startLogic.cc 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274
  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. EASYUICONTEXT->updateLocalesCode(StoragePreferences::getString(STORE_LANG, defaultLang).c_str());
  669. //IO监测
  670. IGpioListener *iGpioListenerA1 = new A1GpioListener();
  671. GpioHelper::registerGpioListener("A1", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  672. IGpioListener *iGpioListenerA2 = new A2GpioListener();
  673. GpioHelper::registerGpioListener("A2", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  674. IGpioListener *iGpioListenerA3 = new A3GpioListener();
  675. GpioHelper::registerGpioListener("A3", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  676. IGpioListener *iGpioListenerA4 = new A4GpioListener();
  677. GpioHelper::registerGpioListener("A4", iGpioListenerA1, E_GPIO_EDGE_TYPE_FALLING);
  678. //TCP启动
  679. TcpClient::instance()->startTcp();
  680. //监听SIP信令
  681. GetTelephone()->AddCallStateListener(OnCallStateChanged);
  682. //开启网页
  683. httpServer.RunAsync(HTTP_SERVER_PORT);
  684. // 启动的时候更改为tcp模式
  685. StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
  686. if (StoragePreferences::getBool(STORE_NURSING_TYPE, false)) {
  687. LOGD("===============> 关闭护理状态");
  688. StoragePreferences::putBool(STORE_NURSING_TYPE, false);
  689. isNursing = true;
  690. }
  691. //请求版本号
  692. // if(UartContext::Uart3IsOpen()) {
  693. // string heartStr = "ASK,VNF-0";
  694. // const char* sendMsg = heartStr.c_str();
  695. // sendProtocolTo(UART_TTYS3, (byte*)(sendMsg), strlen(sendMsg));
  696. // }
  697. #if 0
  698. std::thread backend([](){
  699. while (true) {
  700. if (feed_dogs > 0) {
  701. --feed_dogs;
  702. LOGD("feed");
  703. int ret = GpioHelper::output("GPIO_2", 1); //拉高
  704. if (ret != 0) {
  705. LOGE("GPIO操作失败");
  706. }
  707. usleep(1000 * 20);
  708. ret = GpioHelper::output("GPIO_2", 0); //拉低
  709. if (ret != 0) {
  710. LOGE("GPIO操作失败");
  711. }
  712. }
  713. usleep(1000 * 1000);
  714. }
  715. });
  716. backend.detach();
  717. #endif
  718. }
  719. /**
  720. * 当切换到该界面时触发
  721. */
  722. static void onUI_intent(const Intent *intentPtr) {
  723. if (intentPtr != NULL) {
  724. //TODO
  725. }
  726. }
  727. /*
  728. * 当界面显示时触发
  729. */
  730. static void onUI_show() {
  731. StoragePreferences::putString(STORE_SIGNAL_TYPE, "TCP");
  732. //进入主界面
  733. EASYUICONTEXT->openActivity("mainActivity");
  734. }
  735. /*
  736. * 当界面隐藏时触发
  737. */
  738. static void onUI_hide() {
  739. }
  740. /*
  741. * 当界面完全退出时触发
  742. */
  743. static void onUI_quit() {
  744. }
  745. /**
  746. * 串口数据回调接口
  747. */
  748. static void onProtocolDataUpdate(const SProtocolData &data) {
  749. LOGD("cmd = %s", data.cmd.c_str());
  750. if (data.state!=""){
  751. LOGD("state = %s",data.state.c_str());
  752. }
  753. // if (data.msg != ""){
  754. // LOGD("msg = %s", data.msg.c_str());
  755. // }
  756. if(UartContext::Uart2IsOpen()) { // 如果是true,表示串口打开了
  757. string heartStr;
  758. // 面板拨号
  759. if (data.cmd == "KEY5") {
  760. if (data.state == "0") {
  761. if (isSleep) {
  762. scrrenOn();
  763. if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
  764. return;
  765. }
  766. }
  767. const char* currentAppName = EASYUICONTEXT->currentAppName();
  768. string _currentAppName = currentAppName;
  769. if (_currentAppName == "sipTestActivity") {
  770. setCheckbox("KEY5");
  771. return;
  772. }
  773. else {
  774. voip::CallInfo info = GetTelephone()->GetCallInfo();
  775. //拨打 或 挂断
  776. if (CallingStatus::instance()->busy()){
  777. callActivityFinish(CallFinishType::A1CLICK);
  778. } else {
  779. Intent* intent = new Intent();
  780. intent->putExtra(isOutgoing, "true");
  781. EASYUICONTEXT->openActivity("callActivity", intent);
  782. }
  783. }
  784. }
  785. }
  786. else if (data.cmd == "KEY6") {
  787. if (data.state == "0") {
  788. if (isSleep) {
  789. scrrenOn();
  790. if (!StoragePreferences::getInt(STORE_SCREEN_LIGHT, 0)) {
  791. return;
  792. }
  793. }
  794. const char* currentAppName = EASYUICONTEXT->currentAppName();
  795. string _currentAppName = currentAppName;
  796. if (_currentAppName == "sipTestActivity") {
  797. setCheckbox("KEY6");
  798. return;
  799. }
  800. isTriggerHandle = true;
  801. mActivityPtr->registerUserTimer(HANDLE_TRIGGER_TIME_HANDLE, 5 * 1000);
  802. }
  803. else if (data.state == "1") {
  804. if (isTriggerHandle) {
  805. isTriggerHandle = false;
  806. voip::CallInfo info = GetTelephone()->GetCallInfo();
  807. //拨打 或 挂断
  808. if (CallingStatus::instance()->busy()){
  809. callActivityFinish(CallFinishType::KEY6_CLICK);
  810. } else {
  811. Intent* intent = new Intent();
  812. intent->putExtra(isOutgoing, "true");
  813. EASYUICONTEXT->openActivity("callActivity", intent);
  814. }
  815. }
  816. }
  817. else if (data.state == "3") {
  818. LOGD("手柄在线");
  819. isConnectHandle = true;
  820. }
  821. else if (data.state == "4") {
  822. if (!isConnectHandle) {
  823. return;
  824. }
  825. sosCall(LANGUAGEMANAGER->getValue("HandleDisconnected"));
  826. }
  827. }
  828. else if (data.cmd == "KEY7") {
  829. if (data.state == "0") {
  830. scrrenOn();
  831. const char* currentAppName = EASYUICONTEXT->currentAppName();
  832. string _currentAppName = currentAppName;
  833. if (_currentAppName == "sipTestActivity") {
  834. setCheckbox("KEY7");
  835. return;
  836. }
  837. else {
  838. if (sosTimerRegistered) {
  839. isTriggerSos = true;
  840. mActivityPtr->registerUserTimer(SOS_TRIGGER_TIME_HANDLE, 5 * 1000);
  841. }
  842. }
  843. }
  844. else if (data.state == "1") {
  845. if (isTriggerSos) {
  846. sendSosCall("");
  847. // SOS亮红灯
  848. lightControl("ULED", "1F");
  849. // 门灯亮红灯
  850. lightControl("DOORLED", "200F");
  851. lightControl("CALLLED", "100F");
  852. mActivityPtr->registerUserTimer(SOS_CLICK_TIME_HANDLE, 10000); // 10秒后才能触发
  853. mActivityPtr->registerUserTimer(SOS_LAMP_TIME_HANDLE, 120000); // 2分钟后才能触发
  854. }
  855. }
  856. else if (data.state == "3") {
  857. LOGD("SOS按钮在线");
  858. isConnectSos = true;
  859. }
  860. else if (data.state == "4") {
  861. if (!isConnectSos) {
  862. return;
  863. }
  864. sosCall(LANGUAGEMANAGER->getValue("SosDisconnected"));
  865. }
  866. }
  867. else if (data.cmd == "KEY<") {
  868. if (isSleep) {
  869. scrrenOn();
  870. }
  871. // lightControl("DOORLED", "100F");
  872. }
  873. else if (data.cmd == "KEY>") { // key>是面板挂断按钮
  874. if (data.state == "0") {
  875. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP") {
  876. setCheckbox("KEY>");
  877. return;
  878. }
  879. if (isSleep) {
  880. scrrenOn();
  881. }
  882. else {
  883. voip::CallInfo info = GetTelephone()->GetCallInfo();
  884. //拨打 或 挂断
  885. if (CallingStatus::instance()->busy()){
  886. callActivityFinish(CallFinishType::A1CLICK);
  887. lightControl("DOORLED", "000F");
  888. }
  889. }
  890. }
  891. }
  892. else if (data.cmd == "KEY;") {
  893. if (isSleep) {
  894. scrrenOn();
  895. }
  896. // lightControl("DOORLED", "111F");
  897. }
  898. else if (data.cmd == "HANDKEY00") {
  899. if (data.state == "0") {
  900. if (isSleep) {
  901. scrrenOn();
  902. }
  903. isTriggerHandle1 = true;
  904. mActivityPtr->registerUserTimer(HANDLE1_TRIGGER_TIME_HANDLE, 5 * 1000);
  905. }
  906. else if (data.state == "1") {
  907. if (isTriggerHandle1) {
  908. isTriggerHandle1 = false;
  909. handleHCall(1);
  910. }
  911. }
  912. else if (data.state == "3") {
  913. LOGD("手柄1在线");
  914. isConnectHandle1 = true;
  915. }
  916. else if (data.state == "4") {
  917. if (!isConnectHandle1) {
  918. return;
  919. }
  920. sosCall(LANGUAGEMANAGER->getValue("Handle1Disconnected"));
  921. }
  922. }
  923. else if (data.cmd == "HANDKEY10") {
  924. if (data.state == "0") {
  925. if (isSleep) {
  926. scrrenOn();
  927. }
  928. isTriggerHandle2 = true;
  929. mActivityPtr->registerUserTimer(HANDLE2_TRIGGER_TIME_HANDLE, 5 * 1000);
  930. }
  931. else if (data.state == "1") {
  932. if (isTriggerHandle2) {
  933. isTriggerHandle2 = false;
  934. handleHCall(2);
  935. }
  936. }
  937. else if (data.state == "3") {
  938. LOGD("手柄2在线");
  939. isConnectHandle2 = true;
  940. }
  941. else if (data.state == "4") {
  942. if (!isConnectHandle2) {
  943. return;
  944. }
  945. sosCall(LANGUAGEMANAGER->getValue("Handle2Disconnected"));
  946. }
  947. }
  948. else if (data.cmd == "HANDKEY20") {
  949. if (data.state == "0") {
  950. if (isSleep) {
  951. scrrenOn();
  952. }
  953. isTriggerHandle3 = true;
  954. mActivityPtr->registerUserTimer(HANDLE3_TRIGGER_TIME_HANDLE, 5 * 1000);
  955. }
  956. else if (data.state == "1") {
  957. if (isTriggerHandle3) {
  958. isTriggerHandle3 = false;
  959. handleHCall(3);
  960. }
  961. }
  962. else if (data.state == "3") {
  963. LOGD("手柄3在线");
  964. isConnectHandle3 = true;
  965. }
  966. else if (data.state == "4") {
  967. if (!isConnectHandle3) {
  968. return;
  969. }
  970. sosCall(LANGUAGEMANAGER->getValue("Handle3Disconnected"));
  971. }
  972. }
  973. else if (data.cmd == "HANDKEY30") {
  974. if (data.state == "0") {
  975. if (isSleep) {
  976. scrrenOn();
  977. }
  978. isTriggerHandle4 = true;
  979. mActivityPtr->registerUserTimer(HANDLE4_TRIGGER_TIME_HANDLE, 5 * 1000);
  980. }
  981. else if (data.state == "1") {
  982. if (isTriggerHandle4) {
  983. isTriggerHandle4 = false;
  984. handleHCall(4);
  985. }
  986. }
  987. else if (data.state == "3") {
  988. LOGD("手柄4在线");
  989. isConnectHandle4 = true;
  990. }
  991. else if (data.state == "4") {
  992. if (!isConnectHandle4) {
  993. return;
  994. }
  995. sosCall(LANGUAGEMANAGER->getValue("Handle4Disconnected"));
  996. }
  997. }
  998. else {
  999. if (isSleep) {
  1000. scrrenOn();
  1001. }
  1002. lightControl("DOORLED", "000F");
  1003. }
  1004. }
  1005. }
  1006. /**
  1007. * 定时器触发函数
  1008. * 不建议在此函数中写耗时操作,否则将影响UI刷新
  1009. * 参数: id
  1010. * 当前所触发定时器的id,与注册时的id相同
  1011. * 返回值: true
  1012. * 继续运行当前定时器
  1013. * false
  1014. * 停止运行当前定时器
  1015. */
  1016. static bool onUI_Timer(int id){
  1017. switch (id) {
  1018. case 1:
  1019. {
  1020. //定时器跑在UI线程,这里将喂狗标记加1
  1021. //++feed_dogs;
  1022. //不用心跳
  1023. // if(UartContext::Uart3IsOpen()) {
  1024. // string heartStr = "HEART,1E";
  1025. // const char* sendMsg = heartStr.c_str();
  1026. // sendProtocolTo(UART_TTYS3, (byte*)(sendMsg), strlen(sendMsg));
  1027. // }
  1028. }
  1029. break;
  1030. case 2: //TCP心跳
  1031. {
  1032. const char* req = "0";
  1033. TcpClient::instance()->sendMsg(req);
  1034. }
  1035. break;
  1036. case SOS_CLICK_TIME_HANDLE: {
  1037. sosTimerRegistered = true;
  1038. return false;
  1039. }
  1040. break;
  1041. case SOS_LAMP_TIME_HANDLE: {
  1042. // SOS还原成无灯光的状态
  1043. lightControl("ULED", "0F");
  1044. // 进行门灯还原
  1045. lightControl("DOORLED", "000F");
  1046. statusLight();
  1047. return false;
  1048. }
  1049. break;
  1050. case SLEEP_STRAT_TIME_HANDLE: { // 息屏
  1051. if (isSleepTimerRegistered) {
  1052. isSleep = true;
  1053. BRIGHTNESSHELPER->screenOff();
  1054. } else { // 如果是false的话,就需要关闭定时器
  1055. isSleep = false;
  1056. BRIGHTNESSHELPER->screenOn();
  1057. }
  1058. }
  1059. break;
  1060. case SYS_RESTART_TIME_HANDLE:
  1061. netresetInt += 1;
  1062. lightControl("NETRESET", "1F");
  1063. if (netresetInt == 5) {
  1064. LOGD("网卡重启无效,程序内部重启");
  1065. //重启
  1066. sync();
  1067. reboot(RB_AUTOBOOT);
  1068. }
  1069. break;
  1070. case HANDLE_TRIGGER_TIME_HANDLE: {
  1071. isTriggerHandle = false;
  1072. return false;
  1073. }
  1074. break;
  1075. case SOS_TRIGGER_TIME_HANDLE: {
  1076. isTriggerSos = false;
  1077. return false;
  1078. }
  1079. break;
  1080. case HANDLE1_TRIGGER_TIME_HANDLE: {
  1081. isTriggerHandle1 = false;
  1082. return false;
  1083. }
  1084. break;
  1085. case HANDLE2_TRIGGER_TIME_HANDLE: {
  1086. isTriggerHandle2 = false;
  1087. return false;
  1088. }
  1089. break;
  1090. case HANDLE3_TRIGGER_TIME_HANDLE: {
  1091. isTriggerHandle3 = false;
  1092. return false;
  1093. }
  1094. break;
  1095. case HANDLE4_TRIGGER_TIME_HANDLE: {
  1096. isTriggerHandle4 = false;
  1097. return false;
  1098. }
  1099. break;
  1100. default:
  1101. break;
  1102. }
  1103. return true;
  1104. }
  1105. /**
  1106. * 有新的触摸事件时触发
  1107. * 参数:ev
  1108. * 新的触摸事件
  1109. * 返回值:true
  1110. * 表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
  1111. * false
  1112. * 触摸事件将继续传递到控件上
  1113. */
  1114. static bool onstartActivityTouchEvent(const MotionEvent &ev) {
  1115. switch (ev.mActionStatus) {
  1116. case MotionEvent::E_ACTION_DOWN://触摸按下
  1117. //LOGD("时刻 = %ld 坐标 x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
  1118. break;
  1119. case MotionEvent::E_ACTION_MOVE://触摸滑动
  1120. break;
  1121. case MotionEvent::E_ACTION_UP: //触摸抬起
  1122. break;
  1123. default:
  1124. break;
  1125. }
  1126. return false;
  1127. }