|
@@ -183,6 +183,8 @@ void handleMsg(byte* inBytes){
|
|
|
EASYUICONTEXT->openActivity("DeviceUpdateActivity", intent);
|
|
|
}
|
|
|
else if (tcpModel.action == DeviceAction::RESTART) { // 重启设备
|
|
|
+ //TCP启动
|
|
|
+ TcpClient::instance()->closeTcp();
|
|
|
sync();
|
|
|
reboot(RB_AUTOBOOT);
|
|
|
}
|
|
@@ -300,7 +302,6 @@ void handleMsg(byte* inBytes){
|
|
|
EASYUICONTEXT->goBack();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
|
|
|
std::string heartStr;
|
|
|
if (color != "" && color.size() == 3) {
|
|
@@ -311,7 +312,6 @@ void handleMsg(byte* inBytes){
|
|
|
const char* sendMsg = heartStr.c_str();
|
|
|
sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
|
|
|
-
|
|
|
// 删除这个定时器
|
|
|
mActivityPtr->unregisterUserTimer(NURSING_TIME_HANDLE);
|
|
|
LOGD("收到服务器返回的消息,关闭Nursing的定时器");
|
|
@@ -331,18 +331,46 @@ void handleMsg(byte* inBytes){
|
|
|
sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
}
|
|
|
else if (tcpModel.action == SideAction::ACCEPT) {
|
|
|
- // 收到ACCEPT,需要灭灯
|
|
|
- // 还原成无灯光的状态
|
|
|
- std::string heartStr = "DOORLED,000F";
|
|
|
- const char* sendMsg = heartStr.c_str();
|
|
|
- sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ // 如果还在护理状态,则变回护理灯
|
|
|
+ if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {
|
|
|
+ std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
|
|
|
+ std::string heartStr;
|
|
|
+ if (color != "" && color.size() == 3) {
|
|
|
+ heartStr = "DOORLED," + color + "F";
|
|
|
+ } else {
|
|
|
+ heartStr = "DOORLED,010F";
|
|
|
+ }
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 收到ACCEPT,需要灭灯
|
|
|
+ // 还原成无灯光的状态
|
|
|
+ std::string heartStr = "DOORLED,000F";
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ }
|
|
|
}
|
|
|
else if (tcpModel.action == SideAction::CANCEL) {
|
|
|
- // 收到CANCEL,需要灭灯
|
|
|
- // 还原成无灯光的状态
|
|
|
- std::string heartStr = "DOORLED,000F";
|
|
|
- const char* sendMsg = heartStr.c_str();
|
|
|
- sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ // 如果还在护理状态,则变回护理灯
|
|
|
+ if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {
|
|
|
+ std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
|
|
|
+ std::string heartStr;
|
|
|
+ if (color != "" && color.size() == 3) {
|
|
|
+ heartStr = "DOORLED," + color + "F";
|
|
|
+ } else {
|
|
|
+ heartStr = "DOORLED,010F";
|
|
|
+ }
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 收到CANCEL,需要灭灯
|
|
|
+ // 还原成无灯光的状态
|
|
|
+ std::string heartStr = "DOORLED,000F";
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ }
|
|
|
}
|
|
|
else if (tcpModel.action == SideAction::SOS_CALL) {
|
|
|
// 收到SOS_CALL,需要亮红灯
|
|
@@ -358,11 +386,25 @@ void handleMsg(byte* inBytes){
|
|
|
mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
|
|
|
}
|
|
|
else if (tcpModel.action == SideAction::SOS_CANCEL) {
|
|
|
- // 收到SOS_CANCEL,需要灭灯
|
|
|
- // 还原成无灯光的状态
|
|
|
- std::string heartStr = "DOORLED,000F";
|
|
|
- const char* sendMsg = heartStr.c_str();
|
|
|
- sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ // 如果还在护理状态,则变回护理灯
|
|
|
+ if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {
|
|
|
+ std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
|
|
|
+ std::string heartStr;
|
|
|
+ if (color != "" && color.size() == 3) {
|
|
|
+ heartStr = "DOORLED," + color + "F";
|
|
|
+ } else {
|
|
|
+ heartStr = "DOORLED,010F";
|
|
|
+ }
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 收到SOS_CANCEL,需要灭灯
|
|
|
+ // 还原成无灯光的状态
|
|
|
+ std::string heartStr = "DOORLED,000F";
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if (tcpModel.type == TcpType::CALLBACK) {
|