callLogic.cc 17 KB

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