Bläddra i källkod

修改首页显示,修改侧边栏功能,增加设备注册功能,去掉医护

vothin 11 månader sedan
förälder
incheckning
0deacbd7bc
77 ändrade filer med 4011 tillägg och 173 borttagningar
  1. 63 1
      i18n/zh_CN.tr
  2. 423 0
      jni/activity/customerAffairActivity.cpp
  3. 110 0
      jni/activity/customerAffairActivity.h
  4. 462 0
      jni/activity/deviceAddActivity.cpp
  5. 117 0
      jni/activity/deviceAddActivity.h
  6. 37 0
      jni/activity/functionActivity.cpp
  7. 11 0
      jni/activity/functionActivity.h
  8. 435 0
      jni/activity/interactionActivity.cpp
  9. 111 0
      jni/activity/interactionActivity.h
  10. 26 24
      jni/activity/mainActivity.h
  11. 11 0
      jni/activity/navibar.cpp
  12. 3 0
      jni/activity/navibar.h
  13. 30 0
      jni/include/utils/TimeHelper.h
  14. 254 0
      jni/logic/customerAffairLogic.cc
  15. 527 0
      jni/logic/deviceAddLogic.cc
  16. 399 32
      jni/logic/functionLogic.cc
  17. 404 0
      jni/logic/interactionLogic.cc
  18. 34 0
      jni/logic/mainLogic.cc
  19. 23 8
      jni/logic/moreLogic.cc
  20. 142 0
      jni/logic/navibar.cc
  21. 355 106
      jni/logic/startLogic.cc
  22. 1 1
      jni/net/tcp_client.cpp
  23. 9 0
      jni/net/tcp_model.h
  24. 24 1
      jni/service/BusinessConfig.h
  25. BIN
      libs/armeabi/libzkgui.so
  26. BIN
      obj/activity/callActivity.o
  27. BIN
      obj/activity/customerAffairActivity.o
  28. BIN
      obj/activity/deviceAddActivity.o
  29. BIN
      obj/activity/deviceInfoActivity.o
  30. BIN
      obj/activity/functionActivity.o
  31. BIN
      obj/activity/interactionActivity.o
  32. BIN
      obj/activity/mainActivity.o
  33. BIN
      obj/activity/medicalCareActivity.o
  34. BIN
      obj/activity/moreActivity.o
  35. BIN
      obj/activity/navibar.o
  36. BIN
      obj/activity/promptActivity.o
  37. BIN
      obj/activity/settingActivity.o
  38. BIN
      obj/activity/sipTestActivity.o
  39. BIN
      obj/activity/startActivity.o
  40. BIN
      obj/activity/statusbar.o
  41. BIN
      obj/activity/updateActivity.o
  42. BIN
      obj/core/update_assistant.o
  43. BIN
      obj/net/tcp_client.o
  44. BIN
      obj/net/tcp_model.o
  45. BIN
      obj/server/http_server.o
  46. BIN
      obj/service/BusinessConfig.o
  47. BIN
      obj/service/time.o
  48. BIN
      obj/uart/UartContext.o
  49. BIN
      resources/button/elliptic_bule_125x33.png
  50. BIN
      resources/button/elliptic_grey_125x33.png
  51. BIN
      resources/button/elliptic_light_blue.png
  52. BIN
      resources/button/elliptic_orange_125x33.png
  53. BIN
      resources/button/square_pink.png
  54. BIN
      resources/button/square_red.png
  55. BIN
      resources/customerAffair/affairList.png
  56. BIN
      resources/customerAffair/affairTitle.png
  57. BIN
      resources/deviceAdd/choiceFrame.png
  58. BIN
      resources/icon/nursing.png
  59. BIN
      resources/interaction/choose.png
  60. BIN
      resources/interaction/huchu.png
  61. BIN
      resources/interaction/huishou.png
  62. BIN
      resources/interaction/huli3.png
  63. BIN
      resources/interaction/huru.png
  64. BIN
      resources/interaction/interaction.png
  65. BIN
      resources/interaction/shijian.png
  66. BIN
      resources/interaction/shouhui.png
  67. BIN
      resources/interaction/sos.png
  68. BIN
      resources/interaction/zengyuan2.png
  69. BIN
      resources/main/affair.png
  70. BIN
      resources/main/event.png
  71. BIN
      ui/customerAffair.ftu
  72. BIN
      ui/deviceAdd.ftu
  73. BIN
      ui/function.ftu
  74. BIN
      ui/interaction.ftu
  75. BIN
      ui/main.ftu
  76. BIN
      ui/navibar.ftu
  77. BIN
      ui/setting.ftu

+ 63 - 1
i18n/zh_CN.tr

@@ -40,6 +40,7 @@
     <string name="CallInfo">发起呼叫</string>
     <string name="SOSCallInfo">发起紧急呼叫</string>
     <string name="Voice">语音</string>
+    <string name="BlueCode">Blue Code</string>
     <!-- 首页 -->
     <string name="Room">房间</string>
     <string name="InBedNum">病房人数</string>
@@ -75,6 +76,25 @@
     <string name="ResponsibleNurse">责任护士</string>
     <string name="Director">科主任</string>
     <string name="HeadNurse">护士长</string>
+    <string name="CustomerAffair">用户事务</string>
+    <string name="EventButton">按键事件</string>
+    <!-- 交互界面 -->
+    <string name="Recover">收回列表</string>
+    <string name="All">全部</string>
+    <string name="NotReceived">未接</string>
+    <string name="SOSCall">SOS呼叫</string>
+    <string name="EventCall">-事件</string>
+    <string name="ReinforceCall">请求增援</string>
+    <string name="CallIn">呼入-</string>
+    <string name="CallOut">呼出-</string>
+    <string name="Responded">已响应</string>
+    <string name="NotRespond">未响应</string>
+    <string name="Answered">已接听</string>
+    <string name="UnAnswered">未接听</string>
+    <string name="Other">其他</string>
+    <string name="Sented">已发送</string>
+    <string name="Canceled">已取消</string>
+    <string name="Completed">已完成</string>
     <!-- 导航栏 -->
     <!-- 功能界面 -->
     <string name="CallableBeds">当前可呼叫床位</string>
@@ -96,6 +116,17 @@
     <string name="Mode2">是否切换成模式2</string>
     <string name="Mode3">是否切换成模式3</string>
     <string name="ModeConfirm">确认切换模式后,本机会重启</string>
+    <string name="IsExecuteAffair">是否执行该用户事务</string>
+    <string name="EventCalled">-事件已发出</string>
+    <string name="EventResponse">已响应-</string>
+    <string name="EventCompleteOrCancel">完成或者取消</string>
+    <string name="BlueCodeMsg">Blue Code已发出</string>
+    <string name="PartFrameTreeMsg">没有科室数据</string>
+    <string name="RoomFrameTreeMsg">没有房间数据</string>
+    <string name="BedFrameTreeMsg">没有床位数据</string>
+    <string name="ChoicePartMsg">选择要注册的科室</string>
+    <string name="ChoiceRoomMsg">选择要注册的房间</string>
+    <string name="ChoiceBedMsg">选择要注册的床位</string>
     <!-- 医护界面 -->
     <string name="MedicalLoginMsg">请输入正确的密码,进入医护功能</string>
     <string name="InputMedicalPassword">输入密码进入医护</string>
@@ -114,11 +145,13 @@
     <string name="RoomPatrol">巡房</string>
     <string name="RoomPatrolCompleted">已巡房</string>
 	<string name="Nursing">进入护理</string>
-	<string name="NursingMsg">该房病床进入护理</string>
+	<string name="NursingMsg">该房进入护理</string>
 	<string name="SetNursingMsg">设置为护理状态?</string>
+	<string name="SetNursingMsg2">已进入护理状态</string>
 	<string name="InNursing">护理中</string>
 	<string name="NursingEnd">护理结束</string>
 	<string name="SetNursingEndMsg">以上病床护理中,确认退出?</string>
+	<string name="SetNursingEndMsg2">是否退出护理?</string>
 	<string name="Prompt">设置提示语</string>
 	<string name="PromptMsg">锁屏显示</string>
     <!-- 提示语界面 -->
@@ -143,6 +176,15 @@
     <string name="90Minutes">90分钟</string>
     <string name="120Minutes">120分钟</string>
 	<string name="ExitPrompt">退出提示</string>
+    <!-- 事务界面 -->
+    <string name="CustomerAffair">用户事务</string>
+    <string name="AffairContent">事务内容</string>
+    <string name="PlanTime">计划执行时间</string>
+    <string name="AffairStatus">事务状态</string>
+    <string name="Execute">执行</string>
+    <string name="Unexecuted">未执行</string>
+    <string name="Executed">已执行</string>
+    <string name="AffairHandle">操作</string>
     <!-- 通话界面 -->
     <string name="RemoteRefuse">对方拒绝</string>
     <string name="RemoteBusy">对方忙线</string>
@@ -178,6 +220,21 @@
     <string name="PasswordInput">输入密码</string>
     <string name="RestartTime">重启倒计时:</string>
     <string name="ScanQRCode">扫描二维码</string>
+    <!-- 注册界面 -->
+    <string name="DeviceAdd">设备注册</string>
+    <string name="DeviceLocal">本机</string>
+    <string name="DeviceExtension1">手柄1</string>
+    <string name="DeviceExtension2">手柄2</string>
+    <string name="Part">科室</string>
+    <string name="Room">房间</string>
+    <string name="Bed">床位</string>
+    <string name="ConfirmAdd">确认注册</string>
+    <string name="DeviceAddMsg">设备名称:本机	设备类型:3		注册ID:</string>
+    <string name="DeviceAddMsg2">设备名称:手柄1		设备类型:4		注册ID:</string>
+    <string name="DeviceAddMsg3">设备名称:手柄2		设备类型:4		注册ID:</string>
+    <string name="RoomDevice">门口机</string>
+    <string name="BedDevice">床头分机</string>
+    <string name="AddDeviceSuccess">设备注册成功</string>
     <!-- 设置界面 -->
     <string name="SettingText">设备设置</string>
     <string name="IsLight">是否常亮</string>
@@ -217,6 +274,11 @@
     <string name="WrongPassword">密码错误</string>
     <string name="ConfigureEmployeeID">请先配置员工工号</string>
     <string name="PassNoError">未找到该卡员工</string>
+    <string name="AddDeviceErrorMsg">注册失败,错误代码:</string>
+    <string name="DEVICE_MAC_REPEAT">MAC地址重复</string>
+    <string name="DEVICE_FRAME_FAILED">设备类型和空间结构类型不匹配!</string>
+    <string name="AddDeviceFailed">注册失败</string>
+    <string name="AddDeviceFrameFailed">没有能够注册的空间id</string>
     <!-- 版本界面 -->
     <string name="VersionTitle">版本升级</string>
     <string name="VersionInfo">版本信息</string>

+ 423 - 0
jni/activity/customerAffairActivity.cpp

@@ -0,0 +1,423 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#include "customerAffairActivity.h"
+
+/*TAG:GlobalVariable全局变量*/
+static ZKListView* mAffairListViewPtr;
+static ZKTextView* mHandleTextViewPtr;
+static ZKTextView* mAffairStatusTextViewPtr;
+static ZKTextView* mAffairPlanTimeTextViewPtr;
+static ZKTextView* mAffairContentTextViewPtr;
+static ZKPainter* mAffairTitlePainterPtr;
+static ZKPainter* mAffairPainterPtr;
+static ZKTextView* mTitleTextViewPtr;
+static ZKButton* msys_backPtr;
+static customerAffairActivity* mActivityPtr;
+
+/*register activity*/
+REGISTER_ACTIVITY(customerAffairActivity);
+
+typedef struct {
+	int id; // 定时器ID , 不能重复
+	int time; // 定时器  时间间隔  单位 毫秒
+}S_ACTIVITY_TIMEER;
+
+#include "logic/customerAffairLogic.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_CUSTOMERAFFAIR_sys_back, onButtonClick_sys_back,
+};
+/***************/
+
+
+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[] = {
+    ID_CUSTOMERAFFAIR_AffairListView, getListItemCount_AffairListView, obtainListItemData_AffairListView, onListItemClick_AffairListView,
+};
+
+
+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[] = {
+};
+
+
+customerAffairActivity::customerAffairActivity() {
+	//todo add init code here
+	mVideoLoopIndex = -1;
+	mVideoLoopErrorCount = 0;
+}
+
+customerAffairActivity::~customerAffairActivity() {
+  //todo add init file here
+  // 退出应用时需要反注册
+    EASYUICONTEXT->unregisterGlobalTouchListener(this);
+    unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    onUI_quit();
+    mActivityPtr = NULL;
+    mAffairListViewPtr = NULL;
+    mHandleTextViewPtr = NULL;
+    mAffairStatusTextViewPtr = NULL;
+    mAffairPlanTimeTextViewPtr = NULL;
+    mAffairContentTextViewPtr = NULL;
+    mAffairTitlePainterPtr = NULL;
+    mAffairPainterPtr = NULL;
+    mTitleTextViewPtr = NULL;
+    msys_backPtr = NULL;
+}
+
+const char* customerAffairActivity::getAppName() const{
+	return "customerAffair.ftu";
+}
+
+//TAG:onCreate
+void customerAffairActivity::onCreate() {
+	Activity::onCreate();
+    mAffairListViewPtr = (ZKListView*)findControlByID(ID_CUSTOMERAFFAIR_AffairListView);if(mAffairListViewPtr!= NULL){mAffairListViewPtr->setListAdapter(this);mAffairListViewPtr->setItemClickListener(this);}
+    mHandleTextViewPtr = (ZKTextView*)findControlByID(ID_CUSTOMERAFFAIR_HandleTextView);
+    mAffairStatusTextViewPtr = (ZKTextView*)findControlByID(ID_CUSTOMERAFFAIR_AffairStatusTextView);
+    mAffairPlanTimeTextViewPtr = (ZKTextView*)findControlByID(ID_CUSTOMERAFFAIR_AffairPlanTimeTextView);
+    mAffairContentTextViewPtr = (ZKTextView*)findControlByID(ID_CUSTOMERAFFAIR_AffairContentTextView);
+    mAffairTitlePainterPtr = (ZKPainter*)findControlByID(ID_CUSTOMERAFFAIR_AffairTitlePainter);
+    mAffairPainterPtr = (ZKPainter*)findControlByID(ID_CUSTOMERAFFAIR_AffairPainter);
+    mTitleTextViewPtr = (ZKTextView*)findControlByID(ID_CUSTOMERAFFAIR_TitleTextView);
+    msys_backPtr = (ZKButton*)findControlByID(ID_CUSTOMERAFFAIR_sys_back);
+	mActivityPtr = this;
+	onUI_init();
+  registerProtocolDataUpdateListener(onProtocolDataUpdate);
+  rigesterActivityTimer();
+}
+
+void customerAffairActivity::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 customerAffairActivity::onResume() {
+	Activity::onResume();
+	EASYUICONTEXT->registerGlobalTouchListener(this);
+	startVideoLoopPlayback();
+	onUI_show();
+}
+
+void customerAffairActivity::onPause() {
+	Activity::onPause();
+	EASYUICONTEXT->unregisterGlobalTouchListener(this);
+	stopVideoLoopPlayback();
+	onUI_hide();
+}
+
+void customerAffairActivity::onIntent(const Intent *intentPtr) {
+	Activity::onIntent(intentPtr);
+	onUI_intent(intentPtr);
+}
+
+bool customerAffairActivity::onTimer(int id) {
+	return onUI_Timer(id);
+}
+
+void customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::onTouchEvent(const MotionEvent &ev) {
+    return oncustomerAffairActivityTouchEvent(ev);
+}
+
+void customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::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 customerAffairActivity::registerUserTimer(int id, int time) {
+	registerTimer(id, time);
+}
+
+void customerAffairActivity::unregisterUserTimer(int id) {
+	unregisterTimer(id);
+}
+
+void customerAffairActivity::resetUserTimer(int id, int time) {
+	resetTimer(id, time);
+}

+ 110 - 0
jni/activity/customerAffairActivity.h

@@ -0,0 +1,110 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#ifndef __CUSTOMERAFFAIRACTIVITY_H__
+#define __CUSTOMERAFFAIRACTIVITY_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_CUSTOMERAFFAIR_CustomerAffairHandleSubItem    24004
+#define ID_CUSTOMERAFFAIR_CustomerStatusSubItem    24003
+#define ID_CUSTOMERAFFAIR_PlanTimeSubItem    24002
+#define ID_CUSTOMERAFFAIR_CustomerContentSubItem    24001
+#define ID_CUSTOMERAFFAIR_AffairListView    80001
+#define ID_CUSTOMERAFFAIR_HandleTextView    50005
+#define ID_CUSTOMERAFFAIR_AffairStatusTextView    50004
+#define ID_CUSTOMERAFFAIR_AffairPlanTimeTextView    50003
+#define ID_CUSTOMERAFFAIR_AffairContentTextView    50001
+#define ID_CUSTOMERAFFAIR_AffairTitlePainter    52002
+#define ID_CUSTOMERAFFAIR_AffairPainter    52001
+#define ID_CUSTOMERAFFAIR_TitleTextView    50002
+#define ID_CUSTOMERAFFAIR_sys_back   100
+/*TAG:Macro宏ID END*/
+
+class customerAffairActivity : public Activity, 
+                     public ZKSeekBar::ISeekBarChangeListener, 
+                     public ZKListView::IItemClickListener,
+                     public ZKListView::AbsListAdapter,
+                     public ZKSlideWindow::ISlideItemClickListener,
+                     public EasyUIContext::ITouchListener,
+                     public ZKEditText::ITextChangeListener,
+                     public ZKVideoView::IVideoPlayerMessageListener
+{
+public:
+    customerAffairActivity();
+    virtual ~customerAffairActivity();
+
+    /**
+     * 注册定时器
+     */
+	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

+ 462 - 0
jni/activity/deviceAddActivity.cpp

@@ -0,0 +1,462 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#include "deviceAddActivity.h"
+
+/*TAG:GlobalVariable全局变量*/
+static ZKButton* mRebootButtonPtr;
+static ZKButton* mConfirmButtonPtr;
+static ZKButton* mChoiceBedButtonPtr;
+static ZKTextView* mBedTextViewPtr;
+static ZKButton* mChoiceRoomButtonPtr;
+static ZKTextView* mRoomTextViewPtr;
+static ZKButton* mChoicePartButtonPtr;
+static ZKTextView* mPartTextViewPtr;
+static ZKListView* mHospitalListViewPtr;
+static ZKTextView* mDeviceMacTextViewPtr;
+static ZKRadioGroup* mDeviceRadioGroupPtr;
+static ZKPainter* mDeviceAddPainterPtr;
+static ZKTextView* mTitleTextViewPtr;
+static ZKButton* msys_backPtr;
+static deviceAddActivity* mActivityPtr;
+
+/*register activity*/
+REGISTER_ACTIVITY(deviceAddActivity);
+
+typedef struct {
+	int id; // 定时器ID , 不能重复
+	int time; // 定时器  时间间隔  单位 毫秒
+}S_ACTIVITY_TIMEER;
+
+#include "logic/deviceAddLogic.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_DEVICEADD_RebootButton, onButtonClick_RebootButton,
+    ID_DEVICEADD_ConfirmButton, onButtonClick_ConfirmButton,
+    ID_DEVICEADD_ChoiceBedButton, onButtonClick_ChoiceBedButton,
+    ID_DEVICEADD_ChoiceRoomButton, onButtonClick_ChoiceRoomButton,
+    ID_DEVICEADD_ChoicePartButton, onButtonClick_ChoicePartButton,
+    ID_DEVICEADD_sys_back, onButtonClick_sys_back,
+};
+/***************/
+
+
+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[] = {
+    ID_DEVICEADD_HospitalListView, getListItemCount_HospitalListView, obtainListItemData_HospitalListView, onListItemClick_HospitalListView,
+};
+
+
+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[] = {
+};
+
+
+typedef void (*RadioGroupCallback)(ZKRadioGroup*, int);
+typedef struct {
+  int id;
+  RadioGroupCallback onCheckedChanged;
+}S_RadioGroupCallback;
+/*TAG:RadioGroupCallbackTab*/
+static S_RadioGroupCallback SRadioGroupCallbackTab[] = {
+    ID_DEVICEADD_DeviceRadioGroup, onCheckedChanged_DeviceRadioGroup,
+};
+
+deviceAddActivity::deviceAddActivity() {
+	//todo add init code here
+	mVideoLoopIndex = -1;
+	mVideoLoopErrorCount = 0;
+}
+
+deviceAddActivity::~deviceAddActivity() {
+  //todo add init file here
+  // 退出应用时需要反注册
+    EASYUICONTEXT->unregisterGlobalTouchListener(this);
+    unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    onUI_quit();
+    mActivityPtr = NULL;
+    mRebootButtonPtr = NULL;
+    mConfirmButtonPtr = NULL;
+    mChoiceBedButtonPtr = NULL;
+    mBedTextViewPtr = NULL;
+    mChoiceRoomButtonPtr = NULL;
+    mRoomTextViewPtr = NULL;
+    mChoicePartButtonPtr = NULL;
+    mPartTextViewPtr = NULL;
+    mHospitalListViewPtr = NULL;
+    mDeviceMacTextViewPtr = NULL;
+    mDeviceRadioGroupPtr = NULL;
+    mDeviceAddPainterPtr = NULL;
+    mTitleTextViewPtr = NULL;
+    msys_backPtr = NULL;
+}
+
+const char* deviceAddActivity::getAppName() const{
+	return "deviceAdd.ftu";
+}
+
+//TAG:onCreate
+void deviceAddActivity::onCreate() {
+	Activity::onCreate();
+    mRebootButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_RebootButton);
+    mConfirmButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_ConfirmButton);
+    mChoiceBedButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_ChoiceBedButton);
+    mBedTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_BedTextView);
+    mChoiceRoomButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_ChoiceRoomButton);
+    mRoomTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_RoomTextView);
+    mChoicePartButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_ChoicePartButton);
+    mPartTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_PartTextView);
+    mHospitalListViewPtr = (ZKListView*)findControlByID(ID_DEVICEADD_HospitalListView);if(mHospitalListViewPtr!= NULL){mHospitalListViewPtr->setListAdapter(this);mHospitalListViewPtr->setItemClickListener(this);}
+    mDeviceMacTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_DeviceMacTextView);
+    mDeviceRadioGroupPtr = (ZKRadioGroup*)findControlByID(ID_DEVICEADD_DeviceRadioGroup);if(mDeviceRadioGroupPtr!= NULL){mDeviceRadioGroupPtr->setCheckedChangeListener(this);}
+    mDeviceAddPainterPtr = (ZKPainter*)findControlByID(ID_DEVICEADD_DeviceAddPainter);
+    mTitleTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_TitleTextView);
+    msys_backPtr = (ZKButton*)findControlByID(ID_DEVICEADD_sys_back);
+	mActivityPtr = this;
+	onUI_init();
+  registerProtocolDataUpdateListener(onProtocolDataUpdate);
+  rigesterActivityTimer();
+}
+
+void deviceAddActivity::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 deviceAddActivity::onResume() {
+	Activity::onResume();
+	EASYUICONTEXT->registerGlobalTouchListener(this);
+	startVideoLoopPlayback();
+	onUI_show();
+}
+
+void deviceAddActivity::onPause() {
+	Activity::onPause();
+	EASYUICONTEXT->unregisterGlobalTouchListener(this);
+	stopVideoLoopPlayback();
+	onUI_hide();
+}
+
+void deviceAddActivity::onIntent(const Intent *intentPtr) {
+	Activity::onIntent(intentPtr);
+	onUI_intent(intentPtr);
+}
+
+bool deviceAddActivity::onTimer(int id) {
+	return onUI_Timer(id);
+}
+
+void deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::onTouchEvent(const MotionEvent &ev) {
+    return ondeviceAddActivityTouchEvent(ev);
+}
+
+void deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::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 deviceAddActivity::registerUserTimer(int id, int time) {
+	registerTimer(id, time);
+}
+
+void deviceAddActivity::unregisterUserTimer(int id) {
+	unregisterTimer(id);
+}
+
+void deviceAddActivity::resetUserTimer(int id, int time) {
+	resetTimer(id, time);
+}
+void deviceAddActivity::onCheckedChanged(ZKRadioGroup* pRadioGroup, int checkedID) {
+    int tablen = sizeof(SRadioGroupCallbackTab) / sizeof(S_RadioGroupCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SRadioGroupCallbackTab[i].id == pRadioGroup->getID()) {
+        	SRadioGroupCallbackTab[i].onCheckedChanged(pRadioGroup, checkedID);
+            break;
+        }
+    }
+}

+ 117 - 0
jni/activity/deviceAddActivity.h

@@ -0,0 +1,117 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#ifndef __DEVICEADDACTIVITY_H__
+#define __DEVICEADDACTIVITY_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 "control/ZKRadioGroup.h"
+#include "window/ZKSlideWindow.h"
+
+/*TAG:Macro宏ID*/
+#define ID_DEVICEADD_RebootButton    20001
+#define ID_DEVICEADD_ConfirmButton    20015
+#define ID_DEVICEADD_ChoiceBedButton    20006
+#define ID_DEVICEADD_BedTextView    50005
+#define ID_DEVICEADD_ChoiceRoomButton    20005
+#define ID_DEVICEADD_RoomTextView    50004
+#define ID_DEVICEADD_ChoicePartButton    20004
+#define ID_DEVICEADD_PartTextView    50003
+#define ID_DEVICEADD_HospitalListView    80001
+#define ID_DEVICEADD_DeviceMacTextView    50001
+#define ID_DEVICEADD_DeviceRadioButton3    22003
+#define ID_DEVICEADD_DeviceRadioButton2    22002
+#define ID_DEVICEADD_DeviceRadioButton1    22001
+#define ID_DEVICEADD_DeviceRadioGroup    94001
+#define ID_DEVICEADD_DeviceAddPainter    52001
+#define ID_DEVICEADD_TitleTextView    50002
+#define ID_DEVICEADD_sys_back   100
+/*TAG:Macro宏ID END*/
+
+class deviceAddActivity : public Activity, 
+                     public ZKSeekBar::ISeekBarChangeListener, 
+                     public ZKListView::IItemClickListener,
+                     public ZKListView::AbsListAdapter,
+                     public ZKSlideWindow::ISlideItemClickListener,
+                     public EasyUIContext::ITouchListener,
+                     public ZKRadioGroup::ICheckedChangeListener,
+                     public ZKEditText::ITextChangeListener,
+                     public ZKVideoView::IVideoPlayerMessageListener
+{
+public:
+    deviceAddActivity();
+    virtual ~deviceAddActivity();
+
+    /**
+     * 注册定时器
+     */
+	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 onCheckedChanged(ZKRadioGroup* pRadioGroup, int checkedID);
+
+    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

+ 37 - 0
jni/activity/functionActivity.cpp

@@ -4,6 +4,17 @@
 #include "functionActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKTextView* mHandleStatusTextViewPtr;
+static ZKButton* mHandleBackButtonPtr;
+static ZKButton* mHandleConfirmButtonPtr;
+static ZKTextView* mHandleTextViewPtr;
+static ZKPainter* mHandleIconPainterPtr;
+static ZKWindow* mHandleWindowPtr;
+static ZKButton* mCancelButtonPtr;
+static ZKButton* mCompleteButtonPtr;
+static ZKTextView* mEventHandleTextViewPtr;
+static ZKPainter* mEventHandlePainterPtr;
+static ZKWindow* mEventHandleWindowPtr;
 static ZKButton* mNursingTimeBackButtonPtr;
 static ZKButton* mNursingTimeButtonPtr;
 static ZKTextView* mUnitTextViewPtr;
@@ -94,6 +105,10 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_FUNCTION_HandleBackButton, onButtonClick_HandleBackButton,
+    ID_FUNCTION_HandleConfirmButton, onButtonClick_HandleConfirmButton,
+    ID_FUNCTION_CancelButton, onButtonClick_CancelButton,
+    ID_FUNCTION_CompleteButton, onButtonClick_CompleteButton,
     ID_FUNCTION_NursingTimeBackButton, onButtonClick_NursingTimeBackButton,
     ID_FUNCTION_NursingTimeButton, onButtonClick_NursingTimeButton,
     ID_FUNCTION_Reduce5Button, onButtonClick_Reduce5Button,
@@ -190,6 +205,17 @@ functionActivity::~functionActivity() {
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     onUI_quit();
     mActivityPtr = NULL;
+    mHandleStatusTextViewPtr = NULL;
+    mHandleBackButtonPtr = NULL;
+    mHandleConfirmButtonPtr = NULL;
+    mHandleTextViewPtr = NULL;
+    mHandleIconPainterPtr = NULL;
+    mHandleWindowPtr = NULL;
+    mCancelButtonPtr = NULL;
+    mCompleteButtonPtr = NULL;
+    mEventHandleTextViewPtr = NULL;
+    mEventHandlePainterPtr = NULL;
+    mEventHandleWindowPtr = NULL;
     mNursingTimeBackButtonPtr = NULL;
     mNursingTimeButtonPtr = NULL;
     mUnitTextViewPtr = NULL;
@@ -252,6 +278,17 @@ const char* functionActivity::getAppName() const{
 //TAG:onCreate
 void functionActivity::onCreate() {
 	Activity::onCreate();
+    mHandleStatusTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_HandleStatusTextView);
+    mHandleBackButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_HandleBackButton);
+    mHandleConfirmButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_HandleConfirmButton);
+    mHandleTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_HandleTextView);
+    mHandleIconPainterPtr = (ZKPainter*)findControlByID(ID_FUNCTION_HandleIconPainter);
+    mHandleWindowPtr = (ZKWindow*)findControlByID(ID_FUNCTION_HandleWindow);
+    mCancelButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_CancelButton);
+    mCompleteButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_CompleteButton);
+    mEventHandleTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_EventHandleTextView);
+    mEventHandlePainterPtr = (ZKPainter*)findControlByID(ID_FUNCTION_EventHandlePainter);
+    mEventHandleWindowPtr = (ZKWindow*)findControlByID(ID_FUNCTION_EventHandleWindow);
     mNursingTimeBackButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_NursingTimeBackButton);
     mNursingTimeButtonPtr = (ZKButton*)findControlByID(ID_FUNCTION_NursingTimeButton);
     mUnitTextViewPtr = (ZKTextView*)findControlByID(ID_FUNCTION_UnitTextView);

+ 11 - 0
jni/activity/functionActivity.h

@@ -27,6 +27,17 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_FUNCTION_HandleStatusTextView    50015
+#define ID_FUNCTION_HandleBackButton    20023
+#define ID_FUNCTION_HandleConfirmButton    20015
+#define ID_FUNCTION_HandleTextView    50013
+#define ID_FUNCTION_HandleIconPainter    52008
+#define ID_FUNCTION_HandleWindow    110011
+#define ID_FUNCTION_CancelButton    20014
+#define ID_FUNCTION_CompleteButton    20016
+#define ID_FUNCTION_EventHandleTextView    50014
+#define ID_FUNCTION_EventHandlePainter    52007
+#define ID_FUNCTION_EventHandleWindow    110009
 #define ID_FUNCTION_NursingTimeBackButton    20022
 #define ID_FUNCTION_NursingTimeButton    20017
 #define ID_FUNCTION_UnitTextView    50023

+ 435 - 0
jni/activity/interactionActivity.cpp

@@ -0,0 +1,435 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#include "interactionActivity.h"
+
+/*TAG:GlobalVariable全局变量*/
+static ZKListView* mInteractionListViewPtr;
+static ZKRadioGroup* mInteractionTypeRadioGroupPtr;
+static ZKListView* mEventListViewPtr;
+static ZKButton* mRecoverButtonPtr;
+static ZKPainter* mInteractionPainterPtr;
+static ZKButton* mInteractionBackButtonPtr;
+static interactionActivity* mActivityPtr;
+
+/*register activity*/
+REGISTER_ACTIVITY(interactionActivity);
+
+typedef struct {
+	int id; // 定时器ID , 不能重复
+	int time; // 定时器  时间间隔  单位 毫秒
+}S_ACTIVITY_TIMEER;
+
+#include "logic/interactionLogic.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_INTERACTION_RecoverButton, onButtonClick_RecoverButton,
+    ID_INTERACTION_InteractionBackButton, onButtonClick_InteractionBackButton,
+};
+/***************/
+
+
+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[] = {
+    ID_INTERACTION_InteractionListView, getListItemCount_InteractionListView, obtainListItemData_InteractionListView, onListItemClick_InteractionListView,
+    ID_INTERACTION_EventListView, getListItemCount_EventListView, obtainListItemData_EventListView, onListItemClick_EventListView,
+};
+
+
+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[] = {
+};
+
+
+typedef void (*RadioGroupCallback)(ZKRadioGroup*, int);
+typedef struct {
+  int id;
+  RadioGroupCallback onCheckedChanged;
+}S_RadioGroupCallback;
+/*TAG:RadioGroupCallbackTab*/
+static S_RadioGroupCallback SRadioGroupCallbackTab[] = {
+    ID_INTERACTION_InteractionTypeRadioGroup, onCheckedChanged_InteractionTypeRadioGroup,
+};
+
+interactionActivity::interactionActivity() {
+	//todo add init code here
+	mVideoLoopIndex = -1;
+	mVideoLoopErrorCount = 0;
+}
+
+interactionActivity::~interactionActivity() {
+  //todo add init file here
+  // 退出应用时需要反注册
+    EASYUICONTEXT->unregisterGlobalTouchListener(this);
+    unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
+    onUI_quit();
+    mActivityPtr = NULL;
+    mInteractionListViewPtr = NULL;
+    mInteractionTypeRadioGroupPtr = NULL;
+    mEventListViewPtr = NULL;
+    mRecoverButtonPtr = NULL;
+    mInteractionPainterPtr = NULL;
+    mInteractionBackButtonPtr = NULL;
+}
+
+const char* interactionActivity::getAppName() const{
+	return "interaction.ftu";
+}
+
+//TAG:onCreate
+void interactionActivity::onCreate() {
+	Activity::onCreate();
+    mInteractionListViewPtr = (ZKListView*)findControlByID(ID_INTERACTION_InteractionListView);if(mInteractionListViewPtr!= NULL){mInteractionListViewPtr->setListAdapter(this);mInteractionListViewPtr->setItemClickListener(this);}
+    mInteractionTypeRadioGroupPtr = (ZKRadioGroup*)findControlByID(ID_INTERACTION_InteractionTypeRadioGroup);if(mInteractionTypeRadioGroupPtr!= NULL){mInteractionTypeRadioGroupPtr->setCheckedChangeListener(this);}
+    mEventListViewPtr = (ZKListView*)findControlByID(ID_INTERACTION_EventListView);if(mEventListViewPtr!= NULL){mEventListViewPtr->setListAdapter(this);mEventListViewPtr->setItemClickListener(this);}
+    mRecoverButtonPtr = (ZKButton*)findControlByID(ID_INTERACTION_RecoverButton);
+    mInteractionPainterPtr = (ZKPainter*)findControlByID(ID_INTERACTION_InteractionPainter);
+    mInteractionBackButtonPtr = (ZKButton*)findControlByID(ID_INTERACTION_InteractionBackButton);
+	mActivityPtr = this;
+	onUI_init();
+  registerProtocolDataUpdateListener(onProtocolDataUpdate);
+  rigesterActivityTimer();
+}
+
+void interactionActivity::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 interactionActivity::onResume() {
+	Activity::onResume();
+	EASYUICONTEXT->registerGlobalTouchListener(this);
+	startVideoLoopPlayback();
+	onUI_show();
+}
+
+void interactionActivity::onPause() {
+	Activity::onPause();
+	EASYUICONTEXT->unregisterGlobalTouchListener(this);
+	stopVideoLoopPlayback();
+	onUI_hide();
+}
+
+void interactionActivity::onIntent(const Intent *intentPtr) {
+	Activity::onIntent(intentPtr);
+	onUI_intent(intentPtr);
+}
+
+bool interactionActivity::onTimer(int id) {
+	return onUI_Timer(id);
+}
+
+void interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::onTouchEvent(const MotionEvent &ev) {
+    return oninteractionActivityTouchEvent(ev);
+}
+
+void interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::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 interactionActivity::registerUserTimer(int id, int time) {
+	registerTimer(id, time);
+}
+
+void interactionActivity::unregisterUserTimer(int id) {
+	unregisterTimer(id);
+}
+
+void interactionActivity::resetUserTimer(int id, int time) {
+	resetTimer(id, time);
+}
+void interactionActivity::onCheckedChanged(ZKRadioGroup* pRadioGroup, int checkedID) {
+    int tablen = sizeof(SRadioGroupCallbackTab) / sizeof(S_RadioGroupCallback);
+    for (int i = 0; i < tablen; ++i) {
+        if (SRadioGroupCallbackTab[i].id == pRadioGroup->getID()) {
+        	SRadioGroupCallbackTab[i].onCheckedChanged(pRadioGroup, checkedID);
+            break;
+        }
+    }
+}

+ 111 - 0
jni/activity/interactionActivity.h

@@ -0,0 +1,111 @@
+/***********************************************
+/gen auto by zuitools
+***********************************************/
+#ifndef __INTERACTIONACTIVITY_H__
+#define __INTERACTIONACTIVITY_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 "control/ZKRadioGroup.h"
+#include "window/ZKSlideWindow.h"
+
+/*TAG:Macro宏ID*/
+#define ID_INTERACTION_ActionSubItem    24003
+#define ID_INTERACTION_StatusSubItem    24002
+#define ID_INTERACTION_TimeSubItem    24001
+#define ID_INTERACTION_InteractionListView    80002
+#define ID_INTERACTION_NotReceivedRadioButton    22002
+#define ID_INTERACTION_AllRadioButton    22001
+#define ID_INTERACTION_InteractionTypeRadioGroup    94001
+#define ID_INTERACTION_EventListView    80001
+#define ID_INTERACTION_RecoverButton    20002
+#define ID_INTERACTION_InteractionPainter    52001
+#define ID_INTERACTION_InteractionBackButton    20001
+/*TAG:Macro宏ID END*/
+
+class interactionActivity : public Activity, 
+                     public ZKSeekBar::ISeekBarChangeListener, 
+                     public ZKListView::IItemClickListener,
+                     public ZKListView::AbsListAdapter,
+                     public ZKSlideWindow::ISlideItemClickListener,
+                     public EasyUIContext::ITouchListener,
+                     public ZKRadioGroup::ICheckedChangeListener,
+                     public ZKEditText::ITextChangeListener,
+                     public ZKVideoView::IVideoPlayerMessageListener
+{
+public:
+    interactionActivity();
+    virtual ~interactionActivity();
+
+    /**
+     * 注册定时器
+     */
+	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 onCheckedChanged(ZKRadioGroup* pRadioGroup, int checkedID);
+
+    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

+ 26 - 24
jni/activity/mainActivity.h

@@ -27,14 +27,32 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
-#define ID_MAIN_NurseTitleSubItem4    24034
-#define ID_MAIN_DoctorTitleSubItem4    24033
-#define ID_MAIN_NurseSubItem4    24032
-#define ID_MAIN_DoctorSubItem4    24031
-#define ID_MAIN_SexSubItem4    24030
-#define ID_MAIN_AgeSubItem4    24029
-#define ID_MAIN_CustomerNameSubItem4    24028
-#define ID_MAIN_BedNumSubItem4    24027
+#define ID_MAIN_NurseTitleSubItem4    24036
+#define ID_MAIN_DoctorTitleSubItem4    24035
+#define ID_MAIN_NurseSubItem4    24034
+#define ID_MAIN_DoctorSubItem4    24033
+#define ID_MAIN_SexSubItem4    24032
+#define ID_MAIN_AgeSubItem4    24031
+#define ID_MAIN_CustomerNameSubItem4    24030
+#define ID_MAIN_BedNumSubItem4    24029
+#define ID_MAIN_NurseTitleSubItem3    24028
+#define ID_MAIN_DoctorTitleSubItem3    24027
+#define ID_MAIN_NurseSubItem3    24026
+#define ID_MAIN_DoctorSubItem3    24025
+#define ID_MAIN_SexSubItem3    24024
+#define ID_MAIN_AgeSubItem3    24023
+#define ID_MAIN_CustomerNameSubItem3    24022
+#define ID_MAIN_BedNumSubItem3    24021
+#define ID_MAIN_NurseTitleSubItem2    24020
+#define ID_MAIN_DoctorTitleSubItem2    24019
+#define ID_MAIN_NurseSubItem2    24018
+#define ID_MAIN_DoctorSubItem2    24017
+#define ID_MAIN_SexSubItem2    24016
+#define ID_MAIN_AgeSubItem2    24015
+#define ID_MAIN_CustomerNameSubItem2    24014
+#define ID_MAIN_BedNumSubItem2    24013
+#define ID_MAIN_EventSubItem    24012
+#define ID_MAIN_AffairSubItem    24011
 #define ID_MAIN_BedListView4    80004
 #define ID_MAIN_NurseHeadTextView    50009
 #define ID_MAIN_NurseTitleTextView    50007
@@ -44,23 +62,7 @@
 #define ID_MAIN_DirectorTitleTextView    50006
 #define ID_MAIN_DirectLinePainter    52009
 #define ID_MAIN_DirectorPainter    52007
-#define ID_MAIN_NurseTitleSubItem3    24026
-#define ID_MAIN_DoctorTitleSubItem3    24025
-#define ID_MAIN_NurseSubItem3    24024
-#define ID_MAIN_DoctorSubItem3    24023
-#define ID_MAIN_SexSubItem3    24022
-#define ID_MAIN_AgeSubItem3    24021
-#define ID_MAIN_CustomerNameSubItem3    24020
-#define ID_MAIN_BedNumSubItem3    24019
 #define ID_MAIN_BedListView3    80003
-#define ID_MAIN_NurseTitleSubItem2    24018
-#define ID_MAIN_DoctorTitleSubItem2    24017
-#define ID_MAIN_NurseSubItem2    24016
-#define ID_MAIN_DoctorSubItem2    24015
-#define ID_MAIN_SexSubItem2    24014
-#define ID_MAIN_AgeSubItem2    24013
-#define ID_MAIN_CustomerNameSubItem2    24012
-#define ID_MAIN_BedNumSubItem2    24011
 #define ID_MAIN_BedListView2    80002
 #define ID_MAIN_CustomerNameSubItem    24010
 #define ID_MAIN_NurseSubItem    24008

+ 11 - 0
jni/activity/navibar.cpp

@@ -2,6 +2,9 @@
 #include "entry/EasyUIContext.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKButton* mBlueCodeButtonPtr;
+static ZKPainter* mNursingPainterPtr;
+static ZKButton* mNursingButtonPtr;
 static ZKButton* mCallCancelButtonPtr;
 static ZKPainter* mBgPainterPtr;
 static ZKButton* mHomeButtonPtr;
@@ -49,6 +52,8 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_NAVIBAR_BlueCodeButton, onButtonClick_BlueCodeButton,
+    ID_NAVIBAR_NursingButton, onButtonClick_NursingButton,
     ID_NAVIBAR_CallCancelButton, onButtonClick_CallCancelButton,
     ID_NAVIBAR_HomeButton, onButtonClick_HomeButton,
     ID_NAVIBAR_HealthCareButton, onButtonClick_HealthCareButton,
@@ -132,6 +137,9 @@ navibar::~navibar() {
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     onUI_quit();
     mnavibarPtr = NULL;
+    mBlueCodeButtonPtr = NULL;
+    mNursingPainterPtr = NULL;
+    mNursingButtonPtr = NULL;
     mCallCancelButtonPtr = NULL;
     mBgPainterPtr = NULL;
     mHomeButtonPtr = NULL;
@@ -151,6 +159,9 @@ const char* navibar::getAppName() const{
 //TAG:onCreate
 void navibar::onCreate() {
 	BaseApp::onCreate();
+    mBlueCodeButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_BlueCodeButton);
+    mNursingPainterPtr = (ZKPainter*)findControlByID(ID_NAVIBAR_NursingPainter);
+    mNursingButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_NursingButton);
     mCallCancelButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_CallCancelButton);
     mBgPainterPtr = (ZKPainter*)findControlByID(ID_NAVIBAR_BgPainter);
     mHomeButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_HomeButton);

+ 3 - 0
jni/activity/navibar.h

@@ -23,6 +23,9 @@
 #include "control/ZKRadioGroup.h"
 #include "window/ZKSlideWindow.h"
 /*TAG:Macro宏ID*/
+#define ID_NAVIBAR_BlueCodeButton    20008
+#define ID_NAVIBAR_NursingPainter    52005
+#define ID_NAVIBAR_NursingButton    20007
 #define ID_NAVIBAR_CallCancelButton    20006
 #define ID_NAVIBAR_BgPainter    52004
 #define ID_NAVIBAR_HomeButton    20001

+ 30 - 0
jni/include/utils/TimeHelper.h

@@ -89,6 +89,36 @@ public:
 	    time_t t_ = mktime(tm_);                  // 将tm结构体转换成time_t格式。
 	    return t_;                                 // 返回值。
 	}
+
+	static std::string getTimeStrOnTimeDifference(std::string str, int timeDifference, const char *format) {
+		// 先把时间戳调整到对应时差
+		time_t timet = stoi(str);
+		struct tm *t = gmtime(&timet);
+		char pDate[25];
+		sprintf(pDate,"%d-%02d-%02d %02d:%02d:%02d",
+				1900 + t->tm_year, 1+ t->tm_mon, t->tm_mday,
+				t->tm_hour + timeDifference,t->tm_min,t->tm_sec);
+
+		tm tm_;                                    // 定义tm结构体。
+		int year, month, day, hour, minute, second;// 定义时间的各个int临时变量。
+		sscanf(pDate, "%d-%d-%d %d:%d:%d", &year, &month, &day, &hour, &minute, &second);// 将string存储的日期时间,转换为int临时变量。
+		tm_.tm_year = year - 1900;                 // 年,由于tm结构体存储的是从1900年开始的时间,所以tm_year为int临时变量减去1900。
+		tm_.tm_mon = month - 1;                    // 月,由于tm结构体的月份存储范围为0-11,所以tm_mon为int临时变量减去1。
+		tm_.tm_mday = day;                         // 日。
+		tm_.tm_hour = hour;                        // 时。
+		tm_.tm_min = minute;                       // 分。
+		tm_.tm_sec = second;                       // 秒。
+		tm_.tm_isdst = 0;                          // 非夏令时。
+		time_t _timet = mktime(&tm_);                  // 将tm结构体转换成time_t格式。
+
+		// 再转换成字符串
+		struct tm *_t = gmtime(&_timet);
+		char _pDate[25];
+		sprintf(_pDate, format,
+					1900 + _t->tm_year, 1+ _t->tm_mon, _t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+		std::string result = _pDate;
+		return result;
+	}
 };
 
 #endif /* _UTILS_TIME_HELPER_H_ */

+ 254 - 0
jni/logic/customerAffairLogic.cc

@@ -0,0 +1,254 @@
+#pragma once
+#include "uart/ProtocolSender.h"
+#include "restclient-cpp/restclient.h"
+#include "service/BusinessConfig.h"
+#include "base/http_client.h"
+#include "base/strings.hpp"
+#include <manager/LanguageManager.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 + /”  快捷键可以打开智能提示
+*/
+
+
+static int executeInt = 0;
+
+std::string _affairTransmitCustomerId = "";
+std::string _affairTransmitDeviceId = "";
+
+Json::Value customerAffairs;
+
+
+void getCustomerAffair() {
+	std::string url = getHttpGateway() + "/deviceBed/get_affairs_by_customer_id/" + _affairTransmitCustomerId;
+
+	LOGD("请求用户事务列表. url = %s", url.c_str());
+	//发起HTTP GET请求
+	RestClient::Response r = RestClient::get(url);
+	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)) {
+		customerAffairs = root;
+		mAffairListViewPtr->refreshListView();
+	}
+}
+
+
+void doCutsomerAffair(int execute) {
+	Json::Value affair = customerAffairs[executeInt];
+
+	std::string url = getHttpGateway() + "/deviceBed/execute_affair/" + affair["id"].asString() + "/" + _affairTransmitDeviceId + "/" + to_string(execute);
+
+	LOGD("处理用户事务. url = %s", url.c_str());
+	//发起HTTP GET请求
+	RestClient::Response r = RestClient::get(url);
+	if (r.code != 200) {
+		LOGD("处理用户事务-> 错误代码: %d", r.code);
+		return;
+	}
+
+	getCustomerAffair();
+}
+
+/**
+ * 注册定时器
+ * 填充数组用于注册定时器
+ * 注意: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");
+
+}
+
+/**
+ * 当切换到该界面时触发
+ */
+static void onUI_intent(const Intent *intentPtr) {
+    if (intentPtr != NULL) {
+        //TODO
+    	// 键值解析
+    	_affairTransmitCustomerId = intentPtr->getExtra(transmitCustomerId);
+    	_affairTransmitDeviceId = intentPtr->getExtra(transmitDeviceId);
+
+    	customerAffairs = Json::nullValue;
+
+    	getCustomerAffair();
+    }
+}
+
+/*
+ * 当界面显示时触发
+ */
+static void onUI_show() {
+
+    EASYUICONTEXT->hideStatusBar();
+    EASYUICONTEXT->hideNaviBar();
+
+}
+
+/*
+ * 当界面隐藏时触发
+ */
+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 oncustomerAffairActivityTouchEvent(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_sys_back(ZKButton *pButton) {
+    LOGD(" ButtonClick sys_back !!!\n");
+    return false;
+}
+
+static int getListItemCount_AffairListView(const ZKListView *pListView) {
+    //LOGD("getListItemCount_AffairListView !\n");
+    return customerAffairs.size();
+}
+
+static void obtainListItemData_AffairListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
+    //LOGD(" obtainListItemData_ AffairListView  !!!\n");
+
+	ZKListView::ZKListSubItem* affairContent = pListItem->findSubItemByID(ID_CUSTOMERAFFAIR_CustomerContentSubItem);
+	ZKListView::ZKListSubItem* planTime = pListItem->findSubItemByID(ID_CUSTOMERAFFAIR_PlanTimeSubItem);
+	ZKListView::ZKListSubItem* affairStatus = pListItem->findSubItemByID(ID_CUSTOMERAFFAIR_CustomerStatusSubItem);
+	ZKListView::ZKListSubItem* handle = pListItem->findSubItemByID(ID_CUSTOMERAFFAIR_CustomerAffairHandleSubItem);
+
+	affairContent->setText(customerAffairs[index]["content"].asString());
+	string time = customerAffairs[index]["affair_plan_time"].asString();
+	std::string _planTime = TimeHelper::getTimeStrOnTimeDifference(time, 8, "%d-%02d-%02d %02d:%02d:%02d");
+	planTime->setText(_planTime);
+
+	string _status = customerAffairs[index]["affair_state"].asString();
+	if (_status == "") {
+		affairStatus->setText(LANGUAGEMANAGER->getValue("Unexecuted"));
+		affairStatus->setTextColor(defaultYellow);
+	}
+	else if (_status == "1") {
+		affairStatus->setText(LANGUAGEMANAGER->getValue("Executed"));
+		affairStatus->setTextColor(defaultGreen);
+	}
+	else if (_status == "0") {
+		affairStatus->setText(LANGUAGEMANAGER->getValue("Canceled"));
+		affairStatus->setTextColor(defaultRed);
+	}
+
+	string doTime = customerAffairs[index]["affair_do_time"].asString();
+	if (doTime != "") {
+		std::string _doTime = TimeHelper::getTimeStrOnTimeDifference(time, 8, "%d-%02d-%02d %02d:%02d:%02d");
+		handle->setText(_doTime);
+		handle->setTextColor(BlackColor);
+		handle->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "");
+		handle->setButtonStatusPic(ZK_CONTROL_STATUS_PRESSED, "");
+	}
+	else {
+		handle->setText(LANGUAGEMANAGER->getValue("Execute"));
+		handle->setTextColor(whiteColour);
+		handle->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule_125x33.png");
+		handle->setButtonStatusPic(ZK_CONTROL_STATUS_PRESSED, "button/elliptic_grey_125x33.png");
+	}
+}
+
+static void onListItemClick_AffairListView(ZKListView *pListView, int index, int id) {
+    //LOGD(" onListItemClick_ AffairListView  !!!\n");
+	executeInt = index;
+
+	Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "customerAffair");
+	intent->putExtra(functionText, customerAffairs[executeInt]["content"].asString());
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+}

+ 527 - 0
jni/logic/deviceAddLogic.cc

@@ -0,0 +1,527 @@
+#pragma once
+#include "uart/ProtocolSender.h"
+#include "restclient-cpp/restclient.h"
+#include "service/BusinessConfig.h"
+#include "base/http_client.h"
+#include <string>
+/*
+*此文件由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 + /”  快捷键可以打开智能提示
+*/
+
+
+static int choiceDeviceInt = 0;
+static int choiceHospitalInt = 0;
+static int choicePartInt = 0;
+static int choiceRoomInt = 0;
+static int choiceBedInt = 0;
+Json::Value hospitalList;
+Json::Value hospitalFrameTree;
+Json::Value partFrameTree;
+Json::Value roomFrameTree;
+Json::Value bedFrameTree;
+Json::Value choicePart;
+Json::Value choiceRoom;
+Json::Value choiceBed;
+
+Json::Value addDevice;
+
+static string mac = StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
+
+
+
+
+
+static void getHospital() {
+	std::string url = getHttpGateway() + "/arrange/hospitals";
+
+	LOGD("请求医院列表. url = %s", url.c_str());
+	RestClient::Response r = RestClient::get(url);
+	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)) {
+		hospitalList = root;
+		mHospitalListViewPtr->refreshListView();
+	}
+}
+
+
+static void initFrame() {
+	if (hospitalFrameTree.size() == 0) {
+		return;
+	}
+
+	partFrameTree = hospitalFrameTree["frame_part_vos"];
+	if (partFrameTree.size() == 0) {
+		choicePart.clear();
+		mChoicePartButtonPtr->setText("");
+		return;
+	}
+
+	choicePart = partFrameTree[choicePartInt]["frame_part"];
+	mChoicePartButtonPtr->setText(choicePart["full_name"].asString());
+	addDevice["part_id"] = choicePart["part_id"];
+
+	roomFrameTree = partFrameTree[choicePartInt]["frame_room_vos"];
+	if (roomFrameTree.size() == 0) {
+		choiceRoom.clear();
+		mChoiceRoomButtonPtr->setText("");
+		return;
+	}
+	choiceRoom = roomFrameTree[choiceRoomInt]["frame_room"];
+	mChoiceRoomButtonPtr->setText(choiceRoom["full_name"].asString());
+
+	if (choiceDeviceInt == 0) {
+		addDevice["frame_id"] = choiceRoom["id"];
+		LOGD("门口机注册空间id ===> %d", choiceRoom["id"].asInt());
+	}
+	else {
+
+		bedFrameTree = roomFrameTree[choiceRoomInt]["frame_bed_list"];
+		if (bedFrameTree.size() == 0) {
+			choiceBed.clear();
+			mChoiceBedButtonPtr->setText("");
+			return;
+		}
+		choiceBed = bedFrameTree[choiceBedInt]["frame_bed"];
+
+		addDevice["frame_id"] = choiceBed["id"];
+		LOGD("手柄注册空间id ===> %d", choiceBed["id"].asInt());
+
+		mChoiceBedButtonPtr->setText(choiceBed["full_name"].asString());
+	}
+}
+
+
+static void getHospitalFrameTree(string hospitalId) {
+	std::string url = getHttpGateway() + "/arrange/frame_hospital/" + hospitalId;
+
+	LOGD("请求医院空间节点树状图. url = %s", url.c_str());
+	RestClient::Response r = RestClient::get(url);
+	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)) {
+		hospitalFrameTree = root;
+		initFrame();
+	}
+}
+
+
+static void initHospital() {
+	choicePartInt = 0;
+	choiceRoomInt = 0;
+	choiceBedInt = 0;
+
+	if (choiceHospitalInt != 0 || hospitalFrameTree.size() == 0) {
+		choiceHospitalInt = 0;
+		mHospitalListViewPtr->refreshListView();
+		getHospitalFrameTree(hospitalList[choiceHospitalInt]["shop_id"].asString());
+	}
+	else {
+		initFrame();
+	}
+}
+
+
+Json::Value getFrameTree(std::string frame) {
+	if (frame == "getPartFrame") {
+		return partFrameTree;
+	}
+	else if (frame == "getRoomFrame") {
+		return roomFrameTree;
+	}
+	else if (frame == "getBedFrame") {
+		return bedFrameTree;
+	}
+	Json::Value nullValue;
+	return nullValue;
+}
+
+void setPartFrameTree(int index) {
+	choicePartInt = index;
+
+	choicePart = partFrameTree[choicePartInt]["frame_part"];
+	mChoicePartButtonPtr->setText(choicePart["full_name"].asString());
+	addDevice["part_id"] = choicePart["part_id"];
+
+	roomFrameTree = partFrameTree[choicePartInt]["frame_room_vos"];
+
+	setRoomFrameTree(0);
+}
+
+void setRoomFrameTree(int index) {
+	choiceRoomInt = index;
+
+	if (roomFrameTree.size() == 0) {
+		choiceRoom.clear();
+		mChoiceRoomButtonPtr->setText("");
+		return;
+	}
+	choiceRoom = roomFrameTree[choiceRoomInt]["frame_room"];
+	mChoiceRoomButtonPtr->setText(choiceRoom["full_name"].asString());
+
+	if (choiceDeviceInt == 0) {
+		addDevice["frame_id"] = choiceRoom["id"];
+		LOGD("门口机注册空间id ===> %d", choiceRoom["id"].asInt());
+	}
+	else {
+		bedFrameTree = roomFrameTree[choiceRoomInt]["frame_bed_list"];
+
+		setBedFrameTree(0);
+	}
+}
+
+void setBedFrameTree(int index) {
+	choiceBedInt = index;
+	if (bedFrameTree.size() == 0) {
+		choiceBed.clear();
+		mChoiceBedButtonPtr->setText("");
+		return;
+	}
+	choiceBed = bedFrameTree[choiceBedInt]["frame_bed"];
+
+	addDevice["frame_id"] = choiceBed["id"];
+	LOGD("手柄注册空间id ===> %d", choiceBed["id"].asInt());
+
+	mChoiceBedButtonPtr->setText(choiceBed["full_name"].asString());
+}
+
+
+
+void _addDevice() {
+	string url = getHttpGateway() + "/arrange/linux_add_device";
+	string content_type = std::string("application/json");
+	Json::FastWriter writer;
+	string data = writer.write(addDevice);
+	LOGD("data =============> %s", data.c_str());
+
+	LOGD("注册医院设备. url = %s", url.c_str());
+	RestClient::Response r = RestClient::post(url, content_type, data);
+	if (r.code != 200) {
+		LOGD("注册医院设备-> 错误代码: %d", r.code);
+
+		string errorMsg = LANGUAGEMANAGER->getValue("AddDeviceErrorMsg") + to_string(r.code);
+
+		LOGD("r.body ===> %s",  r.body.c_str());
+		string error =  "DEVICE_MAC_REPEAT";
+		size_t pos = r.body.find(error);
+		if (pos != std::string::npos) {
+			errorMsg = LANGUAGEMANAGER->getValue("DEVICE_MAC_REPEAT");
+		}
+
+		error =  "DEVICE_FRAME_FAILED";
+		pos = r.body.find(error);
+		if (pos != std::string::npos) {
+			errorMsg = LANGUAGEMANAGER->getValue("DEVICE_FRAME_FAILED");
+		}
+
+
+	    Intent* intent = new Intent();
+		intent->putExtra(functionWindows, "warn");
+		intent->putExtra(warnText, errorMsg);
+		EASYUICONTEXT->openActivity("functionActivity", intent);
+		return;
+	}
+
+	LOGD("注册医院设备. result = %s", r.body.c_str());
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+
+	if(reader.parse(r.body, root, false)) {
+		Intent* intent = new Intent();
+		intent->putExtra(functionWindows, "success");
+		intent->putExtra(functionText, LANGUAGEMANAGER->getValue("AddDeviceSuccess"));
+		EASYUICONTEXT->openActivity("functionActivity", intent);
+	}
+}
+
+/**
+ * 注册定时器
+ * 填充数组用于注册定时器
+ * 注意: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");
+	getHospital();
+
+    mDeviceRadioGroupPtr->setCheckedID(ID_DEVICEADD_DeviceRadioButton1);
+    choiceDeviceInt = 0;
+    choiceHospitalInt = 0;
+    choiceHospitalInt = 0;
+    choicePartInt = 0;
+    choiceRoomInt = 0;
+    choiceBedInt = 0;
+}
+
+/**
+ * 当切换到该界面时触发
+ */
+static void onUI_intent(const Intent *intentPtr) {
+    if (intentPtr != NULL) {
+        //TODO
+    }
+}
+
+/*
+ * 当界面显示时触发
+ */
+static void onUI_show() {
+    EASYUICONTEXT->hideStatusBar();
+    EASYUICONTEXT->hideNaviBar();
+}
+
+/*
+ * 当界面隐藏时触发
+ */
+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 ondeviceAddActivityTouchEvent(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_sys_back(ZKButton *pButton) {
+    LOGD(" ButtonClick sys_back !!!\n");
+    return false;
+}
+
+static void onCheckedChanged_DeviceRadioGroup(ZKRadioGroup* pRadioGroup, int checkedID) {
+    LOGD(" RadioGroup DeviceRadioGroup checked %d", checkedID);
+    switch(checkedID) {
+    case ID_DEVICEADD_DeviceRadioButton1:
+    	choiceDeviceInt = 0;
+    	mDeviceMacTextViewPtr->setText(LANGUAGEMANAGER->getValue("DeviceAddMsg") + mac);
+
+    	mBedTextViewPtr->setVisible(false);
+    	mChoiceBedButtonPtr->setVisible(false);
+
+    	addDevice["device_type"] = 3;
+    	addDevice["name"] = LANGUAGEMANAGER->getValue("RoomDevice");
+    	addDevice["eth_mac"] = mac;
+    	addDevice["code"] = "SW10600101C-CM";
+    	addDevice["model"] = "linux_door";
+    	addDevice["soft_ver"] = "SV1.0";
+    	addDevice["hard_ver"] = "HV1.0";
+    	addDevice["status"] = 1;
+
+    	initHospital();
+    	break;
+    case ID_DEVICEADD_DeviceRadioButton2:
+    	choiceDeviceInt = 1;
+    	mDeviceMacTextViewPtr->setText(LANGUAGEMANAGER->getValue("DeviceAddMsg2") + mac + ":h1");
+
+    	mBedTextViewPtr->setVisible(true);
+    	mChoiceBedButtonPtr->setVisible(true);
+
+    	addDevice["device_type"] = 4;
+    	addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
+    	addDevice["eth_mac"] = mac + ":h1";
+    	addDevice["code"] = "SW10600101C-CM";
+    	addDevice["model"] = "linux_handle";
+    	addDevice["soft_ver"] = "SV1.0";
+    	addDevice["hard_ver"] = "HV1.0";
+    	addDevice["status"] = 1;
+
+    	initHospital();
+    	break;
+    case ID_DEVICEADD_DeviceRadioButton3:
+    	choiceDeviceInt = 2;
+    	mDeviceMacTextViewPtr->setText(LANGUAGEMANAGER->getValue("DeviceAddMsg3") + mac + ":h2");
+
+    	mBedTextViewPtr->setVisible(true);
+    	mChoiceBedButtonPtr->setVisible(true);
+
+    	addDevice["device_type"] = 4;
+    	addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
+    	addDevice["eth_mac"] = mac + ":h2";
+    	addDevice["code"] = "SW10600101C-CM";
+    	addDevice["model"] = "linux_handle";
+    	addDevice["soft_ver"] = "SV1.0";
+    	addDevice["hard_ver"] = "HV1.0";
+    	addDevice["status"] = 1;
+
+    	initHospital();
+    	break;
+    }
+}
+
+static int getListItemCount_HospitalListView(const ZKListView *pListView) {
+    //LOGD("getListItemCount_HospitalListView !\n");
+    return hospitalList.size();
+}
+
+static void obtainListItemData_HospitalListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
+    //LOGD(" obtainListItemData_ HospitalListView  !!!\n");
+	if (hospitalList.size() == 0) {
+		return;
+	}
+	pListItem->setText(hospitalList[index]["full_name"].asString());
+
+	if (choiceHospitalInt == index) {
+		pListItem->setSelected(true);
+	}
+	else {
+		pListItem->setSelected(false);
+	}
+}
+
+static void onListItemClick_HospitalListView(ZKListView *pListView, int index, int id) {
+    //LOGD(" onListItemClick_ HospitalListView  !!!\n");
+	if (choiceHospitalInt != index) {
+		choiceHospitalInt = index;
+		getHospitalFrameTree(hospitalList[choiceHospitalInt]["shop_id"].asString());
+	}
+}
+
+static bool onButtonClick_ChoicePartButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ChoicePartButton !!!\n");
+
+    Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "getPartFrame");
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+    return false;
+}
+
+static bool onButtonClick_ChoiceRoomButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ChoiceRoomButton !!!\n");
+
+    Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "getRoomFrame");
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+    return false;
+}
+
+static bool onButtonClick_ChoiceBedButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ChoiceBedButton !!!\n");
+
+    Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "getBedFrame");
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+    return false;
+}
+
+static bool onButtonClick_ConfirmButton(ZKButton *pButton) {
+    LOGD(" ButtonClick ConfirmButton !!!\n");
+    if (addDevice.isMember("frame_id")) {
+    	_addDevice();
+    }
+    else {
+	    Intent* intent = new Intent();
+		intent->putExtra(functionWindows, "warn");
+		intent->putExtra(warnText, LANGUAGEMANAGER->getValue("AddDeviceFrameFailed"));
+		EASYUICONTEXT->openActivity("functionActivity", intent);
+    }
+    return false;
+}
+
+static bool onButtonClick_RebootButton(ZKButton *pButton) {
+    LOGD(" ButtonClick RebootButton !!!\n");
+
+    Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "reboot");
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+    return false;
+}

+ 399 - 32
jni/logic/functionLogic.cc

@@ -3,6 +3,7 @@
 #include "service/BusinessConfig.h"
 #include "voip/media_player.h"
 #include "manager/ConfigManager.h"
+#include "manager/LanguageManager.h"
 
 #include <sys/reboot.h>
 /*
@@ -37,6 +38,9 @@
 
 Json::Value bedList;
 Json::Value chooseBed;
+Json::Value _partFrameTree;
+Json::Value _roomFrameTree;
+Json::Value _bedFrameTree;
 int chooseId = 0;
 static string _functionWindows;
 static string _functionText;
@@ -45,6 +49,7 @@ static string _warnText;
 static string _goActivity;
 static int functionThemeInt = defaultThemeInt;
 static uint32_t functionColor = buleDeepColour;
+static string _functionTransmitDeviceId;
 
 static base::MediaPlayer mediaPlayer;
 
@@ -130,7 +135,11 @@ static void callBed() {
 	else {
 		bedList.clear();
 	}
+
+	mCallBedTextViewPtr->setText(LANGUAGEMANAGER->getValue("CallableBeds"));
 	mCallBedListViewPtr->refreshListView();
+	mConfirmCallButtonPtr->setText(LANGUAGEMANAGER->getValue("ConfirmCall"));
+	mCancelCallButtonPtr->setText(LANGUAGEMANAGER->getValue("CancelCall"));
 	mCallBedWindowPtr->showWnd();
 }
 
@@ -163,12 +172,87 @@ static void helpResopnse() {
 	mActivityPtr->registerUserTimer(FUNCTION_TIMER_HANDLE, 30 * 1000);	// 30秒
 }
 
+
+
+void eventCall(string functionText) {
+	mIconPainterPtr->setBackgroundPic("icon/chenggong.png");
+	mFunctionTextViewPtr->setText(functionText + LANGUAGEMANAGER->getValue("EventCalled"));
+	mStateTextViewPtr->setVisible(false);
+	mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
+	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mFunctionWindowPtr->showWnd();
+
+	mActivityPtr->registerUserTimer(FUNCTION_TIMER_HANDLE, 30 * 1000);	// 30秒
+}
+
+
+void eventResponse(string functionText) {
+	mIconPainterPtr->setBackgroundPic("icon/xiangy.png");
+	mFunctionTextViewPtr->setText(functionText);
+	mStateTextViewPtr->setVisible(false);
+	mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
+	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mFunctionWindowPtr->showWnd();
+
+	mActivityPtr->registerUserTimer(FUNCTION_TIMER_HANDLE, 30 * 1000);	// 30秒
+}
+
+Json::Reader reader(Json::Features::strictMode());
+Json::Value interaction;
+void eventHandle(string functionText) {
+	if (reader.parse(functionText.c_str(), interaction, false)){
+		string eventStr = interaction["data"].asString();
+		mEventHandleTextViewPtr->setText(LANGUAGEMANAGER->getValue("EventCompleteOrCancel") + eventStr);
+		mEventHandleWindowPtr->showWnd();
+	}
+	else {
+		mEventHandleTextViewPtr->setText(LANGUAGEMANAGER->getValue("EventCompleteOrCancel"));
+		mEventHandleWindowPtr->showWnd();
+	}
+
+}
+
+void executeAffair(string _functionText) {
+	mHandleIconPainterPtr->setBackgroundPic("icon/chenggong.png");
+	mHandleTextViewPtr->setText(_functionText);
+	mHandleStatusTextViewPtr->setVisible(true);
+	mHandleStatusTextViewPtr->setText(LANGUAGEMANAGER->getValue("IsExecuteAffair"));
+	mHandleConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
+	mHandleConfirmButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mHandleWindowPtr->showWnd();
+}
+
+
 void toFunctionActivity(std::string data) {
 	if (_functionWindows == "help") {
 		helpResopnse();
 		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
 		        base::MediaPlayer::PlayMode::Default);
 	}
+	else if (_functionWindows == "eventCall") {
+		eventResponse(data);
+		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+		        base::MediaPlayer::PlayMode::Default);
+	}
+}
+
+void success(string _functionText) {
+    if (functionThemeInt == 1) {
+        mIconPainterPtr->setBackgroundPic("icon/zengyuan2.png");
+        mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
+    }
+    else if (functionThemeInt == 2) {
+        mIconPainterPtr->setBackgroundPic("icon/zengyuan2-pink.png");
+        mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
+    }
+    mFunctionTextViewPtr->setText(_functionText);
+	mStateTextViewPtr->setVisible(false);
+	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mFunctionWindowPtr->showWnd();
+
+	mActivityPtr->registerUserTimer(FUNCTION_TIMER_HANDLE, 30 * 1000);	// 30秒
+
+
 }
 
 void warn(string warnText) {
@@ -209,17 +293,40 @@ void nursing(string functionText, string nursingText) {
 	mFunctionWindowPtr->showWnd();
 }
 
+void nursing2() {
+	mIconPainterPtr->setBackgroundPic("icon/huli2.png");
+	mFunctionTextViewPtr->setText(LANGUAGEMANAGER->getValue("SetNursingMsg2"));
+	mStateTextViewPtr->setVisible(false);
+    mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
+	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Nursing"));
+	mFunctionWindowPtr->showWnd();
+
+	mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+	        base::MediaPlayer::PlayMode::Default);
+
+	mActivityPtr->registerUserTimer(FUNCTION_TIMER_HANDLE, 30 * 1000);	// 30秒
+}
+
 
 void nursingEnd(string functionText) {
 	mIconPainterPtr->setBackgroundPic("icon/huli2.png");
 	mFunctionTextViewPtr->setText(functionText);
 	mStateTextViewPtr->setVisible(true);
 	mStateTextViewPtr->setText(LANGUAGEMANAGER->getValue("SetNursingEndMsg"));
-	mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink.png");
+	mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
 	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("NursingEnd"));
 	mFunctionWindowPtr->showWnd();
 }
 
+void nursingEnd2() {
+	mHandleIconPainterPtr->setBackgroundPic("icon/huli2.png");
+	mHandleTextViewPtr->setText(LANGUAGEMANAGER->getValue("SetNursingEndMsg2"));
+	mHandleStatusTextViewPtr->setVisible(false);
+	mHandleConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
+	mHandleConfirmButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mHandleWindowPtr->showWnd();
+}
+
 
 
 void pwdWindowInfo() {
@@ -280,6 +387,71 @@ void mode(string functionText) {
     mFunctionWindowPtr->showWnd();
 }
 
+void blueCode() {
+	mIconPainterPtr->setBackgroundPic("icon/chenggong.png");
+	mFunctionTextViewPtr->setText(LANGUAGEMANAGER->getValue("BlueCodeMsg"));
+	mStateTextViewPtr->setVisible(false);
+	mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
+	mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mFunctionWindowPtr->showWnd();
+
+	mActivityPtr->registerUserTimer(FUNCTION_TIMER_HANDLE, 30 * 1000);	// 30秒
+
+}
+
+void getPartFrameTree() {
+	_partFrameTree = getFrameTree(_functionWindows);
+
+	if (_partFrameTree.size() == 0) {
+		mWarnTextViewPtr->setText(LANGUAGEMANAGER->getValue("PartFrameTreeMsg"));
+		mWarnWindowPtr->showWnd();
+		return;
+	}
+
+	chooseId = 0;
+
+	mCallBedTextViewPtr->setText(LANGUAGEMANAGER->getValue("ChoicePartMsg"));
+	mConfirmCallButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mCancelCallButtonPtr->setText(LANGUAGEMANAGER->getValue("Cancel"));
+	mCallBedListViewPtr->refreshListView();
+	mCallBedWindowPtr->showWnd();
+}
+
+void getRoomFrameTree() {
+	_roomFrameTree = getFrameTree(_functionWindows);
+
+	if (_roomFrameTree.size() == 0) {
+		mWarnTextViewPtr->setText(LANGUAGEMANAGER->getValue("RoomFrameTreeMsg"));
+		mWarnWindowPtr->showWnd();
+		return;
+	}
+
+	chooseId = 0;
+
+	mCallBedTextViewPtr->setText(LANGUAGEMANAGER->getValue("ChoiceRoomMsg"));
+	mConfirmCallButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mCancelCallButtonPtr->setText(LANGUAGEMANAGER->getValue("Cancel"));
+	mCallBedListViewPtr->refreshListView();
+	mCallBedWindowPtr->showWnd();
+}
+
+void getBedFrameTree() {
+	_bedFrameTree = getFrameTree(_functionWindows);
+
+	if (_bedFrameTree.size() == 0) {
+		mWarnTextViewPtr->setText(LANGUAGEMANAGER->getValue("BedFrameTreeMsg"));
+		mWarnWindowPtr->showWnd();
+		return;
+	}
+
+	chooseId = 0;
+
+	mCallBedTextViewPtr->setText(LANGUAGEMANAGER->getValue("ChoiceBedMsg"));
+	mConfirmCallButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mCancelCallButtonPtr->setText(LANGUAGEMANAGER->getValue("Cancel"));
+	mCallBedListViewPtr->refreshListView();
+	mCallBedWindowPtr->showWnd();
+}
 
 
 
@@ -298,7 +470,7 @@ static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  */
 static void onUI_init(){
     //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
-	mFunctionPainterPtr->setAlpha(102);
+	mFunctionPainterPtr->setAlpha(200);
 }
 
 /**
@@ -314,15 +486,18 @@ static void onUI_intent(const Intent *intentPtr) {
 		if (_functionWindows == "callBed") {
 			callBed();
 		}
-		else if (_functionWindows == "help") {
+		else if (_functionWindows == "help" ||
+				_functionWindows == "helpResonse") {
 			help();
 			mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
 			        base::MediaPlayer::PlayMode::Default);
 		}
-		else if (_functionWindows == "helpResonse") {
-			helpResopnse();
+		else if (_functionWindows == "success") {
+			_functionText = intentPtr->getExtra(functionText);
+			success(_functionText);
 			mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
 			        base::MediaPlayer::PlayMode::Default);
+
 		}
 		else if (_functionWindows == "warn") {
 			_warnText = intentPtr->getExtra(warnText);
@@ -356,9 +531,15 @@ static void onUI_intent(const Intent *intentPtr) {
 		else if (_functionWindows == "serverChange" ||
 				_functionWindows == "setting" ||
 				_functionWindows == "init" ||
-				_functionWindows == "reboot") {
+				_functionWindows == "reboot" ||
+				_functionWindows == "nursing2" ||
+				_functionWindows == "deviceAdd"
+				) {
 			pwdWindowInfo();
 		}
+		else if (_functionWindows == "nursingEnd2") {
+			nursingEnd2();
+		}
 		else if (_functionWindows == "theme") {
 			_functionText = intentPtr->getExtra(functionText);
 			theme(_functionText);
@@ -367,6 +548,43 @@ static void onUI_intent(const Intent *intentPtr) {
             _functionText = intentPtr->getExtra(functionText);
             mode(_functionText);
         }
+
+		else if (_functionWindows == "eventCall") {
+			_functionText = intentPtr->getExtra(functionText);
+			eventCall(_functionText);
+			mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+			        base::MediaPlayer::PlayMode::Default);
+		}
+		else if (_functionWindows == "eventResponse") {
+			_functionText = intentPtr->getExtra(functionText);
+			eventResponse(_functionText);
+			mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+			        base::MediaPlayer::PlayMode::Default);
+		}
+		else if (_functionWindows == "eventHandle") {
+			_functionText = intentPtr->getExtra(functionText);
+			_functionTransmitDeviceId = intentPtr->getExtra(transmitDeviceId);
+			eventHandle(_functionText);
+		}
+		else if (_functionWindows == "customerAffair") {
+			_functionText = intentPtr->getExtra(functionText);
+			executeAffair(_functionText);
+		}
+		else if (_functionWindows == "blueCode") {
+			blueCode();
+			mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+			        base::MediaPlayer::PlayMode::Default);
+		}
+		else if (_functionWindows == "getPartFrame") {
+			getPartFrameTree();
+		}
+		else if (_functionWindows == "getRoomFrame") {
+			getRoomFrameTree();
+
+		}
+		else if (_functionWindows == "getBedFrame") {
+			getBedFrameTree();
+		}
     }
 }
 
@@ -459,7 +677,19 @@ static bool onButtonClick_sys_back(ZKButton *pButton) {
 }
 static int getListItemCount_CallBedListView(const ZKListView *pListView) {
     //LOGD("getListItemCount_CallBedListView !\n");
-    return bedList.size();
+	if (_functionWindows == "callBed") {
+		 return bedList.size();
+	}
+	else if (_functionWindows == "getPartFrame") {
+		return _partFrameTree.size();
+	}
+	else if (_functionWindows == "getRoomFrame") {
+		return _roomFrameTree.size();
+	}
+	else if (_functionWindows == "getBedFrame") {
+		return _bedFrameTree.size();
+	}
+    return 0;
 }
 
 static void obtainListItemData_CallBedListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
@@ -472,19 +702,32 @@ static void obtainListItemData_CallBedListView(ZKListView *pListView,ZKListView:
 	}
 	pListItem->setTextStatusColor(ZK_CONTROL_STATUS_SELECTED, functionColor);
 
-	if (bedList.size() > 0) {
-		string frameBedName = bedList[index]["frame_bed"]["full_name"].asString();
-		int nPos = frameBedName.find("-");
-		if (nPos != -1) {
-			frameBedName = frameBedName.substr(nPos + 1, frameBedName.length());
+	if (_functionWindows == "callBed") {
+		if (bedList.size() > 0) {
+			string frameBedName = bedList[index]["frame_bed"]["full_name"].asString();
+			int nPos = frameBedName.find("-");
+			if (nPos != -1) {
+				frameBedName = frameBedName.substr(nPos + 1, frameBedName.length());
+			}
+			string customerName = bedList[index]["customer_name"].asString();
+			pListItem->setText(frameBedName + " (" + customerName + ")");
 		}
-		string customerName = bedList[index]["customer_name"].asString();
-		pListItem->setText(frameBedName + " (" + customerName + ")");
+	}
+	else if (_functionWindows == "getPartFrame") {
+		pListItem->setText(_partFrameTree[index]["frame_part"]["full_name"].asString());
+	}
+	else if (_functionWindows == "getRoomFrame") {
+		pListItem->setText(_roomFrameTree[index]["frame_room"]["full_name"].asString());
+	}
+	else if (_functionWindows == "getBedFrame") {
+		pListItem->setText(_bedFrameTree[index]["frame_bed"]["full_name"].asString());
 	}
 
 	if (index == chooseId) {
 		pListItem->setSelected(true);
-		chooseBed = bedList[index];
+		if (_functionWindows == "callBed") {
+			chooseBed = bedList[index];
+		}
 	}
 	else {
 		pListItem->setSelected(false);
@@ -499,24 +742,37 @@ static void onListItemClick_CallBedListView(ZKListView *pListView, int index, in
 static bool onButtonClick_ConfirmCallButton(ZKButton *pButton) {
     LOGD(" ButtonClick ConfirmCallButton !!!\n");
 
+    if (_functionWindows == "callBed") {
+		string toId = chooseBed["bed_device_id"].asString();
+		if (toId == "") {
+			mCallBedWindowPtr->hideWnd();
 
-    string toId = chooseBed["bed_device_id"].asString();
-    if (toId == "") {
-
-        mCallBedWindowPtr->hideWnd();
-
-    	mWarnTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoBedDevice"));
-    	mWarnWindowPtr->showWnd();
+			mWarnTextViewPtr->setText(LANGUAGEMANAGER->getValue("NoBedDevice"));
+			mWarnWindowPtr->showWnd();
+		}
+		else {
+			Intent* intent = new Intent();
+			intent->putExtra(isOutgoing, "true");
+			intent->putExtra(audioOnly, "true");
+			intent->putExtra(toIdStr, toId);
+			intent->putExtra(callName, chooseBed["frame_bed"]["full_name"].asString()  + " " +  chooseBed["customer_name"].asString());
+			EASYUICONTEXT->openActivity("callActivity", intent);
+			EASYUICONTEXT->closeActivity("functionActivity");
+		}
     }
-    else {
-		Intent* intent = new Intent();
-		intent->putExtra(isOutgoing, "true");
-		intent->putExtra(audioOnly, "true");
-		intent->putExtra(toIdStr, toId);
-		intent->putExtra(callName, chooseBed["frame_bed"]["full_name"].asString()  + " " +  chooseBed["customer_name"].asString());
-		EASYUICONTEXT->openActivity("callActivity", intent);
-		EASYUICONTEXT->closeActivity("functionActivity");
+    else if (_functionWindows == "getPartFrame") {
+    	setPartFrameTree(chooseId);
+    	EASYUICONTEXT->closeActivity("functionActivity");
+    }
+    else if (_functionWindows == "getRoomFrame") {
+    	setRoomFrameTree(chooseId);
+    	EASYUICONTEXT->closeActivity("functionActivity");
     }
+    else if (_functionWindows == "getBedFrame") {
+    	setBedFrameTree(chooseId);
+    	EASYUICONTEXT->closeActivity("functionActivity");
+    }
+
     return false;
 }
 
@@ -542,8 +798,14 @@ static bool onButtonClick_FunctionButton(ZKButton *pButton) {
     LOGD(" ButtonClick FunctionButton !!!\n");
     if (_functionWindows == "help" ||
     		_functionWindows == "helpResonse" ||
+    		_functionWindows == "success" ||
+			_functionWindows == "eventCall" ||
+			_functionWindows == "eventResponse" ||
 			_functionWindows == "position" ||
-			_functionWindows == "roomPatrol"
+			_functionWindows == "roomPatrol" ||
+			_functionWindows == "nursing2" ||
+			_functionWindows == "blueCode"
+
 			) {
     	mActivityPtr->unregisterUserTimer(FUNCTION_TIMER_HANDLE);
     	EASYUICONTEXT->closeActivity("functionActivity");
@@ -681,6 +943,33 @@ static bool onButtonClick_PwdConfirmButton(ZKButton *pButton) {
 			mPwdPromptTextViewPtr->setTextColor(0xFFFF0000);
 		}
 	}
+	else if (_functionWindows == "nursing2") {
+		// 密码为888
+		string cpwd = "888";
+		if (pwd == cpwd){
+			// 关闭密码输入界面
+			mPwdWindowPtr->hideWnd();
+			nursing2();
+			setNursing2(true);
+		} else {
+			mPwdPromptTextViewPtr->setTextTr("PasswordWrong");
+			mPwdPromptTextViewPtr->setTextColor(0xFFFF0000);
+		}
+	}
+	else if (_functionWindows == "deviceAdd") {
+		// 密码为888
+		string cpwd = "888";
+		if (pwd == cpwd){
+			// 关闭密码输入界面
+			mPwdWindowPtr->hideWnd();
+			EASYUICONTEXT->closeActivity("functionActivity");
+			EASYUICONTEXT->openActivity("deviceAddActivity");
+		} else {
+			mPwdPromptTextViewPtr->setTextTr("PasswordWrong");
+			mPwdPromptTextViewPtr->setTextColor(0xFFFF0000);
+		}
+
+	}
     return false;
 }
 
@@ -756,7 +1045,6 @@ static bool onButtonClick_RebootLineButton(ZKButton *pButton) {
 	tcpModel.type = TcpType::DEVICE;
 	tcpModel.action = DeviceAction::POWER_RESET;
 	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-	tcpModel.to_id = NULL;
 
 	std::string req = getTcpModelString(tcpModel);
 	LOGD("TCP DEVICE : %s",req.c_str());
@@ -880,3 +1168,82 @@ static bool onButtonClick_NursingTimeBackButton(ZKButton *pButton) {
     nursingTime = 5;
     return false;
 }
+static bool onButtonClick_CompleteButton(ZKButton *pButton) {
+    LOGD(" ButtonClick CompleteButton !!!\n");
+
+	TcpModel tcpModel;
+	tcpModel.type = TcpType::EVENT;
+	tcpModel.action = EventAction::COMPLETED;
+	tcpModel.from_id = std::stoi(_functionTransmitDeviceId);
+	tcpModel.data = _functionText;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("TCP DEVICE : %s",req.c_str());
+
+    TcpClient::instance()->sendMsg(req.c_str());
+
+	mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+	        base::MediaPlayer::PlayMode::Default);
+
+    mEventHandleWindowPtr->hideWnd();
+	EASYUICONTEXT->closeActivity("functionActivity");
+    return false;
+}
+
+static bool onButtonClick_CancelButton(ZKButton *pButton) {
+    LOGD(" ButtonClick CancelButton !!!\n");
+
+	TcpModel tcpModel;
+	tcpModel.type = TcpType::EVENT;
+	tcpModel.action = EventAction::CANCEL;
+	tcpModel.from_id = std::stoi(_functionTransmitDeviceId);
+	tcpModel.data = _functionText;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("TCP DEVICE : %s",req.c_str());
+
+    TcpClient::instance()->sendMsg(req.c_str());
+
+
+	mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+	        base::MediaPlayer::PlayMode::Default);
+
+    mEventHandleWindowPtr->hideWnd();
+	EASYUICONTEXT->closeActivity("functionActivity");
+    return false;
+}
+
+static bool onButtonClick_HandleConfirmButton(ZKButton *pButton) {
+    LOGD(" ButtonClick HandleConfirmButton !!!\n");
+    if (_functionWindows == "customerAffair") {
+    	doCutsomerAffair(1);
+    	mHandleWindowPtr->hideWnd();
+		EASYUICONTEXT->closeActivity("functionActivity");
+    }
+    else if (_functionWindows == "nursingEnd2") {
+		setNursing2(false);
+    	mHandleWindowPtr->hideWnd();
+		EASYUICONTEXT->closeActivity("functionActivity");
+
+		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+		        base::MediaPlayer::PlayMode::Default);
+    }
+    return false;
+}
+
+static bool onButtonClick_HandleBackButton(ZKButton *pButton) {
+    LOGD(" ButtonClick HandleBackButton !!!\n");
+    if (_functionWindows == "customerAffair") {
+    	mHandleWindowPtr->hideWnd();
+		EASYUICONTEXT->closeActivity("functionActivity");
+
+    }
+    else if (_functionWindows == "nursingEnd2") {
+    	mHandleWindowPtr->hideWnd();
+		EASYUICONTEXT->closeActivity("functionActivity");
+    }
+    return false;
+}
+

+ 404 - 0
jni/logic/interactionLogic.cc

@@ -0,0 +1,404 @@
+#pragma once
+#include "uart/ProtocolSender.h"
+#include "restclient-cpp/restclient.h"
+#include "service/BusinessConfig.h"
+#include "base/http_client.h"
+#include "base/strings.hpp"
+#include <manager/LanguageManager.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 + /”  快捷键可以打开智能提示
+*/
+
+Json::Value eventList;		// 按键事件的缓存
+Json::Value interactionList; // 交互记录
+
+std::string _interactionTransmitCustomerId = "";
+std::string _interactionTransmitDeviceId = "";
+
+#define EVENT_TIME_HANDLE 8		// 事件定时器
+
+
+void getEvent() {
+	std::string url = getHttpGateway() + "/deviceBed/get_event_list_by_part_id/" + StoragePreferences::getString(STORE_PARTID, "");
+
+	LOGD("请求事件列表. url = %s", url.c_str());
+	//发起HTTP POST请求
+	RestClient::Response r = RestClient::get(url);
+	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)) {
+		eventList = root;
+		int size = eventList.size();
+		LOGD("eventList.size() = %d", size);
+			// 按键事件
+			for (int i = 0; i < size; i++) {
+				eventList[i]["invalid"] = false;
+			}
+//		}
+		mEventListViewPtr->refreshListView();
+	}
+}
+
+
+void getInteraction() {
+	std::string url = getHttpGateway() + "/deviceBed/getInteractionVOByCustomerId?page_no=" + to_string(1) + "&page_size=" + to_string(30) + "&customer_id=" + _interactionTransmitCustomerId;
+	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("获得交互记录列表. result = %s", r.body.c_str());
+	//解析json
+	Json::Reader reader;
+	Json::Value root;
+
+	if(reader.parse(r.body, root, false)) {
+		interactionList = root["data"];
+		mInteractionListViewPtr->refreshListView();
+	}
+}
+
+
+/**
+ * 注册定时器
+ * 填充数组用于注册定时器
+ * 注意: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");
+	mInteractionBackButtonPtr->setAlpha(200);
+
+	getEvent();
+}
+
+/**
+ * 当切换到该界面时触发
+ */
+static void onUI_intent(const Intent *intentPtr) {
+    if (intentPtr != NULL) {
+        //TODO
+    	// 键值解析
+    	_interactionTransmitCustomerId = intentPtr->getExtra(transmitCustomerId);
+    	_interactionTransmitDeviceId = intentPtr->getExtra(transmitDeviceId);
+
+    	interactionList = Json::nullValue;
+
+    	getInteraction();
+
+    }
+}
+
+/*
+ * 当界面显示时触发
+ */
+static void onUI_show() {
+    EASYUICONTEXT->hideStatusBar();
+    EASYUICONTEXT->hideNaviBar();
+
+}
+
+/*
+ * 当界面隐藏时触发
+ */
+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) {
+		case EVENT_TIME_HANDLE:
+			for (int i = 0; i < eventList.size(); i++) {
+				eventList[i]["invalid"] = false;
+			}
+			mEventListViewPtr->refreshListView();
+			return false;
+			break;
+
+		default:
+			break;
+	}
+    return true;
+}
+
+/**
+ * 有新的触摸事件时触发
+ * 参数:ev
+ *         新的触摸事件
+ * 返回值:true
+ *            表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
+ *         false
+ *            触摸事件将继续传递到控件上
+ */
+static bool oninteractionActivityTouchEvent(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_InteractionBackButton(ZKButton *pButton) {
+    LOGD(" ButtonClick InteractionBackButton !!!\n");
+	EASYUICONTEXT->closeActivity("interactionActivity");
+    return false;
+}
+
+static bool onButtonClick_RecoverButton(ZKButton *pButton) {
+    LOGD(" ButtonClick RecoverButton !!!\n");
+	EASYUICONTEXT->closeActivity("interactionActivity");
+    return false;
+}
+
+static int getListItemCount_EventListView(const ZKListView *pListView) {
+    //LOGD("getListItemCount_EventListView !\n");
+    return eventList.size();
+}
+
+static void obtainListItemData_EventListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
+    //LOGD(" obtainListItemData_ EventListView  !!!\n");
+	pListItem->setText(eventList[index]["name"].asString());
+	pListItem->setInvalid(eventList[index]["invalid"].asBool());
+}
+
+static void onListItemClick_EventListView(ZKListView *pListView, int index, int id) {
+    //LOGD(" onListItemClick_ EventListView  !!!\n");
+	LOGD("选中的按键事件, name = %s", eventList[index]["name"].asString().c_str());
+	int size = eventList.size();
+	for (int i = 0; i < size; i++) {
+		eventList[i]["invalid"] = true;
+	}
+	pListView->refreshListView();
+	mActivityPtr->registerUserTimer(EVENT_TIME_HANDLE, 3000);
+
+
+	// 发送tcp, tcp_type = EVENT, tcp_action = CALL, data = {"id" : eventList[index]["id"]}
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::EVENT;
+	tcpModel.action = EventAction::KEY_CLICK;
+	tcpModel.from_id = std::stoi(_interactionTransmitDeviceId);
+	Json::Value json;
+	json["id"] = eventList[index]["id"];
+	tcpModel.json = json;
+	sendTcpModel(tcpModel);
+
+	Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "eventCall");
+	intent->putExtra(functionText, eventList[index]["name"].asString());
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+	EASYUICONTEXT->closeActivity("interactionActivity");
+}
+
+static void onCheckedChanged_InteractionTypeRadioGroup(ZKRadioGroup* pRadioGroup, int checkedID) {
+    LOGD(" RadioGroup InteractionTypeRadioGroup checked %d", checkedID);
+}
+
+static int getListItemCount_InteractionListView(const ZKListView *pListView) {
+    //LOGD("getListItemCount_InteractionListView !\n");
+    return interactionList.size();
+}
+
+static void obtainListItemData_InteractionListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
+    //LOGD(" obtainListItemData_ InteractionListView  !!!\n");
+	ZKListView::ZKListSubItem* interactionTime = pListItem->findSubItemByID(ID_INTERACTION_TimeSubItem);
+	ZKListView::ZKListSubItem* interactionStatus = pListItem->findSubItemByID(ID_INTERACTION_StatusSubItem);
+
+	string time = interactionList[index]["create_date"].asString();
+	std::string pDate = TimeHelper::getTimeStrOnTimeDifference(time, 8, "%d-%02d-%02d %02d:%02d:%02d");
+	interactionTime->setText(pDate);
+
+	string actionType = interactionList[index]["action_type"].asString();
+
+	if (actionType == "SOS") {
+		pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/sos.png");
+		pListItem->setText(LANGUAGEMANAGER->getValue("SOSCall"));
+	}
+	else if (actionType == "EVENT") {
+		pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/shijian.png");
+		pListItem->setText(interactionList[index]["data"].asString());
+	}
+	else if (actionType == "REINFORCE") {
+		pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/zengyuan2.png");
+		pListItem->setText(LANGUAGEMANAGER->getValue("ReinforceCall"));
+	}
+	else if (actionType == "VOICE")  {
+		if (interactionList[index]["from_device_id"].asInt() == StoragePreferences::getInt(STORE_DEVICE_ID, 0)) {
+			pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/huru.png");
+			pListItem->setText(LANGUAGEMANAGER->getValue("CallIn") + interactionList[index]["from_device_name"].asString());
+		}
+		else {
+			pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/huchu.png");
+			pListItem->setText(LANGUAGEMANAGER->getValue("CallOut") + interactionList[index]["to_device_name"].asString());
+		}
+	}
+	else if (actionType == "SIDE") {
+		pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/huli3.png");
+		pListItem->setText(LANGUAGEMANAGER->getValue("InNursing"));
+	}
+	else {
+		pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "interaction/zengyuan2.png");
+		pListItem->setText(LANGUAGEMANAGER->getValue("Other"));
+	}
+
+
+	if (actionType == "EVENT") {
+		string actionStatus = interactionList[index]["action_status"].asString();
+		if (actionStatus == "已发送") {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("Sented"));
+			interactionStatus->setTextColor((int) defaultRed);
+		}
+		else if (actionStatus == "已响应") {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("Responded"));
+			interactionStatus->setTextColor((int) defaultGreen);
+		}
+		else if (actionStatus == "已取消") {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("Canceled"));
+			interactionStatus->setTextColor((int) defaultBlue);
+
+		}
+		else if (actionStatus == "已完成") {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("Completed"));
+			interactionStatus->setTextColor((int) defaultGreen);
+
+		}
+		else {
+			if (interactionList[index]["action_end"].asString() != "") {
+				interactionStatus->setText(LANGUAGEMANAGER->getValue("Responded"));
+				interactionStatus->setTextColor((int) defaultGreen);
+			}
+			else {
+				interactionStatus->setText(LANGUAGEMANAGER->getValue("Sented"));
+				interactionStatus->setTextColor((int) defaultRed);
+			}
+		}
+	}
+	else if (actionType == "VOICE") {
+		if (interactionList[index]["action_end"].asString() != "") {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("Answered"));
+			interactionStatus->setTextColor((int) defaultGreen);
+		}
+		else {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("UnAnswered"));
+			interactionStatus->setTextColor((int) defaultRed);
+		}
+	}
+	else {
+		if (interactionList[index]["action_end"].asString() != "") {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("Responded"));
+			interactionStatus->setTextColor((int) defaultGreen);
+		}
+		else {
+			interactionStatus->setText(LANGUAGEMANAGER->getValue("NotRespond"));
+			interactionStatus->setTextColor((int) defaultRed);
+		}
+	}
+}
+
+
+
+static void onListItemClick_InteractionListView(ZKListView *pListView, int index, int id) {
+    //LOGD(" onListItemClick_ InteractionListView  !!!\n");
+	string actionType = interactionList[index]["action_type"].asString();
+	if (actionType == "EVENT") {
+		string actionStatus = interactionList[index]["action_status"].asString();
+
+		Json::Value interaction = interactionList[index];
+		Json::FastWriter writer;
+		string interactionStr = writer.write(interaction);
+
+		if (actionStatus == "已发送") {
+			Intent* intent = new Intent();
+			intent->putExtra(functionWindows, "eventHandle");
+			intent->putExtra(functionText, interactionStr);
+			intent->putExtra(transmitDeviceId, _interactionTransmitDeviceId);
+			EASYUICONTEXT->openActivity("functionActivity", intent);
+			EASYUICONTEXT->closeActivity("interactionActivity");
+		}
+		else if (actionStatus == "已响应") {
+			Intent* intent = new Intent();
+			intent->putExtra(functionWindows, "eventHandle");
+			intent->putExtra(functionText, interactionStr);
+			intent->putExtra(transmitDeviceId, _interactionTransmitDeviceId);
+			EASYUICONTEXT->openActivity("functionActivity", intent);
+			EASYUICONTEXT->closeActivity("interactionActivity");
+		}
+
+	}
+}

+ 34 - 0
jni/logic/mainLogic.cc

@@ -686,6 +686,11 @@ static void obtainListItemData_BedListView(ZKListView *pListView,ZKListView::ZKL
 			sex->setTextColor(0x3A78EF);
 			sex->setBackgroundPic("9/lightBlue.9.png");
 		}
+		else if (customerSex == "") {
+			sex->setText(customerSex);
+			sex->setTextColor(0x37B643);
+			sex->setBackgroundPic("9/lightGreen.9.png");
+		}
 		else {
 			sex->setText(LANGUAGEMANAGER->getValue("Unknown"));
 			sex->setTextColor(0x37B643);
@@ -762,6 +767,25 @@ static void obtainListItemData_BedListView(ZKListView *pListView,ZKListView::ZKL
 
 static void onListItemClick_BedListView(ZKListView *pListView, int index, int id) {
     //LOGD(" onListItemClick_ BedListView  !!!\n");
+	if (id == ID_MAIN_EventSubItem) {
+		string _customerId = frameBedList[index]["customer_id"].asString();
+		string _deviceId = frameBedList[index]["bed_device_id"].asString();
+
+		Intent* intent = new Intent();
+		intent->putExtra(transmitDeviceId, _deviceId);
+		intent->putExtra(transmitCustomerId, _customerId);
+		EASYUICONTEXT->openActivity("interactionActivity", intent);
+
+	}
+	else if (id == ID_MAIN_AffairSubItem) {
+		string _customerId = frameBedList[index]["customer_id"].asString();
+		string _deviceId = frameBedList[index]["bed_device_id"].asString();
+
+		Intent* intent = new Intent();
+		intent->putExtra(transmitDeviceId, _deviceId);
+		intent->putExtra(transmitCustomerId, _customerId);
+		EASYUICONTEXT->openActivity("customerAffairActivity", intent);
+	}
 }
 
 static int getListItemCount_BedListView2(const ZKListView *pListView) {
@@ -837,6 +861,11 @@ static void obtainListItemData_BedListView2(ZKListView *pListView,ZKListView::ZK
 			sex->setTextColor(0x3A78EF);
 			sex->setBackgroundPic("9/lightBlue.9.png");
 		}
+		else if (customerSex == "") {
+			sex->setText(customerSex);
+			sex->setTextColor(0x37B643);
+			sex->setBackgroundPic("9/lightGreen.9.png");
+		}
 		else {
 			sex->setText(LANGUAGEMANAGER->getValue("Unknown"));
 			sex->setTextColor(0x37B643);
@@ -939,6 +968,11 @@ static void obtainListItemData_BedListView3(ZKListView *pListView,ZKListView::ZK
 			sex->setTextColor(0x3A78EF);
 			sex->setBackgroundPic("9/lightBlue.9.png");
 		}
+		else if (customerSex == "") {
+			sex->setText(customerSex);
+			sex->setTextColor(0x37B643);
+			sex->setBackgroundPic("9/lightGreen.9.png");
+		}
 		else {
 			sex->setText(LANGUAGEMANAGER->getValue("Unknown"));
 			sex->setTextColor(0x37B643);

+ 23 - 8
jni/logic/moreLogic.cc

@@ -76,7 +76,12 @@ void getDeviceMenu() {
 					root[i]["icon_src"] = deviceInfoPic;
 					deviceMenus.append(root[i]);
 				}
-				else if (root[i]["act_name"].asString() == "callBedActivity") {
+//				else if (root[i]["act_name"].asString() == "callBedActivity") {
+//					count += 1;
+//					root[i]["icon_src"] = deviceInfoPic;
+//					deviceMenus.append(root[i]);
+//				}
+				else if (root[i]["act_name"].asString() == "deviceAddActivity") {
 					count += 1;
 					root[i]["icon_src"] = deviceInfoPic;
 					deviceMenus.append(root[i]);
@@ -112,14 +117,19 @@ static void onUI_init(){
     //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
 
 	deviceMenus[0]["icon_src"] = deviceInfoPic;
-	deviceMenus[0]["name"] = "设备信息";
+	deviceMenus[0]["name"] = LANGUAGEMANAGER->getValue("DeviceInfo");
 	deviceMenus[0]["introduction"] = "查看信息和设置";
 	deviceMenus[0]["act_name"] = "deviceInfoActivity";
 
 	deviceMenus[1]["icon_src"] ="/more/keshi.png";
-	deviceMenus[1]["name"] = "呼叫床位";
-	deviceMenus[1]["introduction"] = "呼叫床位分机";
-	deviceMenus[0]["act_name"] = "callBedActivity";
+	deviceMenus[1]["name"] = LANGUAGEMANAGER->getValue("DeviceAdd");
+	deviceMenus[1]["introduction"] = "注册设备";
+	deviceMenus[1]["act_name"] = "deviceAddActivity";
+
+//	deviceMenus[1]["icon_src"] ="/more/keshi.png";
+//	deviceMenus[1]["name"] = "呼叫床位";
+//	deviceMenus[1]["introduction"] = "呼叫床位分机";
+//	deviceMenus[0]["act_name"] = "callBedActivity";
 //
 //	deviceMenus[2]["icon_src"] ="/more/yiyuan.png";
 //	deviceMenus[2]["name"] = "医院简介";
@@ -230,11 +240,11 @@ static void obtainListItemData_DeviceMenuListView(ZKListView *pListView,ZKListVi
 static void onListItemClick_DeviceMenuListView(ZKListView *pListView, int index, int id) {
     //LOGD(" onListItemClick_ DeviceMenuListView  !!!\n");
 
-	string name = deviceMenus[index]["name"].asString();
-	if (name == "设备信息") {
+	string actName = deviceMenus[index]["act_name"].asString();
+	if (actName == "deviceInfoActivity") {
 		EASYUICONTEXT->openActivity("deviceInfoActivity");
 	}
-	else if (name == "呼叫床位") {
+	else if (actName == "callBedActivity") {
 		Intent* intent = new Intent();
 		intent->putExtra(functionWindows, "callBed");
 		EASYUICONTEXT->openActivity("functionActivity", intent);
@@ -263,4 +273,9 @@ static void onListItemClick_DeviceMenuListView(ZKListView *pListView, int index,
 //		};
 //		TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
 	}
+	else if (actName == "deviceAddActivity") {
+		Intent* intent = new Intent();
+		intent->putExtra(functionWindows, "deviceAdd");
+		EASYUICONTEXT->openActivity("functionActivity", intent);
+	}
 }

+ 142 - 0
jni/logic/navibar.cc

@@ -37,6 +37,9 @@
 */
 
 static uint32_t navibarButtonColor = buleDeepColour;
+static bool isNursing2 = false;
+static int blueCodeId = 0;
+static string blueCodeTid = "";
 
 void setNavibarTheme() {
     int themeInt = StoragePreferences::getInt(STORE_THEME, defaultThemeInt);
@@ -54,6 +57,7 @@ void setNavibarTheme() {
 	}
 }
 
+
 void goHome() {
 	mHomeButtonPtr->setBackgroundPic("button/elliptic_white.png");
 	mHomeButtonPtr->setTextColor(navibarButtonColor);
@@ -93,6 +97,88 @@ void goCare() {
     EASYUICONTEXT->closeActivity("moreActivity");
 }
 
+void setNursingBg(bool setNursing) {
+	isNursing2 = setNursing;
+
+	if (mnavibarPtr == NULL) {
+		return;
+	}
+
+	if (setNursing) {
+		mBgPainterPtr->setBackgroundPic("navibar/bg-pink.png");
+		mNursingButtonPtr->setText(LANGUAGEMANAGER->getValue("NursingEnd"));
+		mBlueCodeButtonPtr->setInvalid(false);
+	}
+	else {
+		mBgPainterPtr->setBackgroundPic("navibar/bg.png");
+		mNursingButtonPtr->setText(LANGUAGEMANAGER->getValue("Nursing"));
+		mBlueCodeButtonPtr->setInvalid(true);
+	}
+}
+
+void setNursing2(bool setNursing) {
+	if (setNursing) {
+		setNursingBg(setNursing);
+
+	    // 门灯控制
+		std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
+		if (color != "" && color.size() == 3) {
+			color = color + "F";
+		} else {
+			color = "010F";
+		}
+		lightControl("DOORLED", color);
+
+		// 发送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 = 0;
+
+		sendTcpModel(tcpModel);
+
+		// 把护理状态缓存起来
+		StoragePreferences::putBool(STORE_NURSING_TYPE, true);
+	}
+	else {
+		setNursingBg(setNursing);
+
+		lightControl("DOORLED", "000F");
+
+		setNursingEnd();
+
+		if (blueCodeId != 0) {
+			TcpModel tcpModel;
+			tcpModel.tid = blueCodeTid;
+			tcpModel.type = TcpType::BLUE_CODE;
+			tcpModel.action = BlueCodeAction::RESPONSE;
+			tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+			tcpModel.data = to_string(blueCodeId);
+			std::string req = getTcpModelString(tcpModel);
+			LOGD("TCP BLUE CODE : %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);
+
+			blueCodeId = 0;
+			blueCodeTid = "";
+		}
+	}
+}
+
 //void callBedButtonSetVisible() {
 //	if (mnavibarPtr == NULL) {
 //		return;
@@ -121,6 +207,13 @@ void goCare() {
 //		mCallNursePicPainterPtr->setPosition(LayoutPosition(46, 396, 27, 27));
 //	}
 //}
+
+
+void setBlueCodeId(int id, string tid) {
+	blueCodeId = id;
+	blueCodeTid = tid;
+}
+
 /**
  * 注册定时器
  * 填充数组用于注册定时器
@@ -138,6 +231,7 @@ static void onUI_init(){
     //Tips :添加 UI初始化的显示代码到这里,如:mText1->setText("123");
 //	callBedButtonSetVisible();
 	setNavibarTheme();
+	setNursingBg(isNursing2);
 }
 
 /*
@@ -295,3 +389,51 @@ static bool onButtonClick_CallCancelButton(ZKButton *pButton) {
 	TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
     return false;
 }
+
+static bool onButtonClick_NursingButton(ZKButton *pButton) {
+    LOGD(" ButtonClick NursingButton !!!\n");
+
+    if (!isNursing2) {
+    	Intent* intent = new Intent();
+    	intent->putExtra(functionWindows, "nursing2");
+    	EASYUICONTEXT->openActivity("functionActivity", intent);
+    }
+    else {
+    	Intent* intent = new Intent();
+    	intent->putExtra(functionWindows, "nursingEnd2");
+    	EASYUICONTEXT->openActivity("functionActivity", intent);
+    }
+    return false;
+}
+static bool onButtonClick_BlueCodeButton(ZKButton *pButton) {
+    LOGD(" ButtonClick BlueCodeButton !!!\n");
+
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::BLUE_CODE;
+	tcpModel.action = BlueCodeAction::CALL;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	std::string req = getTcpModelString(tcpModel);
+	LOGD("TCP BLUE CODE : %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);
+
+	lightControl("DOORLED", "001F");
+
+	Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "blueCode");
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+    return false;
+}

+ 355 - 106
jni/logic/startLogic.cc

@@ -25,6 +25,13 @@ static bool isNursing = false;	// 用于启动时判断是否处于护理状态
 static bool isNetreset = false;
 static int netresetInt = 0;
 static string callTid = "";
+
+static bool isConnectHandle = false;
+static bool isConnectSos = false;
+static bool isTriggerHandle = false;
+static bool isTriggerSos = false;
+
+
 #define FUNCTION_TIMER_HANDLE 3	// 增援的定时器id
 #define SOS_CLICK_TIME_HANDLE 4	// sos的定时器id
 #define SOS_LAMP_TIME_HANDLE 5	// sos的门灯定时器id
@@ -33,6 +40,9 @@ static string callTid = "";
 #define SYS_RESTART_TIME_HANDLE 10	// 重启
 #define PROMPT_TIME_HANDLE 11	// 提示语
 
+#define HANDLE_TRIGGER_TIME_HANDLE 15
+#define SOS_TRIGGER_TIME_HANDLE 16
+
 #define HTTP_SERVER_PORT  80
 
 srv::HttpServer httpServer;
@@ -499,6 +509,14 @@ void handleMsg(byte* inBytes){
 			}
 		}
 	}
+	else if (tcpModel.type == TcpType::BLUE_CODE) {
+		if (tcpModel.action == BlueCodeAction::SUCCESS) {
+			int id = tcpModel.json["id"].asInt();
+			LOGD("blue code id ===> %d", id);
+			setBlueCodeId(id, tcpModel.tid);
+		}
+
+	}
 }
 
 bool getSleepTimerRegistered() {
@@ -774,33 +792,23 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 	if(UartContext::Uart3IsOpen()) {	// 如果是true,表示串口打开了
 		string heartStr;
 
-		//按下
-		if (data.state=="0"){    // 0表示正被按下,1表示短按松开,2表示长按松开。
-			if (data.cmd == "KEY5") {	// key5是面板拨号按钮
-				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
-					setCheckbox("KEY5");
-					return;
+		// 面板拨号
+		if (data.cmd == "KEY5") {
+			if (data.state == "0") {
+				if (isSleep) {
+					scrrenOn();
+					if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
+						return;
+					}
 				}
 
-				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
-					if (isSleep) {
-						scrrenOn();
-					}
-					else {
-						voip::CallInfo info = GetTelephone()->GetCallInfo();
-						//拨打 或 挂断
-						if (CallingStatus::instance()->busy()){
-							callActivityFinish(CallFinishType::A1CLICK);
-						} else {
-							Intent* intent = new Intent();
-							intent->putExtra(isOutgoing, "true");
-							intent->putExtra(audioOnly, "true");
-							EASYUICONTEXT->openActivity("callActivity", intent);
-						}
-					}
+				const char* currentAppName = EASYUICONTEXT->currentAppName();
+				string _currentAppName = currentAppName;
+				if (_currentAppName == "sipTestActivity") {
+					setCheckbox("KEY5");
+					return;
 				}
 				else {
-					scrrenOn();
 					voip::CallInfo info = GetTelephone()->GetCallInfo();
 					//拨打 或 挂断
 					if (CallingStatus::instance()->busy()){
@@ -813,28 +821,31 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 					}
 				}
 			}
-
-			else if (data.cmd == "KEY6"){	// key6是手柄触发,手柄只有呼叫和挂断功能,没有取消功能,防止用户不停地按
-
-				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
-					if (isSleep) {
-						scrrenOn();
-					}
-					else {
-						voip::CallInfo info = GetTelephone()->GetCallInfo();
-						//拨打 或 挂断
-						if (CallingStatus::instance()->busy()){
-							callActivityFinish(CallFinishType::KEY6_CLICK);
-						} else {
-							Intent* intent = new Intent();
-							intent->putExtra(isOutgoing, "true");
-							intent->putExtra(audioOnly, "true");
-							EASYUICONTEXT->openActivity("callActivity", intent);
-						}
+		}
+		else if (data.cmd == "KEY6") {
+			if (data.state == "0") {
+				if (isSleep) {
+					scrrenOn();
+					if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
+						return;
 					}
 				}
-				else {
-					scrrenOn();
+
+				const char* currentAppName = EASYUICONTEXT->currentAppName();
+				string _currentAppName = currentAppName;
+				if (_currentAppName == "sipTestActivity") {
+					setCheckbox("KEY6");
+					return;
+				}
+
+				isTriggerHandle = true;
+				mActivityPtr->registerUserTimer(HANDLE_TRIGGER_TIME_HANDLE, 5 * 1000);
+
+			}
+			else if (data.state == "1") {
+				if (isTriggerHandle) {
+					isTriggerHandle = false;
+
 					voip::CallInfo info = GetTelephone()->GetCallInfo();
 					//拨打 或 挂断
 					if (CallingStatus::instance()->busy()){
@@ -846,17 +857,63 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 						EASYUICONTEXT->openActivity("callActivity", intent);
 					}
 				}
+			}
+			else if (data.state == "3") {
+				isConnectHandle = true;
+			}
+			else if (data.state == "4") {
+				if (!isConnectHandle) {
+					return;
+				}
+				if (sosTimerRegistered) {
+					LOGD("TCP -> SOS_CALL");
+					Json::Value data;
+					data["title"] = "手柄断连";
 
+					TcpModel tcpModel;
+					tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+					tcpModel.type = TcpType::SOS;
+					tcpModel.action = SosAction::CALL;
+					tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+					tcpModel.json = data;
+					std::string req = getTcpModelString(tcpModel);
+					LOGD("TCP SOS_CALL : %s",req.c_str());
+					TcpClient::instance()->sendMsg(req.c_str());
+
+
+					// SOS亮红灯
+					lightControl("ULED", "1F");
+					// 门灯亮红灯
+					lightControl("DOORLED", "200F");
+
+					lightControl("CALLLED", "100F");
+
+					sosTimerRegistered = false;
+					mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000);		// 10秒后才能触发
+					mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000);		// 2分钟后才能触发
+				}
 			}
-			else if (data.cmd == "KEY7"){	// key7是紧急按钮
-				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
+
+		}
+		else if (data.cmd == "KEY7") {
+			if (data.state == "0") {
+				scrrenOn();
+
+				const char* currentAppName = EASYUICONTEXT->currentAppName();
+				string _currentAppName = currentAppName;
+				if (_currentAppName == "sipTestActivity") {
 					setCheckbox("KEY7");
 					return;
 				}
-				if (isSleep) {
-					scrrenOn();
+				else {
+					if (sosTimerRegistered) {
+						isTriggerSos = true;
+						mActivityPtr->registerUserTimer(SOS_TRIGGER_TIME_HANDLE, 5 * 1000);
+					}
 				}
-				if (sosTimerRegistered) {
+			}
+			else if (data.state == "1") {
+				if (isTriggerSos) {
 					LOGD("TCP -> SOS_CALL");
 					TcpModel tcpModel;
 					tcpModel.type = TcpType::SOS;
@@ -878,82 +935,264 @@ static void onProtocolDataUpdate(const SProtocolData &data) {
 					mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000);		// 2分钟后才能触发
 				}
 			}
-			else if (data.cmd == "KEY<") {	//下左3,红
-				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
-					setCheckbox("KEY<");
+			else if (data.state == "3") {
+				isConnectSos = true;
+			}
+			else if (data.state == "4") {
+				if (!isConnectSos) {
 					return;
 				}
+				if (sosTimerRegistered) {
+					LOGD("TCP -> SOS_CALL");
+					Json::Value data;
+					data["title"] = "紧急按钮断连";
 
-				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
-					if (isSleep) {
-						scrrenOn();
-					}
-					else {
-						voip::CallInfo info = GetTelephone()->GetCallInfo();
-						//拨打 或 挂断
-						if (CallingStatus::instance()->busy()){
-							callActivityFinish(CallFinishType::A1CLICK);
-						} else {
-							Intent* intent = new Intent();
-							intent->putExtra(isOutgoing, "true");
-							intent->putExtra(audioOnly, "true");
-							EASYUICONTEXT->openActivity("callActivity", intent);
-						}
-					}
-				}
-				else {
-					scrrenOn();
-					voip::CallInfo info = GetTelephone()->GetCallInfo();
-					//拨打 或 挂断
-					if (CallingStatus::instance()->busy()){
-						callActivityFinish(CallFinishType::A1CLICK);
-					} else {
-						Intent* intent = new Intent();
-						intent->putExtra(isOutgoing, "true");
-						intent->putExtra(audioOnly, "true");
-						EASYUICONTEXT->openActivity("callActivity", intent);
-					}
+					TcpModel tcpModel;
+					tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+					tcpModel.type = TcpType::SOS;
+					tcpModel.action = SosAction::CALL;
+					tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+					tcpModel.json = data;
+					std::string req = getTcpModelString(tcpModel);
+					LOGD("TCP SOS_CALL : %s",req.c_str());
+					TcpClient::instance()->sendMsg(req.c_str());
+
+
+					// SOS亮红灯
+					lightControl("ULED", "1F");
+					// 门灯亮红灯
+					lightControl("DOORLED", "200F");
+
+					lightControl("CALLLED", "100F");
+
+					sosTimerRegistered = false;
+					mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000);		// 10秒后才能触发
+					mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000);		// 2分钟后才能触发
 				}
 			}
-			else if (data.cmd == "KEY>") {	// key>是面板挂断按钮
-				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
-					if (isSleep) {
-						scrrenOn();
-					}
-					else {
-						voip::CallInfo info = GetTelephone()->GetCallInfo();
-						//拨打 或 挂断
-						if (CallingStatus::instance()->busy()){
-							callActivityFinish(CallFinishType::A1CLICK);
-
-							lightControl("DOORLED", "000F");
-						}
-					}
+
+		}
+		else if (data.cmd == "KEY<") {
+			if (isSleep) {
+				scrrenOn();
+			}
+//			lightControl("DOORLED", "100F");
+		}
+		else if (data.cmd == "KEY>") {	// key>是面板挂断按钮
+			if (data.state == "0") {
+				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
+					setCheckbox("KEY>");
+					return;
 				}
-				else {
+
+				if (isSleep) {
 					scrrenOn();
+				}
+				else {
 					voip::CallInfo info = GetTelephone()->GetCallInfo();
 					//拨打 或 挂断
 					if (CallingStatus::instance()->busy()){
 						callActivityFinish(CallFinishType::A1CLICK);
-
 						lightControl("DOORLED", "000F");
 					}
 				}
 			}
-			else if (data.cmd == "KEY;"){	//下左4,白
-				if (isSleep) {
-					scrrenOn();
-				}
-				lightControl("DOORLED", "111F");
+
+		}
+		else if (data.cmd == "KEY;") {
+			if (isSleep) {
+				scrrenOn();
 			}
-			else {
-				if (isSleep) {
-					scrrenOn();
-				}
-//				lightControl("DOORLED", "000F");
+//			lightControl("DOORLED", "111F");
+		}
+		else {
+			if (isSleep) {
+				scrrenOn();
 			}
+			lightControl("DOORLED", "000F");
 		}
+
+
+//		//按下
+//		if (data.state=="0"){    // 0表示正被按下,1表示短按松开,2表示长按松开。
+//			if (data.cmd == "KEY5") {	// key5是面板拨号按钮
+//				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
+//					setCheckbox("KEY5");
+//					return;
+//				}
+//
+//				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
+//					if (isSleep) {
+//						scrrenOn();
+//					}
+//					else {
+//						voip::CallInfo info = GetTelephone()->GetCallInfo();
+//						//拨打 或 挂断
+//						if (CallingStatus::instance()->busy()){
+//							callActivityFinish(CallFinishType::A1CLICK);
+//						} else {
+//							Intent* intent = new Intent();
+//							intent->putExtra(isOutgoing, "true");
+//							intent->putExtra(audioOnly, "true");
+//							EASYUICONTEXT->openActivity("callActivity", intent);
+//						}
+//					}
+//				}
+//				else {
+//					scrrenOn();
+//					voip::CallInfo info = GetTelephone()->GetCallInfo();
+//					//拨打 或 挂断
+//					if (CallingStatus::instance()->busy()){
+//						callActivityFinish(CallFinishType::A1CLICK);
+//					} else {
+//						Intent* intent = new Intent();
+//						intent->putExtra(isOutgoing, "true");
+//						intent->putExtra(audioOnly, "true");
+//						EASYUICONTEXT->openActivity("callActivity", intent);
+//					}
+//				}
+//			}
+//
+//			else if (data.cmd == "KEY6"){	// key6是手柄触发,手柄只有呼叫和挂断功能,没有取消功能,防止用户不停地按
+//
+//				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
+//					if (isSleep) {
+//						scrrenOn();
+//					}
+//					else {
+//						voip::CallInfo info = GetTelephone()->GetCallInfo();
+//						//拨打 或 挂断
+//						if (CallingStatus::instance()->busy()){
+//							callActivityFinish(CallFinishType::KEY6_CLICK);
+//						} else {
+//							Intent* intent = new Intent();
+//							intent->putExtra(isOutgoing, "true");
+//							intent->putExtra(audioOnly, "true");
+//							EASYUICONTEXT->openActivity("callActivity", intent);
+//						}
+//					}
+//				}
+//				else {
+//					scrrenOn();
+//					voip::CallInfo info = GetTelephone()->GetCallInfo();
+//					//拨打 或 挂断
+//					if (CallingStatus::instance()->busy()){
+//						callActivityFinish(CallFinishType::KEY6_CLICK);
+//					} else {
+//						Intent* intent = new Intent();
+//						intent->putExtra(isOutgoing, "true");
+//						intent->putExtra(audioOnly, "true");
+//						EASYUICONTEXT->openActivity("callActivity", intent);
+//					}
+//				}
+//
+//			}
+//			else if (data.cmd == "KEY7"){	// key7是紧急按钮
+//				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
+//					setCheckbox("KEY7");
+//					return;
+//				}
+//				if (isSleep) {
+//					scrrenOn();
+//				}
+//				if (sosTimerRegistered) {
+//					LOGD("TCP -> SOS_CALL");
+//					TcpModel tcpModel;
+//					tcpModel.type = TcpType::SOS;
+//					tcpModel.action = SosAction::CALL;
+//					tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID, 0);
+//					tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+//					std::string req = getTcpModelString(tcpModel);
+//					LOGD("TCP SOS_CALL : %s",req.c_str());
+//					TcpClient::instance()->sendMsg(req.c_str());
+//
+//					// SOS亮红灯
+//					lightControl("ULED", "1F");
+//					// 门灯亮红灯
+//					lightControl("DOORLED", "200F");
+//
+//					lightControl("CALLLED", "100F");
+//
+//					mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000);		// 10秒后才能触发
+//					mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000);		// 2分钟后才能触发
+//				}
+//			}
+//			else if (data.cmd == "KEY<") {	//下左3,红
+//				if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
+//					setCheckbox("KEY<");
+//					return;
+//				}
+//
+//				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
+//					if (isSleep) {
+//						scrrenOn();
+//					}
+//					else {
+//						voip::CallInfo info = GetTelephone()->GetCallInfo();
+//						//拨打 或 挂断
+//						if (CallingStatus::instance()->busy()){
+//							callActivityFinish(CallFinishType::A1CLICK);
+//						} else {
+//							Intent* intent = new Intent();
+//							intent->putExtra(isOutgoing, "true");
+//							intent->putExtra(audioOnly, "true");
+//							EASYUICONTEXT->openActivity("callActivity", intent);
+//						}
+//					}
+//				}
+//				else {
+//					scrrenOn();
+//					voip::CallInfo info = GetTelephone()->GetCallInfo();
+//					//拨打 或 挂断
+//					if (CallingStatus::instance()->busy()){
+//						callActivityFinish(CallFinishType::A1CLICK);
+//					} else {
+//						Intent* intent = new Intent();
+//						intent->putExtra(isOutgoing, "true");
+//						intent->putExtra(audioOnly, "true");
+//						EASYUICONTEXT->openActivity("callActivity", intent);
+//					}
+//				}
+//			}
+//			else if (data.cmd == "KEY>") {	// key>是面板挂断按钮
+//				if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
+//					if (isSleep) {
+//						scrrenOn();
+//					}
+//					else {
+//						voip::CallInfo info = GetTelephone()->GetCallInfo();
+//						//拨打 或 挂断
+//						if (CallingStatus::instance()->busy()){
+//							callActivityFinish(CallFinishType::A1CLICK);
+//
+//							lightControl("DOORLED", "000F");
+//						}
+//					}
+//				}
+//				else {
+//					scrrenOn();
+//					voip::CallInfo info = GetTelephone()->GetCallInfo();
+//					//拨打 或 挂断
+//					if (CallingStatus::instance()->busy()){
+//						callActivityFinish(CallFinishType::A1CLICK);
+//
+//						lightControl("DOORLED", "000F");
+//					}
+//				}
+//			}
+//			else if (data.cmd == "KEY;"){	//下左4,白
+//				if (isSleep) {
+//					scrrenOn();
+//				}
+//				lightControl("DOORLED", "111F");
+//			}
+//			else {
+//				if (isSleep) {
+//					scrrenOn();
+//				}
+////				lightControl("DOORLED", "000F");
+//			}
+//		}
 	}
 }
 
@@ -1028,6 +1267,16 @@ static bool onUI_Timer(int id){
 	    	reboot(RB_AUTOBOOT);
 	    }
 		break;
+    case HANDLE_TRIGGER_TIME_HANDLE: {
+    	isTriggerHandle = false;
+    	return false;
+    }
+    	break;
+    case SOS_TRIGGER_TIME_HANDLE: {
+    	isTriggerSos = false;
+    	return false;
+    }
+    	break;
 	default:
 		break;
 	}

+ 1 - 1
jni/net/tcp_client.cpp

@@ -101,7 +101,7 @@ public:
 			Json::Value json;
 			json["identification"] = StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
 			json["software_version"] = getVersionCode();
-			json["model"] = "linux_door";;
+			json["model"] = "linux_door";
 			json["code"] = "SW10600101C-CM";
 			tcpModel.json = json;
 

+ 9 - 0
jni/net/tcp_model.h

@@ -23,6 +23,7 @@ public:
 	inline static std::string DATA = "DATA";
 	inline static std::string TIME = "TIME";
 	inline static std::string SIDE = "SIDE";
+	inline static std::string BLUE_CODE = "BLUE_CODE";
 	inline static std::string CALLBACK = "CALLBACK";
 
     /** 新增床旁交互Tcp类型 **/
@@ -105,6 +106,14 @@ public:
 	inline static std::string NURSING_END = "NURSING_END";	// 护理结束
 };
 
+class BlueCodeAction {
+public:
+	inline static std::string CALL = "CALL";	// 呼叫
+	inline static std::string SUCCESS = "SUCCESS";	// 成功
+	inline static std::string RESPONSE = "RESPONSE";	// 响应
+	inline static std::string RESPONDED = "RESPONDED";	// 已响应
+};
+
 class CallbackAction {
 public:
 	inline static std::string ACK = "ACK";			// 反馈

+ 24 - 1
jni/service/BusinessConfig.h

@@ -13,6 +13,7 @@
 #include <atomic>
 #include "net/tcp_client.h"
 #include "net/tcp_model.h"
+#include "core/utilities.h"
 #include <map>
 
 #ifndef JNI_SERVICE_BUSINESSCONFIG_H_
@@ -71,8 +72,15 @@ static uint32_t redDeepColour = 0xFFF78B8F;
 static uint32_t buleLightColour = 0xFF759FFF;
 static uint32_t buleDeepColour = 0xFF3A78EF;
 static uint32_t whiteColour = 0xFFFFFFFF;
+static uint32_t BlackColor = 0xFF000000;
 static int defaultThemeInt = 1;
-static int defaultModeInt = 3;
+static int defaultModeInt = 1;
+
+
+static uint32_t defaultRed = 0xFFE82222;
+static uint32_t defaultGreen = 0xFF2EA22A;
+static uint32_t defaultBlue = 0xFF68A5FF;
+static uint32_t defaultYellow = 0xFFE68024;
 
 static std::string versionCode = "v2.0.11";
 static int versionNo = 58;
@@ -162,10 +170,14 @@ void setNursingEnd();
 
 void setNursing(bool setNursing);
 
+void setNursing2(bool setNursing);
+
 void setNursingTime(int time);
 
 void setNursingFalse();
 
+void setBlueCodeId(int id, std::string tid);
+
 const bool checkAddr(std::string addr);
 
 void openInitWindow();
@@ -193,6 +205,14 @@ void nfcLogin(std::string revStr);
 
 void systemRestart();
 
+void doCutsomerAffair(int execute);
+
+Json::Value getFrameTree(std::string frame);
+
+void setPartFrameTree(int index);
+void setRoomFrameTree(int index);
+void setBedFrameTree(int index);
+
 enum CallFinishType {
 	CANCEL,
 	REJECT,
@@ -324,6 +344,9 @@ static std::string promptText2 = "promptText2";
 static std::string promptTime2 = "promptTime2";
 static std::string goActivity = "goActivity";
 
+static std::string transmitCustomerId = "transmitCustomerId";
+static std::string transmitDeviceId = "transmitDeviceId";
+
 class CallingStatus{
 public:
 	virtual ~CallingStatus();

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/callActivity.o


BIN
obj/activity/customerAffairActivity.o


BIN
obj/activity/deviceAddActivity.o


BIN
obj/activity/deviceInfoActivity.o


BIN
obj/activity/functionActivity.o


BIN
obj/activity/interactionActivity.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/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/button/elliptic_bule_125x33.png


BIN
resources/button/elliptic_grey_125x33.png


BIN
resources/button/elliptic_light_blue.png


BIN
resources/button/elliptic_orange_125x33.png


BIN
resources/button/square_pink.png


BIN
resources/button/square_red.png


BIN
resources/customerAffair/affairList.png


BIN
resources/customerAffair/affairTitle.png


BIN
resources/deviceAdd/choiceFrame.png


BIN
resources/icon/nursing.png


BIN
resources/interaction/choose.png


BIN
resources/interaction/huchu.png


BIN
resources/interaction/huishou.png


BIN
resources/interaction/huli3.png


BIN
resources/interaction/huru.png


BIN
resources/interaction/interaction.png


BIN
resources/interaction/shijian.png


BIN
resources/interaction/shouhui.png


BIN
resources/interaction/sos.png


BIN
resources/interaction/zengyuan2.png


BIN
resources/main/affair.png


BIN
resources/main/event.png


BIN
ui/customerAffair.ftu


BIN
ui/deviceAdd.ftu


BIN
ui/function.ftu


BIN
ui/interaction.ftu


BIN
ui/main.ftu


BIN
ui/navibar.ftu


BIN
ui/setting.ftu