Переглянути джерело

增加颜色和触点测试

vothin 1 рік тому
батько
коміт
715827c2e9

+ 416 - 0
jni/activity/colorActivity.cpp

@@ -0,0 +1,416 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#include "colorActivity.h"
+
+/*TAG:GlobalVariable全局变量*/
+static ZKButton* mBackButtonPtr;
+static ZKPainter* mColorPainterPtr;
+static ZKWindow* mContactWindowPtr;
+static ZKButton* msys_backPtr;
+static ZKButton* mContactButtonPtr;
+static ZKButton* mColorButtonPtr;
+static colorActivity* mActivityPtr;
+
+/*register activity*/
+REGISTER_ACTIVITY(colorActivity);
+
+typedef struct {
+	int id; // 定时器ID , 不能重复
+	int time; // 定时器  时间间隔  单位 毫秒
+}S_ACTIVITY_TIMEER;
+
+#include "logic/colorLogic.cc"
+
+/***********/
+typedef struct {
+    int id;
+    const char *pApp;
+} SAppInfo;
+
+/**
+ *点击跳转window
+ */
+static SAppInfo sAppInfoTab[] = {
+//  { ID_MAIN_TEXT, "TextViewActivity" },
+};
+
+/***************/
+typedef bool (*ButtonCallback)(ZKButton *pButton);
+/**
+ * button onclick表
+ */
+typedef struct {
+    int id;
+    ButtonCallback callback;
+}S_ButtonCallback;
+
+/*TAG:ButtonCallbackTab按键映射表*/
+static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_COLOR_BackButton, onButtonClick_BackButton,
+    ID_COLOR_sys_back, onButtonClick_sys_back,
+    ID_COLOR_ContactButton, onButtonClick_ContactButton,
+    ID_COLOR_ColorButton, onButtonClick_ColorButton,
+};
+/***************/
+
+
+typedef void (*SeekBarCallback)(ZKSeekBar *pSeekBar, int progress);
+typedef struct {
+    int id;
+    SeekBarCallback callback;
+}S_ZKSeekBarCallback;
+/*TAG:SeekBarCallbackTab*/
+static S_ZKSeekBarCallback SZKSeekBarCallbackTab[] = {
+};
+
+
+typedef int (*ListViewGetItemCountCallback)(const ZKListView *pListView);
+typedef void (*ListViewobtainListItemDataCallback)(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index);
+typedef void (*ListViewonItemClickCallback)(ZKListView *pListView, int index, int id);
+typedef struct {
+    int id;
+    ListViewGetItemCountCallback getListItemCountCallback;
+    ListViewobtainListItemDataCallback obtainListItemDataCallback;
+    ListViewonItemClickCallback onItemClickCallback;
+}S_ListViewFunctionsCallback;
+/*TAG:ListViewFunctionsCallback*/
+static S_ListViewFunctionsCallback SListViewFunctionsCallbackTab[] = {
+};
+
+
+typedef void (*SlideWindowItemClickCallback)(ZKSlideWindow *pSlideWindow, int index);
+typedef struct {
+    int id;
+    SlideWindowItemClickCallback onSlideItemClickCallback;
+}S_SlideWindowItemClickCallback;
+/*TAG:SlideWindowFunctionsCallbackTab*/
+static S_SlideWindowItemClickCallback SSlideWindowItemClickCallbackTab[] = {
+};
+
+
+typedef void (*EditTextInputCallback)(const std::string &text);
+typedef struct {
+    int id;
+    EditTextInputCallback onEditTextChangedCallback;
+}S_EditTextInputCallback;
+/*TAG:EditTextInputCallback*/
+static S_EditTextInputCallback SEditTextInputCallbackTab[] = {
+};
+
+typedef void (*VideoViewCallback)(ZKVideoView *pVideoView, int msg);
+typedef struct {
+    int id; //VideoView ID
+    bool loop; // 是否是轮播类型
+    int defaultvolume;//轮播类型时,默认视频音量
+    VideoViewCallback onVideoViewCallback;
+}S_VideoViewCallback;
+/*TAG:VideoViewCallback*/
+static S_VideoViewCallback SVideoViewCallbackTab[] = {
+};
+
+
+colorActivity::colorActivity() {
+	//todo add init code here
+	mVideoLoopIndex = -1;
+	mVideoLoopErrorCount = 0;
+}
+
+colorActivity::~colorActivity() {
+  //todo add init file here
+  // 退出应用时需要反注册
+    EASYUICONTEXT->unregisterGlobalTouchListener(this);
+    unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    onUI_quit();
+    mActivityPtr = NULL;
+    mBackButtonPtr = NULL;
+    mColorPainterPtr = NULL;
+    mContactWindowPtr = NULL;
+    msys_backPtr = NULL;
+    mContactButtonPtr = NULL;
+    mColorButtonPtr = NULL;
+}
+
+const char* colorActivity::getAppName() const{
+	return "color.ftu";
+}
+
+//TAG:onCreate
+void colorActivity::onCreate() {
+	Activity::onCreate();
+    mBackButtonPtr = (ZKButton*)findControlByID(ID_COLOR_BackButton);
+    mColorPainterPtr = (ZKPainter*)findControlByID(ID_COLOR_ColorPainter);
+    mContactWindowPtr = (ZKWindow*)findControlByID(ID_COLOR_ContactWindow);
+    msys_backPtr = (ZKButton*)findControlByID(ID_COLOR_sys_back);
+    mContactButtonPtr = (ZKButton*)findControlByID(ID_COLOR_ContactButton);
+    mColorButtonPtr = (ZKButton*)findControlByID(ID_COLOR_ColorButton);
+	mActivityPtr = this;
+	onUI_init();
+  registerProtocolDataUpdateListener(onProtocolDataUpdate);
+  rigesterActivityTimer();
+}
+
+void colorActivity::onClick(ZKBase *pBase) {
+	//TODO: add widget onClik code 
+    int buttonTablen = sizeof(sButtonCallbackTab) / sizeof(S_ButtonCallback);
+    for (int i = 0; i < buttonTablen; ++i) {
+        if (sButtonCallbackTab[i].id == pBase->getID()) {
+            if (sButtonCallbackTab[i].callback((ZKButton*)pBase)) {
+            	return;
+            }
+            break;
+        }
+    }
+
+
+    int len = sizeof(sAppInfoTab) / sizeof(sAppInfoTab[0]);
+    for (int i = 0; i < len; ++i) {
+        if (sAppInfoTab[i].id == pBase->getID()) {
+            EASYUICONTEXT->openActivity(sAppInfoTab[i].pApp);
+            return;
+        }
+    }
+
+	Activity::onClick(pBase);
+}
+
+void colorActivity::onResume() {
+	Activity::onResume();
+	EASYUICONTEXT->registerGlobalTouchListener(this);
+	startVideoLoopPlayback();
+	onUI_show();
+}
+
+void colorActivity::onPause() {
+	Activity::onPause();
+	EASYUICONTEXT->unregisterGlobalTouchListener(this);
+	stopVideoLoopPlayback();
+	onUI_hide();
+}
+
+void colorActivity::onIntent(const Intent *intentPtr) {
+	Activity::onIntent(intentPtr);
+	onUI_intent(intentPtr);
+}
+
+bool colorActivity::onTimer(int id) {
+	return onUI_Timer(id);
+}
+
+void colorActivity::onProgressChanged(ZKSeekBar *pSeekBar, int progress){
+
+    int seekBarTablen = sizeof(SZKSeekBarCallbackTab) / sizeof(S_ZKSeekBarCallback);
+    for (int i = 0; i < seekBarTablen; ++i) {
+        if (SZKSeekBarCallbackTab[i].id == pSeekBar->getID()) {
+            SZKSeekBarCallbackTab[i].callback(pSeekBar, progress);
+            break;
+        }
+    }
+}
+
+int colorActivity::getListItemCount(const ZKListView *pListView) const{
+    int tablen = sizeof(SListViewFunctionsCallbackTab) / sizeof(S_ListViewFunctionsCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SListViewFunctionsCallbackTab[i].id == pListView->getID()) {
+            return SListViewFunctionsCallbackTab[i].getListItemCountCallback(pListView);
+            break;
+        }
+    }
+    return 0;
+}
+
+void colorActivity::obtainListItemData(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index){
+    int tablen = sizeof(SListViewFunctionsCallbackTab) / sizeof(S_ListViewFunctionsCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SListViewFunctionsCallbackTab[i].id == pListView->getID()) {
+            SListViewFunctionsCallbackTab[i].obtainListItemDataCallback(pListView, pListItem, index);
+            break;
+        }
+    }
+}
+
+void colorActivity::onItemClick(ZKListView *pListView, int index, int id){
+    int tablen = sizeof(SListViewFunctionsCallbackTab) / sizeof(S_ListViewFunctionsCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SListViewFunctionsCallbackTab[i].id == pListView->getID()) {
+            SListViewFunctionsCallbackTab[i].onItemClickCallback(pListView, index, id);
+            break;
+        }
+    }
+}
+
+void colorActivity::onSlideItemClick(ZKSlideWindow *pSlideWindow, int index) {
+    int tablen = sizeof(SSlideWindowItemClickCallbackTab) / sizeof(S_SlideWindowItemClickCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SSlideWindowItemClickCallbackTab[i].id == pSlideWindow->getID()) {
+            SSlideWindowItemClickCallbackTab[i].onSlideItemClickCallback(pSlideWindow, index);
+            break;
+        }
+    }
+}
+
+bool colorActivity::onTouchEvent(const MotionEvent &ev) {
+    return oncolorActivityTouchEvent(ev);
+}
+
+void colorActivity::onTextChanged(ZKTextView *pTextView, const std::string &text) {
+    int tablen = sizeof(SEditTextInputCallbackTab) / sizeof(S_EditTextInputCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SEditTextInputCallbackTab[i].id == pTextView->getID()) {
+            SEditTextInputCallbackTab[i].onEditTextChangedCallback(text);
+            break;
+        }
+    }
+}
+
+void colorActivity::rigesterActivityTimer() {
+    int tablen = sizeof(REGISTER_ACTIVITY_TIMER_TAB) / sizeof(S_ACTIVITY_TIMEER);
+    for (int i = 0; i < tablen; ++i) {
+        S_ACTIVITY_TIMEER temp = REGISTER_ACTIVITY_TIMER_TAB[i];
+        registerTimer(temp.id, temp.time);
+    }
+}
+
+
+void colorActivity::onVideoPlayerMessage(ZKVideoView *pVideoView, int msg) {
+    int tablen = sizeof(SVideoViewCallbackTab) / sizeof(S_VideoViewCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SVideoViewCallbackTab[i].id == pVideoView->getID()) {
+        	if (SVideoViewCallbackTab[i].loop) {
+                //循环播放
+        		videoLoopPlayback(pVideoView, msg, i);
+        	} else if (SVideoViewCallbackTab[i].onVideoViewCallback != NULL){
+        	    SVideoViewCallbackTab[i].onVideoViewCallback(pVideoView, msg);
+        	}
+            break;
+        }
+    }
+}
+
+void colorActivity::videoLoopPlayback(ZKVideoView *pVideoView, int msg, size_t callbackTabIndex) {
+
+	switch (msg) {
+	case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_STARTED:
+		LOGD("ZKVideoView::E_MSGTYPE_VIDEO_PLAY_STARTED\n");
+    if (callbackTabIndex >= (sizeof(SVideoViewCallbackTab)/sizeof(S_VideoViewCallback))) {
+      break;
+    }
+		pVideoView->setVolume(SVideoViewCallbackTab[callbackTabIndex].defaultvolume / 10.0);
+		mVideoLoopErrorCount = 0;
+		break;
+	case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_ERROR:
+		/**错误处理 */
+		++mVideoLoopErrorCount;
+		if (mVideoLoopErrorCount > 100) {
+			LOGD("video loop error counts > 100, quit loop playback !");
+            break;
+		} //不用break, 继续尝试播放下一个
+	case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED:
+		LOGD("ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED\n");
+        std::vector<std::string> videolist;
+        std::string fileName(getAppName());
+        if (fileName.size() < 4) {
+             LOGD("getAppName size < 4, ignore!");
+             break;
+        }
+        fileName = fileName.substr(0, fileName.length() - 4) + "_video_list.txt";
+        fileName = "/mnt/extsd/" + fileName;
+        if (!parseVideoFileList(fileName.c_str(), videolist)) {
+            LOGD("parseVideoFileList failed !");
+		    break;
+        }
+		if (pVideoView && !videolist.empty()) {
+			mVideoLoopIndex = (mVideoLoopIndex + 1) % videolist.size();
+			pVideoView->play(videolist[mVideoLoopIndex].c_str());
+		}
+		break;
+	}
+}
+
+void colorActivity::startVideoLoopPlayback() {
+    int tablen = sizeof(SVideoViewCallbackTab) / sizeof(S_VideoViewCallback);
+    for (int i = 0; i < tablen; ++i) {
+    	if (SVideoViewCallbackTab[i].loop) {
+    		ZKVideoView* videoView = (ZKVideoView*)findControlByID(SVideoViewCallbackTab[i].id);
+    		if (!videoView) {
+    			return;
+    		}
+    		//循环播放
+    		videoLoopPlayback(videoView, ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED, i);
+    		return;
+    	}
+    }
+}
+
+void colorActivity::stopVideoLoopPlayback() {
+    int tablen = sizeof(SVideoViewCallbackTab) / sizeof(S_VideoViewCallback);
+    for (int i = 0; i < tablen; ++i) {
+    	if (SVideoViewCallbackTab[i].loop) {
+    		ZKVideoView* videoView = (ZKVideoView*)findControlByID(SVideoViewCallbackTab[i].id);
+    		if (!videoView) {
+    			return;
+    		}
+    		if (videoView->isPlaying()) {
+    		    videoView->stop();
+    		}
+    		return;
+    	}
+    }
+}
+
+bool colorActivity::parseVideoFileList(const char *pFileListPath, std::vector<string>& mediaFileList) {
+	mediaFileList.clear();
+	if (NULL == pFileListPath || 0 == strlen(pFileListPath)) {
+        LOGD("video file list is null!");
+		return false;
+	}
+
+	ifstream is(pFileListPath, ios_base::in);
+	if (!is.is_open()) {
+		LOGD("cann't open file %s \n", pFileListPath);
+		return false;
+	}
+	char tmp[1024] = {0};
+	while (is.getline(tmp, sizeof(tmp))) {
+		string str = tmp;
+		removeCharFromString(str, '\"');
+		removeCharFromString(str, '\r');
+		removeCharFromString(str, '\n');
+		if (str.size() > 1) {
+     		mediaFileList.push_back(str.c_str());
+		}
+	}
+  LOGD("(f:%s, l:%d) parse fileList[%s], get [%d]files", __FUNCTION__,
+      __LINE__, pFileListPath, int(mediaFileList.size()));
+  for (std::vector<string>::size_type i = 0; i < mediaFileList.size(); i++) {
+    LOGD("file[%u]:[%s]", ::size_t(i), mediaFileList[i].c_str());
+  }
+	is.close();
+
+	return true;
+}
+
+int colorActivity::removeCharFromString(string& nString, char c) {
+    string::size_type   pos;
+    while(1) {
+        pos = nString.find(c);
+        if(pos != string::npos) {
+            nString.erase(pos, 1);
+        } else {
+            break;
+        }
+    }
+    return (int)nString.size();
+}
+
+void colorActivity::registerUserTimer(int id, int time) {
+	registerTimer(id, time);
+}
+
+void colorActivity::unregisterUserTimer(int id) {
+	unregisterTimer(id);
+}
+
+void colorActivity::resetUserTimer(int id, int time) {
+	resetTimer(id, time);
+}

+ 103 - 0
jni/activity/colorActivity.h

@@ -0,0 +1,103 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#ifndef __COLORACTIVITY_H__
+#define __COLORACTIVITY_H__
+
+
+#include "app/Activity.h"
+#include "entry/EasyUIContext.h"
+
+#include "uart/ProtocolData.h"
+#include "uart/ProtocolParser.h"
+
+#include "utils/Log.h"
+#include "control/ZKDigitalClock.h"
+#include "control/ZKPainter.h"
+#include "control/ZKButton.h"
+#include "control/ZKCircleBar.h"
+#include "control/ZKDiagram.h"
+#include "control/ZKListView.h"
+#include "control/ZKPointer.h"
+#include "control/ZKQRCode.h"
+#include "control/ZKTextView.h"
+#include "control/ZKSeekBar.h"
+#include "control/ZKEditText.h"
+#include "control/ZKVideoView.h"
+#include "window/ZKSlideWindow.h"
+
+/*TAG:Macro宏ID*/
+#define ID_COLOR_BackButton    20004
+#define ID_COLOR_ColorPainter    52001
+#define ID_COLOR_ContactWindow    110001
+#define ID_COLOR_sys_back   100
+#define ID_COLOR_ContactButton    20002
+#define ID_COLOR_ColorButton    20001
+/*TAG:Macro宏ID END*/
+
+class colorActivity : public Activity, 
+                     public ZKSeekBar::ISeekBarChangeListener, 
+                     public ZKListView::IItemClickListener,
+                     public ZKListView::AbsListAdapter,
+                     public ZKSlideWindow::ISlideItemClickListener,
+                     public EasyUIContext::ITouchListener,
+                     public ZKEditText::ITextChangeListener,
+                     public ZKVideoView::IVideoPlayerMessageListener
+{
+public:
+    colorActivity();
+    virtual ~colorActivity();
+
+    /**
+     * 注册定时器
+     */
+	void registerUserTimer(int id, int time);
+	/**
+	 * 取消定时器
+	 */
+	void unregisterUserTimer(int id);
+	/**
+	 * 重置定时器
+	 */
+	void resetUserTimer(int id, int time);
+
+protected:
+    /*TAG:PROTECTED_FUNCTION*/
+    virtual const char* getAppName() const;
+    virtual void onCreate();
+    virtual void onClick(ZKBase *pBase);
+    virtual void onResume();
+    virtual void onPause();
+    virtual void onIntent(const Intent *intentPtr);
+    virtual bool onTimer(int id);
+
+    virtual void onProgressChanged(ZKSeekBar *pSeekBar, int progress);
+
+    virtual int getListItemCount(const ZKListView *pListView) const;
+    virtual void obtainListItemData(ZKListView *pListView, ZKListView::ZKListItem *pListItem, int index);
+    virtual void onItemClick(ZKListView *pListView, int index, int subItemIndex);
+
+    virtual void onSlideItemClick(ZKSlideWindow *pSlideWindow, int index);
+
+    virtual bool onTouchEvent(const MotionEvent &ev);
+
+    virtual void onTextChanged(ZKTextView *pTextView, const string &text);
+
+    void rigesterActivityTimer();
+
+    virtual void onVideoPlayerMessage(ZKVideoView *pVideoView, int msg);
+    void videoLoopPlayback(ZKVideoView *pVideoView, int msg, size_t callbackTabIndex);
+    void startVideoLoopPlayback();
+    void stopVideoLoopPlayback();
+    bool parseVideoFileList(const char *pFileListPath, std::vector<string>& mediaFileList);
+    int removeCharFromString(string& nString, char c);
+
+
+private:
+    /*TAG:PRIVATE_VARIABLE*/
+    int mVideoLoopIndex;
+    int mVideoLoopErrorCount;
+
+};
+
+#endif

+ 4 - 0
jni/activity/sipTestActivity.cpp

@@ -4,6 +4,7 @@
 #include "sipTestActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKButton* mColorTestButtonPtr;
 static ZKButton* msip_backPtr;
 static ZKCheckBox* mPanelCallKeysCheckboxPtr;
 static ZKTextView* mPanelCallKeysTextViewPtr;
@@ -49,6 +50,7 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_SIPTEST_ColorTestButton, onButtonClick_ColorTestButton,
     ID_SIPTEST_sip_back, onButtonClick_sip_back,
     ID_SIPTEST_RecordTestButton, onButtonClick_RecordTestButton,
     ID_SIPTEST_CallButton, onButtonClick_CallButton,
@@ -134,6 +136,7 @@ sipTestActivity::~sipTestActivity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    mColorTestButtonPtr = NULL;
     msip_backPtr = NULL;
     mPanelCallKeysCheckboxPtr = NULL;
     mPanelCallKeysTextViewPtr = NULL;
@@ -152,6 +155,7 @@ const char* sipTestActivity::getAppName() const{
 //TAG:onCreate
 void sipTestActivity::onCreate() {
 	Activity::onCreate();
+    mColorTestButtonPtr = (ZKButton*)findControlByID(ID_SIPTEST_ColorTestButton);
     msip_backPtr = (ZKButton*)findControlByID(ID_SIPTEST_sip_back);
     mPanelCallKeysCheckboxPtr = (ZKCheckBox*)findControlByID(ID_SIPTEST_PanelCallKeysCheckbox);if(mPanelCallKeysCheckboxPtr!= NULL){mPanelCallKeysCheckboxPtr->setCheckedChangeListener(this);}
     mPanelCallKeysTextViewPtr = (ZKTextView*)findControlByID(ID_SIPTEST_PanelCallKeysTextView);

+ 1 - 0
jni/activity/sipTestActivity.h

@@ -27,6 +27,7 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_SIPTEST_ColorTestButton    20004
 #define ID_SIPTEST_sip_back    20003
 #define ID_SIPTEST_PanelCallKeysCheckbox    21002
 #define ID_SIPTEST_PanelCallKeysTextView    50003

+ 21 - 17
jni/activity/ui3Activity.cpp

@@ -4,13 +4,14 @@
 #include "ui3Activity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKButton* mSipTestButtonPtr;
+static ZKTextView* mTestErrorTextViewPtr;
+static ZKButton* mTestConfirmButtonPtr;
+static ZKTextView* mTestPasswordTextViewPtr;
+static ZKEditText* mTestPasswordEditTextPtr;
+static ZKWindow* mTestPasswordWindowPtr;
 static ZKTextView* mServerPortTextViewPtr;
 static ZKEditText* mEditTextServerPortPtr;
-static ZKTextView* mSettingErrorTextViewPtr;
-static ZKButton* mSettingConfirmButtonPtr;
-static ZKTextView* mSettingPasswordTextViewPtr;
-static ZKEditText* mSettingPasswordEditTextPtr;
-static ZKWindow* mSettingPasswordWindowPtr;
 static ZKButton* mSettingButtonPtr;
 static ZKButton* msys_backPtr;
 static ZKTextView* mVoiceDomainPtr;
@@ -85,7 +86,8 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
-    ID_UI3_SettingConfirmButton, onButtonClick_SettingConfirmButton,
+    ID_UI3_SipTestButton, onButtonClick_SipTestButton,
+    ID_UI3_TestConfirmButton, onButtonClick_TestConfirmButton,
     ID_UI3_SettingButton, onButtonClick_SettingButton,
     ID_UI3_sys_back, onButtonClick_sys_back,
     ID_UI3_BtnSoftVer, onButtonClick_BtnSoftVer,
@@ -139,8 +141,8 @@ typedef struct {
 }S_EditTextInputCallback;
 /*TAG:EditTextInputCallback*/
 static S_EditTextInputCallback SEditTextInputCallbackTab[] = {
+    ID_UI3_TestPasswordEditText, onEditTextChanged_TestPasswordEditText,
     ID_UI3_EditTextServerPort, onEditTextChanged_EditTextServerPort,
-    ID_UI3_SettingPasswordEditText, onEditTextChanged_SettingPasswordEditText,
     ID_UI3_EditTextServerIP, onEditTextChanged_EditTextServerIP,
     ID_UI3_EditTextPwd, onEditTextChanged_EditTextPwd,
 };
@@ -169,13 +171,14 @@ ui3Activity::~ui3Activity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    mSipTestButtonPtr = NULL;
+    mTestErrorTextViewPtr = NULL;
+    mTestConfirmButtonPtr = NULL;
+    mTestPasswordTextViewPtr = NULL;
+    mTestPasswordEditTextPtr = NULL;
+    mTestPasswordWindowPtr = NULL;
     mServerPortTextViewPtr = NULL;
     mEditTextServerPortPtr = NULL;
-    mSettingErrorTextViewPtr = NULL;
-    mSettingConfirmButtonPtr = NULL;
-    mSettingPasswordTextViewPtr = NULL;
-    mSettingPasswordEditTextPtr = NULL;
-    mSettingPasswordWindowPtr = NULL;
     mSettingButtonPtr = NULL;
     msys_backPtr = NULL;
     mVoiceDomainPtr = NULL;
@@ -223,13 +226,14 @@ const char* ui3Activity::getAppName() const{
 //TAG:onCreate
 void ui3Activity::onCreate() {
 	Activity::onCreate();
+    mSipTestButtonPtr = (ZKButton*)findControlByID(ID_UI3_SipTestButton);
+    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);
     mServerPortTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_ServerPortTextView);
     mEditTextServerPortPtr = (ZKEditText*)findControlByID(ID_UI3_EditTextServerPort);if(mEditTextServerPortPtr!= NULL){mEditTextServerPortPtr->setTextChangeListener(this);}
-    mSettingErrorTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_SettingErrorTextView);
-    mSettingConfirmButtonPtr = (ZKButton*)findControlByID(ID_UI3_SettingConfirmButton);
-    mSettingPasswordTextViewPtr = (ZKTextView*)findControlByID(ID_UI3_SettingPasswordTextView);
-    mSettingPasswordEditTextPtr = (ZKEditText*)findControlByID(ID_UI3_SettingPasswordEditText);if(mSettingPasswordEditTextPtr!= NULL){mSettingPasswordEditTextPtr->setTextChangeListener(this);}
-    mSettingPasswordWindowPtr = (ZKWindow*)findControlByID(ID_UI3_SettingPasswordWindow);
     mSettingButtonPtr = (ZKButton*)findControlByID(ID_UI3_SettingButton);
     msys_backPtr = (ZKButton*)findControlByID(ID_UI3_sys_back);
     mVoiceDomainPtr = (ZKTextView*)findControlByID(ID_UI3_VoiceDomain);

+ 6 - 5
jni/activity/ui3Activity.h

@@ -26,13 +26,14 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_UI3_SipTestButton    20009
+#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_ServerPortTextView    50027
 #define ID_UI3_EditTextServerPort    51004
-#define ID_UI3_SettingErrorTextView    50026
-#define ID_UI3_SettingConfirmButton    20008
-#define ID_UI3_SettingPasswordTextView    50025
-#define ID_UI3_SettingPasswordEditText    51003
-#define ID_UI3_SettingPasswordWindow    110003
 #define ID_UI3_SettingButton    20007
 #define ID_UI3_sys_back   100
 #define ID_UI3_VoiceDomain    50012

+ 0 - 1
jni/core/utilities.cpp

@@ -21,7 +21,6 @@
 #include "base/strings.hpp"
 #include "base/prefs.hpp"
 #include "base/json_object.h"
-#include "edge/ip_table.h"
 #include "core/jhws.h"
 #include "manager/ConfigManager.h"
 #include "security/SecurityManager.h"

+ 0 - 1
jni/core/utilities.h

@@ -16,7 +16,6 @@
 
 #include "base/prefs.hpp"
 
-#include "edge/ip_table.h"
 
 #define SETTINGS_SCREENSAVER_BRIGHTNESS "screensaver_brightness"
 #define SETTINGS_ADDRESS "address"

+ 0 - 236
jni/edge/ip_table.cpp

@@ -1,236 +0,0 @@
-/*
- * ip_table.cpp
- *
- *  Created on: 2022年3月10日
- *      Author: pengzc
- */
-
-#include "ip_table.h"
-#include <zlib.h>
-#include <string>
-#include <vector>
-#include <functional>
-
-#include "rapidxml/rapidxml.hpp"
-#include "rapidxml/rapidxml_print.hpp"
-#include "utils/Log.h"
-#include "base/files.hpp"
-
-const char* IP_TABLE_FILE = "/data/ip_table.zip";
-
-#define XMLAppendNode(doc, name, text) { \
-    xml_node<> *child = doc.allocate_node(node_element, doc.allocate_string(name), doc.allocate_string(text));\
-    root->append_node(child);\
-  }
-
-namespace i {
-
-static int Compress(const std::string& source, std::string* dest) {
-  if (dest == NULL) {
-    return -1;
-  }
-  dest->resize(source.size());
-  uLongf dest_len = source.size();
-  int ret = compress((Bytef*) dest->data(), &dest_len, (Bytef*) source.data(),
-      (uLongf) source.size());
-  if (ret != Z_OK) {
-    dest->clear();
-    return ret;
-  }
-  dest->resize(dest_len);
-  return 0;
-}
-
-static int Uncompress(const std::string& source, std::string* dest) {
-  if (dest == NULL) {
-    return -1;
-  }
-  //最大支持512K
-  dest->resize(1024 * 512);
-  uLongf dest_len = dest->size();
-  int ret = uncompress((Bytef*)dest->data(), &dest_len, (Bytef*)source.data(), (uLong)source.size());
-  if (ret != Z_OK) {
-    dest->clear();
-    return ret;
-  }
-  dest->resize(dest_len);
-  return 0;
-}
-
-int IpTable::Load(std::string* xml) {
-  if (xml == NULL) {
-    return -1;
-  }
-  std::string content = base::read_all(IP_TABLE_FILE);
-  if (content.empty()) {
-    LOGE("%s empty", IP_TABLE_FILE);
-    return -1;
-  }
-  int ret = Uncompress(content, xml);
-  if (ret != 0) {
-    LOGD("uncompress error, %d", ret);
-    return -1;
-  }
-  return 0;
-}
-
-static int WalkIpTable(std::function<int (rapidxml::xml_node<>* node)> func) {
-  std::string xml;
-  if (IpTable::Load(&xml) != 0) {
-    return -1;
-  }
-  rapidxml::xml_document<> doc;    // character type defaults to char
-  doc.parse<0>((char*)xml.c_str());    // 0 means default parse flags
-  rapidxml::xml_node<>* node = doc.first_node("map");
-  if (node == NULL) {
-    return -1;
-  }
-  node = node->first_node();
-  if (node == NULL) {
-    return -1;
-  }
-  do {
-    if (func(node) != 0) {
-      break;
-    }
-  } while ((node = node->next_sibling()) != NULL);
-  return 0;
-}
-
-static int GetFirstNodeValue(rapidxml::xml_node<>* parent,
-    const char* node_name, std::string* value) {
-  if (parent == NULL) {
-    return -1;
-  }
-  if (node_name == NULL) {
-    return -1;
-  }
-  if (value == NULL) {
-    return -1;
-  }
-  rapidxml::xml_node<>* node = parent->first_node(node_name);
-  if (node == NULL) {
-    return -1;
-  }
-  value->assign(node->value(), node->value_size());
-  return 0;
-}
-
-int IpTable::Update(const std::string& map_xml) {
-  if (map_xml.size() <= 0) {
-    return -1;
-  }
-  std::string dest_xml;
-  int ret = Compress(map_xml, &dest_xml);
-  if (ret != 0) {
-    LOGD("compress error, %d", ret);
-    return -1;
-  }
-  LOGD("compressed %d bytes", dest_xml.size());
-  return base::write_all(IP_TABLE_FILE, dest_xml) ? 0 : -1;
-}
-
-int IpTable::GetExtension(int building, int unit, int number, int extension,
-    NetworkProfile* profile) {
-  if (profile == NULL) {
-    return -1;
-  }
-  bool find = false;
-  WalkIpTable([building, unit, number, extension, profile, &find](rapidxml::xml_node<>* node) -> int {
-    if (strcmp("item", node->name()) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "name", &profile->name) != 0) {
-      return 0;
-    }
-    if (4 != sscanf(profile->name.c_str(), "%d栋%d单元%d室%d号分机",
-        &profile->building, &profile->unit,
-        &profile->number, &profile->extension)) {
-      return 0;
-    }
-    if (profile->building != building
-        || profile->unit != unit
-        || profile->number != number
-        || profile->extension != extension) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "code", &profile->code) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "ip", &profile->ipv4) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "gate", &profile->gateway) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "mask", &profile->sub_network_mask) != 0) {
-      return 0;
-    }
-    find = true;
-    return 1; //stop walk;
-  });
-  return find ? 0 : 404;
-}
-
-int IpTable::GetGate(int building, int unit, NetworkProfile* profile) {
-  if (profile == NULL) {
-    return -1;
-  }
-  bool find = false;
-  WalkIpTable([profile, building, unit, &find](rapidxml::xml_node<>* node) -> int {
-    if (strcmp("item", node->name()) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "name", &profile->name) != 0) {
-      return 0;
-    }
-    if (2 != sscanf(profile->name.c_str(), "%d栋%d单元$",
-        &profile->building, &profile->unit)) {
-      return 0;
-    }
-    if (profile->building != building
-        || profile->unit != unit) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "code", &profile->code) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "ip", &profile->ipv4) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "gate", &profile->gateway) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "mask", &profile->sub_network_mask) != 0) {
-      return 0;
-    }
-    find = true;
-    return 1; //stop walk;
-  });
-  return find ? 0 : 404;
-}
-
-std::string IpTable::GetVersion() {
-  std::string ver;
-  WalkIpTable([&ver](rapidxml::xml_node<>* node) -> int {
-    if (strcmp("mapver", node->name()) != 0) {
-      return 0;
-    }
-    if (GetFirstNodeValue(node, "ver", &ver) != 0) {
-      return 0;
-    }
-    return 1; //stop walk;
-  });
-  return ver;
-}
-
-IpTable::IpTable() {
-  // TODO 自动生成的构造函数存根
-
-}
-
-IpTable::~IpTable() {
-  // TODO 自动生成的析构函数存根
-}
-
-} /* namespace i */

+ 0 - 100
jni/edge/ip_table.h

@@ -1,100 +0,0 @@
-/*
- * ip_table.h
- *
- *  Created on: 2022年3月10日
- *      Author: pengzc
- */
-
-#ifndef JNI_CORE_IP_TABLE_H_
-#define JNI_CORE_IP_TABLE_H_
-
-#include <string>
-#include <base/strings.hpp>
-
-namespace i {
-
-struct NetworkProfile {
-  std::string name;
-  std::string code;
-  std::string ipv4;
-  std::string gateway;
-  std::string sub_network_mask;
-
-  int building;
-  int unit;
-  int number;
-  int extension;
-
-public:
-  NetworkProfile() {
-    building = 0;
-    unit = 0;
-    number = 0;
-    extension = 0;
-  }
-
-  std::string ToString() const {
-    return base::format("%s %s %s %s %s", name.c_str(), code.c_str(),
-        ipv4.c_str(), gateway.c_str(), sub_network_mask.c_str());
-  }
-
-  std::string ToAddressString() const {
-    return base::format("%d栋%d单元%04d室%d分机", building,
-      unit, number, extension);
-  }
-
-  bool ParseAddressString(const std::string& str) {
-    return 4 == sscanf(str.c_str(), "%d栋%d单元%d室%d分机", &building,
-        &unit, &number, &extension);
-  }
-};
-
-class IpTable {
-public:
-  virtual ~IpTable();
-
-  /**
-   * 更新IP表
-   * @param map_xml
-   * @return
-   */
-  static int Update(const std::string& map_xml);
-
-  /**
-   * 加载IP表
-   * @param map_xml
-   * @return
-   */
-  static int Load(std::string* map_xml);
-
-  /**
-   * 从IP表中查找指定分机的网络配置
-   *
-   * @param building 栋
-   * @param unit 单元
-   * @param number 室
-   * @param extension 分机号
-   * @param profile 对应的网络配置
-   * @return success 0
-   */
-  static int GetExtension(int building, int unit, int number, int extension,
-      NetworkProfile* profile);
-
-  /**
-   * 从IP表中查找指定门口机的网络配置
-   * @param building 栋
-   * @param unit 单元
-   * @return success 0
-   */
-  static int GetGate(int building, int unit, NetworkProfile* profile);
-
-  static std::string GetVersion();
-
-private:
-  IpTable();
-
-};
-
-} /* namespace i */
-
-#endif /* JNI_CORE_IP_TABLE_H_ */

+ 202 - 0
jni/logic/colorLogic.cc

@@ -0,0 +1,202 @@
+#pragma once
+#include "uart/ProtocolSender.h"
+/*
+*此文件由GUI工具生成
+*文件功能:用于处理用户的逻辑相应代码
+*功能说明:
+*========================onButtonClick_XXXX
+当页面中的按键按下后系统会调用对应的函数,XXX代表GUI工具里面的[ID值]名称,
+如Button1,当返回值为false的时候系统将不再处理这个按键,返回true的时候系统将会继续处理此按键。比如SYS_BACK.
+*========================onSlideWindowItemClick_XXXX(int index) 
+当页面中存在滑动窗口并且用户点击了滑动窗口的图标后系统会调用此函数,XXX代表GUI工具里面的[ID值]名称,
+如slideWindow1;index 代表按下图标的偏移值
+*========================onSeekBarChange_XXXX(int progress) 
+当页面中存在滑动条并且用户改变了进度后系统会调用此函数,XXX代表GUI工具里面的[ID值]名称,
+如SeekBar1;progress 代表当前的进度值
+*========================ogetListItemCount_XXXX() 
+当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表的总数目,XXX代表GUI工具里面的[ID值]名称,
+如List1;返回值为当前列表的总条数
+*========================oobtainListItemData_XXXX(ZKListView::ZKListItem *pListItem, int index)
+ 当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表当前条目下的内容信息,XXX代表GUI工具里面的[ID值]名称,
+如List1;pListItem 是贴图中的单条目对象,index是列表总目的偏移量。具体见函数说明
+*========================常用接口===============
+*LOGD(...)  打印调试信息的接口
+*mTextXXXPtr->setText("****") 在控件TextXXX上显示文字****
+*mButton1Ptr->setSelected(true); 将控件mButton1设置为选中模式,图片会切换成选中图片,按钮文字会切换为选中后的颜色
+*mSeekBarPtr->setProgress(12) 在控件mSeekBar上将进度调整到12
+*mListView1Ptr->refreshListView() 让mListView1 重新刷新,当列表数据变化后调用
+*mDashbroadView1Ptr->setTargetAngle(120) 在控件mDashbroadView1上指针显示角度调整到120度
+*
+* 在Eclipse编辑器中  使用 “alt + /”  快捷键可以打开智能提示
+*/
+
+int color = 0;
+bool contactShow = false;
+
+/**
+ * 注册定时器
+ * 填充数组用于注册定时器
+ * 注意:id不能重复
+ */
+static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
+	//{0,  6000}, //定时器id=0, 时间间隔6秒
+	//{1,  1000},
+};
+
+/**
+ * 当界面构造时触发
+ */
+static void onUI_init(){
+    //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
+	mColorPainterPtr->setLineWidth(1);
+	mColorPainterPtr->setSourceColor(0xFF000000);
+
+}
+
+/**
+ * 当切换到该界面时触发
+ */
+static void onUI_intent(const Intent *intentPtr) {
+    if (intentPtr != NULL) {
+        //TODO
+    }
+}
+
+/*
+ * 当界面显示时触发
+ */
+static void onUI_show() {
+	EASYUICONTEXT->hideNaviBar();
+	EASYUICONTEXT->hideStatusBar();
+
+	color = 0;
+	contactShow = false;
+}
+
+/*
+ * 当界面隐藏时触发
+ */
+static void onUI_hide() {
+
+}
+
+/*
+ * 当界面完全退出时触发
+ */
+static void onUI_quit() {
+	EASYUICONTEXT->showStatusBar();
+
+}
+
+/**
+ * 串口数据回调接口
+ */
+static void onProtocolDataUpdate(const SProtocolData &data) {
+
+}
+
+/**
+ * 定时器触发函数
+ * 不建议在此函数中写耗时操作,否则将影响UI刷新
+ * 参数: id
+ *         当前所触发定时器的id,与注册时的id相同
+ * 返回值: true
+ *             继续运行当前定时器
+ *         false
+ *             停止运行当前定时器
+ */
+static bool onUI_Timer(int id){
+	switch (id) {
+
+		default:
+			break;
+	}
+    return true;
+}
+
+/**
+ * 有新的触摸事件时触发
+ * 参数:ev
+ *         新的触摸事件
+ * 返回值:true
+ *            表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
+ *         false
+ *            触摸事件将继续传递到控件上
+ */
+static bool oncolorActivityTouchEvent(const MotionEvent &ev) {
+    switch (ev.mActionStatus) {
+		case MotionEvent::E_ACTION_DOWN://触摸按下
+			//LOGD("时刻 = %ld 坐标  x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
+			if (contactShow) {
+				mColorPainterPtr->fillRect(ev.mX - 4, ev.mY - 4, 8, 8);
+			}
+			break;
+		case MotionEvent::E_ACTION_MOVE://触摸滑动
+			if (contactShow) {
+				mColorPainterPtr->fillRect(ev.mX - 4, ev.mY - 4, 8, 8);
+			}
+			break;
+		case MotionEvent::E_ACTION_UP:  //触摸抬起
+			break;
+		default:
+			break;
+	}
+	return false;
+}
+
+static bool onButtonClick_ColorButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ColorButton !!!\n");
+    if (color == 1) {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFFFFFF00);
+    }
+    else if (color == 2) {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFFFF0000);
+    }
+    else if (color == 3) {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFF0000FF);
+    }
+    else if (color == 4) {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFF00FFFF);
+    }
+    else if (color == 5) {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFF008000);
+    }
+    else if (color == 6) {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFF800080);
+    }
+    else if (color == 7) {
+    	color = 0;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFF000000);
+    }
+    else {
+    	color += 1;
+    	mColorButtonPtr->setBgStatusColor(ZK_CONTROL_STATUS_NORMAL, 0xFFFFFFFF);
+    }
+    return false;
+}
+
+static bool onButtonClick_ContactButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ContactButton !!!\n");
+    mContactWindowPtr->showWnd();
+    contactShow = true;
+    return false;
+}
+
+static bool onButtonClick_sys_back(ZKButton *pButton) {
+    LOGD(" ButtonClick sys_back !!!\n");
+    return false;
+}
+
+static bool onButtonClick_BackButton(ZKButton *pButton) {
+    LOGD(" ButtonClick BackButton !!!\n");
+    mContactWindowPtr->hideWnd();
+    mColorPainterPtr->erase(0, 0, 1024,600);
+    contactShow = false;
+    return false;
+}

+ 351 - 381
jni/logic/mainLogic.cc

@@ -80,431 +80,377 @@ static std::string cencalByDoorTid = "";
 #define SLEEP_STRAT_TIME_HANDLE 9	// 息屏
 
 
+static bool deviceRequest = false;
+static bool frameRequest = false;
+#define REQUEST_TIME_HANDLE 200	// 重新请求
 
 
-//======================================= udp 请示服务器信息
-static net::Conn* udpConn;
-class UdpThread: public Thread {
-public:
-	static void getServerInfo(){
-
-		string url = getHttpGateway() + "/ncs_url/server_info";
-		LOGD("请求服务器信息. url = %s", url.c_str());
-		//发起HTTP GET请求
-		RestClient::Response r = RestClient::get(url);
-        LOGD("请求服务器信息. result = %s", r.body.c_str());
-        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;
-		if (reader.parse(r.body, root, false)){
-			// http
-			StoragePreferences::putString(STORE_GATEWAY, root["http_local_ip"].asString());
-			StoragePreferences::putInt(STORE_HTTP_PORT, root["http_port"].asInt());
+static void requestTimeHandle() {
+	if (deviceRequest != frameRequest) {
+		LOGD("启动定时任务,重新请求数据");
+		mActivityPtr->registerUserTimer(REQUEST_TIME_HANDLE, 10 * 60 * 1000);
+	}
+}
 
-			// tcp
-			StoragePreferences::putString(STORE_TCP_LOCAL_IP, root["tcp_local_ip"].asString());
-			StoragePreferences::putInt(STORE_TCP_PORT, root["tcp_port"].asInt());
 
-			// sip
-			StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());
-			StoragePreferences::putInt(SIP_REG_PORT, root["sip_port"].asInt());
+static void getServerInfo(){
 
-			serverInfo = false;	// 只有请求成功了,才不需要重复请求
-		}
+	string url = getHttpGateway() + "/ncs_url/server_info";
+	LOGD("请求服务器信息. url = %s", url.c_str());
+	//发起HTTP GET请求
+	RestClient::Response r = RestClient::get(url);
+	LOGD("请求服务器信息. result = %s", r.body.c_str());
+	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);
 
-	static void getDeviceInfo(){
-		if (dataInit){
-			getFrameInfo();
-			//getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
-			reinforceDispaly();
-			setDirectorAndHeadNurse();
-			getTemplate();
-			return;
-		}
-		string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
-		LOGD("请求设备信息. url = %s", url.c_str());
-		//发起HTTP GET请求
-		RestClient::Response r = RestClient::get(url);
-		LOGD("获得设备信息. result = %s", r.body.c_str());
-		//解析json
-		Json::Reader reader;
-		Json::Value root;
-		if (reader.parse(r.body, root, false)){
-			string partName = root["part_display"].asString();
-			StoragePreferences::putString(STORE_PARTNAME,partName);
-			NavibarSetPartName(partName);
-			//设备
-			StoragePreferences::putInt(STORE_DEVICE_ID, root["id"].asInt());
-			StoragePreferences::putInt(STORE_DEVICE_TYPE, root["device_type"].asInt());
-
-			//SIP存储
-//			StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());	// 应该去找配置文件里的sip-ip
-			StoragePreferences::putString(SIP_REG_ACCOUNT,root["sip_id"].asString());
-			StoragePreferences::putString(SIP_REG_PASSWORD, root["sip_password"].asString());
-
-			frameInfo["frame_id"] = root["frame_id"].asInt();
-			frameInfo["full_name"] = root["full_name"].asString();
-			frameInfo["part_id"] = root["part_id"].asInt();
-			getFrameInfo();
-
-			//获取科室设置
-			string partId = root["part_id"].asString();
-			StoragePreferences::putString(STORE_PARTID, partId);
-			getPartSetting(partId);
-			getVersion();
+			//重启
+			sync();
+			reboot(RB_AUTOBOOT);
 		}
+		return;
 	}
-	// 读取空间缓存的数据
-	static void getFrameInfo() {
-		mRoomNamePtr->setText(frameInfo["full_name"].asString());
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+	if (reader.parse(r.body, root, false)){
+		// http
+		StoragePreferences::putString(STORE_GATEWAY, root["http_local_ip"].asString());
+		StoragePreferences::putInt(STORE_HTTP_PORT, root["http_port"].asInt());
+
+		// tcp
+		StoragePreferences::putString(STORE_TCP_LOCAL_IP, root["tcp_local_ip"].asString());
+		StoragePreferences::putInt(STORE_TCP_PORT, root["tcp_port"].asInt());
+
+		// sip
+		StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());
+		StoragePreferences::putInt(SIP_REG_PORT, root["sip_port"].asInt());
+
+		serverInfo = false;	// 只有请求成功了,才不需要重复请求
 	}
 
-	static void getFrameRoom(int frame_id) {
-		string url = getHttpGateway() + "/deviceRoom/get_frame_room/" + to_string(frame_id);
-		LOGD("请求房间信息. url = %s", url.c_str());
-		//发起HTTP GET请求
-		RestClient::Response r = RestClient::get(url);
-		LOGD("获得房间信息. result = %s", r.body.c_str());
-		//解析json
-		Json::Reader reader;
-		Json::Value root;
-		if (reader.parse(r.body, root, false)){
-			frameRoom = root;
-			frameBedList = root["frame_bed_list"];
-			if (mBedListViewPtr != NULL) {
-				mBedListViewPtr->refreshListView();
-			}
-		}
-	}
+}
 
+// 读取空间缓存的数据
+static void getFrameInfo() {
+	mRoomNamePtr->setText(frameInfo["full_name"].asString());
+}
 
-	static void getPartSetting(string partId){
-		string url = getHttpGateway() + "/deviceBed/getPartSetting/" + partId;
-		LOGD("请求科室信息. url = %s", url.c_str());
-		//发起HTTP GET请求
-		RestClient::Response r = RestClient::get(url);
-		LOGD("获得科室信息. result = %s", r.body.c_str());
-		//解析json
-		Json::Reader reader;
-		Json::Value root;
-		if (reader.parse(r.body, root, false)){
-			partSetting.partId = root["part_id"].asInt();
-			partSetting.dayStart = root["day_start"].asString();
-			partSetting.dayLight = root["day_light"].asInt();
-			partSetting.dayVol = root["day_vol"].asInt();
-			partSetting.dayRingVol = root["day_ring_vol"].asInt();
-			partSetting.dayRingTimes = root["day_ring_times"].asInt();
-			partSetting.dayNurseLed = root["day_nurse_led"].asInt();
-			partSetting.dayDoorVol = root["day_door_vol"].asInt();
-			partSetting.dayBedVol = root["day_bed_vol"].asInt();
-			partSetting.dayTransferBoxVol = root["day_transfer_box_vol"].asInt();
-			partSetting.dayTransferBoxSystemVol = root["day_transfer_box_system_vol"].asInt();
-			partSetting.nightStart = root["night_start"].asString();
-			partSetting.nightLight = root["night_light"].asInt();
-			partSetting.nightVol = root["night_vol"].asInt();
-			partSetting.nightRingVol = root["night_ring_vol"].asInt();
-			partSetting.nightRingTimes = root["night_ring_times"].asInt();
-			partSetting.nightNurseLed = root["night_nurse_led"].asInt();
-			partSetting.nightDoorVol = root["night_door_vol"].asInt();
-			partSetting.nightBedVol = root["night_bed_vol"].asInt();
-			partSetting.nightTransferBoxVol = root["night_transfer_box_vol"].asInt();
-			partSetting.nightTransferBoxSystemVol = root["night_transfer_box_system_vol"].asInt();
-			partSetting.sleepSecondsNurse = root["sleep_seconds_nurse"].asInt();
-			partSetting.sleepSecondsDoor = root["sleep_seconds_door"].asInt();
-			partSetting.sleepSecondsBed = root["sleep_seconds_bed"].asInt();
-			partSetting.sipOvertime = root["sip_overtime"].asInt();
-			partSetting.transferDuration = root["transfer_duration"].asInt();
-			partSetting.transferDurationLeader = root["transfer_duration_leader"].asInt();
-			partSetting.communicationModeBed = root["communication_mode_bed"].asInt();
-			partSetting.communicationModeNurse = root["communication_mode_nurse"].asInt();
-			partSetting.communicationModeMobile = root["communication_model_mobile"].asInt();
-			partSetting.customizeRoleCallFirst = root["customize_role_call_first"].asInt();
-			partSetting.customizeRoleCallSecond = root["customize_role_call_second"].asInt();
-			partSetting.customizeRoleCallThird = root["customize_role_call_third"].asInt();
-			partSetting.customizeRoleCallFourth = root["customize_role_call_fourth"].asInt();
-			partSetting.customizeRoleCallFifth = root["customize_role_call_fifth"].asInt();
-			partSetting.customizeHospitalCallFirst = root["customize_hospital_call_first"].asInt();
-			partSetting.customizeHospitalCallFirstName = root["customize_hospital_call_first_name"].asString();
-			partSetting.customizeHospitalCallSecond = root["customize_hospital_call_second"].asInt();
-			partSetting.customizeHospitalCallSecondName = root["customize_hospital_second_name"].asString();
-			partSetting.customizeHospitalCallThird = root["customize_hospital_call_third"].asInt();
-			partSetting.customizeHospitalCallThirdName = root["customize_hospital_call_third_name"].asString();
-			partSetting.doctorTitle = root["doctor_title"].asString();
-			partSetting.doctorValid = root["doctor_valid"].asInt();
-			partSetting.nurseTitle = root["nurse_title"].asString();
-			partSetting.nurseValid = root["nurse_valid"].asInt();
-			partSetting.partDirector = root["part_director"].asString();
-			partSetting.partNurseHead = root["part_nurse_head"].asString();
-			partSetting.doorNurseTitle = root["door_nurse_title"].asString();
-			partSetting.doorNurseValid = root["door_nurse_valid"].asInt();
-			partSetting.doorNursingTitle = root["door_nursing_title"].asString();
-			partSetting.doorNursingValid = root["door_nursing_valid"].asInt();
-			partSetting.upSeconds = root["up_seconds"].asInt();
-			partSetting.autoAccept = root["auto_accept"].asInt();
-			partSetting.eventForward = root["event_forward"].asInt();
-			partSetting.nursingColorRgb = root["nursing_color_rgb"].asString();
-			partSetting.twoColorDoorLightValid = root["two_color_door_light_valid"].asInt();
-			partSetting.qrUrl = root["qr_url"].asString();
-			partSetting.screenLight = root["screen_light"].asInt();
-			partSetting.roomCallBed = root["room_call_bed"].asInt();
-
-			if (root["linux_door_volume_native"].size() != 0) {
-				partSetting.linuxDoorVolumeNative = root["linux_door_volume_native"].asInt();
-				partSetting.linuxDoorGainSize = root["linux_door_gain_size"].asInt();
-
-				zk_audio_input_set_volume_native(0, 0);
-				zk_audio_input_set_volume_native(1, partSetting.linuxDoorVolumeNative);
-				GetTelephone()->SetInputPcmGainSize(partSetting.linuxDoorGainSize);
-
-				StoragePreferences::putInt(STORE_VOLUME_NATIVE, partSetting.linuxDoorVolumeNative);
-				StoragePreferences::putInt(STORE_GAIN_SIZE, partSetting.linuxDoorGainSize);
-			}
+static void getFrameRoom(int frame_id) {
+	string url = getHttpGateway() + "/deviceRoom/get_frame_room/" + to_string(frame_id);
+	LOGD("请求房间信息. url = %s", url.c_str());
+	RestClient::Response r = RestClient::get(url);
+	//发起HTTP GET请求
+	if (r.code != 200) {
+		LOGD("请求房间信息错误. 错误代码 = %d", r.code);
+		if (!frameRequest) {
+			frameRequest = true;
+			requestTimeHandle();
+		}
+		return;
+	}
+	LOGD("获得房间信息. result = %s", r.body.c_str());
+	frameRequest = false;
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+	if (reader.parse(r.body, root, false)){
+		frameRoom = root;
+		frameBedList = root["frame_bed_list"];
+		if (mBedListViewPtr != NULL) {
+			mBedListViewPtr->refreshListView();
+		}
+	}
+}
 
-			StoragePreferences::putString(STORE_DAY_START, partSetting.dayStart);
-			StoragePreferences::putInt(STORE_DAY_LIGHT,partSetting.dayLight);
-			StoragePreferences::putInt(STORE_DAY_VOL,partSetting.dayBedVol);
-			StoragePreferences::putInt(STORE_DAY_RING_TIMES,partSetting.dayRingTimes);
+static void callBedButtonSetVisible() {
+	int roomCallBed = StoragePreferences::getInt(STORE_ROOM_CALL_BED, 1);
+	if (!roomCallBed) {
+		// 如果roomCallBed是0的话,那就隐藏
+		mCallBedButtonPtr->setVisible(roomCallBed);
 
-			StoragePreferences::putString(STORE_NIGHT_START, partSetting.nightStart);
-			StoragePreferences::putInt(STORE_NIGHT_LIGHT,partSetting.nightLight);
-			StoragePreferences::putInt(STORE_NIGHT_VOL,partSetting.nightBedVol);
-			StoragePreferences::putInt(STORE_NIGHT_RING_TIMES,partSetting.nightRingTimes);
+		mCallNurseButtonPtr->setPosition(LayoutPosition(869, 160, 140, 55));
+		mCallCencelButtonPtr->setPosition(LayoutPosition(869, 241, 140, 55));
+		mHelpButtonPtr->setPosition(LayoutPosition(869, 323, 140, 55));
+		mNursingButtonPtr->setPosition(LayoutPosition(869, 404, 140, 55));
+		mMoreButtonPtr->setPosition(LayoutPosition(869, 485, 140, 55));
 
-			StoragePreferences::putInt(STORE_SLEEP_TIME, partSetting.sleepSecondsDoor);
+	}
+	else {
+		// 如果roomCallBed是1的话,那就显示
+		mCallBedButtonPtr->setVisible(roomCallBed);
+
+		mCallNurseButtonPtr->setPosition(LayoutPosition(869, 185, 140, 55));
+		mCallCencelButtonPtr->setPosition(LayoutPosition(869, 260, 140, 55));
+		mHelpButtonPtr->setPosition(LayoutPosition(869, 335, 140, 55));
+		mNursingButtonPtr->setPosition(LayoutPosition(869, 410, 140, 55));
+		mMoreButtonPtr->setPosition(LayoutPosition(869, 485, 140, 55));
+	}
+}
 
-			StoragePreferences::putString(STORE_DOCTOR_TITLE, partSetting.doctorTitle);
-			StoragePreferences::putBool(STORE_DOCTOR_VISIBLE, partSetting.doctorValid==1);
-			StoragePreferences::putString(STORE_NURSE_TITLE, partSetting.nurseTitle);
-			StoragePreferences::putBool(STORE_NURSE_VISIBLE, partSetting.nurseValid==1);
+// 将医生和护士别称缓存起来
+static void setRightTitle(Json::Value partSetting) {
+	rightTitleInfo["doctor_title"] = partSetting["doctor_title"].asString();
+	rightTitleInfo["doctor_valid"] = partSetting["doctor_valid"].asInt();
+	rightTitleInfo["nurse_title"] = partSetting["nurse_title"].asString();
+	rightTitleInfo["nurse_valid"] = partSetting["nurse_valid"].asInt();
+}
 
-			StoragePreferences::putString(STORE_NURSING_COLOR_RGB, partSetting.nursingColorRgb);
-			StoragePreferences::putBool(STORE_AUDO_ANSWER, partSetting.autoAccept==1);
-			StoragePreferences::putInt(STORE_SCREEN_LIGHT, partSetting.screenLight);
-			StoragePreferences::putInt(STORE_ROOM_CALL_BED, partSetting.roomCallBed);
+static void setDirectorAndHeadNurse() {
+	mDirectorTextViewPtr->setText(partSetting.partDirector);
+	mHeadNurseTextViewPtr->setText(partSetting.partNurseHead);
+}
 
-			setRightTitle(root);
-			callBedButtonSetVisible();
-			setDirectorAndHeadNurse();
+static void getVersion() {
+	std::string url = getHttpGateway() + "/deviceRoom/get_app_version?device_type=303&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
+	std::string content_type = std::string("application/json");
 
-			getFrameRoom(frameInfo["frame_id"].asInt());
+	LOGD("请求版本信息. url = %s", url.c_str());
+	//发起HTTP POST请求
+	RestClient::Response r = RestClient::post(url, content_type, "");
+	if (r.code != 200) {
+		LOGD("请求版本信息-> 错误代码: %d", r.code);
+		return;
+	}
 
-			dataInit = true;
+	LOGD("获得版本信息. result = %s", r.body.c_str());
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+
+	if(reader.parse(r.body, root, false)) {
+		int currentVersionNo = getVersionNo();
+		int responseVersionNo = root["version_no"].asInt();
+		std::string responseVersion = root["version_code"].asString();
+		LOGD("服务器版本 : %s %d, 当前设备版本: %d", responseVersion.c_str(), responseVersionNo, currentVersionNo);
+
+		if (currentVersionNo < responseVersionNo) {
+			Intent* intent = new Intent();
+			intent->putExtra(appUpdate, "true");
+			EASYUICONTEXT->openActivity("DeviceUpdateActivity", intent);
 		}
 	}
 
-	static void callBedButtonSetVisible() {
-		int roomCallBed = StoragePreferences::getInt(STORE_ROOM_CALL_BED, 1);
-		if (!roomCallBed) {
-			// 如果roomCallBed是0的话,那就隐藏
-			mCallBedButtonPtr->setVisible(roomCallBed);
+}
 
-			mCallNurseButtonPtr->setPosition(LayoutPosition(869, 160, 140, 55));
-			mCallCencelButtonPtr->setPosition(LayoutPosition(869, 241, 140, 55));
-			mHelpButtonPtr->setPosition(LayoutPosition(869, 323, 140, 55));
-			mNursingButtonPtr->setPosition(LayoutPosition(869, 404, 140, 55));
-			mMoreButtonPtr->setPosition(LayoutPosition(869, 485, 140, 55));
+// 判断是否处于增援状态,处于增援状态,就要显示蓝色
+static void reinforceDispaly() {
+	if (reinforce) {
+//			SetPainterInfo(0xFF2F9DF1, "增援已发出");
+//			setHelpButton("/button/button_help3.png" ,false);
+		setPainterInfo(StoragePreferences::getInt(STORE_DEVICE_ID,0), 0xFF2F9DF1, LANGUAGEMANAGER->getValue("HelpInfo"), "REINFORCE", "ADD", 60);
+	}
+}
 
-		}
-		else {
-			// 如果roomCallBed是1的话,那就显示
-			mCallBedButtonPtr->setVisible(roomCallBed);
-
-			mCallNurseButtonPtr->setPosition(LayoutPosition(869, 185, 140, 55));
-			mCallCencelButtonPtr->setPosition(LayoutPosition(869, 260, 140, 55));
-			mHelpButtonPtr->setPosition(LayoutPosition(869, 335, 140, 55));
-			mNursingButtonPtr->setPosition(LayoutPosition(869, 410, 140, 55));
-			mMoreButtonPtr->setPosition(LayoutPosition(869, 485, 140, 55));
-		}
+static void getTemplate() {
+	int templateInt = StoragePreferences::getInt(STORE_TEMPLATE, 1);
+	LOGD("templateInt =====> %d", templateInt);
+	if (templateInt == 1) {
+		mDirectorTextViewPtr->setVisible(false);
+		mDirectorTitleTextViewPtr->setVisible(false);
+		mHeadNurseTextViewPtr->setVisible(false);
+		mHeadNurseTitleTextViewPtr->setVisible(false);
+
+		mBedListViewPtr->setPosition(LayoutPosition(6, 90, 855, 465));
 	}
+	else if (templateInt == 2) {
+		mDirectorTextViewPtr->setVisible(true);
+		mDirectorTitleTextViewPtr->setVisible(true);
+		mHeadNurseTextViewPtr->setVisible(true);
+		mHeadNurseTitleTextViewPtr->setVisible(true);
 
-	// 将医生和护士别称缓存起来
-	static void setRightTitle(Json::Value partSetting) {
-		rightTitleInfo["doctor_title"] = partSetting["doctor_title"].asString();
-		rightTitleInfo["doctor_valid"] = partSetting["doctor_valid"].asInt();
-		rightTitleInfo["nurse_title"] = partSetting["nurse_title"].asString();
-		rightTitleInfo["nurse_valid"] = partSetting["nurse_valid"].asInt();
+		mBedListViewPtr->setPosition(LayoutPosition(6, 90, 855, 395));
 	}
+	else if (templateInt == 3) {
+		mDirectorTextViewPtr->setVisible(false);
+		mDirectorTitleTextViewPtr->setVisible(false);
+		mHeadNurseTextViewPtr->setVisible(false);
+		mHeadNurseTitleTextViewPtr->setVisible(false);
 
-	static void setDirectorAndHeadNurse() {
-		mDirectorTextViewPtr->setText(partSetting.partDirector);
-		mHeadNurseTextViewPtr->setText(partSetting.partNurseHead);
+		mBedListViewPtr->setPosition(LayoutPosition(6, 90, 855, 465));
 	}
 
-	static void getVersion() {
-		std::string url = getHttpGateway() + "/deviceRoom/get_app_version?device_type=303&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
-		std::string content_type = std::string("application/json");
+}
 
-		LOGD("请求版本信息. url = %s", url.c_str());
-		//发起HTTP POST请求
-		RestClient::Response r = RestClient::post(url, content_type, "");
-		if (r.code != 200) {
-			LOGD("请求版本信息-> 错误代码: %d", r.code);
-			return;
+static void getPartSetting(string partId){
+	string url = getHttpGateway() + "/deviceBed/getPartSetting/" + partId;
+	LOGD("请求科室信息. url = %s", url.c_str());
+	//发起HTTP GET请求
+	RestClient::Response r = RestClient::get(url);
+	LOGD("获得科室信息. result = %s", r.body.c_str());
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+	if (reader.parse(r.body, root, false)){
+		partSetting.partId = root["part_id"].asInt();
+		partSetting.dayStart = root["day_start"].asString();
+		partSetting.dayLight = root["day_light"].asInt();
+		partSetting.dayVol = root["day_vol"].asInt();
+		partSetting.dayRingVol = root["day_ring_vol"].asInt();
+		partSetting.dayRingTimes = root["day_ring_times"].asInt();
+		partSetting.dayNurseLed = root["day_nurse_led"].asInt();
+		partSetting.dayDoorVol = root["day_door_vol"].asInt();
+		partSetting.dayBedVol = root["day_bed_vol"].asInt();
+		partSetting.dayTransferBoxVol = root["day_transfer_box_vol"].asInt();
+		partSetting.dayTransferBoxSystemVol = root["day_transfer_box_system_vol"].asInt();
+		partSetting.nightStart = root["night_start"].asString();
+		partSetting.nightLight = root["night_light"].asInt();
+		partSetting.nightVol = root["night_vol"].asInt();
+		partSetting.nightRingVol = root["night_ring_vol"].asInt();
+		partSetting.nightRingTimes = root["night_ring_times"].asInt();
+		partSetting.nightNurseLed = root["night_nurse_led"].asInt();
+		partSetting.nightDoorVol = root["night_door_vol"].asInt();
+		partSetting.nightBedVol = root["night_bed_vol"].asInt();
+		partSetting.nightTransferBoxVol = root["night_transfer_box_vol"].asInt();
+		partSetting.nightTransferBoxSystemVol = root["night_transfer_box_system_vol"].asInt();
+		partSetting.sleepSecondsNurse = root["sleep_seconds_nurse"].asInt();
+		partSetting.sleepSecondsDoor = root["sleep_seconds_door"].asInt();
+		partSetting.sleepSecondsBed = root["sleep_seconds_bed"].asInt();
+		partSetting.sipOvertime = root["sip_overtime"].asInt();
+		partSetting.transferDuration = root["transfer_duration"].asInt();
+		partSetting.transferDurationLeader = root["transfer_duration_leader"].asInt();
+		partSetting.communicationModeBed = root["communication_mode_bed"].asInt();
+		partSetting.communicationModeNurse = root["communication_mode_nurse"].asInt();
+		partSetting.communicationModeMobile = root["communication_model_mobile"].asInt();
+		partSetting.customizeRoleCallFirst = root["customize_role_call_first"].asInt();
+		partSetting.customizeRoleCallSecond = root["customize_role_call_second"].asInt();
+		partSetting.customizeRoleCallThird = root["customize_role_call_third"].asInt();
+		partSetting.customizeRoleCallFourth = root["customize_role_call_fourth"].asInt();
+		partSetting.customizeRoleCallFifth = root["customize_role_call_fifth"].asInt();
+		partSetting.customizeHospitalCallFirst = root["customize_hospital_call_first"].asInt();
+		partSetting.customizeHospitalCallFirstName = root["customize_hospital_call_first_name"].asString();
+		partSetting.customizeHospitalCallSecond = root["customize_hospital_call_second"].asInt();
+		partSetting.customizeHospitalCallSecondName = root["customize_hospital_second_name"].asString();
+		partSetting.customizeHospitalCallThird = root["customize_hospital_call_third"].asInt();
+		partSetting.customizeHospitalCallThirdName = root["customize_hospital_call_third_name"].asString();
+		partSetting.doctorTitle = root["doctor_title"].asString();
+		partSetting.doctorValid = root["doctor_valid"].asInt();
+		partSetting.nurseTitle = root["nurse_title"].asString();
+		partSetting.nurseValid = root["nurse_valid"].asInt();
+		partSetting.partDirector = root["part_director"].asString();
+		partSetting.partNurseHead = root["part_nurse_head"].asString();
+		partSetting.doorNurseTitle = root["door_nurse_title"].asString();
+		partSetting.doorNurseValid = root["door_nurse_valid"].asInt();
+		partSetting.doorNursingTitle = root["door_nursing_title"].asString();
+		partSetting.doorNursingValid = root["door_nursing_valid"].asInt();
+		partSetting.upSeconds = root["up_seconds"].asInt();
+		partSetting.autoAccept = root["auto_accept"].asInt();
+		partSetting.eventForward = root["event_forward"].asInt();
+		partSetting.nursingColorRgb = root["nursing_color_rgb"].asString();
+		partSetting.twoColorDoorLightValid = root["two_color_door_light_valid"].asInt();
+		partSetting.qrUrl = root["qr_url"].asString();
+		partSetting.screenLight = root["screen_light"].asInt();
+		partSetting.roomCallBed = root["room_call_bed"].asInt();
+		partSetting.customerAgeHiddenOnDoor = root["customer_age_hidden_on_door"].asInt();
+
+		if (root["linux_door_volume_native"].size() != 0) {
+			partSetting.linuxDoorVolumeNative = root["linux_door_volume_native"].asInt();
+			partSetting.linuxDoorGainSize = root["linux_door_gain_size"].asInt();
+
+			zk_audio_input_set_volume_native(0, 0);
+			zk_audio_input_set_volume_native(1, partSetting.linuxDoorVolumeNative);
+			GetTelephone()->SetInputPcmGainSize(partSetting.linuxDoorGainSize);
+
+			StoragePreferences::putInt(STORE_VOLUME_NATIVE, partSetting.linuxDoorVolumeNative);
+			StoragePreferences::putInt(STORE_GAIN_SIZE, partSetting.linuxDoorGainSize);
 		}
 
-		LOGD("获得版本信息. result = %s", r.body.c_str());
-		//解析json
-		Json::Reader reader;
-		Json::Value root;
-
-		if(reader.parse(r.body, root, false)) {
-			int currentVersionNo = getVersionNo();
-			int responseVersionNo = root["version_no"].asInt();
-			std::string responseVersion = root["version_code"].asString();
-			LOGD("服务器版本 : %s %d, 当前设备版本: %d", responseVersion.c_str(), responseVersionNo, currentVersionNo);
-
-			if (currentVersionNo < responseVersionNo) {
-				Intent* intent = new Intent();
-				intent->putExtra(appUpdate, "true");
-				EASYUICONTEXT->openActivity("DeviceUpdateActivity", intent);
-			}
-		}
+		StoragePreferences::putString(STORE_DAY_START, partSetting.dayStart);
+		StoragePreferences::putInt(STORE_DAY_LIGHT,partSetting.dayLight);
+		StoragePreferences::putInt(STORE_DAY_VOL,partSetting.dayBedVol);
+		StoragePreferences::putInt(STORE_DAY_RING_TIMES,partSetting.dayRingTimes);
 
-	}
+		StoragePreferences::putString(STORE_NIGHT_START, partSetting.nightStart);
+		StoragePreferences::putInt(STORE_NIGHT_LIGHT,partSetting.nightLight);
+		StoragePreferences::putInt(STORE_NIGHT_VOL,partSetting.nightBedVol);
+		StoragePreferences::putInt(STORE_NIGHT_RING_TIMES,partSetting.nightRingTimes);
 
-	// 判断是否处于增援状态,处于增援状态,就要显示蓝色
-	static void reinforceDispaly() {
-		if (reinforce) {
-//			SetPainterInfo(0xFF2F9DF1, "增援已发出");
-//			setHelpButton("/button/button_help3.png" ,false);
-			setPainterInfo(StoragePreferences::getInt(STORE_DEVICE_ID,0), 0xFF2F9DF1, LANGUAGEMANAGER->getValue("HelpInfo"), "REINFORCE", "ADD", 60);
-		}
-	}
+		StoragePreferences::putInt(STORE_SLEEP_TIME, partSetting.sleepSecondsDoor);
 
-	static void getTemplate() {
-		int templateInt = StoragePreferences::getInt(STORE_TEMPLATE, 1);
-		LOGD("templateInt =====> %d", templateInt);
-		if (templateInt == 1) {
-			mDirectorTextViewPtr->setVisible(false);
-			mDirectorTitleTextViewPtr->setVisible(false);
-			mHeadNurseTextViewPtr->setVisible(false);
-			mHeadNurseTitleTextViewPtr->setVisible(false);
+		StoragePreferences::putString(STORE_DOCTOR_TITLE, partSetting.doctorTitle);
+		StoragePreferences::putBool(STORE_DOCTOR_VISIBLE, partSetting.doctorValid==1);
+		StoragePreferences::putString(STORE_NURSE_TITLE, partSetting.nurseTitle);
+		StoragePreferences::putBool(STORE_NURSE_VISIBLE, partSetting.nurseValid==1);
 
-			mBedListViewPtr->setPosition(LayoutPosition(6, 90, 855, 465));
-		}
-		else if (templateInt == 2) {
-			mDirectorTextViewPtr->setVisible(true);
-			mDirectorTitleTextViewPtr->setVisible(true);
-			mHeadNurseTextViewPtr->setVisible(true);
-			mHeadNurseTitleTextViewPtr->setVisible(true);
+		StoragePreferences::putString(STORE_NURSING_COLOR_RGB, partSetting.nursingColorRgb);
+		StoragePreferences::putBool(STORE_AUDO_ANSWER, partSetting.autoAccept==1);
+		StoragePreferences::putInt(STORE_SCREEN_LIGHT, partSetting.screenLight);
+		StoragePreferences::putInt(STORE_ROOM_CALL_BED, partSetting.roomCallBed);
 
-			mBedListViewPtr->setPosition(LayoutPosition(6, 90, 855, 395));
-		}
-		else if (templateInt == 3) {
-			mDirectorTextViewPtr->setVisible(false);
-			mDirectorTitleTextViewPtr->setVisible(false);
-			mHeadNurseTextViewPtr->setVisible(false);
-			mHeadNurseTitleTextViewPtr->setVisible(false);
+		setRightTitle(root);
+		callBedButtonSetVisible();
+		setDirectorAndHeadNurse();
 
-			mBedListViewPtr->setPosition(LayoutPosition(6, 90, 855, 465));
-		}
+		getFrameRoom(frameInfo["frame_id"].asInt());
 
+		dataInit = true;
 	}
+}
 
 
-	/**
-	 * 线程创建成功后会调用该函数,可以在该函数中做一些初始化操作
-	 * return true   继续线程
-	 *        false  退出线程
-	 */
-	virtual bool readyToRun() {
-		LOGD("Thread 已经创建完成");
-		return true;
-	}
 
-	/**
-	 * 线程循环函数
-	 *
-	 * return true  继续线程循环
-	 *        false 推出线程
-	 */
-	virtual bool threadLoop() {
-		LOGD("线程循环函数");
-
-		//检查是否有退出线程的请求,如果有,则返回false,立即退出线程
-		if (exitPending()) {
-			return false;
+static void getDeviceInfo(){
+	if (dataInit){
+		getFrameInfo();
+		//getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
+		reinforceDispaly();
+		setDirectorAndHeadNurse();
+		getTemplate();
+		return;
+	}
+	string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
+	LOGD("请求设备信息. url = %s", url.c_str());
+	//发起HTTP GET请求
+	RestClient::Response r = RestClient::get(url);
+	if (r.code != 200) {
+		LOGD("请求设备信息错误. 错误代码 = %d", r.code);
+		if (!deviceRequest) {
+			deviceRequest = true;
+			requestTimeHandle();
 		}
 
-		udpConn = net::Dial("udp", "192.168.1.255:10010");
-		if (udpConn) {
-			byte buf[1024] = {0};
-			const char* req = "search_server";
-			//发送
-			udpConn->Write((byte*)req, strlen(req));
-			while (true && !exitPending()) {
-				//读取,超时10*1000毫秒
-				int n = udpConn->Read(buf, sizeof(buf) - 1, 10*1000);
-				if (n > 0) {
-					buf[n] = 0;
-					char serverStr[1024];
-					sprintf(serverStr,"%s",buf);
-					LOGD("读取 %d字节: %s", n, serverStr);
-
-					//解析json
-					Json::Reader reader;
-					Json::Value root;
-					if (reader.parse(serverStr, root, false)){
-						if (root.isMember("success") && root["success"].asBool()){
-							serverIP = root["data"]["third_server"].asString();
-							serverHttpPort = root["data"]["third_server_port"].asInt();
-
-							StoragePreferences::putString(STORE_GATEWAY, serverIP);
-							StoragePreferences::putInt(STORE_HTTP_PORT, serverHttpPort);
-
-							//先获取服务器信息
-							//getServerInfo();
-							//就当在获取服务器信息完成后获取用户信息,这里测试用
-							//getCustomerInfo();
-							//退出UDP线程
-							pthread_exit(NULL);
-							break;
-						}
-					}
-				} else if (n == 0) {
-					LOGD("连接正常断开");
-					break;
-				} else if (n == net::E_TIMEOUT) {
-					udpConn->Write((byte*)req, strlen(req));
-					LOGD("读取超时");
-				} else {
-					LOGD("出错");
-					break;
-				}
-			}
-			//关闭连接
-			udpConn->Close();
-			//释放内存
-			delete udpConn;
-			udpConn = NULL;
-		}
+		return;
+	}
 
-		//返回真,继续下次线程循环
-		return true;
+	LOGD("获得设备信息. result = %s", r.body.c_str());
+	deviceRequest = false;
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+	if (reader.parse(r.body, root, false)){
+		string partName = root["part_display"].asString();
+		StoragePreferences::putString(STORE_PARTNAME,partName);
+		NavibarSetPartName(partName);
+		//设备
+		StoragePreferences::putInt(STORE_DEVICE_ID, root["id"].asInt());
+		StoragePreferences::putInt(STORE_DEVICE_TYPE, root["device_type"].asInt());
+
+		//SIP存储
+//			StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());	// 应该去找配置文件里的sip-ip
+		StoragePreferences::putString(SIP_REG_ACCOUNT,root["sip_id"].asString());
+		StoragePreferences::putString(SIP_REG_PASSWORD, root["sip_password"].asString());
+
+		frameInfo["frame_id"] = root["frame_id"].asInt();
+		frameInfo["full_name"] = root["full_name"].asString();
+		frameInfo["part_id"] = root["part_id"].asInt();
+		getFrameInfo();
+
+		//获取科室设置
+		string partId = root["part_id"].asString();
+		StoragePreferences::putString(STORE_PARTID, partId);
+		getPartSetting(partId);
+		getVersion();
 	}
-};
+}
 
-static UdpThread udp_thread;
 
 
 void setReinforce(bool result) {
@@ -635,15 +581,15 @@ void dataRefresh() {
 	}
 
 	if (serverInfo) {
-		udp_thread.getServerInfo();
+		getServerInfo();
 	}
 	dataInit = false;
-	udp_thread.getDeviceInfo();
+	getDeviceInfo();
 	mBedListViewPtr->refreshListView();
 }
 
 void getPartSetting() {
-	udp_thread.getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
+	getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
 }
 
 
@@ -696,7 +642,7 @@ void sendNursingEnd() {
 }
 
 void setTemplate() {
-	udp_thread.getTemplate();
+	getTemplate();
 	mBedListViewPtr->refreshListView();
 }
 
@@ -719,9 +665,9 @@ static void onUI_init(){
 	LOGD("进入mainLogic页面, 触发 onUI_init");
 	if (ETHERNETMANAGER->isConnected() || WIFIMANAGER->isConnected()) {
 		if(serverInfo) {	// 如果是false,就是不需要
-			udp_thread.getServerInfo();
+			getServerInfo();
 		}
-		udp_thread.getDeviceInfo();
+		getDeviceInfo();
 	}
 
 	if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {	// 如果处于护理状态
@@ -826,6 +772,20 @@ static bool onUI_Timer(int id){
 			}
 		}
 		break;
+
+	case REQUEST_TIME_HANDLE:
+	{
+		if (deviceRequest) {
+			getDeviceInfo();
+		}
+		if (frameRequest) {
+			getFrameRoom(frameInfo["frame_id"].asInt());
+		}
+		if (!deviceRequest && !frameRequest) {
+			return false;
+		}
+	}
+	break;
 	default:
 		break;
 	}
@@ -950,7 +910,17 @@ static void obtainListItemData_BedListView(ZKListView *pListView,ZKListView::ZKL
 		} else {
 			pListItem->findSubItemByID(ID_MAIN_CustomerName)->setText(customerName);
 		}
-		pListItem->findSubItemByID(ID_MAIN_CustomerAge)->setText(frameBedList[index]["customer_age"].asString() + frameBedList[index]["customer_age_unit"].asString());
+
+		if (partSetting.customerAgeHiddenOnDoor != 0) {
+			if (frameBedList[index]["customer_age"].asString() == "") {
+				pListItem->findSubItemByID(ID_MAIN_CustomerAge)->setText("");
+			} else {
+				pListItem->findSubItemByID(ID_MAIN_CustomerAge)->setText("*" + frameBedList[index]["customer_age_unit"].asString());
+			}
+		}
+		else {
+			pListItem->findSubItemByID(ID_MAIN_CustomerAge)->setText(frameBedList[index]["customer_age"].asString() + frameBedList[index]["customer_age_unit"].asString());
+		}
 
 		string customerSex = frameBedList[index]["customer_sex"].asString();
 		if (customerSex == "0") {	// 如果性别为女性,则替换成女性头像,和女性的图标

+ 6 - 0
jni/logic/sipTestLogic.cc

@@ -191,6 +191,7 @@ static void onUI_intent(const Intent *intentPtr) {
 static void onUI_show() {
 	// 切换成SIP模式
 	StoragePreferences::putString(STORE_SIGNAL_TYPE, "SIP");
+	EASYUICONTEXT->hideNaviBar();
 
 }
 
@@ -309,3 +310,8 @@ static bool onButtonClick_sip_back(ZKButton *pButton) {
     EASYUICONTEXT->goBack();
     return false;
 }
+static bool onButtonClick_ColorTestButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ColorTestButton !!!\n");
+    EASYUICONTEXT->openActivity("colorActivity");
+    return false;
+}

+ 19 - 13
jni/logic/ui3Logic.cc

@@ -260,7 +260,7 @@ static void onUI_init(){
 	string voicePwd = StoragePreferences::getString(SIP_REG_PASSWORD, SIP_REG_PASSWORD_DEFAULT);
 	mVoiceDomainPtr->setText(StoragePreferences::getString(SIP_REG_DOMAIN, SIP_REG_DOMAIN_DEFAULT));
 
-	mVersionPtr->setText(version);
+	mVersionPtr->setText(versionCode);
 
 	//server ip
 	string sIP = StoragePreferences::getString(STORE_GATEWAY, serverIP);
@@ -441,31 +441,37 @@ static bool onButtonClick_sys_back(ZKButton *pButton) {
 }
 static bool onButtonClick_SettingButton(ZKButton *pButton) {
     LOGD(" ButtonClick SettingButton !!!\n");
-    mSettingPasswordWindowPtr->showWnd();
+    EASYUICONTEXT->openActivity("settingActivity");
     return false;
 }
-static void onEditTextChanged_SettingPasswordEditText(const std::string &text) {
-    //LOGD(" onEditTextChanged_ SettingPasswordEditText %s !!!\n", text.c_str());
+static void onEditTextChanged_EditTextServerPort(const std::string &text) {
+    //LOGD(" onEditTextChanged_ EditTextServerPort %s !!!\n", text.c_str());
+}
+static void onEditTextChanged_TestPasswordEditText(const std::string &text) {
+    //LOGD(" onEditTextChanged_ TestPasswordEditText %s !!!\n", text.c_str());
 }
 
-static bool onButtonClick_SettingConfirmButton(ZKButton *pButton) {
-    LOGD(" ButtonClick SettingConfirmButton !!!\n");
-    string pwd = mSettingPasswordEditTextPtr->getText();
+static bool onButtonClick_TestConfirmButton(ZKButton *pButton) {
+    LOGD(" ButtonClick TestConfirmButton !!!\n");
+    string pwd = mTestPasswordEditTextPtr->getText();
 
 	// 密码为888
 	string cpwd = "888";
     if (pwd == cpwd){
     	// 关闭密码输入界面
-    	mSettingPasswordWindowPtr->hideWnd();
-    	// 打开设置界面
-        EASYUICONTEXT->openActivity("settingActivity");
+    	mTestPasswordWindowPtr->hideWnd();
+        // 打开设置界面
+//        EASYUICONTEXT->openActivity("settingActivity");
+        EASYUICONTEXT->openActivity("sipTestActivity");
 		return false;
     } else {
-    	mSettingErrorTextViewPtr->setTextTr("PasswordWrong");
+    	mTestErrorTextViewPtr->setTextTr("PasswordWrong");
     }
 
     return false;
 }
-static void onEditTextChanged_EditTextServerPort(const std::string &text) {
-    //LOGD(" onEditTextChanged_ EditTextServerPort %s !!!\n", text.c_str());
+static bool onButtonClick_SipTestButton(ZKButton *pButton) {
+    LOGD(" ButtonClick SipTestButton !!!\n");
+    mTestPasswordWindowPtr->showWnd();
+    return false;
 }

+ 1 - 1
jni/logic/updateLogic.cc

@@ -207,7 +207,7 @@ static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
 static void onUI_init(){
     //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
 
-	std::string currentVersion = getVersion();
+	std::string currentVersion = getVersionCode();
 	int currentVersionNo = getVersionNo();
 
 	mVersionPtr->setText(currentVersion);	// 写入界面的版本

+ 1 - 1
jni/net/tcp_client.cpp

@@ -100,7 +100,7 @@ public:
 //			tcpModel.data = ETHERNETMANAGER->getMacAddr();
 			Json::Value json;
 			json["identification"] = StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
-			json["software_version"] = version;
+			json["software_version"] = versionCode;
 			json["model"] = "linux_door";;
 			json["code"] = "SW10600101C-CM";
 			tcpModel.json = json;

+ 8 - 5
jni/service/BusinessConfig.h

@@ -64,8 +64,8 @@
 
 #define STORE_MAC_ADDR "mac_addr"
 
-static std::string version = "v1.0.52";
-static int versionNo = 52;
+static std::string versionCode = "v1.0.53";
+static int versionNo = 53;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
@@ -92,9 +92,9 @@ static std::string getTcpGateway(){
 }
 
 
-static std::string getVersion() {
-	LOGD("version -> %s",version);
-	return version;
+static std::string getVersionCode() {
+	LOGD("version -> %s",versionCode);
+	return versionCode;
 }
 
 static int getVersionNo() {
@@ -262,6 +262,9 @@ public:
 	inline static int linuxBedGainSize;
 	inline static int linuxDoorVolumeNative;
 	inline static int linuxDoorGainSize;
+    inline static int customerNameHiddenOnDoor;
+    inline static int customerAgeHiddenOnDoor;
+    inline static int clerkNameHiddenOnDoor;
 };
 
 /**

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/callActivity.o


BIN
obj/activity/colorActivity.o


BIN
obj/activity/mainActivity.o


BIN
obj/activity/settingActivity.o


BIN
obj/activity/sipTestActivity.o


BIN
obj/activity/startActivity.o


BIN
obj/activity/statusbar.o


BIN
obj/activity/ui3Activity.o


BIN
obj/activity/updateActivity.o


BIN
obj/activity/warnActivity.o


BIN
obj/core/update_assistant.o


BIN
obj/net/tcp_client.o


BIN
obj/server/http_server.o


BIN
obj/service/BusinessConfig.o


BIN
obj/service/time.o



BIN
ui/sipTest.ftu