mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2025-10-29 19:43:22 +00:00
publishDriver command
This commit is contained in:
parent
81d5ffa396
commit
9748043ce8
@ -1629,6 +1629,21 @@ commandResult_t MQTT_PublishCommandFloat(const void* context, const char* cmd, c
|
|||||||
|
|
||||||
return CMD_RES_OK;
|
return CMD_RES_OK;
|
||||||
}
|
}
|
||||||
|
commandResult_t MQTT_PublishCommandDriver(const void* context, const char* cmd, const char* args, int cmdFlags) {
|
||||||
|
const char* driver;
|
||||||
|
OBK_Publish_Result ret;
|
||||||
|
|
||||||
|
Tokenizer_TokenizeString(args, 0);
|
||||||
|
|
||||||
|
driver = Tokenizer_GetArg(0);
|
||||||
|
bool bOn = DRV_IsRunning(driver);
|
||||||
|
|
||||||
|
char full[32];
|
||||||
|
sprintf(full,"driver/%s", driver);
|
||||||
|
ret = MQTT_PublishMain_StringInt(full, bOn, OBK_PUBLISH_FLAG_FORCE_REMOVE_GET);
|
||||||
|
|
||||||
|
return CMD_RES_OK;
|
||||||
|
}
|
||||||
/****************************************************************************************************
|
/****************************************************************************************************
|
||||||
*
|
*
|
||||||
****************************************************************************************************/
|
****************************************************************************************************/
|
||||||
@ -1976,6 +1991,9 @@ void MQTT_init()
|
|||||||
//cmddetail:"examples":""}
|
//cmddetail:"examples":""}
|
||||||
CMD_RegisterCommand("publishFile", MQTT_PublishFile, NULL);
|
CMD_RegisterCommand("publishFile", MQTT_PublishFile, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
CMD_RegisterCommand("publishDriver", MQTT_PublishCommandDriver, NULL);
|
||||||
}
|
}
|
||||||
static float getInternalTemperature() {
|
static float getInternalTemperature() {
|
||||||
return g_wifi_temperature;
|
return g_wifi_temperature;
|
||||||
|
|||||||
@ -527,6 +527,20 @@ void Test_MQTT_Misc() {
|
|||||||
SELFTEST_ASSERT_HAD_MQTT_PUBLISH_FLOAT("miscDevice/mySecond/get", 12.3f, false);
|
SELFTEST_ASSERT_HAD_MQTT_PUBLISH_FLOAT("miscDevice/mySecond/get", 12.3f, false);
|
||||||
SIM_ClearMQTTHistory();
|
SIM_ClearMQTTHistory();
|
||||||
|
|
||||||
|
CMD_ExecuteCommand("publishDriver DDP", 0);
|
||||||
|
SELFTEST_ASSERT_HAD_MQTT_PUBLISH_FLOAT("miscDevice/driver/DDP", 0, false);
|
||||||
|
SIM_ClearMQTTHistory();
|
||||||
|
|
||||||
|
CMD_ExecuteCommand("startDriver DDP", 0);
|
||||||
|
CMD_ExecuteCommand("publishDriver DDP", 0);
|
||||||
|
SELFTEST_ASSERT_HAD_MQTT_PUBLISH_FLOAT("miscDevice/driver/DDP", 1, false);
|
||||||
|
SIM_ClearMQTTHistory();
|
||||||
|
|
||||||
|
CMD_ExecuteCommand("stopDriver DDP", 0);
|
||||||
|
CMD_ExecuteCommand("publishDriver DDP", 0);
|
||||||
|
SELFTEST_ASSERT_HAD_MQTT_PUBLISH_FLOAT("miscDevice/driver/DDP", 0, false);
|
||||||
|
SIM_ClearMQTTHistory();
|
||||||
|
|
||||||
//SIM_SendFakeMQTTAndRunSimFrame_CMND("setChannel", "3 100");
|
//SIM_SendFakeMQTTAndRunSimFrame_CMND("setChannel", "3 100");
|
||||||
//CMD_ExecuteCommand("addEventHandler OnChannelChange 7 publishFloat thirdTest $CH7*0.01+$CH3", 0);
|
//CMD_ExecuteCommand("addEventHandler OnChannelChange 7 publishFloat thirdTest $CH7*0.01+$CH3", 0);
|
||||||
//// set channel 7 to 31.4 and see what we get
|
//// set channel 7 to 31.4 and see what we get
|
||||||
|
|||||||
@ -166,6 +166,9 @@ void SIM_ClearOBK(const char *flashPath) {
|
|||||||
Main_Init();
|
Main_Init();
|
||||||
}
|
}
|
||||||
void Win_DoUnitTests() {
|
void Win_DoUnitTests() {
|
||||||
|
//SELFTEST_ASSERT_EXPRESSION("sqrt(4)", 2)
|
||||||
|
|
||||||
|
|
||||||
Test_Driver_TCL_AC();
|
Test_Driver_TCL_AC();
|
||||||
|
|
||||||
Test_PIR();
|
Test_PIR();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user