|
@@ -5,6 +5,7 @@
|
|
#include "edge/call_log.h"
|
|
#include "edge/call_log.h"
|
|
#include "net/tcp_client.h"
|
|
#include "net/tcp_client.h"
|
|
#include "net/tcp_model.h"
|
|
#include "net/tcp_model.h"
|
|
|
|
+#include "base/strings.hpp"
|
|
|
|
|
|
#include "utils/GpioHelper.h"
|
|
#include "utils/GpioHelper.h"
|
|
#include "utils/TimeHelper.h"
|
|
#include "utils/TimeHelper.h"
|
|
@@ -19,6 +20,7 @@
|
|
static bool sosTimerRegistered = true;
|
|
static bool sosTimerRegistered = true;
|
|
static bool isSleepTimerRegistered = false; // 是否开启息屏定时任务
|
|
static bool isSleepTimerRegistered = false; // 是否开启息屏定时任务
|
|
static bool isSleep = false; // 是否在息屏
|
|
static bool isSleep = false; // 是否在息屏
|
|
|
|
+static string sosTid = "";
|
|
#define HELP_TIMER_HANDLE 3 // 增援的定时器id
|
|
#define HELP_TIMER_HANDLE 3 // 增援的定时器id
|
|
#define SOS_CLICK_TIME_HANDLE 4 // sos的定时器id
|
|
#define SOS_CLICK_TIME_HANDLE 4 // sos的定时器id
|
|
#define SOS_LAMP_TIME_HANDLE 5 // sos的门灯定时器id
|
|
#define SOS_LAMP_TIME_HANDLE 5 // sos的门灯定时器id
|
|
@@ -484,7 +486,10 @@ void handleMsg(byte* inBytes){
|
|
if (callback.tid != "0"){
|
|
if (callback.tid != "0"){
|
|
callback.onFalied(tcpModel.json);
|
|
callback.onFalied(tcpModel.json);
|
|
}
|
|
}
|
|
- callActivityFinish(CallFinishType::FAILED);
|
|
|
|
|
|
+
|
|
|
|
+ if (tcpModel.tid != sosTid){
|
|
|
|
+ callActivityFinish(CallFinishType::FAILED);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -646,6 +651,7 @@ static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
|
|
{2, 30*1000}
|
|
{2, 30*1000}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 当界面构造时触发
|
|
* 当界面构造时触发
|
|
*/
|
|
*/
|
|
@@ -668,6 +674,7 @@ static void onUI_init(){
|
|
//监听SIP信令
|
|
//监听SIP信令
|
|
GetTelephone()->AddCallStateListener(OnCallStateChanged);
|
|
GetTelephone()->AddCallStateListener(OnCallStateChanged);
|
|
|
|
|
|
|
|
+
|
|
//请求版本号
|
|
//请求版本号
|
|
// if(UartContext::Uart3IsOpen()) {
|
|
// if(UartContext::Uart3IsOpen()) {
|
|
// string heartStr = "ASK,VNF-0";
|
|
// string heartStr = "ASK,VNF-0";
|
|
@@ -824,11 +831,11 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
|
|
tcpModel.type = TcpType::SOS;
|
|
tcpModel.type = TcpType::SOS;
|
|
tcpModel.action = SosAction::CALL;
|
|
tcpModel.action = SosAction::CALL;
|
|
tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
|
|
tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
|
|
|
|
+ tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
|
|
std::string req = getTcpModelString(tcpModel);
|
|
std::string req = getTcpModelString(tcpModel);
|
|
LOGD("TCP SOS_CALL : %s",req.c_str());
|
|
LOGD("TCP SOS_CALL : %s",req.c_str());
|
|
TcpClient::instance()->sendMsg(req.c_str());
|
|
TcpClient::instance()->sendMsg(req.c_str());
|
|
|
|
|
|
-
|
|
|
|
// SOS亮红灯
|
|
// SOS亮红灯
|
|
heartStr = "ULED,1F";
|
|
heartStr = "ULED,1F";
|
|
// 门灯亮红灯
|
|
// 门灯亮红灯
|
|
@@ -836,6 +843,7 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
|
|
const char* sendMsg2 = heartStr2.c_str();
|
|
const char* sendMsg2 = heartStr2.c_str();
|
|
sendProtocolTo(UART_TTYS2, (byte*)(sendMsg2), strlen(sendMsg2));
|
|
sendProtocolTo(UART_TTYS2, (byte*)(sendMsg2), strlen(sendMsg2));
|
|
|
|
|
|
|
|
+ sosTid = tcpModel.tid;
|
|
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分钟后才能触发
|