diff --git a/sdk/OpenW600 b/sdk/OpenW600 index 6d8d2e4da..7e7a22d55 160000 --- a/sdk/OpenW600 +++ b/sdk/OpenW600 @@ -1 +1 @@ -Subproject commit 6d8d2e4dabd89531768d671ef0d3c01fa477d3c8 +Subproject commit 7e7a22d5541d82bad911540235682ec56714927d diff --git a/sdk/OpenW800 b/sdk/OpenW800 index cb8826eac..a668aef9c 160000 --- a/sdk/OpenW800 +++ b/sdk/OpenW800 @@ -1 +1 @@ -Subproject commit cb8826eac07138fef502c05026374ed1601d30e6 +Subproject commit a668aef9c3884cf816df5a8d46eaf288fc82e7d5 diff --git a/sdk/OpenXR809 b/sdk/OpenXR809 index 8aa48c055..cac4a2139 160000 --- a/sdk/OpenXR809 +++ b/sdk/OpenXR809 @@ -1 +1 @@ -Subproject commit 8aa48c055f6ac0174414a731b2aeee0c23e1e696 +Subproject commit cac4a2139605edf4aa7ef94bdcfdc21c172dae13 diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 67a46cc43..0c4eee3ce 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -1960,13 +1960,13 @@ int http_fn_cm(http_request_t* request) { if (long_str_alloced) { http_getArg(request->url, "cmnd", long_str_alloced, commandLen); CMD_ExecuteCommand(long_str_alloced, COMMAND_FLAG_SOURCE_HTTP); - JSON_ProcessCommandReply(long_str_alloced, request, hprintf255, COMMAND_FLAG_SOURCE_HTTP); + JSON_ProcessCommandReply(long_str_alloced, request, (jsonCb_t)hprintf255, COMMAND_FLAG_SOURCE_HTTP); free(long_str_alloced); } } else { CMD_ExecuteCommand(tmpA, COMMAND_FLAG_SOURCE_HTTP); - JSON_ProcessCommandReply(tmpA, request, hprintf255, COMMAND_FLAG_SOURCE_HTTP); + JSON_ProcessCommandReply(tmpA, request, (jsonCb_t)hprintf255, COMMAND_FLAG_SOURCE_HTTP); } } diff --git a/src/httpserver/json_interface.c b/src/httpserver/json_interface.c index a03d3dcc2..e2fa21ff6 100644 --- a/src/httpserver/json_interface.c +++ b/src/httpserver/json_interface.c @@ -558,7 +558,7 @@ int JSON_ProcessCommandReply(const char *cmd, void *request, jsonCb_t printer, i if (!wal_strnicmp(cmd, "POWER", 5)) { printer(request, "{"); - http_tasmota_json_power(request, printer, flags); + http_tasmota_json_power(request, printer); printer(request, "}"); if (flags == COMMAND_FLAG_SOURCE_MQTT) { MQTT_PublishPrinterContentsToStat((struct obk_mqtt_publishReplyPrinter_s *)request, "RESULT"); diff --git a/src/mqtt/new_mqtt.c b/src/mqtt/new_mqtt.c index 4277babe7..50a972d95 100644 --- a/src/mqtt/new_mqtt.c +++ b/src/mqtt/new_mqtt.c @@ -515,9 +515,7 @@ char* MQTT_RemoveClientFromTopic(char* topic) { int channelGet(obk_mqtt_request_t* request) { //int len = request->receivedLen; int channel = 0; - int iValue = 0; char* p; - const char *argument; // we only support here publishes with emtpy value, otherwise we would get into // a loop where we receive a get, and then send get reply with val, and receive our own get @@ -566,11 +564,11 @@ int channelGet(obk_mqtt_request_t* request) { return 0; } - MQTT_ChannelPublish(channel, 0); +MQTT_ChannelPublish(channel, 0); - // return 1 to stop processing callbacks here. - // return 0 to allow later callbacks to process this topic. - return 1; +// return 1 to stop processing callbacks here. +// return 0 to allow later callbacks to process this topic. +return 1; } // this accepts obkXXXXXX//set to receive data to set channels int channelSet(obk_mqtt_request_t* request) { @@ -645,7 +643,7 @@ typedef struct obk_mqtt_publishReplyPrinter_s { int curLen; } obk_mqtt_publishReplyPrinter_t; -void MQTT_PublishPrinterContentsToStat(struct obk_mqtt_publishReplyPrinter_s *printer, const char *statName) { +void MQTT_PublishPrinterContentsToStat(obk_mqtt_publishReplyPrinter_t *printer, const char *statName) { const char *toUse; if (printer->allocated) toUse = printer->allocated; @@ -665,7 +663,11 @@ int mqtt_printf255(obk_mqtt_publishReplyPrinter_t* request, const char* fmt, ... myLen = strlen(tmp); - if (request->curLen + (myLen+2) >= MQTT_STACK_BUFFER_SIZE) { + if (request->curLen + (myLen + 2) >= MQTT_STACK_BUFFER_SIZE) { + if (request->curLen + (myLen + 2) >= MQTT_TOTAL_BUFFER_SIZE) { + // TODO: realloc + return 0; + } // init alloced if needed if (request->allocated == 0) { request->allocated = malloc(MQTT_TOTAL_BUFFER_SIZE); @@ -677,11 +679,12 @@ int mqtt_printf255(obk_mqtt_publishReplyPrinter_t* request, const char* fmt, ... strcat(request->stackBuffer, tmp); } request->curLen += myLen; + return 0; } int tasCmnd(obk_mqtt_request_t* request) { const char *p, *args; - obk_mqtt_publishReplyPrinter_t replyBuilder; + memset(&replyBuilder, 0, sizeof(obk_mqtt_publishReplyPrinter_t)); p = request->topic; // TODO: better @@ -697,7 +700,7 @@ int tasCmnd(obk_mqtt_request_t* request) { // there is a NULL terminating character after payload of MQTT // So we can feed it directly as command CMD_ExecuteCommandArgs(p, args, COMMAND_FLAG_SOURCE_MQTT); - JSON_ProcessCommandReply(p, &replyBuilder, mqtt_printf255, COMMAND_FLAG_SOURCE_MQTT); + JSON_ProcessCommandReply(p, &replyBuilder, (jsonCb_t)mqtt_printf255, COMMAND_FLAG_SOURCE_MQTT); if (replyBuilder.allocated != 0) { free(replyBuilder.allocated); }