瀏覽代碼

增加电源控制,增加服务器端口设置

vothin 1 年之前
父節點
當前提交
119c83c71a

+ 2 - 0
i18n/zh_CN.tr

@@ -110,6 +110,8 @@
     <string name="DownloadFailed">下载错误,错误码</string>
     <string name="PasswordText">3位密码</string>
     <string name="PasswordInput">输入密码</string>
+    <string name="RebootDevice">重启本机</string>
+    <string name="RebootPower">重启线路电源</string>
     <!-- 通话界面 -->
     <string name="RemoteRefuse">对方拒绝</string>
     <string name="RemoteBusy">对方忙线</string>

+ 41 - 34
jni/activity/ui3Activity.cpp

@@ -4,11 +4,18 @@
 #include "ui3Activity.h"
 
 /*TAG:GlobalVariable全局变量*/
-static ZKTextView* mTestErrorTextViewPtr;
-static ZKButton* mTestConfirmButtonPtr;
-static ZKTextView* mTestPasswordTextViewPtr;
-static ZKEditText* mTestPasswordEditTextPtr;
-static ZKWindow* mTestPasswordWindowPtr;
+static ZKTextView* mTextViewServerPortPtr;
+static ZKEditText* mEditTextServerPortPtr;
+static ZKButton* mRebootPowerButtonPtr;
+static ZKButton* mRebootDeviceButtonPtr;
+static ZKTextView* mRebbotPowerTextViewPtr;
+static ZKTextView* mRebootDeviceTextViewPtr;
+static ZKWindow* mRebootWindowPtr;
+static ZKTextView* mErrorTextViewPtr;
+static ZKButton* mConfirmButtonPtr;
+static ZKTextView* mPasswordTextViewPtr;
+static ZKEditText* mPasswordEditTextPtr;
+static ZKWindow* mPasswordWindowPtr;
 static ZKButton* mTestButtonPtr;
 static ZKPainter* mUi3PainterPtr;
 static ZKButton* msys_backPtr;
@@ -19,7 +26,6 @@ static ZKTextView* mServerIPPtr;
 static ZKTextView* mTextView7Ptr;
 static ZKTextView* mTextView10Ptr;
 static ZKTextView* mDeviceCodePtr;
-static ZKTextView* mTextPwdInfoPtr;
 static ZKButton* mBtnRestartPtr;
 static ZKTextView* mTextView12Ptr;
 static ZKTextView* mGatewayPtr;
@@ -30,10 +36,6 @@ static ZKButton* mBtnServerIPConfirmPtr;
 static ZKTextView* mTextView6Ptr;
 static ZKEditText* mEditTextServerIPPtr;
 static ZKWindow* mWindowServerIPPtr;
-static ZKWindow* mWindowPwdPtr;
-static ZKButton* mBtnPwdConfirmPtr;
-static ZKTextView* mTextView2Ptr;
-static ZKEditText* mEditTextPwdPtr;
 static ZKButton* mSettingPtr;
 static ZKTextView* mTextView4Ptr;
 static ZKTextView* mDeviceIpPtr;
@@ -84,14 +86,15 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
-    ID_UI3_TestConfirmButton, onButtonClick_TestConfirmButton,
+    ID_UI3_RebootPowerButton, onButtonClick_RebootPowerButton,
+    ID_UI3_RebootDeviceButton, onButtonClick_RebootDeviceButton,
+    ID_UI3_ConfirmButton, onButtonClick_ConfirmButton,
     ID_UI3_TestButton, onButtonClick_TestButton,
     ID_UI3_sys_back, onButtonClick_sys_back,
     ID_UI3_BtnSoftVer, onButtonClick_BtnSoftVer,
     ID_UI3_BtnNetSetting, onButtonClick_BtnNetSetting,
     ID_UI3_BtnRestart, onButtonClick_BtnRestart,
     ID_UI3_BtnServerIPConfirm, onButtonClick_BtnServerIPConfirm,
-    ID_UI3_BtnPwdConfirm, onButtonClick_BtnPwdConfirm,
     ID_UI3_Setting, onButtonClick_Setting,
 };
 /***************/
@@ -138,9 +141,9 @@ typedef struct {
 }S_EditTextInputCallback;
 /*TAG:EditTextInputCallback*/
 static S_EditTextInputCallback SEditTextInputCallbackTab[] = {
-    ID_UI3_TestPasswordEditText, onEditTextChanged_TestPasswordEditText,
+    ID_UI3_EditTextServerPort, onEditTextChanged_EditTextServerPort,
+    ID_UI3_PasswordEditText, onEditTextChanged_PasswordEditText,
     ID_UI3_EditTextServerIP, onEditTextChanged_EditTextServerIP,
-    ID_UI3_EditTextPwd, onEditTextChanged_EditTextPwd,
 };
 
 typedef void (*VideoViewCallback)(ZKVideoView *pVideoView, int msg);
@@ -167,11 +170,18 @@ ui3Activity::~ui3Activity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
-    mTestErrorTextViewPtr = NULL;
-    mTestConfirmButtonPtr = NULL;
-    mTestPasswordTextViewPtr = NULL;
-    mTestPasswordEditTextPtr = NULL;
-    mTestPasswordWindowPtr = NULL;
+    mTextViewServerPortPtr = NULL;
+    mEditTextServerPortPtr = NULL;
+    mRebootPowerButtonPtr = NULL;
+    mRebootDeviceButtonPtr = NULL;
+    mRebbotPowerTextViewPtr = NULL;
+    mRebootDeviceTextViewPtr = NULL;
+    mRebootWindowPtr = NULL;
+    mErrorTextViewPtr = NULL;
+    mConfirmButtonPtr = NULL;
+    mPasswordTextViewPtr = NULL;
+    mPasswordEditTextPtr = NULL;
+    mPasswordWindowPtr = NULL;
     mTestButtonPtr = NULL;
     mUi3PainterPtr = NULL;
     msys_backPtr = NULL;
@@ -182,7 +192,6 @@ ui3Activity::~ui3Activity() {
     mTextView7Ptr = NULL;
     mTextView10Ptr = NULL;
     mDeviceCodePtr = NULL;
-    mTextPwdInfoPtr = NULL;
     mBtnRestartPtr = NULL;
     mTextView12Ptr = NULL;
     mGatewayPtr = NULL;
@@ -193,10 +202,6 @@ ui3Activity::~ui3Activity() {
     mTextView6Ptr = NULL;
     mEditTextServerIPPtr = NULL;
     mWindowServerIPPtr = NULL;
-    mWindowPwdPtr = NULL;
-    mBtnPwdConfirmPtr = NULL;
-    mTextView2Ptr = NULL;
-    mEditTextPwdPtr = NULL;
     mSettingPtr = NULL;
     mTextView4Ptr = NULL;
     mDeviceIpPtr = NULL;
@@ -220,11 +225,18 @@ const char* ui3Activity::getAppName() const{
 //TAG:onCreate
 void ui3Activity::onCreate() {
 	Activity::onCreate();
-    mTestErrorTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_TestErrorTextView);
-    mTestConfirmButtonPtr = (ZKButton*)findControlByID(ID_UI3_TestConfirmButton);
-    mTestPasswordTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_TestPasswordTextView);
-    mTestPasswordEditTextPtr = (ZKEditText*)findControlByID(ID_UI3_TestPasswordEditText);if(mTestPasswordEditTextPtr!= NULL){mTestPasswordEditTextPtr->setTextChangeListener(this);}
-    mTestPasswordWindowPtr = (ZKWindow*)findControlByID(ID_UI3_TestPasswordWindow);
+    mTextViewServerPortPtr = (ZKTextView*)findControlByID(ID_UI3_TextViewServerPort);
+    mEditTextServerPortPtr = (ZKEditText*)findControlByID(ID_UI3_EditTextServerPort);if(mEditTextServerPortPtr!= NULL){mEditTextServerPortPtr->setTextChangeListener(this);}
+    mRebootPowerButtonPtr = (ZKButton*)findControlByID(ID_UI3_RebootPowerButton);
+    mRebootDeviceButtonPtr = (ZKButton*)findControlByID(ID_UI3_RebootDeviceButton);
+    mRebbotPowerTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_RebbotPowerTextView);
+    mRebootDeviceTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_RebootDeviceTextView);
+    mRebootWindowPtr = (ZKWindow*)findControlByID(ID_UI3_RebootWindow);
+    mErrorTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_ErrorTextView);
+    mConfirmButtonPtr = (ZKButton*)findControlByID(ID_UI3_ConfirmButton);
+    mPasswordTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_PasswordTextView);
+    mPasswordEditTextPtr = (ZKEditText*)findControlByID(ID_UI3_PasswordEditText);if(mPasswordEditTextPtr!= NULL){mPasswordEditTextPtr->setTextChangeListener(this);}
+    mPasswordWindowPtr = (ZKWindow*)findControlByID(ID_UI3_PasswordWindow);
     mTestButtonPtr = (ZKButton*)findControlByID(ID_UI3_TestButton);
     mUi3PainterPtr = (ZKPainter*)findControlByID(ID_UI3_Ui3Painter);
     msys_backPtr = (ZKButton*)findControlByID(ID_UI3_sys_back);
@@ -235,7 +247,6 @@ void ui3Activity::onCreate() {
     mTextView7Ptr = (ZKTextView*)findControlByID(ID_UI3_TextView7);
     mTextView10Ptr = (ZKTextView*)findControlByID(ID_UI3_TextView10);
     mDeviceCodePtr = (ZKTextView*)findControlByID(ID_UI3_DeviceCode);
-    mTextPwdInfoPtr = (ZKTextView*)findControlByID(ID_UI3_TextPwdInfo);
     mBtnRestartPtr = (ZKButton*)findControlByID(ID_UI3_BtnRestart);
     mTextView12Ptr = (ZKTextView*)findControlByID(ID_UI3_TextView12);
     mGatewayPtr = (ZKTextView*)findControlByID(ID_UI3_Gateway);
@@ -246,10 +257,6 @@ void ui3Activity::onCreate() {
     mTextView6Ptr = (ZKTextView*)findControlByID(ID_UI3_TextView6);
     mEditTextServerIPPtr = (ZKEditText*)findControlByID(ID_UI3_EditTextServerIP);if(mEditTextServerIPPtr!= NULL){mEditTextServerIPPtr->setTextChangeListener(this);}
     mWindowServerIPPtr = (ZKWindow*)findControlByID(ID_UI3_WindowServerIP);
-    mWindowPwdPtr = (ZKWindow*)findControlByID(ID_UI3_WindowPwd);
-    mBtnPwdConfirmPtr = (ZKButton*)findControlByID(ID_UI3_BtnPwdConfirm);
-    mTextView2Ptr = (ZKTextView*)findControlByID(ID_UI3_TextView2);
-    mEditTextPwdPtr = (ZKEditText*)findControlByID(ID_UI3_EditTextPwd);if(mEditTextPwdPtr!= NULL){mEditTextPwdPtr->setTextChangeListener(this);}
     mSettingPtr = (ZKButton*)findControlByID(ID_UI3_Setting);
     mTextView4Ptr = (ZKTextView*)findControlByID(ID_UI3_TextView4);
     mDeviceIpPtr = (ZKTextView*)findControlByID(ID_UI3_DeviceIp);

+ 12 - 10
jni/activity/ui3Activity.h

@@ -27,11 +27,18 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
-#define ID_UI3_TestErrorTextView    50026
-#define ID_UI3_TestConfirmButton    20008
-#define ID_UI3_TestPasswordTextView    50025
-#define ID_UI3_TestPasswordEditText    51003
-#define ID_UI3_TestPasswordWindow    110003
+#define ID_UI3_TextViewServerPort    50013
+#define ID_UI3_EditTextServerPort    51001
+#define ID_UI3_RebootPowerButton    20011
+#define ID_UI3_RebootDeviceButton    20009
+#define ID_UI3_RebbotPowerTextView    50028
+#define ID_UI3_RebootDeviceTextView    50027
+#define ID_UI3_RebootWindow    110004
+#define ID_UI3_ErrorTextView    50026
+#define ID_UI3_ConfirmButton    20008
+#define ID_UI3_PasswordTextView    50025
+#define ID_UI3_PasswordEditText    51003
+#define ID_UI3_PasswordWindow    110003
 #define ID_UI3_TestButton    20007
 #define ID_UI3_Ui3Painter    52001
 #define ID_UI3_sys_back   100
@@ -42,7 +49,6 @@
 #define ID_UI3_TextView7    50023
 #define ID_UI3_TextView10    50021
 #define ID_UI3_DeviceCode    50020
-#define ID_UI3_TextPwdInfo    50022
 #define ID_UI3_BtnRestart    20004
 #define ID_UI3_TextView12    50019
 #define ID_UI3_Gateway    50018
@@ -53,10 +59,6 @@
 #define ID_UI3_TextView6    50014
 #define ID_UI3_EditTextServerIP    51002
 #define ID_UI3_WindowServerIP    110002
-#define ID_UI3_WindowPwd    110001
-#define ID_UI3_BtnPwdConfirm    20002
-#define ID_UI3_TextView2    50013
-#define ID_UI3_EditTextPwd    51001
 #define ID_UI3_Setting    20001
 #define ID_UI3_TextView4    50008
 #define ID_UI3_DeviceIp    50007

+ 1 - 0
jni/logic/callLogic.cc

@@ -420,6 +420,7 @@ static bool onUI_Timer(int id){
 	case CALLING_TIME: {
 		//TCP call
 		TcpModel tcpModel;
+		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
 		tcpModel.type = TcpType::VOICE;
 		tcpModel.action = VoiceAction::CANCEL;
 		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);

+ 19 - 0
jni/logic/mainLogic.cc

@@ -4,6 +4,7 @@
 #include "storage/StoragePreferences.h"
 #include "net/net.h"
 #include <system/Thread.h>
+#include <sys/reboot.h>
 #include "restclient-cpp/restclient.h"
 #include "curl/curl.h"
 #include <algorithm>
@@ -92,6 +93,24 @@ public:
 		LOGD("请求服务器信息. url = %s", url.c_str());
 		//发起HTTP GET请求
 		RestClient::Response r = RestClient::get(url);
+		if (r.code != 200) {
+			LOGD("请求服务器信息错误. 错误代码 = %d", r.code);
+
+			string serverIP = StoragePreferences::getString(STORE_GATEWAY, "172.28.100.100");
+			int serverPort = StoragePreferences::getInt(STORE_HTTP_PORT, 8006);
+			LOGD("serverIP ===> %s", serverIP.c_str());
+			LOGD("serverPort ===> %d", serverPort);
+			if (!checkAddr(serverIP) || serverPort == 0) {
+				// http
+				StoragePreferences::putString(STORE_GATEWAY, "172.28.100.100");
+				StoragePreferences::putInt(STORE_HTTP_PORT, 8006);
+
+				//重启
+				sync();
+				reboot(RB_AUTOBOOT);
+			}
+			return;
+		}
 		//解析json
 		Json::Reader reader;
 		Json::Value root;

+ 1 - 0
jni/logic/startLogic.cc

@@ -767,6 +767,7 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 				if (sosTimerRegistered) {
 					LOGD("TCP -> SOS_CALL");
 					TcpModel tcpModel;
+					tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
 					tcpModel.type = TcpType::SOS;
 					tcpModel.action = SosAction::CALL;
 					tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);

+ 99 - 57
jni/logic/ui3Logic.cc

@@ -48,6 +48,9 @@
 * 在Eclipse编辑器中  使用 “alt + /”  快捷键可以打开智能提示
 */
 
+
+static std::string passwordType = "";
+
 using namespace std;
 
 struct NetworkConfiguration {
@@ -229,6 +232,13 @@ const bool checkAddr(string addr)
 //	return true;
 }
 
+static void passwordWindowShow() {
+    mPasswordEditTextPtr->setText("");
+    mErrorTextViewPtr->setText("");
+    mPasswordWindowPtr->showWnd();
+}
+
+
 
 static uint32_t color = 0xFFF84D61;
 static uint32_t redLightColour = 0xFFF9C5C5;
@@ -289,14 +299,12 @@ static void onUI_init(){
 	if (color == redDeepColour) {
 		mUi3PainterPtr->setBackgroundColor(redLightColour);
 		mWindowServerIPPtr->setBackgroundColor(0xFFFF8080);
-		mWindowPwdPtr->setBackgroundColor(0xFFFF8080);
-		mTestPasswordWindowPtr->setBackgroundColor(0xFFFF8080);
+		mPasswordWindowPtr->setBackgroundColor(0xFFFF8080);
 	}
 	else {
 		mUi3PainterPtr->setBackgroundColor(buleLightColour);
 		mWindowServerIPPtr->setBackgroundColor(0xFF92C5EB);
-		mWindowPwdPtr->setBackgroundColor(0xFF92C5EB);
-		mTestPasswordWindowPtr->setBackgroundColor(0xFF92C5EB);
+		mPasswordWindowPtr->setBackgroundColor(0xFF92C5EB);
 	}
 
 	// 界面上
@@ -309,8 +317,7 @@ static void onUI_init(){
 
 	// 窗口上
 	mBtnServerIPConfirmPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, color);
-	mBtnPwdConfirmPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, color);
-	mTestConfirmButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, color);
+	mConfirmButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, color);
 }
 
 /**
@@ -394,39 +401,19 @@ static bool onui3ActivityTouchEvent(const MotionEvent &ev) {
 }
 static bool onButtonClick_Setting(ZKButton *pButton) {
     LOGD(" ButtonClick Setting !!!\n");
-    mWindowPwdPtr->showWnd();
+    passwordType = "serverIp";
+    passwordWindowShow();
     return false;
 }
-static void onEditTextChanged_EditTextPwd(const std::string &text) {
-    //LOGD(" onEditTextChanged_ EditTextPwd %s !!!\n", text.c_str());
-}
 
-static bool onButtonClick_BtnPwdConfirm(ZKButton *pButton) {
-    LOGD(" ButtonClick BtnPwdConfirm !!!\n");
-    string pwd = mEditTextPwdPtr->getText();
-
-//    //密码为当前日时
-//    struct tm *t = TimeHelper::getDateTime();
-//    char cpwd[10];
-//    sprintf(cpwd,"%02d%02d",t->tm_mday,t->tm_hour);
-//    LOGD("cpwd is %s", cpwd);
-
-	// 密码为666
-	string cpwd = "666";
-    if (pwd == cpwd){
-    	mWindowPwdPtr->hideWnd();
-		mWindowServerIPPtr->showWnd();
-		return false;
-    } else {
-    	mTextPwdInfoPtr->setTextTr("PasswordWrong");
-    }
-
-    return false;
-}
 static void onEditTextChanged_EditTextServerIP(const std::string &text) {
     //LOGD(" onEditTextChanged_ EditTextServerIP %s !!!\n", text.c_str());
 }
 
+static void onEditTextChanged_EditTextServerPort(const std::string &text) {
+    //LOGD(" onEditTextChanged_ EditTextServerPort %s !!!\n", text.c_str());
+}
+
 // 设置服务器ip
 static bool onButtonClick_BtnServerIPConfirm(ZKButton *pButton) {
     LOGD("设置服务器ip !!!\n");
@@ -438,6 +425,7 @@ static bool onButtonClick_BtnServerIPConfirm(ZKButton *pButton) {
     }
 
     StoragePreferences::putString(STORE_GATEWAY, mEditTextServerIPPtr->getText().c_str());
+    StoragePreferences::putInt(STORE_HTTP_PORT, std::atoi(mEditTextServerPortPtr->getText().c_str()));
 
     //mWindowServerIPPtr->hideWnd();
 
@@ -450,12 +438,13 @@ static bool onButtonClick_BtnServerIPConfirm(ZKButton *pButton) {
 }
 static bool onButtonClick_BtnRestart(ZKButton *pButton) {
     LOGD(" ButtonClick BtnRestart !!!\n");
-
-	const char* req = "-1";
-	TcpClient::instance()->sendMsg(req);
-    //重启
-	sync();
-	reboot(RB_AUTOBOOT);
+    passwordType = "reboot";
+    passwordWindowShow();
+//	const char* req = "-1";
+//	TcpClient::instance()->sendMsg(req);
+//    //重启
+//	sync();
+//	reboot(RB_AUTOBOOT);
     return false;
 }
 static bool onButtonClick_BtnNetSetting(ZKButton *pButton) {
@@ -480,30 +469,83 @@ static bool onButtonClick_sys_back(ZKButton *pButton) {
 }
 static bool onButtonClick_TestButton(ZKButton *pButton) {
     LOGD(" ButtonClick TestButton !!!\n");
-    mTestPasswordWindowPtr->showWnd();
+    passwordType = "sipTest";
+    passwordWindowShow();
     return false;
 }
-static bool onButtonClick_TestConfirmButton(ZKButton *pButton) {
-    LOGD(" ButtonClick TestConfirmButton !!!\n");
-    string pwd = mTestPasswordEditTextPtr->getText();
-
-	// 密码为888
-	string cpwd = "888";
-    if (pwd == cpwd){
-    	// 关闭密码输入界面
-        mTestPasswordWindowPtr->hideWnd();
-        // 切换成SIP模式
-    	StoragePreferences::putString(STORE_SIGNAL_TYPE, "SIP");
-    	// 打开SIP调试界面
-        EASYUICONTEXT->openActivity("sipTestActivity");
-		return false;
-    } else {
-    	mTestErrorTextViewPtr->setTextTr("PasswordWrong");
+
+static void onEditTextChanged_PasswordEditText(const std::string &text) {
+    //LOGD(" onEditTextChanged_ PasswordEditText %s !!!\n", text.c_str());
+}
+
+static bool onButtonClick_ConfirmButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ConfirmButton !!!\n");
+    string pwd = mPasswordEditTextPtr->getText();
+
+    if (passwordType == "serverIp") {
+    	string cpwd = "666";
+        if (pwd == cpwd){
+        	mPasswordWindowPtr->hideWnd();
+    		mWindowServerIPPtr->showWnd();
+
+            string serverIp = StoragePreferences::getString(STORE_GATEWAY, "172.28.100.100");
+            int serverPort = StoragePreferences::getInt(STORE_HTTP_PORT, 8006);
+            mEditTextServerIPPtr->setText(serverIp);
+            mEditTextServerPortPtr->setText(to_string(serverPort));
+    		return false;
+        } else {
+        	mErrorTextViewPtr->setTextTr("PasswordWrong");
+        }
+    }
+    else if (passwordType == "sipTest") {
+		// 密码为888
+		string cpwd = "888";
+		if (pwd == cpwd){
+			// 关闭密码输入界面
+			mPasswordWindowPtr->hideWnd();
+			EASYUICONTEXT->openActivity("sipTestActivity");
+			return false;
+		} else {
+			mErrorTextViewPtr->setTextTr("PasswordWrong");
+		}
+    }
+    else if (passwordType == "reboot") {
+		// 密码为888
+		string cpwd = "888";
+		if (pwd == cpwd){
+			// 关闭密码输入界面
+			mPasswordWindowPtr->hideWnd();
+			mRebootWindowPtr->showWnd();
+			return false;
+		} else {
+			mErrorTextViewPtr->setTextTr("PasswordWrong");
+		}
+
     }
+    return false;
+}
 
+static bool onButtonClick_RebootDeviceButton(ZKButton *pButton) {
+    LOGD(" ButtonClick RebootDeviceButton !!!\n");
+	const char* req = "-1";
+	TcpClient::instance()->sendMsg(req);
+	//重启
+	sync();
+	reboot(RB_AUTOBOOT);
     return false;
 }
 
-static void onEditTextChanged_TestPasswordEditText(const std::string &text) {
-    //LOGD(" onEditTextChanged_ TestPasswordEditText %s !!!\n", text.c_str());
+static bool onButtonClick_RebootPowerButton(ZKButton *pButton) {
+    LOGD(" ButtonClick RebootPowerButton !!!\n");
+	TcpModel tcpModel;
+	tcpModel.type = TcpType::DEVICE;
+	tcpModel.action = DeviceAction::POWER_RESET;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.to_id = NULL;
+
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("TCP DEVICE : %s",req.c_str());
+
+    TcpClient::instance()->sendMsg(req.c_str());
+    return false;
 }

+ 1 - 0
jni/net/tcp_client.cpp

@@ -94,6 +94,7 @@ public:
 		if (conn) {
 			byte buf[2048] = {0};
 			TcpModel tcpModel;
+			tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
 			tcpModel.type = TcpType::DEVICE;
 			tcpModel.action = DeviceAction::CONNECT;
 //			tcpModel.data = ETHERNETMANAGER->getMacAddr();

+ 7 - 2
jni/net/tcp_model.cpp

@@ -14,9 +14,10 @@ std::string getTcpModelString(TcpModel model){
 	Json::Value root;
 	if (model.tid != ""){
 		root["tid"] = model.tid;
-	} else {
-		root["tid"] = base::format("t%d",TimeHelper::getCurrentTime());
 	}
+//	else {
+//		root["tid"] = base::format("t%d",TimeHelper::getCurrentTime());
+//	}
 	root["type"] = model.type;
 	root["action"] = model.action;
 	if (model.from_id>0){
@@ -60,9 +61,13 @@ TcpModel getTcpModel(byte* inBytes){
 			tcpModel.to_id = root["toId"].asInt();
 		}
 		if (root.isMember("data")){
+			LOGD("tcp model str2 = %s", str);
 			if (root["data"].isInt()){
 				std::string s = std::to_string(root["data"].asInt());
 				tcpModel.data = s.c_str();
+			} else if (root["data"].isString()){
+				std::string s = root["data"].asString();
+				tcpModel.data = s.c_str();
 			} else {
 				tcpModel.json = root["data"];
 			}

+ 1 - 0
jni/net/tcp_model.h

@@ -66,6 +66,7 @@ public:
 	inline static std::string DEVICE_REFRESH = "DEVICE_REFRESH";
 	inline static std::string SYSTEM_SETTING = "SYSTEM_SETTING";
 	inline static std::string SERVER_CHANGE = "SERVER_CHANGE";
+	inline static std::string POWER_RESET = "POWER_RESET";
 };
 
 class DataAction {

+ 4 - 2
jni/service/BusinessConfig.h

@@ -51,8 +51,8 @@
 #define STORE_SCREEN_LIGHT "screen_light"
 #define SIGNAL_TYPE "TCP" //TCP,SIP
 
-static std::string version = "v1.0.29";
-static int versionNo = 29;
+static std::string version = "v1.0.30";
+static int versionNo = 30;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
@@ -123,6 +123,8 @@ void setUi3BgColor(uint32_t color);
 // 设置调试的按键框
 void setCheckbox(std::string check);
 
+const bool checkAddr(std::string addr);
+
 enum CallFinishType {
 	CANCEL,
 	REJECT,

二進制
libs/armeabi/libzkgui.so


二進制
obj/activity/DeviceUpdateActivity.o


二進制
obj/activity/callActivity.o


二進制
obj/activity/mainActivity.o


二進制
obj/activity/sipTestActivity.o


二進制
obj/activity/startActivity.o


二進制
obj/activity/statusbar.o


二進制
obj/activity/ui3Activity.o


二進制
obj/activity/warnActivity.o


二進制
obj/core/update_assistant.o


二進制
obj/net/tcp_client.o


二進制
obj/net/tcp_model.o


二進制
obj/server/http_server.o


二進制
obj/service/BusinessConfig.o


二進制
obj/service/time.o


二進制
ui/ui3.ftu