broad.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. #ifndef __BROAD_OPEN_H__
  2. #define __BROAD_OPEN_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "type.h"
  7. typedef enum AUDIO_STATE{
  8. AUDIO_IDLE, //话权空闲
  9. BND_SPEAK_START, //本人开始讲话通知,这个是同步的,证明poc在本地判断已经通过,开始向服务器申请麦权了
  10. BND_SPEAK_START_ACK, //本人开始讲话,并向服务器请求的话权的请求服务器回应了,这个通知是个异步的
  11. BND_SPEAKING, //本人正在讲话
  12. BND_SPEAK_STOP, //本人停止讲话
  13. BND_LISTEN_START, //本人开始收听
  14. BND_LISTENING, //本人正在收听
  15. BND_LISTEN_STOP, //本人停止收听
  16. BND_TTS_START, //tts开始播放
  17. BND_TTS_STOP, //tts停止播放
  18. BND_TONE_START, //tone开始播放
  19. BND_TONE_STOP, //tone停止播放
  20. BND_REC_PLAY_START, //本地录音开始播放
  21. BND_REC_PLAY_STOP, //本地录音停止播放
  22. }AUDIO_STATE;
  23. typedef enum VOL_TYPE{
  24. BND_VOICE,
  25. BND_TTS,
  26. BND_TONE
  27. }VOL_TYPE;
  28. typedef void(*ui_notify_cb)(void* notify);
  29. void broad_register_ui_notify_cb(ui_notify_cb cb);
  30. /*
  31. FUN:login_state_cb 登录状态回调
  32. PARAM:
  33. online:USER_OFFLINE/USER_ONLINE
  34. */
  35. typedef void(*login_state_cb)(int online);
  36. /*
  37. FUN:join_group_cb 进组回调,触发源包括主动进组和被动进组
  38. PARAM:
  39. groupname:当前群组的名字
  40. gid:当前群组gid
  41. */
  42. typedef void(*join_group_cb)(const char* groupname, bnd_gid_t gid);
  43. /*
  44. FUN:audio_cb 音频的回调
  45. PARAM:
  46. state:当前语音状态:收听/讲话/TTS/TONE
  47. uid:当前操作用户uid,讲话/TTS/TONE时为0
  48. name:当前操作用户名字,讲话/TTS/TONE时为NULL
  49. flag:如果state为BND_LISTEN_START,flag==1表示本机可以打断对方讲话,flag==0表示本机不能打断对方讲话
  50. */
  51. typedef void(*audio_cb)(AUDIO_STATE state, bnd_uid_t uid, const char* name, int flag);
  52. /*
  53. FUN:callmember_cb 单呼的回调
  54. PARAM:
  55. ret:1->成功,0->失败,2->超时解散
  56. */
  57. typedef void(*callmember_cb)(int ret);
  58. /*
  59. FUN:listupdate_cb 数据变化的回调
  60. PARAM:
  61. flag:1:群组列表变化, 2:成员列表变化
  62. */
  63. typedef void(*listupdate_cb)(int flag);
  64. typedef void(*member_list_update_cb)(int gid);
  65. /*
  66. FUN:member_change_cb 数据变化的回调
  67. PARAM:
  68. flag:1 离组
  69. gid:变化的gid
  70. num:个数
  71. uids:uid集合
  72. */
  73. typedef void(*member_change_cb)(int flag, bnd_gid_t gid, int nun, bnd_uid_t* uids);
  74. /*
  75. FUN:error_cb 异常错误信息的回调
  76. PARAM:
  77. info: 异常信息
  78. */
  79. typedef void(*error_cb)(const char* info);
  80. /*
  81. FUN:poc_at_cb AT透传回调,用于接收POC处理后的返回AT数据
  82. PARAM:
  83. at: POC处理后的返回AT数据
  84. */
  85. typedef void(*poc_at_cb)(char* at);
  86. /*
  87. FUN:location_cb GPS定位信息变化通知
  88. PARAM:
  89. on: 定位开关, 1是开启,0是关闭
  90. interval: 定位上报间隔,单位秒
  91. */
  92. typedef void(*location_cb)(unsigned char on, int interval);
  93. typedef void(*upgrade_cb)(int ret);
  94. typedef void(*reminder_cb)(char* reminder, int day);
  95. typedef void(*write_account_cb)(int ret);
  96. typedef void(*member_audio_enable)(int enable);
  97. typedef void(*request_lbs_info_cb)(char *z8filename,char *z12filename, char *z16filename, char *lbs_tts,char is_lbs_tts, char is_static_map);
  98. typedef void(*weather_info_cb)(char *lbs_tts,char is_lbs_tts);
  99. typedef void(*location_change_cb)(int location_switch, int report_rate);
  100. int broad_set_thread_priority(int priority);
  101. void broad_set_notify_mode(int flags);
  102. void broad_init(void);
  103. void broad_free(void);
  104. void broad_log(boolean enable);
  105. int broad_login(login_state_cb cb);
  106. int broad_logout(void);
  107. int broad_joingroup(bnd_gid_t gid);
  108. int broad_leavegroup(void);
  109. //1:start 0:stop
  110. int broad_speak(boolean start);
  111. int broad_calluser(const bnd_uid_t uid ,callmember_cb cb);
  112. int broad_callusers( const bnd_uid_t* uids, int num, callmember_cb cb );
  113. //按索引查询群组信息
  114. int broad_group_getbyindex(int index,bnd_group_t* dst);
  115. //如果gid传入0,可查询当前群组信息
  116. int broad_group_getbyid(bnd_gid_t gid,bnd_group_t* dst);
  117. //如果uid传入0,可查询当前登录用户信息
  118. int broad_member_getbyid(bnd_uid_t uid,bnd_member_t* dst);
  119. int broad_get_loginstate(void);
  120. int broad_get_groupcount(void);
  121. /*
  122. FUN:broad_get_grouplist
  123. PARAM:
  124. dst和dst_size为调用者的数组空间及数组大小
  125. index_begin为查询的索引起始值
  126. count为计划查询的个数
  127. RETURN:
  128. 实际查询到的个数
  129. */
  130. int broad_get_grouplist(bnd_group_t* dst, int dst_size, int index_begin, int count);
  131. const int broad_get_membercount(bnd_gid_t gid );
  132. /*
  133. FUN:broad_get_memberlist
  134. PARAM:
  135. gid为群组id
  136. dst和dst_size为调用者的数组空间及数组大小
  137. index_begin为查询的索引起始值
  138. count为计划查询的个数
  139. RETURN:
  140. 实际查询到的个数
  141. */
  142. const int broad_get_memberlist(bnd_gid_t gid, bnd_member_t* dst, int dst_size, int index_begin, int count);
  143. AUDIO_STATE broad_get_audiostate(void);
  144. //boolean interrupt : true--interrupt current tts playing
  145. int broad_play_tts(const char* tts, boolean interrupt);
  146. int broad_send_ping(void);
  147. //lat:纬度, lon: 经度, time: 定位时间
  148. int broad_send_gpsinfo(double lon,double lat,bnd_time_t time, double alt, double speed, double dirang);
  149. void broad_get_version(char* ver);
  150. void broad_get_upgrade_version(char* ver);
  151. int broad_current_zone_time(bnd_time_t* now, int zone);
  152. //success return 0, failed return -1
  153. int broad_set_tts_enable(boolean enable);
  154. int broad_set_tone_enable(boolean enable);
  155. int broad_set_vol(VOL_TYPE type, int vol);
  156. int broad_get_vol(VOL_TYPE type);
  157. //获取帐号可用天数
  158. int broad_get_account_day(void);
  159. //mode:1->open; 0->close; 2->clear all history
  160. int broad_set_rec_audio_mode(unsigned char mode);
  161. int broad_get_rec_audio_count(void);
  162. //index:录音列表索引, name:讲话的用户名utf8格式, delay:语音时长(单位秒), time:录制时间
  163. int broad_get_rec_audio_info(int index, char* name, unsigned char* delay, bnd_time_t* time);
  164. //index:录音列表索引
  165. int broad_play_rec_audio(int index);
  166. int broad_stop_play_rec_audio(void);
  167. //notify
  168. void broad_register_audio_cb(audio_cb cb);
  169. void broad_register_join_group_cb(join_group_cb cb);
  170. void broad_register_listupdate_cb(listupdate_cb cb);
  171. void broad_register_member_list_update_cb(member_list_update_cb cb);
  172. void broad_register_member_change_cb(member_change_cb cb);
  173. void broad_register_member_audio_enable_cb(member_audio_enable cb);
  174. void broad_register_error_cb(error_cb cb);
  175. void broad_register_location_cb(location_cb cb);
  176. void broad_register_upgrade_cb(upgrade_cb cb);
  177. void broad_register_reminder_cb(reminder_cb cb);
  178. void broad_register_write_account_cb(write_account_cb cb);
  179. void broad_register_request_lbs_info_cb(request_lbs_info_cb cb);
  180. void broad_register_weather_info_cb(weather_info_cb cb);
  181. void broad_register_location_change_cb(location_change_cb cb);
  182. void broad_register_cell_location_change_cb(location_change_cb cb);
  183. int broad_read_custom(BND_CUSTOM_TYPE type, const char* value);
  184. int broad_write_custom(BND_CUSTOM_TYPE type, const char* value);
  185. void broad_set_auto_end_temp_call_time(unsigned int t);
  186. void broad_set_is_destroy_temp_call(boolean flag);
  187. int broad_set_poc_uart_device(int open); //默认uart设备是打开的,如需关闭请设置为0
  188. //AT 透传接口
  189. int broad_send_at(char* at); //发送
  190. void broad_register_poc_at_cb(poc_at_cb cb);//注册接收回调
  191. int broad_set_solution(char *solution);
  192. int broad_set_solution_version(char *version);
  193. int broad_set_productInfo(char *productInfo);
  194. int broad_set_manufacturer(char *manufacturer);
  195. int broad_upgrade_init(void);
  196. int broad_request_upgrade();
  197. int broad_get_init_status();
  198. int broad_request_lbs_info(int w, int h, double lon, double lat);
  199. int broad_request_weather_info(double lon,double lat);
  200. int broad_set_default_platform(char *platform);
  201. #ifdef __cplusplus
  202. }
  203. #endif
  204. #endif