bool lib_aci_connect(uint16_t run_timeout, uint16_t adv_interval) { aci_cmd_params_connect_t aci_cmd_params_connect; aci_cmd_params_connect.timeout = run_timeout; aci_cmd_params_connect.adv_interval = adv_interval; acil_encode_cmd_connect(&(msg_to_send.buffer[0]), &aci_cmd_params_connect); return hal_aci_tl_send(&msg_to_send); }
bool acil_encode_cmd(uint8_t *buffer, aci_cmd_t *p_aci_cmd) { bool ret_val = false; switch(p_aci_cmd->cmd_opcode) { case ACI_CMD_TEST: acil_encode_cmd_set_test_mode(buffer, &(p_aci_cmd->params.test)); break; case ACI_CMD_SLEEP: acil_encode_cmd_sleep(buffer); break; case ACI_CMD_GET_DEVICE_VERSION: acil_encode_cmd_get_device_version(buffer); break; case ACI_CMD_WAKEUP: acil_encode_cmd_wakeup(buffer); break; case ACI_CMD_ECHO: acil_encode_cmd_echo_msg(buffer, &(p_aci_cmd->params.echo), (p_aci_cmd->len - MSG_ECHO_MSG_CMD_BASE_LEN)); break; case ACI_CMD_GET_BATTERY_LEVEL: acil_encode_cmd_battery_level(buffer); break; case ACI_CMD_GET_TEMPERATURE: acil_encode_cmd_temparature(buffer); break; case ACI_CMD_GET_DEVICE_ADDRESS: acil_encode_cmd_get_address(buffer); break; case ACI_CMD_SET_TX_POWER: acil_encode_cmd_set_radio_tx_power(buffer, &(p_aci_cmd->params.set_tx_power)); break; case ACI_CMD_CONNECT: acil_encode_cmd_connect(buffer, &(p_aci_cmd->params.connect)); break; case ACI_CMD_BOND: acil_encode_cmd_bond(buffer, &(p_aci_cmd->params.bond)); break; case ACI_CMD_DISCONNECT: acil_encode_cmd_disconnect(buffer, &(p_aci_cmd->params.disconnect)); break; case ACI_CMD_RADIO_RESET: acil_encode_baseband_reset(buffer); break; case ACI_CMD_CHANGE_TIMING: acil_encode_cmd_change_timing_req(buffer, &(p_aci_cmd->params.change_timing)); break; case ACI_CMD_SETUP: acil_encode_cmd_setup(buffer, &(p_aci_cmd->params.setup), (p_aci_cmd->len - MSG_SETUP_CMD_BASE_LEN)); break; case ACI_CMD_DTM_CMD: acil_encode_cmd_dtm_cmd(buffer, &(p_aci_cmd->params.dtm_cmd)); break; case ACI_CMD_READ_DYNAMIC_DATA: acil_encode_cmd_read_dynamic_data(buffer); break; case ACI_CMD_WRITE_DYNAMIC_DATA: acil_encode_cmd_write_dynamic_data(buffer, p_aci_cmd->params.write_dynamic_data.seq_no, &(p_aci_cmd->params.write_dynamic_data.dynamic_data[0]), (p_aci_cmd->len - MSG_WRITE_DYNAMIC_DATA_BASE_LEN)); break; case ACI_CMD_OPEN_REMOTE_PIPE: acil_encode_cmd_open_remote_pipe(buffer, &(p_aci_cmd->params.open_remote_pipe)); break; case ACI_CMD_SEND_DATA: acil_encode_cmd_send_data(buffer, &(p_aci_cmd->params.send_data), (p_aci_cmd->len - MSG_SEND_DATA_BASE_LEN)); break; case ACI_CMD_SEND_DATA_ACK: acil_encode_cmd_send_data_ack(buffer, p_aci_cmd->params.send_data_ack.pipe_number ); break; case ACI_CMD_REQUEST_DATA: acil_encode_cmd_request_data(buffer, &(p_aci_cmd->params.request_data)); break; case ACI_CMD_SET_LOCAL_DATA: acil_encode_cmd_set_local_data(buffer, (aci_cmd_params_set_local_data_t *)(&(p_aci_cmd->params.send_data)), (p_aci_cmd->len - MSG_SET_LOCAL_DATA_BASE_LEN)); break; case ACI_CMD_BOND_SECURITY_REQUEST: acil_encode_cmd_bond_security_request(buffer); break; default: break; } return ret_val; }