mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev2
This commit is contained in:
@@ -317,7 +317,8 @@ void MqttClient::_loop(MqttClient * c) {
|
||||
|
||||
uint16_t MqttClient::_getNextPacketId() {
|
||||
++_packetId;
|
||||
if (_packetId == 0) ++_packetId;
|
||||
if (_packetId == 0)
|
||||
++_packetId;
|
||||
return _packetId;
|
||||
}
|
||||
|
||||
@@ -333,7 +334,7 @@ int MqttClient::_sendPacket() {
|
||||
EMC_SEMAPHORE_TAKE();
|
||||
OutgoingPacket * packet = _outbox.getCurrent();
|
||||
|
||||
size_t written = 0;
|
||||
size_t written = 0;
|
||||
if (packet) {
|
||||
size_t wantToWrite = packet->packet.available(_bytesSent);
|
||||
if (wantToWrite == 0) {
|
||||
@@ -498,12 +499,12 @@ void MqttClient::_onConnack() {
|
||||
}
|
||||
|
||||
void MqttClient::_onPublish() {
|
||||
espMqttClientInternals::IncomingPacket p = _parser.getPacket();
|
||||
uint8_t qos = p.qos();
|
||||
bool retain = p.retain();
|
||||
bool dup = p.dup();
|
||||
uint16_t packetId = p.variableHeader.fixed.packetId;
|
||||
bool callback = true;
|
||||
const espMqttClientInternals::IncomingPacket & p = _parser.getPacket();
|
||||
uint8_t qos = p.qos();
|
||||
bool retain = p.retain();
|
||||
bool dup = p.dup();
|
||||
uint16_t packetId = p.variableHeader.fixed.packetId;
|
||||
bool callback = true;
|
||||
if (qos == 1) {
|
||||
if (p.payload.index + p.payload.length == p.payload.total) {
|
||||
EMC_SEMAPHORE_TAKE();
|
||||
|
||||
@@ -110,7 +110,12 @@ void MqttSettingsService::setWill(const char * topic) {
|
||||
static_cast<espMqttClient *>(_mqttClient)->setWill(topic, 1, true, "offline");
|
||||
}
|
||||
|
||||
void MqttSettingsService::onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total) {
|
||||
void MqttSettingsService::onMqttMessage(const espMqttClientTypes::MessageProperties & properties,
|
||||
const char * topic,
|
||||
const uint8_t * payload,
|
||||
size_t len,
|
||||
size_t index,
|
||||
size_t total) {
|
||||
emsesp::EMSESP::mqtt_.on_message(topic, payload, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,8 @@ class MqttSettingsService : public StatefulService<MqttSettings> {
|
||||
void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||
void onMqttConnect(bool sessionPresent);
|
||||
void onMqttDisconnect(espMqttClientTypes::DisconnectReason reason);
|
||||
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total);
|
||||
void
|
||||
onMqttMessage(const espMqttClientTypes::MessageProperties & properties, const char * topic, const uint8_t * payload, size_t len, size_t index, size_t total);
|
||||
bool configureMqtt();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user