BikeControl.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Mead
  5. * Date: 2019/9/5
  6. * Time: 9:36 PM
  7. */
  8. namespace App\Servers\Weikemu;
  9. use App\Handlers\ExceptionTrait;
  10. use App\Servers\Weikemu\Maps\VideoMap;
  11. use GatewayWorker\Lib\Gateway;
  12. class BikeControl
  13. {
  14. use ExceptionTrait;
  15. private static $start = '42 44';
  16. private static $registerAddress = 'node1:11001';
  17. /**
  18. * realLocation 3.2.2 实时位置上报参数设置
  19. *
  20. * @param $box_no
  21. * @param string $control 01:实时追踪开启,00:实时追踪关闭
  22. * @param int $interval 上报间隔 秒 量化值30
  23. * @param int $continued 持续时长(1-43200) 分钟
  24. * @return bool
  25. * @author Fx
  26. *
  27. */
  28. public static function realLocation($box_no, $control = "01", $interval = 1, $continued = 60)
  29. {
  30. $cmd = "23";
  31. $body = [
  32. self::getMsgId(),
  33. $control,// 1:实时追踪开启,0:实时追踪关闭
  34. str_pad(base_convert($interval, 10, 16), 4, 0, STR_PAD_LEFT),//上报间隔
  35. str_pad(base_convert($continued, 10, 16), 4, 0, STR_PAD_LEFT),//持续时长(1-43200)
  36. ];
  37. $send_msg = self::makeSendMsg($cmd, $body);
  38. return self::send($box_no, $send_msg);
  39. }
  40. /**
  41. * 获取序号(msg_id)
  42. * @return string
  43. * Author: Mead
  44. */
  45. private static function getMsgId()
  46. {
  47. $msg_id = str_pad(dechex(rand(0, 65535)), 4, "0", STR_PAD_LEFT);
  48. return $msg_id;
  49. }
  50. /**
  51. * 组装命令
  52. * @param $cmd
  53. * @param $msgID
  54. * @return string
  55. * User: Mead
  56. */
  57. private static function makeSendMsg($cmd, $body, $msg_id = false, $length = false)
  58. {
  59. if (is_array($body)) {
  60. $body = self::arr2arr($body);
  61. }
  62. if (is_string($body)) {
  63. $body = str_split($body, 2);
  64. }
  65. if ($length !== false) {
  66. $length = str_pad($length, 4, '0', STR_PAD_LEFT);
  67. } else {
  68. $length = str_pad(dechex(count($body)), 4, '0', STR_PAD_LEFT);
  69. }
  70. if ($msg_id === false) {
  71. $msg_id = self::getMsgId();
  72. }
  73. $header = [
  74. $cmd,
  75. $msg_id,
  76. '00',
  77. $length
  78. ];
  79. $response = self::formatArr($header, $body);
  80. $response[] = self::verification($response);
  81. return self::format(self::$start . implode('', $response));
  82. }
  83. /**
  84. * 格式数组
  85. * @param $arr
  86. * @return array
  87. * User: Mead
  88. */
  89. private static function arr2arr($arr)
  90. {
  91. $arr = implode('', $arr);
  92. return str_split(str_replace(' ', '', $arr), 2);
  93. }
  94. /**
  95. * 合并数组
  96. * @return array
  97. * User: Mead
  98. */
  99. private static function formatArr()
  100. {
  101. $args = func_get_args();
  102. $arr = '';
  103. foreach ($args as $arg) {
  104. $arr .= implode('', $arg);
  105. }
  106. return str_split($arr, 2);
  107. }
  108. /**
  109. * 校检
  110. * @param $data
  111. * @param $verification
  112. * @return bool
  113. * Author: Mead
  114. */
  115. protected static function verification($data)
  116. {
  117. $a = $b = 0;
  118. for ($i = 0; $i < count($data); $i++) {
  119. $a = $a + hexdec($data[$i]);
  120. $b = $a + $b;
  121. }
  122. return str_pad(substr(dechex($a), -2), 2, 0, STR_PAD_LEFT) . str_pad(substr(dechex($b), -2), 2, 0, STR_PAD_LEFT);
  123. }
  124. /**
  125. * 格式字符
  126. * @param $str
  127. * @return string
  128. * User: Mead
  129. */
  130. private static function format($str)
  131. {
  132. return strtoupper(implode('', str_split(str_replace(' ', '', $str), 2)));
  133. }
  134. /**
  135. * 发送数据
  136. * @param $box_no
  137. * @param $msg
  138. * @return bool
  139. * User: Mead
  140. */
  141. private static function send($box_no, $msg)
  142. {
  143. self::log($msg, 'sendMsg');
  144. Gateway::sendToUid($box_no, '+NNMI,' . hex2bin(str_replace(' ', '', $msg . '0D0A')));
  145. return true;
  146. }
  147. /**
  148. * multipleConfigsSetting 3.2.3 综合配置参数设置
  149. *
  150. * @param $box_no
  151. * @param $arr
  152. * @return bool
  153. * @author Fx
  154. *
  155. */
  156. public static function multipleConfigsSetting($box_no, $arr)
  157. {
  158. $cmd = "2C";
  159. // ['ip' => $ip,'port' => $port,'bluetooth_name' => $bluetooth_name,'bluetooth_token' => $bluetooth_token,
  160. // 'is_auto_lock' => $is_auto_lock, 'auto_lock_time' => $auto_lock_time,
  161. // 'is_displacement' => $is_displacement, 'displacement_radius' => $displacement_radius,
  162. // 'is_shock' => $is_shock,
  163. // 'is_temperature' => $is_temperature,'temperature' => $temperature,
  164. // 'is_speeding' => $is_speeding,'speeding'=>$speeding,
  165. // 'motion_position_sampling_interval'=>$motion_position_sampling_interval,
  166. // 'motion_position_reporting_interval'=>$motion_position_reporting_interval,
  167. // 'static_position_reporting_interval'=>$static_position_reporting_interval];
  168. $ip = $arr['ip'];
  169. $port = $arr['port'];
  170. $bluetooth_name = $arr['bluetooth_name']; // 蓝牙名称
  171. $bluetooth_token = $arr['bluetooth_token']; //蓝牙token
  172. $is_auto_lock = $arr['is_auto_lock']; // 是否开启自动落锁1:自动落锁开启;0:关闭自动落锁
  173. $auto_lock_time = str_pad(base_convert($arr['auto_lock_time'], 10, 2), 7, 0, STR_PAD_LEFT); // 自动落锁时长,量化单位1分钟
  174. $is_displacement = $arr['is_displacement']; // 位移告警开启设置1:位移告警开启;0: 位移告警关闭
  175. $displacement_radius = str_pad(base_convert($arr['displacement_radius'], 10, 2), 7, 0, STR_PAD_LEFT); // 位移告警半径门限,取值范围0~126,量化单位10米
  176. $is_shock = $arr['is_shock'];//震动告警开启设置1:震动告警开启,0:震动告警关闭
  177. $is_temperature = $arr['is_temperature'];//温度告警开启设置。1:温度告警开启;0:温度告警关闭
  178. $temperature = str_pad(base_convert($arr['temperature'], 10, 2), 7, 0, STR_PAD_LEFT); // 温度告警门限,取值范围0~126,
  179. $is_speeding = $arr['is_speeding']; // 超速告警开启设置。1:超速告警开启;0:超速告警关闭
  180. $speeding = str_pad(base_convert($arr['speeding'] * 2, 10, 2), 7, 0, STR_PAD_LEFT); // 超速告警门限 量化单位2km/h,范围 0~126
  181. $motion_position_sampling_interval = $arr['motion_position_sampling_interval']; // 运动状态,位置采样间隔设置(默认1秒)
  182. $motion_position_reporting_interval = $arr['motion_position_reporting_interval']; // 运动状态,位置上报间隔设置
  183. $static_position_reporting_interval = $arr['static_position_reporting_interval']; // 静止状态,位置上报间隔设置
  184. $body = [
  185. self::getMsgId(),
  186. str_pad(base_convert($motion_position_sampling_interval, 10, 16), 2, 0, STR_PAD_LEFT),// 运动状态,位置采样间隔设置(默认1秒)
  187. str_pad(base_convert($motion_position_reporting_interval, 10, 16), 2, 0, STR_PAD_LEFT),// 运动状态,位置上报间隔设置
  188. str_pad(base_convert($static_position_reporting_interval, 10, 16), 4, 0, STR_PAD_LEFT),// 静止状态,位置上报间隔设置
  189. str_pad(base_convert($displacement_radius . $is_displacement, 2, 16), 2, 0, STR_PAD_LEFT),// 位移告警
  190. str_pad(base_convert('0000000' . $is_shock, 2, 16), 2, 0, STR_PAD_LEFT),// 震动告警
  191. str_pad(base_convert($temperature . $is_temperature, 2, 16), 2, 0, STR_PAD_LEFT),// 温度告警
  192. str_pad(base_convert($speeding . $is_speeding, 2, 16), 2, 0, STR_PAD_LEFT),// 超速告警
  193. str_pad(base_convert($auto_lock_time . $is_auto_lock, 2, 16), 2, 0, STR_PAD_LEFT),// 自动落锁
  194. str_pad(base_convert($port, 10, 16), 4, 0, STR_PAD_LEFT),// 自动落锁
  195. str_pad(base_convert($ip, 10, 16), 8, 0, STR_PAD_LEFT),// 自动落锁
  196. str_pad($bluetooth_name, 10, 0, STR_PAD_LEFT),
  197. str_pad(base_convert($bluetooth_token, 10, 16), 8, 0, STR_PAD_LEFT),// 自动落锁
  198. '00 00 00 00 00 00'
  199. ];
  200. $send_msg = self::makeSendMsg($cmd, $body);
  201. return self::send($box_no, $send_msg);
  202. }
  203. /**
  204. * reboot 重启中控
  205. *
  206. * @param $box_no
  207. * @param $reboot string 11:重启升级;01:重启不升级
  208. * @param $ip string 重启升级地址(域名或IP地址)
  209. * @param $port int 重启升级端口号
  210. * @param $path string 重启升级路径
  211. * @param $upFile string 重启升级文件名称
  212. * @return bool
  213. * @author Fx
  214. *
  215. */
  216. public static function reboot($box_no, $reboot = "01", $ip, $port, $path, $upFile)
  217. {
  218. $cmd = "25";
  219. $reboot = '000000' . $reboot; // 11:重启升级;01:重启不升级
  220. $body = [
  221. self::getMsgId(),
  222. self::str2Hex($reboot, 2, 8),
  223. self::char2Hex($ip, 20),
  224. self::str2Hex($port, 10, 8),
  225. self::char2Hex($path, 20),
  226. self::char2Hex($upFile, 20),
  227. ];
  228. $send_msg = self::makeSendMsg($cmd, $body);
  229. return self::send($box_no, $send_msg);
  230. }
  231. /**
  232. * str2Hex 其他进制转16进制
  233. *
  234. * @param $str string 需要转的数据
  235. * @param $frombase int 需要转的进制
  236. * @param $pad_length int 长度
  237. * @return string
  238. * @author Fx
  239. *
  240. */
  241. private static function str2Hex($str, $frombase, $pad_length)
  242. {
  243. return str_pad(base_convert($str, $frombase, 16), $pad_length, 0, STR_PAD_LEFT);
  244. }
  245. /**
  246. * char2Hex char 转16进制
  247. *
  248. * @param $char
  249. * @param $pad_length
  250. * @return string
  251. * @author Fx
  252. *
  253. */
  254. private static function char2Hex($char, $pad_length)
  255. {
  256. return str_pad(bin2hex($char), $pad_length, 0, STR_PAD_LEFT);
  257. }
  258. /**
  259. * settingVoice 语音设置
  260. *
  261. * @param $box_no
  262. * @param $voice_no
  263. * @param $ip
  264. * @param $port
  265. * @param $path
  266. * @param $upFile
  267. * @return bool
  268. * @author Fx
  269. *
  270. */
  271. public static function settingVoice($box_no, $voice_no, $ip, $port, $path, $upFile)
  272. {
  273. $cmd = "2A";
  274. $body = [
  275. self::getMsgId(),
  276. '00',
  277. self::str2Hex($voice_no, 10, 2),
  278. self::char2Hex($ip, 20),
  279. self::str2Hex($port, 10, 8),
  280. self::char2Hex($path, 20),
  281. self::char2Hex($upFile, 20),
  282. ];
  283. $send_msg = self::makeSendMsg($cmd, $body);
  284. return self::send($box_no, $send_msg);
  285. }
  286. /**
  287. * setBoxSetting 配置中控
  288. *
  289. * @param $box_no
  290. * @param $arr
  291. * @return bool
  292. * @author Fx
  293. *
  294. */
  295. public static function setBoxSetting($box_no, $arr)
  296. {
  297. $cmd = "2C";
  298. // Log::info($arr['auto_lock_time']);
  299. $auto_lock_time = str_pad(base_convert($arr['auto_lock_time'], 10, 2), 7, 0, STR_PAD_LEFT); // 自动落锁时长,量化单位1分钟
  300. $ipArr = explode('.', $arr['ip']);
  301. $ip = self::decToHex($ipArr[0]) . self::decToHex($ipArr[1]) . self::decToHex($ipArr[2]) . self::decToHex($ipArr[3]);
  302. $port = str_pad(base_convert($arr['port'], 10, 16), 4, 0, STR_PAD_LEFT);
  303. // 中控升级后调整
  304. // $ip = 'FF FF FF FF';
  305. // $port = 'FF FF';
  306. $body = [
  307. self::getMsgId(),
  308. 'FF',// 运动状态,位置采样间隔设置(默认1秒)
  309. str_pad(base_convert($arr['motion_position_reporting_interval'], 10, 16), 2, 0, STR_PAD_LEFT),// 运动状态,位置上报间隔设置
  310. str_pad(base_convert($arr['static_position_reporting_interval'], 10, 16), 4, 0, STR_PAD_LEFT),// 静止状态,位置上报间隔设置
  311. 'FF',// 位移告警
  312. 'FF',// 震动告警
  313. 'FF',// 温度告警
  314. 'FF',// 超速告警
  315. str_pad(base_convert($auto_lock_time . '1', 2, 16), 2, 0, STR_PAD_LEFT),// 自动落锁
  316. // 'FF FF',
  317. $port,// port
  318. $ip,
  319. // str_pad(base_convert($arr['ip'], 10, 16), 8, 0, STR_PAD_LEFT),// ip
  320. 'FF FF FF FF FF FF FF FF FF FF',// 20位
  321. 'FF FF FF FF ',//
  322. 'FF FF FF FF FF FF'
  323. ];
  324. $send_msg = self::makeSendMsg($cmd, $body);
  325. return self::send($box_no, $send_msg);
  326. }
  327. /**
  328. * guardSwitch 3.2.7 防盗开关设置
  329. *
  330. * @param $box_no
  331. * @param $control 00:关闭 01:开启
  332. * @return bool
  333. * @author Fx
  334. *
  335. */
  336. public static function guardSwitch($box_no, $control)
  337. {
  338. $cmd = "2E";
  339. $body = [
  340. self::getMsgId(),
  341. $control
  342. ];
  343. $send_msg = self::makeSendMsg($cmd, $body);
  344. return self::send($box_no, $send_msg);
  345. }
  346. /**
  347. * batterySwitch 3.2.8 电池仓开关设置
  348. *
  349. * @param $box_no
  350. * @return bool
  351. * @author Fx
  352. *
  353. */
  354. public static function batterySwitch($box_no)
  355. {
  356. $cmd = "2F";
  357. $body = [
  358. self::getMsgId(),
  359. '01',
  360. ];
  361. $send_msg = self::makeSendMsg($cmd, $body);
  362. return self::send($box_no, $send_msg);
  363. }
  364. /**
  365. * limitSpeed 限速
  366. *
  367. * @param $box_no
  368. * @param $limit int 限速[%]
  369. * @return bool
  370. * @author Fx
  371. *
  372. */
  373. public static function limitSpeed($box_no, $limit)
  374. {
  375. $cmd = "30";
  376. $body = [
  377. self::getMsgId(),
  378. self::str2Hex($limit, 10, 2),// 限速[%]
  379. ];
  380. $send_msg = self::makeSendMsg($cmd, $body);
  381. return self::send($box_no, $send_msg);
  382. }
  383. /**
  384. * undervoltageProtection 3.2.10 控制器欠压保护设置
  385. *
  386. * @param $box_no
  387. * @param $limit int 控制器欠压保护值,量单位1mv
  388. * @return bool
  389. * @author Fx
  390. *
  391. */
  392. public static function undervoltageProtection($box_no, $limit)
  393. {
  394. $cmd = "31";
  395. $body = [
  396. self::getMsgId(),
  397. self::str2Hex($limit, 10, 4),// 限速[%]
  398. ];
  399. $send_msg = self::makeSendMsg($cmd, $body);
  400. return self::send($box_no, $send_msg);
  401. }
  402. /**
  403. * currentLimitingProtection 3.2.11 控制器限流保护设置
  404. *
  405. * @param $box_no
  406. * @param $limit int 控制器限流保护值,量化单位1mA
  407. * @return bool
  408. * @author Fx
  409. *
  410. */
  411. public static function currentLimitingProtection($box_no, $limit)
  412. {
  413. $cmd = "32";
  414. $body = [
  415. self::getMsgId(),
  416. self::str2Hex($limit, 10, 4),//
  417. ];
  418. $send_msg = self::makeSendMsg($cmd, $body);
  419. return self::send($box_no, $send_msg);
  420. }
  421. /**
  422. * slowReboot 3.2.12 控制器缓启动设置
  423. *
  424. * @param $box_no
  425. * @param $control string 01,缓启动;00,快启动
  426. * @return bool
  427. * @author Fx
  428. *
  429. */
  430. public static function slowReboot($box_no, $control)
  431. {
  432. $cmd = "33";
  433. $body = [
  434. self::getMsgId(),
  435. $control,
  436. ];
  437. $send_msg = self::makeSendMsg($cmd, $body);
  438. return self::send($box_no, $send_msg);
  439. }
  440. /**
  441. * lampSwitch 3.2.13 控制器大灯设置
  442. *
  443. * @param $box_no
  444. * @param $control string 01,大灯开;00,大灯关
  445. * @return bool
  446. * @author Fx
  447. *
  448. */
  449. public static function lampSwitch($box_no, $control)
  450. {
  451. $cmd = "34";
  452. $body = [
  453. self::getMsgId(),
  454. $control,
  455. ];
  456. $send_msg = self::makeSendMsg($cmd, $body);
  457. return self::send($box_no, $send_msg);
  458. }
  459. /**
  460. * openLock 开锁
  461. *
  462. * @param $box_no
  463. * @return bool
  464. * @author Fx
  465. *
  466. */
  467. public static function openLock($box_no)
  468. {
  469. self::electricSwitchControl($box_no, '01');
  470. self::orderStatus($box_no, '01');
  471. return self::playVoice($box_no, VideoMap::VIDEO_OPEN_LOCK);
  472. }
  473. /**
  474. * electricSwitchControl 电门控制
  475. *
  476. * @param $box_no
  477. * @param $control 01 电门开启; 00 电门关闭(关闭防盗开关);02 电门关闭(开启防盗开关);
  478. * @return bool
  479. * @author Fx
  480. *
  481. */
  482. public static function electricSwitchControl($box_no, $control = "01")
  483. {
  484. // echo 'kaiguansuo' . PHP_EOL;
  485. $cmd = "2D";
  486. $body = [
  487. self::getMsgId(),
  488. $control,// 01 电门开启; 00 电门关闭(关闭防盗开关);02 电门关闭(开启防盗开关);
  489. ];
  490. $send_msg = self::makeSendMsg($cmd, $body);
  491. return self::send($box_no, $send_msg);
  492. }
  493. /**
  494. * orderStatus
  495. *
  496. * @param $box_no
  497. * @param $control string 01:接单开启;00:接单关闭
  498. * @return bool
  499. * @author Fx
  500. *
  501. */
  502. public static function orderStatus($box_no, $control)
  503. {
  504. $cmd = "35";
  505. $body = [
  506. self::getMsgId(),
  507. $control,
  508. ];
  509. $send_msg = self::makeSendMsg($cmd, $body);
  510. return self::send($box_no, $send_msg);
  511. }
  512. /**
  513. * 播放语音
  514. * @param $box_no
  515. * @return bool
  516. * User: Mead
  517. */
  518. public static function playVoice($box_no, $voice_no = '09')
  519. {
  520. $cmd = "2A";
  521. $body = [
  522. self::getMsgId(),
  523. '01',
  524. $voice_no,
  525. 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF',
  526. 'FF FF FF FF',
  527. 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF',
  528. 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF',
  529. ];
  530. $send_msg = self::makeSendMsg($cmd, $body);
  531. return self::send($box_no, $send_msg, false);
  532. }
  533. /**
  534. * nowBikeLocation 立即定位
  535. *
  536. * @param $box_no
  537. * @return bool
  538. * @author Fx
  539. *
  540. */
  541. public static function nowBikeLocation($box_no)
  542. {
  543. return self::queryCmd($box_no, '00000001');
  544. }
  545. /**
  546. * queryCmd 3.2.1 查询指令
  547. *
  548. * @param $box_no
  549. * @return bool
  550. * @author Fx
  551. *
  552. */
  553. public static function queryCmd($box_no, $str2 = '00111101')
  554. {
  555. // echo 'queryCmd' . PHP_EOL;
  556. $cmd = "2B";
  557. // $str2 = '00111101'; // 3d
  558. $body = [
  559. self::getMsgId(),
  560. str_pad(base_convert($str2, 2, 16), 2, 0, STR_PAD_LEFT)
  561. ];
  562. $send_msg = self::makeSendMsg($cmd, $body);
  563. // echo $send_msg . PHP_EOL;
  564. return self::send($box_no, $send_msg);
  565. }
  566. /**
  567. * 中控状态
  568. * @param $box_no
  569. * @return bool
  570. * Author: Mead
  571. */
  572. public static function nowBoxStatus($box_no)
  573. {
  574. return self::queryCmd($box_no, '00001000');
  575. }
  576. /**
  577. * openLock 开锁
  578. *
  579. * @param $box_no
  580. * @return bool
  581. * @author Fx
  582. *
  583. */
  584. public static function closeLock($box_no, $video = false)
  585. {
  586. self::electricSwitchControl($box_no, '02');
  587. if ($video) {
  588. self::playVoice($box_no, VideoMap::VIDEO_RETURN_BIKE);
  589. }
  590. return self::orderStatus($box_no, '00');
  591. }
  592. /**
  593. * closeLock 临时关锁 (设防)
  594. *
  595. * @param $box_no
  596. * @return bool
  597. * @author Fx
  598. *
  599. */
  600. public static function temporaryCloseLock($box_no)
  601. {
  602. self::electricSwitchControl($box_no, '02');
  603. return self::playVoice($box_no, VideoMap::VIDEO_FIND_BIKE);
  604. }
  605. /**
  606. * closeLockNoGuard 关锁 (不设防) 失能
  607. *
  608. * @param $box_no
  609. * @return bool
  610. * @author Fx
  611. *
  612. */
  613. public static function outAreaLoseElectric($box_no, $video = false)
  614. {
  615. self::electricSwitchControl($box_no, '00');
  616. sleep(1);
  617. if ($video) {
  618. self::playVoice($box_no, $video);
  619. }
  620. // return self::playVoice($box_no, VideoMap::VIDEO_RESERVED);
  621. }
  622. /**
  623. * outAreaGetElectric 开锁 获能
  624. *
  625. * @param $box_no
  626. * @return bool
  627. * @author Fx
  628. *
  629. */
  630. public static function outAreaGetElectric($box_no)
  631. {
  632. self::electricSwitchControl($box_no, '01');
  633. return self::playVoice($box_no, VideoMap::VIDEO_KEEP_GOING);
  634. }
  635. }