|
@@ -43,10 +43,59 @@ static string _functionText;
|
|
|
static string _nursingText;
|
|
|
static string _warnText;
|
|
|
static string _goActivity;
|
|
|
+static int functionThemeInt = defaultThemeInt;
|
|
|
+static uint32_t functionColor = buleDeepColour;
|
|
|
+static bool isNetreset = false;
|
|
|
+static int netresetInt = 0;
|
|
|
|
|
|
static base::MediaPlayer mediaPlayer;
|
|
|
|
|
|
-#define FUNCTION_TIMER_HANDLE 3 // 增援的定时器id
|
|
|
+#define FUNCTION_TIMER_HANDLE 3 // 功能模块的定时器id
|
|
|
+#define NETRESET_TIMER_HANDLE 101
|
|
|
+
|
|
|
+void setFunctionTheme() {
|
|
|
+ functionThemeInt = StoragePreferences::getInt(STORE_THEME, defaultThemeInt);
|
|
|
+ if (functionThemeInt == 1) {
|
|
|
+ mCallBedPicPainterPtr->setBackgroundPic("/function/chuangwei.png");
|
|
|
+ mConfirmCallButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule.png");
|
|
|
+ mConfirmLogoutButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
+ mLogoutPicPainterPtr->setBackgroundPic("/medicalCare/dianhua.png");
|
|
|
+ mPwdPainterPtr->setBackgroundPic("/medicalCare/dianhua.png");
|
|
|
+ mPwdEditTextPtr->setBackgroundPic("/function/input.png");
|
|
|
+ mPwdConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
+ mServerPainterPtr->setBackgroundPic("/medicalCare/dianhua.png");
|
|
|
+ mServerIpEditTextPtr->setBackgroundPic("/function/input.png");
|
|
|
+ mServerPortEditTextPtr->setBackgroundPic("/function/input.png");
|
|
|
+ mServerConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
+ mRebootPowerButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
+ mRebootDeviceButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
+ mRebootLineButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ functionColor = buleDeepColour;
|
|
|
+ }
|
|
|
+ else if (functionThemeInt == 2) {
|
|
|
+ mCallBedPicPainterPtr->setBackgroundPic("/function/chuangwei-pink.png");
|
|
|
+ mConfirmCallButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink.png");
|
|
|
+ mConfirmLogoutButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
+ mLogoutPicPainterPtr->setBackgroundPic("/medicalCare/dianhua-pink.png");
|
|
|
+ mPwdPainterPtr->setBackgroundPic("/medicalCare/dianhua-pink.png");
|
|
|
+ mPwdEditTextPtr->setBackgroundPic("/function/input-pink.png");
|
|
|
+ mPwdConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
+ mServerPainterPtr->setBackgroundPic("/medicalCare/dianhua-pink.png");
|
|
|
+ mServerIpEditTextPtr->setBackgroundPic("/function/input-pink.png");
|
|
|
+ mServerPortEditTextPtr->setBackgroundPic("/function/input-pink.png");
|
|
|
+ mServerConfirmButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
+ mRebootPowerButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
+ mRebootDeviceButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
+ mRebootLineButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
+//
|
|
|
+
|
|
|
+ functionColor = redDeepColour;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
@@ -72,10 +121,16 @@ static void callBed() {
|
|
|
|
|
|
|
|
|
static void help() {
|
|
|
- mIconPainterPtr->setBackgroundPic("icon/zengyuan2.png");
|
|
|
+ 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(LANGUAGEMANAGER->getValue("HelpInfo"));
|
|
|
mStateTextViewPtr->setVisible(false);
|
|
|
- mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_bule2.png");
|
|
|
mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
|
|
|
mFunctionWindowPtr->showWnd();
|
|
|
|
|
@@ -134,7 +189,7 @@ void nursing(string functionText, string nursingText) {
|
|
|
mFunctionTextViewPtr->setText(functionText);
|
|
|
mStateTextViewPtr->setVisible(true);
|
|
|
mStateTextViewPtr->setText(nursingText + " " + LANGUAGEMANAGER->getValue("SetNursingMsg"));
|
|
|
- mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink.png");
|
|
|
+ mFunctionButtonPtr->setButtonStatusPic(ZK_CONTROL_STATUS_NORMAL, "button/elliptic_pink2.png");
|
|
|
mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Nursing"));
|
|
|
mFunctionWindowPtr->showWnd();
|
|
|
}
|
|
@@ -162,6 +217,27 @@ void pwdWindowInfo() {
|
|
|
mPwdPromptTextViewPtr->setTextColor(0xFF000000);
|
|
|
}
|
|
|
|
|
|
+void theme(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");
|
|
|
+ }
|
|
|
+ if (functionText == "蓝色") {
|
|
|
+ mFunctionTextViewPtr->setText(LANGUAGEMANAGER->getValue("ThemeBlue"));
|
|
|
+ }
|
|
|
+ else if (functionText == "红色") {
|
|
|
+ mFunctionTextViewPtr->setText(LANGUAGEMANAGER->getValue("ThemeRed"));
|
|
|
+ }
|
|
|
+ mStateTextViewPtr->setVisible(true);
|
|
|
+ mStateTextViewPtr->setText(LANGUAGEMANAGER->getValue("ThemeConfirm"));
|
|
|
+ mFunctionButtonPtr->setText(LANGUAGEMANAGER->getValue("Confirm"));
|
|
|
+ mFunctionWindowPtr->showWnd();
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -237,9 +313,14 @@ static void onUI_intent(const Intent *intentPtr) {
|
|
|
}
|
|
|
else if (_functionWindows == "serverChange" ||
|
|
|
_functionWindows == "setting" ||
|
|
|
- _functionWindows == "init") {
|
|
|
+ _functionWindows == "init" ||
|
|
|
+ _functionWindows == "reboot") {
|
|
|
pwdWindowInfo();
|
|
|
}
|
|
|
+ else if (_functionWindows == "theme") {
|
|
|
+ _functionText = intentPtr->getExtra(functionText);
|
|
|
+ theme(_functionText);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -247,6 +328,9 @@ static void onUI_intent(const Intent *intentPtr) {
|
|
|
* 当界面显示时触发
|
|
|
*/
|
|
|
static void onUI_show() {
|
|
|
+ EASYUICONTEXT->hideStatusBar();
|
|
|
+ EASYUICONTEXT->hideNaviBar();
|
|
|
+ setFunctionTheme();
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -290,6 +374,16 @@ static bool onUI_Timer(int id){
|
|
|
EASYUICONTEXT->closeActivity("functionActivity");
|
|
|
return false;
|
|
|
break;
|
|
|
+ case NETRESET_TIMER_HANDLE:
|
|
|
+ netresetInt += 1;
|
|
|
+ lightControl("NETRESET", "1F");
|
|
|
+
|
|
|
+ if (netresetInt == 15) {
|
|
|
+ //重启
|
|
|
+ sync();
|
|
|
+ reboot(RB_AUTOBOOT);
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -330,6 +424,13 @@ static int getListItemCount_CallBedListView(const ZKListView *pListView) {
|
|
|
|
|
|
static void obtainListItemData_CallBedListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
|
|
|
//LOGD(" obtainListItemData_ CallBedListView !!!\n");
|
|
|
+ if (functionThemeInt == 1) {
|
|
|
+ pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_SELECTED, "/function/chooseBed.png");
|
|
|
+ }
|
|
|
+ else if (functionThemeInt == 2) {
|
|
|
+ pListItem->setButtonStatusPic(ZK_CONTROL_STATUS_SELECTED, "/function/chooseBed-pink.png");
|
|
|
+ }
|
|
|
+ pListItem->setTextStatusColor(ZK_CONTROL_STATUS_SELECTED, functionColor);
|
|
|
|
|
|
if (bedList.size() > 0) {
|
|
|
string frameBedName = bedList[index]["frame_bed"]["full_name"].asString();
|
|
@@ -412,6 +513,16 @@ static bool onButtonClick_FunctionButton(ZKButton *pButton) {
|
|
|
else if (_functionWindows == "nursingEnd") {
|
|
|
setNursing(false);
|
|
|
}
|
|
|
+ else if (_functionWindows == "theme") {
|
|
|
+ if (_functionText == "蓝色") {
|
|
|
+ StoragePreferences::putInt(STORE_THEME, 1);
|
|
|
+ }
|
|
|
+ else if (_functionText == "红色") {
|
|
|
+ StoragePreferences::putInt(STORE_THEME, 2);
|
|
|
+ }
|
|
|
+ sync();
|
|
|
+ reboot(RB_AUTOBOOT);
|
|
|
+ }
|
|
|
|
|
|
EASYUICONTEXT->closeActivity("functionActivity");
|
|
|
return false;
|
|
@@ -500,6 +611,20 @@ static bool onButtonClick_PwdConfirmButton(ZKButton *pButton) {
|
|
|
mPwdPromptTextViewPtr->setTextColor(0xFFFF0000);
|
|
|
}
|
|
|
}
|
|
|
+ else if (_functionWindows == "reboot") {
|
|
|
+
|
|
|
+ // 密码为888
|
|
|
+ string cpwd = "888";
|
|
|
+ if (pwd == cpwd){
|
|
|
+ // 关闭密码输入界面
|
|
|
+ mPwdWindowPtr->hideWnd();
|
|
|
+ // 打开初始化界面
|
|
|
+ mRebootWindowPtr->showWnd();
|
|
|
+ } else {
|
|
|
+ mPwdPromptTextViewPtr->setTextTr("PasswordWrong");
|
|
|
+ mPwdPromptTextViewPtr->setTextColor(0xFFFF0000);
|
|
|
+ }
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -551,3 +676,39 @@ static bool onButtonClick_ServerCancelButton(ZKButton *pButton) {
|
|
|
EASYUICONTEXT->closeActivity("functionActivity");
|
|
|
return false;
|
|
|
}
|
|
|
+static bool onButtonClick_RebootDeviceButton(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick RebootDeviceButton !!!\n");
|
|
|
+ const char* req = "-1";
|
|
|
+ TcpClient::instance()->sendMsg(req);
|
|
|
+
|
|
|
+ lightControl("CALLLED", "000F");
|
|
|
+ //重启
|
|
|
+ sync();
|
|
|
+ reboot(RB_AUTOBOOT);
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+static bool onButtonClick_RebootPowerButton(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick RebootPowerButton !!!\n");
|
|
|
+ if (!isNetreset) {
|
|
|
+ isNetreset = true;
|
|
|
+ lightControl("CALLLED", "000F");
|
|
|
+ mActivityPtr->registerUserTimer(NETRESET_TIMER_HANDLE, 1000);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+static bool onButtonClick_RebootLineButton(ZKButton *pButton) {
|
|
|
+ LOGD(" ButtonClick RebootLineButton !!!\n");
|
|
|
+ TcpModel tcpModel;
|
|
|
+ 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());
|
|
|
+
|
|
|
+ TcpClient::instance()->sendMsg(req.c_str());
|
|
|
+ return false;
|
|
|
+}
|