oem_lib.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. #ifndef __OEM_LIB__
  2. #define __OEM_LIB__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <stdio.h>
  9. #ifdef POSIX
  10. #include <semaphore.h>
  11. #endif
  12. /*oem lib extern functions*/
  13. extern void lib_oem_tts_play_end_cb();
  14. extern void lib_oem_player_need_data_len_cb(int datalen);
  15. extern void lib_oem_record_cb(const char* data, int length);
  16. /*tts functions*/
  17. /*
  18. * Function: lib_oem_tts_play
  19. *
  20. * Description:
  21. * push the tts data
  22. *
  23. * Rarameter:
  24. * text:unicode data
  25. *
  26. * Return:
  27. * none
  28. */
  29. int lib_oem_tts_play(char *text);
  30. /*
  31. * Function: lib_oem_tts_stop
  32. *
  33. * Description:
  34. * stop the tts
  35. *
  36. * Rarameter:
  37. * none
  38. *
  39. * Return:
  40. * none
  41. */
  42. int lib_oem_tts_stop(void);
  43. /*
  44. * Function: lib_oem_tts_status
  45. *
  46. * Description:
  47. * get the tts status
  48. *
  49. * Rarameter:
  50. * none
  51. *
  52. * Return:
  53. * 0-not work
  54. * 1-working
  55. */
  56. int lib_oem_tts_status(void);
  57. /*
  58. * Function: lib_oem_start_record
  59. *
  60. * Description:
  61. * start record for ptt or open device for record
  62. *
  63. * Rarameter:
  64. * none
  65. *
  66. * Return:
  67. * none
  68. */
  69. int lib_oem_start_record(void);
  70. /*
  71. * Function: lib_oem_stop_record
  72. *
  73. * Description:
  74. * stop record or close device for record
  75. *
  76. * Rarameter:
  77. * none
  78. *
  79. * Return:
  80. * none
  81. */
  82. int lib_oem_stop_record(void);
  83. /*
  84. * Function: lib_oem_start_play
  85. *
  86. * Description:
  87. * start play pcm, or open device for play
  88. *
  89. * Rarameter:
  90. * none
  91. *
  92. * Return:
  93. * none
  94. */
  95. int lib_oem_start_play(void);
  96. /*
  97. * Function: lib_oem_stop_play
  98. *
  99. * Description:
  100. * stop play pcm, or close device for play
  101. *
  102. * Rarameter:
  103. * none
  104. *
  105. * Return:
  106. * none
  107. */
  108. int lib_oem_stop_play(void);
  109. /*
  110. * Function: lib_oem_play
  111. *
  112. * Description:
  113. * push pcm data
  114. *
  115. * Rarameter:
  116. * data:pcm data
  117. * length: the length of data
  118. *
  119. * Return:
  120. * receive data length
  121. */
  122. int lib_oem_play(const char* data, int length);
  123. /*
  124. * Function: lib_oem_out_space
  125. *
  126. * Description:
  127. * pcm free space
  128. *
  129. * Rarameter:
  130. * none
  131. *
  132. * Return:
  133. * > 0 free
  134. * 0 busy
  135. */
  136. int lib_oem_out_space(void);
  137. /*
  138. * Function: lib_oem_play_tone
  139. *
  140. * Description:
  141. * Play tone
  142. *
  143. * Rarameter:
  144. * type:
  145. * [0]--start ptt
  146. * [1]--stop ptt
  147. * [2]--error
  148. * [3]--start play
  149. * [4]--stop play
  150. *
  151. * Return:
  152. * none
  153. */
  154. int lib_oem_play_tone(int type);
  155. /*voice call functions */
  156. int lib_oem_setup_call(char* dial_number);
  157. int lib_oem_call_state();
  158. int lib_oem_call_state_change_notify();
  159. int lib_oem_call_hungup();
  160. /* network functions*/
  161. /*
  162. * Function: lib_oem_socket_set_apn
  163. *
  164. * Description:
  165. * set the new apn
  166. *
  167. * Rarameter:
  168. * apn
  169. *
  170. * Return:
  171. * none
  172. */
  173. void lib_oem_socket_set_apn(char *apn);
  174. /*
  175. * Function: lib_oem_socket_net_open
  176. *
  177. * Description:
  178. * Open the network data
  179. *
  180. * Rarameter:
  181. * none
  182. *
  183. * Return:
  184. * 0-FAIL
  185. * 1-SUCCESS
  186. */
  187. int lib_oem_socket_net_open(void);
  188. /*
  189. * Function: lib_oem_socket_get_net_status
  190. *
  191. * Description:
  192. * Get network data status
  193. *
  194. * Parameter:
  195. * none
  196. *
  197. * Return:
  198. * 0-FAIL
  199. * 1-SUCCESS
  200. */
  201. int lib_oem_socket_get_net_status(void);
  202. /*
  203. * Function: lib_oem_socket_get_network
  204. *
  205. * Description:
  206. * Get network status
  207. *
  208. * Rarameter:
  209. * none
  210. *
  211. * Return:
  212. * -1-FAIL
  213. * 0-
  214. * 1-SUCCESS
  215. */
  216. int lib_oem_socket_get_network(void);
  217. /*
  218. * Function: lib_oem_get_rssi
  219. *
  220. * Description:
  221. * Get network signal strength
  222. *
  223. * Rarameter:
  224. * none
  225. *
  226. * Return:
  227. * rssi
  228. *
  229. */
  230. int lib_oem_get_rssi(void);
  231. /*
  232. * Function: lib_oem_net_close
  233. *
  234. * Description:
  235. * Close the network
  236. *
  237. * Rarameter:
  238. * none
  239. *
  240. * Return:
  241. * 0-SUCCESS
  242. * 1-FAILURE
  243. *
  244. */
  245. int lib_oem_net_close(void);
  246. /*
  247. * Function: lib_oem_reset_ps
  248. *
  249. * Description:
  250. * network module restart
  251. *
  252. * Rarameter:
  253. * none
  254. *
  255. * Return:
  256. * 0-SUCCESS
  257. * 1-FAILURE
  258. *
  259. */
  260. int lib_oem_reset_ps(void);
  261. /*module init*/
  262. /*
  263. * Function: lib_oem_module_init
  264. *
  265. * Description:
  266. * Initialize mcm cilent for network, sim,sms,etc
  267. *
  268. * Rarameter:
  269. * none
  270. *
  271. * Return:
  272. * 0-FAILURE
  273. * 1-SUCCESS
  274. *
  275. */
  276. int lib_oem_module_init(void);
  277. /*
  278. * Function: lib_oem_play_open_pcm
  279. *
  280. * Description:
  281. * Initialize pcm for TTS
  282. *
  283. * Input:
  284. * none
  285. *
  286. * Return:
  287. * 0-FAILURE
  288. * 1-SUCCESS
  289. *
  290. */
  291. int lib_oem_play_open_pcm();
  292. /*sim*/
  293. /*
  294. * Function: lib_oem_is_sim_present
  295. *
  296. * Description:
  297. * Check the status of the SIM card
  298. *
  299. * Input:
  300. * none
  301. *
  302. * Return:
  303. * 0-SIMcard is absent
  304. * 1-SIM card is present
  305. *
  306. */
  307. int lib_oem_is_sim_present(void);
  308. /*========================================================================================
  309. FUNCTION:
  310. lib_oem_get_device_serial_number
  311. DESCRIPTION:
  312. get imei and meid
  313. PARAMETERS:
  314. data:imei+0x0a+meid+0x0a+0x00
  315. RETURN:
  316. [0]SUCCESS
  317. [-1]FAILURE
  318. =========================================================================================*/
  319. int lib_oem_get_device_serial_number(char* data);
  320. /*========================================================================================
  321. FUNCTION:
  322. lib_oem_get_sim_serial_number
  323. DESCRIPTION:
  324. get iccid and imsi
  325. PARAMETERS:
  326. data:iccid+0x0a+imsi+0x0a+0x00
  327. RETURN:
  328. [0]SUCCESS
  329. [-1]FAILURE
  330. =========================================================================================*/
  331. int lib_oem_get_sim_serial_number(char* data);
  332. /*========================================================================================
  333. FUNCTION:
  334. lib_oem_get_model
  335. DESCRIPTION:
  336. get model name
  337. RETURN:
  338. name
  339. =========================================================================================*/
  340. char* lib_oem_get_model(void);
  341. /*========================================================================================
  342. FUNCTION:
  343. lib_oem_get_system_version
  344. DESCRIPTION:
  345. get system version
  346. RETURN:
  347. version
  348. =========================================================================================*/
  349. char* lib_oem_get_system_version(void);
  350. /*========================================================================================
  351. FUNCTION:
  352. lib_oem_send_uart
  353. DESCRIPTION:
  354. poc uart sent at
  355. PARAMETERS:
  356. data:AT size: AT len
  357. RETURN:
  358. [0]SUCCESS
  359. [-1]FAILURE
  360. =========================================================================================*/
  361. int lib_oem_send_uart(const char* data, int size);
  362. /*========================================================================================
  363. FUNCTION:
  364. lib_oem_uart_cb
  365. DESCRIPTION:
  366. poc uart recv at
  367. PARAMETERS:
  368. data:AT size: AT len
  369. RETURN:
  370. [0]SUCCESS
  371. [-1]FAILURE
  372. =========================================================================================*/
  373. extern int lib_oem_uart_cb(char* data, int size);
  374. /*========================================================================================
  375. FUNCTION:
  376. poc_uart_open
  377. DESCRIPTION:
  378. poc open uart
  379. =========================================================================================*/
  380. void poc_uart_open(void);
  381. /*========================================================================================
  382. FUNCTION:
  383. poc_uart_close
  384. DESCRIPTION:
  385. poc close uart
  386. =========================================================================================*/
  387. void poc_uart_close(void);
  388. /**远程升级初始化
  389. *@return 0: 表示成功
  390. * <0: 表示失败
  391. **/
  392. int lib_oem_ota_init(void);
  393. /**远程升级下载
  394. *@param data: 下载固件包数据
  395. *@param len: 下载固件包长度
  396. *@param total: 固件包总大小
  397. *@return 0: 表示成功
  398. * <0: 表示失败
  399. **/
  400. int lib_oem_ota_process(char* data, unsigned int len, unsigned int total);
  401. /**远程升级结束且校验
  402. *@return 0: 表示成功, 成功后模块自动重启升级
  403. * <0: 表示失败
  404. **/
  405. int lib_oem_ota_done(void);
  406. extern int lib_oem_device_bts(int* mcc,int* mnc,int* lac, int* cid);
  407. #ifdef __cplusplus
  408. }
  409. #endif
  410. #endif