Prechádzať zdrojové kódy

完成门口机的界面、tcp处理

vothin 2 rokov pred
rodič
commit
43ed14759c
42 zmenil súbory, kde vykonal 557 pridanie a 862 odobranie
  1. 9 1
      i18n/zh_CN.tr
  2. 44 0
      jni/activity/mainActivity.cpp
  3. 20 5
      jni/activity/mainActivity.h
  4. 0 394
      jni/activity/navibar.cpp
  5. 0 92
      jni/activity/navibar.h
  6. 1 1
      jni/core/update_assistant.cpp
  7. 94 65
      jni/logic/callLogic.cc
  8. 325 72
      jni/logic/mainLogic.cc
  9. 0 198
      jni/logic/navibar.cc
  10. 46 3
      jni/logic/startLogic.cc
  11. 3 1
      jni/logic/ui3Logic.cc
  12. 6 0
      jni/net/tcp_model.h
  13. 7 2
      jni/service/BusinessConfig.h
  14. BIN
      libs/armeabi/libzkgui.so
  15. 0 28
      linux_door/.project
  16. BIN
      obj/activity/DeviceUpdateActivity.o
  17. BIN
      obj/activity/callActivity.o
  18. BIN
      obj/activity/mainActivity.o
  19. BIN
      obj/activity/navibar.o
  20. BIN
      obj/activity/startActivity.o
  21. BIN
      obj/activity/statusbar.o
  22. BIN
      obj/activity/testActivity.o
  23. BIN
      obj/activity/ui3Activity.o
  24. BIN
      obj/core/update_assistant.o
  25. BIN
      obj/net/tcp_client.o
  26. BIN
      obj/net/tcp_model.o
  27. BIN
      obj/service/BusinessConfig.o
  28. BIN
      obj/service/time.o
  29. 2 0
      package.properties
  30. BIN
      resources/1.mp3
  31. BIN
      resources/button/button_call1.png
  32. BIN
      resources/button/button_call2.png
  33. BIN
      resources/button/button_help1.png
  34. BIN
      resources/button/button_help2.png
  35. BIN
      resources/button/button_help3.png
  36. BIN
      resources/button/button_more1.png
  37. BIN
      resources/button/button_more2.png
  38. BIN
      resources/button/button_nursing1.png
  39. BIN
      resources/button/button_nursing2.png
  40. 0 0
      resources/ring1.wav
  41. BIN
      ui/main.ftu
  42. BIN
      ui/navibar.ftu

+ 9 - 1
i18n/zh_CN.tr

@@ -28,9 +28,10 @@
     <string name="Cancel">取消</string>
     <string name="Save">保存</string>
     <string name="Back">返回</string>
-    <string name="CallBack">呼叫床位</string>
+    <string name="CallBed">呼叫床位</string>
     <string name="CallNurse">呼叫护士</string>
     <string name="CallCencel">取消呼叫</string>
+    <string name="Voice">语音</string>
     <!-- 首页 -->
     <string name="Room">房间</string>
     <string name="EmptyBed">空床</string>
@@ -65,6 +66,8 @@
 	<string name="EndTime">结束时间:</string>
 	<string name="Content">内容</string>
 	<string name="Detail">参数</string>
+    <string name="ResponsibleDoctor">责任医生</string>
+    <string name="ResponsibleNurse">责任护士</string>
     <!-- 系统信息 -->
     <string name="Null">无</string>
     <string name="InDate">入院日期</string>
@@ -101,4 +104,9 @@
     <string name="CallConnecting">正在连接</string>
     <string name="CallInComing">来电</string>
     <string name="CallOutTitle">呼叫护士</string>
+    <string name="Call">呼叫</string>
+    <!-- 错误界面 -->
+    <string name="NoBedList">当前房间没有床位</string>
+    <string name="NoCustomer">当前房间用户入住</string>
+    <string name="NoBedDevice">当前房间没有床位设备</string>
 </resources>

+ 44 - 0
jni/activity/mainActivity.cpp

@@ -4,6 +4,19 @@
 #include "mainActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKButton* mErrorConfirmButtonPtr;
+static ZKTextView* mErrorTextViewPtr;
+static ZKPainter* mErrorPainterPtr;
+static ZKWindow* mErrorWinPtr;
+static ZKButton* mCallBedCancelPtr;
+static ZKListView* mCallBedListViewPtr;
+static ZKPainter* mCallBedPainterPtr;
+static ZKWindow* mCallBebWinPtr;
+static ZKButton* mFunctionBackPtr;
+static ZKButton* mFunctionButtonPtr;
+static ZKTextView* mFunctionTextViewPtr;
+static ZKPainter* mPainter1Ptr;
+static ZKWindow* mFunctionWinPtr;
 static ZKButton* mMoreButtonPtr;
 static ZKButton* mNursingButtonPtr;
 static ZKButton* mCallCencelButtonPtr;
@@ -54,6 +67,10 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_MAIN_ErrorConfirmButton, onButtonClick_ErrorConfirmButton,
+    ID_MAIN_CallBedCancel, onButtonClick_CallBedCancel,
+    ID_MAIN_FunctionBack, onButtonClick_FunctionBack,
+    ID_MAIN_FunctionButton, onButtonClick_FunctionButton,
     ID_MAIN_MoreButton, onButtonClick_MoreButton,
     ID_MAIN_NursingButton, onButtonClick_NursingButton,
     ID_MAIN_CallCencelButton, onButtonClick_CallCencelButton,
@@ -85,6 +102,7 @@ typedef struct {
 }S_ListViewFunctionsCallback;
 /*TAG:ListViewFunctionsCallback*/
 static S_ListViewFunctionsCallback SListViewFunctionsCallbackTab[] = {
+    ID_MAIN_CallBedListView, getListItemCount_CallBedListView, obtainListItemData_CallBedListView, onListItemClick_CallBedListView,
     ID_MAIN_BedListView, getListItemCount_BedListView, obtainListItemData_BedListView, onListItemClick_BedListView,
 };
 
@@ -132,6 +150,19 @@ mainActivity::~mainActivity() {
     EASYUICONTEXT->unregisterGlobalTouchListener(this);
     onUI_quit();
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    mErrorConfirmButtonPtr = NULL;
+    mErrorTextViewPtr = NULL;
+    mErrorPainterPtr = NULL;
+    mErrorWinPtr = NULL;
+    mCallBedCancelPtr = NULL;
+    mCallBedListViewPtr = NULL;
+    mCallBedPainterPtr = NULL;
+    mCallBebWinPtr = NULL;
+    mFunctionBackPtr = NULL;
+    mFunctionButtonPtr = NULL;
+    mFunctionTextViewPtr = NULL;
+    mPainter1Ptr = NULL;
+    mFunctionWinPtr = NULL;
     mMoreButtonPtr = NULL;
     mNursingButtonPtr = NULL;
     mCallCencelButtonPtr = NULL;
@@ -155,6 +186,19 @@ const char* mainActivity::getAppName() const{
 //TAG:onCreate
 void mainActivity::onCreate() {
 	Activity::onCreate();
+    mErrorConfirmButtonPtr = (ZKButton*)findControlByID(ID_MAIN_ErrorConfirmButton);
+    mErrorTextViewPtr = (ZKTextView*)findControlByID(ID_MAIN_ErrorTextView);
+    mErrorPainterPtr = (ZKPainter*)findControlByID(ID_MAIN_ErrorPainter);
+    mErrorWinPtr = (ZKWindow*)findControlByID(ID_MAIN_ErrorWin);
+    mCallBedCancelPtr = (ZKButton*)findControlByID(ID_MAIN_CallBedCancel);
+    mCallBedListViewPtr = (ZKListView*)findControlByID(ID_MAIN_CallBedListView);if(mCallBedListViewPtr!= NULL){mCallBedListViewPtr->setListAdapter(this);mCallBedListViewPtr->setItemClickListener(this);}
+    mCallBedPainterPtr = (ZKPainter*)findControlByID(ID_MAIN_CallBedPainter);
+    mCallBebWinPtr = (ZKWindow*)findControlByID(ID_MAIN_CallBebWin);
+    mFunctionBackPtr = (ZKButton*)findControlByID(ID_MAIN_FunctionBack);
+    mFunctionButtonPtr = (ZKButton*)findControlByID(ID_MAIN_FunctionButton);
+    mFunctionTextViewPtr = (ZKTextView*)findControlByID(ID_MAIN_FunctionTextView);
+    mPainter1Ptr = (ZKPainter*)findControlByID(ID_MAIN_Painter1);
+    mFunctionWinPtr = (ZKWindow*)findControlByID(ID_MAIN_FunctionWin);
     mMoreButtonPtr = (ZKButton*)findControlByID(ID_MAIN_MoreButton);
     mNursingButtonPtr = (ZKButton*)findControlByID(ID_MAIN_NursingButton);
     mCallCencelButtonPtr = (ZKButton*)findControlByID(ID_MAIN_CallCencelButton);

+ 20 - 5
jni/activity/mainActivity.h

@@ -27,6 +27,21 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_MAIN_ErrorConfirmButton    20010
+#define ID_MAIN_ErrorTextView    50002
+#define ID_MAIN_ErrorPainter    52003
+#define ID_MAIN_ErrorWin    110002
+#define ID_MAIN_CallBedBtn    24027
+#define ID_MAIN_CallBedName    24026
+#define ID_MAIN_CallBedCancel    20009
+#define ID_MAIN_CallBedListView    80002
+#define ID_MAIN_CallBedPainter    52002
+#define ID_MAIN_CallBebWin    110001
+#define ID_MAIN_FunctionBack    20008
+#define ID_MAIN_FunctionButton    20007
+#define ID_MAIN_FunctionTextView    50006
+#define ID_MAIN_Painter1    52004
+#define ID_MAIN_FunctionWin    110003
 #define ID_MAIN_MoreButton    20006
 #define ID_MAIN_NursingButton    20005
 #define ID_MAIN_CallCencelButton    20003
@@ -44,15 +59,15 @@
 #define ID_MAIN_NursePortrait    24017
 #define ID_MAIN_DoctorPortrait    24016
 #define ID_MAIN_NurseOption5    24015
-#define ID_MAIN_NurseConfig5    24014
 #define ID_MAIN_NurseOption4    24013
-#define ID_MAIN_NurseConfig4    24012
 #define ID_MAIN_NurseOption3    24011
-#define ID_MAIN_NurseConfig3    24010
 #define ID_MAIN_NurseOption2    24009
-#define ID_MAIN_NurseConfig2    24008
 #define ID_MAIN_NurseOption1    24007
-#define ID_MAIN_NurseConfin1    24006
+#define ID_MAIN_NurseConfig5    24014
+#define ID_MAIN_NurseConfig4    24012
+#define ID_MAIN_NurseConfig3    24010
+#define ID_MAIN_NurseConfig2    24008
+#define ID_MAIN_NurseConfig1    24006
 #define ID_MAIN_NurseConfigColor5    24005
 #define ID_MAIN_NurseConfigColor4    24004
 #define ID_MAIN_NurseConfigColor3    24003

+ 0 - 394
jni/activity/navibar.cpp

@@ -1,394 +0,0 @@
-#include "navibar.h"
-#include "entry/EasyUIContext.h"
-
-/*TAG:GlobalVariable全局变量*/
-static ZKWindow* mWindow1Ptr;
-static ZKButton* mBtnAboutPtr;
-static ZKButton* msys_homePtr;
-static ZKButton* msys_backPtr;
-static ZKButton* mBtnHelpPtr;
-static ZKButton* mBtnCallPtr;
-static navibar* mnavibarPtr;
-/* register sysapp */
-REGISTER_SYSAPP(APP_TYPE_SYS_NAVIBAR, navibar);
-
-typedef struct {
-	int id; // 定时器ID , 不能重复
-	int time; // 定时器  时间间隔  单位 毫秒
-}S_ACTIVITY_TIMEER;
-
-#include "logic/navibar.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_NAVIBAR_BtnAbout, onButtonClick_BtnAbout,
-    ID_NAVIBAR_sys_home, onButtonClick_sys_home,
-    ID_NAVIBAR_sys_back, onButtonClick_sys_back,
-    ID_NAVIBAR_BtnHelp, onButtonClick_BtnHelp,
-    ID_NAVIBAR_BtnCall, onButtonClick_BtnCall,
-};
-/***************/
-
-
-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[] = {
-};
-
-navibar::navibar() {
-	mVideoLoopIndex = -1;
-	mVideoLoopErrorCount = 0;
-}
-
-navibar::~navibar() {
-    // 退出应用时需要反注册
-    EASYUICONTEXT->unregisterGlobalTouchListener(this);
-    onUI_quit();
-    unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
-    mWindow1Ptr = NULL;
-    mBtnAboutPtr = NULL;
-    msys_homePtr = NULL;
-    msys_backPtr = NULL;
-    mBtnHelpPtr = NULL;
-    mBtnCallPtr = NULL;
-    mnavibarPtr = NULL;
-}
-
-const char* navibar::getAppName() const{
-    return "navibar.ftu";
-}
-
-//TAG:onCreate
-void navibar::onCreate() {
-	BaseApp::onCreate();
-    mWindow1Ptr = (ZKWindow*)findControlByID(ID_NAVIBAR_Window1);
-    mBtnAboutPtr = (ZKButton*)findControlByID(ID_NAVIBAR_BtnAbout);
-    msys_homePtr = (ZKButton*)findControlByID(ID_NAVIBAR_sys_home);
-    msys_backPtr = (ZKButton*)findControlByID(ID_NAVIBAR_sys_back);
-    mBtnHelpPtr = (ZKButton*)findControlByID(ID_NAVIBAR_BtnHelp);
-    mBtnCallPtr = (ZKButton*)findControlByID(ID_NAVIBAR_BtnCall);
-	mnavibarPtr = this;
-	onUI_init();
-    // 注册监听全局触摸
-    EASYUICONTEXT->registerGlobalTouchListener(this);
-    registerProtocolDataUpdateListener(onProtocolDataUpdate); 
-    rigesterActivityTimer();
-    startVideoLoopPlayback();
-}
-
-void navibar::onClick(ZKBase *pBase) {
-    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;
-        }
-    }
-
-	BaseApp::onClick(pBase);
-}
-
-bool navibar::onTimer(int id) {
-    return onUI_Timer(id);
-}
-
-
-void navibar::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 navibar::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 navibar::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 navibar::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 navibar::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 navibar::onTouchEvent(const MotionEvent &ev) {
-    return onnavibarActivityTouchEvent(ev);
-}
-
-void navibar::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 navibar::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 navibar::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 navibar::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 navibar::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 navibar::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 navibar::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\n", __FUNCTION__,
-			__LINE__, pFileListPath, mediaFileList.size());
-	for (size_t i = 0; i < mediaFileList.size(); i++) {
-		LOGD("file[%d]:[%s]\n", i, mediaFileList[i].c_str());
-	}
-	is.close();
-
-	return true;
-}
-
-int navibar::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 navibar::registerUserTimer(int id, int time) {
-	registerTimer(id, time);
-}
-
-void navibar::unregisterUserTimer(int id) {
-	unregisterTimer(id);
-}
-
-void navibar::resetUserTimer(int id, int time) {
-	resetTimer(id, time);
-}

+ 0 - 92
jni/activity/navibar.h

@@ -1,92 +0,0 @@
-#ifndef _SYSAPP_NAVIBAR_H_
-#define _SYSAPP_NAVIBAR_H_
-
-#include "entry/EasyUIContext.h"
-#include "app/SysAppFactory.h"
-
-#include "uart/ProtocolData.h"
-#include "uart/ProtocolParser.h"
-
-#include "utils/Log.h"
-#include "control/ZKDigitalClock.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_NAVIBAR_Window1    110001
-#define ID_NAVIBAR_BtnAbout    20004
-#define ID_NAVIBAR_sys_home   101
-#define ID_NAVIBAR_sys_back   100
-#define ID_NAVIBAR_BtnHelp    20002
-#define ID_NAVIBAR_BtnCall    20001
-/*TAG:Macro宏ID END*/
-class navibar : public BaseApp,
-                  public ZKSeekBar::ISeekBarChangeListener, 
-                  public ZKListView::IItemClickListener,
-                  public ZKListView::AbsListAdapter,
-                  public ZKSlideWindow::ISlideItemClickListener,
-                  public EasyUIContext::ITouchListener,
-                  public ZKEditText::ITextChangeListener,
-                  public ZKVideoView::IVideoPlayerMessageListener
-{
-public:
-	navibar();
-	virtual ~navibar();
-	virtual void onCreate();
-	virtual void onClick(ZKBase *pBase);
-	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);
-
-    /**
-     * 注册定时器
-     */
-	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;
-
-
-private:
-    /*TAG:PRIVATE_VARIABLE*/
-    int mVideoLoopIndex;
-    int mVideoLoopErrorCount;
-};
-
-#endif

+ 1 - 1
jni/core/update_assistant.cpp

@@ -50,7 +50,7 @@ int UpdateAssistant::GetLatest(const std::string& app_name, VersionInfo* info) {
 //	info->url = json.GetString("app_path", "");
 //	info->file_size = json.GetInt("fileSize", 0);
 
-	std::string url = getHttpGateway() + "/deviceBed/getAppVersion?device_type=304&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
+	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());

+ 94 - 65
jni/logic/callLogic.cc

@@ -13,7 +13,11 @@
 #include "voip/wav_player.h"
 #include "manager/LanguageManager.h"
 
+#include "media/ZKMediaPlayer.h"
+static ZKMediaPlayer* player;
+
 std::string _isOutgoing;
+std::string _toIdStr;
 
 voip::WAVPlayer wavPlayer;	// 播放音频
 
@@ -197,8 +201,11 @@ static void onUI_init(){
 	EASYUICONTEXT->hideStatusBar();
 	EASYUICONTEXT->hideNaviBar();
 
+	player = new ZKMediaPlayer(ZKMediaPlayer::E_MEDIA_TYPE_AUDIO);
+	player->play("/mnt/extsd/ui/ring.wav");
+
 	//界面操作
-	if (StoragePreferences::getString(STORE_SIGNAL_TYPE,"TCP")=="SIP"){
+	if (SIGNAL_TYPE=="SIP"){
 		voip::CallInfo info = GetTelephone()->GetCallInfo();
 		mTextViewNamePtr->setText(info.remote_uri);
 		if (info.state == voip::STATE_CALL_CALLING) {
@@ -233,63 +240,81 @@ static void onUI_intent(const Intent *intentPtr) {
 	if(intentPtr != NULL) {
 		BRIGHTNESSHELPER->screenOn();
 		_isSleepTimerRegistered = getSleepTimerRegistered();
-		LOGD("_isSleepTimerRegistered = %d", _isSleepTimerRegistered);
 		setSleepTimerRegistered(false);
 
-		wavPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"));
+		wavPlayer.Play(CONFIGMANAGER->getResFilePath("ring1.wav"));
+		//wavPlayer.Play(CONFIGMANAGER->getResFilePath("1.mp3"));
 		// 键值解析
 		_isOutgoing = intentPtr->getExtra(isOutgoing);
 		std::string _audioOnly = intentPtr->getExtra(audioOnly);
 
-		if (_isOutgoing == "true"){
-			//TCP call
-			TcpModel tcpModel;
-			tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
-			tcpModel.type = TcpType::VOICE;
-			tcpModel.action = VoiceAction::CALL;
-			tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-			tcpModel.to_id = 0;
-			std::string req = getTcpModelString(tcpModel);
-			LOGD("TCP CALL : %s",req.c_str());
-			TcpClient::instance()->sendMsg(req.c_str());
-
-			//回调注册
-			TcpCallback callback;
-			callback.tid = tcpModel.tid;
-			callback.jsonStr = req;
-			callback.onSuccess = [](Json::Value json){
-				LOGD("voice callback success");
-				return 0;
-			};
-			callback.onFalied = [](Json::Value json){
-				LOGD("voice callback failed");
-				return 0;
-			};
-			TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
-
-
-			// 呼叫的时候需要把tid放进去
-			tid = tcpModel.tid;
-			mButtonAnswerPtr->setVisible(false);
-			mTextViewNamePtr->setTextTr("CallOutTitle");
-
-			mActivityPtr->registerUserTimer(CALLING_TIME, 60000);	// 如果对方没接听,则发送一个CANCEL回去
-		} else {
-			TcpModel storeModel = CallingStatus::instance()->getTcpModel();
-			mTextViewNamePtr->setText(storeModel.json["fromFrameName"].asString());
-			//自动接听处理
-			if (StoragePreferences::getBool(STORE_AUDO_ANSWER,false)){
-				mButtonAnswerPtr->setVisible(false);
-				voip::CallInfo info = GetTelephone()->GetCallInfo();
-				if (info.state == voip::STATE_CALL_INCOMING
-						|| info.state == voip::STATE_CALL_EARLY) {
-					GetTelephone()->Answer();
+//		if (_isOutgoing == "true"){
+//			int toId = 0;
+//			_toIdStr = intentPtr->getExtra(toIdStr);
+//			if (_toIdStr != "") {
+//				toId = atoi(_toIdStr.c_str());
+//			}
+//
+//			//TCP call
+//			TcpModel tcpModel;
+//			tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+//			tcpModel.type = TcpType::VOICE;
+//			tcpModel.action = VoiceAction::CALL;
+//			tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+//			tcpModel.to_id = toId;
+//			std::string req = getTcpModelString(tcpModel);
+//			LOGD("TCP CALL : %s",req.c_str());
+////			TcpClient::instance()->sendMsg(req.c_str());
+//
+//			//回调注册
+//			TcpCallback callback;
+//			callback.tid = tcpModel.tid;
+//			callback.jsonStr = req;
+//			callback.onSuccess = [](Json::Value json){
+//				LOGD("voice callback success");
+//				return 0;
+//			};
+//			callback.onFalied = [](Json::Value json){
+//				LOGD("voice callback failed");
+//				return 0;
+//			};
+//			TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
+//
+//
+//			// 呼叫的时候需要把tid放进去
+//			tid = tcpModel.tid;
+//			mButtonAnswerPtr->setVisible(false);
+//
+//			std::string _callName = intentPtr->getExtra(callName);
+//			if (_callName != "") {
+//				mTextViewNamePtr->setText(LANGUAGEMANAGER->getValue("Call") + _callName);
+//			} else {
+//				mTextViewNamePtr->setTextTr("CallOutTitle");
+//			}
+//
+//			mActivityPtr->registerUserTimer(CALLING_TIME, 60000);	// 如果对方没接听,则发送一个CANCEL回去
+//		} else {
+//			TcpModel storeModel = CallingStatus::instance()->getTcpModel();
+//            TcpModel backTcp = storeModel;
+//            backTcp.data = storeModel.json["id"].asString();
+//            //back voice success
+//            sendVoiceTcp(VoiceAction::SUCCESS, backTcp, storeModel.from_id);
+//
+//			mTextViewNamePtr->setText(storeModel.json["fromFrameName"].asString());
+//			//自动接听处理
+//			if (StoragePreferences::getBool(STORE_AUDO_ANSWER,false)){
+//				mButtonAnswerPtr->setVisible(false);
+//				voip::CallInfo info = GetTelephone()->GetCallInfo();
+//				if (info.state == voip::STATE_CALL_INCOMING
+//						|| info.state == voip::STATE_CALL_EARLY) {
+//					GetTelephone()->Answer();
+//
+//					//发出TCP
+//					sendVoiceTcp(VoiceAction::ACCEPT, storeModel, storeModel.from_id);
+//				}
+//			}
+//		}
 
-					//发出TCP
-					sendVoiceTcp(VoiceAction::ACCEPT, storeModel, storeModel.from_id);
-				}
-			}
-		}
 	}
 }
 
@@ -340,7 +365,7 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 static bool onUI_Timer(int id){
 	switch (id) {
 	case 1: {
-		if (StoragePreferences::getString(STORE_SIGNAL_TYPE,"TCP")=="SIP"){
+		if (SIGNAL_TYPE=="SIP"){
 			voip::CallInfo info = GetTelephone()->GetCallInfo();
 			if (info.state == voip::STATE_CALL_CONFIRMED){
 				mButtonAnswerPtr->setVisible(false);
@@ -480,10 +505,12 @@ static bool onButtonClick_ButtonHangup(ZKButton *pButton) {
 			const char* sendMsg = heartStr.c_str();
 			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
 		}
-	}
 
-	setSleepTimerRegistered(_isSleepTimerRegistered);
-	EASYUICONTEXT->goBack();
+		setSleepTimerRegistered(_isSleepTimerRegistered);
+        EASYUICONTEXT->goBack();
+	} else {
+		GetTelephone()->Hangup();
+	}
 	return false;
 }
 
@@ -491,16 +518,18 @@ static bool onButtonClick_ButtonAnswer(ZKButton *pButton) {
 	LOGD(" ButtonClick ButtonAnswer !!!\n");
 	mButtonAnswerPtr->setVisible(false);
 
-//	voip::CallInfo info = GetTelephone()->GetCallInfo();
-//	GetTelephone()->Answer();
-
-	TcpModel model = CallingStatus::instance()->getTcpModel();
-	//LOGD("storeModel :::: type=%s,action=%s,from=%d,to=%d",model.type.c_str(),model.action.c_str(),model.from_id,model.to_id);
-	//std::string storeModelStr = getTcpModelString(model);
-	//LOGD("storeModelStr ===== %s",storeModelStr.c_str());
-	//只回传iId
-	model.data = model.json["id"].asString();
-	sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
+	if (SIGNAL_TYPE=="SIP"){
+        voip::CallInfo info = GetTelephone()->GetCallInfo();
+        GetTelephone()->Answer();
+    } else {
+        TcpModel model = CallingStatus::instance()->getTcpModel();
+        //LOGD("storeModel :::: type=%s,action=%s,from=%d,to=%d",model.type.c_str(),model.action.c_str(),model.from_id,model.to_id);
+        //std::string storeModelStr = getTcpModelString(model);
+        //LOGD("storeModelStr ===== %s",storeModelStr.c_str());
+        //只回传iId
+        model.data = model.json["id"].asString();
+        sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
+    }
 
 	return false;
 }

+ 325 - 72
jni/logic/mainLogic.cc

@@ -10,6 +10,7 @@
 #include "service/BusinessConfig.h"
 #include "core/sip_config.h"
 #include "manager/LanguageManager.h"
+#include "core/utilities.h"
 
 #include "base/strings.hpp"
 #include "base/http_client.h"
@@ -54,29 +55,19 @@
 
 
 
+TcpModel nursingTcpModel;
 static bool dataInit = false;	// false表示需要从数据库里获取数据,true表示从缓存里获取数据
 PartSetting partSetting;
-Json::Value customerData;
-Json::Value nurseConfigOption;
+Json::Value frameRoom;
+Json::Value frameBedList;
 Json::Value frameInfo;			// 缓存房间名字等
 Json::Value rightTitleInfo;	// 缓存分机右边医生和护士标题
-Json::Value eventList;		// 按键事件的缓存
-Json::Value customerFeeList;	// 费用的缓存
-Json::Value customerAdviceList;	// 医嘱的缓存
-bool hasNurseConfigOption = false;
 static bool reinforce = false;	// 判断设备是否处于增援状态
 static bool serverInfo = true;	// 判断是否需要从服务器获取服务器信息,第一次要,后续不要
-static int nurseConfigNumber = 5;	// 护理项的数量,用于左侧显示,最少为5个,最多不限
-TcpModel nursingTcpModel;
-static int customerFeePageNo = 1;
-static int customerFeePageSize = 3;
-static int customerFeeDataTotal = 0;
-static int customerAdvicePageNo = 1;
-static int customerAdvicePageSize = 2;
-static int customerAdviceDataTotal = 0;
+static bool isHelpTimerRegistered = false;
 
 
-#define STORE_NURSING_TYPE "nursing_type"	// 护理的状态,如果是true,那就在护理中,如果是false,那就不在护理中
+#define HELP_TIMER_HANDLE 3
 #define NURSING_TIME_HANDLE 6	// 护理的定时器id
 #define OXYGEN_TIME_HANDLE 7	// 吸氧倒计时
 #define EVENT_TIME_HANDLE 8		// 事件定时器
@@ -117,14 +108,12 @@ public:
 
 	static void getDeviceInfo(){
 		if (dataInit){
-			getCustomerInfo(StoragePreferences::getString(STORE_CUSTOMER_ID, ""));
 			getFrameInfo();
-			getRightTitle();
 			//getPartSetting(StoragePreferences::getString(STORE_PARTID, ""));
 			reinforceDispaly();
 			return;
 		}
-		string url = getHttpGateway()+"/deviceBed/getBedDeviceInfoByEthMac/"+ETHERNETMANAGER->getMacAddr();
+		string url = getHttpGateway() + "/deviceRoom/get_device_by_eth_mac/" + ETHERNETMANAGER->getMacAddr();
 		LOGD("请求设备信息. url = %s", url.c_str());
 		//发起HTTP GET请求
 		RestClient::Response r = RestClient::get(url);
@@ -145,13 +134,6 @@ public:
 			StoragePreferences::putString(SIP_REG_ACCOUNT,root["sip_id"].asString());
 			StoragePreferences::putString(SIP_REG_PASSWORD, root["sip_password"].asString());
 
-			if (root["customer_id"] != NULL && root["customer_id"].asString() != "") {
-				string customerId = root["customer_id"].asString();
-				StoragePreferences::putString(STORE_CUSTOMER_ID, customerId);
-				//获取病患信息
-				getCustomerInfo(customerId);
-			}
-
 			//获取科室设置
 			string partId = root["part_id"].asString();
 			StoragePreferences::putString(STORE_PARTID, partId);
@@ -168,6 +150,7 @@ public:
 		frameInfo["part_id"] = deviceInfo["part_id"].asInt();
 
 		getFrameInfo();
+		getFrameRoom(deviceInfo["frame_id"].asInt());
 	}
 
 	// 读取空间缓存的数据
@@ -175,57 +158,24 @@ public:
 		mRoomNamePtr->setText(frameInfo["full_name"].asString());
 	}
 
-	// 通过https获取用户的数据,并且放进缓存里
-	static void getCustomerInfo(string customerId){
-		if (dataInit){
-			settingCustomer(customerData);
-			return;
-		}
-		string url = getHttpGateway()+"/deviceBed/getCustomerInfo/" + customerId;
-		LOGD("请求用户信息. url = %s", url.c_str());
+	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());
+		LOGD("获得房间信息. result = %s", r.body.c_str());
 		//解析json
 		Json::Reader reader;
 		Json::Value root;
 		if (reader.parse(r.body, root, false)){
-			customerData = root;
-			settingCustomer(root);
-		}
-	}
-
-	// 读取用户的缓存数据
-	static void settingCustomer(Json::Value root){
-//		mUserNamePtr->setText(root["named"].asString());
-//		string sex = root["sex"].asInt()==0?"女":"男";
-//		mSexAgePtr->setText(sex+" "+root["age"].asString()+root["age_unit"].asString());
-
-		string inDate = root["in_date"].asString();
-		time_t timet = stoi(inDate);
-		struct tm *t = gmtime(&timet);
-		char pDate[25];
-		sprintf(pDate,"%d-%02d-%02d",
-				1900 + t->tm_year, 1+ t->tm_mon, t->tm_mday);
-
-//		if (root["illness_desc"].asString()==""){
-//			mAdvicePtr->setTextTr("Null");
-//		} else {
-//			mAdvicePtr->setText(root["illness_desc"].asString());
-//		}
-
-		//护理项
-		if (root["list"].isArray() && root["list"].size()>0){
-			hasNurseConfigOption = true;
-			nurseConfigOption = root["list"];
-			nurseConfigNumber = root["list"].size();
-
+			frameRoom = root;
+			frameBedList = root["frame_bed_list"];
 		}
 	}
 
 
 	static void getPartSetting(string partId){
-		string url = getHttpGateway()+"/deviceBed/getPartSetting/"+partId;
+		string url = getHttpGateway() + "/deviceBed/getPartSetting/" + partId;
 		LOGD("请求科室信息. url = %s", url.c_str());
 		//发起HTTP GET请求
 		RestClient::Response r = RestClient::get(url);
@@ -321,15 +271,11 @@ public:
 		rightTitleInfo["doctor_valid"] = partSetting["doctor_valid"].asInt();
 		rightTitleInfo["nurse_title"] = partSetting["nurse_title"].asString();
 		rightTitleInfo["nurse_valid"] = partSetting["nurse_valid"].asInt();
-		getRightTitle();
-	}
-
-	static void getRightTitle() {
 	}
 
 
 	static void getVersion() {
-		std::string url = getHttpGateway() + "/deviceBed/getAppVersion?device_type=304&part_id=" + StoragePreferences::getString(STORE_PARTID, "");
+		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());
@@ -364,6 +310,7 @@ public:
 	static void reinforceDispaly() {
 		if (reinforce) {
 			SetPainterInfo(0xFF2F9DF1,"增援已发出");
+			setHelpButton("/button/button_help3.png" ,false);
 		}
 	}
 
@@ -457,6 +404,14 @@ void setReinforce(bool result) {
 	reinforce = result;
 }
 
+void cancelAutoBtnHelpTimer(){
+	if (isHelpTimerRegistered) {
+		mActivityPtr->unregisterUserTimer(HELP_TIMER_HANDLE);
+		 isHelpTimerRegistered = false;
+	 }
+}
+
+
 //标识方法
 void SetPainterInfo(uint32_t bgColor, const std::string& msg){
 	mPainterInfoPtr->setBackgroundColor(bgColor);
@@ -486,6 +441,11 @@ void setNursingTcpModel(TcpModel tcpModel) {
 	nursingTcpModel = tcpModel;
 }
 
+void setHelpButton(const char *pPicPath, bool isTouchable){
+	mHelpButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, pPicPath);
+	mHelpButtonPtr->setTouchable(isTouchable);
+}
+
 /**
  * 注册定时器
  * 填充数组用于注册定时器
@@ -559,6 +519,15 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
  */
 static bool onUI_Timer(int id){
 	switch (id) {
+
+	case HELP_TIMER_HANDLE:	// 不能在线程里面关掉线程
+		{
+			SetPainterInfo(0xFFFFFFFF,"");
+			setReinforce(false);
+			setHelpButton("/button/button_help2.png", true);
+			return false;
+		}
+		break;
 	default:
 		break;
 	}
@@ -590,11 +559,103 @@ static bool onmainActivityTouchEvent(const MotionEvent &ev) {
 }
 static int getListItemCount_BedListView(const ZKListView *pListView) {
     //LOGD("getListItemCount_BedListView !\n");
-    return 3;
+	if (frameBedList.size() > 3) {
+		return frameBedList.size();
+	}
+	return 3;
 }
 
 static void obtainListItemData_BedListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
     //LOGD(" obtainListItemData_ BedListView  !!!\n");
+	if (frameBedList.size() > 0) {
+		pListItem->setText(frameBedList[index]["frame_bed"]["full_name"].asString());
+
+		// 用户相关
+		string customerName = frameBedList[index]["customer_name"].asString();
+		pListItem->findSubItemByID(ID_MAIN_CustomerName)->setText(customerName);
+		pListItem->findSubItemByID(ID_MAIN_CustomerAge)->setText(frameBedList[index]["customer_age"].asString() + frameBedList[index]["customer_age_unit"].asString());
+
+		string customerSex = frameBedList[index]["customer_sex"].asString();
+		if (customerSex == "0") {	// 如果性别为女性,则替换成女性头像,和女性的图标
+			pListItem->findSubItemByID(ID_MAIN_CustomerPortrait)->setBackgroundPic("ic_custom_female.png");
+			pListItem->findSubItemByID(ID_MAIN_CustomerSex)->setBackgroundPic("ic_gender_female.png");
+		}
+		else if (customerSex == "1") {
+			pListItem->findSubItemByID(ID_MAIN_CustomerPortrait)->setBackgroundPic("ic_custom_male.png");
+			pListItem->findSubItemByID(ID_MAIN_CustomerSex)->setBackgroundPic("ic_gender_male.png");
+		}
+		else {
+			pListItem->findSubItemByID(ID_MAIN_CustomerPortrait)->setBackgroundPic("ic_custom_empty.png");
+			pListItem->findSubItemByID(ID_MAIN_CustomerSex)->setBackgroundPic("");
+		}
+
+
+		// 医生护士相关
+		if (rightTitleInfo["doctor_valid"] != 1){
+			pListItem->findSubItemByID(ID_MAIN_DoctorText)->setVisible(false);
+		} else {
+			pListItem->findSubItemByID(ID_MAIN_DoctorText)->setText(rightTitleInfo["doctor_title"].asString());
+		}
+
+		if (rightTitleInfo["nurse_valid"] != 1){
+			pListItem->findSubItemByID(ID_MAIN_NurseText)->setVisible(false);
+		} else {
+			pListItem->findSubItemByID(ID_MAIN_NurseText)->setText(rightTitleInfo["nurse_title"].asString());
+		}
+		pListItem->findSubItemByID(ID_MAIN_DoctorName)->setText(frameBedList[index]["doctor_name"].asString());
+		pListItem->findSubItemByID(ID_MAIN_NurseName)->setText(frameBedList[index]["nurse_name"].asString());
+
+
+		// 护理项相关
+		Json::Value nurseConfigList = frameBedList[index]["nurse_config_dtos"];
+		if (nurseConfigList.size() > 0) {
+			for (int i = 0; i < 5; i++) {
+				int nurseConfigColorNumber = ID_MAIN_NurseConfigColor1 + i;
+				int nurseConfigNumber = ID_MAIN_NurseConfig1 + i * 2;
+				int nurseOptionNumber = ID_MAIN_NurseOption1 + i * 2;
+				if (nurseConfigList.size() >= i) {
+					//颜色
+					string nurseConfigColot = nurseConfigList[i]["nurse_color_rbg"].asString();
+					uint32_t bgColor = 0xFFC0C0C0;
+					if (nurseConfigColot != "") {
+						string rgbStr = "FF" + nurseConfigColot;
+						transform(rgbStr.begin(), rgbStr.end(), rgbStr.begin(), ::toupper);
+						bgColor = strtoul(("0x" + rgbStr).c_str(), NULL,16);
+					}
+					pListItem->findSubItemByID(nurseConfigColorNumber)->setBackgroundColor(bgColor);
+					pListItem->findSubItemByID(nurseConfigNumber)->setText(nurseConfigList[i]["nurse_config_name"].asString());
+					string nurseOptionName = nurseConfigList[i]["nurse_option_name"].asString();
+					if (nurseOptionName == "") {
+						nurseOptionName = LANGUAGEMANAGER->getValue("None");
+					}
+					pListItem->findSubItemByID(nurseOptionNumber)->setText(nurseOptionName);
+
+				} else {
+					//颜色
+					pListItem->findSubItemByID(nurseConfigColorNumber)->setBackgroundColor(0xFFC0C0C0);
+					pListItem->findSubItemByID(nurseConfigNumber)->setText(nurseConfigList[i]["nurse_config_name"].asString());
+					pListItem->findSubItemByID(nurseOptionNumber)->setText(LANGUAGEMANAGER->getValue("None"));
+				}
+			}
+		}
+		else {
+			pListItem->findSubItemByID(ID_MAIN_NurseConfigColor1)->setBackgroundColor(0xFFC0C0C0);
+			pListItem->findSubItemByID(ID_MAIN_NurseConfigColor2)->setBackgroundColor(0xFFC0C0C0);
+			pListItem->findSubItemByID(ID_MAIN_NurseConfigColor3)->setBackgroundColor(0xFFC0C0C0);
+			pListItem->findSubItemByID(ID_MAIN_NurseConfigColor4)->setBackgroundColor(0xFFC0C0C0);
+			pListItem->findSubItemByID(ID_MAIN_NurseConfigColor5)->setBackgroundColor(0xFFC0C0C0);
+			pListItem->findSubItemByID(ID_MAIN_NurseConfig1)->setText("");
+			pListItem->findSubItemByID(ID_MAIN_NurseConfig2)->setText("");
+			pListItem->findSubItemByID(ID_MAIN_NurseConfig3)->setText("");
+			pListItem->findSubItemByID(ID_MAIN_NurseConfig4)->setText("");
+			pListItem->findSubItemByID(ID_MAIN_NurseConfig5)->setText("");
+			pListItem->findSubItemByID(ID_MAIN_NurseOption1)->setText(LANGUAGEMANAGER->getValue("None"));
+			pListItem->findSubItemByID(ID_MAIN_NurseOption2)->setText(LANGUAGEMANAGER->getValue("None"));
+			pListItem->findSubItemByID(ID_MAIN_NurseOption3)->setText(LANGUAGEMANAGER->getValue("None"));
+			pListItem->findSubItemByID(ID_MAIN_NurseOption4)->setText(LANGUAGEMANAGER->getValue("None"));
+			pListItem->findSubItemByID(ID_MAIN_NurseOption5)->setText(LANGUAGEMANAGER->getValue("None"));
+		}
+	}
 }
 
 static void onListItemClick_BedListView(ZKListView *pListView, int index, int id) {
@@ -602,31 +663,223 @@ static void onListItemClick_BedListView(ZKListView *pListView, int index, int id
 }
 static bool onButtonClick_CallBedButton(ZKButton *pButton) {
     LOGD(" ButtonClick CallBedButton !!!\n");
+
+    if (frameBedList.size() > 0) {
+    	mCallBebWinPtr->showWnd();
+    } else {
+    	mErrorWinPtr->showWnd();
+    	mErrorTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoBedList"));
+    }
     return false;
 }
 
 static bool onButtonClick_CallNurseButton(ZKButton *pButton) {
     LOGD(" ButtonClick CallNurseButton !!!\n");
+
+	if (SIGNAL_TYPE=="SIP"){
+		int port = StoragePreferences::getInt(SIP_REG_PORT, SIP_REG_PORT_DEFAULT);
+		std::string domain = StoragePreferences::getString(SIP_REG_DOMAIN, SIP_REG_DOMAIN_DEFAULT);
+		std::string od_number = StoragePreferences::getString(SIP_REG_DOOR_ACCOUNT, SIP_REG_DOOR_ACCOUNT_DEFAULT);
+		std::string od_number_uri = URI(od_number, domain, port);
+		LOGD("od_number_uri: %s", od_number_uri.c_str());
+		GetTelephone()->MakeCall(od_number_uri);
+	} else {
+        Intent* intent = new Intent();
+        intent->putExtra(isOutgoing, "true");
+        intent->putExtra(audioOnly, "true");
+        EASYUICONTEXT->openActivity("callActivity", intent);
+    }
+
     return false;
 }
 
 static bool onButtonClick_HelpButton(ZKButton *pButton) {
     LOGD(" ButtonClick HelpButton !!!\n");
+
+	TcpModel tcpModel;
+	tcpModel.type = TcpType::REINFORCE;
+	tcpModel.action = ReinforceAction::CALL;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.to_id = 0;
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("REINFORCE CALL : %s",req.c_str());
+//	TcpClient::instance()->sendMsg(req.c_str());
+
+	//回调注册
+	TcpCallback callback;
+	callback.tid = tcpModel.tid;
+	callback.jsonStr = req;
+	callback.onSuccess = [](Json::Value json){
+		LOGD("callback success");
+		return 0;
+	};
+	callback.onFalied = [](Json::Value json){
+		LOGD("callback failed");
+		return 0;
+	};
+	TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
+
+	setHelpButton("/button/button_help3.png" ,false);
+	SetPainterInfo(0xFF2F9DF1,"增援已发出");
+	setReinforce(true);		// 设置增援状态为true
+	//1分钟后无响应还原颜色
+	if (!isHelpTimerRegistered){
+		mActivityPtr->registerUserTimer(HELP_TIMER_HANDLE, 60000);
+	}
     return false;
 }
 
 static bool onButtonClick_CallCencelButton(ZKButton *pButton) {
+
     LOGD(" ButtonClick CallCencelButton !!!\n");
+    // 发送tcp, tcp_type = VOICE, tcp_action = CANCEL_BY_DOOR
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::VOICE;
+	tcpModel.action = VoiceAction::CANCEL_BY_DOOR;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.to_id = NULL;
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("TCP VOICE : %s",req.c_str());
+
+	//回调注册
+	TcpCallback callback;
+	callback.tid = tcpModel.tid;
+	callback.jsonStr = req;
+	callback.onSuccess = [](Json::Value json){
+		LOGD("side callback success");
+		return 0;
+	};
+	callback.onFalied = [](Json::Value json){
+		LOGD("side callback failed");
+		return 0;
+	};
+	TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
     return false;
 }
 
 static bool onButtonClick_NursingButton(ZKButton *pButton) {
     LOGD(" ButtonClick NursingButton !!!\n");
-	EASYUICONTEXT->openActivity("ui3Activity");
+	LOGD("onButtonClick_Nursing 触发护理按钮!!!");
+	mFunctionWinPtr->showWnd();
+	mFunctionTextViewPtr->setText(LANGUAGEMANAGER->getValue("InNursing"));
+	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("NursingEnd"));
+	mFunctionBackPtr->setVisible(false);
+
+	// 发送tcp, tcp_type = SIDE, tcp_action = NURSING
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::SIDE;
+	tcpModel.action = SideAction::NURSING;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.to_id = NULL;
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("TCP SIDE : %s",req.c_str());
+
+	//回调注册
+	TcpCallback callback;
+	callback.tid = tcpModel.tid;
+	callback.jsonStr = req;
+	callback.onSuccess = [](Json::Value json){
+		LOGD("side callback success");
+		return 0;
+	};
+	callback.onFalied = [](Json::Value json){
+		LOGD("side callback failed");
+		return 0;
+	};
+	TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
     return false;
 }
+
 static bool onButtonClick_MoreButton(ZKButton *pButton) {
     LOGD(" ButtonClick MoreButton !!!\n");
 	EASYUICONTEXT->openActivity("ui3Activity");
     return false;
 }
+
+static bool onButtonClick_FunctionButton(ZKButton *pButton) {
+    LOGD(" ButtonClick FunctionButton !!!\n");
+	mFunctionWinPtr->hideWnd();
+
+	if (nursingTcpModel.json.size() != 0) {	// 对比一下,json里面不为空的时候
+		// 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
+		TcpModel tcpModel;
+		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+		tcpModel.type = TcpType::SIDE;
+		tcpModel.action = SideAction::NURSING_END;
+		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+		tcpModel.data = nursingTcpModel.json["id"].asString();	// 获取nursingTcpModel里,id字段的数据
+
+		std::string req = getTcpModelString(tcpModel);
+		LOGD("TCP NURSING_END : %s",req.c_str());
+
+		//回调注册
+		TcpCallback callback;
+		callback.tid = tcpModel.tid;
+		callback.jsonStr = req;
+		callback.onSuccess = [](Json::Value json){
+			LOGD("event callback success");
+			return 0;
+		};
+		callback.onFalied = [](Json::Value json){
+			LOGD("event callback failed");
+			return 0;
+		};
+		TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
+
+		TcpModel newTcpModel;
+		nursingTcpModel = newTcpModel;	// 清空nursingTcpModel
+	}
+    return false;
+}
+
+static bool onButtonClick_FunctionBack(ZKButton *pButton) {
+    LOGD(" ButtonClick FunctionBack !!!\n");
+    return false;
+}
+static int getListItemCount_CallBedListView(const ZKListView *pListView) {
+    //LOGD("getListItemCount_CallBedListView !\n");
+    return frameBedList.size();
+}
+
+static void obtainListItemData_CallBedListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
+    //LOGD(" obtainListItemData_ CallBedListView  !!!\n");
+	pListItem->setText(frameBedList[index]["frame_bed"]["full_name"].asString());
+	pListItem->findSubItemByID(ID_MAIN_CallBedName)->setText(frameBedList[index]["customer_name"].asString());
+}
+
+static void onListItemClick_CallBedListView(ZKListView *pListView, int index, int id) {
+//    LOGD(" onListItemClick_ CallBedListView  !!!\n");
+
+    string customerName = frameBedList[index]["customer_name"].asString();
+    string toId = frameBedList[index]["bed_device_id"].asString();
+    if (customerName == "") {
+    	mErrorTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoCustomer"));
+    	mErrorWinPtr->showWnd();
+    }
+    else if (toId == "") {
+    	mErrorTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoBedDevice"));
+    	mErrorWinPtr->showWnd();
+    }
+    else {
+		mCallBebWinPtr->hideWnd();
+		Intent* intent = new Intent();
+		intent->putExtra(isOutgoing, "true");
+		intent->putExtra(audioOnly, "true");
+		intent->putExtra(toIdStr, toId);
+		intent->putExtra(callName, frameBedList[index]["frame_bed"]["full_name"].asString() + " " + customerName);
+		EASYUICONTEXT->openActivity("callActivity", intent);
+    }
+}
+
+static bool onButtonClick_CallBedCancel(ZKButton *pButton) {
+    LOGD(" ButtonClick CallBedCancel !!!\n");
+	mCallBebWinPtr->hideWnd();
+    return false;
+}
+static bool onButtonClick_ErrorConfirmButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ErrorConfirmButton !!!\n");
+    mErrorWinPtr->hideWnd();
+    return false;
+}

+ 0 - 198
jni/logic/navibar.cc

@@ -1,198 +0,0 @@
-#pragma once
-#include "uart/ProtocolSender.h"
-#include "core/utilities.h"
-#include "storage/StoragePreferences.h"
-#include "core/sip_config.h"
-#include "edge/popup_service.h"
-#include "base/strings.hpp"
-#include "net/tcp_client.h"
-#include "app/Activity.h"
-/*
- *此文件由GUI工具生成
- *文件功能:用于处理用户的逻辑相应代码
- *功能说明:
- *========================onButtonClick_XXXX
-当页面中的按键按下后系统会调用对应的函数,XXX代表GUI工具里面的[标识]名称,
-如Button1,当返回值为false的时候系统将不再处理这个按键,返回true的时候系统将会继续处理此按键。比如SYS_BACK.
- *========================onSlideWindowItemClick_XXXX(int index)
-当页面中存在滑动窗口并且用户点击了滑动窗口的图标后系统会调用此函数,XXX代表GUI工具里面的[标识]名称,
-如slideWindow1;index 代表按下图标的偏移值
- *========================onSeekBarChange_XXXX(int progress)
-当页面中存在滑动条并且用户改变了进度后系统会调用此函数,XXX代表GUI工具里面的[标识]名称,
-如SeekBar1;progress 代表当前的进度值
- *========================ogetListItemCount_XXXX()
-当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表的总数目,XXX代表GUI工具里面的[标识]名称,
-如List1;返回值为当前列表的总条数
- *========================oobtainListItemData_XXXX(ZKListView::ZKListItem *pListItem, int index)
- 当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表当前条目下的内容信息,XXX代表GUI工具里面的[标识]名称,
-如List1;pListItem 是贴图中的单条目对象,index是列表总目的偏移量。具体见函数说明
- *========================常用接口===============
- *LOGD(...)  打印调试信息的接口
- *mTextXXX->setText("****") 在控件TextXXX上显示文字****
- *mButton1->setSelected(true); 将控件mButton1设置为选中模式,图片会切换成选中图片,按钮文字会切换为选中后的颜色
- *mSeekBar->setProgress(12) 在控件mSeekBar上将进度调整到12
- *mListView1->refreshListView() 让mListView1 重新刷新,当列表数据变化后调用
- *mDashbroadView1->setTargetAngle(120) 在控件mDashbroadView1上指针显示角度调整到120度
-
- */
-static bool isHelpTimerRegistered = false;
-#define HELP_TIMER_HANDLE 3
-
-void setBtnHelpVisible(bool visible){
-	mBtnHelpPtr->setVisible(visible);
-}
-void cancelAutoBtnHelpTimer(){
-	if (isHelpTimerRegistered) {
-		mnavibarPtr->unregisterUserTimer(HELP_TIMER_HANDLE);
-		 isHelpTimerRegistered = false;
-	 }
-}
-
-/**
- * 注册定时器
- * 填充数组用于注册定时器
- * 注意:id不能重复
- */
-static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
-		//{0,  6000}, //定时器id=0, 时间间隔6秒
-		//{1,  1000},
-};
-
-/**
- * 当界面构造时触发
- */
-static void onUI_init(){
-	//Tips :添加 UI初始化的显示代码到这里,如:mText1->setText("123");
-}
-
-/*
- * 当界面完全退出时触发
- */
-static void onUI_quit() {
-
-}
-
-/**
- * 串口数据回调接口
- */
-static void onProtocolDataUpdate(const SProtocolData &data) {
-	//串口数据回调接口
-}
-
-/**
- * 定时器触发函数setReinforce
- * 不建议在此函数中写耗时操作,否则将影响UI刷新
- * 参数: id
- *         当前所触发定时器的id,与注册时的id相同
- * 返回值: true
- *             继续运行当前定时器
- *         false
- *             停止运行当前定时器
- */
-static bool onUI_Timer(int id){
-	switch (id) {
-	case HELP_TIMER_HANDLE:	// 不能在线程里面关掉线程
-		{
-			SetPainterInfo(0xFFFFFFFF,"");
-			setBtnHelpVisible(true);
-			setReinforce(false);
-			return false;
-		}
-		break;
-	default:
-		break;
-	}
-	return true;
-}
-
-/**
- * 有新的触摸事件时触发
- * 参数:ev
- *         新的触摸事件
- * 返回值:true
- *            表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
- *         false
- *            触摸事件将继续传递到控件上
- */
-static bool onnavibarActivityTouchEvent(const MotionEvent &ev) {
-	switch (ev.mActionStatus) {
-	case MotionEvent::E_ACTION_DOWN://触摸按下
-		//LOGD("时刻 = %ld 坐标  x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
-		break;
-	case MotionEvent::E_ACTION_MOVE://触摸滑动
-		break;
-	case MotionEvent::E_ACTION_UP:  //触摸抬起
-		break;
-	default:
-		break;
-	}
-	return false;
-}
-
-static bool onButtonClick_BtnCall(ZKButton *pButton) {
-	LOGD(" ButtonClick BtnCall !!!\n");
-
-//	int port = StoragePreferences::getInt(SIP_REG_PORT, SIP_REG_PORT_DEFAULT);
-//	std::string domain = StoragePreferences::getString(SIP_REG_DOMAIN, SIP_REG_DOMAIN_DEFAULT);
-//	std::string od_number = StoragePreferences::getString(SIP_REG_DOOR_ACCOUNT, SIP_REG_DOOR_ACCOUNT_DEFAULT);
-//	std::string od_number_uri = URI(od_number, domain, port);
-//	LOGD("od_number_uri: %s", od_number_uri.c_str());
-//	GetTelephone()->MakeCall(od_number_uri);
-
-
-	Intent* intent = new Intent();
-	intent->putExtra(isOutgoing, "true");
-	intent->putExtra(audioOnly, "true");
-	EASYUICONTEXT->openActivity("callActivity", intent);
-
-	return false;
-}
-
-static bool onButtonClick_BtnHelp(ZKButton *pButton) {
-	LOGD(" ButtonClick BtnHelp !!!\n");
-	TcpModel tcpModel;
-	tcpModel.type = TcpType::REINFORCE;
-	tcpModel.action = ReinforceAction::CALL;
-	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-	tcpModel.to_id = 0;
-	std::string req = getTcpModelString(tcpModel);
-	LOGD("REINFORCE CALL : %s",req.c_str());
-//	TcpClient::instance()->sendMsg(req.c_str());
-
-	//回调注册
-	TcpCallback callback;
-	callback.tid = tcpModel.tid;
-	callback.jsonStr = req;
-	callback.onSuccess = [](Json::Value json){
-		LOGD("callback success");
-		return 0;
-	};
-	callback.onFalied = [](Json::Value json){
-		LOGD("callback failed");
-		return 0;
-	};
-	TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
-
-	SetPainterInfo(0xFF2F9DF1,"增援已发出");
-	setBtnHelpVisible(false);	// 设置增援的按钮为false
-	setReinforce(true);		// 设置增援状态为true
-	//1分钟后无响应还原颜色
-	if (!isHelpTimerRegistered){
-		mnavibarPtr->registerUserTimer(HELP_TIMER_HANDLE, 60000);
-	}
-	return false;
-}
-static bool onButtonClick_sys_back(ZKButton *pButton) {
-	LOGD(" ButtonClick sys_back !!!\n");
-	return false;
-}
-
-static bool onButtonClick_sys_home(ZKButton *pButton) {
-	LOGD(" ButtonClick sys_home !!!\n");
-	return false;
-}
-static bool onButtonClick_BtnAbout(ZKButton *pButton) {
-	LOGD(" ButtonClick BtnAbout !!!\n");
-	EASYUICONTEXT->openActivity("ui3Activity");
-	return false;
-}

+ 46 - 3
jni/logic/startLogic.cc

@@ -165,6 +165,7 @@ void handleMsg(byte* inBytes){
 			cancelAutoBtnHelpTimer();
 
 			SetPainterInfo(0xFF37C127, LANGUAGEMANAGER->getValue("HelpResponse"));
+			setHelpButton("/button/button_help3.png", false);
 			setReinforce(false);		// 设置增援状态为true
 			//3秒后还原白色
 			if (!isHelpTimerRegistered){
@@ -309,9 +310,49 @@ void handleMsg(byte* inBytes){
 			LOGD("收到服务器返回的消息,关闭Nursing的定时器");
 
 		}
-		if (tcpModel.action == SideAction::NURSING_END) {
+		else if (tcpModel.action == SideAction::NURSING_END) {
 			// 收到nursing_end
 		}
+		else if (tcpModel.action == SideAction::CALL) {
+			// 收到CALL,需要亮红灯
+			std::string heartStr = "DOORLED,200F";	// 红灯闪烁
+			const char* sendMsg = heartStr.c_str();
+			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
+		}
+		else if (tcpModel.action == SideAction::ACCEPT) {
+			// 收到ACCEPT,需要灭灯
+			// 还原成无灯光的状态
+			std::string heartStr = "DOORLED,000F";
+			const char* sendMsg = heartStr.c_str();
+			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
+		}
+		else if (tcpModel.action == SideAction::CANCEL) {
+			// 收到CANCEL,需要灭灯
+			// 还原成无灯光的状态
+			std::string heartStr = "DOORLED,000F";
+			const char* sendMsg = heartStr.c_str();
+			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
+		}
+		else if (tcpModel.action == SideAction::SOS_CALL) {
+			// 收到SOS_CALL,需要亮红灯
+			// SOS亮红灯
+			string heartStr = "ULED,1F";
+			// 门灯亮红灯
+			std::string heartStr2 = "DOORLED,200F";
+			const char* sendMsg2 = heartStr2.c_str();
+			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg2), strlen(sendMsg2));
+
+			sosTimerRegistered = false;
+			mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000);		// 10秒后才能触发
+			mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000);		// 2分钟后才能触发
+		}
+		else if (tcpModel.action == SideAction::SOS_CANCEL) {
+			// 收到SOS_CANCEL,需要灭灯
+			// 还原成无灯光的状态
+			std::string heartStr = "DOORLED,000F";
+			const char* sendMsg = heartStr.c_str();
+			sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
+		}
 	}
 	else if (tcpModel.type == TcpType::CALLBACK) {
 		if (tcpModel.action == CallbackAction::ACK) {
@@ -337,6 +378,7 @@ void handleMsg(byte* inBytes){
 			if (callback.tid != "0"){
 				callback.onFalied(tcpModel.json);
 			}
+			callActivityFinish(CallFinishType::FAILED);
 		}
 
 	}
@@ -350,7 +392,6 @@ bool getSleepTimerRegistered() {
 // 触发定时任务
 void setSleepTimerRegistered(bool result) {
 	isSleepTimerRegistered = result;
-	LOGD("isSleepTimerRegistered = %d", isSleepTimerRegistered);
 //	if (isSleepTimerRegistered) {
 //		int sleepTime = StoragePreferences::getInt(STORE_SLEEP_TIME, 3);
 //		mActivityPtr->registerUserTimer(SLEEP_STRAT_TIME_HANDLE, sleepTime * 60 * 1000);
@@ -651,6 +692,7 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 				}
 			}
 			else if (data.cmd == "KEY<") {	//下左3,红
+				LOGD("KEY<");
 				heartStr = "DOORLED,100F";
 			}
 			else if (data.cmd == "KEY>") {	// key>是面板挂断按钮
@@ -717,7 +759,8 @@ static bool onUI_Timer(int id){
 	case HELP_TIMER_HANDLE:
 	{
 		SetPainterInfo(0xFFFFFFFF,"");
-		setBtnHelpVisible(true);
+		setHelpButton("/button/button_help2.png", true);
+		setReinforce(false);		// 设置增援状态为false
 //		//取消计时
 //		if (isHelpTimerRegistered) {
 //			mActivityPtr->unregisterUserTimer(HELP_TIMER_HANDLE);

+ 3 - 1
jni/logic/ui3Logic.cc

@@ -234,8 +234,10 @@ static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  */
 static void onUI_init(){
     //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
-	mQRCode1Ptr->loadQRCode("https://www.baidu.com");
+	string qrStr = "http://m.wdklian.com/care/apk/care.user?type=NCS_DEVICE&code=&mac=" + std::string(ETHERNETMANAGER->getMacAddr()) + "&model=&hard_ver=HV1.0&soft_ver=SW1.0&device_type=3&device_name=门口机";
+	mQRCode1Ptr->loadQRCode(qrStr.c_str());
 
+	mDeviceIdPtr->setText(StoragePreferences::getInt(STORE_DEVICE_ID, 0));
 	mDeviceCodePtr->setText(GetDeviceUid());
 	mDeviceMacPtr->setText(ETHERNETMANAGER->getMacAddr());
 	mDeviceIpPtr->setText(ETHERNETMANAGER->getIp());

+ 6 - 0
jni/net/tcp_model.h

@@ -37,6 +37,7 @@ public:
 	inline static std::string CANCEL = "CANCEL";
 	inline static std::string SUCCESS = "SUCCESS";
 	inline static std::string FAILED = "FAILED";
+	inline static std::string CANCEL_BY_DOOR = "CANCEL_BY_DOOR";
 };
 
 class SosAction {
@@ -84,6 +85,11 @@ public:
 
 class SideAction {
 public:
+	inline static std::string CALL = "CALL";	// 护理
+	inline static std::string ACCEPT = "ACCEPT";	// 护理
+	inline static std::string CANCEL = "CANCEL";	// 护理
+	inline static std::string SOS_CALL = "SOS_CALL";	// 护理
+	inline static std::string SOS_CANCEL = "SOS_CANCEL";	// 护理
 	inline static std::string NURSING = "NURSING";	// 护理
 	inline static std::string NURSING_END = "NURSING_END";	// 护理结束
 };

+ 7 - 2
jni/service/BusinessConfig.h

@@ -46,9 +46,10 @@
 #define STORE_NURSE_VISIBLE "nurse_visible"
 
 #define STORE_AUDO_ANSWER "auto_answer"
+#define SIGNAL_TYPE "TCP" //TCP,SIP
 
-static std::string version = "v1.0.9";
-static int versionNo = 65;
+static std::string version = "v1.0.4";
+static int versionNo = 4;
 static std::string serverIP = "172.28.100.100";
 static std::string tcpIP = "172.28.100.100";
 static int serverHttpPort = 8006;
@@ -97,6 +98,8 @@ void SetPainterInfo(uint32_t bgColor, const std::string& msg);
 
 void setReinforce(bool result);
 
+void setHelpButton(const char *pPicPath, bool isTouchable);
+
 /**
  * 刷新设备数据
  */
@@ -231,6 +234,8 @@ static bool checkIsDay(){
 
 static std::string isOutgoing = "isOutgoing";
 static std::string audioOnly = "audioOnly";
+static std::string toIdStr = "";
+static std::string callName = "";
 
 class CallingStatus{
 public:

BIN
libs/armeabi/libzkgui.so


+ 0 - 28
linux_door/.project

@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>linux_door</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-			<triggers>full,incremental,</triggers>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-			<triggers>clean,full,incremental,</triggers>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.cdt.core.cnature</nature>
-		<nature>org.eclipse.cdt.core.ccnature</nature>
-		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
-		<nature>com.zksw.ui.editor.core.nature</nature>
-	</natures>
-</projectDescription>

BIN
obj/activity/DeviceUpdateActivity.o


BIN
obj/activity/callActivity.o


BIN
obj/activity/mainActivity.o


BIN
obj/activity/navibar.o


BIN
obj/activity/startActivity.o


BIN
obj/activity/statusbar.o


BIN
obj/activity/testActivity.o


BIN
obj/activity/ui3Activity.o


BIN
obj/core/update_assistant.o


BIN
obj/net/tcp_client.o


BIN
obj/net/tcp_model.o


BIN
obj/service/BusinessConfig.o


BIN
obj/service/time.o


+ 2 - 0
package.properties

@@ -0,0 +1,2 @@
+release.reserved = false
+launch.platform.verify = true;

BIN
resources/1.mp3


BIN
resources/button/button_call1.png


BIN
resources/button/button_call2.png


BIN
resources/button/button_help1.png


BIN
resources/button/button_help2.png


BIN
resources/button/button_help3.png


BIN
resources/button/button_more1.png


BIN
resources/button/button_more2.png


BIN
resources/button/button_nursing1.png


BIN
resources/button/button_nursing2.png


resources/ring.wav → resources/ring1.wav


BIN
ui/main.ftu


BIN
ui/navibar.ftu