|
@@ -48,6 +48,8 @@ static bool isTriggerHandle4 = false;
|
|
#define SLEEP_STRAT_TIME_HANDLE 9 // 息屏
|
|
#define SLEEP_STRAT_TIME_HANDLE 9 // 息屏
|
|
#define SYS_RESTART_TIME_HANDLE 10 // 重启
|
|
#define SYS_RESTART_TIME_HANDLE 10 // 重启
|
|
#define PROMPT_TIME_HANDLE 11 // 提示语
|
|
#define PROMPT_TIME_HANDLE 11 // 提示语
|
|
|
|
+#define NURSEING_TIME_HANDLE 12 // 护理
|
|
|
|
+#define DOOR_LIGHT_TIME_HANDLE 13 // 门灯
|
|
|
|
|
|
#define HANDLE_TRIGGER_TIME_HANDLE 15
|
|
#define HANDLE_TRIGGER_TIME_HANDLE 15
|
|
#define SOS_TRIGGER_TIME_HANDLE 16
|
|
#define SOS_TRIGGER_TIME_HANDLE 16
|
|
@@ -203,7 +205,11 @@ void systemRestart() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// 门灯还原
|
|
|
|
|
|
+
|
|
|
|
+string _typeStr;
|
|
|
|
+string _lightColorStr;
|
|
|
|
+string _actualColorStr;
|
|
|
|
+bool isDoorLightTimeHandle = false;
|
|
void lightControl(std::string typeStr, std::string lightColorStr) {
|
|
void lightControl(std::string typeStr, std::string lightColorStr) {
|
|
// 类型是门灯,并且还原成白色灯
|
|
// 类型是门灯,并且还原成白色灯
|
|
std::string heartStr;
|
|
std::string heartStr;
|
|
@@ -225,10 +231,29 @@ void lightControl(std::string typeStr, std::string lightColorStr) {
|
|
heartStr = typeStr + "," + lightColorStr;
|
|
heartStr = typeStr + "," + lightColorStr;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (typeStr == "DOORLED" && isDoorLightTimeHandle) {
|
|
|
|
+ isDoorLightTimeHandle = false;
|
|
|
|
+ mActivityPtr->unregisterUserTimer(DOOR_LIGHT_TIME_HANDLE);
|
|
|
|
+ }
|
|
|
|
+
|
|
LOGD("=====> the heartStr == %s", heartStr.c_str());
|
|
LOGD("=====> the heartStr == %s", heartStr.c_str());
|
|
const char* sendMsg = heartStr.c_str();
|
|
const char* sendMsg = heartStr.c_str();
|
|
sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
|
+}
|
|
|
|
|
|
|
|
+void lightControl(std::string typeStr, std::string lightColorStr, int time) {
|
|
|
|
+ LOGD("频率闪烁,类型:%s,颜色:%s,频率:%d", typeStr.c_str(), lightColorStr.c_str(), time);
|
|
|
|
+ _typeStr = typeStr;
|
|
|
|
+ _lightColorStr = lightColorStr;
|
|
|
|
+ _actualColorStr = lightColorStr;
|
|
|
|
+ // 还原成无灯光的状态
|
|
|
|
+ std::string heartStr = typeStr + "," + lightColorStr;
|
|
|
|
+ LOGD("=====> the heartStr == %s", heartStr.c_str());
|
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
|
+
|
|
|
|
+ isDoorLightTimeHandle = true;
|
|
|
|
+ mActivityPtr->registerUserTimer(DOOR_LIGHT_TIME_HANDLE, time);
|
|
}
|
|
}
|
|
|
|
|
|
// 接收tcp消息
|
|
// 接收tcp消息
|
|
@@ -351,7 +376,7 @@ void handleMsg(byte* inBytes){
|
|
} else if (tcpModel.action == VoiceAction::SUCCESS){
|
|
} else if (tcpModel.action == VoiceAction::SUCCESS){
|
|
CallingStatus::instance()->setTcpModel(tcpModel); // 只有呼叫成功才闪红灯
|
|
CallingStatus::instance()->setTcpModel(tcpModel); // 只有呼叫成功才闪红灯
|
|
|
|
|
|
- lightControl("DOORLED", "200F");
|
|
|
|
|
|
+ lightControl("DOORLED", "100F");
|
|
} else if (tcpModel.action == VoiceAction::ACCEPT){
|
|
} else if (tcpModel.action == VoiceAction::ACCEPT){
|
|
if (CallingStatus::instance()->busy()){
|
|
if (CallingStatus::instance()->busy()){
|
|
CallingStatus::instance()->setTcpModel(tcpModel);
|
|
CallingStatus::instance()->setTcpModel(tcpModel);
|
|
@@ -384,6 +409,7 @@ void handleMsg(byte* inBytes){
|
|
if (CallingStatus::instance()->busy()){
|
|
if (CallingStatus::instance()->busy()){
|
|
sendVoiceTcp(VoiceAction::CALLING, tcpModel, tcpModel.from_id);
|
|
sendVoiceTcp(VoiceAction::CALLING, tcpModel, tcpModel.from_id);
|
|
} else {
|
|
} else {
|
|
|
|
+ lightControl("DOORLED", "200F");
|
|
|
|
|
|
CallingStatus::instance()->setTcpModel(tcpModel);
|
|
CallingStatus::instance()->setTcpModel(tcpModel);
|
|
|
|
|
|
@@ -409,7 +435,9 @@ void handleMsg(byte* inBytes){
|
|
lightControl("ULED", "0F");
|
|
lightControl("ULED", "0F");
|
|
// 进行门灯还原
|
|
// 进行门灯还原
|
|
lightControl("DOORLED", "000F");
|
|
lightControl("DOORLED", "000F");
|
|
- mActivityPtr->unregisterUserTimer(SOS_LAMP_TIME_HANDLE);
|
|
|
|
|
|
+
|
|
|
|
+ statusLight();
|
|
|
|
+// mActivityPtr->unregisterUserTimer(SOS_LAMP_TIME_HANDLE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (tcpModel.type == TcpType::SIDE) {
|
|
else if (tcpModel.type == TcpType::SIDE) {
|
|
@@ -447,7 +475,7 @@ void handleMsg(byte* inBytes){
|
|
}
|
|
}
|
|
else if (tcpModel.action == SideAction::CALL) {
|
|
else if (tcpModel.action == SideAction::CALL) {
|
|
// 收到CALL,需要亮红灯
|
|
// 收到CALL,需要亮红灯
|
|
- lightControl("DOORLED", "200F");
|
|
|
|
|
|
+// lightControl("DOORLED", "200F");
|
|
}
|
|
}
|
|
else if (tcpModel.action == SideAction::ACCEPT) {
|
|
else if (tcpModel.action == SideAction::ACCEPT) {
|
|
// 进行门灯还原
|
|
// 进行门灯还原
|
|
@@ -473,13 +501,13 @@ void handleMsg(byte* inBytes){
|
|
else if (tcpModel.action == SideAction::SOS_CALL) {
|
|
else if (tcpModel.action == SideAction::SOS_CALL) {
|
|
// 收到SOS_CALL,需要亮红灯
|
|
// 收到SOS_CALL,需要亮红灯
|
|
// 门灯亮红灯
|
|
// 门灯亮红灯
|
|
- lightControl("DOORLED", "200F");
|
|
|
|
|
|
+ lightControl("DOORLED", "100F", 1000);
|
|
|
|
|
|
lightControl("CALLLED", "100F");
|
|
lightControl("CALLLED", "100F");
|
|
|
|
|
|
sosTimerRegistered = false;
|
|
sosTimerRegistered = false;
|
|
mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
|
|
mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
|
|
- mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
|
|
|
|
|
|
+// mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
|
|
|
|
|
|
if (tcpModel.json.isMember("id")) {
|
|
if (tcpModel.json.isMember("id")) {
|
|
sosDataList.push_back(tcpModel.json["id"].asString());
|
|
sosDataList.push_back(tcpModel.json["id"].asString());
|
|
@@ -644,13 +672,13 @@ void sosCall(string sosMsg) {
|
|
// SOS亮红灯
|
|
// SOS亮红灯
|
|
lightControl("ULED", "1F");
|
|
lightControl("ULED", "1F");
|
|
// 门灯亮红灯
|
|
// 门灯亮红灯
|
|
- lightControl("DOORLED", "200F");
|
|
|
|
|
|
+ lightControl("DOORLED", "100F", 1000);
|
|
|
|
|
|
lightControl("CALLLED", "100F");
|
|
lightControl("CALLLED", "100F");
|
|
|
|
|
|
sosTimerRegistered = false;
|
|
sosTimerRegistered = false;
|
|
mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
|
|
mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
|
|
- mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
|
|
|
|
|
|
+// mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -907,7 +935,10 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
|
|
//拨打 或 挂断
|
|
//拨打 或 挂断
|
|
if (CallingStatus::instance()->busy()){
|
|
if (CallingStatus::instance()->busy()){
|
|
callActivityFinish(CallFinishType::A1CLICK);
|
|
callActivityFinish(CallFinishType::A1CLICK);
|
|
|
|
+ lightControl("DOORLED", "000F");
|
|
} else {
|
|
} else {
|
|
|
|
+ lightControl("DOORLED", "100F");
|
|
|
|
+
|
|
Intent* intent = new Intent();
|
|
Intent* intent = new Intent();
|
|
intent->putExtra(isOutgoing, "true");
|
|
intent->putExtra(isOutgoing, "true");
|
|
EASYUICONTEXT->openActivity("callActivity", intent);
|
|
EASYUICONTEXT->openActivity("callActivity", intent);
|
|
@@ -944,7 +975,10 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
|
|
//拨打 或 挂断
|
|
//拨打 或 挂断
|
|
if (CallingStatus::instance()->busy()){
|
|
if (CallingStatus::instance()->busy()){
|
|
callActivityFinish(CallFinishType::KEY6_CLICK);
|
|
callActivityFinish(CallFinishType::KEY6_CLICK);
|
|
|
|
+ lightControl("DOORLED", "000F");
|
|
} else {
|
|
} else {
|
|
|
|
+ lightControl("DOORLED", "100F");
|
|
|
|
+
|
|
Intent* intent = new Intent();
|
|
Intent* intent = new Intent();
|
|
intent->putExtra(isOutgoing, "true");
|
|
intent->putExtra(isOutgoing, "true");
|
|
EASYUICONTEXT->openActivity("callActivity", intent);
|
|
EASYUICONTEXT->openActivity("callActivity", intent);
|
|
@@ -983,17 +1017,7 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
|
|
else if (data.state == "1") {
|
|
else if (data.state == "1") {
|
|
if (isTriggerSos) {
|
|
if (isTriggerSos) {
|
|
isConnectSos = true;
|
|
isConnectSos = true;
|
|
- sendSosCall("");
|
|
|
|
-
|
|
|
|
- // SOS亮红灯
|
|
|
|
- lightControl("ULED", "1F");
|
|
|
|
- // 门灯亮红灯
|
|
|
|
- lightControl("DOORLED", "200F");
|
|
|
|
-
|
|
|
|
- lightControl("CALLLED", "100F");
|
|
|
|
-
|
|
|
|
- mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
|
|
|
|
- mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
|
|
|
|
|
|
+ sosCall("");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (data.state == "3") {
|
|
else if (data.state == "3") {
|
|
@@ -1211,7 +1235,25 @@ static bool onUI_Timer(int id){
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+ case DOOR_LIGHT_TIME_HANDLE: {
|
|
|
|
+ if (_lightColorStr == _actualColorStr) {
|
|
|
|
+ _actualColorStr = "000F";
|
|
|
|
+
|
|
|
|
+ std::string heartStr = _typeStr + "," + _actualColorStr;
|
|
|
|
+ LOGD("=====> the heartStr == %s", heartStr.c_str());
|
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _actualColorStr = _lightColorStr;
|
|
|
|
|
|
|
|
+ std::string heartStr = _typeStr + "," + _actualColorStr;
|
|
|
|
+ LOGD("=====> the heartStr == %s", heartStr.c_str());
|
|
|
|
+ const char* sendMsg = heartStr.c_str();
|
|
|
|
+ sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
case SLEEP_STRAT_TIME_HANDLE: { // 息屏
|
|
case SLEEP_STRAT_TIME_HANDLE: { // 息屏
|
|
if (isSleepTimerRegistered) {
|
|
if (isSleepTimerRegistered) {
|
|
isSleep = true;
|
|
isSleep = true;
|