startLogic.cc 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. #pragma once
  2. #include "uart/ProtocolSender.h"
  3. #include "uart/UartContext.h"
  4. #include "core/utilities.h"
  5. #include "edge/call_log.h"
  6. #include "net/tcp_client.h"
  7. #include "net/tcp_model.h"
  8. #include "server/http_server.h"
  9. #include "base/strings.hpp"
  10. #include "utils/GpioHelper.h"
  11. #include "utils/TimeHelper.h"
  12. #include "utils/BrightnessHelper.h"
  13. #include <time.h>
  14. #include <thread>
  15. #include <string>
  16. #include <unistd.h>
  17. #include <sys/reboot.h>
  18. #include "service/BusinessConfig.h"
  19. static bool sosTimerRegistered = true;
  20. static bool isSleepTimerRegistered = false; // 是否开启息屏定时任务
  21. static bool isSleep = false; // 是否在息屏
  22. static bool isNursing = false; // 用于启动时判断是否处于护理状态
  23. static bool isNetreset = false;
  24. static int netresetInt = 0;
  25. static string callTid = "";
  26. static bool isConnectHandle = false;
  27. static bool isConnectSos = false;
  28. static bool isConnectHandle1 = false;
  29. static bool isConnectHandle2 = false;
  30. static bool isConnectHandle3 = false;
  31. static bool isConnectHandle4 = false;
  32. static bool isTriggerHandle = false;
  33. static bool isTriggerSos = false;
  34. static bool isTriggerHandle1 = false;
  35. static bool isTriggerHandle2 = false;
  36. static bool isTriggerHandle3 = false;
  37. static bool isTriggerHandle4 = false;
  38. #define FUNCTION_TIMER_HANDLE 3 // 增援的定时器id
  39. #define SOS_CLICK_TIME_HANDLE 4 // sos的定时器id
  40. #define SOS_LAMP_TIME_HANDLE 5 // sos的门灯定时器id
  41. #define EVENT_TIME_HANDLE 8 // 事件定时器
  42. #define SLEEP_STRAT_TIME_HANDLE 9 // 息屏
  43. #define SYS_RESTART_TIME_HANDLE 10 // 重启
  44. #define PROMPT_TIME_HANDLE 11 // 提示语
  45. #define HANDLE_TRIGGER_TIME_HANDLE 15
  46. #define SOS_TRIGGER_TIME_HANDLE 16
  47. #define HANDLE1_TRIGGER_TIME_HANDLE 17
  48. #define HANDLE2_TRIGGER_TIME_HANDLE 18
  49. #define HANDLE3_TRIGGER_TIME_HANDLE 19
  50. #define HANDLE4_TRIGGER_TIME_HANDLE 20
  51. #define HTTP_SERVER_PORT 80
  52. srv::HttpServer httpServer;
  53. namespace {
  54. std::string uilogic[] = {
  55. "testActivity",
  56. "ui3Activity"
  57. };
  58. void CloseUi();
  59. int feed_dogs = 0;
  60. void PrintCallLog() {
  61. CallLogEntries entries;
  62. int ret = GetCallLog(&entries);
  63. LOGD("GetCallRecord %d", ret);
  64. for (auto r : entries) {
  65. LOGD("id=%d, uri=%s, contact=%s,duration=%d,created_at=%d",
  66. r.id, r.uri.c_str(), r.contact.c_str(), r.duration, r.created_at);
  67. }
  68. }
  69. void OnCallStateChanged(voip::Telephone* telephone, int call_id, voip::State state) {
  70. LOGD("call state = %d", state);
  71. if (state == voip::STATE_CALL_INCOMING
  72. || state == voip::STATE_CALL_CALLING
  73. || state == voip::STATE_CALL_CONFIRMED) {
  74. voip::CallInfo info = GetTelephone()->GetCallInfo();
  75. LOGD("info.id == %d", info.id);
  76. LOGD("info.remote_uri == %s", info.remote_uri.c_str());
  77. LOGD("info.remote_contact == %s", info.remote_contact.c_str());
  78. string sipId = info.remote_uri.substr(info.remote_uri.find(":") + 1, info.remote_uri.find("@") - info.remote_uri.find(":") - 1);
  79. LOGD("sipId == %s", sipId.c_str());
  80. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  81. EASYUICONTEXT->openActivity("callActivity");
  82. }
  83. else {
  84. if (sipId != "0000000000") {
  85. const char* currentAppName = EASYUICONTEXT->currentAppName();
  86. string _currentAppName = currentAppName;
  87. if (_currentAppName != "callActivity") {
  88. telephone->Hangup();
  89. LOGD("=================> 不在通话界面,直接挂断!");
  90. return;
  91. }
  92. }
  93. }
  94. if (state == voip::STATE_CALL_INCOMING) {
  95. if (telephone->GetCallCount() > 1) {
  96. LOGD("call count > 1, return");
  97. telephone->Hangup(call_id, voip::SIP_STATUS_CODE_BUSY_HERE);
  98. return;
  99. }
  100. //提前显示视频
  101. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  102. telephone->Answer(call_id, voip::SIP_STATUS_CODE_PROGRESS);
  103. telephone->Answer();
  104. } else {
  105. acceptSIP();
  106. }
  107. }
  108. }
  109. if (state == voip::STATE_CALL_DISCONNECTED) {
  110. LOGD("通话挂断");
  111. if (telephone->GetCallCount() > 1) {
  112. LOGD("call count > 1, return");
  113. return;
  114. }
  115. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  116. //EASYUICONTEXT->goHome();
  117. EASYUICONTEXT->goBack();
  118. }
  119. //保存通话记录
  120. voip::CallInfo info = telephone->GetCallInfo(call_id);
  121. CallLogEntry entry;
  122. entry.uri = info.remote_uri;
  123. entry.contact = info.remote_contact;
  124. entry.duration = info.duration/1000;
  125. if (0 != PutCallLog(entry)) {
  126. LOGE("保存通话记录失败");
  127. }
  128. int n = GetCallLogCount();
  129. if (n > CALL_LOG_COUNT_MAX) {
  130. //超过最大通话记录条数,删除旧记录
  131. if (0 != DeleteOldCallLog(n - CALL_LOG_COUNT_MAX)) {
  132. LOGE("删除失败");
  133. }
  134. }
  135. const char* currentAppName = EASYUICONTEXT->currentAppName();
  136. string _currentAppName = currentAppName;
  137. if (_currentAppName == "callActivity") {
  138. callActivityFinish(HANDOFF);
  139. return;
  140. }
  141. //PrintCallLog();
  142. }
  143. }
  144. void CloseUi() {
  145. for(int i = 0; i < 2; i++){
  146. EASYUICONTEXT->closeActivity(uilogic[i].c_str());
  147. }
  148. }
  149. void setBrightness(){
  150. int dayLight = StoragePreferences::getInt(STORE_DAY_LIGHT,100);
  151. int nightLight = StoragePreferences::getInt(STORE_NIGHT_LIGHT,10);
  152. if (checkIsDay()){
  153. BRIGHTNESSHELPER->setBrightness(dayLight);
  154. } else {
  155. BRIGHTNESSHELPER->setBrightness(nightLight);
  156. }
  157. }
  158. }
  159. void systemRestart() {
  160. if (!isNetreset) {
  161. isNetreset = true;
  162. lightControl("CALLLED", "000F");
  163. mActivityPtr->registerUserTimer(SYS_RESTART_TIME_HANDLE, 1000);
  164. }
  165. }
  166. // 门灯还原
  167. void lightControl(std::string typeStr, std::string lightColorStr) {
  168. // 类型是门灯,并且还原成白色灯
  169. std::string heartStr;
  170. if (typeStr == "DOORLED" && lightColorStr == "000F") {
  171. //护理状态,需要还原成护理灯
  172. if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {
  173. std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
  174. if (color != "" && color.size() == 3) {
  175. heartStr = "DOORLED," + color + "F";
  176. } else {
  177. heartStr = "DOORLED,010F";
  178. }
  179. }
  180. else {
  181. // 还原成无灯光的状态
  182. heartStr = "DOORLED,000F";
  183. }
  184. } else {
  185. heartStr = typeStr + "," + lightColorStr;
  186. }
  187. LOGD("=====> the heartStr == %s", heartStr.c_str());
  188. const char* sendMsg = heartStr.c_str();
  189. sendProtocolTo(UART_TTYS2, (byte*)(sendMsg), strlen(sendMsg));
  190. }
  191. // 接收tcp消息
  192. void handleMsg(byte* inBytes){
  193. LOGD("TCP received: %s", inBytes);
  194. const char* cstr = reinterpret_cast<const char*>(inBytes);
  195. string str = cstr;
  196. if (str == "1"){
  197. LOGD("get a heart beat");
  198. return;
  199. }
  200. TcpModel tcpModel;
  201. tcpModel = getTcpModel(inBytes);
  202. LOGD("tcp model: %s, %s", tcpModel.type.c_str(), tcpModel.action.c_str());
  203. if (tcpModel.type == TcpType::OTHER) {
  204. LOGD("trans tcp json failed");
  205. } else if (tcpModel.type == TcpType::TIME) {
  206. if (tcpModel.action == TimeAction::SYNC) {
  207. string serverTime = "";
  208. if (tcpModel.data != ""){
  209. serverTime = tcpModel.data;
  210. } else {
  211. serverTime = tcpModel.json["time"].asString();
  212. }
  213. LOGD("sync time : %s", serverTime.c_str());
  214. time_t timet = stoi(serverTime);
  215. struct tm *t = gmtime(&timet);
  216. char pDate[25];
  217. sprintf(pDate,"%d-%02d-%02d %02d:%02d:%02d",
  218. 1900 + t->tm_year, 1+ t->tm_mon, t->tm_mday,
  219. t->tm_hour + 8,t->tm_min,t->tm_sec);
  220. LOGD("transfered time : %s", pDate);
  221. TimeHelper::setDateTime(pDate);
  222. dataRefresh();
  223. if (isNursing) {
  224. setNursingEnd();
  225. }
  226. }
  227. } else if (tcpModel.type == TcpType::REINFORCE){
  228. if (tcpModel.action == ReinforceAction::RESPONSED){
  229. //回调
  230. TcpCallback callback = TcpCacheManager::instance()->getFunc(tcpModel.tid);
  231. if (callback.tid != "0"){
  232. callback.onSuccess(tcpModel.json);
  233. }
  234. const char* currentAppName = EASYUICONTEXT->currentAppName();
  235. string _currentAppName = currentAppName;
  236. if (_currentAppName != "functionActivity") {
  237. Intent* intent = new Intent();
  238. intent->putExtra(functionWindows, "helpResonse");
  239. EASYUICONTEXT->openActivity("functionActivity", intent);
  240. } else {
  241. toFunctionActivity("");
  242. }
  243. }
  244. } else if (tcpModel.type == TcpType::DEVICE){
  245. if (tcpModel.action == DeviceAction::APP_UPDATE){ //软件升级
  246. if (isSleep) {
  247. isSleep = false;
  248. BRIGHTNESSHELPER->screenOn();
  249. }
  250. Intent* intent = new Intent();
  251. intent->putExtra(appUpdate, "true");
  252. EASYUICONTEXT->openActivity("updateActivity", intent);
  253. }
  254. else if (tcpModel.action == DeviceAction::RESTART) { // 重启设备
  255. const char* req = "-1";
  256. TcpClient::instance()->sendMsg(req);
  257. lightControl("CALLLED", "000F");
  258. sync();
  259. reboot(RB_AUTOBOOT);
  260. }
  261. else if (tcpModel.action == DeviceAction::REBOOT) {
  262. const char* req = "-1";
  263. TcpClient::instance()->sendMsg(req);
  264. lightControl("CALLLED", "000F");
  265. //重启
  266. sync();
  267. reboot(RB_AUTOBOOT);
  268. }
  269. else if (tcpModel.action == DeviceAction::DEVICE_REFRESH) { // 设备刷新
  270. dataRefresh();
  271. }
  272. else if (tcpModel.action == DeviceAction::SYSTEM_SETTING) { // 修改科室设置
  273. getPartSetting();
  274. }
  275. else if (tcpModel.action == DeviceAction::SERVER_CHANGE) {
  276. StoragePreferences::putString(STORE_GATEWAY, tcpModel.json["server_ip"].asCString());
  277. StoragePreferences::putString(STORE_HTTP_PORT, tcpModel.json["server_port"].asCString());
  278. const char* req = "-1";
  279. TcpClient::instance()->sendMsg(req);
  280. lightControl("CALLLED", "000F");
  281. //重启
  282. sync();
  283. reboot(RB_AUTOBOOT);
  284. }
  285. } else if (tcpModel.type == TcpType::DATA){
  286. if (tcpModel.action == DataAction::REFRESH){ // 刷新数据
  287. dataRefresh();
  288. }
  289. } else if (tcpModel.type == TcpType::VOICE){
  290. if (tcpModel.action == VoiceAction::FAILED){
  291. const char* currentAppName = EASYUICONTEXT->currentAppName();
  292. string _currentAppName = currentAppName;
  293. if (_currentAppName == "callActivity") {
  294. callActivityFinish(CallFinishType::FAILED);
  295. }
  296. } else if (tcpModel.action == VoiceAction::SUCCESS){
  297. CallingStatus::instance()->setTcpModel(tcpModel); // 只有呼叫成功才闪红灯
  298. lightControl("DOORLED", "200F");
  299. } else if (tcpModel.action == VoiceAction::ACCEPT){
  300. if (CallingStatus::instance()->busy()){
  301. CallingStatus::instance()->setTcpModel(tcpModel);
  302. std::string toSipId = tcpModel.json["toSipId"].asString();
  303. callActivityFinish(CallFinishType::ACCEPT);
  304. //接听
  305. buildSIP(toSipId);
  306. }
  307. // 进行门灯还原
  308. lightControl("DOORLED", "000F");
  309. } else if (tcpModel.action == VoiceAction::REJECT){
  310. if (CallingStatus::instance()->busy()){
  311. callActivityFinish(CallFinishType::REJECT);
  312. // 进行门灯还原
  313. lightControl("DOORLED", "000F");
  314. }
  315. } else if (tcpModel.action == VoiceAction::CANCEL){
  316. if (CallingStatus::instance()->busy()){
  317. callActivityFinish(CallFinishType::CANCEL);
  318. }
  319. } else if (tcpModel.action == VoiceAction::CALLING){
  320. //对方忙线
  321. callActivityFinish(CallFinishType::BUSY);
  322. } else if (tcpModel.action == VoiceAction::CALL){
  323. //我方忙线判断
  324. if (CallingStatus::instance()->busy()){
  325. sendVoiceTcp(VoiceAction::CALLING, tcpModel, tcpModel.from_id);
  326. } else {
  327. CallingStatus::instance()->setTcpModel(tcpModel);
  328. //来电话了
  329. Intent* intent = new Intent();
  330. intent->putExtra(isOutgoing, "false");
  331. EASYUICONTEXT->openActivity("callActivity", intent);
  332. }
  333. } else if (tcpModel.action == VoiceAction::HANDOFF){
  334. //判断 是否同一个对话
  335. long iId = CallingStatus::instance()->getInteractionId();
  336. if (iId > 0 && CallingStatus::instance()->busy()){
  337. long inId = tcpModel.json["id"].asInt();
  338. if (iId == inId && CallingStatus::instance()->busy()){
  339. callActivityFinish(CallFinishType::HANDOFF);
  340. }
  341. }
  342. }
  343. }
  344. else if (tcpModel.type == TcpType::SOS) {
  345. if (tcpModel.action == SosAction::CANCEL) {
  346. // SOS还原成无灯光的状态
  347. lightControl("ULED", "0F");
  348. // 进行门灯还原
  349. lightControl("DOORLED", "000F");
  350. mActivityPtr->unregisterUserTimer(SOS_LAMP_TIME_HANDLE);
  351. }
  352. }
  353. else if (tcpModel.type == TcpType::SIDE) {
  354. if (tcpModel.action == SideAction::NURSING) {
  355. StoragePreferences::putString(STORE_NURSING_INTERACTION_ID, tcpModel.json["id"].asString());
  356. // 收到nursing,需要把通话给挂断了
  357. voip::CallInfo info = GetTelephone()->GetCallInfo();
  358. LOGD("info state = %d",info.state);
  359. if (info.state == voip::STATE_CALL_CALLING
  360. || info.state == voip::STATE_CALL_CALLING
  361. || info.state == voip::STATE_CALL_CONFIRMED){
  362. TcpModel storeModel = CallingStatus::instance()->getTcpModel();
  363. //只回传iId
  364. storeModel.data = storeModel.json["id"].asString();
  365. sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
  366. GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
  367. GetTelephone()->Hangup();
  368. EASYUICONTEXT->goBack();
  369. }
  370. std::string color = StoragePreferences::getString(STORE_NURSING_COLOR_RGB, "010");
  371. if (color != "" && color.size() == 3) {
  372. color = color + "F";
  373. } else {
  374. color = "010F";
  375. }
  376. lightControl("DOORLED", color);
  377. }
  378. else if (tcpModel.action == SideAction::NURSING_END) {
  379. // 收到nursing_end
  380. lightControl("DOORLED", "000F");
  381. }
  382. else if (tcpModel.action == SideAction::CALL) {
  383. // 收到CALL,需要亮红灯
  384. lightControl("DOORLED", "200F");
  385. }
  386. else if (tcpModel.action == SideAction::ACCEPT) {
  387. // 进行门灯还原
  388. lightControl("DOORLED", "000F");
  389. if (isHandleId(tcpModel.to_id) && CallingStatus::instance()->busy()) {
  390. CallingStatus::instance()->setTcpModel(tcpModel);
  391. std::string toSipId = tcpModel.json["toSipId"].asString();
  392. callActivityFinish(CallFinishType::ACCEPT);
  393. //接听
  394. buildSIP(toSipId);
  395. }
  396. }
  397. else if (tcpModel.action == SideAction::CANCEL) {
  398. // 进行门灯还原
  399. lightControl("DOORLED", "000F");
  400. if (isHandleId(tcpModel.to_id) && CallingStatus::instance()->busy()) {
  401. callActivityFinish(CallFinishType::CANCEL);
  402. }
  403. }
  404. else if (tcpModel.action == SideAction::SOS_CALL) {
  405. // 收到SOS_CALL,需要亮红灯
  406. // 门灯亮红灯
  407. lightControl("DOORLED", "200F");
  408. lightControl("CALLLED", "100F");
  409. sosTimerRegistered = false;
  410. mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
  411. mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
  412. }
  413. else if (tcpModel.action == SideAction::SOS_CANCEL) {
  414. // 进行门灯还原
  415. lightControl("DOORLED", "000F");
  416. statusLight();
  417. }
  418. }
  419. else if (tcpModel.type == TcpType::CALLBACK) {
  420. if (tcpModel.action == CallbackAction::ACK) {
  421. LOGD("CALLBACK ACK !!!!");
  422. //回调
  423. TcpCallback callback = TcpCacheManager::instance()->getFunc(tcpModel.tid);
  424. if (callback.tid != "0"){
  425. callback.onSuccess(tcpModel.json);
  426. }
  427. }
  428. else if (tcpModel.action == CallbackAction::SUCCESS) {
  429. //回调
  430. TcpCallback callback = TcpCacheManager::instance()->getFunc(tcpModel.tid);
  431. if (callback.tid != "0"){
  432. callback.onSuccess(tcpModel.json);
  433. }
  434. }
  435. else if (tcpModel.action == CallbackAction::FAILED) {
  436. //回调
  437. TcpCallback callback = TcpCacheManager::instance()->getFunc(tcpModel.tid);
  438. if (callback.tid != "0"){
  439. callback.onFalied(tcpModel.json);
  440. }
  441. if (tcpModel.tid == callTid){
  442. callActivityFinish(CallFinishType::FAILED);
  443. }
  444. }
  445. }
  446. else if (tcpModel.type == TcpType::POSITION) {
  447. if (tcpModel.action == PositionAction::POSITION_START) {
  448. setPosistionItId(tcpModel.json["id"].asInt());
  449. }
  450. }
  451. else if (tcpModel.type == TcpType::ROOMCHECK) {
  452. if (tcpModel.action == RoomCheckAction::START) {
  453. setRoomCheckItId(tcpModel.json["id"].asInt());
  454. }
  455. }
  456. else if (tcpModel.type == TcpType::SCREEN_TIP) {
  457. if (tcpModel.action == ScreenTipAction::START) {
  458. setPromptTimeItId(tcpModel.json["id"].asInt());
  459. }
  460. }
  461. else if (tcpModel.type == TcpType::AUTH) {
  462. if (tcpModel.action == AuthAction::LOGIN) {
  463. // 需要判断fromId跟自己是不是一样的,一样的就代表是自己发送出去,不一样的就代表员工已经登录到其他设备去了
  464. if (tcpModel.from_id == StoragePreferences::getInt(STORE_DEVICE_ID, 0)) {
  465. LOGD("id ===> %d", tcpModel.json["id"].asInt());
  466. setAuthItId(tcpModel.json["id"].asInt());
  467. }
  468. else {
  469. navibarNfcLogout();
  470. // logoutMedicalCare();
  471. // const char* currentAppName = EASYUICONTEXT->currentAppName();
  472. // string _currentAppName = currentAppName;
  473. // if (_currentAppName == "medicalCareActivity") {
  474. // goHome();
  475. // }
  476. }
  477. }
  478. }
  479. else if (tcpModel.type == TcpType::BLUE_CODE) {
  480. if (tcpModel.action == BlueCodeAction::SUCCESS) {
  481. int id = tcpModel.json["id"].asInt();
  482. LOGD("blue code id ===> %d", id);
  483. setBlueCodeId(id, tcpModel.tid);
  484. }
  485. }
  486. }
  487. bool getSleepTimerRegistered() {
  488. return isSleepTimerRegistered;
  489. }
  490. // 触发定时任务
  491. void setSleepTimerRegistered(bool result) {
  492. LOGD("isSleepTimerRegistered = %d", isSleepTimerRegistered);
  493. LOGD("result = %d", result);
  494. if (mActivityPtr == NULL) {
  495. return;
  496. }
  497. if (result != isSleepTimerRegistered) { // 与定时任务不同时,才进行处理
  498. if (isSleepTimerRegistered) { // 与定时任务开关进行判断,如果定时任务开启,那就要关闭
  499. isSleepTimerRegistered = result;
  500. mActivityPtr->unregisterUserTimer(SLEEP_STRAT_TIME_HANDLE); // 关闭定时器
  501. if (isSleep) {
  502. isSleep = false;
  503. BRIGHTNESSHELPER->screenOn();
  504. }
  505. LOGD("关闭息屏");
  506. } else { // 如果定时任务关着,那就要打开
  507. isSleepTimerRegistered = result;
  508. int sleepTime = StoragePreferences::getInt(STORE_SLEEP_TIME, 3);
  509. if (sleepTime > 0) {
  510. mActivityPtr->registerUserTimer(SLEEP_STRAT_TIME_HANDLE, sleepTime * 60 * 1000);
  511. LOGD("开启息屏");
  512. }
  513. }
  514. }
  515. }
  516. void scrrenOn() {
  517. isSleep = false;
  518. BRIGHTNESSHELPER->screenOn();
  519. }
  520. void setCallTid(std::string tid) {
  521. callTid = tid;
  522. }
  523. void handleHCall(int id) {
  524. int handleId = getHandleId(id);
  525. if (handleId != 0) {
  526. const char* currentAppName = EASYUICONTEXT->currentAppName();
  527. string _currentAppName = currentAppName;
  528. if (_currentAppName == "callActivity") {
  529. LOGD("已经在呼叫界面");
  530. return;
  531. }
  532. string handleIdStr = to_string(handleId);
  533. Intent* intent = new Intent();
  534. intent->putExtra(isOutgoing, "handleHCall");
  535. intent->putExtra(handleCallId, handleIdStr);
  536. EASYUICONTEXT->openActivity("callActivity", intent);
  537. }
  538. else {
  539. string errorMsg = LANGUAGEMANAGER->getValue("HandleError") +
  540. StoragePreferences::getString(STORE_MAC_ADDR, "0.0.0.0") + ":h" + to_string(id) +
  541. LANGUAGEMANAGER->getValue("NotAdd");
  542. Intent* intent = new Intent();
  543. intent->putExtra(functionWindows, "warn");
  544. intent->putExtra(warnText, errorMsg);
  545. EASYUICONTEXT->openActivity("functionActivity", intent);
  546. }
  547. }
  548. void sosCall(string sosMsg) {
  549. if (sosTimerRegistered) {
  550. LOGD("TCP -> SOS_CALL");
  551. sendSosCall(sosMsg);
  552. // SOS亮红灯
  553. lightControl("ULED", "1F");
  554. // 门灯亮红灯
  555. lightControl("DOORLED", "200F");
  556. lightControl("CALLLED", "100F");
  557. sosTimerRegistered = false;
  558. mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
  559. mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
  560. }
  561. }
  562. //================================= IO 口操作
  563. //紧急按钮灯,明/灭
  564. void setSOS_A5(bool light){
  565. int result = -1;
  566. int slight = light?0:1;
  567. result = GpioHelper::output("A5", slight);
  568. if (result==0){
  569. LOGD("set A5 SOS light %d. success",light);
  570. } else {
  571. LOGD("set A5 SOS light %d. failed",light);
  572. }
  573. }
  574. //A6,A7,A8 RGB灯控制
  575. void setRGB_A678(bool R, bool G, bool B){
  576. int rR = -1, rG = -1, rB = -1;
  577. int sR = R?0:1, sG = G?0:1, sB = B?0:1;
  578. rR = GpioHelper::output("A6", sR);
  579. rG = GpioHelper::output("A7", sG);
  580. rB = GpioHelper::output("A8", sB);
  581. const char *strLog = "set %s light %d. %d";
  582. LOGD(strLog,"A6 R",R, rR);
  583. LOGD(strLog,"A7 G",G, rG);
  584. LOGD(strLog,"A8 B",B, rB);
  585. }
  586. //手柄按钮
  587. class A1GpioListener : public IGpioListener{
  588. public:
  589. bool onGpioEdge(const char *pPin) override {
  590. int state = GpioHelper::input("A1");
  591. LOGD("IGpioListener GPIO IS A1=%d", state);
  592. if (state==0){
  593. voip::CallInfo info = GetTelephone()->GetCallInfo();
  594. //拨打 或 挂断
  595. if (CallingStatus::instance()->busy()){
  596. callActivityFinish(CallFinishType::A1CLICK);
  597. } else {
  598. Intent* intent = new Intent();
  599. intent->putExtra(isOutgoing, "true");
  600. EASYUICONTEXT->openActivity("callActivity", intent);
  601. }
  602. }
  603. return true;
  604. }
  605. void onGpioError(const char *pPin, int error) override {
  606. LOGD("IGpioListener ERROR GPIO IS %s, %d", pPin, error);
  607. }
  608. };
  609. //7寸面板,呼出
  610. class A2GpioListener : public IGpioListener{
  611. public:
  612. bool onGpioEdge(const char *pPin) override {
  613. int state = GpioHelper::input("A2");
  614. LOGD("IGpioListener GPIO IS A2=%d", state);
  615. if (state==0){
  616. //拨打 或 接听
  617. }
  618. return true;
  619. }
  620. void onGpioError(const char *pPin, int error) override {
  621. LOGD("IGpioListener ERROR GPIO IS %s, %d", pPin, error);
  622. }
  623. };
  624. //7寸面板,挂断
  625. class A3GpioListener : public IGpioListener{
  626. public:
  627. bool onGpioEdge(const char *pPin) override {
  628. int state = GpioHelper::input("A3");
  629. LOGD("IGpioListener GPIO IS A3=%d", state);
  630. if (state==0){
  631. //挂断
  632. }
  633. return true;
  634. }
  635. void onGpioError(const char *pPin, int error) override {
  636. LOGD("IGpioListener ERROR GPIO IS %s, %d", pPin, error);
  637. }
  638. };
  639. //紧急按钮
  640. class A4GpioListener : public IGpioListener{
  641. public:
  642. bool onGpioEdge(const char *pPin) override {
  643. int state = GpioHelper::input("A4");
  644. LOGD("IGpioListener GPIO IS A4=%d", state);
  645. if (state==0){
  646. //发出
  647. setSOS_A5(true);
  648. }
  649. return true;
  650. }
  651. void onGpioError(const char *pPin, int error) override {
  652. LOGD("IGpioListener ERROR GPIO IS %s, %d", pPin, error);
  653. }
  654. };
  655. /**
  656. * 注册定时器
  657. * 填充数组用于注册定时器
  658. * 注意:id不能重复
  659. */
  660. static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  661. {1, 5000},
  662. {2, 30*1000}
  663. };
  664. /**
  665. * 当界面构造时触发
  666. */
  667. static void onUI_init(){
  668. //IO监测
  669. IGpioListener *iGpioListenerA1 = new A1GpioListener();
  670. GpioHelper::registerGpioListener("A1", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  671. IGpioListener *iGpioListenerA2 = new A2GpioListener();
  672. GpioHelper::registerGpioListener("A2", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  673. IGpioListener *iGpioListenerA3 = new A3GpioListener();
  674. GpioHelper::registerGpioListener("A3", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  675. IGpioListener *iGpioListenerA4 = new A4GpioListener();
  676. GpioHelper::registerGpioListener("A4", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  677. //TCP启动
  678. TcpClient::instance()->startTcp();
  679. //监听SIP信令
  680. GetTelephone()->AddCallStateListener(OnCallStateChanged);
  681. //开启网页
  682. httpServer.RunAsync(HTTP_SERVER_PORT);
  683. // 启动的时候更改为tcp模式
  684. StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
  685. if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {
  686. LOGD("===============> 关闭护理状态");
  687. StoragePreferences::putBool(STORE_NURSING_TYPE, false);
  688. isNursing = true;
  689. }
  690. //请求版本号
  691. // if(UartContext::Uart3IsOpen()) {
  692. // string heartStr = "ASK,VNF-0";
  693. // const char* sendMsg = heartStr.c_str();
  694. // sendProtocolTo(UART_TTYS3, (byte*)(sendMsg), strlen(sendMsg));
  695. // }
  696. #if 0
  697. std::thread backend([](){
  698. while (true) {
  699. if (feed_dogs > 0) {
  700. --feed_dogs;
  701. LOGD("feed");
  702. int ret = GpioHelper::output("GPIO_2", 1); //拉高
  703. if (ret != 0) {
  704. LOGE("GPIO操作失败");
  705. }
  706. usleep(1000 * 20);
  707. ret = GpioHelper::output("GPIO_2", 0); //拉低
  708. if (ret != 0) {
  709. LOGE("GPIO操作失败");
  710. }
  711. }
  712. usleep(1000 * 1000);
  713. }
  714. });
  715. backend.detach();
  716. #endif
  717. }
  718. /**
  719. * 当切换到该界面时触发
  720. */
  721. static void onUI_intent(const Intent *intentPtr) {
  722. if (intentPtr != NULL) {
  723. //TODO
  724. }
  725. }
  726. /*
  727. * 当界面显示时触发
  728. */
  729. static void onUI_show() {
  730. StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
  731. //进入主界面
  732. EASYUICONTEXT->openActivity("mainActivity");
  733. }
  734. /*
  735. * 当界面隐藏时触发
  736. */
  737. static void onUI_hide() {
  738. }
  739. /*
  740. * 当界面完全退出时触发
  741. */
  742. static void onUI_quit() {
  743. }
  744. /**
  745. * 串口数据回调接口
  746. */
  747. static void onProtocolDataUpdate(const SProtocolData &data) {
  748. LOGD("cmd = %s", data.cmd.c_str());
  749. if (data.state!=""){
  750. LOGD("state = %s",data.state.c_str());
  751. }
  752. // if (data.msg != ""){
  753. // LOGD("msg = %s", data.msg.c_str());
  754. // }
  755. if(UartContext::Uart2IsOpen()) { // 如果是true,表示串口打开了
  756. string heartStr;
  757. // 面板拨号
  758. if (data.cmd == "KEY5") {
  759. if (data.state == "0") {
  760. if (isSleep) {
  761. scrrenOn();
  762. if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
  763. return;
  764. }
  765. }
  766. const char* currentAppName = EASYUICONTEXT->currentAppName();
  767. string _currentAppName = currentAppName;
  768. if (_currentAppName == "sipTestActivity") {
  769. setCheckbox("KEY5");
  770. return;
  771. }
  772. else {
  773. voip::CallInfo info = GetTelephone()->GetCallInfo();
  774. //拨打 或 挂断
  775. if (CallingStatus::instance()->busy()){
  776. callActivityFinish(CallFinishType::A1CLICK);
  777. } else {
  778. Intent* intent = new Intent();
  779. intent->putExtra(isOutgoing, "true");
  780. EASYUICONTEXT->openActivity("callActivity", intent);
  781. }
  782. }
  783. }
  784. }
  785. else if (data.cmd == "KEY6") {
  786. if (data.state == "0") {
  787. if (isSleep) {
  788. scrrenOn();
  789. if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
  790. return;
  791. }
  792. }
  793. const char* currentAppName = EASYUICONTEXT->currentAppName();
  794. string _currentAppName = currentAppName;
  795. if (_currentAppName == "sipTestActivity") {
  796. setCheckbox("KEY6");
  797. return;
  798. }
  799. isTriggerHandle = true;
  800. mActivityPtr->registerUserTimer(HANDLE_TRIGGER_TIME_HANDLE, 5 * 1000);
  801. }
  802. else if (data.state == "1") {
  803. if (isTriggerHandle) {
  804. isTriggerHandle = false;
  805. voip::CallInfo info = GetTelephone()->GetCallInfo();
  806. //拨打 或 挂断
  807. if (CallingStatus::instance()->busy()){
  808. callActivityFinish(CallFinishType::KEY6_CLICK);
  809. } else {
  810. Intent* intent = new Intent();
  811. intent->putExtra(isOutgoing, "true");
  812. EASYUICONTEXT->openActivity("callActivity", intent);
  813. }
  814. }
  815. }
  816. else if (data.state == "3") {
  817. LOGD("手柄在线");
  818. isConnectHandle = true;
  819. }
  820. else if (data.state == "4") {
  821. if (!isConnectHandle) {
  822. return;
  823. }
  824. sosCall(LANGUAGEMANAGER->getValue("HandleDisconnected"));
  825. }
  826. }
  827. else if (data.cmd == "KEY7") {
  828. if (data.state == "0") {
  829. scrrenOn();
  830. const char* currentAppName = EASYUICONTEXT->currentAppName();
  831. string _currentAppName = currentAppName;
  832. if (_currentAppName == "sipTestActivity") {
  833. setCheckbox("KEY7");
  834. return;
  835. }
  836. else {
  837. if (sosTimerRegistered) {
  838. isTriggerSos = true;
  839. mActivityPtr->registerUserTimer(SOS_TRIGGER_TIME_HANDLE, 5 * 1000);
  840. }
  841. }
  842. }
  843. else if (data.state == "1") {
  844. if (isTriggerSos) {
  845. sendSosCall("");
  846. // SOS亮红灯
  847. lightControl("ULED", "1F");
  848. // 门灯亮红灯
  849. lightControl("DOORLED", "200F");
  850. lightControl("CALLLED", "100F");
  851. mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
  852. mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
  853. }
  854. }
  855. else if (data.state == "3") {
  856. LOGD("SOS按钮在线");
  857. isConnectSos = true;
  858. }
  859. else if (data.state == "4") {
  860. if (!isConnectSos) {
  861. return;
  862. }
  863. sosCall(LANGUAGEMANAGER->getValue("SosDisconnected"));
  864. }
  865. }
  866. else if (data.cmd == "KEY<") {
  867. if (isSleep) {
  868. scrrenOn();
  869. }
  870. // lightControl("DOORLED", "100F");
  871. }
  872. else if (data.cmd == "KEY>") { // key>是面板挂断按钮
  873. if (data.state == "0") {
  874. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
  875. setCheckbox("KEY>");
  876. return;
  877. }
  878. if (isSleep) {
  879. scrrenOn();
  880. }
  881. else {
  882. voip::CallInfo info = GetTelephone()->GetCallInfo();
  883. //拨打 或 挂断
  884. if (CallingStatus::instance()->busy()){
  885. callActivityFinish(CallFinishType::A1CLICK);
  886. lightControl("DOORLED", "000F");
  887. }
  888. }
  889. }
  890. }
  891. else if (data.cmd == "KEY;") {
  892. if (isSleep) {
  893. scrrenOn();
  894. }
  895. // lightControl("DOORLED", "111F");
  896. }
  897. else if (data.cmd == "HANDKEY00") {
  898. if (data.state == "0") {
  899. if (isSleep) {
  900. scrrenOn();
  901. }
  902. isTriggerHandle1 = true;
  903. mActivityPtr->registerUserTimer(HANDLE1_TRIGGER_TIME_HANDLE, 5 * 1000);
  904. }
  905. else if (data.state == "1") {
  906. if (isTriggerHandle1) {
  907. isTriggerHandle1 = false;
  908. handleHCall(1);
  909. }
  910. }
  911. else if (data.state == "3") {
  912. LOGD("手柄1在线");
  913. isConnectHandle1 = true;
  914. }
  915. else if (data.state == "4") {
  916. if (!isConnectHandle1) {
  917. return;
  918. }
  919. sosCall(LANGUAGEMANAGER->getValue("Handle1Disconnected"));
  920. }
  921. }
  922. else if (data.cmd == "HANDKEY10") {
  923. if (data.state == "0") {
  924. if (isSleep) {
  925. scrrenOn();
  926. }
  927. isTriggerHandle2 = true;
  928. mActivityPtr->registerUserTimer(HANDLE2_TRIGGER_TIME_HANDLE, 5 * 1000);
  929. }
  930. else if (data.state == "1") {
  931. if (isTriggerHandle2) {
  932. isTriggerHandle2 = false;
  933. handleHCall(2);
  934. }
  935. }
  936. else if (data.state == "3") {
  937. LOGD("手柄2在线");
  938. isConnectHandle2 = true;
  939. }
  940. else if (data.state == "4") {
  941. if (!isConnectHandle2) {
  942. return;
  943. }
  944. sosCall(LANGUAGEMANAGER->getValue("Handle2Disconnected"));
  945. }
  946. }
  947. else if (data.cmd == "HANDKEY20") {
  948. if (data.state == "0") {
  949. if (isSleep) {
  950. scrrenOn();
  951. }
  952. isTriggerHandle3 = true;
  953. mActivityPtr->registerUserTimer(HANDLE3_TRIGGER_TIME_HANDLE, 5 * 1000);
  954. }
  955. else if (data.state == "1") {
  956. if (isTriggerHandle3) {
  957. isTriggerHandle3 = false;
  958. handleHCall(3);
  959. }
  960. }
  961. else if (data.state == "3") {
  962. LOGD("手柄3在线");
  963. isConnectHandle3 = true;
  964. }
  965. else if (data.state == "4") {
  966. if (!isConnectHandle3) {
  967. return;
  968. }
  969. sosCall(LANGUAGEMANAGER->getValue("Handle3Disconnected"));
  970. }
  971. }
  972. else if (data.cmd == "HANDKEY30") {
  973. if (data.state == "0") {
  974. if (isSleep) {
  975. scrrenOn();
  976. }
  977. isTriggerHandle4 = true;
  978. mActivityPtr->registerUserTimer(HANDLE4_TRIGGER_TIME_HANDLE, 5 * 1000);
  979. }
  980. else if (data.state == "1") {
  981. if (isTriggerHandle4) {
  982. isTriggerHandle4 = false;
  983. handleHCall(4);
  984. }
  985. }
  986. else if (data.state == "3") {
  987. LOGD("手柄4在线");
  988. isConnectHandle4 = true;
  989. }
  990. else if (data.state == "4") {
  991. if (!isConnectHandle4) {
  992. return;
  993. }
  994. sosCall(LANGUAGEMANAGER->getValue("Handle4Disconnected"));
  995. }
  996. }
  997. else {
  998. if (isSleep) {
  999. scrrenOn();
  1000. }
  1001. lightControl("DOORLED", "000F");
  1002. }
  1003. }
  1004. }
  1005. /**
  1006. * 定时器触发函数
  1007. * 不建议在此函数中写耗时操作,否则将影响UI刷新
  1008. * 参数: id
  1009. * 当前所触发定时器的id,与注册时的id相同
  1010. * 返回值: true
  1011. * 继续运行当前定时器
  1012. * false
  1013. * 停止运行当前定时器
  1014. */
  1015. static bool onUI_Timer(int id){
  1016. switch (id) {
  1017. case 1:
  1018. {
  1019. //定时器跑在UI线程,这里将喂狗标记加1
  1020. //++feed_dogs;
  1021. //不用心跳
  1022. // if(UartContext::Uart3IsOpen()) {
  1023. // string heartStr = "HEART,1E";
  1024. // const char* sendMsg = heartStr.c_str();
  1025. // sendProtocolTo(UART_TTYS3, (byte*)(sendMsg), strlen(sendMsg));
  1026. // }
  1027. }
  1028. break;
  1029. case 2: //TCP心跳
  1030. {
  1031. const char* req = "0";
  1032. TcpClient::instance()->sendMsg(req);
  1033. }
  1034. break;
  1035. case SOS_CLICK_TIME_HANDLE: {
  1036. sosTimerRegistered = true;
  1037. return false;
  1038. }
  1039. break;
  1040. case SOS_LAMP_TIME_HANDLE: {
  1041. // SOS还原成无灯光的状态
  1042. lightControl("ULED", "0F");
  1043. // 进行门灯还原
  1044. lightControl("DOORLED", "000F");
  1045. statusLight();
  1046. return false;
  1047. }
  1048. break;
  1049. case SLEEP_STRAT_TIME_HANDLE: { // 息屏
  1050. if (isSleepTimerRegistered) {
  1051. isSleep = true;
  1052. BRIGHTNESSHELPER->screenOff();
  1053. } else { // 如果是false的话,就需要关闭定时器
  1054. isSleep = false;
  1055. BRIGHTNESSHELPER->screenOn();
  1056. }
  1057. }
  1058. break;
  1059. case SYS_RESTART_TIME_HANDLE:
  1060. netresetInt += 1;
  1061. lightControl("NETRESET", "1F");
  1062. if (netresetInt == 5) {
  1063. LOGD("网卡重启无效,程序内部重启");
  1064. //重启
  1065. sync();
  1066. reboot(RB_AUTOBOOT);
  1067. }
  1068. break;
  1069. case HANDLE_TRIGGER_TIME_HANDLE: {
  1070. isTriggerHandle = false;
  1071. return false;
  1072. }
  1073. break;
  1074. case SOS_TRIGGER_TIME_HANDLE: {
  1075. isTriggerSos = false;
  1076. return false;
  1077. }
  1078. break;
  1079. case HANDLE1_TRIGGER_TIME_HANDLE: {
  1080. isTriggerHandle1 = false;
  1081. return false;
  1082. }
  1083. break;
  1084. case HANDLE2_TRIGGER_TIME_HANDLE: {
  1085. isTriggerHandle2 = false;
  1086. return false;
  1087. }
  1088. break;
  1089. case HANDLE3_TRIGGER_TIME_HANDLE: {
  1090. isTriggerHandle3 = false;
  1091. return false;
  1092. }
  1093. break;
  1094. case HANDLE4_TRIGGER_TIME_HANDLE: {
  1095. isTriggerHandle4 = false;
  1096. return false;
  1097. }
  1098. break;
  1099. default:
  1100. break;
  1101. }
  1102. return true;
  1103. }
  1104. /**
  1105. * 有新的触摸事件时触发
  1106. * 参数:ev
  1107. * 新的触摸事件
  1108. * 返回值:true
  1109. * 表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
  1110. * false
  1111. * 触摸事件将继续传递到控件上
  1112. */
  1113. static bool onstartActivityTouchEvent(const MotionEvent &ev) {
  1114. switch (ev.mActionStatus) {
  1115. case MotionEvent::E_ACTION_DOWN://触摸按下
  1116. //LOGD("时刻 = %ld 坐标 x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
  1117. break;
  1118. case MotionEvent::E_ACTION_MOVE://触摸滑动
  1119. break;
  1120. case MotionEvent::E_ACTION_UP: //触摸抬起
  1121. break;
  1122. default:
  1123. break;
  1124. }
  1125. return false;
  1126. }