Selaa lähdekoodia

增加颜色测试和触点测试,增加用户年龄隐藏

vothin 1 vuosi sitten
vanhempi
commit
84915bba4e
47 muutettua tiedostoa jossa 1064 lisäystä ja 1639 poistoa
  1. 8 1
      i18n/zh_CN.tr
  2. 416 0
      jni/activity/colorActivity.cpp
  3. 103 0
      jni/activity/colorActivity.h
  4. 4 0
      jni/activity/sipTestActivity.cpp
  5. 1 0
      jni/activity/sipTestActivity.h
  6. 0 102
      jni/core/houseinfo.h
  7. 0 659
      jni/core/jhws.cpp
  8. 0 133
      jni/core/jhws.h
  9. 0 10
      jni/core/utilities.cpp
  10. 0 4
      jni/core/utilities.h
  11. 0 236
      jni/edge/ip_table.cpp
  12. 0 100
      jni/edge/ip_table.h
  13. 201 0
      jni/logic/colorLogic.cc
  14. 1 2
      jni/logic/deviceInfoLogic.cc
  15. 14 4
      jni/logic/functionLogic.cc
  16. 300 381
      jni/logic/mainLogic.cc
  17. 7 0
      jni/logic/sipTestLogic.cc
  18. 1 2
      jni/logic/updateLogic.cc
  19. 1 1
      jni/net/tcp_client.cpp
  20. 7 4
      jni/service/BusinessConfig.h
  21. BIN
      libs/armeabi/libzkgui.so
  22. BIN
      obj/activity/callActivity.o
  23. BIN
      obj/activity/colorActivity.o
  24. BIN
      obj/activity/deviceInfoActivity.o
  25. BIN
      obj/activity/functionActivity.o
  26. BIN
      obj/activity/mainActivity.o
  27. BIN
      obj/activity/medicalCareActivity.o
  28. BIN
      obj/activity/moreActivity.o
  29. BIN
      obj/activity/navibar.o
  30. BIN
      obj/activity/promptActivity.o
  31. BIN
      obj/activity/settingActivity.o
  32. BIN
      obj/activity/sipTestActivity.o
  33. BIN
      obj/activity/startActivity.o
  34. BIN
      obj/activity/statusbar.o
  35. BIN
      obj/activity/updateActivity.o
  36. BIN
      obj/core/update_assistant.o
  37. BIN
      obj/core/utilities.o
  38. BIN
      obj/net/tcp_client.o
  39. BIN
      obj/net/tcp_model.o
  40. BIN
      obj/server/http_server.o
  41. BIN
      obj/service/BusinessConfig.o
  42. BIN
      obj/service/time.o
  43. BIN
      obj/uart/UartContext.o
  44. BIN
      resources/medicalCare/white_468x827.png
  45. BIN
      ui/color.ftu
  46. BIN
      ui/medicalCare.ftu
  47. BIN
      ui/sipTest.ftu

+ 8 - 1
i18n/zh_CN.tr

@@ -173,7 +173,10 @@
     <string name="IsVolume">开启音量控制</string>
     <!-- 测试界面 -->
     <string name="DebugText">设备调试</string>
-    <string name="InputSip">输入目标SIP账号</string>
+    <string name="InputSip">请输入目标SIP账号</string>
+    <string name="InputSipMsg">输入账号进行测试</string>
+    <string name="OtherDevicesTest">外接设备测试</string>
+    <string name="OtherDevicesTestMsg">请检查外接设备是否已连接再开始测试</string>
     <string name="ChangeToRtc">切换成RTC通话</string>
     <string name="ChangeToSip">切换成SIP通话</string>
     <string name="HandleKeys">手柄按键测试</string>
@@ -185,6 +188,10 @@
     <string name="RecordPlay">录音结束,开始播放</string>
     <string name="RecordStop">录音播放结束</string>
     <string name="RecordFailed">录音失败</string>
+    <string name="ColorTest">颜色测试</string>
+    <!-- 颜色测试界面 -->
+    <string name="ColorMsg">点击变换颜色</string>
+    <string name="ContactButton">触点界面</string>
     <!-- 错误提示 -->
     <string name="NoBedList">当前房间没有床位</string>
     <string name="NoCustomer">当前房间用户入住</string>

+ 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* mButton1Ptr;
 static ZKCheckBox* mPanelCancelKeysCheckboxPtr;
 static ZKCheckBox* mHandleKeysCheckboxPtr;
 static ZKTextView* mDebugPromptTextViewPtr;
@@ -57,6 +58,7 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_SIPTEST_Button1, onButtonClick_Button1,
     ID_SIPTEST_sip_back, onButtonClick_sip_back,
     ID_SIPTEST_RecordTestButton, onButtonClick_RecordTestButton,
     ID_SIPTEST_CallButton, onButtonClick_CallButton,
@@ -144,6 +146,7 @@ sipTestActivity::~sipTestActivity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    mButton1Ptr = NULL;
     mPanelCancelKeysCheckboxPtr = NULL;
     mHandleKeysCheckboxPtr = NULL;
     mDebugPromptTextViewPtr = NULL;
@@ -170,6 +173,7 @@ const char* sipTestActivity::getAppName() const{
 //TAG:onCreate
 void sipTestActivity::onCreate() {
 	Activity::onCreate();
+    mButton1Ptr = (ZKButton*)findControlByID(ID_SIPTEST_Button1);
     mPanelCancelKeysCheckboxPtr = (ZKCheckBox*)findControlByID(ID_SIPTEST_PanelCancelKeysCheckbox);if(mPanelCancelKeysCheckboxPtr!= NULL){mPanelCancelKeysCheckboxPtr->setCheckedChangeListener(this);}
     mHandleKeysCheckboxPtr = (ZKCheckBox*)findControlByID(ID_SIPTEST_HandleKeysCheckbox);if(mHandleKeysCheckboxPtr!= NULL){mHandleKeysCheckboxPtr->setCheckedChangeListener(this);}
     mDebugPromptTextViewPtr = (ZKTextView*)findControlByID(ID_SIPTEST_DebugPromptTextView);

+ 1 - 0
jni/activity/sipTestActivity.h

@@ -28,6 +28,7 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_SIPTEST_Button1    20004
 #define ID_SIPTEST_PanelCancelKeysCheckbox    21003
 #define ID_SIPTEST_HandleKeysCheckbox    21001
 #define ID_SIPTEST_DebugPromptTextView    50010

+ 0 - 102
jni/core/houseinfo.h

@@ -1,102 +0,0 @@
-/*
- * houseinfo.h
- *
- *  Created on: 2022年5月27日
- *      Author: dingxy
- */
-
-#ifndef JNI_CORE_HOUSEINFO_H_
-#define JNI_CORE_HOUSEINFO_H_
-
-#include "base/strings.hpp"
-
-namespace j {
-
-	struct house_setting{
-
-		  std::string UserID;
-		  std::string UserPassword;
-
-		  std::string Token;
-
-		  std::string code;
-		  std::string name;
-
-		  std::string replace;
-
-		  std::string password;
-
-		  std::string community;
-		  std::string communityId;
-		  int communitycode;
-
-		  std::string area;
-		  std::string areaId;
-		  int areacode;
-
-		  std::string build;
-		  std::string buildId;
-		  int buildcode;
-
-		  std::string unit;
-		  std::string unitId;
-		  int unitcode;
-
-		  std::string floor;
-		  std::string floorId;
-		  int floorcode;
-
-		  std::string room;
-		  std::string roomId;
-		  int roomcode;
-
-	public:
-		  house_setting() {
-
-			code = "";
-			name = "";
-
-			replace = "false";
-
-			password = "";
-
-			community = "";
-			communityId = "";
-			communitycode = 0;
-
-			area = "";
-			areaId = "";
-			areacode = 0;
-
-			build = "";
-			buildId = "";
-			buildcode = 0;
-
-			unit = "";
-			unitId = "";
-			unitcode = 0;
-
-			floor = "";
-			floorId = "";
-			floorcode = 0;
-
-			room = "";
-		    roomId = "";
-		    roomcode = 0;
-	  }
-	  std::string ToAddressString() const {
-		  return base::format("%s %s %s层 %s室", build.c_str(), unit.c_str(), floor.c_str(), room.c_str());
-      }
-	  std::string ToWuyeString() const {
-		  return base::format("MN-%d-0-0-0-0-1", communitycode);
-	  }
-	  std::string ToUserString() const {
-		  return base::format("RM-%d-%d-%d-%d-%d-%d", communitycode, areacode, buildcode, unitcode, floorcode, roomcode);
-	  }
-	  std::string ToDoorPartString() const {
-		  return base::format("OD-%d-%d-%d-%d-0-", communitycode, areacode, buildcode, unitcode);
-	  }
-	};
-};
-
-#endif /* JNI_CORE_HOUSEINFO_H_ */

+ 0 - 659
jni/core/jhws.cpp

@@ -1,659 +0,0 @@
-/*
- * jhws.cpp
- *
- *  Created on: 2022年4月22日
- *      Author: pengzc
- */
-
-#include "jhws.h"
-#include "base/http_client.h"
-#include "base/json_object.h"
-#include "base/base.hpp"
-
-#include "json/json.h"
-
-#include "core/houseinfo.h"
-
-#include "utils/Log.h"
-
-#include <list>
-#include <vector>
-#include <iterator>
-#include <stdlib.h>
-
-#include "storage/StoragePreferences.h"
-#include "sip_config.h"
-
-#include "core/urlencode.h"
-#include "core/utilities.h"
-
-namespace jhws {
-
-	const char* kBaseUrl = "http://wuye.jhws.top";
-	const char* bearer = "bearer ";
-	std::string authorization = StoragePreferences::getString(SIP_JHWS_TOKEN, "");
-
-	int ErrorInfo(base::HttpResponse response) {
-		Json::Reader reader;
-		Json::Value root;
-		LOGD("连接失败");
-		LOGD("返回体:%s",response.Body().c_str());
-		LOGD("状态码:%d", response.StatusCode());
-		LOGD("错误码:%d", response.ErrorCode());
-		LOGD("错误信息:%s", response.ErrorMessage().c_str());
-		LOGD("http信息:%s", response.ToString().c_str());
-		reader.parse(response.Body(), root);
-		if(response.StatusCode() == 0 && response.ErrorCode() == 28) {
-			return 1;
-		}
-		if(response.StatusCode() == 400 && response.ErrorCode() == 0) {
-			if(root["code"].asInt() == 400)
-			{
-				return -1;
-			}
-			return root["code"].asInt();
-		}
-		if(response.StatusCode() == 401 && response.ErrorCode() == 0 && root["code"].asInt() == 1001) {
-			return 4;
-		}
-
-		return 2;
-	}
-
-//	int ErrorJson(base::HttpResponse response) {
-//		Json::Reader reader;
-//		Json::Value root;
-//
-//		if(!reader.parse(response.Body(), root)) {
-//			LOGD("解析错误不是Json格式!");
-//			return 2;
-//		}
-//
-//		if(!root.isMember("data") || root["data"][0].isNull() || !root["data"].isArray()) {
-//			LOGD("解析数据体:%s", root.toStyledString().c_str());
-//			return 3;
-//		}
-//		return 2;
-//	}
-
-	int GetToken(const std::string& id, const std::string& secret, const std::string& encrypted, j::house_setting* profile) {
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/client/anon/client_token", "");
-
-		req.AppendHeader("client_id", id);
-		req.AppendHeader("client_secret", secret);
-		req.AppendHeader("encrypted", encrypted);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-		base::HttpResponse response = client.Do(req);
-
-		Json::Reader reader;
-		Json::Value root;
-
-		//判断返回是否正确
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-		//判断是否为Json格式
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-
-		if(!root.isMember("data")){
-			return 2;
-		}
-
-		std::string accessToken;
-		accessToken = root["data"]["accessToken"].asString();
-		profile->Token = bearer + std::string(accessToken);
-		authorization = profile->Token;
-//		StoragePreferences::putString(SIP_JHWS_TOKEN, profile->Token);
-
-		return 0;
-	}
-
-	int GetCommunities(jhws::CommunityList& list, j::house_setting* profile) {
-
-		if(authorization == ""){
-			int j = GetToken("778558024368394240", "d1330c96195c3b7b653cd60bb0ea5ded", "false", profile);
-			if(j == 1) return 1;
-		}
-
-//		LOGD("author: %s", authorization.c_str());
-
-		std::string paramurl;
-
-		encodeUrl(profile->name, paramurl);
-
-		paramurl = "?code=" + std::string(profile->code) + "&name=" + std::string(paramurl);
-
-//		LOGD("paramurl: %s", paramurl.c_str());
-
-		base::HttpClient client;
-
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/community/grant/communitys" + std::string(paramurl), "");
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Community s;
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-
-		if(!root.isMember("data") || root["data"][0].isNull() || !root["data"].isArray()) {
-			LOGD("解析数据体:%s", root.toStyledString().c_str());
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.code = root["data"][i]["code"].asInt();
-			s.name = root["data"][i]["name"].asString();
-			s.communityId = root["data"][i]["id"].asString();
-			list.push_back(s);
-		}
-
-		return 0;
-	}
-
-	int GetAreas(jhws::AreaList& list, j::house_setting* profile) {
-
-		std::string Paramurl;
-
-		std::string communityId = profile->communityId;
-//		LOGD("Area这里:%s", communityId.c_str());
-
-		base::HttpClient client;
-
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/houseinfo/grant/area/"+std::string(communityId)+"/areas", "");
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Area s;
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-		if(!root.isMember("data") || root["data"][0].isNull()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.code = root["data"][i]["code"].asInt();
-			s.name = root["data"][i]["name"].asString();
-			s.areaId = root["data"][i]["id"].asString();
-			list.push_back(s);
-		}
-
-		return 0;
-	}
-
-	int GetBuildings(BuildingList& list, j::house_setting* profile) {
-
-		std::string Paramurl;
-
-		std::string areaId = profile->areaId;
-//		LOGD("build这里:%s", areaId.c_str());
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/houseinfo/grant/building/"+std::string(areaId)+"/buildings", "");
-
-		req.AppendHeader("Authorization", authorization);
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-//		LOGD("得到的数据:%s", response.Body().c_str());
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Building s;
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-		if(!root.isMember("data") || root["data"][0].isNull()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.code = root["data"][i]["code"].asInt();
-			s.name = root["data"][i]["name"].asString();
-			s.buildId = root["data"][i]["id"].asString();
-			list.push_back(s);
-		}
-
-		return 0;
-	}
-
-	int GetUnits(UnitList& list, j::house_setting* profile) {
-
-		std::string buildId = profile->buildId;
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/houseinfo/grant/unit/"+std::string(buildId)+"/units", "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-//		LOGD("得到的数据:%s", response.Body().c_str());
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Unit s;
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-		if(!root.isMember("data") || root["data"][0].isNull()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.code = root["data"][i]["code"].asInt();
-			s.name = root["data"][i]["name"].asString();
-			s.unitId = root["data"][i]["id"].asString();
-			list.push_back(s);
-		}
-
-		return 0;
-	}
-
-	int GetFloors(FloorList& list, j::house_setting* profile) {
-
-		std::string unitId = profile->unitId;
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/houseinfo/grant/floor/"+std::string(unitId)+"/floors", "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-//		LOGD("得到的数据:%s", response.Body().c_str());
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Floor s;
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-		if(!root.isMember("data") || root["data"][0].isNull()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.code = root["data"][i]["code"].asInt();
-			s.name = root["data"][i]["name"].asString();
-			s.floorId = root["data"][i]["id"].asString();
-			list.push_back(s);
-		}
-
-		return 0;
-	}
-
-	int GetRooms(RoomList& list, j::house_setting* profile) {
-
-		std::string floorId = profile->floorId;
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/houseinfo/grant/room/"+std::string(floorId)+"/rooms", "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-//		LOGD("得到的数据:%s", response.Body().c_str());
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Room s;
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-		if(!root.isMember("data") || root["data"][0].isNull()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.code = root["data"][i]["code"].asInt();
-			s.name = root["data"][i]["name"].asString();
-			s.roomId = root["data"][i]["id"].asString();
-			list.push_back(s);
-		}
-
-		return 0;
-	}
-
-	int BindDevice(j::house_setting* profile) {
-
-		Json::Value body;
-		Json::FastWriter writer;
-
-		body["uid"] = GetDeviceUid();
-		body["versionNumber"] = StoragePreferences::getString(JHWS_VERSION_NUMBER, to_string(GetVersionNo()));
-		body["type"] = "indoor";
-		body["hardwareType"] = "linux";
-		body["communityId"] = profile->communityId;
-		body["areaId"] = profile->areaId;
-		body["buildingId"] = profile->buildId;
-		body["unitId"] = profile->unitId;
-		body["floorId"] = profile->floorId;
-		body["roomId"] = profile->roomId;
-		body["password"] = profile->password;
-
-		writer.write(body);
-
-		LOGD("body: %s", body.toStyledString().c_str());
-
-		base::HttpClient client;
-		base::HttpRequest req("POST", std::string(kBaseUrl) + "/api/device/grant/" + std::string(profile->replace), body.toStyledString());
-
-		req.AppendHeader("Authorization", authorization);
-		req.ContentType("application/json");
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		Json::Reader reader;
-		Json::Value root;
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			return 2;
-		}
-
-		//LOGD("收到返回信息:%s", response.Body().c_str());
-
-		if(!root.isMember("code") && root["code"].isNull()) {
-			return 3;
-		}
-
-		return 0;
-	}
-
-	int GetDevice(DeviceList& list, j::house_setting* profile) {
-
-		std::string paramurl;
-		std::string type = "indoor";
-
-		paramurl = "?type=" + std::string(type) + "&communityId=" + std::string(profile->communityId) + "&unitId=" + std::string(profile->unitId);
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/device/grant/gates" + std::string(paramurl), "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Device s;
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!");
-			LOGD("解析错误不是Json格式!%s", response.Body().c_str());
-			return 2;
-		}
-
-		if(!root.isMember("data") || root["data"][0].isNull() || !root["data"].isArray()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			if(root["data"][i]["type"].asString() == "outdoor") {
-				s.type = root["data"][i]["type"].asString();
-				s.deviceNumber = root["data"][i]["deviceNumber"].asString();
-				s.areaname = root["data"][i]["areaName"].asString();
-				s.buildname = root["data"][i]["buildingName"].asString();
-				s.unitname = root["data"][i]["unitName"].asString();
-				s.communitycode = root["data"][i]["communityCode"].asInt();
-				s.areacode = root["data"][i]["areaCode"].asInt();
-				s.buildcode = root["data"][i]["buildingCode"].asInt();
-				s.unitcode = root["data"][i]["unitCode"].asInt();
-				list.push_back(s);
-			} else if(root["data"][i]["type"].asString() == "wall") {
-				s.type = root["data"][i]["type"].asString();
-				s.deviceNumber = root["data"][i]["deviceNumber"].asString();
-				s.areaname = root["data"][i]["areaName"].asString();
-				s.communitycode = root["data"][i]["communityCode"].asInt();
-				s.areacode = root["data"][i]["areaCode"].asInt();
-				list.push_back(s);
-			}
-		}
-		return 0;
-	}
-
-	int GetUpdate(Update& list) {
-
-		std::string paramurl;
-
-		std::string uid = GetDeviceUid();
-//		LOGD("deviceuid: %s", uid.c_str());
-		std::string communityId = StoragePreferences::getString(SIP_JHWS_COMMUNITYID, "");
-		std::string roomId = StoragePreferences::getString(SIP_JHWS_ROOMID, "");
-
-		paramurl = "?uid="+ std::string(uid) + "&deviceType=indoor&communityId=" + std::string(communityId) + "&roomId=" + std::string(roomId);
-
-//		LOGD("updateTime: %s", roomId.c_str());
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/update/grant" + std::string(paramurl), "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		Json::Reader reader;
-		Json::Value root;
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!%s", response.Body().c_str());
-			return 2;
-		}
-
-		if(!root.isMember("data") || root["data"].isNull()) {
-			return 3;
-		}
-
-		long long num1 = (long long)root["data"]["device"].asDouble();
-		long long num2 = (long long)root["data"]["notice"].asDouble();
-		list.device = to_string(num1);
-		list.notice = to_string(num2);
-
-//		LOGD("---------1---------");
-		return 0;
-	}
-
-
-	int GetMessage(MessageList& list) {
-
-//		LOGD("---------2---------");
-		std::string paramurl;
-
-		std::string communityId = StoragePreferences::getString(SIP_JHWS_COMMUNITYID, "");
-		std::string roomId = StoragePreferences::getString(SIP_JHWS_ROOMID, "");
-		std::string updateTime = StoragePreferences::getString(SIP_JHWS_UPDATETIME, "0");
-//		std::string updateTime = "0";
-
-		paramurl = "?communityId=" + std::string(communityId) + "&roomId=" + std::string(roomId) + "&updateTime=" + std::string(updateTime);
-
-//		LOGD("updateTime: %s", updateTime.c_str());
-
-		base::HttpClient client;
-		base::HttpRequest req("GET", std::string(kBaseUrl) + "/api/notice/grant/notices" + std::string(paramurl), "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		Json::Reader reader;
-		Json::Value root;
-
-		jhws::Message s;
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-
-		if(!reader.parse(response.Body(), root)) {
-			LOGD("解析错误不是Json格式!%s", response.Body().c_str());
-			return 2;
-		}
-
-		if(!root.isMember("data") || root["data"][0].isNull() || !root["data"].isArray()) {
-			return 3;
-		}
-
-		for(unsigned int i = 0; i < root["data"].size(); i++) {
-			s.content = root["data"][i]["content"].asString();
-			s.title = root["data"][i]["title"].asString();
-			long long num = (long long)root["data"][i]["updateTime"].asDouble();
-			s.updateTime = to_string(num);
-			list.push_back(s);
-		}
-		StoragePreferences::putString(SIP_JHWS_UPDATETIME, list.back().updateTime);
-
-//		LOGD("---------3---------");
-
-		return 0;
-	}
-
-	int Alarm(j::house_setting* profile) {
-
-		std::string paramurl;
-		std::string type = "indoor";
-
-		paramurl = "?type=" + std::string(type) + "&communityId=" + std::string(profile->communityId) + "&roomId=" + std::string(profile->roomId);
-
-		base::HttpClient client;
-		base::HttpRequest req("POST", std::string(kBaseUrl) + "/api/alarm/grant" + std::string(paramurl), "");
-
-		req.AppendHeader("Authorization", authorization);
-
-		client.SetConnectionTimeout(2000);
-		client.SetTimeout(3000);
-
-		base::HttpResponse response = client.Do(req);
-
-		Json::Reader reader;
-		Json::Value root;
-
-		if(response.StatusCode() != 200) {
-			return ErrorInfo(response);
-		}
-		if(!reader.parse(response.Body(), root)) {
-			return 2;
-		}
-
-		if(!root.isMember("data") || root["data"][0].isNull() || !root["data"].isArray()) {
-			return 3;
-		}
-
-		if(root.isMember("data")) {
-			if(root["data"].isMember("type")) {
-				std::string type = root["data"]["type"].asString();
-			}
-			if(root["data"].isMember("communityId")) {
-				std::string communityId = root["data"]["communityId"].asString();
-			}
-			if(root["data"].isMember("unitId")) {
-				std::string unitId = root["data"]["unitId"].asString();
-			}
-
-		} else {
-			LOGD("错误没有名为data的key!");
-		}
-
-		return 0;
-	}
-
-} /* namespace jhws */

+ 0 - 133
jni/core/jhws.h

@@ -1,133 +0,0 @@
-/*
- * jhws.h
- *
- *  Created on: 2022年4月22日
- *      Author: pengzc
- */
-
-#ifndef JNI_CORE_JHWS_H_
-#define JNI_CORE_JHWS_H_
-
-#define WDKL_VERSION "wdkl_version"
-#define JHWS_VERSION_NUMBER "wdkl_version_number"
-
-#include <string>
-#include <list>
-
-#include <vector>
-
-#include "core/houseinfo.h"
-
-namespace jhws {
-
-struct Community {
-	int code;
-	std::string name;
-	std::string communityId;
-};
-typedef std::vector<Community> CommunityList;
-
-struct Area {
-	int code;
-	std::string name;
-	std::string areaId;
-};
-typedef std::vector<Area> AreaList;
-
-struct Building {
-	int code;
-	std::string name;
-	std::string buildId;
-};
-typedef std::vector<Building> BuildingList;
-
-struct Unit {
-	int code;
-	std::string name;
-	std::string unitId;
-};
-typedef std::vector<Unit> UnitList;
-
-struct Floor {
-	int code;
-	std::string name;
-	std::string floorId;
-};
-typedef std::vector<Floor> FloorList;
-
-struct Room {
-	int code;
-	std::string name;
-	std::string roomId;
-};
-typedef std::vector<Room> RoomList;
-
-struct Device {
-	std::string type;
-	std::string deviceNumber;
-
-	int communitycode;
-	int areacode;
-	std::string areaname;
-	int buildcode;
-	std::string buildname;
-	int unitcode;
-	std::string unitname;
-
-};
-typedef std::vector<Device> DeviceList;
-
-struct Message {
-	std::string updateTime;
-	std::string content;
-	std::string title;
-};
-typedef std::vector<Message> MessageList;
-
-struct Update {
-	std::string notice;
-	std::string device;
-};
-typedef std::vector<Update> UpdateList;
-
-//获取token
-int GetToken(const std::string& id, const std::string& secret, const std::string& encrypted, j::house_setting* profile);
-
-//获取社区列表
-int GetCommunities(CommunityList& list, j::house_setting* profile);
-
-//获取区域列表
-int GetAreas(AreaList& list, j::house_setting* profile);
-
-//获取楼栋列表
-int GetBuildings(BuildingList& list, j::house_setting* profile);
-
-//获取单元列表
-int GetUnits(UnitList& list, j::house_setting* profile);
-
-//获取楼层列表
-int GetFloors(FloorList& list, j::house_setting* profile);
-
-//获取房间列表
-int GetRooms(RoomList& list, j::house_setting* profile);
-
-//绑定设备
-int BindDevice(j::house_setting* profile);
-
-//获取设备列表
-int GetDevice(DeviceList& list, j::house_setting* profile);
-
-//获取消息最新时间
-int GetUpdate(Update& list);
-
-//获取消息列表
-int GetMessage(MessageList& list);
-
-//报警
-int Alarm(j::house_setting* profile);
-
-} /* namespace jhws */
-
-
-
-#endif /* JNI_CORE_JHWS_H_ */

+ 0 - 10
jni/core/utilities.cpp

@@ -21,8 +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"
 #include "zkaudio.h"
@@ -179,14 +177,6 @@ void ReleaseTelephone() {
   }
 }
 
-std::string GetVersion(){
-	return "1.0.0";
-}
-
-int GetVersionNo() {
-  return 3;
-}
-
 std::string GetDeviceUid() {
   unsigned char devID[16];
   int ret = SECURITYMANAGER->getDevID(devID);

+ 0 - 4
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"
@@ -50,9 +49,6 @@ class AutoDialTest : public Thread {
   }
 };
 
-std::string GetVersion();
-int GetVersionNo();
-
 std::string GetDeviceUid();
 
 void HeadSetting(voip::CallSetting& setting);

+ 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_ */

+ 201 - 0
jni/logic/colorLogic.cc

@@ -0,0 +1,201 @@
+#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() {
+
+}
+
+/**
+ * 串口数据回调接口
+ */
+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;
+}

+ 1 - 2
jni/logic/deviceInfoLogic.cc

@@ -12,7 +12,6 @@
 #include "base/base.hpp"
 #include "storage/StoragePreferences.h"
 #include "service/BusinessConfig.h"
-#include "core/jhws.h"
 #include "manager/LanguageManager.h"
 #include <net/NetUtils.h>
 
@@ -260,7 +259,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(getVersionCode());
 
 	//server ip
 	string sIP = StoragePreferences::getString(STORE_GATEWAY, serverIP);

+ 14 - 4
jni/logic/functionLogic.cc

@@ -463,16 +463,26 @@ static bool onButtonClick_PwdConfirmButton(ZKButton *pButton) {
     else if (_functionWindows == "setting") {
 
 		// 密码为888
-		string cpwd = "888";
-		if (pwd == cpwd){
+//		string cpwd = "888";
+		if (pwd == "888"){
+			// 关闭密码输入界面
+			mPwdWindowPtr->hideWnd();
+			EASYUICONTEXT->closeActivity("functionActivity");
+			EASYUICONTEXT->closeActivity("deviceInfoActivity");
+			// 打开设置界面
+//			EASYUICONTEXT->openActivity("settingActivity");
+			EASYUICONTEXT->openActivity("sipTestActivity");
+		}
+		else if (pwd == "999") {
 			// 关闭密码输入界面
 			mPwdWindowPtr->hideWnd();
 			EASYUICONTEXT->closeActivity("functionActivity");
+			EASYUICONTEXT->closeActivity("deviceInfoActivity");
 			// 打开设置界面
 			EASYUICONTEXT->openActivity("settingActivity");
 //			EASYUICONTEXT->openActivity("sipTestActivity");
-			EASYUICONTEXT->closeActivity("deviceInfoActivity");
-		} else {
+		}
+		else {
 			mPwdPromptTextViewPtr->setTextTr("PasswordWrong");
 			mPwdPromptTextViewPtr->setTextColor(0xFFFF0000);
 		}

+ 300 - 381
jni/logic/mainLogic.cc

@@ -17,7 +17,6 @@
 #include "base/strings.hpp"
 #include "base/http_client.h"
 #include "os/UpgradeMonitor.h"
-#include "core/jhws.h"
 #include "core/update_assistant.h"
 #include "utils/TimeHelper.h"
 
@@ -78,424 +77,334 @@ static int emptyBedCount = 0;
 #define SLEEP_STRAT_TIME_HANDLE 9	// 息屏
 
 
+static void getServerInfo(){
 
+	string url = getHttpGateway() + "/ncs_url/server_info";
+	LOGD("请求服务器信息. url = %s", url.c_str());
+	//发起HTTP GET请求
+	RestClient::Response r = RestClient::get(url);
+	//解析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());
 
-//======================================= udp 请示服务器信息
-static net::Conn* udpConn;
-class UdpThread: public Thread {
-public:
-	static void getServerInfo(){
+		// tcp
+		StoragePreferences::putString(STORE_TCP_LOCAL_IP, root["tcp_local_ip"].asString());
+		StoragePreferences::putInt(STORE_TCP_PORT, root["tcp_port"].asInt());
 
-		string url = getHttpGateway() + "/ncs_url/server_info";
-		LOGD("请求服务器信息. url = %s", url.c_str());
-		//发起HTTP GET请求
-		RestClient::Response r = RestClient::get(url);
-		//解析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;	// 只有请求成功了,才不需要重复请求
-		}
+		// sip
+		StoragePreferences::putString(SIP_REG_DOMAIN, root["sip_ip"].asString());
+		StoragePreferences::putInt(SIP_REG_PORT, root["sip_port"].asInt());
 
+		serverInfo = false;	// 只有请求成功了,才不需要重复请求
 	}
+}
 
-	static void getDeviceInfo(){
-		if (dataInit){
-			getFrameInfo();
-			getBedCount();
-			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();
-			getNfcInteraction();
-		}
-	}
-	// 读取空间缓存的数据
-	static void getFrameInfo() {
-		mRoomNameTextViewPtr->setText(frameInfo["full_name"].asString());
+// 读取空间缓存的数据
+static void getFrameInfo() {
+	mRoomNameTextViewPtr->setText(frameInfo["full_name"].asString());
+}
+
+static void getBedCount() {
+	if (mActivityPtr == NULL) {
+		return;
 	}
+	mInBedNumTextViewPtr->setText(inBedCount);
+	mEmptyBedNumTextViewPtr->setText(emptyBedCount);
+}
 
-	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"];
-
-			inBedCount = 0;
-			emptyBedCount = 0;
-			if (frameBedList.size() > 0) {
-				for (int i = 0; i < frameBedList.size(); i++) {
-					string customerId = frameBedList[i]["customer_id"].asString();
-					if (customerId != "") {
-						inBedCount += 1;
-					}
+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"];
+
+		inBedCount = 0;
+		emptyBedCount = 0;
+		if (frameBedList.size() > 0) {
+			for (int i = 0; i < frameBedList.size(); i++) {
+				string customerId = frameBedList[i]["customer_id"].asString();
+				if (customerId != "") {
+					inBedCount += 1;
 				}
-				emptyBedCount = frameBedList.size() - inBedCount;
-				getBedCount();
-			}
-
-			if (mBedListViewPtr != NULL) {
-				mBedListViewPtr->refreshListView();
 			}
+			emptyBedCount = frameBedList.size() - inBedCount;
+			getBedCount();
 		}
-	}
 
-	static void getBedCount() {
-		if (mActivityPtr == NULL) {
-			return;
+		if (mBedListViewPtr != NULL) {
+			mBedListViewPtr->refreshListView();
 		}
-		mInBedNumTextViewPtr->setText(inBedCount);
-		mEmptyBedNumTextViewPtr->setText(emptyBedCount);
 	}
+}
 
 
-	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.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.autoPosition = root["auto_position"].asInt();
-
-            if (root.isMember("linux_bed_volume_native")) {
-				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 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_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);
 
-			StoragePreferences::putInt(STORE_SLEEP_TIME, partSetting.sleepSecondsDoor);
+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.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.autoPosition = root["auto_position"].asInt();
+        partSetting.customerAgeHiddenOnDoor = root["customer_age_hidden_on_door"].asInt();
+
+		if (root.isMember("linux_bed_volume_native")) {
+			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);
+		}
 
-			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);
+		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_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);
-			StoragePreferences::putInt(STORE_AUTO_POSITION, partSetting.autoPosition);
+		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);
 
-			setRightTitle(root);
-			callBedButtonSetVisible();
+		StoragePreferences::putInt(STORE_SLEEP_TIME, partSetting.sleepSecondsDoor);
 
-			getFrameRoom(frameInfo["frame_id"].asInt());
+		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);
 
-			dataInit = 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);
+		StoragePreferences::putInt(STORE_AUTO_POSITION, partSetting.autoPosition);
 
+		setRightTitle(root);
+		callBedButtonSetVisible();
 
-	// 将医生和护士别称缓存起来
-	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();
-	}
+		getFrameRoom(frameInfo["frame_id"].asInt());
 
+		dataInit = true;
+	}
+}
 
-	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");
+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;
-		}
+	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;
+	}
 
-		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("updateActivity", intent);
-			}
+	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("updateActivity", intent);
 		}
 	}
+}
 
-	static void getNfcInteraction() {
-		std::string url = getHttpGateway() + "/deviceRoom/get_nfc_interaction_end_time_is_null/" + to_string(StoragePreferences::getInt(STORE_DEVICE_ID,0));
+static void getNfcInteraction() {
+	std::string url = getHttpGateway() + "/deviceRoom/get_nfc_interaction_end_time_is_null/" + to_string(StoragePreferences::getInt(STORE_DEVICE_ID,0));
 
-		LOGD("请求未完成的nfc记录. url = %s", url.c_str());
-		//发起HTTP POST请求
-		RestClient::Response r = RestClient::get(url);
-		if (r.code != 200) {
-			LOGD("请求未完成的nfc记录-> 错误代码: %d", r.code);
-			return;
-		}
+	LOGD("请求未完成的nfc记录. url = %s", url.c_str());
+	//发起HTTP POST请求
+	RestClient::Response r = RestClient::get(url);
+	if (r.code != 200) {
+		LOGD("请求未完成的nfc记录-> 错误代码: %d", r.code);
+		return;
+	}
 
-		LOGD("获得未完成的nfc记录. result = %s", r.body.c_str());
-		//解析json
-		Json::Reader reader;
-		Json::Value root;
-
-		if(reader.parse(r.body, root, false)) {
-			int clerkId = 0;
-			for (int i = 0; i < root.size(); i++) {
-				if (root[i]["components_type"].asCString() == TcpType::AUTH) {
-					clerkId = root[i]["clerk_id"].asInt();
-					setClerk(root[i]["clerk_name"].asCString(), root[i]["pass_no"].asCString(), root[i]["id"].asInt());
-				}
-				else if (root[i]["components_type"].asString() == "POSITION_COMPONENT") {
-					setPosistionItId(root[i]["id"].asInt());
-					setPositionButton(true);
-				}
-				else if (root[i]["components_type"].asString() == "ROOMCHECK_COMPONENT") {
-					setRoomCheckItId(root[i]["id"].asInt());
-					setRoomPatrolButton(true);
-				}
-				else if (root[i]["components_type"].asString() == "SCREEN_TIP_SET_COMPONENT") {
-					time_t now = TimeHelper::getDateline();
-					if (now <= 0) {
-                        continue;
-					}
-
-					Json::Reader Reader;
-					Json::Value operationData;
-					Reader.parse(root[i]["operation_data"].asString(), operationData);
-					int seconds = operationData["seconds"].asInt();
-
-					if (now - root[i]["start_time"].asInt() < seconds) {
-						setPromptTimeItId(root[i]["id"].asInt());
-
-						Intent* intent = new Intent();
-						intent->putExtra(promptText2, operationData["tips"].asString());
-						intent->putExtra(promptTime2, to_string(seconds - (now - root[i]["start_time"].asInt())));
-						EASYUICONTEXT->openActivity("promptActivity", intent);
-					}
-					else {
-						sendPromptQuit(root[i]["id"].asInt());
-					}
-				}
+	LOGD("获得未完成的nfc记录. result = %s", r.body.c_str());
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+
+	if(reader.parse(r.body, root, false)) {
+		int clerkId = 0;
+		for (int i = 0; i < root.size(); i++) {
+			if (root[i]["components_type"].asCString() == TcpType::AUTH) {
+				clerkId = root[i]["clerk_id"].asInt();
+				setClerk(root[i]["clerk_name"].asCString(), root[i]["pass_no"].asCString(), root[i]["id"].asInt());
 			}
-			if (clerkId != 0) {
-				goCare();
+			else if (root[i]["components_type"].asString() == "POSITION_COMPONENT") {
+				setPosistionItId(root[i]["id"].asInt());
+				setPositionButton(true);
 			}
-		}
-	}
-
+			else if (root[i]["components_type"].asString() == "ROOMCHECK_COMPONENT") {
+				setRoomCheckItId(root[i]["id"].asInt());
+				setRoomPatrolButton(true);
+			}
+			else if (root[i]["components_type"].asString() == "SCREEN_TIP_SET_COMPONENT") {
+				time_t now = TimeHelper::getDateline();
+				if (now <= 0) {
+					continue;
+				}
 
-	/**
-	 * 线程创建成功后会调用该函数,可以在该函数中做一些初始化操作
-	 * return true   继续线程
-	 *        false  退出线程
-	 */
-	virtual bool readyToRun() {
-		LOGD("Thread 已经创建完成");
-		return true;
-	}
+				Json::Reader Reader;
+				Json::Value operationData;
+				Reader.parse(root[i]["operation_data"].asString(), operationData);
+				int seconds = operationData["seconds"].asInt();
 
-	/**
-	 * 线程循环函数
-	 *
-	 * return true  继续线程循环
-	 *        false 推出线程
-	 */
-	virtual bool threadLoop() {
-		LOGD("线程循环函数");
-
-		//检查是否有退出线程的请求,如果有,则返回false,立即退出线程
-		if (exitPending()) {
-			return false;
-		}
+				if (now - root[i]["start_time"].asInt() < seconds) {
+					setPromptTimeItId(root[i]["id"].asInt());
 
-		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;
+					Intent* intent = new Intent();
+					intent->putExtra(promptText2, operationData["tips"].asString());
+					intent->putExtra(promptTime2, to_string(seconds - (now - root[i]["start_time"].asInt())));
+					EASYUICONTEXT->openActivity("promptActivity", intent);
+				}
+				else {
+					sendPromptQuit(root[i]["id"].asInt());
 				}
 			}
-			//关闭连接
-			udpConn->Close();
-			//释放内存
-			delete udpConn;
-			udpConn = NULL;
 		}
-
-		//返回真,继续下次线程循环
-		return true;
+		if (clerkId != 0) {
+			goCare();
+		}
 	}
-};
+}
 
-static UdpThread udp_thread;
+static void getDeviceInfo(){
+	if (dataInit){
+		getFrameInfo();
+		getBedCount();
+		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();
+		getNfcInteraction();
+	}
+}
 
 Json::Value getFrame() {
 	return frameRoom;
@@ -513,15 +422,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, ""));
 }
 
 
@@ -539,14 +448,14 @@ static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  * 当界面构造时触发
  */
 static void onUI_init(){
-	//udp_thread.run("this is thread name");
+	//run("this is thread name");
 	//测试用
 	LOGD("进入mainLogic页面, 触发 onUI_init");
 	if (ETHERNETMANAGER->isConnected() || WIFIMANAGER->isConnected()) {
 		if(serverInfo) {	// 如果是false,就是不需要
-			udp_thread.getServerInfo();
+			getServerInfo();
 		}
-		udp_thread.getDeviceInfo();
+		getDeviceInfo();
 	}
 
 }
@@ -668,7 +577,17 @@ static void obtainListItemData_BedListView(ZKListView *pListView,ZKListView::ZKL
 		} else {
 			name->setText(customerName);
 		}
-		age->setText(frameBedList[index]["customer_age"].asString() + frameBedList[index]["customer_age_unit"].asString());
+
+		if (partSetting.customerAgeHiddenOnDoor != 0) {
+			if (frameBedList[index]["customer_age"].asString() == "") {
+				age->setText("");
+			} else {
+				age->setText("*" + frameBedList[index]["customer_age_unit"].asString());
+			}
+		}
+		else {
+			age->setText(frameBedList[index]["customer_age"].asString() + frameBedList[index]["customer_age_unit"].asString());
+		}
 
 		string customerSex = frameBedList[index]["customer_sex"].asString();
 		if (customerSex == "0") {	// 如果性别为女性,替换成女性,底色为粉色

+ 7 - 0
jni/logic/sipTestLogic.cc

@@ -206,6 +206,8 @@ static void onUI_hide() {
  */
 static void onUI_quit() {
 	LOGD(">>>>>>>>>>> sip test quit !!!\n");
+	EASYUICONTEXT->showStatusBar();
+	EASYUICONTEXT->showNaviBar();
 	// 切换回TCP模式
 	StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
 
@@ -311,3 +313,8 @@ static bool onButtonClick_sip_back(ZKButton *pButton) {
 static void onCheckedChanged_PanelCancelKeysCheckbox(ZKCheckBox* pCheckBox, bool isChecked) {
     LOGD(" Checkbox PanelCancelKeysCheckbox checked %d", isChecked);
 }
+static bool onButtonClick_Button1(ZKButton *pButton) {
+    LOGD(" ButtonClick Button1 !!!\n");
+    EASYUICONTEXT->openActivity("colorActivity");
+    return false;
+}

+ 1 - 2
jni/logic/updateLogic.cc

@@ -13,7 +13,6 @@
 #include "os/UpgradeMonitor.h"
 
 #include "core/utilities.h"
-#include "core/jhws.h"
 #include "service/BusinessConfig.h"
 #include "manager/LanguageManager.h"
 /*
@@ -216,7 +215,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"] = getVersionCode();
 			json["model"] = "linux_door";;
 			json["code"] = "SW10600101C-CM";
 			tcpModel.json = json;

+ 7 - 4
jni/service/BusinessConfig.h

@@ -64,7 +64,7 @@
 
 #define STORE_MAC_ADDR "mac_addr"
 
-static std::string version = "v1.0.35";
+static std::string versionCode = "v1.0.35";
 static int versionNo = 35;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
@@ -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() {
@@ -263,6 +263,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/deviceInfoActivity.o


BIN
obj/activity/functionActivity.o


BIN
obj/activity/mainActivity.o


BIN
obj/activity/medicalCareActivity.o


BIN
obj/activity/moreActivity.o


BIN
obj/activity/navibar.o


BIN
obj/activity/promptActivity.o


BIN
obj/activity/settingActivity.o


BIN
obj/activity/sipTestActivity.o


BIN
obj/activity/startActivity.o


BIN
obj/activity/statusbar.o


BIN
obj/activity/updateActivity.o


BIN
obj/core/update_assistant.o


BIN
obj/core/utilities.o


BIN
obj/net/tcp_client.o


BIN
obj/net/tcp_model.o


BIN
obj/server/http_server.o


BIN
obj/service/BusinessConfig.o


BIN
obj/service/time.o


BIN
obj/uart/UartContext.o


BIN
resources/medicalCare/white_468x827.png


BIN
ui/color.ftu


BIN
ui/medicalCare.ftu


BIN
ui/sipTest.ftu