hfp_ag.h (66a048ab906a04706fe3948e52f9291ec7110b9c) hfp_ag.h (a0ffb263e02c613f9155d5035f68cb0ad7b80d74)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 48 unchanged lines hidden (view full) ---

57/* API_START */
58typedef struct {
59 uint8_t type;
60 const char * number;
61} hfp_phone_number_t;
62
63/**
64 * @brief Create HFP Audio Gateway (AG) SDP service record.
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 48 unchanged lines hidden (view full) ---

57/* API_START */
58typedef struct {
59 uint8_t type;
60 const char * number;
61} hfp_phone_number_t;
62
63/**
64 * @brief Create HFP Audio Gateway (AG) SDP service record.
65 * @param service
66 * @param rfcomm_channel_nr
67 * @param name
68 * @param ability_to_reject_call
69 * @param suported_features 32-bit bitmap, see HFP_AGSF_* values in hfp.h
65 */
66void hfp_ag_create_sdp_record(uint8_t * service, uint32_t service_record_handle, int rfcomm_channel_nr, const char * name, uint8_t ability_to_reject_call, uint16_t supported_features);;
67
68/**
70 */
71void hfp_ag_create_sdp_record(uint8_t * service, uint32_t service_record_handle, int rfcomm_channel_nr, const char * name, uint8_t ability_to_reject_call, uint16_t supported_features);;
72
73/**
69 * @brief Intialize HFP Audio Gateway (AG) device.
70 * TODO: move optional params into setters
74 * @brief Set up HFP Audio Gateway (AG) device without additional supported features.
75 * @param rfcomm_channel_nr
71 */
76 */
72void hfp_ag_init(uint16_t rfcomm_channel_nr, uint32_t supported_features,
73 uint8_t * codecs, int codecs_nr,
74 hfp_ag_indicator_t * ag_indicators, int ag_indicators_nr,
75 hfp_generic_status_indicator_t * hf_indicators, int hf_indicators_nr,
76 const char *call_hold_services[], int call_hold_services_nr);
77void hfp_ag_init(uint16_t rfcomm_channel_nr);
77
78/**
78
79/**
80 * @brief Set codecs.
81 * @param codecs_nr
82 * @param codecs
83 */
84void hfp_ag_init_codecs(int codecs_nr, uint8_t * codecs);
85
86/**
87 * @brief Set supported features.
88 * @param supported_features 32-bit bitmap, see HFP_AGSF_* values in hfp.h
89 */
90void hfp_ag_init_supported_features(uint32_t supported_features);
91
92/**
93 * @brief Set AG indicators.
94 * @param indicators_nr
95 * @param indicators
96 */
97void hfp_ag_init_ag_indicators(int ag_indicators_nr, hfp_ag_indicator_t * ag_indicators);
98
99/**
100 * @brief Set HF indicators.
101 * @param indicators_nr
102 * @param indicators
103 */
104void hfp_ag_init_hf_indicators(int hf_indicators_nr, hfp_generic_status_indicator_t * hf_indicators);
105
106/**
107 * @brief Set Call Hold services.
108 * @param indicators_nr
109 * @param indicators
110 */
111void hfp_ag_init_call_hold_services(int call_hold_services_nr, const char * call_hold_services[]);
112
113
114/**
79 * @brief Register callback for the HFP Audio Gateway (AG) client.
115 * @brief Register callback for the HFP Audio Gateway (AG) client.
116 * @param callback
80 */
81void hfp_ag_register_packet_handler(hfp_callback_t callback);
82
83/**
117 */
118void hfp_ag_register_packet_handler(hfp_callback_t callback);
119
120/**
84 * @brief Enable in-band ring tone
121 * @brief Enable in-band ring tone.
122 * @param use_in_band_ring_tone
85 */
86void hfp_ag_set_use_in_band_ring_tone(int use_in_band_ring_tone);
87
88
89// actions used by local device / user
90
91/**
92 * @brief Establish RFCOMM connection, and perform service level connection agreement:
93 * - exchange of supported features
94 * - report Audio Gateway (AG) indicators and their status
95 * - enable indicator status update in the AG
96 * - accept the information about available codecs in the Hands-Free (HF), if sent
97 * - report own information describing the call hold and multiparty services, if possible
98 * - report which HF indicators are enabled on the AG, if possible
123 */
124void hfp_ag_set_use_in_band_ring_tone(int use_in_band_ring_tone);
125
126
127// actions used by local device / user
128
129/**
130 * @brief Establish RFCOMM connection, and perform service level connection agreement:
131 * - exchange of supported features
132 * - report Audio Gateway (AG) indicators and their status
133 * - enable indicator status update in the AG
134 * - accept the information about available codecs in the Hands-Free (HF), if sent
135 * - report own information describing the call hold and multiparty services, if possible
136 * - report which HF indicators are enabled on the AG, if possible
137 * The status of SLC connection establishment is reported via
138 * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED.
139 *
140 * @param bd_addr Bluetooth address of the HF
99 */
100void hfp_ag_establish_service_level_connection(bd_addr_t bd_addr);
101
102/**
103 * @brief Release the RFCOMM channel and the audio connection between the HF and the AG.
141 */
142void hfp_ag_establish_service_level_connection(bd_addr_t bd_addr);
143
144/**
145 * @brief Release the RFCOMM channel and the audio connection between the HF and the AG.
104 * TODO: trigger release of the audio connection ??
146 * If the audio connection exists, it will be released.
147 * The status of releasing the SLC connection is reported via
148 * HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED.
149 *
150 * @param bd_addr Bluetooth address of the HF
105 */
106void hfp_ag_release_service_level_connection(bd_addr_t bd_addr);
107
108/**
151 */
152void hfp_ag_release_service_level_connection(bd_addr_t bd_addr);
153
154/**
109 * @brief
155 * @brief Establish audio connection.
156 * The status of Audio connection establishment is reported via is reported via
157 * HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE.
158 * @param bd_addr Bluetooth address of the HF
110 */
111void hfp_ag_establish_audio_connection(bd_addr_t bd_addr);
112
113/**
159 */
160void hfp_ag_establish_audio_connection(bd_addr_t bd_addr);
161
162/**
114 * @brief
163 * @brief Release audio connection.
164 * The status of releasing the Audio connection is reported via is reported via
165 * HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE.
166 * @param bd_addr Bluetooth address of the HF
115 */
116void hfp_ag_release_audio_connection(bd_addr_t bd_addr);
117
118/**
167 */
168void hfp_ag_release_audio_connection(bd_addr_t bd_addr);
169
170/**
119 * @brief
171 * @brief Put the current call on hold, if it exists, and accept incoming call.
120 */
121void hfp_ag_answer_incoming_call(void);
122
123/**
172 */
173void hfp_ag_answer_incoming_call(void);
174
175/**
124 * @brief
176 * @brief Join held call with active call.
125 */
126void hfp_ag_join_held_call(void);
127
128/**
177 */
178void hfp_ag_join_held_call(void);
179
180/**
129 * @brief
181 * @brief Reject incoming call, if exists, or terminate active call.
130 */
131void hfp_ag_terminate_call(void);
132
133/*
182 */
183void hfp_ag_terminate_call(void);
184
185/*
134 * @brief
186 * @brief Put incoming call on hold.
135 */
136void hfp_ag_hold_incoming_call(void);
137
138/*
187 */
188void hfp_ag_hold_incoming_call(void);
189
190/*
139 * @brief
191 * @brief Accept the held incoming call.
140 */
141void hfp_ag_accept_held_incoming_call(void);
142
143/*
192 */
193void hfp_ag_accept_held_incoming_call(void);
194
195/*
144 * @brief
196 * @brief Reject the held incoming call.
145 */
146void hfp_ag_reject_held_incoming_call(void);
147
148/*
197 */
198void hfp_ag_reject_held_incoming_call(void);
199
200/*
149 * @brief
201 * @brief Set microphone gain.
202 * @param bd_addr Bluetooth address of the HF
203 * @param gain Valid range: [0,15]
150 */
151void hfp_ag_set_microphone_gain(bd_addr_t bd_addr, int gain);
152
153/*
204 */
205void hfp_ag_set_microphone_gain(bd_addr_t bd_addr, int gain);
206
207/*
154 * @brief
208 * @brief Set speaker gain.
209 * @param bd_addr Bluetooth address of the HF
210 * @param gain Valid range: [0,15]
155 */
156void hfp_ag_set_speaker_gain(bd_addr_t bd_addr, int gain);
157
158/*
211 */
212void hfp_ag_set_speaker_gain(bd_addr_t bd_addr, int gain);
213
214/*
159 * @brief
215 * @brief Set battery level.
216 * @param level Valid range: [0,5]
160 */
161void hfp_ag_set_battery_level(int level);
162
163/*
217 */
218void hfp_ag_set_battery_level(int level);
219
220/*
164 * @brief
221 * @brief Clear last dialed number.
165 */
166void hfp_ag_clear_last_dialed_number(void);
167
222 */
223void hfp_ag_clear_last_dialed_number(void);
224
225/*
226 * @brief Notify the HF that an incoming call is waiting
227 * during an ongoing call. The notification will be sent only if the HF has
228 * has previously enabled the "Call Waiting notification" in the AG.
229 * @param bd_addr Bluetooth address of the HF
230 */
231void hfp_ag_notify_incoming_call_waiting(bd_addr_t bd_addr);
168
169// Voice Recognition
170
171/*
232
233// Voice Recognition
234
235/*
172 * @brief
236 * @brief Activate voice recognition.
237 * @param bd_addr Bluetooth address of the HF
238 * @param activate
173 */
174void hfp_ag_activate_voice_recognition(bd_addr_t bd_addr, int activate);
175
176/*
239 */
240void hfp_ag_activate_voice_recognition(bd_addr_t bd_addr, int activate);
241
242/*
177 * @brief
243 * @brief Send a phone number back to the HF.
244 * @param bd_addr Bluetooth address of the HF
245 * @param phone_number
178 */
246 */
179void hfp_ag_send_phone_number_for_voice_tag(bd_addr_t bd_addr, const char * number);
247void hfp_ag_send_phone_number_for_voice_tag(bd_addr_t bd_addr, const char * phone_number);
180
181/*
248
249/*
182 * @brief
250 * @brief Reject sending a phone number to the HF.
251 * @param bd_addr Bluetooth address of the HF
183 */
184void hfp_ag_reject_phone_number_for_voice_tag(bd_addr_t bd_addr);
185
252 */
253void hfp_ag_reject_phone_number_for_voice_tag(bd_addr_t bd_addr);
254
255/**
256 * @brief Store phone number with initiated call.
257 * @param type
258 * @param number
259 */
260void hfp_ag_set_clip(uint8_t type, const char * number);
186
261
262
187// Cellular Actions
188
189/**
263// Cellular Actions
264
265/**
190 * @brief
266 * @brief Pass the accept incoming call event to the AG.
191 */
192void hfp_ag_incoming_call(void);
193
194/**
267 */
268void hfp_ag_incoming_call(void);
269
270/**
195 * @brief number is stored.
271 * @brief Pass the reject outgoing call event to the AG.
196 */
272 */
197void hfp_ag_set_clip(uint8_t type, const char * number);
198
199/**
200 * @brief
201 */
202void hfp_ag_outgoing_call_rejected(void);
203
204/**
273void hfp_ag_outgoing_call_rejected(void);
274
275/**
205 * @brief
276 * @brief Pass the accept outgoing call event to the AG.
206 */
207void hfp_ag_outgoing_call_accepted(void);
208
209/**
277 */
278void hfp_ag_outgoing_call_accepted(void);
279
280/**
210 * @brief
281 * @brief Pass the outgoing call ringing event to the AG.
211 */
212void hfp_ag_outgoing_call_ringing(void);
213
214/**
282 */
283void hfp_ag_outgoing_call_ringing(void);
284
285/**
215 * @brief
286 * @brief Pass the outgoing call established event to the AG.
216 */
217void hfp_ag_outgoing_call_established(void);
218
219/**
287 */
288void hfp_ag_outgoing_call_established(void);
289
290/**
220 * @brief
291 * @brief Pass the call droped event to the AG.
221 */
222void hfp_ag_call_dropped(void);
292 */
293void hfp_ag_call_dropped(void);
294
223/*
295/*
224 * @brief
296 * @brief Set network registration status.
297 * @param status 0 - not registered, 1 - registered
225 */
226void hfp_ag_set_registration_status(int status);
227
228/*
298 */
299void hfp_ag_set_registration_status(int status);
300
301/*
229 * @brief
302 * @brief Set network signal strength.
303 * @param strength [0-5]
230 */
231void hfp_ag_set_signal_strength(int strength);
232
233/*
304 */
305void hfp_ag_set_signal_strength(int strength);
306
307/*
234 * @brief
308 * @brief Set roaming status.
309 * @param status 0 - no roaming, 1 - roaming active
235 */
236void hfp_ag_set_roaming_status(int status);
237
238/*
310 */
311void hfp_ag_set_roaming_status(int status);
312
313/*
239 * @brief
314 * @brief Set subcriber number information, e.g. the phone number
315 * @param numbers
316 * @param numbers_count
240 */
241void hfp_ag_set_subcriber_number_information(hfp_phone_number_t * numbers, int numbers_count);
242
243/*
317 */
318void hfp_ag_set_subcriber_number_information(hfp_phone_number_t * numbers, int numbers_count);
319
320/*
244 * @brief Called by cellular unit after a DTMF code was transmitted, so that the next one can be emitted
321 * @brief Called by cellular unit after a DTMF code was transmitted, so that the next one can be emitted.
322 * @param bd_addr Bluetooth address of the HF
245 */
246void hfp_ag_send_dtmf_code_done(bd_addr_t bd_addr);
247
248/**
249 * @brief Report Extended Audio Gateway Error result codes in the AG.
250 * Whenever there is an error relating to the functionality of the AG as a
251 * result of AT command, the AG shall send +CME ERROR:
252 * - +CME ERROR: 0 - AG failure

--- 14 unchanged lines hidden (view full) ---

267 * - +CME ERROR: 23 - memory failure
268 * - +CME ERROR: 24 - text string too long
269 * - +CME ERROR: 25 - invalid characters in text string
270 * - +CME ERROR: 26 - dial string too long
271 * - +CME ERROR: 27 - invalid characters in dial string
272 * - +CME ERROR: 30 - no network service
273 * - +CME ERROR: 31 - network Timeout.
274 * - +CME ERROR: 32 - network not allowed – Emergency calls only
323 */
324void hfp_ag_send_dtmf_code_done(bd_addr_t bd_addr);
325
326/**
327 * @brief Report Extended Audio Gateway Error result codes in the AG.
328 * Whenever there is an error relating to the functionality of the AG as a
329 * result of AT command, the AG shall send +CME ERROR:
330 * - +CME ERROR: 0 - AG failure

--- 14 unchanged lines hidden (view full) ---

345 * - +CME ERROR: 23 - memory failure
346 * - +CME ERROR: 24 - text string too long
347 * - +CME ERROR: 25 - invalid characters in text string
348 * - +CME ERROR: 26 - dial string too long
349 * - +CME ERROR: 27 - invalid characters in dial string
350 * - +CME ERROR: 30 - no network service
351 * - +CME ERROR: 31 - network Timeout.
352 * - +CME ERROR: 32 - network not allowed – Emergency calls only
353 *
354 * @param bd_addr Bluetooth address of the HF
355 * @param error
275 */
276void hfp_ag_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr, hfp_cme_error_t error);
277
278/* API_END */
279
280
281#if defined __cplusplus
282}
283#endif
284
285#endif
356 */
357void hfp_ag_report_extended_audio_gateway_error_result_code(bd_addr_t bd_addr, hfp_cme_error_t error);
358
359/* API_END */
360
361
362#if defined __cplusplus
363}
364#endif
365
366#endif