deviceAddLogic.cc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. #pragma once
  2. #include "uart/ProtocolSender.h"
  3. #include "restclient-cpp/restclient.h"
  4. #include "service/BusinessConfig.h"
  5. #include "base/http_client.h"
  6. #include <string>
  7. /*
  8. *此文件由GUI工具生成
  9. *文件功能:用于处理用户的逻辑相应代码
  10. *功能说明:
  11. *========================onButtonClick_XXXX
  12. 当页面中的按键按下后系统会调用对应的函数,XXX代表GUI工具里面的[ID值]名称,
  13. 如Button1,当返回值为false的时候系统将不再处理这个按键,返回true的时候系统将会继续处理此按键。比如SYS_BACK.
  14. *========================onSlideWindowItemClick_XXXX(int index)
  15. 当页面中存在滑动窗口并且用户点击了滑动窗口的图标后系统会调用此函数,XXX代表GUI工具里面的[ID值]名称,
  16. 如slideWindow1;index 代表按下图标的偏移值
  17. *========================onSeekBarChange_XXXX(int progress)
  18. 当页面中存在滑动条并且用户改变了进度后系统会调用此函数,XXX代表GUI工具里面的[ID值]名称,
  19. 如SeekBar1;progress 代表当前的进度值
  20. *========================ogetListItemCount_XXXX()
  21. 当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表的总数目,XXX代表GUI工具里面的[ID值]名称,
  22. 如List1;返回值为当前列表的总条数
  23. *========================oobtainListItemData_XXXX(ZKListView::ZKListItem *pListItem, int index)
  24. 当页面中存在滑动列表的时候,更新的时候系统会调用此接口获取列表当前条目下的内容信息,XXX代表GUI工具里面的[ID值]名称,
  25. 如List1;pListItem 是贴图中的单条目对象,index是列表总目的偏移量。具体见函数说明
  26. *========================常用接口===============
  27. *LOGD(...) 打印调试信息的接口
  28. *mTextXXXPtr->setText("****") 在控件TextXXX上显示文字****
  29. *mButton1Ptr->setSelected(true); 将控件mButton1设置为选中模式,图片会切换成选中图片,按钮文字会切换为选中后的颜色
  30. *mSeekBarPtr->setProgress(12) 在控件mSeekBar上将进度调整到12
  31. *mListView1Ptr->refreshListView() 让mListView1 重新刷新,当列表数据变化后调用
  32. *mDashbroadView1Ptr->setTargetAngle(120) 在控件mDashbroadView1上指针显示角度调整到120度
  33. *
  34. * 在Eclipse编辑器中 使用 “alt + /” 快捷键可以打开智能提示
  35. */
  36. static int choiceDeviceInt = 0;
  37. static int choiceHospitalInt = 0;
  38. static int choicePartInt = 0;
  39. static int choiceRoomInt = 0;
  40. static int choiceBedInt = 0;
  41. Json::Value hospitalList;
  42. Json::Value hospitalFrameTree;
  43. Json::Value partFrameTree;
  44. Json::Value roomFrameTree;
  45. Json::Value bedFrameTree;
  46. Json::Value choicePart;
  47. Json::Value choiceRoom;
  48. Json::Value choiceBed;
  49. Json::Value addDevice;
  50. static string deviceMacMsg = "";
  51. static string mac = StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0");
  52. static void getHospital() {
  53. std::string url = getHttpGateway() + "/arrange/hospitals";
  54. LOGD("请求医院列表. url = %s", url.c_str());
  55. RestClient::Response r = RestClient::get(url);
  56. if (r.code != 200) {
  57. LOGD("请求医院列表-> 错误代码: %d", r.code);
  58. return;
  59. }
  60. LOGD("获得医院列表. result = %s", r.body.c_str());
  61. //解析json
  62. Json::Reader reader;
  63. Json::Value root;
  64. if(reader.parse(r.body, root, false)) {
  65. hospitalList = root;
  66. mHospitalListViewPtr->refreshListView();
  67. }
  68. }
  69. static void initFrame() {
  70. if (hospitalFrameTree.size() == 0) {
  71. return;
  72. }
  73. partFrameTree = hospitalFrameTree["frame_part_vos"];
  74. if (partFrameTree.size() == 0) {
  75. choicePart.clear();
  76. mChoicePartButtonPtr->setText("");
  77. return;
  78. }
  79. choicePart = partFrameTree[choicePartInt]["frame_part"];
  80. mChoicePartButtonPtr->setText(choicePart["full_name"].asString());
  81. addDevice["part_id"] = choicePart["part_id"];
  82. roomFrameTree = partFrameTree[choicePartInt]["frame_room_vos"];
  83. if (roomFrameTree.size() == 0) {
  84. choiceRoom.clear();
  85. mChoiceRoomButtonPtr->setText("");
  86. return;
  87. }
  88. choiceRoom = roomFrameTree[choiceRoomInt]["frame_room"];
  89. mChoiceRoomButtonPtr->setText(choiceRoom["full_name"].asString());
  90. if (choiceDeviceInt == 0) {
  91. addDevice["frame_id"] = choiceRoom["id"];
  92. LOGD("门口机注册空间id ===> %d", choiceRoom["id"].asInt());
  93. }
  94. else {
  95. bedFrameTree = roomFrameTree[choiceRoomInt]["frame_bed_list"];
  96. if (bedFrameTree.size() == 0) {
  97. choiceBed.clear();
  98. mChoiceBedButtonPtr->setText("");
  99. return;
  100. }
  101. choiceBed = bedFrameTree[choiceBedInt]["frame_bed"];
  102. addDevice["frame_id"] = choiceBed["id"];
  103. LOGD("手柄注册空间id ===> %d", choiceBed["id"].asInt());
  104. mChoiceBedButtonPtr->setText(choiceBed["full_name"].asString());
  105. }
  106. }
  107. static void getHospitalFrameTree(string hospitalId) {
  108. std::string url = getHttpGateway() + "/arrange/frame_hospital/" + hospitalId;
  109. LOGD("请求医院空间节点树状图. url = %s", url.c_str());
  110. RestClient::Response r = RestClient::get(url);
  111. if (r.code != 200) {
  112. LOGD("请求医院空间节点树状图-> 错误代码: %d", r.code);
  113. return;
  114. }
  115. LOGD("获得医院空间节点树状图. result = %s", r.body.c_str());
  116. //解析json
  117. Json::Reader reader;
  118. Json::Value root;
  119. if(reader.parse(r.body, root, false)) {
  120. hospitalFrameTree = root;
  121. initFrame();
  122. }
  123. }
  124. static void initHospital() {
  125. choicePartInt = 0;
  126. choiceRoomInt = 0;
  127. choiceBedInt = 0;
  128. if (choiceHospitalInt != 0 || hospitalFrameTree.size() == 0) {
  129. choiceHospitalInt = 0;
  130. mHospitalListViewPtr->refreshListView();
  131. getHospitalFrameTree(hospitalList[choiceHospitalInt]["shop_id"].asString());
  132. }
  133. else {
  134. initFrame();
  135. }
  136. }
  137. Json::Value getFrameTree(std::string frame) {
  138. if (frame == "getPartFrame") {
  139. return partFrameTree;
  140. }
  141. else if (frame == "getRoomFrame") {
  142. return roomFrameTree;
  143. }
  144. else if (frame == "getBedFrame") {
  145. return bedFrameTree;
  146. }
  147. Json::Value nullValue;
  148. return nullValue;
  149. }
  150. void setPartFrameTree(int index) {
  151. choicePartInt = index;
  152. choicePart = partFrameTree[choicePartInt]["frame_part"];
  153. mChoicePartButtonPtr->setText(choicePart["full_name"].asString());
  154. addDevice["part_id"] = choicePart["part_id"];
  155. roomFrameTree = partFrameTree[choicePartInt]["frame_room_vos"];
  156. setRoomFrameTree(0);
  157. }
  158. void setRoomFrameTree(int index) {
  159. choiceRoomInt = index;
  160. if (roomFrameTree.size() == 0) {
  161. choiceRoom.clear();
  162. mChoiceRoomButtonPtr->setText("");
  163. return;
  164. }
  165. choiceRoom = roomFrameTree[choiceRoomInt]["frame_room"];
  166. mChoiceRoomButtonPtr->setText(choiceRoom["full_name"].asString());
  167. if (choiceDeviceInt == 0) {
  168. addDevice["frame_id"] = choiceRoom["id"];
  169. LOGD("门口机注册空间id ===> %d", choiceRoom["id"].asInt());
  170. }
  171. else {
  172. bedFrameTree = roomFrameTree[choiceRoomInt]["frame_bed_list"];
  173. setBedFrameTree(0);
  174. }
  175. }
  176. void setBedFrameTree(int index) {
  177. choiceBedInt = index;
  178. if (bedFrameTree.size() == 0) {
  179. choiceBed.clear();
  180. mChoiceBedButtonPtr->setText("");
  181. return;
  182. }
  183. choiceBed = bedFrameTree[choiceBedInt]["frame_bed"];
  184. addDevice["frame_id"] = choiceBed["id"];
  185. LOGD("手柄注册空间id ===> %d", choiceBed["id"].asInt());
  186. mChoiceBedButtonPtr->setText(choiceBed["full_name"].asString());
  187. }
  188. void _addDevice() {
  189. string url = getHttpGateway() + "/arrange/linux_add_device";
  190. string content_type = std::string("application/json");
  191. Json::FastWriter writer;
  192. string data = writer.write(addDevice);
  193. LOGD("data =============> %s", data.c_str());
  194. LOGD("注册医院设备. url = %s", url.c_str());
  195. RestClient::Response r = RestClient::post(url, content_type, data);
  196. if (r.code != 200) {
  197. LOGD("注册医院设备-> 错误代码: %d", r.code);
  198. string errorMsg = LANGUAGEMANAGER->getValue("AddDeviceErrorMsg") + to_string(r.code);
  199. LOGD("r.body ===> %s", r.body.c_str());
  200. string error = "DEVICE_MAC_REPEAT";
  201. size_t pos = r.body.find(error);
  202. if (pos != std::string::npos) {
  203. errorMsg = LANGUAGEMANAGER->getValue("DEVICE_MAC_REPEAT");
  204. }
  205. error = "DEVICE_FRAME_FAILED";
  206. pos = r.body.find(error);
  207. if (pos != std::string::npos) {
  208. errorMsg = LANGUAGEMANAGER->getValue("DEVICE_FRAME_FAILED");
  209. }
  210. Intent* intent = new Intent();
  211. intent->putExtra(functionWindows, "warn");
  212. intent->putExtra(warnText, errorMsg);
  213. EASYUICONTEXT->openActivity("functionActivity", intent);
  214. return;
  215. }
  216. LOGD("注册医院设备. result = %s", r.body.c_str());
  217. //解析json
  218. Json::Reader reader;
  219. Json::Value root;
  220. if(reader.parse(r.body, root, false)) {
  221. Intent* intent = new Intent();
  222. intent->putExtra(functionWindows, "success");
  223. intent->putExtra(functionText, LANGUAGEMANAGER->getValue("AddDeviceSuccess"));
  224. EASYUICONTEXT->openActivity("functionActivity", intent);
  225. }
  226. }
  227. /**
  228. * 注册定时器
  229. * 填充数组用于注册定时器
  230. * 注意:id不能重复
  231. */
  232. static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  233. //{0, 6000}, //定时器id=0, 时间间隔6秒
  234. //{1, 1000},
  235. };
  236. /**
  237. * 当界面构造时触发
  238. */
  239. static void onUI_init(){
  240. //Tips :添加 UI初始化的显示代码到这里,如:mText1Ptr->setText("123");
  241. getHospital();
  242. mDeviceRadioGroupPtr->setCheckedID(ID_DEVICEADD_DeviceRadioButton1);
  243. choiceDeviceInt = 0;
  244. choiceHospitalInt = 0;
  245. choiceHospitalInt = 0;
  246. choicePartInt = 0;
  247. choiceRoomInt = 0;
  248. choiceBedInt = 0;
  249. }
  250. /**
  251. * 当切换到该界面时触发
  252. */
  253. static void onUI_intent(const Intent *intentPtr) {
  254. if (intentPtr != NULL) {
  255. //TODO
  256. }
  257. }
  258. /*
  259. * 当界面显示时触发
  260. */
  261. static void onUI_show() {
  262. EASYUICONTEXT->hideStatusBar();
  263. EASYUICONTEXT->hideNaviBar();
  264. }
  265. /*
  266. * 当界面隐藏时触发
  267. */
  268. static void onUI_hide() {
  269. }
  270. /*
  271. * 当界面完全退出时触发
  272. */
  273. static void onUI_quit() {
  274. }
  275. /**
  276. * 串口数据回调接口
  277. */
  278. static void onProtocolDataUpdate(const SProtocolData &data) {
  279. }
  280. /**
  281. * 定时器触发函数
  282. * 不建议在此函数中写耗时操作,否则将影响UI刷新
  283. * 参数: id
  284. * 当前所触发定时器的id,与注册时的id相同
  285. * 返回值: true
  286. * 继续运行当前定时器
  287. * false
  288. * 停止运行当前定时器
  289. */
  290. static bool onUI_Timer(int id){
  291. switch (id) {
  292. default:
  293. break;
  294. }
  295. return true;
  296. }
  297. /**
  298. * 有新的触摸事件时触发
  299. * 参数:ev
  300. * 新的触摸事件
  301. * 返回值:true
  302. * 表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
  303. * false
  304. * 触摸事件将继续传递到控件上
  305. */
  306. static bool ondeviceAddActivityTouchEvent(const MotionEvent &ev) {
  307. switch (ev.mActionStatus) {
  308. case MotionEvent::E_ACTION_DOWN://触摸按下
  309. //LOGD("时刻 = %ld 坐标 x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
  310. break;
  311. case MotionEvent::E_ACTION_MOVE://触摸滑动
  312. break;
  313. case MotionEvent::E_ACTION_UP: //触摸抬起
  314. break;
  315. default:
  316. break;
  317. }
  318. return false;
  319. }
  320. static bool onButtonClick_sys_back(ZKButton *pButton) {
  321. LOGD(" ButtonClick sys_back !!!\n");
  322. return false;
  323. }
  324. static void onCheckedChanged_DeviceRadioGroup(ZKRadioGroup* pRadioGroup, int checkedID) {
  325. LOGD(" RadioGroup DeviceRadioGroup checked %d", checkedID);
  326. switch(checkedID) {
  327. case ID_DEVICEADD_DeviceRadioButton1:
  328. choiceDeviceInt = 0;
  329. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac;
  330. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  331. mBedTextViewPtr->setVisible(false);
  332. mChoiceBedButtonPtr->setVisible(false);
  333. addDevice["device_type"] = 3;
  334. addDevice["name"] = LANGUAGEMANAGER->getValue("RoomDevice");
  335. addDevice["eth_mac"] = mac;
  336. addDevice["code"] = "SW10600101C-CM";
  337. addDevice["model"] = "linux_door";
  338. addDevice["soft_ver"] = "SV1.0";
  339. addDevice["hard_ver"] = "HV1.0";
  340. addDevice["status"] = 1;
  341. initHospital();
  342. break;
  343. case ID_DEVICEADD_DeviceRadioButton2:
  344. choiceDeviceInt = 1;
  345. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg2") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac + ":h1";
  346. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  347. mBedTextViewPtr->setVisible(true);
  348. mChoiceBedButtonPtr->setVisible(true);
  349. addDevice["device_type"] = 4;
  350. addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
  351. addDevice["eth_mac"] = mac + ":h1";
  352. addDevice["code"] = "SW10600101C-CM";
  353. addDevice["model"] = "linux_handle";
  354. addDevice["soft_ver"] = "SV1.0";
  355. addDevice["hard_ver"] = "HV1.0";
  356. addDevice["status"] = 1;
  357. initHospital();
  358. break;
  359. case ID_DEVICEADD_DeviceRadioButton3:
  360. choiceDeviceInt = 2;
  361. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg3") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac + ":h2";
  362. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  363. mBedTextViewPtr->setVisible(true);
  364. mChoiceBedButtonPtr->setVisible(true);
  365. addDevice["device_type"] = 4;
  366. addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
  367. addDevice["eth_mac"] = mac + ":h2";
  368. addDevice["code"] = "SW10600101C-CM";
  369. addDevice["model"] = "linux_handle";
  370. addDevice["soft_ver"] = "SV1.0";
  371. addDevice["hard_ver"] = "HV1.0";
  372. addDevice["status"] = 1;
  373. initHospital();
  374. break;
  375. case ID_DEVICEADD_DeviceRadioButton4:
  376. choiceDeviceInt = 3;
  377. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg4") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac + ":h3";
  378. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  379. mBedTextViewPtr->setVisible(true);
  380. mChoiceBedButtonPtr->setVisible(true);
  381. addDevice["device_type"] = 4;
  382. addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
  383. addDevice["eth_mac"] = mac + ":h3";
  384. addDevice["code"] = "SW10600101C-CM";
  385. addDevice["model"] = "linux_handle";
  386. addDevice["soft_ver"] = "SV1.0";
  387. addDevice["hard_ver"] = "HV1.0";
  388. addDevice["status"] = 1;
  389. initHospital();
  390. break;
  391. case ID_DEVICEADD_DeviceRadioButton5:
  392. choiceDeviceInt = 4;
  393. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg5") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac + ":h4";
  394. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  395. mBedTextViewPtr->setVisible(true);
  396. mChoiceBedButtonPtr->setVisible(true);
  397. addDevice["device_type"] = 4;
  398. addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
  399. addDevice["eth_mac"] = mac + ":h4";
  400. addDevice["code"] = "SW10600101C-CM";
  401. addDevice["model"] = "linux_handle";
  402. addDevice["soft_ver"] = "SV1.0";
  403. addDevice["hard_ver"] = "HV1.0";
  404. addDevice["status"] = 1;
  405. initHospital();
  406. break;
  407. case ID_DEVICEADD_DeviceRadioButton6:
  408. choiceDeviceInt = 4;
  409. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg6") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac + ":h5";
  410. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  411. mBedTextViewPtr->setVisible(true);
  412. mChoiceBedButtonPtr->setVisible(true);
  413. addDevice["device_type"] = 4;
  414. addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
  415. addDevice["eth_mac"] = mac + ":h5";
  416. addDevice["code"] = "SW10600101C-CM";
  417. addDevice["model"] = "linux_handle";
  418. addDevice["soft_ver"] = "SV1.0";
  419. addDevice["hard_ver"] = "HV1.0";
  420. addDevice["status"] = 1;
  421. initHospital();
  422. break;
  423. case ID_DEVICEADD_DeviceRadioButton7:
  424. choiceDeviceInt = 4;
  425. deviceMacMsg = LANGUAGEMANAGER->getValue("DeviceAddMsg7") + " \n" + LANGUAGEMANAGER->getValue("DeviceAddMsgId") + mac + ":h6";
  426. mDeviceMacTextViewPtr->setText(deviceMacMsg);
  427. mBedTextViewPtr->setVisible(true);
  428. mChoiceBedButtonPtr->setVisible(true);
  429. addDevice["device_type"] = 4;
  430. addDevice["name"] = LANGUAGEMANAGER->getValue("BedDevice");
  431. addDevice["eth_mac"] = mac + ":h6";
  432. addDevice["code"] = "SW10600101C-CM";
  433. addDevice["model"] = "linux_handle";
  434. addDevice["soft_ver"] = "SV1.0";
  435. addDevice["hard_ver"] = "HV1.0";
  436. addDevice["status"] = 1;
  437. initHospital();
  438. break;
  439. }
  440. }
  441. static int getListItemCount_HospitalListView(const ZKListView *pListView) {
  442. //LOGD("getListItemCount_HospitalListView !\n");
  443. return hospitalList.size();
  444. }
  445. static void obtainListItemData_HospitalListView(ZKListView *pListView,ZKListView::ZKListItem *pListItem, int index) {
  446. //LOGD(" obtainListItemData_ HospitalListView !!!\n");
  447. if (hospitalList.size() == 0) {
  448. return;
  449. }
  450. pListItem->setText(hospitalList[index]["full_name"].asString());
  451. if (choiceHospitalInt == index) {
  452. pListItem->setSelected(true);
  453. }
  454. else {
  455. pListItem->setSelected(false);
  456. }
  457. }
  458. static void onListItemClick_HospitalListView(ZKListView *pListView, int index, int id) {
  459. //LOGD(" onListItemClick_ HospitalListView !!!\n");
  460. if (choiceHospitalInt != index) {
  461. choiceHospitalInt = index;
  462. getHospitalFrameTree(hospitalList[choiceHospitalInt]["shop_id"].asString());
  463. }
  464. }
  465. static bool onButtonClick_ChoicePartButton(ZKButton *pButton) {
  466. LOGD(" ButtonClick ChoicePartButton !!!\n");
  467. Intent* intent = new Intent();
  468. intent->putExtra(functionWindows, "getPartFrame");
  469. EASYUICONTEXT->openActivity("functionActivity", intent);
  470. return false;
  471. }
  472. static bool onButtonClick_ChoiceRoomButton(ZKButton *pButton) {
  473. LOGD(" ButtonClick ChoiceRoomButton !!!\n");
  474. Intent* intent = new Intent();
  475. intent->putExtra(functionWindows, "getRoomFrame");
  476. EASYUICONTEXT->openActivity("functionActivity", intent);
  477. return false;
  478. }
  479. static bool onButtonClick_ChoiceBedButton(ZKButton *pButton) {
  480. LOGD(" ButtonClick ChoiceBedButton !!!\n");
  481. Intent* intent = new Intent();
  482. intent->putExtra(functionWindows, "getBedFrame");
  483. EASYUICONTEXT->openActivity("functionActivity", intent);
  484. return false;
  485. }
  486. static bool onButtonClick_ConfirmButton(ZKButton *pButton) {
  487. LOGD(" ButtonClick ConfirmButton !!!\n");
  488. if (addDevice.isMember("frame_id")) {
  489. _addDevice();
  490. }
  491. else {
  492. Intent* intent = new Intent();
  493. intent->putExtra(functionWindows, "warn");
  494. intent->putExtra(warnText, LANGUAGEMANAGER->getValue("AddDeviceFrameFailed"));
  495. EASYUICONTEXT->openActivity("functionActivity", intent);
  496. }
  497. return false;
  498. }
  499. static bool onButtonClick_RebootButton(ZKButton *pButton) {
  500. LOGD(" ButtonClick RebootButton !!!\n");
  501. Intent* intent = new Intent();
  502. intent->putExtra(functionWindows, "reboot");
  503. EASYUICONTEXT->openActivity("functionActivity", intent);
  504. return false;
  505. }