added debugging
Fork of BLE_nRF8001 by
Embed:
(wiki syntax)
Show/hide line numbers
acilib_if.h
Go to the documentation of this file.
00001 /* Copyright (c) 2014, Nordic Semiconductor ASA 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy 00004 * of this software and associated documentation files (the "Software"), to deal 00005 * in the Software without restriction, including without limitation the rights 00006 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 * copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in all 00011 * copies or substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00017 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00018 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00019 * SOFTWARE. 00020 */ 00021 00022 /** 00023 * @file 00024 * 00025 * @ingroup group_acilib 00026 * 00027 * @brief Prototypes for the acilib interfaces. 00028 */ 00029 00030 #ifndef _acilib_IF_H_ 00031 #define _acilib_IF_H_ 00032 00033 /** @brief Encode the ACI message for set test mode command 00034 * 00035 * @param[in,out] buffer Pointer to ACI message buffer 00036 * @param[in] test_mode Pointer to the test mode in ::aci_cmd_params_test_t 00037 * 00038 * @return None 00039 */ 00040 void acil_encode_cmd_set_test_mode(uint8_t *buffer, aci_cmd_params_test_t *p_aci_cmd_params_test); 00041 00042 /** @brief Encode the ACI message for sleep command 00043 * 00044 * @param[in,out] buffer Pointer to ACI message buffer 00045 * 00046 * @return None 00047 */ 00048 void acil_encode_cmd_sleep(uint8_t *buffer); 00049 00050 /** @brief Encode the ACI message for get device version 00051 * 00052 * @param[in,out] buffer Pointer to ACI message buffer 00053 * 00054 * @return None 00055 */ 00056 void acil_encode_cmd_get_device_version(uint8_t *buffer); 00057 00058 /** @brief Encode the ACI message for set local data 00059 * 00060 * @param[in,out] buffer Pointer to ACI message buffer 00061 * @param[in] p_aci_cmd_params_set_local_data Pointer to the local data parameters in ::aci_cmd_params_set_local_data_t 00062 * @param[in] data_size Size of data message 00063 * 00064 * @return None 00065 */ 00066 void acil_encode_cmd_set_local_data(uint8_t *buffer, aci_cmd_params_set_local_data_t *p_aci_cmd_params_set_local_data, uint8_t data_size); 00067 00068 /** @brief Encode the ACI message to connect 00069 * 00070 * @param[in,out] buffer Pointer to ACI message buffer 00071 * @param[in] p_aci_cmd_params_connect Pointer to the run parameters in ::aci_cmd_params_connect_t 00072 * 00073 * @return None 00074 */ 00075 void acil_encode_cmd_connect(uint8_t *buffer, aci_cmd_params_connect_t *p_aci_cmd_params_connect); 00076 00077 /** @brief Encode the ACI message to bond 00078 * 00079 * @param[in,out] buffer Pointer to ACI message buffer 00080 * @param[in] p_aci_cmd_params_bond Pointer to the run parameters in ::aci_cmd_params_bond_t 00081 * 00082 * @return None 00083 */ 00084 void acil_encode_cmd_bond(uint8_t *buffer, aci_cmd_params_bond_t *p_aci_cmd_params_bond); 00085 00086 /** @brief Encode the ACI message to disconnect 00087 * 00088 * @param[in,out] buffer Pointer to ACI message buffer 00089 * @param[in] p_aci_cmd_params_disconnect Pointer to the run parameters in ::aci_cmd_params_disconnect_t 00090 * 00091 * @return None 00092 */ 00093 void acil_encode_cmd_disconnect(uint8_t *buffer, aci_cmd_params_disconnect_t *p_aci_cmd_params_disconnect); 00094 00095 /** @brief Encode the ACI message to baseband reset 00096 * 00097 * @param[in,out] buffer Pointer to ACI message buffer 00098 * 00099 * @return None 00100 */ 00101 void acil_encode_baseband_reset(uint8_t *buffer); 00102 00103 /** @brief Encode the ACI message for Directed Advertising 00104 * 00105 * @param[in,out] buffer Pointer to ACI message buffer 00106 * 00107 * @return None 00108 */ 00109 void acil_encode_direct_connect(uint8_t *buffer); 00110 00111 /** @brief Encode the ACI message to wakeup 00112 * 00113 * @param[in,out] buffer Pointer to ACI message buffer 00114 * 00115 * @return None 00116 */ 00117 void acil_encode_cmd_wakeup(uint8_t *buffer); 00118 00119 /** @brief Encode the ACI message for set radio Tx power 00120 * 00121 * @param[in,out] buffer Pointer to ACI message buffer 00122 * @param[in] p_aci_cmd_params_set_tx_power Pointer to the set Tx power parameters in ::aci_cmd_params_set_tx_power_t 00123 * 00124 * @return None 00125 */ 00126 void acil_encode_cmd_set_radio_tx_power(uint8_t *buffer, aci_cmd_params_set_tx_power_t *p_aci_cmd_params_set_tx_power); 00127 00128 /** @brief Encode the ACI message for get device address 00129 * 00130 * @param[in,out] buffer Pointer to ACI message buffer 00131 * 00132 * @return None 00133 */ 00134 void acil_encode_cmd_get_address(uint8_t *buffer); 00135 00136 /** @brief Encode the ACI message for send data 00137 * 00138 * @param[in,out] buffer Pointer to ACI message buffer 00139 * @param[in] p_aci_cmd_params_send_data_t Pointer to the data parameters in ::aci_cmd_params_send_data_t 00140 * @param[in] data_size Size of data message 00141 * 00142 * @return None 00143 */ 00144 void acil_encode_cmd_send_data(uint8_t *buffer, aci_cmd_params_send_data_t *p_aci_cmd_params_send_data_t, uint8_t data_size); 00145 00146 /** @brief Encode the ACI message for request data 00147 * 00148 * @param[in,out] buffer Pointer to ACI message buffer 00149 * @param[in] p_aci_cmd_params_request_data Pointer to the request data parameters in ::aci_cmd_params_request_data_t 00150 * 00151 * @return None 00152 */ 00153 void acil_encode_cmd_request_data(uint8_t *buffer, aci_cmd_params_request_data_t *p_aci_cmd_params_request_data); 00154 00155 /** @brief Encode the ACI message for open remote pipe 00156 * 00157 * @param[in,out] buffer Pointer to ACI message buffer 00158 * @param[in] p_aci_cmd_params_open_remote_pipe Pointer to the dynamic data parameters in ::aci_cmd_params_open_remote_pipe_t 00159 * 00160 * @return None 00161 */ 00162 void acil_encode_cmd_open_remote_pipe(uint8_t *buffer, aci_cmd_params_open_remote_pipe_t *p_aci_cmd_params_open_remote_pipe); 00163 00164 /** @brief Encode the ACI message for close remote pipe 00165 * 00166 * @param[in,out] buffer Pointer to ACI message buffer 00167 * @param[in] p_aci_cmd_params_close_remote_pipe Pointer to the dynamic data parameters in ::aci_cmd_params_close_remote_pipe_t 00168 * 00169 * @return None 00170 */ 00171 void acil_encode_cmd_close_remote_pipe(uint8_t *buffer, aci_cmd_params_close_remote_pipe_t *p_aci_cmd_params_close_remote_pipe); 00172 00173 /** @brief Encode the ACI message for echo message 00174 * 00175 * @param[in,out] buffer Pointer to ACI message buffer 00176 * @param[in] p_cmd_params_echo Pointer to the dynamic data parameters in ::aci_cmd_params_echo_t 00177 * @param[in] msg_size Size of the message 00178 * 00179 * @return None 00180 */ 00181 void acil_encode_cmd_echo_msg(uint8_t *buffer, aci_cmd_params_echo_t *p_cmd_params_echo, uint8_t msg_size); 00182 00183 /** @brief Encode the ACI message to battery level 00184 * 00185 * @param[in,out] buffer Pointer to ACI message buffer 00186 * 00187 * @return None 00188 */ 00189 void acil_encode_cmd_battery_level(uint8_t *buffer); 00190 00191 /** @brief Encode the ACI message to temparature 00192 * 00193 * @param[in,out] buffer Pointer to ACI message buffer 00194 * 00195 * @return None 00196 */ 00197 void acil_encode_cmd_temparature(uint8_t *buffer); 00198 00199 /** @brief Encode the ACI message to read dynamic data 00200 * 00201 * @param[in,out] buffer Pointer to ACI message buffer 00202 * 00203 * @return None 00204 */ 00205 void acil_encode_cmd_read_dynamic_data(uint8_t *buffer); 00206 00207 /** @brief Encode the ACI message to change timing request 00208 * 00209 * @param[in,out] buffer Pointer to ACI message buffer 00210 * @param[in] p_aci_cmd_params_change_timing Pointer to the change timing parameters in ::aci_cmd_params_change_timing_t 00211 * 00212 * @return None 00213 */ 00214 void acil_encode_cmd_change_timing_req(uint8_t *buffer, aci_cmd_params_change_timing_t *p_aci_cmd_params_change_timing); 00215 00216 /** @brief Encode the ACI message to change timing request using the timing parameters from GAP PPCP 00217 * 00218 * @param[in,out] buffer Pointer to ACI message buffer 00219 * @param[in] p_aci_cmd_params_change_timing Pointer to the change timing parameters in ::aci_cmd_params_change_timing_t 00220 * 00221 * @return None 00222 */ 00223 void acil_encode_cmd_change_timing_req_GAP_PPCP(uint8_t *buffer); 00224 00225 00226 /** @brief Encode the ACI message for write dynamic data 00227 * 00228 * @param[in,out] buffer Pointer to ACI message buffer 00229 * @param[in] seq_no Sequence number of the dynamic data (as received in the response to @c Read Dynamic Data) 00230 * @param[in] dynamic_data Pointer to the dynamic data 00231 * @param[in] dynamic_data_size Size of dynamic data 00232 * 00233 * @return None 00234 */ 00235 void acil_encode_cmd_write_dynamic_data(uint8_t *buffer, uint8_t seq_no, uint8_t* dynamic_data, uint8_t dynamic_data_size); 00236 00237 /** @brief Encode the ACI message to send data acknowledgement 00238 * 00239 * @param[in,out] buffer Pointer to ACI message buffer 00240 * @param[in] pipe_number Pipe number for which the ack is to be sent 00241 * 00242 * @return None 00243 */ 00244 void acil_encode_cmd_send_data_ack(uint8_t *buffer, const uint8_t pipe_number); 00245 00246 /** @brief Encode the ACI message to send negative acknowledgement 00247 * 00248 * @param[in,out] buffer Pointer to ACI message buffer 00249 * @param[in] pipe_number Pipe number for which the nack is to be sent 00250 * @param[in] error_code Error code that has to be sent in the NACK 00251 * 00252 * @return None 00253 */ 00254 void acil_encode_cmd_send_data_nack(uint8_t *buffer, const uint8_t pipe_number,const uint8_t error_code); 00255 00256 /** @brief Encode the ACI message to set the application latency 00257 * 00258 * @param[in,out] buffer Pointer to ACI message buffer 00259 * @param[in] p_aci_cmd_params_set_app_latency Pointer to the set_application_latency command parameters in ::aci_cmd_params_dtm_cmd_t 00260 * 00261 * @return None 00262 */ 00263 void acil_encode_cmd_set_app_latency(uint8_t *buffer, aci_cmd_params_set_app_latency_t *p_aci_cmd_params_set_app_latency); 00264 00265 /** @brief Encode the ACI message for setup 00266 * 00267 * @param[in,out] buffer Pointer to ACI message buffer 00268 * @param[in] p_cmd_params_set_run_behaviour Pointer to the setup data in ::aci_cmd_params_setup_t 00269 * @param[in] setup_data_size Size of setup message 00270 * 00271 * @return None 00272 */ 00273 void acil_encode_cmd_setup(uint8_t *buffer, aci_cmd_params_setup_t *p_aci_cmd_params_setup, uint8_t setup_data_size); 00274 00275 /** @brief Encode the ACI message for DTM command 00276 * 00277 * @param[in,out] buffer Pointer to ACI message buffer 00278 * @param[in] p_cmd_params_set_run_behaviour Pointer to the DTM command parameters in ::aci_cmd_params_dtm_cmd_t 00279 * 00280 * @return None 00281 */ 00282 void acil_encode_cmd_dtm_cmd(uint8_t *buffer, aci_cmd_params_dtm_cmd_t *p_aci_cmd_params_dtm_cmd); 00283 00284 /** @brief Encode the ACI message for Set Key Request command 00285 * 00286 * @param[in,out] buffer Pointer to ACI message buffer 00287 * 00288 * @return None 00289 */ 00290 void acil_encode_cmd_set_key(uint8_t *buffer, aci_cmd_params_set_key_t *p_aci_cmd_params_set_key); 00291 00292 /** @brief Encode the ACI message for Bond Security Request command 00293 * 00294 * @param[in,out] buffer Pointer to ACI message buffer 00295 * 00296 * @return None 00297 */ 00298 void acil_encode_cmd_bond_security_request(uint8_t *buffer); 00299 00300 /** @brief Encode the ACI message 00301 * 00302 * @param[in,out] buffer Pointer to ACI message buffer 00303 * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_t 00304 * @param[in] bool 00305 * 00306 * @return bool true, if succesful, else returns false 00307 */ 00308 bool acil_encode_cmd(uint8_t *buffer, aci_cmd_t *p_aci_cmd); 00309 00310 /** @brief Encode the ACI message for Broadcast command 00311 * 00312 * @param[in,out] buffer Pointer to ACI message buffer 00313 * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_params_broadcast_t 00314 * 00315 * @return None 00316 */ 00317 void acil_encode_cmd_broadcast(uint8_t *buffer, aci_cmd_params_broadcast_t * p_aci_cmd_params_broadcast); 00318 00319 /** @brief Encode the ACI message for Open Adv Pipes 00320 * 00321 * @param[in,out] buffer Pointer to ACI message buffer 00322 * @param[in] p_aci_cmd Pointer to ACI command data in ::aci_cmd_params_open_adv_pipe_t 00323 * 00324 * @return None 00325 */ 00326 void acil_encode_cmd_open_adv_pipes(uint8_t *buffer, aci_cmd_params_open_adv_pipe_t * p_aci_cmd_params_set_adv_svc_data); 00327 00328 /** @brief Decode the ACI event command response 00329 * 00330 * @param[in] buffer_in Pointer to message received 00331 * @param[in,out] buffer Pointer to the decoded message in ::aci_evt_params_cmd_rsp_t 00332 * 00333 * @return None 00334 */ 00335 void acil_decode_evt_command_response(uint8_t *buffer_in, aci_evt_params_cmd_rsp_t *p_evt_params_cmd_rsp); 00336 00337 /** @brief Decode the ACI event device started 00338 * 00339 * @param[in] buffer_in Pointer to message received 00340 * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_params_device_started_t 00341 * 00342 * @return None 00343 */ 00344 void acil_decode_evt_device_started(uint8_t *buffer_in, aci_evt_params_device_started_t *p_evt_params_device_started); 00345 00346 /** @brief Decode the ACI event pipe status 00347 * 00348 * @param[in] buffer_in Pointer to message received 00349 * @param[in,out] p_aci_evt_params_pipe_status Pointer to the decoded message in ::aci_evt_params_pipe_status_t 00350 * 00351 * @return None 00352 */ 00353 void acil_decode_evt_pipe_status(uint8_t *buffer_in, aci_evt_params_pipe_status_t *p_aci_evt_params_pipe_status); 00354 00355 /** @brief Decode the ACI event for disconnected 00356 * 00357 * @param[in] buffer_in Pointer to message received 00358 * @param[in,out] p_aci_evt_params_disconnected Pointer to the decoded message in ::aci_evt_params_disconnected_t 00359 * 00360 * @return None 00361 */ 00362 void acil_decode_evt_disconnected(uint8_t *buffer_in, aci_evt_params_disconnected_t *p_aci_evt_params_disconnected); 00363 00364 /** @brief Decode the ACI event for bond status 00365 * 00366 * @param[in] buffer_in Pointer to message received 00367 * @param[in,out] p_aci_evt_params_bond_status Pointer to the decoded message in ::aci_evt_params_bond_status_t 00368 * 00369 * @return None 00370 */ 00371 void acil_decode_evt_bond_status(uint8_t *buffer_in, aci_evt_params_bond_status_t *p_aci_evt_params_bond_status); 00372 00373 /** @brief Decode the ACI event for data received 00374 * 00375 * @param[in] buffer_in Pointer to message received 00376 * @param[in,out] p_evt_params_data_received Pointer to the decoded message in ::aci_evt_params_data_received_t 00377 * 00378 * @return size Received data size 00379 */ 00380 uint8_t acil_decode_evt_data_received(uint8_t *buffer_in, aci_evt_params_data_received_t *p_evt_params_data_received); 00381 00382 /** @brief Decode the ACI event data acknowledgement 00383 * 00384 * @param[in] buffer_in Pointer to message received 00385 * @param[in,out] p_evt_params_data_ack Pointer to the decoded message in ::aci_evt_params_data_ack_t 00386 * 00387 * @return None 00388 */ 00389 void acil_decode_evt_data_ack(uint8_t *buffer_in, aci_evt_params_data_ack_t *p_evt_params_data_ack); 00390 00391 /** @brief Decode the ACI event for hardware error 00392 * 00393 * @param[in] buffer_in Pointer to message received 00394 * @param[in,out] p_aci_evt_params_hw_error Pointer to the decoded message in ::aci_evt_params_hw_error_t 00395 * 00396 * @return size Size of debug information 00397 */ 00398 uint8_t acil_decode_evt_hw_error(uint8_t *buffer_in, aci_evt_params_hw_error_t *p_aci_evt_params_hw_error); 00399 00400 /** @brief Decode the ACI event data credit 00401 * 00402 * @param[in] buffer_in Pointer to message received 00403 * @param[in,out] p_evt_params_data_credit Pointer to the decoded message in ::aci_evt_params_data_credit_t 00404 * 00405 * @return None 00406 */ 00407 void acil_decode_evt_credit(uint8_t *buffer_in, aci_evt_params_data_credit_t *p_evt_params_data_credit); 00408 00409 /** @brief Decode the ACI event for connected 00410 * 00411 * @param[in] buffer_in Pointer to message received 00412 * @param[in,out] p_aci_evt_params_connected Pointer to the decoded message in ::aci_evt_params_connected_t 00413 * 00414 * @return None 00415 */ 00416 void acil_decode_evt_connected(uint8_t *buffer_in, aci_evt_params_connected_t *p_aci_evt_params_connected); 00417 00418 /** @brief Decode the ACI event for timing 00419 * 00420 * @param[in] buffer_in Pointer to message received 00421 * @param[in,out] p_evt_params_timing Pointer to the decoded message in ::aci_evt_params_timing_t 00422 * 00423 * @return None 00424 */ 00425 void acil_decode_evt_timing(uint8_t *buffer_in, aci_evt_params_timing_t *p_evt_params_timing); 00426 00427 /** @brief Decode the ACI event for pipe error 00428 * 00429 * @param[in] buffer_in Pointer to message received 00430 * @param[in,out] p_evt_params_pipe_error Pointer to the decoded message in ::aci_evt_params_pipe_error_t 00431 * 00432 */ 00433 void acil_decode_evt_pipe_error(uint8_t *buffer_in, aci_evt_params_pipe_error_t *p_evt_params_pipe_error); 00434 00435 /** @brief Decode the ACI event for key request 00436 * 00437 * @param[in] buffer_in Pointer to message received 00438 * @param[in,out] p_evt_params_key_type Pointer to the decoded message in ::aci_evt_params_key_type_t 00439 * 00440 * @return None 00441 */ 00442 void acil_decode_evt_key_request(uint8_t *buffer_in, aci_evt_params_key_request_t *p_evt_params_key_request); 00443 00444 /** @brief Decode the ACI event for echo 00445 * 00446 * @param[in] buffer_in Pointer to message received 00447 * @param[in,out] buffer_out Pointer to the echo message (max size of buffer ::ACI_ECHO_DATA_MAX_LEN) 00448 * 00449 * @return size Received echo message size 00450 */ 00451 uint8_t acil_decode_evt_echo(uint8_t *buffer_in, aci_evt_params_echo_t *buffer_out); 00452 00453 /** @brief Decode the ACI event 00454 * 00455 * @param[in] buffer_in Pointer to message received 00456 * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_t 00457 * 00458 * @return bool true, if succesful, else returns false 00459 */ 00460 bool acil_decode_evt(uint8_t *buffer_in, aci_evt_t *p_aci_evt); 00461 00462 /** @brief Decode the Display Key Event 00463 * 00464 * @param[in] buffer_in Pointer to message received 00465 * @param[in,out] p_aci_evt Pointer to the decoded message in ::aci_evt_params_display_passkey_t 00466 * 00467 * @return None 00468 */ 00469 void acil_decode_evt_display_passkey(uint8_t *buffer_in, aci_evt_params_display_passkey_t *p_aci_evt_params_display_passkey); 00470 00471 #endif /* _acilib_IF_H_ */
Generated on Tue Jul 12 2022 15:15:45 by 1.7.2