Просмотр исходного кода

增加nfc刷卡登录,优化tcp发送

vothin 11 месяцев назад
Родитель
Сommit
2fd0f758dc

+ 10 - 3
i18n/zh_CN.tr

@@ -78,6 +78,9 @@
     <string name="HeadNurse">护士长</string>
     <string name="CustomerAffair">用户事务</string>
     <string name="EventButton">按键事件</string>
+    <string name="Logined">已登录</string>
+    <string name="NfcLoginSuccess">刷卡登录成功</string>
+    <string name="NfcLogoutSuccess">成功退出登录</string>
     <!-- 交互界面 -->
     <string name="Recover">收回列表</string>
     <string name="All">全部</string>
@@ -127,6 +130,7 @@
     <string name="ChoicePartMsg">选择要注册的科室</string>
     <string name="ChoiceRoomMsg">选择要注册的房间</string>
     <string name="ChoiceBedMsg">选择要注册的床位</string>
+    <string name="IsNfcLogout">请确认,是否退出登录?</string>
     <!-- 医护界面 -->
     <string name="MedicalLoginMsg">请输入正确的密码,进入医护功能</string>
     <string name="InputMedicalPassword">输入密码进入医护</string>
@@ -229,12 +233,15 @@
     <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="DeviceAddMsg">设备名称:本机        设备类型:3</string>
+    <string name="DeviceAddMsg2">设备名称:手柄1	       设备类型:4</string>
+    <string name="DeviceAddMsg3">设备名称:手柄2	       设备类型:4</string>
+    <string name="DeviceAddMsg4">注册ID:</string>
     <string name="RoomDevice">门口机</string>
     <string name="BedDevice">床头分机</string>
     <string name="AddDeviceSuccess">设备注册成功</string>
+    <string name="HospitalList">医院列表</string>
+    <string name="DeviceAddTitle">注册信息</string>
     <!-- 设置界面 -->
     <string name="SettingText">设备设置</string>
     <string name="IsLight">是否常亮</string>

+ 18 - 3
jni/activity/deviceAddActivity.cpp

@@ -4,6 +4,12 @@
 #include "deviceAddActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKTextView* mDeviceAddTitleTextViewPtr;
+static ZKPainter* mDeviceAddPicPainterPtr;
+static ZKPainter* mDeviceAddPainterPtr;
+static ZKTextView* mHospitalTextViewPtr;
+static ZKPainter* mHospitalPicPainterPtr;
+static ZKPainter* mHospitalPainterPtr;
 static ZKButton* mRebootButtonPtr;
 static ZKButton* mConfirmButtonPtr;
 static ZKButton* mChoiceBedButtonPtr;
@@ -15,7 +21,6 @@ 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;
@@ -144,6 +149,12 @@ deviceAddActivity::~deviceAddActivity() {
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     onUI_quit();
     mActivityPtr = NULL;
+    mDeviceAddTitleTextViewPtr = NULL;
+    mDeviceAddPicPainterPtr = NULL;
+    mDeviceAddPainterPtr = NULL;
+    mHospitalTextViewPtr = NULL;
+    mHospitalPicPainterPtr = NULL;
+    mHospitalPainterPtr = NULL;
     mRebootButtonPtr = NULL;
     mConfirmButtonPtr = NULL;
     mChoiceBedButtonPtr = NULL;
@@ -155,7 +166,6 @@ deviceAddActivity::~deviceAddActivity() {
     mHospitalListViewPtr = NULL;
     mDeviceMacTextViewPtr = NULL;
     mDeviceRadioGroupPtr = NULL;
-    mDeviceAddPainterPtr = NULL;
     mTitleTextViewPtr = NULL;
     msys_backPtr = NULL;
 }
@@ -167,6 +177,12 @@ const char* deviceAddActivity::getAppName() const{
 //TAG:onCreate
 void deviceAddActivity::onCreate() {
 	Activity::onCreate();
+    mDeviceAddTitleTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_DeviceAddTitleTextView);
+    mDeviceAddPicPainterPtr = (ZKPainter*)findControlByID(ID_DEVICEADD_DeviceAddPicPainter);
+    mDeviceAddPainterPtr = (ZKPainter*)findControlByID(ID_DEVICEADD_DeviceAddPainter);
+    mHospitalTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEADD_HospitalTextView);
+    mHospitalPicPainterPtr = (ZKPainter*)findControlByID(ID_DEVICEADD_HospitalPicPainter);
+    mHospitalPainterPtr = (ZKPainter*)findControlByID(ID_DEVICEADD_HospitalPainter);
     mRebootButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_RebootButton);
     mConfirmButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_ConfirmButton);
     mChoiceBedButtonPtr = (ZKButton*)findControlByID(ID_DEVICEADD_ChoiceBedButton);
@@ -178,7 +194,6 @@ void deviceAddActivity::onCreate() {
     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;

+ 6 - 1
jni/activity/deviceAddActivity.h

@@ -28,6 +28,12 @@
 #include "window/ZKSlideWindow.h"
 
 /*TAG:Macro宏ID*/
+#define ID_DEVICEADD_DeviceAddTitleTextView    50007
+#define ID_DEVICEADD_DeviceAddPicPainter    52004
+#define ID_DEVICEADD_DeviceAddPainter    52002
+#define ID_DEVICEADD_HospitalTextView    50006
+#define ID_DEVICEADD_HospitalPicPainter    52003
+#define ID_DEVICEADD_HospitalPainter    52001
 #define ID_DEVICEADD_RebootButton    20001
 #define ID_DEVICEADD_ConfirmButton    20015
 #define ID_DEVICEADD_ChoiceBedButton    20006
@@ -42,7 +48,6 @@
 #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*/

+ 22 - 0
jni/activity/deviceInfoActivity.cpp

@@ -4,6 +4,7 @@
 #include "deviceInfoActivity.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKRadioGroup* mQrCodeRadioGroup1Ptr;
 static ZKTextView* mScanQRCodeTextViewPtr;
 static ZKPainter* mQRCodePicPainterPtr;
 static ZKQRCode* mQRCodePtr;
@@ -145,6 +146,16 @@ static S_VideoViewCallback SVideoViewCallbackTab[] = {
 };
 
 
+typedef void (*RadioGroupCallback)(ZKRadioGroup*, int);
+typedef struct {
+  int id;
+  RadioGroupCallback onCheckedChanged;
+}S_RadioGroupCallback;
+/*TAG:RadioGroupCallbackTab*/
+static S_RadioGroupCallback SRadioGroupCallbackTab[] = {
+    ID_DEVICEINFO_QrCodeRadioGroup1, onCheckedChanged_QrCodeRadioGroup1,
+};
+
 deviceInfoActivity::deviceInfoActivity() {
 	//todo add init code here
 	mVideoLoopIndex = -1;
@@ -158,6 +169,7 @@ deviceInfoActivity::~deviceInfoActivity() {
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     onUI_quit();
     mActivityPtr = NULL;
+    mQrCodeRadioGroup1Ptr = NULL;
     mScanQRCodeTextViewPtr = NULL;
     mQRCodePicPainterPtr = NULL;
     mQRCodePtr = NULL;
@@ -207,6 +219,7 @@ const char* deviceInfoActivity::getAppName() const{
 //TAG:onCreate
 void deviceInfoActivity::onCreate() {
 	Activity::onCreate();
+    mQrCodeRadioGroup1Ptr = (ZKRadioGroup*)findControlByID(ID_DEVICEINFO_QrCodeRadioGroup1);if(mQrCodeRadioGroup1Ptr!= NULL){mQrCodeRadioGroup1Ptr->setCheckedChangeListener(this);}
     mScanQRCodeTextViewPtr = (ZKTextView*)findControlByID(ID_DEVICEINFO_ScanQRCodeTextView);
     mQRCodePicPainterPtr = (ZKPainter*)findControlByID(ID_DEVICEINFO_QRCodePicPainter);
     mQRCodePtr = (ZKQRCode*)findControlByID(ID_DEVICEINFO_QRCode);
@@ -516,4 +529,13 @@ void deviceInfoActivity::unregisterUserTimer(int id) {
 
 void deviceInfoActivity::resetUserTimer(int id, int time) {
 	resetTimer(id, time);
+}
+void deviceInfoActivity::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;
+        }
+    }
 }

+ 7 - 0
jni/activity/deviceInfoActivity.h

@@ -24,9 +24,14 @@
 #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_DEVICEINFO_QrCodeRadioButton3    22003
+#define ID_DEVICEINFO_QrCodeRadioButton2    22002
+#define ID_DEVICEINFO_QrCodeRadioButton1    22001
+#define ID_DEVICEINFO_QrCodeRadioGroup1    94001
 #define ID_DEVICEINFO_ScanQRCodeTextView    50028
 #define ID_DEVICEINFO_QRCodePicPainter    52010
 #define ID_DEVICEINFO_QRCode    92001
@@ -75,6 +80,7 @@ class deviceInfoActivity : public Activity,
                      public ZKListView::AbsListAdapter,
                      public ZKSlideWindow::ISlideItemClickListener,
                      public EasyUIContext::ITouchListener,
+                     public ZKRadioGroup::ICheckedChangeListener,
                      public ZKEditText::ITextChangeListener,
                      public ZKVideoView::IVideoPlayerMessageListener
 {
@@ -114,6 +120,7 @@ protected:
     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);
 

+ 4 - 0
jni/activity/navibar.cpp

@@ -2,6 +2,7 @@
 #include "entry/EasyUIContext.h"
 
 /*TAG:GlobalVariable全局变量*/
+static ZKButton* mNfcLogoutButtonPtr;
 static ZKButton* mBlueCodeButtonPtr;
 static ZKPainter* mNursingPainterPtr;
 static ZKButton* mNursingButtonPtr;
@@ -52,6 +53,7 @@ typedef struct {
 
 /*TAG:ButtonCallbackTab按键映射表*/
 static S_ButtonCallback sButtonCallbackTab[] = {
+    ID_NAVIBAR_NfcLogoutButton, onButtonClick_NfcLogoutButton,
     ID_NAVIBAR_BlueCodeButton, onButtonClick_BlueCodeButton,
     ID_NAVIBAR_NursingButton, onButtonClick_NursingButton,
     ID_NAVIBAR_CallCancelButton, onButtonClick_CallCancelButton,
@@ -137,6 +139,7 @@ navibar::~navibar() {
     unregisterProtocolDataUpdateListener(onProtocolDataUpdate);
     onUI_quit();
     mnavibarPtr = NULL;
+    mNfcLogoutButtonPtr = NULL;
     mBlueCodeButtonPtr = NULL;
     mNursingPainterPtr = NULL;
     mNursingButtonPtr = NULL;
@@ -159,6 +162,7 @@ const char* navibar::getAppName() const{
 //TAG:onCreate
 void navibar::onCreate() {
 	BaseApp::onCreate();
+    mNfcLogoutButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_NfcLogoutButton);
     mBlueCodeButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_BlueCodeButton);
     mNursingPainterPtr = (ZKPainter*)findControlByID(ID_NAVIBAR_NursingPainter);
     mNursingButtonPtr = (ZKButton*)findControlByID(ID_NAVIBAR_NursingButton);

+ 1 - 0
jni/activity/navibar.h

@@ -23,6 +23,7 @@
 #include "control/ZKRadioGroup.h"
 #include "window/ZKSlideWindow.h"
 /*TAG:Macro宏ID*/
+#define ID_NAVIBAR_NfcLogoutButton    20009
 #define ID_NAVIBAR_BlueCodeButton    20008
 #define ID_NAVIBAR_NursingPainter    52005
 #define ID_NAVIBAR_NursingButton    20007

+ 8 - 3
jni/logic/deviceAddLogic.cc

@@ -51,6 +51,8 @@ Json::Value choiceBed;
 
 Json::Value addDevice;
 
+static string deviceMacMsg = "";
+
 static string mac = StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
 
 
@@ -393,7 +395,8 @@ static void onCheckedChanged_DeviceRadioGroup(ZKRadioGroup* pRadioGroup, int che
     switch(checkedID) {
     case ID_DEVICEADD_DeviceRadioButton1:
     	choiceDeviceInt = 0;
-    	mDeviceMacTextViewPtr->setText(LANGUAGEMANAGER->getValue("DeviceAddMsg") + mac);
+    	deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsg4") + mac;
+    	mDeviceMacTextViewPtr->setText(deviceMacMsg);
 
     	mBedTextViewPtr->setVisible(false);
     	mChoiceBedButtonPtr->setVisible(false);
@@ -411,7 +414,8 @@ static void onCheckedChanged_DeviceRadioGroup(ZKRadioGroup* pRadioGroup, int che
     	break;
     case ID_DEVICEADD_DeviceRadioButton2:
     	choiceDeviceInt = 1;
-    	mDeviceMacTextViewPtr->setText(LANGUAGEMANAGER->getValue("DeviceAddMsg2") + mac + ":h1");
+    	deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg2") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsg4")  + mac + ":h1";
+    	mDeviceMacTextViewPtr->setText(deviceMacMsg);
 
     	mBedTextViewPtr->setVisible(true);
     	mChoiceBedButtonPtr->setVisible(true);
@@ -429,7 +433,8 @@ static void onCheckedChanged_DeviceRadioGroup(ZKRadioGroup* pRadioGroup, int che
     	break;
     case ID_DEVICEADD_DeviceRadioButton3:
     	choiceDeviceInt = 2;
-    	mDeviceMacTextViewPtr->setText(LANGUAGEMANAGER->getValue("DeviceAddMsg3") + mac + ":h2");
+    	deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg3") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsg4") + mac + ":h2";
+    	mDeviceMacTextViewPtr->setText(deviceMacMsg);
 
     	mBedTextViewPtr->setVisible(true);
     	mChoiceBedButtonPtr->setVisible(true);

+ 19 - 0
jni/logic/deviceInfoLogic.cc

@@ -409,3 +409,22 @@ static bool onButtonClick_RestartButton(ZKButton *pButton) {
 //	reboot(RB_AUTOBOOT);
     return false;
 }
+static void onCheckedChanged_QrCodeRadioGroup1(ZKRadioGroup* pRadioGroup, int checkedID) {
+    LOGD(" RadioGroup QrCodeRadioGroup1 checked %d", checkedID);
+    string qrStr = "";
+    switch (checkedID) {
+    case ID_DEVICEINFO_QrCodeRadioButton1:
+    	qrStr = "http://m.wdklian.com/care/apk/care.user?type=NCS_DEVICE&code=&mac=" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0") + "&model=&hard_ver=HV1.0&soft_ver=SW1.0&device_type=3&device_name=门口机";
+    	mQRCodePtr->loadQRCode(qrStr.c_str());
+    	break;
+    case ID_DEVICEINFO_QrCodeRadioButton2:
+    	qrStr = "http://m.wdklian.com/care/apk/care.user?type=NCS_DEVICE&code=&mac=" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0") + ":h1&model=&hard_ver=HV1.0&soft_ver=SW1.0&device_type=4&device_name=床位分机";
+    	mQRCodePtr->loadQRCode(qrStr.c_str());
+    	break;
+    case ID_DEVICEINFO_QrCodeRadioButton3:
+    	qrStr = "http://m.wdklian.com/care/apk/care.user?type=NCS_DEVICE&code=&mac=" + StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0") + ":h2&model=&hard_ver=HV1.0&soft_ver=SW1.0&device_type=4&device_name=床位分机";
+    	mQRCodePtr->loadQRCode(qrStr.c_str());
+    	break;
+    }
+
+}

+ 23 - 10
jni/logic/functionLogic.cc

@@ -453,6 +453,15 @@ void getBedFrameTree() {
 	mCallBedWindowPtr->showWnd();
 }
 
+void navibarLogout() {
+	mHandleIconPainterPtr->setBackgroundPic("icon/chenggong.png");
+	mHandleTextViewPtr->setText(LANGUAGEMANAGER->getValue("IsNfcLogout"));
+	mHandleStatusTextViewPtr->setVisible(false);
+	mHandleConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
+	mHandleConfirmButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
+	mHandleWindowPtr->showWnd();
+}
+
 
 
 /**
@@ -585,6 +594,9 @@ static void onUI_intent(const Intent *intentPtr) {
 		else if (_functionWindows == "getBedFrame") {
 			getBedFrameTree();
 		}
+		else if (_functionWindows == "navibarLogout") {
+			navibarLogout();
+		}
     }
 }
 
@@ -1223,27 +1235,28 @@ static bool onButtonClick_HandleConfirmButton(ZKButton *pButton) {
 		EASYUICONTEXT->closeActivity("functionActivity");
     }
     else if (_functionWindows == "nursingEnd2") {
+		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
+		        base::MediaPlayer::PlayMode::Default);
+
 		setNursing2(false);
     	mHandleWindowPtr->hideWnd();
 		EASYUICONTEXT->closeActivity("functionActivity");
-
+    }
+    else if (_functionWindows == "navibarLogout") {
 		mediaPlayer.Play(CONFIGMANAGER->getResFilePath("response.wav"), "", 1000,
 		        base::MediaPlayer::PlayMode::Default);
+
+    	navibarNfcLogout();
+    	mHandleWindowPtr->hideWnd();
+		EASYUICONTEXT->closeActivity("functionActivity");
     }
     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");
-    }
+	mHandleWindowPtr->hideWnd();
+	EASYUICONTEXT->closeActivity("functionActivity");
     return false;
 }
 

+ 82 - 76
jni/logic/medicalCareLogic.cc

@@ -108,7 +108,7 @@ static void getClerkList() {
 	}
 }
 
-static bool getClerkByPartIdAndPassNo(std::string passNo) {
+bool getClerkByPartIdAndPassNo(std::string passNo) {
     string url = getHttpGateway() + "/deviceRoom/get_clerk_by_part_id_and_pass_no/" + StoragePreferences::getString(STORE_PARTID, "") + "/" + passNo;
     LOGD("根据科室id和卡号查询员工. url = %s", url.c_str());
     //发起HTTP GET请求
@@ -188,18 +188,19 @@ void setPosition(bool setPosition) {
 	if (setPosition) {
 		setPositionButton(setPosition);
 
-		Json::Value json;
-		json["passNo"] = clerk["pass_no"].asCString();
-		json["operationData"] = "";
-
-		TcpModel tcpModel;
-		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
-		tcpModel.type = TcpType::POSITION;
-		tcpModel.action = PositionAction::POSITION_START;
-		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-		tcpModel.to_id = 0;
-		tcpModel.json = json;
-		sendTcpModel(tcpModel);
+//		Json::Value json;
+//		json["passNo"] = clerk["pass_no"].asCString();
+//		json["operationData"] = "";
+//
+//		TcpModel tcpModel;
+//		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+//		tcpModel.type = TcpType::POSITION;
+//		tcpModel.action = PositionAction::POSITION_START;
+//		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+//		tcpModel.to_id = 0;
+//		tcpModel.json = json;
+//		sendTcpModel(tcpModel);
+		sendPostionStart(clerk["pass_no"].asString());
 	}
 	else {
 		setPositionButton(setPosition);
@@ -253,19 +254,20 @@ void setRoomPatrol(bool setRoomPatrol) {
 	if (setRoomPatrol) {
 		setRoomPatrolButton(setRoomPatrol);
 
-		Json::Value json;
-		json["passNo"] = clerk["pass_no"].asCString();
-		json["operationData"] = "";
-
-		TcpModel tcpModel;
-		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
-		tcpModel.type = TcpType::ROOMCHECK;
-		tcpModel.action = RoomCheckAction::START;
-		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-		tcpModel.to_id = 0;
-		tcpModel.json = json;
-
-		sendTcpModel(tcpModel);
+//		Json::Value json;
+//		json["passNo"] = clerk["pass_no"].asCString();
+//		json["operationData"] = "";
+//
+//		TcpModel tcpModel;
+//		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+//		tcpModel.type = TcpType::ROOMCHECK;
+//		tcpModel.action = RoomCheckAction::START;
+//		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+//		tcpModel.to_id = 0;
+//		tcpModel.json = json;
+//
+//		sendTcpModel(tcpModel);
+		sendRoomCheckStart(clerk["pass_no"].asString());
 	}
 	else {
 		setRoomPatrolButton(setRoomPatrol);
@@ -290,15 +292,16 @@ void setNursingEnd() {
 
 	if (StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, "") != "") {	// 对比一下,json里面不为空的时候
 
-		// 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
-		TcpModel tcpModel;
-		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
-		tcpModel.type = TcpType::SIDE;
-		tcpModel.action = SideAction::NURSING_END;
-		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-		tcpModel.data = StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, "");	// 获取nursingTcpModel里,id字段的数据
-
-		sendTcpModel(tcpModel);
+//		// 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
+//		TcpModel tcpModel;
+//		tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+//		tcpModel.type = TcpType::SIDE;
+//		tcpModel.action = SideAction::NURSING_END;
+//		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+//		tcpModel.data = StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, "");	// 获取nursingTcpModel里,id字段的数据
+//
+//		sendTcpModel(tcpModel);
+		sendNursingEnd();
 
 		// 需要把护理的interactionId清空
 		StoragePreferences::putString(STORE_NURSING_INTERACTION_ID, "");
@@ -334,24 +337,25 @@ void setNursing(bool setNursing) {
 	if (setNursing) {
 		setNursingButton(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);
+//	    // 门灯控制
+//		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);
+		sendNursing();
 
 		// 把护理状态缓存起来
 		StoragePreferences::putBool(STORE_NURSING_TYPE, true);
@@ -397,15 +401,16 @@ void logoutMedicalCare() {
 
 	if (authItId != 0) {
 		// 发送tcp, tcp_type = AUTH, tcp_action = LOGOUT
-		TcpModel tcpModel;
-		tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
-		tcpModel.type = TcpType::AUTH;
-		tcpModel.action = AuthAction::LOGOUT;
-		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-		tcpModel.to_id = 0;
-		tcpModel.data = to_string(authItId);
-
-		sendTcpModel(tcpModel);
+//		TcpModel tcpModel;
+//		tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+//		tcpModel.type = TcpType::AUTH;
+//		tcpModel.action = AuthAction::LOGOUT;
+//		tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+//		tcpModel.to_id = 0;
+//		tcpModel.data = to_string(authItId);
+//
+//		sendTcpModel(tcpModel);
+		sendAuthLogout(to_string(authItId));
 
 		authItId = 0;
 	}
@@ -416,20 +421,21 @@ void loginMedicalCare() {
     mChooseClerkWindowPtr->hideWnd();
     mMedicalCareWindowPtr->showWnd();
 
-    Json::Value json;
-    json["passNo"] = clerk["pass_no"].asCString();
-    json["operationData"] = "";
-
-    // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
-    TcpModel tcpModel;
-    tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
-    tcpModel.type = TcpType::AUTH;
-    tcpModel.action = AuthAction::LOGIN;
-    tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-    tcpModel.to_id = 0;
-    tcpModel.json = json;
-
-    sendTcpModel(tcpModel);
+//    Json::Value json;
+//    json["passNo"] = clerk["pass_no"].asCString();
+//    json["operationData"] = "";
+//
+//    // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
+//    TcpModel tcpModel;
+//    tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+//    tcpModel.type = TcpType::AUTH;
+//    tcpModel.action = AuthAction::LOGIN;
+//    tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+//    tcpModel.to_id = 0;
+//    tcpModel.json = json;
+//
+//    sendTcpModel(tcpModel);
+    sendAuthLogin(clerk["pass_no"].asString());
 
     if (StoragePreferences::getInt(STORE_AUTO_POSITION, 0)) {
         setPosition(true);

+ 80 - 98
jni/logic/navibar.cc

@@ -38,8 +38,10 @@
 
 static uint32_t navibarButtonColor = buleDeepColour;
 static bool isNursing2 = false;
+static bool hasClerk = false;
 static int blueCodeId = 0;
 static string blueCodeTid = "";
+static string clerkNfc = "";
 
 void setNavibarTheme() {
     int themeInt = StoragePreferences::getInt(STORE_THEME, defaultThemeInt);
@@ -129,15 +131,7 @@ void setNursing2(bool setNursing) {
 		}
 		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);
+		sendNursing();
 
 		// 把护理状态缓存起来
 		StoragePreferences::putBool(STORE_NURSING_TYPE, true);
@@ -150,28 +144,7 @@ void setNursing2(bool setNursing) {
 		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);
+			sendBlueCodeResponse(blueCodeTid, to_string(blueCodeId));
 
 			blueCodeId = 0;
 			blueCodeTid = "";
@@ -214,6 +187,53 @@ void setBlueCodeId(int id, string tid) {
 	blueCodeTid = tid;
 }
 
+
+void navibarNfcLogout() {
+	hasClerk = false;
+	clerkNfc = "";
+
+	sendAuthLogout(to_string(getAuthItId()));
+	mNfcLogoutButtonPtr->setVisible(false);
+}
+
+void navibarNfcLogin(std::string revStr) {
+    if (hasClerk) {
+    	if (clerkNfc == revStr) {
+    		navibarNfcLogout();
+            Intent* intent = new Intent();
+            intent->putExtra(functionWindows, "success");
+            intent->putExtra(functionText, LANGUAGEMANAGER->getValue("NfcLogoutSuccess"));
+            EASYUICONTEXT->openActivity("functionActivity", intent);
+            return;
+    	}
+		navibarNfcLogout();
+    }
+
+    bool reslut = getClerkByPartIdAndPassNo(revStr);
+    if (reslut) {
+    	hasClerk = true;
+    	clerkNfc = revStr;
+
+    	sendAuthLogin(clerkNfc);
+    	sendSignIn(clerkNfc);
+    	sendPostionStart(clerkNfc);
+
+    	mNfcLogoutButtonPtr->setVisible(true);
+
+        Intent* intent = new Intent();
+        intent->putExtra(functionWindows, "success");
+        intent->putExtra(functionText, LANGUAGEMANAGER->getValue("NfcLoginSuccess"));
+        EASYUICONTEXT->openActivity("functionActivity", intent);
+    }
+    else {
+        Intent* intent = new Intent();
+        intent->putExtra(functionWindows, "warn");
+        intent->putExtra(warnText, LANGUAGEMANAGER->getValue("PassNoError"));
+        EASYUICONTEXT->openActivity("functionActivity", intent);
+    }
+
+}
+
 /**
  * 注册定时器
  * 填充数组用于注册定时器
@@ -296,14 +316,15 @@ static bool onnavibarActivityTouchEvent(const MotionEvent &ev) {
 
 static bool onButtonClick_HomeButton(ZKButton *pButton) {
     LOGD(" ButtonClick HomeButton !!!\n");
-    if (getAuthItId() != 0) {
-    	Intent* intent = new Intent();
-    	intent->putExtra(functionWindows, "logoutMedicalCare");
-    	intent->putExtra(goActivity, "home");
-    	EASYUICONTEXT->openActivity("functionActivity", intent);
-    } else {
-        goHome();
-    }
+//    if (getAuthItId() != 0) {
+//    	Intent* intent = new Intent();
+//    	intent->putExtra(functionWindows, "logoutMedicalCare");
+//    	intent->putExtra(goActivity, "home");
+//    	EASYUICONTEXT->openActivity("functionActivity", intent);
+//    } else {
+//        goHome();
+//    }
+    goHome();
     return false;
 }
 
@@ -316,27 +337,22 @@ static bool onButtonClick_HealthCareButton(ZKButton *pButton) {
 static bool onButtonClick_MoreButton(ZKButton *pButton) {
     LOGD(" ButtonClick MoreButton !!!\n");
 
-    if (getAuthItId() != 0) {
-    	Intent* intent = new Intent();
-    	intent->putExtra(functionWindows, "logoutMedicalCare");
-    	intent->putExtra(goActivity, "more");
-    	EASYUICONTEXT->openActivity("functionActivity", intent);
-    } else {
-    	goMore();
-    }
+//    if (getAuthItId() != 0) {
+//    	Intent* intent = new Intent();
+//    	intent->putExtra(functionWindows, "logoutMedicalCare");
+//    	intent->putExtra(goActivity, "more");
+//    	EASYUICONTEXT->openActivity("functionActivity", intent);
+//    } else {
+//    	goMore();
+//    }
+    goMore();
     return false;
 }
 
 static bool onButtonClick_HelpButton(ZKButton *pButton) {
     LOGD(" ButtonClick HelpButton !!!\n");
 
-	TcpModel tcpModel;
-	tcpModel.type = TcpType::REINFORCE;
-	tcpModel.action = ReinforceAction::CALL;
-	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-	tcpModel.to_id = 0;
-	sendTcpModel(tcpModel);
-
+    sendReinforceCall();
 
 	Intent* intent = new Intent();
 	intent->putExtra(functionWindows, "help");
@@ -365,28 +381,7 @@ static bool onButtonClick_CallNurseButton(ZKButton *pButton) {
 
 static bool onButtonClick_CallCancelButton(ZKButton *pButton) {
     LOGD(" ButtonClick CallCancelButton !!!\n");
-    // 发送tcp, tcp_type = VOICE, tcp_action = CANCEL_BY_DOOR
-	TcpModel tcpModel;
-	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
-	tcpModel.type = TcpType::VOICE;
-	tcpModel.action = VoiceAction::CANCEL_BY_DOOR;
-	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
-	std::string req = getTcpModelString(tcpModel);
-	LOGD("TCP VOICE : %s",req.c_str());
-
-	//回调注册
-	TcpCallback callback;
-	callback.tid = tcpModel.tid;
-	callback.jsonStr = req;
-	callback.onSuccess = [](Json::Value json){
-		LOGD("side callback success");
-		return 0;
-	};
-	callback.onFalied = [](Json::Value json){
-		LOGD("side callback failed");
-		return 0;
-	};
-	TcpClient::instance()->sendMsgWithCb(req.c_str(), callback);
+    sendCallByDoor();
     return false;
 }
 
@@ -407,29 +402,9 @@ static bool onButtonClick_NursingButton(ZKButton *pButton) {
 }
 static bool onButtonClick_BlueCodeButton(ZKButton *pButton) {
     LOGD(" ButtonClick BlueCodeButton !!!\n");
+    sendBlueCodeCall();
 
-	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);
-
+    mBlueCodeButtonPtr->setInvalid(true);
 	lightControl("DOORLED", "001F");
 
 	Intent* intent = new Intent();
@@ -437,3 +412,10 @@ static bool onButtonClick_BlueCodeButton(ZKButton *pButton) {
 	EASYUICONTEXT->openActivity("functionActivity", intent);
     return false;
 }
+static bool onButtonClick_NfcLogoutButton(ZKButton *pButton) {
+    LOGD(" ButtonClick NfcLogoutButton !!!\n");
+	Intent* intent = new Intent();
+	intent->putExtra(functionWindows, "navibarLogout");
+	EASYUICONTEXT->openActivity("functionActivity", intent);
+    return false;
+}

+ 7 - 6
jni/logic/startLogic.cc

@@ -500,12 +500,13 @@ void handleMsg(byte* inBytes){
 				setAuthItId(tcpModel.json["id"].asInt());
 			}
 			else {
-				logoutMedicalCare();
-				const char* currentAppName = EASYUICONTEXT->currentAppName();
-				string _currentAppName = currentAppName;
-				if (_currentAppName == "medicalCareActivity") {
-					goHome();
-				}
+				navibarNfcLogout();
+//				logoutMedicalCare();
+//				const char* currentAppName = EASYUICONTEXT->currentAppName();
+//				string _currentAppName = currentAppName;
+//				if (_currentAppName == "medicalCareActivity") {
+//					goHome();
+//				}
 			}
 		}
 	}

+ 166 - 0
jni/net/tcp_util.cpp

@@ -0,0 +1,166 @@
+/*
+ * tcp_util.cpp
+ *
+ *  Created on: 2024年7月18日
+ *      Author: m
+ */
+
+#include "tcp_model.h"
+#include "tcp_util.h"
+#include "json/json.h"
+#include <utils/TimeHelper.h>
+#include "base/strings.hpp"
+#include "service/BusinessConfig.h"
+
+
+void sendAuthLogin(std::string clerkNfc) {
+    Json::Value json;
+    json["passNo"] = clerkNfc;
+    json["operationData"] = "";
+
+    // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
+    TcpModel tcpModel;
+    tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+    tcpModel.type = TcpType::AUTH;
+    tcpModel.action = AuthAction::LOGIN;
+    tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+    tcpModel.json = json;
+
+    sendTcpModel(tcpModel);
+}
+
+
+void sendAuthLogout(std::string authItId) {
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::AUTH;
+	tcpModel.action = AuthAction::LOGOUT;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.to_id = 0;
+	tcpModel.data = authItId;
+
+	sendTcpModel(tcpModel);
+}
+
+
+void sendSignIn(std::string clerkNfc) {
+    Json::Value json;
+    json["passNo"] = clerkNfc;
+    json["operationData"] = "";
+
+    // 发送tcp, tcp_type = AUTH, tcp_action = LOGIN
+    TcpModel tcpModel;
+    tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+    tcpModel.type = TcpType::SIGN_IN;
+    tcpModel.action = SignInAction::SIGN_IN;
+    tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+    tcpModel.json = json;
+
+    sendTcpModel(tcpModel);
+}
+
+
+void sendPostionStart(std::string clerkNfc) {
+	Json::Value json;
+	json["passNo"] = clerkNfc;
+	json["operationData"] = "";
+
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::POSITION;
+	tcpModel.action = PositionAction::POSITION_START;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.json = json;
+	sendTcpModel(tcpModel);
+}
+
+
+void sendRoomCheckStart(std::string clerkNfc) {
+	Json::Value json;
+	json["passNo"] = clerkNfc;
+	json["operationData"] = "";
+
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::ROOMCHECK;
+	tcpModel.action = RoomCheckAction::START;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.json = json;
+
+	sendTcpModel(tcpModel);
+}
+
+
+void sendNursing() {
+    // 门灯控制
+	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);
+
+	sendTcpModel(tcpModel);
+}
+
+
+void sendNursingEnd() {
+	// 发送tcp, tcp_type = SIDE, tcp_action = NURSING_END
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d", TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::SIDE;
+	tcpModel.action = SideAction::NURSING_END;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.data = StoragePreferences::getString(STORE_NURSING_INTERACTION_ID, "");	// 获取nursingTcpModel里,id字段的数据
+
+	sendTcpModel(tcpModel);
+}
+
+void sendReinforceCall() {
+	TcpModel tcpModel;
+	tcpModel.type = TcpType::REINFORCE;
+	tcpModel.action = ReinforceAction::CALL;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.to_id = 0;
+	sendTcpModel(tcpModel);
+}
+
+void sendCallByDoor() {
+    // 发送tcp, tcp_type = VOICE, tcp_action = CANCEL_BY_DOOR
+	TcpModel tcpModel;
+	tcpModel.tid = base::format("t%d",TimeHelper::getCurrentTime());
+	tcpModel.type = TcpType::VOICE;
+	tcpModel.action = VoiceAction::CANCEL_BY_DOOR;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	sendTcpModel(tcpModel);
+}
+
+
+void sendBlueCodeCall() {
+	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);
+	sendTcpModel(tcpModel);
+}
+
+void sendBlueCodeResponse(std::string tid, std::string blueCodeId) {
+	TcpModel tcpModel;
+	tcpModel.tid = tid;
+	tcpModel.type = TcpType::BLUE_CODE;
+	tcpModel.action = BlueCodeAction::RESPONSE;
+	tcpModel.from_id = StoragePreferences::getInt(STORE_DEVICE_ID,0);
+	tcpModel.data = blueCodeId;
+
+	sendTcpModel(tcpModel);
+}
+

+ 25 - 0
jni/net/tcp_util.h

@@ -0,0 +1,25 @@
+/*
+ * tcp_util.h
+ *
+ *  Created on: 2024年7月18日
+ *      Author: m
+ */
+
+#ifndef JNI_NET_TCP_UTIL_H_
+#define JNI_NET_TCP_UTIL_H_
+
+void sendAuthLogin(std::string clerkNfc);
+void sendAuthLogout(std::string authItId);
+void sendSignIn(std::string clerkNfc);
+void sendPostionStart(std::string clerkNfc);
+void sendRoomCheckStart(std::string clerkNfc);
+void sendNursing();
+void sendNursingEnd();
+void sendReinforceCall();
+void sendCallByDoor();
+void sendBlueCodeCall();
+void sendBlueCodeResponse(std::string tid, std::string blueCodeId);
+
+
+
+#endif /* JNI_NET_TCP_UTIL_H_ */

+ 5 - 0
jni/service/BusinessConfig.h

@@ -13,6 +13,7 @@
 #include <atomic>
 #include "net/tcp_client.h"
 #include "net/tcp_model.h"
+#include "net/tcp_util.h"
 #include "core/utilities.h"
 #include <map>
 
@@ -202,6 +203,8 @@ std::string getClerkPassNo();
 void setClerk(std::string clerk_name, std::string pass_no, int _authItid);
 
 void nfcLogin(std::string revStr);
+void navibarNfcLogin(std::string revStr);
+void navibarNfcLogout();
 
 void systemRestart();
 
@@ -213,6 +216,8 @@ void setPartFrameTree(int index);
 void setRoomFrameTree(int index);
 void setBedFrameTree(int index);
 
+bool getClerkByPartIdAndPassNo(std::string passNo);
+
 enum CallFinishType {
 	CANCEL,
 	REJECT,

+ 13 - 3
jni/uart/UartContext.cpp

@@ -194,6 +194,8 @@ bool UartContext::threadLoop() {
 		unsigned char buffer[1024] = {0};
 		int ret = read(mUartID, buffer, sizeof(buffer));
 		if (ret > 0) {
+			LOGD("收到串口消息");
+
 			if (buffer[0]==CMD_HEAD && buffer[ret-2] == CMD_END1 && buffer[ret-1] == CMD_END2){
 				std::string revStr = "";
 				//std::string logInfo = " <<< ";
@@ -221,8 +223,16 @@ bool UartContext::threadLoop() {
                         revStr += buf;
                     }
                     LOGD("revStr == %s", revStr.c_str());
-                    nfcLogin(revStr);
+//                    nfcLogin(revStr);
+                    navibarNfcLogin(revStr);
+                }
+            }
+            else {
+                std::string revStr = "";
+                for (int i = 0; i < ret; ++i) {
+                	revStr += buffer[i];
                 }
+                LOGD("revStr == %s", revStr.c_str());
             }
 		} else {
 		  //没收到数据时,休眠50ms,防止过度消耗cpu
@@ -245,8 +255,8 @@ void UartContext::init() {
 //    uart0 = new UartContext(UART_TTYS0);
 //    uart0->openUart("/dev/ttyS0", B115200);
 
-//    uart1 = new UartContext(UART_TTYS1);
-//    uart1->openUart("/dev/ttyS1", B115200);
+    uart1 = new UartContext(UART_TTYS1);
+    uart1->openUart("/dev/ttyS1", B115200);
 
 	// 20221108的板子打开了串口2
     uart2 = new UartContext(UART_TTYS2);

BIN
libs/armeabi/libzkgui.so


BIN
obj/activity/deviceAddActivity.o


BIN
obj/activity/deviceInfoActivity.o


BIN
obj/activity/functionActivity.o


BIN
obj/activity/medicalCareActivity.o


BIN
obj/activity/navibar.o


BIN
obj/activity/startActivity.o


BIN
obj/net/tcp_util.o


BIN
obj/service/time.o


BIN
obj/uart/UartContext.o


BIN
resources/9/input.9.png


BIN
resources/button/elliptic_green_88x34.png


BIN
resources/button/elliptic_grey_88x34.png


BIN
resources/deviceAdd/l.png


BIN
resources/deviceAdd/tu.png


BIN
resources/deviceInfo/leixing.png


BIN
ui/deviceAdd.ftu


BIN
ui/deviceInfo.ftu


BIN
ui/navibar.ftu