|
@@ -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;
|
|
|
+}
|