callLogic.cc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. #pragma once
  2. #include "uart/ProtocolSender.h"
  3. #include <string>
  4. #include "core/utilities.h"
  5. #include "voip/telephone.h"
  6. #include "base/strings.hpp"
  7. #include "storage/StoragePreferences.h"
  8. #include "core/sip_config.h"
  9. #include "zkaudio.h"
  10. #include "service/BusinessConfig.h"
  11. #include "net/tcp_client.h"
  12. #include "manager/ConfigManager.h"
  13. //#include "voip/wav_player.h"
  14. #include "voip/media_player.h"
  15. #include "manager/LanguageManager.h"
  16. std::string _isOutgoing;
  17. std::string _toIdStr;
  18. //voip::WAVPlayer wavPlayer; // 播放音频
  19. std::string tid;
  20. static base::MediaPlayer mediaPlayer;
  21. static bool _isSleepTimerRegistered = false;
  22. #define CALLING_TIME 60 // 用于控制呼叫时间,定时器
  23. const int goBack = 200;
  24. void callActivityFinish(CallFinishType type){
  25. switch (type){
  26. case CANCEL:
  27. LOGD("cancel");
  28. setSleepTimerRegistered(_isSleepTimerRegistered);
  29. EASYUICONTEXT->goBack();
  30. break;
  31. case REJECT:
  32. LOGD("reject");
  33. // wavPlayer.Stop();
  34. mediaPlayer.Stop();
  35. mTextViewNamePtr->setTextTr("RemoteRefuse");
  36. mActivityPtr->unregisterUserTimer(CALLING_TIME);
  37. mActivityPtr->registerUserTimer(goBack, 5000);
  38. break;
  39. case BUSY:
  40. LOGD("BUSY");
  41. // wavPlayer.Stop();
  42. mediaPlayer.Stop();
  43. mTextViewNamePtr->setTextTr("RemoteBusy");
  44. mActivityPtr->unregisterUserTimer(CALLING_TIME);
  45. mActivityPtr->registerUserTimer(goBack, 5000);
  46. break;
  47. case HANDOFF:
  48. LOGD("handoff");
  49. setSleepTimerRegistered(_isSleepTimerRegistered);
  50. EASYUICONTEXT->goBack();
  51. break;
  52. case FAILED:
  53. // wavPlayer.Stop();
  54. mediaPlayer.Stop();
  55. mTextViewNamePtr->setTextTr("CallFailed");
  56. mActivityPtr->registerUserTimer(goBack, 5000);
  57. break;
  58. case ACCEPT:
  59. mActivityPtr->unregisterUserTimer(CALLING_TIME);
  60. break;
  61. case A1CLICK:
  62. LOGD("a1 click");
  63. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
  64. TcpModel storeModel = CallingStatus::instance()->getTcpModel();
  65. //只回传iId
  66. storeModel.data = storeModel.json["id"].asString();
  67. voip::CallInfo info = GetTelephone()->GetCallInfo();
  68. LOGD("info state = %d",info.state);
  69. if (info.state == voip::STATE_CALL_CALLING
  70. || info.state == voip::STATE_CALL_CALLING
  71. || info.state == voip::STATE_CALL_CONFIRMED){
  72. sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
  73. GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
  74. GetTelephone()->Hangup();
  75. setSleepTimerRegistered(_isSleepTimerRegistered);
  76. EASYUICONTEXT->goBack();
  77. }
  78. else if (_isOutgoing == "false"){ //state = 5
  79. mButtonAnswerPtr->setVisible(false);
  80. TcpModel model = CallingStatus::instance()->getTcpModel();
  81. model.data = model.json["id"].asString();
  82. sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
  83. mActivityPtr->unregisterUserTimer(CALLING_TIME);
  84. }
  85. else if (_isOutgoing == "true") {
  86. sendVoiceTcp(VoiceAction::CANCEL, storeModel, storeModel.from_id);
  87. setSleepTimerRegistered(_isSleepTimerRegistered);
  88. EASYUICONTEXT->goBack();
  89. }
  90. else if (_isOutgoing == "handleHCall") {
  91. sendVoiceCancel(storeModel.to_id, 0);
  92. setSleepTimerRegistered(_isSleepTimerRegistered);
  93. EASYUICONTEXT->goBack();
  94. }
  95. }
  96. break;
  97. case KEY6_CLICK:
  98. LOGD("KEY6 click");
  99. if (StoragePreferences::getString(STORE_SIGNAL_TYPE,"TCP") == "TCP"){
  100. TcpModel storeModel = CallingStatus::instance()->getTcpModel();
  101. //只回传iId
  102. storeModel.data = storeModel.json["id"].asString();
  103. voip::CallInfo info = GetTelephone()->GetCallInfo();
  104. LOGD("info state = %d",info.state);
  105. if (info.state == voip::STATE_CALL_CALLING
  106. || info.state == voip::STATE_CALL_CALLING
  107. || info.state == voip::STATE_CALL_CONFIRMED){
  108. sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
  109. GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
  110. GetTelephone()->Hangup();
  111. setSleepTimerRegistered(_isSleepTimerRegistered);
  112. EASYUICONTEXT->goBack();
  113. lightControl("DOORLED", "000F");
  114. }
  115. else if (_isOutgoing == "false"){ //state = 5
  116. mButtonAnswerPtr->setVisible(false);
  117. TcpModel model = CallingStatus::instance()->getTcpModel();
  118. model.data = model.json["id"].asString();
  119. sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
  120. mActivityPtr->unregisterUserTimer(CALLING_TIME);
  121. }
  122. }
  123. break;
  124. }
  125. }
  126. void buildSIP(std::string toSipId){
  127. // wavPlayer.Stop();
  128. mediaPlayer.Stop();
  129. int port = StoragePreferences::getInt(SIP_REG_PORT, SIP_REG_PORT_DEFAULT);
  130. std::string domain = StoragePreferences::getString(SIP_REG_DOMAIN, SIP_REG_DOMAIN_DEFAULT);
  131. //std::string od_number = StoragePreferences::getString(SIP_REG_DOOR_ACCOUNT, SIP_REG_DOOR_ACCOUNT_DEFAULT);
  132. std::string od_number_uri = URI(toSipId, domain, port);
  133. LOGD("xxxxxxxxxxxxxx %s",od_number_uri.c_str());
  134. GetTelephone()->MakeCall(od_number_uri);
  135. }
  136. void acceptSIP(){
  137. // wavPlayer.Stop();
  138. mediaPlayer.Stop();
  139. GetTelephone()->Answer();
  140. }
  141. //static ZKMediaPlayer sPlayer(ZKMediaPlayer::E_MEDIA_TYPE_AUDIO);
  142. namespace {
  143. const int kTimerAutoAnswer = 100;
  144. std::string StateString(voip::State state) {
  145. switch (state) {
  146. case voip::STATE_CALL_CALLING:
  147. case voip::STATE_CALL_EARLY:
  148. return LANGUAGEMANAGER->getValue("Calling");
  149. case voip::STATE_CALL_CONFIRMED:
  150. return LANGUAGEMANAGER->getValue("CallConfirmed");
  151. case voip::STATE_CALL_CONNECTING:
  152. return LANGUAGEMANAGER->getValue("CallConnecting");
  153. case voip::STATE_CALL_INCOMING:
  154. return LANGUAGEMANAGER->getValue("CallInComing");
  155. default:
  156. break;
  157. }
  158. return "";
  159. }
  160. } /* anonymous namespace */
  161. /**
  162. * 注册定时器
  163. * 填充数组用于注册定时器
  164. * 注意:id不能重复
  165. */
  166. static S_ACTIVITY_TIMEER REGISTER_ACTIVITY_TIMER_TAB[] = {
  167. //{0, 6000}, //定时器id=0, 时间间隔6秒
  168. {1, 1000},
  169. {kTimerAutoAnswer, 2000},
  170. };
  171. /**
  172. * 当界面构造时触发
  173. */
  174. static void onUI_init(){
  175. CallingStatus::instance()->setBusy(true);
  176. // GetTelephone()->SetInputPcmGainSize(10.0);
  177. // player = new ZKMediaPlayer(ZKMediaPlayer::E_MEDIA_TYPE_AUDIO);
  178. // player->play("/mnt/extsd/ui/hl.mp3");
  179. //界面操作
  180. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  181. voip::CallInfo info = GetTelephone()->GetCallInfo();
  182. mTextViewNamePtr->setText(info.remote_uri);
  183. if (info.state == voip::STATE_CALL_CALLING) {
  184. mButtonAnswerPtr->setVisible(false);
  185. }
  186. }
  187. // mSeekBarOutputVolumePtr->setMax(zk_audio_output_volume_native_max());
  188. bool isVolume = StoragePreferences::getBool(STORE_VOLUME, false);
  189. mSeekBarGainPtr->setVisible(isVolume);
  190. mTextViewGainPtr->setVisible(isVolume);
  191. mSeekBarInputPtr->setVisible(isVolume);
  192. mTextViewInputPtr->setVisible(isVolume);
  193. //打开时的声音大小
  194. int serverVol = StoragePreferences::getInt(STORE_DAY_VOL,PartSetting::dayDoorVol);
  195. if (checkIsDay()){
  196. serverVol = StoragePreferences::getInt(STORE_NIGHT_VOL,PartSetting::nightDoorVol);
  197. }
  198. LOGD("serverVol == %d", serverVol);
  199. double percent = (double) serverVol / (double)100;
  200. int vol = (int)(zk_audio_output_volume_native_max()*percent);
  201. LOGD("bed vol is %d. server is %d. max is %d",vol,serverVol, zk_audio_output_volume_native_max());
  202. zk_audio_output_set_volume_native(vol);
  203. mSeekBarOutputVolumePtr->setProgress(vol);
  204. mTextViewOutputVolumePtr->setTouchPass(true);
  205. //
  206. mSeekBarGainPtr->setProgress(StoragePreferences::getInt(STORE_GAIN_SIZE, 2));
  207. mTextViewGainPtr->setTouchPass(true);
  208. mSeekBarInputPtr->setProgress(StoragePreferences::getInt(STORE_VOLUME_NATIVE, 6));
  209. mTextViewInputPtr->setTouchPass(true);
  210. // mTextViewNamePtr->setVisible(false);
  211. // mTextViewStatePtr->setVisible(false);
  212. // mTextViewDurationPtr->setVisible(false);
  213. }
  214. /**
  215. * 当切换到该界面时触发
  216. */
  217. static void onUI_intent(const Intent *intentPtr) {
  218. if(intentPtr != NULL) {
  219. LOGD("打开通话页面,进行通话");
  220. BRIGHTNESSHELPER->screenOn();
  221. _isSleepTimerRegistered = getSleepTimerRegistered();
  222. setSleepTimerRegistered(false);
  223. // wavPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"));
  224. // mediaPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"));
  225. mediaPlayer.Play(CONFIGMANAGER->getResFilePath("ring.wav"), "", 1000,
  226. base::MediaPlayer::PlayMode::Loop);
  227. // 键值解析
  228. _isOutgoing = intentPtr->getExtra(isOutgoing);
  229. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  230. return;
  231. }
  232. if (_isOutgoing == "true"){
  233. int toId = 0;
  234. _toIdStr = intentPtr->getExtra(toIdStr);
  235. if (_toIdStr != "") {
  236. toId = atoi(_toIdStr.c_str());
  237. }
  238. // 呼叫的时候需要把tid放进去
  239. tid = sendVoiceCall(toId);
  240. mButtonAnswerPtr->setVisible(false);
  241. std::string _callName = intentPtr->getExtra(callName);
  242. if (_callName != "") {
  243. mTextViewNamePtr->setText(LANGUAGEMANAGER->getValue("Call") + _callName);
  244. } else {
  245. mTextViewNamePtr->setTextTr("CallOutTitle");
  246. }
  247. mActivityPtr->registerUserTimer(CALLING_TIME, 60000); // 如果对方没接听,则发送一个CANCEL回去
  248. }
  249. else if (_isOutgoing == "handleHCall") {
  250. string handleCallIdStr = intentPtr->getExtra(handleCallId);
  251. int _handleCallId = std::stoi(handleCallIdStr);
  252. // 呼叫的时候需要把tid放进去
  253. tid = sendVoiceHCall(_handleCallId);
  254. mButtonAnswerPtr->setVisible(false);
  255. std::string _callName = intentPtr->getExtra(callName);
  256. if (_callName != "") {
  257. mTextViewNamePtr->setText(LANGUAGEMANAGER->getValue("Call") + _callName);
  258. } else {
  259. mTextViewNamePtr->setTextTr("CallOutTitle");
  260. }
  261. mActivityPtr->registerUserTimer(CALLING_TIME, 60000); // 如果对方没接听,则发送一个CANCEL回去
  262. }
  263. else {
  264. TcpModel storeModel = CallingStatus::instance()->getTcpModel();
  265. TcpModel backTcp = storeModel;
  266. backTcp.data = storeModel.json["id"].asString();
  267. //back voice success
  268. sendVoiceTcp(VoiceAction::SUCCESS, backTcp, storeModel.from_id);
  269. mTextViewNamePtr->setText(storeModel.json["fromFrameName"].asString());
  270. //自动接听处理
  271. if (StoragePreferences::getBool(STORE_AUDO_ANSWER,false)){
  272. mButtonAnswerPtr->setVisible(false);
  273. voip::CallInfo info = GetTelephone()->GetCallInfo();
  274. if (info.state == voip::STATE_CALL_INCOMING
  275. || info.state == voip::STATE_CALL_EARLY) {
  276. GetTelephone()->Answer();
  277. //发出TCP
  278. sendVoiceTcp(VoiceAction::ACCEPT, storeModel, storeModel.from_id);
  279. }
  280. }
  281. }
  282. }
  283. }
  284. /*
  285. * 当界面显示时触发
  286. */
  287. static void onUI_show() {
  288. EASYUICONTEXT->hideStatusBar();
  289. EASYUICONTEXT->hideNaviBar();
  290. }
  291. /*
  292. * 当界面隐藏时触发
  293. */
  294. static void onUI_hide() {
  295. }
  296. /*
  297. * 当界面完全退出时触发
  298. */
  299. static void onUI_quit() {
  300. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
  301. EASYUICONTEXT->showNaviBar();
  302. EASYUICONTEXT->showStatusBar();
  303. CallingStatus::instance()->setBusy(false);
  304. CallingStatus::instance()->clearTcpModel();
  305. voip::CallInfo info = GetTelephone()->GetCallInfo();
  306. if (info.state == voip::STATE_CALL_CALLING
  307. || info.state == voip::STATE_CALL_CALLING
  308. || info.state == voip::STATE_CALL_CONFIRMED){
  309. GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
  310. GetTelephone()->Hangup();
  311. }
  312. }
  313. mediaPlayer.Stop();
  314. mActivityPtr->unregisterUserTimer(goBack);
  315. }
  316. /**
  317. * 串口数据回调接口
  318. */
  319. static void onProtocolDataUpdate(const SProtocolData &data) {
  320. }
  321. /**
  322. * 定时器触发函数
  323. * 不建议在此函数中写耗时操作,否则将影响UI刷新
  324. * 参数: id
  325. * 当前所触发定时器的id,与注册时的id相同
  326. * 返回值: true
  327. * 继续运行当前定时器
  328. * false
  329. * 停止运行当前定时器
  330. */
  331. static bool onUI_Timer(int id){
  332. switch (id) {
  333. case 1: {
  334. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  335. voip::CallInfo info = GetTelephone()->GetCallInfo();
  336. if (info.state == voip::STATE_CALL_CONFIRMED){
  337. mButtonAnswerPtr->setVisible(false);
  338. }
  339. mTextViewNamePtr->setText(info.remote_uri);
  340. mTextViewStatePtr->setText(StateString(info.state));
  341. mTextViewDurationPtr->setText(
  342. base::format("%02d:%02d",
  343. info.duration/1000/60,
  344. info.duration/1000%60));
  345. } else {
  346. voip::CallInfo info = GetTelephone()->GetCallInfo();
  347. if (info.state == voip::STATE_CALL_CONFIRMED){
  348. mButtonAnswerPtr->setVisible(false);
  349. }
  350. mTextViewStatePtr->setText(StateString(info.state));
  351. mTextViewDurationPtr->setText(
  352. base::format("%02d:%02d",
  353. info.duration/1000/60,
  354. info.duration/1000%60));
  355. }
  356. }
  357. break;
  358. case kTimerAutoAnswer: {
  359. voip::CallInfo info = GetTelephone()->GetCallInfo();
  360. if (info.state == voip::STATE_CALL_INCOMING
  361. || info.state == voip::STATE_CALL_EARLY) {
  362. bool auto_answer = StoragePreferences::getBool(SIP_AUTO_ANSWER, false);
  363. LOGD("is auto answer: %d", auto_answer);
  364. if (auto_answer) {
  365. GetTelephone()->Answer();
  366. }
  367. }
  368. }
  369. return false;
  370. break;
  371. case goBack:{
  372. setSleepTimerRegistered(_isSleepTimerRegistered);
  373. EASYUICONTEXT->goBack();
  374. break;
  375. }
  376. case CALLING_TIME: {
  377. //TCP call
  378. sendVoiceCancel(StoragePreferences::getInt(STORE_DEVICE_ID,0), 0);
  379. lightControl("DOORLED", "000F");
  380. setSleepTimerRegistered(_isSleepTimerRegistered);
  381. EASYUICONTEXT->goBack();
  382. break;
  383. }
  384. default:
  385. break;
  386. }
  387. return true;
  388. }
  389. /**
  390. * 有新的触摸事件时触发
  391. * 参数:ev
  392. * 新的触摸事件
  393. * 返回值:true
  394. * 表示该触摸事件在此被拦截,系统不再将此触摸事件传递到控件上
  395. * false
  396. * 触摸事件将继续传递到控件上
  397. */
  398. static bool oncallActivityTouchEvent(const MotionEvent &ev) {
  399. switch (ev.mActionStatus) {
  400. case MotionEvent::E_ACTION_DOWN://触摸按下
  401. //LOGD("时刻 = %ld 坐标 x = %d, y = %d", ev.mEventTime, ev.mX, ev.mY);
  402. break;
  403. case MotionEvent::E_ACTION_MOVE://触摸滑动
  404. break;
  405. case MotionEvent::E_ACTION_UP: //触摸抬起
  406. break;
  407. default:
  408. break;
  409. }
  410. return false;
  411. }
  412. static void onVideoViewPlayerMessageListener_VideoView1(ZKVideoView *pVideoView, int msg) {
  413. switch (msg) {
  414. case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_STARTED:
  415. break;
  416. case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED:
  417. break;
  418. case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_ERROR:
  419. break;
  420. }
  421. }
  422. static void onProgressChanged_SeekBarOutputVolume(ZKSeekBar *pSeekBar, int progress) {
  423. zk_audio_output_set_volume_native(progress);
  424. mTextViewOutputVolumePtr->setText(base::format("%d", progress));
  425. }
  426. static bool onButtonClick_ButtonHangup(ZKButton *pButton) {
  427. LOGD("handup click");
  428. voip::CallInfo info = GetTelephone()->GetCallInfo();
  429. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "TCP"){
  430. TcpModel storeModel = CallingStatus::instance()->getTcpModel();
  431. if (storeModel.json != 0) {
  432. //只回传iId
  433. storeModel.data = storeModel.json["id"].asString();
  434. if (info.state == voip::STATE_CALL_CALLING
  435. || info.state == voip::STATE_CALL_CALLING
  436. || info.state == voip::STATE_CALL_CONFIRMED){
  437. sendVoiceTcp(VoiceAction::HANDOFF, storeModel, storeModel.from_id);
  438. GetTelephone()->Hangup(info.id, voip::SIP_STATUS_CODE_DECLINE);
  439. GetTelephone()->Hangup();
  440. } else if (_isOutgoing == "true") {
  441. string storeModelStr = getTcpModelString(storeModel);
  442. sendVoiceTcp(VoiceAction::CANCEL, storeModel, storeModel.from_id);
  443. lightControl("DOORLED", "000F");
  444. }
  445. else if (_isOutgoing == "handleHCall") {
  446. LOGD("storeModel.from_id ============> %d", storeModel.from_id);
  447. sendVoiceCancel(storeModel.to_id, 0);
  448. setSleepTimerRegistered(_isSleepTimerRegistered);
  449. EASYUICONTEXT->goBack();
  450. }
  451. else {
  452. storeModel.data = storeModel.json["id"].asString();
  453. sendVoiceTcp(VoiceAction::REJECT, storeModel, storeModel.from_id);
  454. }
  455. } else {
  456. TcpModel tcpModel;
  457. tcpModel.tid = tid;
  458. sendVoiceTcp(VoiceAction::CANCEL, tcpModel, StoragePreferences::getInt(STORE_DEVICE_ID,0));
  459. lightControl("DOORLED", "000F");
  460. }
  461. setSleepTimerRegistered(_isSleepTimerRegistered);
  462. EASYUICONTEXT->goBack();
  463. } else {
  464. GetTelephone()->Hangup();
  465. }
  466. return false;
  467. }
  468. static bool onButtonClick_ButtonAnswer(ZKButton *pButton) {
  469. LOGD(" ButtonClick ButtonAnswer !!!\n");
  470. lightControl("DOORLED", "000F");
  471. mButtonAnswerPtr->setVisible(false);
  472. if (StoragePreferences::getString(STORE_SIGNAL_TYPE, SIGNAL_TYPE) == "SIP"){
  473. voip::CallInfo info = GetTelephone()->GetCallInfo();
  474. GetTelephone()->Answer();
  475. } else {
  476. TcpModel model = CallingStatus::instance()->getTcpModel();
  477. //LOGD("storeModel :::: type=%s,action=%s,from=%d,to=%d",model.type.c_str(),model.action.c_str(),model.from_id,model.to_id);
  478. //std::string storeModelStr = getTcpModelString(model);
  479. //LOGD("storeModelStr ===== %s",storeModelStr.c_str());
  480. //只回传iId
  481. model.data = model.json["id"].asString();
  482. sendVoiceTcp(VoiceAction::ACCEPT, model, model.from_id);
  483. }
  484. return false;
  485. }
  486. static bool onButtonClick_ButtonVol(ZKButton *pButton) {
  487. LOGD(" ButtonClick ButtonVol !!!\n");
  488. return false;
  489. }
  490. static void onProgressChanged_SeekBarGain(ZKSeekBar *pSeekBar, int progress) {
  491. //LOGD(" ProgressChanged SeekBarGain %d !!!\n", progress);
  492. mTextViewGainPtr->setText(base::format("%d", progress));
  493. GetTelephone()->SetInputPcmGainSize(progress);
  494. }
  495. static void onProgressChanged_SeekBarInput(ZKSeekBar *pSeekBar, int progress) {
  496. //LOGD(" ProgressChanged SeekBarInput %d !!!\n", progress);
  497. mTextViewInputPtr->setText(base::format("%d", progress));
  498. zk_audio_input_set_volume_native(0, 0);
  499. zk_audio_input_set_volume_native(1, progress);
  500. }
  501. static void onVideoViewPlayerMessageListener_VideoView(ZKVideoView *pVideoView, int msg) {
  502. switch (msg) {
  503. case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_STARTED:
  504. break;
  505. case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_COMPLETED:
  506. break;
  507. case ZKVideoView::E_MSGTYPE_VIDEO_PLAY_ERROR:
  508. break;
  509. }
  510. }