diff --git a/conf/messages.xml b/conf/messages.xml index 1541b20d7f..b7bb56b9ec 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -856,6 +856,7 @@ + diff --git a/sw/airborne/mcu_periph/spi.h b/sw/airborne/mcu_periph/spi.h index b09b222828..a49345cade 100644 --- a/sw/airborne/mcu_periph/spi.h +++ b/sw/airborne/mcu_periph/spi.h @@ -135,7 +135,7 @@ typedef void (*SPICallback)(struct spi_transaction *trans); * - The input/output buffers needs to be created separately * - Take care of pointing input_buf/ouput_buf correctly * - input_length and output_length can be different, the larger number - * of the two specifies the toal number of exchanged words, + * of the two specifies the total number of exchanged words, * - if input_length is larger than output length, * 0 is sent for the remaining words */ @@ -198,7 +198,7 @@ struct spi_periph { extern struct spi_periph spi0; extern void spi0_init(void); -/** Architecture dependant SPI0 initialization. +/** Architecture dependent SPI0 initialization. * Must be implemented by underlying architecture */ extern void spi0_arch_init(void); @@ -210,7 +210,7 @@ extern void spi0_arch_init(void); extern struct spi_periph spi1; extern void spi1_init(void); -/** Architecture dependant SPI1 initialization. +/** Architecture dependent SPI1 initialization. * Must be implemented by underlying architecture */ extern void spi1_arch_init(void); @@ -222,7 +222,7 @@ extern void spi1_arch_init(void); extern struct spi_periph spi2; extern void spi2_init(void); -/** Architecture dependant SPI2 initialization. +/** Architecture dependent SPI2 initialization. * Must be implemented by underlying architecture */ extern void spi2_arch_init(void); @@ -234,7 +234,7 @@ extern void spi2_arch_init(void); extern struct spi_periph spi3; extern void spi3_init(void); -/** Architecture dependant SPI3 initialization. +/** Architecture dependent SPI3 initialization. * Must be implemented by underlying architecture */ extern void spi3_arch_init(void); @@ -246,7 +246,7 @@ extern void spi3_arch_init(void); */ extern void spi_init(struct spi_periph *p); -/** Initialize all used slaves and uselect them. +/** Initialize all used slaves and unselect them. */ extern void spi_init_slaves(void); @@ -254,7 +254,7 @@ extern void spi_init_slaves(void); * Must be implemented by the underlying architecture * @param p spi peripheral to be used * @param t spi transaction - * @return TRUE if insertion to the transaction queue succeded + * @return TRUE if insertion to the transaction queue succeeded */ extern bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t); @@ -295,7 +295,7 @@ extern bool_t spi_resume(struct spi_periph *p, uint8_t slave); extern struct spi_periph spi0; extern void spi0_slave_init(void); -/** Architecture dependant SPI0 initialization as slave. +/** Architecture dependent SPI0 initialization as slave. * Must be implemented by underlying architecture */ extern void spi0_slave_arch_init(void); @@ -307,7 +307,7 @@ extern void spi0_slave_arch_init(void); extern struct spi_periph spi1; extern void spi1_slave_init(void); -/** Architecture dependant SPI1 initialization as slave. +/** Architecture dependent SPI1 initialization as slave. * Must be implemented by underlying architecture */ extern void spi1_slave_arch_init(void); @@ -319,7 +319,7 @@ extern void spi1_slave_arch_init(void); extern struct spi_periph spi2; extern void spi2_slave_init(void); -/** Architecture dependant SPI2 initialization as slave. +/** Architecture dependent SPI2 initialization as slave. * Must be implemented by underlying architecture */ extern void spi2_slave_arch_init(void); @@ -331,7 +331,7 @@ extern void spi2_slave_arch_init(void); extern struct spi_periph spi3; extern void spi3_slave_init(void); -/** Architecture dependant SPI3 initialization as slave. +/** Architecture dependent SPI3 initialization as slave. * Must be implemented by underlying architecture */ extern void spi3_slave_arch_init(void); diff --git a/sw/airborne/subsystems/datalink/bluegiga.c b/sw/airborne/subsystems/datalink/bluegiga.c index 8ece80fb03..5d51503e4a 100644 --- a/sw/airborne/subsystems/datalink/bluegiga.c +++ b/sw/airborne/subsystems/datalink/bluegiga.c @@ -48,6 +48,7 @@ struct bluegiga_periph bluegiga_p; struct spi_transaction bluegiga_spi; signed char bluegiga_rssi[256]; // values initialized with 127 +unsigned char temlemetry_copy[20]; void bluegiga_transmit(struct bluegiga_periph *p, uint8_t data); void bluegiga_receive(struct spi_transaction *trans); @@ -109,7 +110,7 @@ static void send_bluegiga(struct transport_tx *trans, struct link_device *dev) if (now_ts > last_ts){ uint32_t rate = 1000*bluegiga_p.bytes_recvd_since_last/(now_ts - last_ts); - pprz_msg_send_BLUEGIGA(trans, dev, AC_ID, &rate); + pprz_msg_send_BLUEGIGA(trans, dev, AC_ID, &rate, 20, temlemetry_copy); bluegiga_p.bytes_recvd_since_last = 0; last_ts = now_ts; @@ -213,6 +214,8 @@ void bluegiga_send(struct bluegiga_periph *p) p->work_tx[i] = 0; } + p->work_tx[0] = 1; // todo for testing only + coms_status = BLUEGIGA_SENDING; } } @@ -228,65 +231,90 @@ void bluegiga_receive(struct spi_transaction *trans) } } - uint8_t packet_len = trans->input_buf[3]; // length of transmitted message + /* + * 0xff communication lost with ground station + * 0xfe RSSI value from broadcaster + * 0xfd Change in broadcast mode + * 0xfc Receive all recorded RSSI + * <=20 Data package from ground station + */ - if (packet_len > trans->input_length) { - // Direct message from Bluegiga - // int k_rssi, i; - switch (packet_len) { - case 0xff: // Connection lost with ground station! + uint8_t packet_len = 0; + uint8_t read_offset = 0; + switch (trans->input_buf[0]) + { + case 0xff: // communication lost with ground station #ifdef MODEM_LED - LED_OFF(MODEM_LED); + LED_OFF(MODEM_LED); #endif - coms_status = BLUEGIGA_UNINIT; - gpio_set(BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN); // Reset interrupt pin - break; - /*case 0xfe: // rssi data - k_rssi = trans->input_buf[2]; - for (i = 0; i < k_rssi; i++) { - bluegiga_rssi[i] = trans->input_buf[3 + i]; - } - break;*/ - case 0xfd: // interrupt handled on bluegiga - gpio_set(BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN); // Reset interrupt pin + coms_status = BLUEGIGA_UNINIT; + gpio_set(BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN); // Reset interrupt pin + break; + case 0xfe: // RSSI value from broadcaster + bluegiga_rssi[trans->input_buf[1]] = trans->input_buf[2]; + packet_len = trans->input_buf[3]; + read_offset = 4; + break; + case 0xfd: // Change in broadcast mode + gpio_set(BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN); // Reset interrupt pin - // fetch scan status - if (trans->input_buf[2] == 1) { - coms_status = BLUEGIGA_SCANNING; - } else { - coms_status = BLUEGIGA_UNINIT; - } - break; - default: - break; - } + // fetch scan status + if (trans->input_buf[1] == 1) { + coms_status = BLUEGIGA_BROADCASTING; + } else { + coms_status = BLUEGIGA_UNINIT; + } + break; + case 0xfc: // Receive all recorded RSSI + for (uint8_t i = 0; i < trans->input_buf[1]; i++) + bluegiga_rssi[trans->input_buf[2] + i] = trans->input_buf[3 + i]; + break; + default: + packet_len = trans->input_buf[0]; // length of transmitted message + read_offset = 1; } // handle incoming datalink message - else if (packet_len > 0) { - bluegiga_rssi[trans->input_buf[1]] = trans->input_buf[2]; + if (packet_len > 0 && packet_len <= trans->input_length) { // Handle received message for (uint8_t i = 0; i < packet_len; i++) { - bluegiga_p.rx_buf[(bluegiga_p.rx_insert_idx + i) % BLUEGIGA_BUFFER_SIZE] = trans->input_buf[i + 4]; + bluegiga_p.rx_buf[(bluegiga_p.rx_insert_idx + i) % BLUEGIGA_BUFFER_SIZE] = trans->input_buf[i + read_offset]; } bluegiga_increment_buf(&bluegiga_p.rx_insert_idx, packet_len); bluegiga_p.bytes_recvd_since_last += packet_len; coms_status = BLUEGIGA_IDLE; + + for (uint8_t i = 0; i < trans->input_length; i++) + { + temlemetry_copy[i] = trans->input_buf[i]; + } } else { coms_status = BLUEGIGA_IDLE; } - // clear rx buffer - for (uint8_t i = 0; i < trans->input_length; i++) { - trans->input_buf[i] = 0; - } // register spi slave read for next transaction spi_slave_register(&(BLUEGIGA_SPI_DEV), &bluegiga_spi); } } -/* command bluetooth to switch to active scan mode to get rssi values from neighboring drones */ -void bluegiga_scan(void) +/* command bluetooth to switch to active scan mode to get rssi values from neighbouring drones */ +void bluegiga_scan(struct bluegiga_periph *p) { + + memset(p->work_tx, 0, 20); + p->work_tx[0] = 0xfd; // change broadcast mode header + + // trigger bluegiga to read direct command + gpio_clear(BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN); // set interrupt +} + +/* Request list of all recorded RSSI */ +void bluegiga_request_all_rssi(struct bluegiga_periph *p) +{ + + memset(p->work_tx, 0, 20); + p->work_tx[0] = 0xfc; + + // trigger bluegiga to read direct command gpio_clear(BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN); // set interrupt } diff --git a/sw/airborne/subsystems/datalink/bluegiga.h b/sw/airborne/subsystems/datalink/bluegiga.h index 021356741d..b0a2f6a7fb 100644 --- a/sw/airborne/subsystems/datalink/bluegiga.h +++ b/sw/airborne/subsystems/datalink/bluegiga.h @@ -34,7 +34,7 @@ enum BlueGigaStatus { BLUEGIGA_UNINIT, /**< The com isn't initialized */ BLUEGIGA_IDLE, /**< The com is in idle */ BLUEGIGA_SENDING, /**< The com is sending */ - BLUEGIGA_SCANNING /**< The com is switched from data link to rssi scanning */ + BLUEGIGA_BROADCASTING /**< The com is switched from data link to rssi scanning */ }; #ifndef BLUEGIGA_BUFFER_SIZE @@ -75,7 +75,8 @@ void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len); void bluegiga_init(struct bluegiga_periph *p); void bluegiga_send(struct bluegiga_periph *p); -void bluegiga_scan(void); +void bluegiga_scan(struct bluegiga_periph *p); +void bluegiga_request_all_rssi(struct bluegiga_periph *p); // BLUEGIGA is using pprz_transport // FIXME it should not appear here, this will be fixed with the rx improvements some day... @@ -104,7 +105,6 @@ static inline void bluegiga_read_buffer(struct bluegiga_periph *p, struct pprz_t } // transmit previous data in buffer and parse data received -// TODO: (Kirk) Remove hard coded device perph here #define BlueGigaCheckAndParse(_dev,_trans) { \ if (bluegiga_ch_available(&(_dev))) \ bluegiga_read_buffer(&(_dev), &(_trans)); \ diff --git a/sw/tools/bluegiga_usb_dongle/apitypes.h b/sw/tools/bluegiga_usb_dongle/apitypes.h index 40982a5948..370c4001e1 100644 --- a/sw/tools/bluegiga_usb_dongle/apitypes.h +++ b/sw/tools/bluegiga_usb_dongle/apitypes.h @@ -13,7 +13,7 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // @@ -30,23 +30,23 @@ /* structure packing compability */ #ifndef PACKSTRUCT - #ifdef PACKED - #define PACKSTRUCT(a) a PACKED - #else - /* default packed configuration */ - #ifdef __GNUC__ - #ifdef _WIN32 - #define PACKSTRUCT( decl ) decl __attribute__((__packed__,gcc_struct)) - #else - #define PACKSTRUCT( decl ) decl __attribute__((__packed__)) - #endif - #define ALIGNED __attribute__((aligned(0x4))) +#ifdef PACKED +#define PACKSTRUCT(a) a PACKED +#else +/* default packed configuration */ +#ifdef __GNUC__ +#ifdef _WIN32 +#define PACKSTRUCT( decl ) decl __attribute__((__packed__,gcc_struct)) +#else +#define PACKSTRUCT( decl ) decl __attribute__((__packed__)) +#endif +#define ALIGNED __attribute__((aligned(0x4))) - #else // MSVC - #define PACKSTRUCT( decl ) __pragma( pack(push, 1) ) decl __pragma( pack(pop) ) - #define ALIGNED - #endif - #endif +#else // MSVC +#define PACKSTRUCT( decl ) __pragma( pack(push, 1) ) decl __pragma( pack(pop) ) +#define ALIGNED +#endif +#endif #endif typedef unsigned char uint8; @@ -55,23 +55,20 @@ typedef signed short int16; typedef unsigned long uint32; typedef signed char int8; -typedef struct bd_addr_t -{ - uint8 addr[6]; +typedef struct bd_addr_t { + uint8 addr[6]; } bd_addr; typedef bd_addr hwaddr; -typedef struct -{ - uint8 len; - uint8 data[]; +typedef struct { + uint8 len; + uint8 data[]; } uint8array; -typedef struct -{ - uint8 len; - int8 data[]; +typedef struct { + uint8 len; + int8 data[]; } string; #endif diff --git a/sw/tools/bluegiga_usb_dongle/cmd_def.c b/sw/tools/bluegiga_usb_dongle/cmd_def.c index 5d52166651..3f7229f248 100644 --- a/sw/tools/bluegiga_usb_dongle/cmd_def.c +++ b/sw/tools/bluegiga_usb_dongle/cmd_def.c @@ -13,7 +13,7 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // @@ -36,552 +36,530 @@ #include #include "cmd_def.h" -void (*bglib_output)(uint8 len1,uint8* data1,uint16 len2,uint8* data2)=0; -static const struct ble_msg apis[]={ - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_system,ble_cmd_system_reset_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_system,ble_cmd_system_hello_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_system,ble_cmd_system_address_get_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_system,ble_cmd_system_reg_write_id}, 0x24,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_system,ble_cmd_system_reg_read_id}, 0x4,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_system,ble_cmd_system_get_counters_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_system,ble_cmd_system_get_connections_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x5,ble_cls_system,ble_cmd_system_read_memory_id}, 0x26,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_system,ble_cmd_system_get_info_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_system,ble_cmd_system_endpoint_tx_id}, 0x82,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x7,ble_cls_system,ble_cmd_system_whitelist_append_id}, 0x2a,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x7,ble_cls_system,ble_cmd_system_whitelist_remove_id}, 0x2a,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_system,ble_cmd_system_whitelist_clear_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_system,ble_cmd_system_endpoint_rx_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_system,ble_cmd_system_endpoint_set_watermarks_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_defrag_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_dump_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_erase_all_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_flash,ble_cmd_flash_ps_save_id}, 0x84,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_flash,ble_cmd_flash_ps_load_id}, 0x4,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_flash,ble_cmd_flash_ps_erase_id}, 0x4,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_flash,ble_cmd_flash_erase_page_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_flash,ble_cmd_flash_write_words_id}, 0x84,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x4,ble_cls_attributes,ble_cmd_attributes_write_id}, 0x824,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x4,ble_cls_attributes,ble_cmd_attributes_read_id}, 0x44,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_attributes,ble_cmd_attributes_read_type_id}, 0x4,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_attributes,ble_cmd_attributes_user_read_response_id}, 0x822,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_attributes,ble_cmd_attributes_user_write_response_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_connection,ble_cmd_connection_disconnect_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_connection,ble_cmd_connection_get_rssi_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x9,ble_cls_connection,ble_cmd_connection_update_id}, 0x44442,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_connection,ble_cmd_connection_version_update_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_connection,ble_cmd_connection_channel_map_get_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_connection,ble_cmd_connection_channel_map_set_id}, 0x82,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_connection,ble_cmd_connection_features_get_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_connection,ble_cmd_connection_get_status_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_connection,ble_cmd_connection_raw_tx_id}, 0x82,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x8,ble_cls_attclient,ble_cmd_attclient_find_by_type_value_id}, 0x84442,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x6,ble_cls_attclient,ble_cmd_attclient_read_by_group_type_id}, 0x8442,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x6,ble_cls_attclient,ble_cmd_attclient_read_by_type_id}, 0x8442,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x5,ble_cls_attclient,ble_cmd_attclient_find_information_id}, 0x442,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_by_handle_id}, 0x42,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x4,ble_cls_attclient,ble_cmd_attclient_attribute_write_id}, 0x842,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x4,ble_cls_attclient,ble_cmd_attclient_write_command_id}, 0x842,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_attclient,ble_cmd_attclient_indicate_confirm_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_long_id}, 0x42,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x6,ble_cls_attclient,ble_cmd_attclient_prepare_write_id}, 0x8442,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_attclient,ble_cmd_attclient_execute_write_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_attclient,ble_cmd_attclient_read_multiple_id}, 0x82,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_sm,ble_cmd_sm_encrypt_start_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_sm,ble_cmd_sm_set_bondable_mode_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_sm,ble_cmd_sm_delete_bonding_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_sm,ble_cmd_sm_set_parameters_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x5,ble_cls_sm,ble_cmd_sm_passkey_entry_id}, 0x62,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_sm,ble_cmd_sm_get_bonds_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_sm,ble_cmd_sm_set_oob_data_id}, 0x8,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_privacy_flags_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_mode_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_gap,ble_cmd_gap_discover_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0xf,ble_cls_gap,ble_cmd_gap_connect_direct_id}, 0x44442a,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_gap,ble_cmd_gap_end_procedure_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x8,ble_cls_gap,ble_cmd_gap_connect_selective_id}, 0x4444,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_gap,ble_cmd_gap_set_filtering_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x5,ble_cls_gap,ble_cmd_gap_set_scan_parameters_id}, 0x244,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x5,ble_cls_gap,ble_cmd_gap_set_adv_parameters_id}, 0x244,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_adv_data_id}, 0x82,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x7,ble_cls_gap,ble_cmd_gap_set_directed_connectable_mode_id}, 0x2a,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_io_port_config_irq_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x6,ble_cls_hardware,ble_cmd_hardware_set_soft_timer_id}, 0x226,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_adc_read_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_config_direction_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_config_function_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_io_port_config_pull_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_io_port_write_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_read_id}, 0x22,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x6,ble_cls_hardware,ble_cmd_hardware_spi_config_id}, 0x222222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_spi_transfer_id}, 0x82,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_i2c_read_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_i2c_write_id}, 0x822,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_hardware,ble_cmd_hardware_set_txpower_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x5,ble_cls_hardware,ble_cmd_hardware_timer_comparator_id}, 0x4222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x3,ble_cls_test,ble_cmd_test_phy_tx_id}, 0x222,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_test,ble_cmd_test_phy_rx_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_test,ble_cmd_test_phy_end_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_test,ble_cmd_test_phy_reset_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_test,ble_cmd_test_get_channel_map_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_test,ble_cmd_test_debug_id}, 0x8,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_test,ble_cmd_test_channel_mode_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_dfu,ble_cmd_dfu_reset_id}, 0x2,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x4,ble_cls_dfu,ble_cmd_dfu_flash_set_address_id}, 0x6,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x1,ble_cls_dfu,ble_cmd_dfu_flash_upload_id}, 0x8,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_cmd|0x0,0x0,ble_cls_dfu,ble_cmd_dfu_flash_upload_finish_id}, 0x0,(ble_cmd_handler)ble_default}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_system,ble_cmd_system_reset_id}, 0x0, (ble_cmd_handler)ble_rsp_system_reset}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_system,ble_cmd_system_hello_id}, 0x0, (ble_cmd_handler)ble_rsp_system_hello}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x6,ble_cls_system,ble_cmd_system_address_get_id}, 0xa, (ble_cmd_handler)ble_rsp_system_address_get}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_system,ble_cmd_system_reg_write_id}, 0x4, (ble_cmd_handler)ble_rsp_system_reg_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_system,ble_cmd_system_reg_read_id}, 0x24, (ble_cmd_handler)ble_rsp_system_reg_read}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x5,ble_cls_system,ble_cmd_system_get_counters_id}, 0x22222, (ble_cmd_handler)ble_rsp_system_get_counters}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_system,ble_cmd_system_get_connections_id}, 0x2, (ble_cmd_handler)ble_rsp_system_get_connections}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x5,ble_cls_system,ble_cmd_system_read_memory_id}, 0x86, (ble_cmd_handler)ble_rsp_system_read_memory}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0xc,ble_cls_system,ble_cmd_system_get_info_id}, 0x2244444, (ble_cmd_handler)ble_rsp_system_get_info}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_system,ble_cmd_system_endpoint_tx_id}, 0x4, (ble_cmd_handler)ble_rsp_system_endpoint_tx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_system,ble_cmd_system_whitelist_append_id}, 0x4, (ble_cmd_handler)ble_rsp_system_whitelist_append}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_system,ble_cmd_system_whitelist_remove_id}, 0x4, (ble_cmd_handler)ble_rsp_system_whitelist_remove}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_system,ble_cmd_system_whitelist_clear_id}, 0x0, (ble_cmd_handler)ble_rsp_system_whitelist_clear}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_system,ble_cmd_system_endpoint_rx_id}, 0x84, (ble_cmd_handler)ble_rsp_system_endpoint_rx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_system,ble_cmd_system_endpoint_set_watermarks_id}, 0x4, (ble_cmd_handler)ble_rsp_system_endpoint_set_watermarks}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_defrag_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_defrag}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_dump_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_dump}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_erase_all_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_erase_all}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_flash,ble_cmd_flash_ps_save_id}, 0x4, (ble_cmd_handler)ble_rsp_flash_ps_save}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_flash,ble_cmd_flash_ps_load_id}, 0x84, (ble_cmd_handler)ble_rsp_flash_ps_load}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_flash,ble_cmd_flash_ps_erase_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_erase}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_flash,ble_cmd_flash_erase_page_id}, 0x4, (ble_cmd_handler)ble_rsp_flash_erase_page}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_flash,ble_cmd_flash_write_words_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_write_words}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_attributes,ble_cmd_attributes_write_id}, 0x4, (ble_cmd_handler)ble_rsp_attributes_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x7,ble_cls_attributes,ble_cmd_attributes_read_id}, 0x8444, (ble_cmd_handler)ble_rsp_attributes_read}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x5,ble_cls_attributes,ble_cmd_attributes_read_type_id}, 0x844, (ble_cmd_handler)ble_rsp_attributes_read_type}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_attributes,ble_cmd_attributes_user_read_response_id}, 0x0, (ble_cmd_handler)ble_rsp_attributes_user_read_response}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_attributes,ble_cmd_attributes_user_write_response_id}, 0x0, (ble_cmd_handler)ble_rsp_attributes_user_write_response}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_connection,ble_cmd_connection_disconnect_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_disconnect}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_connection,ble_cmd_connection_get_rssi_id}, 0x32, (ble_cmd_handler)ble_rsp_connection_get_rssi}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_connection,ble_cmd_connection_update_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_update}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_connection,ble_cmd_connection_version_update_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_version_update}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_connection,ble_cmd_connection_channel_map_get_id}, 0x82, (ble_cmd_handler)ble_rsp_connection_channel_map_get}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_connection,ble_cmd_connection_channel_map_set_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_channel_map_set}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_connection,ble_cmd_connection_features_get_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_features_get}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_connection,ble_cmd_connection_get_status_id}, 0x2, (ble_cmd_handler)ble_rsp_connection_get_status}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_connection,ble_cmd_connection_raw_tx_id}, 0x2, (ble_cmd_handler)ble_rsp_connection_raw_tx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_find_by_type_value_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_find_by_type_value}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_by_group_type_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_by_group_type}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_by_type_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_by_type}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_find_information_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_find_information}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_by_handle_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_by_handle}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_attribute_write_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_attribute_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_write_command_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_write_command}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_attclient,ble_cmd_attclient_indicate_confirm_id}, 0x4, (ble_cmd_handler)ble_rsp_attclient_indicate_confirm}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_long_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_long}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_prepare_write_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_prepare_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_execute_write_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_execute_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_attclient,ble_cmd_attclient_read_multiple_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_multiple}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_sm,ble_cmd_sm_encrypt_start_id}, 0x42, (ble_cmd_handler)ble_rsp_sm_encrypt_start}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_sm,ble_cmd_sm_set_bondable_mode_id}, 0x0, (ble_cmd_handler)ble_rsp_sm_set_bondable_mode}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_sm,ble_cmd_sm_delete_bonding_id}, 0x4, (ble_cmd_handler)ble_rsp_sm_delete_bonding}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_sm,ble_cmd_sm_set_parameters_id}, 0x0, (ble_cmd_handler)ble_rsp_sm_set_parameters}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_sm,ble_cmd_sm_passkey_entry_id}, 0x4, (ble_cmd_handler)ble_rsp_sm_passkey_entry}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_sm,ble_cmd_sm_get_bonds_id}, 0x2, (ble_cmd_handler)ble_rsp_sm_get_bonds}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_sm,ble_cmd_sm_set_oob_data_id}, 0x0, (ble_cmd_handler)ble_rsp_sm_set_oob_data}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_gap,ble_cmd_gap_set_privacy_flags_id}, 0x0, (ble_cmd_handler)ble_rsp_gap_set_privacy_flags}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_mode_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_mode}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_discover_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_discover}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_gap,ble_cmd_gap_connect_direct_id}, 0x24, (ble_cmd_handler)ble_rsp_gap_connect_direct}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_end_procedure_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_end_procedure}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_gap,ble_cmd_gap_connect_selective_id}, 0x24, (ble_cmd_handler)ble_rsp_gap_connect_selective}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_filtering_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_filtering}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_scan_parameters_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_scan_parameters}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_adv_parameters_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_adv_parameters}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_adv_data_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_adv_data}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_gap,ble_cmd_gap_set_directed_connectable_mode_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_directed_connectable_mode}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_config_irq_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_irq}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_set_soft_timer_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_set_soft_timer}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_adc_read_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_adc_read}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_config_direction_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_direction}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_config_function_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_function}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_config_pull_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_pull}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_io_port_write_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x4,ble_cls_hardware,ble_cmd_hardware_io_port_read_id}, 0x224, (ble_cmd_handler)ble_rsp_hardware_io_port_read}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_spi_config_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_spi_config}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x4,ble_cls_hardware,ble_cmd_hardware_spi_transfer_id}, 0x824, (ble_cmd_handler)ble_rsp_hardware_spi_transfer}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x3,ble_cls_hardware,ble_cmd_hardware_i2c_read_id}, 0x84, (ble_cmd_handler)ble_rsp_hardware_i2c_read}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_hardware,ble_cmd_hardware_i2c_write_id}, 0x2, (ble_cmd_handler)ble_rsp_hardware_i2c_write}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_hardware,ble_cmd_hardware_set_txpower_id}, 0x0, (ble_cmd_handler)ble_rsp_hardware_set_txpower}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_hardware,ble_cmd_hardware_timer_comparator_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_timer_comparator}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_test,ble_cmd_test_phy_tx_id}, 0x0, (ble_cmd_handler)ble_rsp_test_phy_tx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_test,ble_cmd_test_phy_rx_id}, 0x0, (ble_cmd_handler)ble_rsp_test_phy_rx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_test,ble_cmd_test_phy_end_id}, 0x4, (ble_cmd_handler)ble_rsp_test_phy_end}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_test,ble_cmd_test_phy_reset_id}, 0x0, (ble_cmd_handler)ble_rsp_test_phy_reset}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_test,ble_cmd_test_get_channel_map_id}, 0x8, (ble_cmd_handler)ble_rsp_test_get_channel_map}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x1,ble_cls_test,ble_cmd_test_debug_id}, 0x8, (ble_cmd_handler)ble_rsp_test_debug}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_test,ble_cmd_test_channel_mode_id}, 0x0, (ble_cmd_handler)ble_rsp_test_channel_mode}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x0,ble_cls_dfu,ble_cmd_dfu_reset_id}, 0x0, (ble_cmd_handler)ble_rsp_dfu_reset}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_dfu,ble_cmd_dfu_flash_set_address_id}, 0x4, (ble_cmd_handler)ble_rsp_dfu_flash_set_address}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_dfu,ble_cmd_dfu_flash_upload_id}, 0x4, (ble_cmd_handler)ble_rsp_dfu_flash_upload}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_rsp|0x0,0x2,ble_cls_dfu,ble_cmd_dfu_flash_upload_finish_id}, 0x4, (ble_cmd_handler)ble_rsp_dfu_flash_upload_finish}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0xc,ble_cls_system,ble_evt_system_boot_id}, 0x2244444, (ble_cmd_handler)ble_evt_system_boot}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x1,ble_cls_system,ble_evt_system_debug_id}, 0x8, (ble_cmd_handler)ble_evt_system_debug}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_system,ble_evt_system_endpoint_watermark_rx_id}, 0x22, (ble_cmd_handler)ble_evt_system_endpoint_watermark_rx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_system,ble_evt_system_endpoint_watermark_tx_id}, 0x22, (ble_cmd_handler)ble_evt_system_endpoint_watermark_tx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x4,ble_cls_system,ble_evt_system_script_failure_id}, 0x44, (ble_cmd_handler)ble_evt_system_script_failure}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x0,ble_cls_system,ble_evt_system_no_license_key_id}, 0x0, (ble_cmd_handler)ble_evt_system_no_license_key}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_system,ble_evt_system_protocol_error_id}, 0x4, (ble_cmd_handler)ble_evt_system_protocol_error}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_flash,ble_evt_flash_ps_key_id}, 0x84, (ble_cmd_handler)ble_evt_flash_ps_key}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x7,ble_cls_attributes,ble_evt_attributes_value_id}, 0x84422, (ble_cmd_handler)ble_evt_attributes_value}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x6,ble_cls_attributes,ble_evt_attributes_user_read_request_id}, 0x2442, (ble_cmd_handler)ble_evt_attributes_user_read_request}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_attributes,ble_evt_attributes_status_id}, 0x24, (ble_cmd_handler)ble_evt_attributes_status}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x10,ble_cls_connection,ble_evt_connection_status_id}, 0x24442a22, (ble_cmd_handler)ble_evt_connection_status}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x6,ble_cls_connection,ble_evt_connection_version_ind_id}, 0x4422, (ble_cmd_handler)ble_evt_connection_version_ind}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_connection,ble_evt_connection_feature_ind_id}, 0x82, (ble_cmd_handler)ble_evt_connection_feature_ind}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_connection,ble_evt_connection_raw_rx_id}, 0x82, (ble_cmd_handler)ble_evt_connection_raw_rx}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_connection,ble_evt_connection_disconnected_id}, 0x42, (ble_cmd_handler)ble_evt_connection_disconnected}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_attclient,ble_evt_attclient_indicated_id}, 0x42, (ble_cmd_handler)ble_evt_attclient_indicated}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x5,ble_cls_attclient,ble_evt_attclient_procedure_completed_id}, 0x442, (ble_cmd_handler)ble_evt_attclient_procedure_completed}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x6,ble_cls_attclient,ble_evt_attclient_group_found_id}, 0x8442, (ble_cmd_handler)ble_evt_attclient_group_found}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x7,ble_cls_attclient,ble_evt_attclient_attribute_found_id}, 0x82442, (ble_cmd_handler)ble_evt_attclient_attribute_found}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x4,ble_cls_attclient,ble_evt_attclient_find_information_found_id}, 0x842, (ble_cmd_handler)ble_evt_attclient_find_information_found}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x5,ble_cls_attclient,ble_evt_attclient_attribute_value_id}, 0x8242, (ble_cmd_handler)ble_evt_attclient_attribute_value}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_attclient,ble_evt_attclient_read_multiple_response_id}, 0x82, (ble_cmd_handler)ble_evt_attclient_read_multiple_response}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_sm,ble_evt_sm_smp_data_id}, 0x822, (ble_cmd_handler)ble_evt_sm_smp_data}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_sm,ble_evt_sm_bonding_fail_id}, 0x42, (ble_cmd_handler)ble_evt_sm_bonding_fail}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x5,ble_cls_sm,ble_evt_sm_passkey_display_id}, 0x62, (ble_cmd_handler)ble_evt_sm_passkey_display}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x1,ble_cls_sm,ble_evt_sm_passkey_request_id}, 0x2, (ble_cmd_handler)ble_evt_sm_passkey_request}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x4,ble_cls_sm,ble_evt_sm_bond_status_id}, 0x2222, (ble_cmd_handler)ble_evt_sm_bond_status}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0xb,ble_cls_gap,ble_evt_gap_scan_response_id}, 0x822a23, (ble_cmd_handler)ble_evt_gap_scan_response}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x2,ble_cls_gap,ble_evt_gap_mode_changed_id}, 0x22, (ble_cmd_handler)ble_evt_gap_mode_changed}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x7,ble_cls_hardware,ble_evt_hardware_io_port_status_id}, 0x2226, (ble_cmd_handler)ble_evt_hardware_io_port_status}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x1,ble_cls_hardware,ble_evt_hardware_soft_timer_id}, 0x2, (ble_cmd_handler)ble_evt_hardware_soft_timer}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x3,ble_cls_hardware,ble_evt_hardware_adc_result_id}, 0x52, (ble_cmd_handler)ble_evt_hardware_adc_result}, - {{(uint8)ble_dev_type_ble|(uint8)ble_msg_type_evt|0x0,0x4,ble_cls_dfu,ble_evt_dfu_boot_id}, 0x6, (ble_cmd_handler)ble_evt_dfu_boot}, - {{0,0,0,0}, 0, 0}}; -const struct ble_msg * ble_get_msg(uint8 idx) +void (*bglib_output)(uint8 len1, uint8 *data1, uint16 len2, uint8 *data2) = 0; +static const struct ble_msg apis[] = { + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_system, ble_cmd_system_reset_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_system, ble_cmd_system_hello_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_system, ble_cmd_system_address_get_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_system, ble_cmd_system_reg_write_id}, 0x24, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_system, ble_cmd_system_reg_read_id}, 0x4, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_system, ble_cmd_system_get_counters_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_system, ble_cmd_system_get_connections_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x5, ble_cls_system, ble_cmd_system_read_memory_id}, 0x26, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_system, ble_cmd_system_get_info_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_system, ble_cmd_system_endpoint_tx_id}, 0x82, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x7, ble_cls_system, ble_cmd_system_whitelist_append_id}, 0x2a, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x7, ble_cls_system, ble_cmd_system_whitelist_remove_id}, 0x2a, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_system, ble_cmd_system_whitelist_clear_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_system, ble_cmd_system_endpoint_rx_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_system, ble_cmd_system_endpoint_set_watermarks_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_defrag_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_dump_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_erase_all_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_flash, ble_cmd_flash_ps_save_id}, 0x84, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_flash, ble_cmd_flash_ps_load_id}, 0x4, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_flash, ble_cmd_flash_ps_erase_id}, 0x4, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_flash, ble_cmd_flash_erase_page_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_flash, ble_cmd_flash_write_words_id}, 0x84, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x4, ble_cls_attributes, ble_cmd_attributes_write_id}, 0x824, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x4, ble_cls_attributes, ble_cmd_attributes_read_id}, 0x44, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_attributes, ble_cmd_attributes_read_type_id}, 0x4, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_attributes, ble_cmd_attributes_user_read_response_id}, 0x822, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_attributes, ble_cmd_attributes_user_write_response_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_disconnect_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_get_rssi_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x9, ble_cls_connection, ble_cmd_connection_update_id}, 0x44442, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_version_update_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_channel_map_get_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_connection, ble_cmd_connection_channel_map_set_id}, 0x82, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_features_get_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_get_status_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_connection, ble_cmd_connection_raw_tx_id}, 0x82, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x8, ble_cls_attclient, ble_cmd_attclient_find_by_type_value_id}, 0x84442, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x6, ble_cls_attclient, ble_cmd_attclient_read_by_group_type_id}, 0x8442, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x6, ble_cls_attclient, ble_cmd_attclient_read_by_type_id}, 0x8442, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x5, ble_cls_attclient, ble_cmd_attclient_find_information_id}, 0x442, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_by_handle_id}, 0x42, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x4, ble_cls_attclient, ble_cmd_attclient_attribute_write_id}, 0x842, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x4, ble_cls_attclient, ble_cmd_attclient_write_command_id}, 0x842, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_attclient, ble_cmd_attclient_indicate_confirm_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_long_id}, 0x42, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x6, ble_cls_attclient, ble_cmd_attclient_prepare_write_id}, 0x8442, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_attclient, ble_cmd_attclient_execute_write_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_attclient, ble_cmd_attclient_read_multiple_id}, 0x82, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_sm, ble_cmd_sm_encrypt_start_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_sm, ble_cmd_sm_set_bondable_mode_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_sm, ble_cmd_sm_delete_bonding_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_sm, ble_cmd_sm_set_parameters_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x5, ble_cls_sm, ble_cmd_sm_passkey_entry_id}, 0x62, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_sm, ble_cmd_sm_get_bonds_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_sm, ble_cmd_sm_set_oob_data_id}, 0x8, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_privacy_flags_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_mode_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_gap, ble_cmd_gap_discover_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0xf, ble_cls_gap, ble_cmd_gap_connect_direct_id}, 0x44442a, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_gap, ble_cmd_gap_end_procedure_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x8, ble_cls_gap, ble_cmd_gap_connect_selective_id}, 0x4444, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_gap, ble_cmd_gap_set_filtering_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x5, ble_cls_gap, ble_cmd_gap_set_scan_parameters_id}, 0x244, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x5, ble_cls_gap, ble_cmd_gap_set_adv_parameters_id}, 0x244, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_adv_data_id}, 0x82, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x7, ble_cls_gap, ble_cmd_gap_set_directed_connectable_mode_id}, 0x2a, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_io_port_config_irq_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x6, ble_cls_hardware, ble_cmd_hardware_set_soft_timer_id}, 0x226, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_adc_read_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_config_direction_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_config_function_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_io_port_config_pull_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_io_port_write_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_read_id}, 0x22, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x6, ble_cls_hardware, ble_cmd_hardware_spi_config_id}, 0x222222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_spi_transfer_id}, 0x82, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_i2c_read_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_i2c_write_id}, 0x822, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_hardware, ble_cmd_hardware_set_txpower_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x5, ble_cls_hardware, ble_cmd_hardware_timer_comparator_id}, 0x4222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x3, ble_cls_test, ble_cmd_test_phy_tx_id}, 0x222, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_test, ble_cmd_test_phy_rx_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_test, ble_cmd_test_phy_end_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_test, ble_cmd_test_phy_reset_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_test, ble_cmd_test_get_channel_map_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_test, ble_cmd_test_debug_id}, 0x8, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_test, ble_cmd_test_channel_mode_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_dfu, ble_cmd_dfu_reset_id}, 0x2, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x4, ble_cls_dfu, ble_cmd_dfu_flash_set_address_id}, 0x6, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x1, ble_cls_dfu, ble_cmd_dfu_flash_upload_id}, 0x8, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_cmd | 0x0, 0x0, ble_cls_dfu, ble_cmd_dfu_flash_upload_finish_id}, 0x0, (ble_cmd_handler)ble_default}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_system, ble_cmd_system_reset_id}, 0x0, (ble_cmd_handler)ble_rsp_system_reset}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_system, ble_cmd_system_hello_id}, 0x0, (ble_cmd_handler)ble_rsp_system_hello}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x6, ble_cls_system, ble_cmd_system_address_get_id}, 0xa, (ble_cmd_handler)ble_rsp_system_address_get}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_system, ble_cmd_system_reg_write_id}, 0x4, (ble_cmd_handler)ble_rsp_system_reg_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_system, ble_cmd_system_reg_read_id}, 0x24, (ble_cmd_handler)ble_rsp_system_reg_read}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x5, ble_cls_system, ble_cmd_system_get_counters_id}, 0x22222, (ble_cmd_handler)ble_rsp_system_get_counters}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_system, ble_cmd_system_get_connections_id}, 0x2, (ble_cmd_handler)ble_rsp_system_get_connections}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x5, ble_cls_system, ble_cmd_system_read_memory_id}, 0x86, (ble_cmd_handler)ble_rsp_system_read_memory}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0xc, ble_cls_system, ble_cmd_system_get_info_id}, 0x2244444, (ble_cmd_handler)ble_rsp_system_get_info}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_system, ble_cmd_system_endpoint_tx_id}, 0x4, (ble_cmd_handler)ble_rsp_system_endpoint_tx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_system, ble_cmd_system_whitelist_append_id}, 0x4, (ble_cmd_handler)ble_rsp_system_whitelist_append}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_system, ble_cmd_system_whitelist_remove_id}, 0x4, (ble_cmd_handler)ble_rsp_system_whitelist_remove}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_system, ble_cmd_system_whitelist_clear_id}, 0x0, (ble_cmd_handler)ble_rsp_system_whitelist_clear}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_system, ble_cmd_system_endpoint_rx_id}, 0x84, (ble_cmd_handler)ble_rsp_system_endpoint_rx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_system, ble_cmd_system_endpoint_set_watermarks_id}, 0x4, (ble_cmd_handler)ble_rsp_system_endpoint_set_watermarks}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_defrag_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_defrag}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_dump_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_dump}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_erase_all_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_erase_all}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_flash, ble_cmd_flash_ps_save_id}, 0x4, (ble_cmd_handler)ble_rsp_flash_ps_save}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_flash, ble_cmd_flash_ps_load_id}, 0x84, (ble_cmd_handler)ble_rsp_flash_ps_load}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_ps_erase_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_ps_erase}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_flash, ble_cmd_flash_erase_page_id}, 0x4, (ble_cmd_handler)ble_rsp_flash_erase_page}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_flash, ble_cmd_flash_write_words_id}, 0x0, (ble_cmd_handler)ble_rsp_flash_write_words}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_attributes, ble_cmd_attributes_write_id}, 0x4, (ble_cmd_handler)ble_rsp_attributes_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x7, ble_cls_attributes, ble_cmd_attributes_read_id}, 0x8444, (ble_cmd_handler)ble_rsp_attributes_read}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x5, ble_cls_attributes, ble_cmd_attributes_read_type_id}, 0x844, (ble_cmd_handler)ble_rsp_attributes_read_type}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_attributes, ble_cmd_attributes_user_read_response_id}, 0x0, (ble_cmd_handler)ble_rsp_attributes_user_read_response}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_attributes, ble_cmd_attributes_user_write_response_id}, 0x0, (ble_cmd_handler)ble_rsp_attributes_user_write_response}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_connection, ble_cmd_connection_disconnect_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_disconnect}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_connection, ble_cmd_connection_get_rssi_id}, 0x32, (ble_cmd_handler)ble_rsp_connection_get_rssi}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_connection, ble_cmd_connection_update_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_update}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_connection, ble_cmd_connection_version_update_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_version_update}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_connection, ble_cmd_connection_channel_map_get_id}, 0x82, (ble_cmd_handler)ble_rsp_connection_channel_map_get}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_connection, ble_cmd_connection_channel_map_set_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_channel_map_set}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_connection, ble_cmd_connection_features_get_id}, 0x42, (ble_cmd_handler)ble_rsp_connection_features_get}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_get_status_id}, 0x2, (ble_cmd_handler)ble_rsp_connection_get_status}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_connection, ble_cmd_connection_raw_tx_id}, 0x2, (ble_cmd_handler)ble_rsp_connection_raw_tx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_find_by_type_value_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_find_by_type_value}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_by_group_type_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_by_group_type}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_by_type_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_by_type}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_find_information_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_find_information}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_by_handle_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_by_handle}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_attribute_write_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_attribute_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_write_command_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_write_command}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_attclient, ble_cmd_attclient_indicate_confirm_id}, 0x4, (ble_cmd_handler)ble_rsp_attclient_indicate_confirm}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_long_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_long}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_prepare_write_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_prepare_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_execute_write_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_execute_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_attclient, ble_cmd_attclient_read_multiple_id}, 0x42, (ble_cmd_handler)ble_rsp_attclient_read_multiple}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_sm, ble_cmd_sm_encrypt_start_id}, 0x42, (ble_cmd_handler)ble_rsp_sm_encrypt_start}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_sm, ble_cmd_sm_set_bondable_mode_id}, 0x0, (ble_cmd_handler)ble_rsp_sm_set_bondable_mode}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_sm, ble_cmd_sm_delete_bonding_id}, 0x4, (ble_cmd_handler)ble_rsp_sm_delete_bonding}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_sm, ble_cmd_sm_set_parameters_id}, 0x0, (ble_cmd_handler)ble_rsp_sm_set_parameters}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_sm, ble_cmd_sm_passkey_entry_id}, 0x4, (ble_cmd_handler)ble_rsp_sm_passkey_entry}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_sm, ble_cmd_sm_get_bonds_id}, 0x2, (ble_cmd_handler)ble_rsp_sm_get_bonds}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_sm, ble_cmd_sm_set_oob_data_id}, 0x0, (ble_cmd_handler)ble_rsp_sm_set_oob_data}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_gap, ble_cmd_gap_set_privacy_flags_id}, 0x0, (ble_cmd_handler)ble_rsp_gap_set_privacy_flags}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_mode_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_mode}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_discover_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_discover}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_gap, ble_cmd_gap_connect_direct_id}, 0x24, (ble_cmd_handler)ble_rsp_gap_connect_direct}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_end_procedure_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_end_procedure}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_gap, ble_cmd_gap_connect_selective_id}, 0x24, (ble_cmd_handler)ble_rsp_gap_connect_selective}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_filtering_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_filtering}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_scan_parameters_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_scan_parameters}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_adv_parameters_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_adv_parameters}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_adv_data_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_adv_data}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_gap, ble_cmd_gap_set_directed_connectable_mode_id}, 0x4, (ble_cmd_handler)ble_rsp_gap_set_directed_connectable_mode}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_config_irq_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_irq}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_set_soft_timer_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_set_soft_timer}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_adc_read_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_adc_read}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_config_direction_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_direction}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_config_function_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_function}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_config_pull_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_config_pull}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_io_port_write_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_io_port_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x4, ble_cls_hardware, ble_cmd_hardware_io_port_read_id}, 0x224, (ble_cmd_handler)ble_rsp_hardware_io_port_read}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_spi_config_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_spi_config}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x4, ble_cls_hardware, ble_cmd_hardware_spi_transfer_id}, 0x824, (ble_cmd_handler)ble_rsp_hardware_spi_transfer}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x3, ble_cls_hardware, ble_cmd_hardware_i2c_read_id}, 0x84, (ble_cmd_handler)ble_rsp_hardware_i2c_read}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_hardware, ble_cmd_hardware_i2c_write_id}, 0x2, (ble_cmd_handler)ble_rsp_hardware_i2c_write}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_hardware, ble_cmd_hardware_set_txpower_id}, 0x0, (ble_cmd_handler)ble_rsp_hardware_set_txpower}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_hardware, ble_cmd_hardware_timer_comparator_id}, 0x4, (ble_cmd_handler)ble_rsp_hardware_timer_comparator}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_test, ble_cmd_test_phy_tx_id}, 0x0, (ble_cmd_handler)ble_rsp_test_phy_tx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_test, ble_cmd_test_phy_rx_id}, 0x0, (ble_cmd_handler)ble_rsp_test_phy_rx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_test, ble_cmd_test_phy_end_id}, 0x4, (ble_cmd_handler)ble_rsp_test_phy_end}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_test, ble_cmd_test_phy_reset_id}, 0x0, (ble_cmd_handler)ble_rsp_test_phy_reset}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_test, ble_cmd_test_get_channel_map_id}, 0x8, (ble_cmd_handler)ble_rsp_test_get_channel_map}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x1, ble_cls_test, ble_cmd_test_debug_id}, 0x8, (ble_cmd_handler)ble_rsp_test_debug}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_test, ble_cmd_test_channel_mode_id}, 0x0, (ble_cmd_handler)ble_rsp_test_channel_mode}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x0, ble_cls_dfu, ble_cmd_dfu_reset_id}, 0x0, (ble_cmd_handler)ble_rsp_dfu_reset}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_dfu, ble_cmd_dfu_flash_set_address_id}, 0x4, (ble_cmd_handler)ble_rsp_dfu_flash_set_address}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_dfu, ble_cmd_dfu_flash_upload_id}, 0x4, (ble_cmd_handler)ble_rsp_dfu_flash_upload}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_rsp | 0x0, 0x2, ble_cls_dfu, ble_cmd_dfu_flash_upload_finish_id}, 0x4, (ble_cmd_handler)ble_rsp_dfu_flash_upload_finish}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0xc, ble_cls_system, ble_evt_system_boot_id}, 0x2244444, (ble_cmd_handler)ble_evt_system_boot}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x1, ble_cls_system, ble_evt_system_debug_id}, 0x8, (ble_cmd_handler)ble_evt_system_debug}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_system, ble_evt_system_endpoint_watermark_rx_id}, 0x22, (ble_cmd_handler)ble_evt_system_endpoint_watermark_rx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_system, ble_evt_system_endpoint_watermark_tx_id}, 0x22, (ble_cmd_handler)ble_evt_system_endpoint_watermark_tx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x4, ble_cls_system, ble_evt_system_script_failure_id}, 0x44, (ble_cmd_handler)ble_evt_system_script_failure}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x0, ble_cls_system, ble_evt_system_no_license_key_id}, 0x0, (ble_cmd_handler)ble_evt_system_no_license_key}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_system, ble_evt_system_protocol_error_id}, 0x4, (ble_cmd_handler)ble_evt_system_protocol_error}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_flash, ble_evt_flash_ps_key_id}, 0x84, (ble_cmd_handler)ble_evt_flash_ps_key}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x7, ble_cls_attributes, ble_evt_attributes_value_id}, 0x84422, (ble_cmd_handler)ble_evt_attributes_value}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x6, ble_cls_attributes, ble_evt_attributes_user_read_request_id}, 0x2442, (ble_cmd_handler)ble_evt_attributes_user_read_request}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_attributes, ble_evt_attributes_status_id}, 0x24, (ble_cmd_handler)ble_evt_attributes_status}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x10, ble_cls_connection, ble_evt_connection_status_id}, 0x24442a22, (ble_cmd_handler)ble_evt_connection_status}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x6, ble_cls_connection, ble_evt_connection_version_ind_id}, 0x4422, (ble_cmd_handler)ble_evt_connection_version_ind}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_connection, ble_evt_connection_feature_ind_id}, 0x82, (ble_cmd_handler)ble_evt_connection_feature_ind}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_connection, ble_evt_connection_raw_rx_id}, 0x82, (ble_cmd_handler)ble_evt_connection_raw_rx}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_connection, ble_evt_connection_disconnected_id}, 0x42, (ble_cmd_handler)ble_evt_connection_disconnected}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_attclient, ble_evt_attclient_indicated_id}, 0x42, (ble_cmd_handler)ble_evt_attclient_indicated}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x5, ble_cls_attclient, ble_evt_attclient_procedure_completed_id}, 0x442, (ble_cmd_handler)ble_evt_attclient_procedure_completed}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x6, ble_cls_attclient, ble_evt_attclient_group_found_id}, 0x8442, (ble_cmd_handler)ble_evt_attclient_group_found}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x7, ble_cls_attclient, ble_evt_attclient_attribute_found_id}, 0x82442, (ble_cmd_handler)ble_evt_attclient_attribute_found}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x4, ble_cls_attclient, ble_evt_attclient_find_information_found_id}, 0x842, (ble_cmd_handler)ble_evt_attclient_find_information_found}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x5, ble_cls_attclient, ble_evt_attclient_attribute_value_id}, 0x8242, (ble_cmd_handler)ble_evt_attclient_attribute_value}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_attclient, ble_evt_attclient_read_multiple_response_id}, 0x82, (ble_cmd_handler)ble_evt_attclient_read_multiple_response}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_sm, ble_evt_sm_smp_data_id}, 0x822, (ble_cmd_handler)ble_evt_sm_smp_data}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_sm, ble_evt_sm_bonding_fail_id}, 0x42, (ble_cmd_handler)ble_evt_sm_bonding_fail}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x5, ble_cls_sm, ble_evt_sm_passkey_display_id}, 0x62, (ble_cmd_handler)ble_evt_sm_passkey_display}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x1, ble_cls_sm, ble_evt_sm_passkey_request_id}, 0x2, (ble_cmd_handler)ble_evt_sm_passkey_request}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x4, ble_cls_sm, ble_evt_sm_bond_status_id}, 0x2222, (ble_cmd_handler)ble_evt_sm_bond_status}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0xb, ble_cls_gap, ble_evt_gap_scan_response_id}, 0x822a23, (ble_cmd_handler)ble_evt_gap_scan_response}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x2, ble_cls_gap, ble_evt_gap_mode_changed_id}, 0x22, (ble_cmd_handler)ble_evt_gap_mode_changed}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x7, ble_cls_hardware, ble_evt_hardware_io_port_status_id}, 0x2226, (ble_cmd_handler)ble_evt_hardware_io_port_status}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x1, ble_cls_hardware, ble_evt_hardware_soft_timer_id}, 0x2, (ble_cmd_handler)ble_evt_hardware_soft_timer}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x3, ble_cls_hardware, ble_evt_hardware_adc_result_id}, 0x52, (ble_cmd_handler)ble_evt_hardware_adc_result}, + {{(uint8)ble_dev_type_ble | (uint8)ble_msg_type_evt | 0x0, 0x4, ble_cls_dfu, ble_evt_dfu_boot_id}, 0x6, (ble_cmd_handler)ble_evt_dfu_boot}, + {{0, 0, 0, 0}, 0, 0} +}; +const struct ble_msg *ble_get_msg(uint8 idx) { - return &apis[idx]; + return &apis[idx]; } -const struct ble_msg * ble_find_msg_hdr(struct ble_header hdr) +const struct ble_msg *ble_find_msg_hdr(struct ble_header hdr) { - const struct ble_msg *msg=apis; - - while(msg->handler) - { - if(((msg->hdr.type_hilen&0xF8)==(hdr.type_hilen&0xF8))&& - (msg->hdr.cls==hdr.cls)&& - (msg->hdr.command==hdr.command))return msg; - msg++; - } - return 0; + const struct ble_msg *msg = apis; + + while (msg->handler) { + if (((msg->hdr.type_hilen & 0xF8) == (hdr.type_hilen & 0xF8)) && + (msg->hdr.cls == hdr.cls) && + (msg->hdr.command == hdr.command)) { return msg; } + msg++; + } + return 0; } -const struct ble_msg * ble_get_msg_hdr(struct ble_header hdr) +const struct ble_msg *ble_get_msg_hdr(struct ble_header hdr) { - if((hdr.type_hilen&0x80)==ble_msg_type_evt) - { - if(hdr.cls>=(sizeof(ble_class_evt_handlers)/sizeof(struct ble_class_handler_t))) - return NULL; - if(hdr.command>=ble_class_evt_handlers[hdr.cls].maxhandlers) - return NULL; - return ble_class_evt_handlers[hdr.cls].msgs[hdr.command]; - }else - if((hdr.type_hilen&0x80)==ble_msg_type_rsp) - { - if(hdr.cls>=(sizeof(ble_class_rsp_handlers)/sizeof(struct ble_class_handler_t))) - return NULL; - if(hdr.command>=ble_class_rsp_handlers[hdr.cls].maxhandlers) - return NULL; - return ble_class_rsp_handlers[hdr.cls].msgs[hdr.command]; + if ((hdr.type_hilen & 0x80) == ble_msg_type_evt) { + if (hdr.cls >= (sizeof(ble_class_evt_handlers) / sizeof(struct ble_class_handler_t))) { + return NULL; } - return ble_find_msg_hdr(hdr); + if (hdr.command >= ble_class_evt_handlers[hdr.cls].maxhandlers) { + return NULL; + } + return ble_class_evt_handlers[hdr.cls].msgs[hdr.command]; + } else if ((hdr.type_hilen & 0x80) == ble_msg_type_rsp) { + if (hdr.cls >= (sizeof(ble_class_rsp_handlers) / sizeof(struct ble_class_handler_t))) { + return NULL; + } + if (hdr.command >= ble_class_rsp_handlers[hdr.cls].maxhandlers) { + return NULL; + } + return ble_class_rsp_handlers[hdr.cls].msgs[hdr.command]; + } + return ble_find_msg_hdr(hdr); } -void ble_send_message(uint8 msgid,...) +void ble_send_message(uint8 msgid, ...) { - uint32 i; - uint32 u32; - uint16 u16; - uint8 u8; - struct ble_cmd_packet packet; - uint8 *b=(uint8 *)&packet.payload; - - uint8 *hw; - uint8 *data_ptr=0; - uint16 data_len=0; - va_list va; - va_start(va,msgid); - - i=apis[msgid].params; - packet.header=apis[msgid].hdr; - while(i) - { - - switch(i&0xF) - { - - case 7:/*int32*/ - case 6:/*uint32*/ - u32=va_arg(va,uint32); - *b++=u32&0xff;u32>>=8; - *b++=u32&0xff;u32>>=8; - *b++=u32&0xff;u32>>=8; - *b++=u32&0xff; - break; - case 5:/*int16*/ - case 4:/*uint16*/ - u16=va_arg(va,unsigned); - *b++=u16&0xff;u16>>=8; - *b++=u16&0xff; - break; - case 3:/*int8*/ - case 2:/*uint8*/ - u8=va_arg(va,int); - *b++=u8&0xff; - break; - - case 9:/*string*/ - case 8:/*uint8 array*/ - data_len=va_arg(va,int); - *b++=data_len; - - u16=data_len+packet.header.lolen; - packet.header.lolen=u16&0xff; - packet.header.type_hilen|=u16>>8; - - data_ptr=va_arg(va,uint8*); - break; - case 10:/*hwaddr*/ - hw=va_arg(va,uint8*); - *b++=*hw++; - *b++=*hw++; - *b++=*hw++; - *b++=*hw++; - *b++=*hw++; - *b++=*hw++; - break; - case 11:/*uint16 array*/ - data_len=va_arg(va,int); - *b++=data_len&0xff; - *b++=data_len>>8; - - u16=data_len+packet.header.lolen; - packet.header.lolen=u16&0xff; - packet.header.type_hilen|=u16>>8; - - data_ptr=va_arg(va,uint8*); - break; - } - i=i>>4; + uint32 i; + uint32 u32; + uint16 u16; + uint8 u8; + struct ble_cmd_packet packet; + uint8 *b = (uint8 *)&packet.payload; + + uint8 *hw; + uint8 *data_ptr = 0; + uint16 data_len = 0; + va_list va; + va_start(va, msgid); + + i = apis[msgid].params; + packet.header = apis[msgid].hdr; + while (i) { + + switch (i & 0xF) { + + case 7:/*int32*/ + case 6:/*uint32*/ + u32 = va_arg(va, uint32); + *b++ = u32 & 0xff; u32 >>= 8; + *b++ = u32 & 0xff; u32 >>= 8; + *b++ = u32 & 0xff; u32 >>= 8; + *b++ = u32 & 0xff; + break; + case 5:/*int16*/ + case 4:/*uint16*/ + u16 = va_arg(va, unsigned); + *b++ = u16 & 0xff; u16 >>= 8; + *b++ = u16 & 0xff; + break; + case 3:/*int8*/ + case 2:/*uint8*/ + u8 = va_arg(va, int); + *b++ = u8 & 0xff; + break; + + case 9:/*string*/ + case 8:/*uint8 array*/ + data_len = va_arg(va, int); + *b++ = data_len; + + u16 = data_len + packet.header.lolen; + packet.header.lolen = u16 & 0xff; + packet.header.type_hilen |= u16 >> 8; + + data_ptr = va_arg(va, uint8 *); + break; + case 10:/*hwaddr*/ + hw = va_arg(va, uint8 *); + *b++ = *hw++; + *b++ = *hw++; + *b++ = *hw++; + *b++ = *hw++; + *b++ = *hw++; + *b++ = *hw++; + break; + case 11:/*uint16 array*/ + data_len = va_arg(va, int); + *b++ = data_len & 0xff; + *b++ = data_len >> 8; + + u16 = data_len + packet.header.lolen; + packet.header.lolen = u16 & 0xff; + packet.header.type_hilen |= u16 >> 8; + + data_ptr = va_arg(va, uint8 *); + break; } - va_end(va); - if(bglib_output)bglib_output(sizeof(struct ble_header)+apis[msgid].hdr.lolen,(uint8*)&packet,data_len,(uint8*)data_ptr); + i = i >> 4; + } + va_end(va); + if (bglib_output) { bglib_output(sizeof(struct ble_header) + apis[msgid].hdr.lolen, (uint8 *)&packet, data_len, (uint8 *)data_ptr); } } -static const struct ble_msg* ble_class_system_rsp_handlers[]= -{ - &apis[ble_rsp_system_reset_idx], - &apis[ble_rsp_system_hello_idx], - &apis[ble_rsp_system_address_get_idx], - &apis[ble_rsp_system_reg_write_idx], - &apis[ble_rsp_system_reg_read_idx], - &apis[ble_rsp_system_get_counters_idx], - &apis[ble_rsp_system_get_connections_idx], - &apis[ble_rsp_system_read_memory_idx], - &apis[ble_rsp_system_get_info_idx], - &apis[ble_rsp_system_endpoint_tx_idx], - &apis[ble_rsp_system_whitelist_append_idx], - &apis[ble_rsp_system_whitelist_remove_idx], - &apis[ble_rsp_system_whitelist_clear_idx], - &apis[ble_rsp_system_endpoint_rx_idx], - &apis[ble_rsp_system_endpoint_set_watermarks_idx], +static const struct ble_msg *ble_class_system_rsp_handlers[] = { + &apis[ble_rsp_system_reset_idx], + &apis[ble_rsp_system_hello_idx], + &apis[ble_rsp_system_address_get_idx], + &apis[ble_rsp_system_reg_write_idx], + &apis[ble_rsp_system_reg_read_idx], + &apis[ble_rsp_system_get_counters_idx], + &apis[ble_rsp_system_get_connections_idx], + &apis[ble_rsp_system_read_memory_idx], + &apis[ble_rsp_system_get_info_idx], + &apis[ble_rsp_system_endpoint_tx_idx], + &apis[ble_rsp_system_whitelist_append_idx], + &apis[ble_rsp_system_whitelist_remove_idx], + &apis[ble_rsp_system_whitelist_clear_idx], + &apis[ble_rsp_system_endpoint_rx_idx], + &apis[ble_rsp_system_endpoint_set_watermarks_idx], }; -static const struct ble_msg* ble_class_system_evt_handlers[]= -{ - &apis[ble_evt_system_boot_idx], - &apis[ble_evt_system_debug_idx], - &apis[ble_evt_system_endpoint_watermark_rx_idx], - &apis[ble_evt_system_endpoint_watermark_tx_idx], - &apis[ble_evt_system_script_failure_idx], - &apis[ble_evt_system_no_license_key_idx], - &apis[ble_evt_system_protocol_error_idx], +static const struct ble_msg *ble_class_system_evt_handlers[] = { + &apis[ble_evt_system_boot_idx], + &apis[ble_evt_system_debug_idx], + &apis[ble_evt_system_endpoint_watermark_rx_idx], + &apis[ble_evt_system_endpoint_watermark_tx_idx], + &apis[ble_evt_system_script_failure_idx], + &apis[ble_evt_system_no_license_key_idx], + &apis[ble_evt_system_protocol_error_idx], }; -static const struct ble_msg* ble_class_flash_rsp_handlers[]= -{ - &apis[ble_rsp_flash_ps_defrag_idx], - &apis[ble_rsp_flash_ps_dump_idx], - &apis[ble_rsp_flash_ps_erase_all_idx], - &apis[ble_rsp_flash_ps_save_idx], - &apis[ble_rsp_flash_ps_load_idx], - &apis[ble_rsp_flash_ps_erase_idx], - &apis[ble_rsp_flash_erase_page_idx], - &apis[ble_rsp_flash_write_words_idx], +static const struct ble_msg *ble_class_flash_rsp_handlers[] = { + &apis[ble_rsp_flash_ps_defrag_idx], + &apis[ble_rsp_flash_ps_dump_idx], + &apis[ble_rsp_flash_ps_erase_all_idx], + &apis[ble_rsp_flash_ps_save_idx], + &apis[ble_rsp_flash_ps_load_idx], + &apis[ble_rsp_flash_ps_erase_idx], + &apis[ble_rsp_flash_erase_page_idx], + &apis[ble_rsp_flash_write_words_idx], }; -static const struct ble_msg* ble_class_flash_evt_handlers[]= -{ - &apis[ble_evt_flash_ps_key_idx], +static const struct ble_msg *ble_class_flash_evt_handlers[] = { + &apis[ble_evt_flash_ps_key_idx], }; -static const struct ble_msg* ble_class_attributes_rsp_handlers[]= -{ - &apis[ble_rsp_attributes_write_idx], - &apis[ble_rsp_attributes_read_idx], - &apis[ble_rsp_attributes_read_type_idx], - &apis[ble_rsp_attributes_user_read_response_idx], - &apis[ble_rsp_attributes_user_write_response_idx], +static const struct ble_msg *ble_class_attributes_rsp_handlers[] = { + &apis[ble_rsp_attributes_write_idx], + &apis[ble_rsp_attributes_read_idx], + &apis[ble_rsp_attributes_read_type_idx], + &apis[ble_rsp_attributes_user_read_response_idx], + &apis[ble_rsp_attributes_user_write_response_idx], }; -static const struct ble_msg* ble_class_attributes_evt_handlers[]= -{ - &apis[ble_evt_attributes_value_idx], - &apis[ble_evt_attributes_user_read_request_idx], - &apis[ble_evt_attributes_status_idx], +static const struct ble_msg *ble_class_attributes_evt_handlers[] = { + &apis[ble_evt_attributes_value_idx], + &apis[ble_evt_attributes_user_read_request_idx], + &apis[ble_evt_attributes_status_idx], }; -static const struct ble_msg* ble_class_connection_rsp_handlers[]= -{ - &apis[ble_rsp_connection_disconnect_idx], - &apis[ble_rsp_connection_get_rssi_idx], - &apis[ble_rsp_connection_update_idx], - &apis[ble_rsp_connection_version_update_idx], - &apis[ble_rsp_connection_channel_map_get_idx], - &apis[ble_rsp_connection_channel_map_set_idx], - &apis[ble_rsp_connection_features_get_idx], - &apis[ble_rsp_connection_get_status_idx], - &apis[ble_rsp_connection_raw_tx_idx], +static const struct ble_msg *ble_class_connection_rsp_handlers[] = { + &apis[ble_rsp_connection_disconnect_idx], + &apis[ble_rsp_connection_get_rssi_idx], + &apis[ble_rsp_connection_update_idx], + &apis[ble_rsp_connection_version_update_idx], + &apis[ble_rsp_connection_channel_map_get_idx], + &apis[ble_rsp_connection_channel_map_set_idx], + &apis[ble_rsp_connection_features_get_idx], + &apis[ble_rsp_connection_get_status_idx], + &apis[ble_rsp_connection_raw_tx_idx], }; -static const struct ble_msg* ble_class_connection_evt_handlers[]= -{ - &apis[ble_evt_connection_status_idx], - &apis[ble_evt_connection_version_ind_idx], - &apis[ble_evt_connection_feature_ind_idx], - &apis[ble_evt_connection_raw_rx_idx], - &apis[ble_evt_connection_disconnected_idx], +static const struct ble_msg *ble_class_connection_evt_handlers[] = { + &apis[ble_evt_connection_status_idx], + &apis[ble_evt_connection_version_ind_idx], + &apis[ble_evt_connection_feature_ind_idx], + &apis[ble_evt_connection_raw_rx_idx], + &apis[ble_evt_connection_disconnected_idx], }; -static const struct ble_msg* ble_class_attclient_rsp_handlers[]= -{ - &apis[ble_rsp_attclient_find_by_type_value_idx], - &apis[ble_rsp_attclient_read_by_group_type_idx], - &apis[ble_rsp_attclient_read_by_type_idx], - &apis[ble_rsp_attclient_find_information_idx], - &apis[ble_rsp_attclient_read_by_handle_idx], - &apis[ble_rsp_attclient_attribute_write_idx], - &apis[ble_rsp_attclient_write_command_idx], - &apis[ble_rsp_attclient_indicate_confirm_idx], - &apis[ble_rsp_attclient_read_long_idx], - &apis[ble_rsp_attclient_prepare_write_idx], - &apis[ble_rsp_attclient_execute_write_idx], - &apis[ble_rsp_attclient_read_multiple_idx], +static const struct ble_msg *ble_class_attclient_rsp_handlers[] = { + &apis[ble_rsp_attclient_find_by_type_value_idx], + &apis[ble_rsp_attclient_read_by_group_type_idx], + &apis[ble_rsp_attclient_read_by_type_idx], + &apis[ble_rsp_attclient_find_information_idx], + &apis[ble_rsp_attclient_read_by_handle_idx], + &apis[ble_rsp_attclient_attribute_write_idx], + &apis[ble_rsp_attclient_write_command_idx], + &apis[ble_rsp_attclient_indicate_confirm_idx], + &apis[ble_rsp_attclient_read_long_idx], + &apis[ble_rsp_attclient_prepare_write_idx], + &apis[ble_rsp_attclient_execute_write_idx], + &apis[ble_rsp_attclient_read_multiple_idx], }; -static const struct ble_msg* ble_class_attclient_evt_handlers[]= -{ - &apis[ble_evt_attclient_indicated_idx], - &apis[ble_evt_attclient_procedure_completed_idx], - &apis[ble_evt_attclient_group_found_idx], - &apis[ble_evt_attclient_attribute_found_idx], - &apis[ble_evt_attclient_find_information_found_idx], - &apis[ble_evt_attclient_attribute_value_idx], - &apis[ble_evt_attclient_read_multiple_response_idx], +static const struct ble_msg *ble_class_attclient_evt_handlers[] = { + &apis[ble_evt_attclient_indicated_idx], + &apis[ble_evt_attclient_procedure_completed_idx], + &apis[ble_evt_attclient_group_found_idx], + &apis[ble_evt_attclient_attribute_found_idx], + &apis[ble_evt_attclient_find_information_found_idx], + &apis[ble_evt_attclient_attribute_value_idx], + &apis[ble_evt_attclient_read_multiple_response_idx], }; -static const struct ble_msg* ble_class_sm_rsp_handlers[]= -{ - &apis[ble_rsp_sm_encrypt_start_idx], - &apis[ble_rsp_sm_set_bondable_mode_idx], - &apis[ble_rsp_sm_delete_bonding_idx], - &apis[ble_rsp_sm_set_parameters_idx], - &apis[ble_rsp_sm_passkey_entry_idx], - &apis[ble_rsp_sm_get_bonds_idx], - &apis[ble_rsp_sm_set_oob_data_idx], +static const struct ble_msg *ble_class_sm_rsp_handlers[] = { + &apis[ble_rsp_sm_encrypt_start_idx], + &apis[ble_rsp_sm_set_bondable_mode_idx], + &apis[ble_rsp_sm_delete_bonding_idx], + &apis[ble_rsp_sm_set_parameters_idx], + &apis[ble_rsp_sm_passkey_entry_idx], + &apis[ble_rsp_sm_get_bonds_idx], + &apis[ble_rsp_sm_set_oob_data_idx], }; -static const struct ble_msg* ble_class_sm_evt_handlers[]= -{ - &apis[ble_evt_sm_smp_data_idx], - &apis[ble_evt_sm_bonding_fail_idx], - &apis[ble_evt_sm_passkey_display_idx], - &apis[ble_evt_sm_passkey_request_idx], - &apis[ble_evt_sm_bond_status_idx], +static const struct ble_msg *ble_class_sm_evt_handlers[] = { + &apis[ble_evt_sm_smp_data_idx], + &apis[ble_evt_sm_bonding_fail_idx], + &apis[ble_evt_sm_passkey_display_idx], + &apis[ble_evt_sm_passkey_request_idx], + &apis[ble_evt_sm_bond_status_idx], }; -static const struct ble_msg* ble_class_gap_rsp_handlers[]= -{ - &apis[ble_rsp_gap_set_privacy_flags_idx], - &apis[ble_rsp_gap_set_mode_idx], - &apis[ble_rsp_gap_discover_idx], - &apis[ble_rsp_gap_connect_direct_idx], - &apis[ble_rsp_gap_end_procedure_idx], - &apis[ble_rsp_gap_connect_selective_idx], - &apis[ble_rsp_gap_set_filtering_idx], - &apis[ble_rsp_gap_set_scan_parameters_idx], - &apis[ble_rsp_gap_set_adv_parameters_idx], - &apis[ble_rsp_gap_set_adv_data_idx], - &apis[ble_rsp_gap_set_directed_connectable_mode_idx], +static const struct ble_msg *ble_class_gap_rsp_handlers[] = { + &apis[ble_rsp_gap_set_privacy_flags_idx], + &apis[ble_rsp_gap_set_mode_idx], + &apis[ble_rsp_gap_discover_idx], + &apis[ble_rsp_gap_connect_direct_idx], + &apis[ble_rsp_gap_end_procedure_idx], + &apis[ble_rsp_gap_connect_selective_idx], + &apis[ble_rsp_gap_set_filtering_idx], + &apis[ble_rsp_gap_set_scan_parameters_idx], + &apis[ble_rsp_gap_set_adv_parameters_idx], + &apis[ble_rsp_gap_set_adv_data_idx], + &apis[ble_rsp_gap_set_directed_connectable_mode_idx], }; -static const struct ble_msg* ble_class_gap_evt_handlers[]= -{ - &apis[ble_evt_gap_scan_response_idx], - &apis[ble_evt_gap_mode_changed_idx], +static const struct ble_msg *ble_class_gap_evt_handlers[] = { + &apis[ble_evt_gap_scan_response_idx], + &apis[ble_evt_gap_mode_changed_idx], }; -static const struct ble_msg* ble_class_hardware_rsp_handlers[]= -{ - &apis[ble_rsp_hardware_io_port_config_irq_idx], - &apis[ble_rsp_hardware_set_soft_timer_idx], - &apis[ble_rsp_hardware_adc_read_idx], - &apis[ble_rsp_hardware_io_port_config_direction_idx], - &apis[ble_rsp_hardware_io_port_config_function_idx], - &apis[ble_rsp_hardware_io_port_config_pull_idx], - &apis[ble_rsp_hardware_io_port_write_idx], - &apis[ble_rsp_hardware_io_port_read_idx], - &apis[ble_rsp_hardware_spi_config_idx], - &apis[ble_rsp_hardware_spi_transfer_idx], - &apis[ble_rsp_hardware_i2c_read_idx], - &apis[ble_rsp_hardware_i2c_write_idx], - &apis[ble_rsp_hardware_set_txpower_idx], - &apis[ble_rsp_hardware_timer_comparator_idx], +static const struct ble_msg *ble_class_hardware_rsp_handlers[] = { + &apis[ble_rsp_hardware_io_port_config_irq_idx], + &apis[ble_rsp_hardware_set_soft_timer_idx], + &apis[ble_rsp_hardware_adc_read_idx], + &apis[ble_rsp_hardware_io_port_config_direction_idx], + &apis[ble_rsp_hardware_io_port_config_function_idx], + &apis[ble_rsp_hardware_io_port_config_pull_idx], + &apis[ble_rsp_hardware_io_port_write_idx], + &apis[ble_rsp_hardware_io_port_read_idx], + &apis[ble_rsp_hardware_spi_config_idx], + &apis[ble_rsp_hardware_spi_transfer_idx], + &apis[ble_rsp_hardware_i2c_read_idx], + &apis[ble_rsp_hardware_i2c_write_idx], + &apis[ble_rsp_hardware_set_txpower_idx], + &apis[ble_rsp_hardware_timer_comparator_idx], }; -static const struct ble_msg* ble_class_hardware_evt_handlers[]= -{ - &apis[ble_evt_hardware_io_port_status_idx], - &apis[ble_evt_hardware_soft_timer_idx], - &apis[ble_evt_hardware_adc_result_idx], +static const struct ble_msg *ble_class_hardware_evt_handlers[] = { + &apis[ble_evt_hardware_io_port_status_idx], + &apis[ble_evt_hardware_soft_timer_idx], + &apis[ble_evt_hardware_adc_result_idx], }; -static const struct ble_msg* ble_class_test_rsp_handlers[]= -{ - &apis[ble_rsp_test_phy_tx_idx], - &apis[ble_rsp_test_phy_rx_idx], - &apis[ble_rsp_test_phy_end_idx], - &apis[ble_rsp_test_phy_reset_idx], - &apis[ble_rsp_test_get_channel_map_idx], - &apis[ble_rsp_test_debug_idx], - &apis[ble_rsp_test_channel_mode_idx], +static const struct ble_msg *ble_class_test_rsp_handlers[] = { + &apis[ble_rsp_test_phy_tx_idx], + &apis[ble_rsp_test_phy_rx_idx], + &apis[ble_rsp_test_phy_end_idx], + &apis[ble_rsp_test_phy_reset_idx], + &apis[ble_rsp_test_get_channel_map_idx], + &apis[ble_rsp_test_debug_idx], + &apis[ble_rsp_test_channel_mode_idx], }; -static const struct ble_msg* ble_class_dfu_rsp_handlers[]= -{ - &apis[ble_rsp_dfu_reset_idx], - &apis[ble_rsp_dfu_flash_set_address_idx], - &apis[ble_rsp_dfu_flash_upload_idx], - &apis[ble_rsp_dfu_flash_upload_finish_idx], +static const struct ble_msg *ble_class_dfu_rsp_handlers[] = { + &apis[ble_rsp_dfu_reset_idx], + &apis[ble_rsp_dfu_flash_set_address_idx], + &apis[ble_rsp_dfu_flash_upload_idx], + &apis[ble_rsp_dfu_flash_upload_finish_idx], }; -static const struct ble_msg* ble_class_dfu_evt_handlers[]= -{ - &apis[ble_evt_dfu_boot_idx], +static const struct ble_msg *ble_class_dfu_evt_handlers[] = { + &apis[ble_evt_dfu_boot_idx], }; -struct ble_class_handler_t ble_class_rsp_handlers[ble_cls_last]= -{ - {ble_class_system_rsp_handlers,15}, - {ble_class_flash_rsp_handlers,8}, - {ble_class_attributes_rsp_handlers,5}, - {ble_class_connection_rsp_handlers,9}, - {ble_class_attclient_rsp_handlers,12}, - {ble_class_sm_rsp_handlers,7}, - {ble_class_gap_rsp_handlers,11}, - {ble_class_hardware_rsp_handlers,14}, - {ble_class_test_rsp_handlers,7}, - {ble_class_dfu_rsp_handlers,4}, +struct ble_class_handler_t ble_class_rsp_handlers[ble_cls_last] = { + {ble_class_system_rsp_handlers, 15}, + {ble_class_flash_rsp_handlers, 8}, + {ble_class_attributes_rsp_handlers, 5}, + {ble_class_connection_rsp_handlers, 9}, + {ble_class_attclient_rsp_handlers, 12}, + {ble_class_sm_rsp_handlers, 7}, + {ble_class_gap_rsp_handlers, 11}, + {ble_class_hardware_rsp_handlers, 14}, + {ble_class_test_rsp_handlers, 7}, + {ble_class_dfu_rsp_handlers, 4}, }; -struct ble_class_handler_t ble_class_evt_handlers[ble_cls_last]= -{ - {ble_class_system_evt_handlers,7}, - {ble_class_flash_evt_handlers,1}, - {ble_class_attributes_evt_handlers,3}, - {ble_class_connection_evt_handlers,5}, - {ble_class_attclient_evt_handlers,7}, - {ble_class_sm_evt_handlers,5}, - {ble_class_gap_evt_handlers,2}, - {ble_class_hardware_evt_handlers,3}, - {NULL,0}, - {ble_class_dfu_evt_handlers,1}, +struct ble_class_handler_t ble_class_evt_handlers[ble_cls_last] = { + {ble_class_system_evt_handlers, 7}, + {ble_class_flash_evt_handlers, 1}, + {ble_class_attributes_evt_handlers, 3}, + {ble_class_connection_evt_handlers, 5}, + {ble_class_attclient_evt_handlers, 7}, + {ble_class_sm_evt_handlers, 5}, + {ble_class_gap_evt_handlers, 2}, + {ble_class_hardware_evt_handlers, 3}, + {NULL, 0}, + {ble_class_dfu_evt_handlers, 1}, }; diff --git a/sw/tools/bluegiga_usb_dongle/cmd_def.h b/sw/tools/bluegiga_usb_dongle/cmd_def.h index 820e30d369..3890a69fed 100644 --- a/sw/tools/bluegiga_usb_dongle/cmd_def.h +++ b/sw/tools/bluegiga_usb_dongle/cmd_def.h @@ -13,7 +13,7 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // @@ -35,7 +35,7 @@ * * ****************************************************************************/ - + #include #include "apitypes.h" @@ -45,115 +45,106 @@ extern "C" { /* structure packing compability */ #ifndef PACKSTRUCT - #ifdef PACKED - #define PACKSTRUCT(a) a PACKED - #else - /* default packed configuration */ - #ifdef __GNUC__ - #ifdef _WIN32 - #define PACKSTRUCT( decl ) decl __attribute__((__packed__,gcc_struct)) - #else - #define PACKSTRUCT( decl ) decl __attribute__((__packed__)) - #endif - #define ALIGNED __attribute__((aligned(0x4))) +#ifdef PACKED +#define PACKSTRUCT(a) a PACKED +#else +/* default packed configuration */ +#ifdef __GNUC__ +#ifdef _WIN32 +#define PACKSTRUCT( decl ) decl __attribute__((__packed__,gcc_struct)) +#else +#define PACKSTRUCT( decl ) decl __attribute__((__packed__)) +#endif +#define ALIGNED __attribute__((aligned(0x4))) - #else // MSVC - #define PACKSTRUCT( decl ) __pragma( pack(push, 1) ) decl __pragma( pack(pop) ) - #define ALIGNED - #endif - #endif +#else // MSVC +#define PACKSTRUCT( decl ) __pragma( pack(push, 1) ) decl __pragma( pack(pop) ) +#define ALIGNED +#endif +#endif #endif struct ble_cmd_packet; -typedef void (*ble_cmd_handler)(const void*); -struct ble_header -{ - uint8 type_hilen; - uint8 lolen; - uint8 cls; - uint8 command; +typedef void (*ble_cmd_handler)(const void *); +struct ble_header { + uint8 type_hilen; + uint8 lolen; + uint8 cls; + uint8 command; }; -struct ble_msg -{ - struct ble_header hdr; - uint32 params; - ble_cmd_handler handler; -}; - -const struct ble_msg * ble_find_msg_hdr(struct ble_header hdr); -const struct ble_msg * ble_get_msg(uint8 idx) ; -const struct ble_msg * ble_get_msg_hdr(struct ble_header hdr) ; -extern void (*bglib_output)(uint8 len1,uint8* data1,uint16 len2,uint8* data2); -void ble_send_message(uint8 msgid,...); - -enum system_endpoints -{ - system_endpoint_api = 0, - system_endpoint_test = 1, - system_endpoint_script = 2, - system_endpoint_usb = 3, - system_endpoint_uart0 = 4, - system_endpoint_uart1 = 5, - system_endpoints_max = 6 +struct ble_msg { + struct ble_header hdr; + uint32 params; + ble_cmd_handler handler; }; -enum attributes_attribute_change_reason -{ - attributes_attribute_change_reason_write_request = 0, - attributes_attribute_change_reason_write_command = 1, - attributes_attribute_change_reason_write_request_user = 2, - attributes_attribute_change_reason_max = 3 +const struct ble_msg *ble_find_msg_hdr(struct ble_header hdr); +const struct ble_msg *ble_get_msg(uint8 idx) ; +const struct ble_msg *ble_get_msg_hdr(struct ble_header hdr) ; +extern void (*bglib_output)(uint8 len1, uint8 *data1, uint16 len2, uint8 *data2); +void ble_send_message(uint8 msgid, ...); + +enum system_endpoints { + system_endpoint_api = 0, + system_endpoint_test = 1, + system_endpoint_script = 2, + system_endpoint_usb = 3, + system_endpoint_uart0 = 4, + system_endpoint_uart1 = 5, + system_endpoints_max = 6 }; -enum attributes_attribute_status_flag -{ - attributes_attribute_status_flag_notify = 1, - attributes_attribute_status_flag_indicate = 2, - attributes_attribute_status_flag_max = 3 +enum attributes_attribute_change_reason { + attributes_attribute_change_reason_write_request = 0, + attributes_attribute_change_reason_write_command = 1, + attributes_attribute_change_reason_write_request_user = 2, + attributes_attribute_change_reason_max = 3 }; -enum connection_connstatus -{ - connection_connected = 1, - connection_encrypted = 2, - connection_completed = 4, - connection_parameters_change = 8, - connection_connstatus_max = 9 +enum attributes_attribute_status_flag { + attributes_attribute_status_flag_notify = 1, + attributes_attribute_status_flag_indicate = 2, + attributes_attribute_status_flag_max = 3 }; -enum attclient_attribute_value_types -{ - attclient_attribute_value_type_read = 0, - attclient_attribute_value_type_notify = 1, - attclient_attribute_value_type_indicate = 2, - attclient_attribute_value_type_read_by_type = 3, - attclient_attribute_value_type_read_blob = 4, - attclient_attribute_value_type_indicate_rsp_req = 5, - attclient_attribute_value_types_max = 6 +enum connection_connstatus { + connection_connected = 1, + connection_encrypted = 2, + connection_completed = 4, + connection_parameters_change = 8, + connection_connstatus_max = 9 }; -enum sm_bonding_key -{ - sm_bonding_key_ltk = 0x01, - sm_bonding_key_addr_public = 0x02, - sm_bonding_key_addr_static = 0x04, - sm_bonding_key_irk = 0x08, - sm_bonding_key_edivrand = 0x10, - sm_bonding_key_csrk = 0x20, - sm_bonding_key_masterid = 0x40, - sm_bonding_key_max = 65 +enum attclient_attribute_value_types { + attclient_attribute_value_type_read = 0, + attclient_attribute_value_type_notify = 1, + attclient_attribute_value_type_indicate = 2, + attclient_attribute_value_type_read_by_type = 3, + attclient_attribute_value_type_read_blob = 4, + attclient_attribute_value_type_indicate_rsp_req = 5, + attclient_attribute_value_types_max = 6 }; -enum sm_io_capability -{ - sm_io_capability_displayonly = 0, - sm_io_capability_displayyesno = 1, - sm_io_capability_keyboardonly = 2, - sm_io_capability_noinputnooutput = 3, - sm_io_capability_keyboarddisplay = 4, - sm_io_capability_max = 5 +enum sm_bonding_key { + sm_bonding_key_ltk = 0x01, + sm_bonding_key_addr_public = 0x02, + sm_bonding_key_addr_static = 0x04, + sm_bonding_key_irk = 0x08, + sm_bonding_key_edivrand = 0x10, + sm_bonding_key_csrk = 0x20, + sm_bonding_key_masterid = 0x40, + sm_bonding_key_max = 65 +}; + +enum sm_io_capability { + sm_io_capability_displayonly = 0, + sm_io_capability_displayyesno = 1, + sm_io_capability_keyboardonly = 2, + sm_io_capability_noinputnooutput = 3, + sm_io_capability_keyboarddisplay = 4, + sm_io_capability_max = 5 }; #define GAP_SCAN_HEADER_ADV_IND 0 @@ -171,1943 +162,1743 @@ enum sm_io_capability #define GAP_AD_FLAG_SIMULTANEOUS_LEBREDR_HOST 0x20 #define GAP_AD_FLAG_MASK 0x1f -enum gap_address_type -{ - gap_address_type_public = 0, - gap_address_type_random = 1, - gap_address_type_max = 2 +enum gap_address_type { + gap_address_type_public = 0, + gap_address_type_random = 1, + gap_address_type_max = 2 }; -enum gap_discoverable_mode -{ - gap_non_discoverable = 0, - gap_limited_discoverable = 1, - gap_general_discoverable = 2, - gap_broadcast = 3, - gap_user_data = 4, - gap_discoverable_mode_max= 5 +enum gap_discoverable_mode { + gap_non_discoverable = 0, + gap_limited_discoverable = 1, + gap_general_discoverable = 2, + gap_broadcast = 3, + gap_user_data = 4, + gap_discoverable_mode_max = 5 }; -enum gap_connectable_mode -{ - gap_non_connectable = 0, - gap_directed_connectable = 1, - gap_undirected_connectable = 2, - gap_scannable_connectable = 3, - gap_connectable_mode_max = 4 +enum gap_connectable_mode { + gap_non_connectable = 0, + gap_directed_connectable = 1, + gap_undirected_connectable = 2, + gap_scannable_connectable = 3, + gap_connectable_mode_max = 4 }; -enum gap_discover_mode -{ - gap_discover_limited = 0, - gap_discover_generic = 1, - gap_discover_observation = 2, - gap_discover_mode_max = 3 +enum gap_discover_mode { + gap_discover_limited = 0, + gap_discover_generic = 1, + gap_discover_observation = 2, + gap_discover_mode_max = 3 }; -enum gap_ad_types -{ - gap_ad_type_none = 0, - gap_ad_type_flags = 1, - gap_ad_type_services_16bit_more = 2, - gap_ad_type_services_16bit_all = 3, - gap_ad_type_services_32bit_more = 4, - gap_ad_type_services_32bit_all = 5, - gap_ad_type_services_128bit_more = 6, - gap_ad_type_services_128bit_all = 7, - gap_ad_type_localname_short = 8, - gap_ad_type_localname_complete = 9, - gap_ad_type_txpower = 10, - gap_ad_types_max = 11 +enum gap_ad_types { + gap_ad_type_none = 0, + gap_ad_type_flags = 1, + gap_ad_type_services_16bit_more = 2, + gap_ad_type_services_16bit_all = 3, + gap_ad_type_services_32bit_more = 4, + gap_ad_type_services_32bit_all = 5, + gap_ad_type_services_128bit_more = 6, + gap_ad_type_services_128bit_all = 7, + gap_ad_type_localname_short = 8, + gap_ad_type_localname_complete = 9, + gap_ad_type_txpower = 10, + gap_ad_types_max = 11 }; -enum gap_advertising_policy -{ - gap_adv_policy_all = 0, - gap_adv_policy_whitelist_scan = 1, - gap_adv_policy_whitelist_connect = 2, - gap_adv_policy_whitelist_all = 3, - gap_advertising_policy_max = 4 +enum gap_advertising_policy { + gap_adv_policy_all = 0, + gap_adv_policy_whitelist_scan = 1, + gap_adv_policy_whitelist_connect = 2, + gap_adv_policy_whitelist_all = 3, + gap_advertising_policy_max = 4 }; -enum gap_scan_policy -{ - gap_scan_policy_all = 0, - gap_scan_policy_whitelist = 1, - gap_scan_policy_max = 2 +enum gap_scan_policy { + gap_scan_policy_all = 0, + gap_scan_policy_whitelist = 1, + gap_scan_policy_max = 2 }; -enum ble_parameter_types -{ - ble_msg_parameter_uint8=2, - ble_msg_parameter_int8=3, - ble_msg_parameter_uint16=4, - ble_msg_parameter_int16=5, - ble_msg_parameter_uint32=6, - ble_msg_parameter_int32=7, - ble_msg_parameter_uint8array=8, - ble_msg_parameter_string=9, - ble_msg_parameter_hwaddr=10, - ble_msg_parameter_uint16array=11 +enum ble_parameter_types { + ble_msg_parameter_uint8 = 2, + ble_msg_parameter_int8 = 3, + ble_msg_parameter_uint16 = 4, + ble_msg_parameter_int16 = 5, + ble_msg_parameter_uint32 = 6, + ble_msg_parameter_int32 = 7, + ble_msg_parameter_uint8array = 8, + ble_msg_parameter_string = 9, + ble_msg_parameter_hwaddr = 10, + ble_msg_parameter_uint16array = 11 }; -enum ble_msg_types -{ - ble_msg_type_cmd=0x00, - ble_msg_type_rsp=0x00, - ble_msg_type_evt=0x80 +enum ble_msg_types { + ble_msg_type_cmd = 0x00, + ble_msg_type_rsp = 0x00, + ble_msg_type_evt = 0x80 }; -enum ble_dev_types -{ - ble_dev_type_ble =0x00, - ble_dev_type_wifi =0x08, - ble_dev_type_iwrap =0x10 +enum ble_dev_types { + ble_dev_type_ble = 0x00, + ble_dev_type_wifi = 0x08, + ble_dev_type_iwrap = 0x10 }; -enum ble_classes -{ - ble_cls_system, - ble_cls_flash, - ble_cls_attributes, - ble_cls_connection, - ble_cls_attclient, - ble_cls_sm, - ble_cls_gap, - ble_cls_hardware, - ble_cls_test, - ble_cls_dfu, - ble_cls_last +enum ble_classes { + ble_cls_system, + ble_cls_flash, + ble_cls_attributes, + ble_cls_connection, + ble_cls_attclient, + ble_cls_sm, + ble_cls_gap, + ble_cls_hardware, + ble_cls_test, + ble_cls_dfu, + ble_cls_last }; -enum ble_command_ids -{ - ble_cmd_system_reset_id=0, - ble_cmd_system_hello_id=1, - ble_cmd_system_address_get_id=2, - ble_cmd_system_reg_write_id=3, - ble_cmd_system_reg_read_id=4, - ble_cmd_system_get_counters_id=5, - ble_cmd_system_get_connections_id=6, - ble_cmd_system_read_memory_id=7, - ble_cmd_system_get_info_id=8, - ble_cmd_system_endpoint_tx_id=9, - ble_cmd_system_whitelist_append_id=10, - ble_cmd_system_whitelist_remove_id=11, - ble_cmd_system_whitelist_clear_id=12, - ble_cmd_system_endpoint_rx_id=13, - ble_cmd_system_endpoint_set_watermarks_id=14, - ble_cmd_flash_ps_defrag_id=0, - ble_cmd_flash_ps_dump_id=1, - ble_cmd_flash_ps_erase_all_id=2, - ble_cmd_flash_ps_save_id=3, - ble_cmd_flash_ps_load_id=4, - ble_cmd_flash_ps_erase_id=5, - ble_cmd_flash_erase_page_id=6, - ble_cmd_flash_write_words_id=7, - ble_cmd_attributes_write_id=0, - ble_cmd_attributes_read_id=1, - ble_cmd_attributes_read_type_id=2, - ble_cmd_attributes_user_read_response_id=3, - ble_cmd_attributes_user_write_response_id=4, - ble_cmd_connection_disconnect_id=0, - ble_cmd_connection_get_rssi_id=1, - ble_cmd_connection_update_id=2, - ble_cmd_connection_version_update_id=3, - ble_cmd_connection_channel_map_get_id=4, - ble_cmd_connection_channel_map_set_id=5, - ble_cmd_connection_features_get_id=6, - ble_cmd_connection_get_status_id=7, - ble_cmd_connection_raw_tx_id=8, - ble_cmd_attclient_find_by_type_value_id=0, - ble_cmd_attclient_read_by_group_type_id=1, - ble_cmd_attclient_read_by_type_id=2, - ble_cmd_attclient_find_information_id=3, - ble_cmd_attclient_read_by_handle_id=4, - ble_cmd_attclient_attribute_write_id=5, - ble_cmd_attclient_write_command_id=6, - ble_cmd_attclient_indicate_confirm_id=7, - ble_cmd_attclient_read_long_id=8, - ble_cmd_attclient_prepare_write_id=9, - ble_cmd_attclient_execute_write_id=10, - ble_cmd_attclient_read_multiple_id=11, - ble_cmd_sm_encrypt_start_id=0, - ble_cmd_sm_set_bondable_mode_id=1, - ble_cmd_sm_delete_bonding_id=2, - ble_cmd_sm_set_parameters_id=3, - ble_cmd_sm_passkey_entry_id=4, - ble_cmd_sm_get_bonds_id=5, - ble_cmd_sm_set_oob_data_id=6, - ble_cmd_gap_set_privacy_flags_id=0, - ble_cmd_gap_set_mode_id=1, - ble_cmd_gap_discover_id=2, - ble_cmd_gap_connect_direct_id=3, - ble_cmd_gap_end_procedure_id=4, - ble_cmd_gap_connect_selective_id=5, - ble_cmd_gap_set_filtering_id=6, - ble_cmd_gap_set_scan_parameters_id=7, - ble_cmd_gap_set_adv_parameters_id=8, - ble_cmd_gap_set_adv_data_id=9, - ble_cmd_gap_set_directed_connectable_mode_id=10, - ble_cmd_hardware_io_port_config_irq_id=0, - ble_cmd_hardware_set_soft_timer_id=1, - ble_cmd_hardware_adc_read_id=2, - ble_cmd_hardware_io_port_config_direction_id=3, - ble_cmd_hardware_io_port_config_function_id=4, - ble_cmd_hardware_io_port_config_pull_id=5, - ble_cmd_hardware_io_port_write_id=6, - ble_cmd_hardware_io_port_read_id=7, - ble_cmd_hardware_spi_config_id=8, - ble_cmd_hardware_spi_transfer_id=9, - ble_cmd_hardware_i2c_read_id=10, - ble_cmd_hardware_i2c_write_id=11, - ble_cmd_hardware_set_txpower_id=12, - ble_cmd_hardware_timer_comparator_id=13, - ble_cmd_test_phy_tx_id=0, - ble_cmd_test_phy_rx_id=1, - ble_cmd_test_phy_end_id=2, - ble_cmd_test_phy_reset_id=3, - ble_cmd_test_get_channel_map_id=4, - ble_cmd_test_debug_id=5, - ble_cmd_test_channel_mode_id=6, - ble_cmd_dfu_reset_id=0, - ble_cmd_dfu_flash_set_address_id=1, - ble_cmd_dfu_flash_upload_id=2, - ble_cmd_dfu_flash_upload_finish_id=3 +enum ble_command_ids { + ble_cmd_system_reset_id = 0, + ble_cmd_system_hello_id = 1, + ble_cmd_system_address_get_id = 2, + ble_cmd_system_reg_write_id = 3, + ble_cmd_system_reg_read_id = 4, + ble_cmd_system_get_counters_id = 5, + ble_cmd_system_get_connections_id = 6, + ble_cmd_system_read_memory_id = 7, + ble_cmd_system_get_info_id = 8, + ble_cmd_system_endpoint_tx_id = 9, + ble_cmd_system_whitelist_append_id = 10, + ble_cmd_system_whitelist_remove_id = 11, + ble_cmd_system_whitelist_clear_id = 12, + ble_cmd_system_endpoint_rx_id = 13, + ble_cmd_system_endpoint_set_watermarks_id = 14, + ble_cmd_flash_ps_defrag_id = 0, + ble_cmd_flash_ps_dump_id = 1, + ble_cmd_flash_ps_erase_all_id = 2, + ble_cmd_flash_ps_save_id = 3, + ble_cmd_flash_ps_load_id = 4, + ble_cmd_flash_ps_erase_id = 5, + ble_cmd_flash_erase_page_id = 6, + ble_cmd_flash_write_words_id = 7, + ble_cmd_attributes_write_id = 0, + ble_cmd_attributes_read_id = 1, + ble_cmd_attributes_read_type_id = 2, + ble_cmd_attributes_user_read_response_id = 3, + ble_cmd_attributes_user_write_response_id = 4, + ble_cmd_connection_disconnect_id = 0, + ble_cmd_connection_get_rssi_id = 1, + ble_cmd_connection_update_id = 2, + ble_cmd_connection_version_update_id = 3, + ble_cmd_connection_channel_map_get_id = 4, + ble_cmd_connection_channel_map_set_id = 5, + ble_cmd_connection_features_get_id = 6, + ble_cmd_connection_get_status_id = 7, + ble_cmd_connection_raw_tx_id = 8, + ble_cmd_attclient_find_by_type_value_id = 0, + ble_cmd_attclient_read_by_group_type_id = 1, + ble_cmd_attclient_read_by_type_id = 2, + ble_cmd_attclient_find_information_id = 3, + ble_cmd_attclient_read_by_handle_id = 4, + ble_cmd_attclient_attribute_write_id = 5, + ble_cmd_attclient_write_command_id = 6, + ble_cmd_attclient_indicate_confirm_id = 7, + ble_cmd_attclient_read_long_id = 8, + ble_cmd_attclient_prepare_write_id = 9, + ble_cmd_attclient_execute_write_id = 10, + ble_cmd_attclient_read_multiple_id = 11, + ble_cmd_sm_encrypt_start_id = 0, + ble_cmd_sm_set_bondable_mode_id = 1, + ble_cmd_sm_delete_bonding_id = 2, + ble_cmd_sm_set_parameters_id = 3, + ble_cmd_sm_passkey_entry_id = 4, + ble_cmd_sm_get_bonds_id = 5, + ble_cmd_sm_set_oob_data_id = 6, + ble_cmd_gap_set_privacy_flags_id = 0, + ble_cmd_gap_set_mode_id = 1, + ble_cmd_gap_discover_id = 2, + ble_cmd_gap_connect_direct_id = 3, + ble_cmd_gap_end_procedure_id = 4, + ble_cmd_gap_connect_selective_id = 5, + ble_cmd_gap_set_filtering_id = 6, + ble_cmd_gap_set_scan_parameters_id = 7, + ble_cmd_gap_set_adv_parameters_id = 8, + ble_cmd_gap_set_adv_data_id = 9, + ble_cmd_gap_set_directed_connectable_mode_id = 10, + ble_cmd_hardware_io_port_config_irq_id = 0, + ble_cmd_hardware_set_soft_timer_id = 1, + ble_cmd_hardware_adc_read_id = 2, + ble_cmd_hardware_io_port_config_direction_id = 3, + ble_cmd_hardware_io_port_config_function_id = 4, + ble_cmd_hardware_io_port_config_pull_id = 5, + ble_cmd_hardware_io_port_write_id = 6, + ble_cmd_hardware_io_port_read_id = 7, + ble_cmd_hardware_spi_config_id = 8, + ble_cmd_hardware_spi_transfer_id = 9, + ble_cmd_hardware_i2c_read_id = 10, + ble_cmd_hardware_i2c_write_id = 11, + ble_cmd_hardware_set_txpower_id = 12, + ble_cmd_hardware_timer_comparator_id = 13, + ble_cmd_test_phy_tx_id = 0, + ble_cmd_test_phy_rx_id = 1, + ble_cmd_test_phy_end_id = 2, + ble_cmd_test_phy_reset_id = 3, + ble_cmd_test_get_channel_map_id = 4, + ble_cmd_test_debug_id = 5, + ble_cmd_test_channel_mode_id = 6, + ble_cmd_dfu_reset_id = 0, + ble_cmd_dfu_flash_set_address_id = 1, + ble_cmd_dfu_flash_upload_id = 2, + ble_cmd_dfu_flash_upload_finish_id = 3 }; -enum ble_response_ids -{ - ble_rsp_system_reset_id=0, - ble_rsp_system_hello_id=1, - ble_rsp_system_address_get_id=2, - ble_rsp_system_reg_write_id=3, - ble_rsp_system_reg_read_id=4, - ble_rsp_system_get_counters_id=5, - ble_rsp_system_get_connections_id=6, - ble_rsp_system_read_memory_id=7, - ble_rsp_system_get_info_id=8, - ble_rsp_system_endpoint_tx_id=9, - ble_rsp_system_whitelist_append_id=10, - ble_rsp_system_whitelist_remove_id=11, - ble_rsp_system_whitelist_clear_id=12, - ble_rsp_system_endpoint_rx_id=13, - ble_rsp_system_endpoint_set_watermarks_id=14, - ble_rsp_flash_ps_defrag_id=0, - ble_rsp_flash_ps_dump_id=1, - ble_rsp_flash_ps_erase_all_id=2, - ble_rsp_flash_ps_save_id=3, - ble_rsp_flash_ps_load_id=4, - ble_rsp_flash_ps_erase_id=5, - ble_rsp_flash_erase_page_id=6, - ble_rsp_flash_write_words_id=7, - ble_rsp_attributes_write_id=0, - ble_rsp_attributes_read_id=1, - ble_rsp_attributes_read_type_id=2, - ble_rsp_attributes_user_read_response_id=3, - ble_rsp_attributes_user_write_response_id=4, - ble_rsp_connection_disconnect_id=0, - ble_rsp_connection_get_rssi_id=1, - ble_rsp_connection_update_id=2, - ble_rsp_connection_version_update_id=3, - ble_rsp_connection_channel_map_get_id=4, - ble_rsp_connection_channel_map_set_id=5, - ble_rsp_connection_features_get_id=6, - ble_rsp_connection_get_status_id=7, - ble_rsp_connection_raw_tx_id=8, - ble_rsp_attclient_find_by_type_value_id=0, - ble_rsp_attclient_read_by_group_type_id=1, - ble_rsp_attclient_read_by_type_id=2, - ble_rsp_attclient_find_information_id=3, - ble_rsp_attclient_read_by_handle_id=4, - ble_rsp_attclient_attribute_write_id=5, - ble_rsp_attclient_write_command_id=6, - ble_rsp_attclient_indicate_confirm_id=7, - ble_rsp_attclient_read_long_id=8, - ble_rsp_attclient_prepare_write_id=9, - ble_rsp_attclient_execute_write_id=10, - ble_rsp_attclient_read_multiple_id=11, - ble_rsp_sm_encrypt_start_id=0, - ble_rsp_sm_set_bondable_mode_id=1, - ble_rsp_sm_delete_bonding_id=2, - ble_rsp_sm_set_parameters_id=3, - ble_rsp_sm_passkey_entry_id=4, - ble_rsp_sm_get_bonds_id=5, - ble_rsp_sm_set_oob_data_id=6, - ble_rsp_gap_set_privacy_flags_id=0, - ble_rsp_gap_set_mode_id=1, - ble_rsp_gap_discover_id=2, - ble_rsp_gap_connect_direct_id=3, - ble_rsp_gap_end_procedure_id=4, - ble_rsp_gap_connect_selective_id=5, - ble_rsp_gap_set_filtering_id=6, - ble_rsp_gap_set_scan_parameters_id=7, - ble_rsp_gap_set_adv_parameters_id=8, - ble_rsp_gap_set_adv_data_id=9, - ble_rsp_gap_set_directed_connectable_mode_id=10, - ble_rsp_hardware_io_port_config_irq_id=0, - ble_rsp_hardware_set_soft_timer_id=1, - ble_rsp_hardware_adc_read_id=2, - ble_rsp_hardware_io_port_config_direction_id=3, - ble_rsp_hardware_io_port_config_function_id=4, - ble_rsp_hardware_io_port_config_pull_id=5, - ble_rsp_hardware_io_port_write_id=6, - ble_rsp_hardware_io_port_read_id=7, - ble_rsp_hardware_spi_config_id=8, - ble_rsp_hardware_spi_transfer_id=9, - ble_rsp_hardware_i2c_read_id=10, - ble_rsp_hardware_i2c_write_id=11, - ble_rsp_hardware_set_txpower_id=12, - ble_rsp_hardware_timer_comparator_id=13, - ble_rsp_test_phy_tx_id=0, - ble_rsp_test_phy_rx_id=1, - ble_rsp_test_phy_end_id=2, - ble_rsp_test_phy_reset_id=3, - ble_rsp_test_get_channel_map_id=4, - ble_rsp_test_debug_id=5, - ble_rsp_test_channel_mode_id=6, - ble_rsp_dfu_reset_id=0, - ble_rsp_dfu_flash_set_address_id=1, - ble_rsp_dfu_flash_upload_id=2, - ble_rsp_dfu_flash_upload_finish_id=3 +enum ble_response_ids { + ble_rsp_system_reset_id = 0, + ble_rsp_system_hello_id = 1, + ble_rsp_system_address_get_id = 2, + ble_rsp_system_reg_write_id = 3, + ble_rsp_system_reg_read_id = 4, + ble_rsp_system_get_counters_id = 5, + ble_rsp_system_get_connections_id = 6, + ble_rsp_system_read_memory_id = 7, + ble_rsp_system_get_info_id = 8, + ble_rsp_system_endpoint_tx_id = 9, + ble_rsp_system_whitelist_append_id = 10, + ble_rsp_system_whitelist_remove_id = 11, + ble_rsp_system_whitelist_clear_id = 12, + ble_rsp_system_endpoint_rx_id = 13, + ble_rsp_system_endpoint_set_watermarks_id = 14, + ble_rsp_flash_ps_defrag_id = 0, + ble_rsp_flash_ps_dump_id = 1, + ble_rsp_flash_ps_erase_all_id = 2, + ble_rsp_flash_ps_save_id = 3, + ble_rsp_flash_ps_load_id = 4, + ble_rsp_flash_ps_erase_id = 5, + ble_rsp_flash_erase_page_id = 6, + ble_rsp_flash_write_words_id = 7, + ble_rsp_attributes_write_id = 0, + ble_rsp_attributes_read_id = 1, + ble_rsp_attributes_read_type_id = 2, + ble_rsp_attributes_user_read_response_id = 3, + ble_rsp_attributes_user_write_response_id = 4, + ble_rsp_connection_disconnect_id = 0, + ble_rsp_connection_get_rssi_id = 1, + ble_rsp_connection_update_id = 2, + ble_rsp_connection_version_update_id = 3, + ble_rsp_connection_channel_map_get_id = 4, + ble_rsp_connection_channel_map_set_id = 5, + ble_rsp_connection_features_get_id = 6, + ble_rsp_connection_get_status_id = 7, + ble_rsp_connection_raw_tx_id = 8, + ble_rsp_attclient_find_by_type_value_id = 0, + ble_rsp_attclient_read_by_group_type_id = 1, + ble_rsp_attclient_read_by_type_id = 2, + ble_rsp_attclient_find_information_id = 3, + ble_rsp_attclient_read_by_handle_id = 4, + ble_rsp_attclient_attribute_write_id = 5, + ble_rsp_attclient_write_command_id = 6, + ble_rsp_attclient_indicate_confirm_id = 7, + ble_rsp_attclient_read_long_id = 8, + ble_rsp_attclient_prepare_write_id = 9, + ble_rsp_attclient_execute_write_id = 10, + ble_rsp_attclient_read_multiple_id = 11, + ble_rsp_sm_encrypt_start_id = 0, + ble_rsp_sm_set_bondable_mode_id = 1, + ble_rsp_sm_delete_bonding_id = 2, + ble_rsp_sm_set_parameters_id = 3, + ble_rsp_sm_passkey_entry_id = 4, + ble_rsp_sm_get_bonds_id = 5, + ble_rsp_sm_set_oob_data_id = 6, + ble_rsp_gap_set_privacy_flags_id = 0, + ble_rsp_gap_set_mode_id = 1, + ble_rsp_gap_discover_id = 2, + ble_rsp_gap_connect_direct_id = 3, + ble_rsp_gap_end_procedure_id = 4, + ble_rsp_gap_connect_selective_id = 5, + ble_rsp_gap_set_filtering_id = 6, + ble_rsp_gap_set_scan_parameters_id = 7, + ble_rsp_gap_set_adv_parameters_id = 8, + ble_rsp_gap_set_adv_data_id = 9, + ble_rsp_gap_set_directed_connectable_mode_id = 10, + ble_rsp_hardware_io_port_config_irq_id = 0, + ble_rsp_hardware_set_soft_timer_id = 1, + ble_rsp_hardware_adc_read_id = 2, + ble_rsp_hardware_io_port_config_direction_id = 3, + ble_rsp_hardware_io_port_config_function_id = 4, + ble_rsp_hardware_io_port_config_pull_id = 5, + ble_rsp_hardware_io_port_write_id = 6, + ble_rsp_hardware_io_port_read_id = 7, + ble_rsp_hardware_spi_config_id = 8, + ble_rsp_hardware_spi_transfer_id = 9, + ble_rsp_hardware_i2c_read_id = 10, + ble_rsp_hardware_i2c_write_id = 11, + ble_rsp_hardware_set_txpower_id = 12, + ble_rsp_hardware_timer_comparator_id = 13, + ble_rsp_test_phy_tx_id = 0, + ble_rsp_test_phy_rx_id = 1, + ble_rsp_test_phy_end_id = 2, + ble_rsp_test_phy_reset_id = 3, + ble_rsp_test_get_channel_map_id = 4, + ble_rsp_test_debug_id = 5, + ble_rsp_test_channel_mode_id = 6, + ble_rsp_dfu_reset_id = 0, + ble_rsp_dfu_flash_set_address_id = 1, + ble_rsp_dfu_flash_upload_id = 2, + ble_rsp_dfu_flash_upload_finish_id = 3 }; -enum ble_event_ids -{ - ble_evt_system_boot_id=0, - ble_evt_system_debug_id=1, - ble_evt_system_endpoint_watermark_rx_id=2, - ble_evt_system_endpoint_watermark_tx_id=3, - ble_evt_system_script_failure_id=4, - ble_evt_system_no_license_key_id=5, - ble_evt_system_protocol_error_id=6, - ble_evt_flash_ps_key_id=0, - ble_evt_attributes_value_id=0, - ble_evt_attributes_user_read_request_id=1, - ble_evt_attributes_status_id=2, - ble_evt_connection_status_id=0, - ble_evt_connection_version_ind_id=1, - ble_evt_connection_feature_ind_id=2, - ble_evt_connection_raw_rx_id=3, - ble_evt_connection_disconnected_id=4, - ble_evt_attclient_indicated_id=0, - ble_evt_attclient_procedure_completed_id=1, - ble_evt_attclient_group_found_id=2, - ble_evt_attclient_attribute_found_id=3, - ble_evt_attclient_find_information_found_id=4, - ble_evt_attclient_attribute_value_id=5, - ble_evt_attclient_read_multiple_response_id=6, - ble_evt_sm_smp_data_id=0, - ble_evt_sm_bonding_fail_id=1, - ble_evt_sm_passkey_display_id=2, - ble_evt_sm_passkey_request_id=3, - ble_evt_sm_bond_status_id=4, - ble_evt_gap_scan_response_id=0, - ble_evt_gap_mode_changed_id=1, - ble_evt_hardware_io_port_status_id=0, - ble_evt_hardware_soft_timer_id=1, - ble_evt_hardware_adc_result_id=2, - ble_evt_dfu_boot_id=0 +enum ble_event_ids { + ble_evt_system_boot_id = 0, + ble_evt_system_debug_id = 1, + ble_evt_system_endpoint_watermark_rx_id = 2, + ble_evt_system_endpoint_watermark_tx_id = 3, + ble_evt_system_script_failure_id = 4, + ble_evt_system_no_license_key_id = 5, + ble_evt_system_protocol_error_id = 6, + ble_evt_flash_ps_key_id = 0, + ble_evt_attributes_value_id = 0, + ble_evt_attributes_user_read_request_id = 1, + ble_evt_attributes_status_id = 2, + ble_evt_connection_status_id = 0, + ble_evt_connection_version_ind_id = 1, + ble_evt_connection_feature_ind_id = 2, + ble_evt_connection_raw_rx_id = 3, + ble_evt_connection_disconnected_id = 4, + ble_evt_attclient_indicated_id = 0, + ble_evt_attclient_procedure_completed_id = 1, + ble_evt_attclient_group_found_id = 2, + ble_evt_attclient_attribute_found_id = 3, + ble_evt_attclient_find_information_found_id = 4, + ble_evt_attclient_attribute_value_id = 5, + ble_evt_attclient_read_multiple_response_id = 6, + ble_evt_sm_smp_data_id = 0, + ble_evt_sm_bonding_fail_id = 1, + ble_evt_sm_passkey_display_id = 2, + ble_evt_sm_passkey_request_id = 3, + ble_evt_sm_bond_status_id = 4, + ble_evt_gap_scan_response_id = 0, + ble_evt_gap_mode_changed_id = 1, + ble_evt_hardware_io_port_status_id = 0, + ble_evt_hardware_soft_timer_id = 1, + ble_evt_hardware_adc_result_id = 2, + ble_evt_dfu_boot_id = 0 }; -enum ble_msg_idx -{ - ble_cmd_system_reset_idx =0, - ble_cmd_system_hello_idx =1, - ble_cmd_system_address_get_idx =2, - ble_cmd_system_reg_write_idx =3, - ble_cmd_system_reg_read_idx =4, - ble_cmd_system_get_counters_idx =5, - ble_cmd_system_get_connections_idx =6, - ble_cmd_system_read_memory_idx =7, - ble_cmd_system_get_info_idx =8, - ble_cmd_system_endpoint_tx_idx =9, - ble_cmd_system_whitelist_append_idx =10, - ble_cmd_system_whitelist_remove_idx =11, - ble_cmd_system_whitelist_clear_idx =12, - ble_cmd_system_endpoint_rx_idx =13, - ble_cmd_system_endpoint_set_watermarks_idx =14, - ble_cmd_flash_ps_defrag_idx =15, - ble_cmd_flash_ps_dump_idx =16, - ble_cmd_flash_ps_erase_all_idx =17, - ble_cmd_flash_ps_save_idx =18, - ble_cmd_flash_ps_load_idx =19, - ble_cmd_flash_ps_erase_idx =20, - ble_cmd_flash_erase_page_idx =21, - ble_cmd_flash_write_words_idx =22, - ble_cmd_attributes_write_idx =23, - ble_cmd_attributes_read_idx =24, - ble_cmd_attributes_read_type_idx =25, - ble_cmd_attributes_user_read_response_idx =26, - ble_cmd_attributes_user_write_response_idx =27, - ble_cmd_connection_disconnect_idx =28, - ble_cmd_connection_get_rssi_idx =29, - ble_cmd_connection_update_idx =30, - ble_cmd_connection_version_update_idx =31, - ble_cmd_connection_channel_map_get_idx =32, - ble_cmd_connection_channel_map_set_idx =33, - ble_cmd_connection_features_get_idx =34, - ble_cmd_connection_get_status_idx =35, - ble_cmd_connection_raw_tx_idx =36, - ble_cmd_attclient_find_by_type_value_idx =37, - ble_cmd_attclient_read_by_group_type_idx =38, - ble_cmd_attclient_read_by_type_idx =39, - ble_cmd_attclient_find_information_idx =40, - ble_cmd_attclient_read_by_handle_idx =41, - ble_cmd_attclient_attribute_write_idx =42, - ble_cmd_attclient_write_command_idx =43, - ble_cmd_attclient_indicate_confirm_idx =44, - ble_cmd_attclient_read_long_idx =45, - ble_cmd_attclient_prepare_write_idx =46, - ble_cmd_attclient_execute_write_idx =47, - ble_cmd_attclient_read_multiple_idx =48, - ble_cmd_sm_encrypt_start_idx =49, - ble_cmd_sm_set_bondable_mode_idx =50, - ble_cmd_sm_delete_bonding_idx =51, - ble_cmd_sm_set_parameters_idx =52, - ble_cmd_sm_passkey_entry_idx =53, - ble_cmd_sm_get_bonds_idx =54, - ble_cmd_sm_set_oob_data_idx =55, - ble_cmd_gap_set_privacy_flags_idx =56, - ble_cmd_gap_set_mode_idx =57, - ble_cmd_gap_discover_idx =58, - ble_cmd_gap_connect_direct_idx =59, - ble_cmd_gap_end_procedure_idx =60, - ble_cmd_gap_connect_selective_idx =61, - ble_cmd_gap_set_filtering_idx =62, - ble_cmd_gap_set_scan_parameters_idx =63, - ble_cmd_gap_set_adv_parameters_idx =64, - ble_cmd_gap_set_adv_data_idx =65, - ble_cmd_gap_set_directed_connectable_mode_idx =66, - ble_cmd_hardware_io_port_config_irq_idx =67, - ble_cmd_hardware_set_soft_timer_idx =68, - ble_cmd_hardware_adc_read_idx =69, - ble_cmd_hardware_io_port_config_direction_idx =70, - ble_cmd_hardware_io_port_config_function_idx =71, - ble_cmd_hardware_io_port_config_pull_idx =72, - ble_cmd_hardware_io_port_write_idx =73, - ble_cmd_hardware_io_port_read_idx =74, - ble_cmd_hardware_spi_config_idx =75, - ble_cmd_hardware_spi_transfer_idx =76, - ble_cmd_hardware_i2c_read_idx =77, - ble_cmd_hardware_i2c_write_idx =78, - ble_cmd_hardware_set_txpower_idx =79, - ble_cmd_hardware_timer_comparator_idx =80, - ble_cmd_test_phy_tx_idx =81, - ble_cmd_test_phy_rx_idx =82, - ble_cmd_test_phy_end_idx =83, - ble_cmd_test_phy_reset_idx =84, - ble_cmd_test_get_channel_map_idx =85, - ble_cmd_test_debug_idx =86, - ble_cmd_test_channel_mode_idx =87, - ble_cmd_dfu_reset_idx =88, - ble_cmd_dfu_flash_set_address_idx =89, - ble_cmd_dfu_flash_upload_idx =90, - ble_cmd_dfu_flash_upload_finish_idx =91, - ble_rsp_system_reset_idx =92, - ble_rsp_system_hello_idx =93, - ble_rsp_system_address_get_idx =94, - ble_rsp_system_reg_write_idx =95, - ble_rsp_system_reg_read_idx =96, - ble_rsp_system_get_counters_idx =97, - ble_rsp_system_get_connections_idx =98, - ble_rsp_system_read_memory_idx =99, - ble_rsp_system_get_info_idx =100, - ble_rsp_system_endpoint_tx_idx =101, - ble_rsp_system_whitelist_append_idx =102, - ble_rsp_system_whitelist_remove_idx =103, - ble_rsp_system_whitelist_clear_idx =104, - ble_rsp_system_endpoint_rx_idx =105, - ble_rsp_system_endpoint_set_watermarks_idx =106, - ble_rsp_flash_ps_defrag_idx =107, - ble_rsp_flash_ps_dump_idx =108, - ble_rsp_flash_ps_erase_all_idx =109, - ble_rsp_flash_ps_save_idx =110, - ble_rsp_flash_ps_load_idx =111, - ble_rsp_flash_ps_erase_idx =112, - ble_rsp_flash_erase_page_idx =113, - ble_rsp_flash_write_words_idx =114, - ble_rsp_attributes_write_idx =115, - ble_rsp_attributes_read_idx =116, - ble_rsp_attributes_read_type_idx =117, - ble_rsp_attributes_user_read_response_idx =118, - ble_rsp_attributes_user_write_response_idx =119, - ble_rsp_connection_disconnect_idx =120, - ble_rsp_connection_get_rssi_idx =121, - ble_rsp_connection_update_idx =122, - ble_rsp_connection_version_update_idx =123, - ble_rsp_connection_channel_map_get_idx =124, - ble_rsp_connection_channel_map_set_idx =125, - ble_rsp_connection_features_get_idx =126, - ble_rsp_connection_get_status_idx =127, - ble_rsp_connection_raw_tx_idx =128, - ble_rsp_attclient_find_by_type_value_idx =129, - ble_rsp_attclient_read_by_group_type_idx =130, - ble_rsp_attclient_read_by_type_idx =131, - ble_rsp_attclient_find_information_idx =132, - ble_rsp_attclient_read_by_handle_idx =133, - ble_rsp_attclient_attribute_write_idx =134, - ble_rsp_attclient_write_command_idx =135, - ble_rsp_attclient_indicate_confirm_idx =136, - ble_rsp_attclient_read_long_idx =137, - ble_rsp_attclient_prepare_write_idx =138, - ble_rsp_attclient_execute_write_idx =139, - ble_rsp_attclient_read_multiple_idx =140, - ble_rsp_sm_encrypt_start_idx =141, - ble_rsp_sm_set_bondable_mode_idx =142, - ble_rsp_sm_delete_bonding_idx =143, - ble_rsp_sm_set_parameters_idx =144, - ble_rsp_sm_passkey_entry_idx =145, - ble_rsp_sm_get_bonds_idx =146, - ble_rsp_sm_set_oob_data_idx =147, - ble_rsp_gap_set_privacy_flags_idx =148, - ble_rsp_gap_set_mode_idx =149, - ble_rsp_gap_discover_idx =150, - ble_rsp_gap_connect_direct_idx =151, - ble_rsp_gap_end_procedure_idx =152, - ble_rsp_gap_connect_selective_idx =153, - ble_rsp_gap_set_filtering_idx =154, - ble_rsp_gap_set_scan_parameters_idx =155, - ble_rsp_gap_set_adv_parameters_idx =156, - ble_rsp_gap_set_adv_data_idx =157, - ble_rsp_gap_set_directed_connectable_mode_idx =158, - ble_rsp_hardware_io_port_config_irq_idx =159, - ble_rsp_hardware_set_soft_timer_idx =160, - ble_rsp_hardware_adc_read_idx =161, - ble_rsp_hardware_io_port_config_direction_idx =162, - ble_rsp_hardware_io_port_config_function_idx =163, - ble_rsp_hardware_io_port_config_pull_idx =164, - ble_rsp_hardware_io_port_write_idx =165, - ble_rsp_hardware_io_port_read_idx =166, - ble_rsp_hardware_spi_config_idx =167, - ble_rsp_hardware_spi_transfer_idx =168, - ble_rsp_hardware_i2c_read_idx =169, - ble_rsp_hardware_i2c_write_idx =170, - ble_rsp_hardware_set_txpower_idx =171, - ble_rsp_hardware_timer_comparator_idx =172, - ble_rsp_test_phy_tx_idx =173, - ble_rsp_test_phy_rx_idx =174, - ble_rsp_test_phy_end_idx =175, - ble_rsp_test_phy_reset_idx =176, - ble_rsp_test_get_channel_map_idx =177, - ble_rsp_test_debug_idx =178, - ble_rsp_test_channel_mode_idx =179, - ble_rsp_dfu_reset_idx =180, - ble_rsp_dfu_flash_set_address_idx =181, - ble_rsp_dfu_flash_upload_idx =182, - ble_rsp_dfu_flash_upload_finish_idx =183, - ble_evt_system_boot_idx =184, - ble_evt_system_debug_idx =185, - ble_evt_system_endpoint_watermark_rx_idx =186, - ble_evt_system_endpoint_watermark_tx_idx =187, - ble_evt_system_script_failure_idx =188, - ble_evt_system_no_license_key_idx =189, - ble_evt_system_protocol_error_idx =190, - ble_evt_flash_ps_key_idx =191, - ble_evt_attributes_value_idx =192, - ble_evt_attributes_user_read_request_idx =193, - ble_evt_attributes_status_idx =194, - ble_evt_connection_status_idx =195, - ble_evt_connection_version_ind_idx =196, - ble_evt_connection_feature_ind_idx =197, - ble_evt_connection_raw_rx_idx =198, - ble_evt_connection_disconnected_idx =199, - ble_evt_attclient_indicated_idx =200, - ble_evt_attclient_procedure_completed_idx =201, - ble_evt_attclient_group_found_idx =202, - ble_evt_attclient_attribute_found_idx =203, - ble_evt_attclient_find_information_found_idx =204, - ble_evt_attclient_attribute_value_idx =205, - ble_evt_attclient_read_multiple_response_idx =206, - ble_evt_sm_smp_data_idx =207, - ble_evt_sm_bonding_fail_idx =208, - ble_evt_sm_passkey_display_idx =209, - ble_evt_sm_passkey_request_idx =210, - ble_evt_sm_bond_status_idx =211, - ble_evt_gap_scan_response_idx =212, - ble_evt_gap_mode_changed_idx =213, - ble_evt_hardware_io_port_status_idx =214, - ble_evt_hardware_soft_timer_idx =215, - ble_evt_hardware_adc_result_idx =216, - ble_evt_dfu_boot_idx =217 +enum ble_msg_idx { + ble_cmd_system_reset_idx = 0, + ble_cmd_system_hello_idx = 1, + ble_cmd_system_address_get_idx = 2, + ble_cmd_system_reg_write_idx = 3, + ble_cmd_system_reg_read_idx = 4, + ble_cmd_system_get_counters_idx = 5, + ble_cmd_system_get_connections_idx = 6, + ble_cmd_system_read_memory_idx = 7, + ble_cmd_system_get_info_idx = 8, + ble_cmd_system_endpoint_tx_idx = 9, + ble_cmd_system_whitelist_append_idx = 10, + ble_cmd_system_whitelist_remove_idx = 11, + ble_cmd_system_whitelist_clear_idx = 12, + ble_cmd_system_endpoint_rx_idx = 13, + ble_cmd_system_endpoint_set_watermarks_idx = 14, + ble_cmd_flash_ps_defrag_idx = 15, + ble_cmd_flash_ps_dump_idx = 16, + ble_cmd_flash_ps_erase_all_idx = 17, + ble_cmd_flash_ps_save_idx = 18, + ble_cmd_flash_ps_load_idx = 19, + ble_cmd_flash_ps_erase_idx = 20, + ble_cmd_flash_erase_page_idx = 21, + ble_cmd_flash_write_words_idx = 22, + ble_cmd_attributes_write_idx = 23, + ble_cmd_attributes_read_idx = 24, + ble_cmd_attributes_read_type_idx = 25, + ble_cmd_attributes_user_read_response_idx = 26, + ble_cmd_attributes_user_write_response_idx = 27, + ble_cmd_connection_disconnect_idx = 28, + ble_cmd_connection_get_rssi_idx = 29, + ble_cmd_connection_update_idx = 30, + ble_cmd_connection_version_update_idx = 31, + ble_cmd_connection_channel_map_get_idx = 32, + ble_cmd_connection_channel_map_set_idx = 33, + ble_cmd_connection_features_get_idx = 34, + ble_cmd_connection_get_status_idx = 35, + ble_cmd_connection_raw_tx_idx = 36, + ble_cmd_attclient_find_by_type_value_idx = 37, + ble_cmd_attclient_read_by_group_type_idx = 38, + ble_cmd_attclient_read_by_type_idx = 39, + ble_cmd_attclient_find_information_idx = 40, + ble_cmd_attclient_read_by_handle_idx = 41, + ble_cmd_attclient_attribute_write_idx = 42, + ble_cmd_attclient_write_command_idx = 43, + ble_cmd_attclient_indicate_confirm_idx = 44, + ble_cmd_attclient_read_long_idx = 45, + ble_cmd_attclient_prepare_write_idx = 46, + ble_cmd_attclient_execute_write_idx = 47, + ble_cmd_attclient_read_multiple_idx = 48, + ble_cmd_sm_encrypt_start_idx = 49, + ble_cmd_sm_set_bondable_mode_idx = 50, + ble_cmd_sm_delete_bonding_idx = 51, + ble_cmd_sm_set_parameters_idx = 52, + ble_cmd_sm_passkey_entry_idx = 53, + ble_cmd_sm_get_bonds_idx = 54, + ble_cmd_sm_set_oob_data_idx = 55, + ble_cmd_gap_set_privacy_flags_idx = 56, + ble_cmd_gap_set_mode_idx = 57, + ble_cmd_gap_discover_idx = 58, + ble_cmd_gap_connect_direct_idx = 59, + ble_cmd_gap_end_procedure_idx = 60, + ble_cmd_gap_connect_selective_idx = 61, + ble_cmd_gap_set_filtering_idx = 62, + ble_cmd_gap_set_scan_parameters_idx = 63, + ble_cmd_gap_set_adv_parameters_idx = 64, + ble_cmd_gap_set_adv_data_idx = 65, + ble_cmd_gap_set_directed_connectable_mode_idx = 66, + ble_cmd_hardware_io_port_config_irq_idx = 67, + ble_cmd_hardware_set_soft_timer_idx = 68, + ble_cmd_hardware_adc_read_idx = 69, + ble_cmd_hardware_io_port_config_direction_idx = 70, + ble_cmd_hardware_io_port_config_function_idx = 71, + ble_cmd_hardware_io_port_config_pull_idx = 72, + ble_cmd_hardware_io_port_write_idx = 73, + ble_cmd_hardware_io_port_read_idx = 74, + ble_cmd_hardware_spi_config_idx = 75, + ble_cmd_hardware_spi_transfer_idx = 76, + ble_cmd_hardware_i2c_read_idx = 77, + ble_cmd_hardware_i2c_write_idx = 78, + ble_cmd_hardware_set_txpower_idx = 79, + ble_cmd_hardware_timer_comparator_idx = 80, + ble_cmd_test_phy_tx_idx = 81, + ble_cmd_test_phy_rx_idx = 82, + ble_cmd_test_phy_end_idx = 83, + ble_cmd_test_phy_reset_idx = 84, + ble_cmd_test_get_channel_map_idx = 85, + ble_cmd_test_debug_idx = 86, + ble_cmd_test_channel_mode_idx = 87, + ble_cmd_dfu_reset_idx = 88, + ble_cmd_dfu_flash_set_address_idx = 89, + ble_cmd_dfu_flash_upload_idx = 90, + ble_cmd_dfu_flash_upload_finish_idx = 91, + ble_rsp_system_reset_idx = 92, + ble_rsp_system_hello_idx = 93, + ble_rsp_system_address_get_idx = 94, + ble_rsp_system_reg_write_idx = 95, + ble_rsp_system_reg_read_idx = 96, + ble_rsp_system_get_counters_idx = 97, + ble_rsp_system_get_connections_idx = 98, + ble_rsp_system_read_memory_idx = 99, + ble_rsp_system_get_info_idx = 100, + ble_rsp_system_endpoint_tx_idx = 101, + ble_rsp_system_whitelist_append_idx = 102, + ble_rsp_system_whitelist_remove_idx = 103, + ble_rsp_system_whitelist_clear_idx = 104, + ble_rsp_system_endpoint_rx_idx = 105, + ble_rsp_system_endpoint_set_watermarks_idx = 106, + ble_rsp_flash_ps_defrag_idx = 107, + ble_rsp_flash_ps_dump_idx = 108, + ble_rsp_flash_ps_erase_all_idx = 109, + ble_rsp_flash_ps_save_idx = 110, + ble_rsp_flash_ps_load_idx = 111, + ble_rsp_flash_ps_erase_idx = 112, + ble_rsp_flash_erase_page_idx = 113, + ble_rsp_flash_write_words_idx = 114, + ble_rsp_attributes_write_idx = 115, + ble_rsp_attributes_read_idx = 116, + ble_rsp_attributes_read_type_idx = 117, + ble_rsp_attributes_user_read_response_idx = 118, + ble_rsp_attributes_user_write_response_idx = 119, + ble_rsp_connection_disconnect_idx = 120, + ble_rsp_connection_get_rssi_idx = 121, + ble_rsp_connection_update_idx = 122, + ble_rsp_connection_version_update_idx = 123, + ble_rsp_connection_channel_map_get_idx = 124, + ble_rsp_connection_channel_map_set_idx = 125, + ble_rsp_connection_features_get_idx = 126, + ble_rsp_connection_get_status_idx = 127, + ble_rsp_connection_raw_tx_idx = 128, + ble_rsp_attclient_find_by_type_value_idx = 129, + ble_rsp_attclient_read_by_group_type_idx = 130, + ble_rsp_attclient_read_by_type_idx = 131, + ble_rsp_attclient_find_information_idx = 132, + ble_rsp_attclient_read_by_handle_idx = 133, + ble_rsp_attclient_attribute_write_idx = 134, + ble_rsp_attclient_write_command_idx = 135, + ble_rsp_attclient_indicate_confirm_idx = 136, + ble_rsp_attclient_read_long_idx = 137, + ble_rsp_attclient_prepare_write_idx = 138, + ble_rsp_attclient_execute_write_idx = 139, + ble_rsp_attclient_read_multiple_idx = 140, + ble_rsp_sm_encrypt_start_idx = 141, + ble_rsp_sm_set_bondable_mode_idx = 142, + ble_rsp_sm_delete_bonding_idx = 143, + ble_rsp_sm_set_parameters_idx = 144, + ble_rsp_sm_passkey_entry_idx = 145, + ble_rsp_sm_get_bonds_idx = 146, + ble_rsp_sm_set_oob_data_idx = 147, + ble_rsp_gap_set_privacy_flags_idx = 148, + ble_rsp_gap_set_mode_idx = 149, + ble_rsp_gap_discover_idx = 150, + ble_rsp_gap_connect_direct_idx = 151, + ble_rsp_gap_end_procedure_idx = 152, + ble_rsp_gap_connect_selective_idx = 153, + ble_rsp_gap_set_filtering_idx = 154, + ble_rsp_gap_set_scan_parameters_idx = 155, + ble_rsp_gap_set_adv_parameters_idx = 156, + ble_rsp_gap_set_adv_data_idx = 157, + ble_rsp_gap_set_directed_connectable_mode_idx = 158, + ble_rsp_hardware_io_port_config_irq_idx = 159, + ble_rsp_hardware_set_soft_timer_idx = 160, + ble_rsp_hardware_adc_read_idx = 161, + ble_rsp_hardware_io_port_config_direction_idx = 162, + ble_rsp_hardware_io_port_config_function_idx = 163, + ble_rsp_hardware_io_port_config_pull_idx = 164, + ble_rsp_hardware_io_port_write_idx = 165, + ble_rsp_hardware_io_port_read_idx = 166, + ble_rsp_hardware_spi_config_idx = 167, + ble_rsp_hardware_spi_transfer_idx = 168, + ble_rsp_hardware_i2c_read_idx = 169, + ble_rsp_hardware_i2c_write_idx = 170, + ble_rsp_hardware_set_txpower_idx = 171, + ble_rsp_hardware_timer_comparator_idx = 172, + ble_rsp_test_phy_tx_idx = 173, + ble_rsp_test_phy_rx_idx = 174, + ble_rsp_test_phy_end_idx = 175, + ble_rsp_test_phy_reset_idx = 176, + ble_rsp_test_get_channel_map_idx = 177, + ble_rsp_test_debug_idx = 178, + ble_rsp_test_channel_mode_idx = 179, + ble_rsp_dfu_reset_idx = 180, + ble_rsp_dfu_flash_set_address_idx = 181, + ble_rsp_dfu_flash_upload_idx = 182, + ble_rsp_dfu_flash_upload_finish_idx = 183, + ble_evt_system_boot_idx = 184, + ble_evt_system_debug_idx = 185, + ble_evt_system_endpoint_watermark_rx_idx = 186, + ble_evt_system_endpoint_watermark_tx_idx = 187, + ble_evt_system_script_failure_idx = 188, + ble_evt_system_no_license_key_idx = 189, + ble_evt_system_protocol_error_idx = 190, + ble_evt_flash_ps_key_idx = 191, + ble_evt_attributes_value_idx = 192, + ble_evt_attributes_user_read_request_idx = 193, + ble_evt_attributes_status_idx = 194, + ble_evt_connection_status_idx = 195, + ble_evt_connection_version_ind_idx = 196, + ble_evt_connection_feature_ind_idx = 197, + ble_evt_connection_raw_rx_idx = 198, + ble_evt_connection_disconnected_idx = 199, + ble_evt_attclient_indicated_idx = 200, + ble_evt_attclient_procedure_completed_idx = 201, + ble_evt_attclient_group_found_idx = 202, + ble_evt_attclient_attribute_found_idx = 203, + ble_evt_attclient_find_information_found_idx = 204, + ble_evt_attclient_attribute_value_idx = 205, + ble_evt_attclient_read_multiple_response_idx = 206, + ble_evt_sm_smp_data_idx = 207, + ble_evt_sm_bonding_fail_idx = 208, + ble_evt_sm_passkey_display_idx = 209, + ble_evt_sm_passkey_request_idx = 210, + ble_evt_sm_bond_status_idx = 211, + ble_evt_gap_scan_response_idx = 212, + ble_evt_gap_mode_changed_idx = 213, + ble_evt_hardware_io_port_status_idx = 214, + ble_evt_hardware_soft_timer_idx = 215, + ble_evt_hardware_adc_result_idx = 216, + ble_evt_dfu_boot_idx = 217 }; #ifndef BG_ERRORCODES #define BG_ERRORCODES -enum ble_error_spaces -{ - ble_errspc_bt=512, - ble_errspc_att=1024, - ble_errspc_bg=256, - ble_errspc_smp=768, +enum ble_error_spaces { + ble_errspc_bt = 512, + ble_errspc_att = 1024, + ble_errspc_bg = 256, + ble_errspc_smp = 768, }; -typedef enum ble_error -{ - ble_err_bt_error_success =ble_errspc_bt+0, //Command completed succesfully - ble_err_bt_bt_error_authentication_failure =ble_errspc_bt+5, //Pairing or authentication failed due to incorrect results in the pairing or authentication procedure. This could be due to an incorrect PIN or Link Key - ble_err_bt_pin_or_key_missing =ble_errspc_bt+6, //Pairing failed because of missing PIN, or authentication failed because of missing Key - ble_err_bt_bt_error_memory_capacity_exceeded =ble_errspc_bt+7, //Controller is out of memory. - ble_err_bt_connection_timeout =ble_errspc_bt+8, //Link supervision timeout has expired. - ble_err_bt_connection_limit_exceeded =ble_errspc_bt+9, //Controller is at limit of connections it can support. - ble_err_bt_bt_error_command_disallowed =ble_errspc_bt+12, //Command requested cannot be executed because the Controller is in a state where it cannot process this command at this time. - ble_err_bt_bt_error_invalid_command_parameters =ble_errspc_bt+18, //Command contained invalid parameters. - ble_err_bt_bt_error_remote_user_terminated =ble_errspc_bt+19, //User on the remote device terminated the connection. - ble_err_bt_bt_error_connection_terminated_by_local_host =ble_errspc_bt+22, //Local device terminated the connection. - ble_err_bt_bt_error_ll_response_timeout =ble_errspc_bt+34, //Connection terminated due to link-layer procedure timeout. - ble_err_bt_bt_error_ll_instant_passed =ble_errspc_bt+40, //Received link-layer control packet where instant was in the past. - ble_err_bt_bt_error_controller_busy =ble_errspc_bt+58, //Operation was rejected because the controller is busy and unable to process the request. - ble_err_bt_bt_error_unacceptable_connection_interval =ble_errspc_bt+59, //Remote evice terminated the connection because of an unacceptable connection interval. - ble_err_bt_bt_error_directed_advertising_timeout =ble_errspc_bt+60, //Directed advertising completed without a connection being created. - ble_err_bt_bt_error_connection_terminated_due_to_mic_failure=ble_errspc_bt+61, //Connection was terminated because the Message Integrity Check (MIC) failed on a received packet. - ble_err_bt_bt_error_connection_failed_to_be_established =ble_errspc_bt+62, //LL initiated a connection but the connection has failed to be established. Controller did not receive any packets from remote end. - ble_err_att_invalid_handle =ble_errspc_att+1, //The attribute handle given was not valid on this server - ble_err_att_read_not_permitted =ble_errspc_att+2, //The attribute cannot be read - ble_err_att_write_not_permitted =ble_errspc_att+3, //The attribute cannot be written - ble_err_att_invalid_pdu =ble_errspc_att+4, //The attribute PDU was invalid - ble_err_att_insufficient_authentication =ble_errspc_att+5, //The attribute requires authentication before it can be read or written. - ble_err_att_request_not_supported =ble_errspc_att+6, //Attribute Server does not support the request received from the client. - ble_err_att_invalid_offset =ble_errspc_att+7, //Offset specified was past the end of the attribute - ble_err_att_insufficient_authorization =ble_errspc_att+8, //The attribute requires authorization before it can be read or written. - ble_err_att_prepare_queue_full =ble_errspc_att+9, //Too many prepare writes have been queueud - ble_err_att_att_not_found =ble_errspc_att+10, //No attribute found within the given attribute handle range. - ble_err_att_att_not_long =ble_errspc_att+11, //The attribute cannot be read or written using the Read Blob Request - ble_err_att_insufficient_enc_key_size =ble_errspc_att+12, //The Encryption Key Size used for encrypting this link is insufficient. - ble_err_att_invalid_att_length =ble_errspc_att+13, //The attribute value length is invalid for the operation - ble_err_att_unlikely_error =ble_errspc_att+14, //The attribute request that was requested has encountered an error that was unlikely, and therefore could not be completed as requested. - ble_err_att_insufficient_encryption =ble_errspc_att+15, //The attribute requires encryption before it can be read or written. - ble_err_att_unsupported_group_type =ble_errspc_att+16, //The attribute type is not a supported grouping attribute as defined by a higher layer specification. - ble_err_att_insufficient_resources =ble_errspc_att+17, //Insufficient Resources to complete the request - ble_err_att_application =ble_errspc_att+128,//Application error code defined by a higher layer specification. - ble_err_success =0, //No error - ble_err_invalid_param =ble_errspc_bg+128, //Command contained invalid parameter - ble_err_wrong_state =ble_errspc_bg+129, //Device is in wrong state to receive command - ble_err_out_of_memory =ble_errspc_bg+130, //Device has run out of memory - ble_err_not_implemented =ble_errspc_bg+131, //Feature is not implemented - ble_err_invalid_command =ble_errspc_bg+132, //Command was not recognized - ble_err_timeout =ble_errspc_bg+133, //Command or Procedure failed due to timeout - ble_err_not_connected =ble_errspc_bg+134, //Connection handle passed is to command is not a valid handle - ble_err_flow =ble_errspc_bg+135, //Command would cause either underflow or overflow error - ble_err_user_attribute =ble_errspc_bg+136, //User attribute was accessed through API which is not supported - ble_err_invalid_license_key =ble_errspc_bg+137, //No valid license key found - ble_err_command_too_long =ble_errspc_bg+138, //Command maximum length exceeded - ble_err_out_of_bonds =ble_errspc_bg+139, //Bonding procedure can't be started because device has no space left for bond. - ble_err_smp_passkey_entry_failed =ble_errspc_smp+1, //The user input of passkey failed, for example, the user cancelled the operation - ble_err_smp_oob_not_available =ble_errspc_smp+2, //Out of Band data is not available for authentication - ble_err_smp_authentication_requirements =ble_errspc_smp+3, //The pairing procedure cannot be performed as authentication requirements cannot be met due to IO capabilities of one or both devices - ble_err_smp_confirm_value_failed =ble_errspc_smp+4, //The confirm value does not match the calculated compare value - ble_err_smp_pairing_not_supported =ble_errspc_smp+5, //Pairing is not supported by the device - ble_err_smp_encryption_key_size =ble_errspc_smp+6, //The resultant encryption key size is insufficient for the security requirements of this device - ble_err_smp_command_not_supported =ble_errspc_smp+7, //The SMP command received is not supported on this device - ble_err_smp_unspecified_reason =ble_errspc_smp+8, //Pairing failed due to an unspecified reason - ble_err_smp_repeated_attempts =ble_errspc_smp+9, //Pairing or authentication procedure is disallowed because too little time has elapsed since last pairing request or security request - ble_err_smp_invalid_parameters =ble_errspc_smp+10, //The Invalid Parameters error code indicates: the command length is invalid or a parameter is outside of the specified range. - ble_err_last -}errorcode_t; +typedef enum ble_error { + ble_err_bt_error_success = ble_errspc_bt + 0, //Command completed succesfully + ble_err_bt_bt_error_authentication_failure = ble_errspc_bt + 5, //Pairing or authentication failed due to incorrect results in the pairing or authentication procedure. This could be due to an incorrect PIN or Link Key + ble_err_bt_pin_or_key_missing = ble_errspc_bt + 6, //Pairing failed because of missing PIN, or authentication failed because of missing Key + ble_err_bt_bt_error_memory_capacity_exceeded = ble_errspc_bt + 7, //Controller is out of memory. + ble_err_bt_connection_timeout = ble_errspc_bt + 8, //Link supervision timeout has expired. + ble_err_bt_connection_limit_exceeded = ble_errspc_bt + 9, //Controller is at limit of connections it can support. + ble_err_bt_bt_error_command_disallowed = ble_errspc_bt + 12, //Command requested cannot be executed because the Controller is in a state where it cannot process this command at this time. + ble_err_bt_bt_error_invalid_command_parameters = ble_errspc_bt + 18, //Command contained invalid parameters. + ble_err_bt_bt_error_remote_user_terminated = ble_errspc_bt + 19, //User on the remote device terminated the connection. + ble_err_bt_bt_error_connection_terminated_by_local_host = ble_errspc_bt + 22, //Local device terminated the connection. + ble_err_bt_bt_error_ll_response_timeout = ble_errspc_bt + 34, //Connection terminated due to link-layer procedure timeout. + ble_err_bt_bt_error_ll_instant_passed = ble_errspc_bt + 40, //Received link-layer control packet where instant was in the past. + ble_err_bt_bt_error_controller_busy = ble_errspc_bt + 58, //Operation was rejected because the controller is busy and unable to process the request. + ble_err_bt_bt_error_unacceptable_connection_interval = ble_errspc_bt + 59, //Remote evice terminated the connection because of an unacceptable connection interval. + ble_err_bt_bt_error_directed_advertising_timeout = ble_errspc_bt + 60, //Directed advertising completed without a connection being created. + ble_err_bt_bt_error_connection_terminated_due_to_mic_failure = ble_errspc_bt + 61, //Connection was terminated because the Message Integrity Check (MIC) failed on a received packet. + ble_err_bt_bt_error_connection_failed_to_be_established = ble_errspc_bt + 62, //LL initiated a connection but the connection has failed to be established. Controller did not receive any packets from remote end. + ble_err_att_invalid_handle = ble_errspc_att + 1, //The attribute handle given was not valid on this server + ble_err_att_read_not_permitted = ble_errspc_att + 2, //The attribute cannot be read + ble_err_att_write_not_permitted = ble_errspc_att + 3, //The attribute cannot be written + ble_err_att_invalid_pdu = ble_errspc_att + 4, //The attribute PDU was invalid + ble_err_att_insufficient_authentication = ble_errspc_att + 5, //The attribute requires authentication before it can be read or written. + ble_err_att_request_not_supported = ble_errspc_att + 6, //Attribute Server does not support the request received from the client. + ble_err_att_invalid_offset = ble_errspc_att + 7, //Offset specified was past the end of the attribute + ble_err_att_insufficient_authorization = ble_errspc_att + 8, //The attribute requires authorization before it can be read or written. + ble_err_att_prepare_queue_full = ble_errspc_att + 9, //Too many prepare writes have been queueud + ble_err_att_att_not_found = ble_errspc_att + 10, //No attribute found within the given attribute handle range. + ble_err_att_att_not_long = ble_errspc_att + 11, //The attribute cannot be read or written using the Read Blob Request + ble_err_att_insufficient_enc_key_size = ble_errspc_att + 12, //The Encryption Key Size used for encrypting this link is insufficient. + ble_err_att_invalid_att_length = ble_errspc_att + 13, //The attribute value length is invalid for the operation + ble_err_att_unlikely_error = ble_errspc_att + 14, //The attribute request that was requested has encountered an error that was unlikely, and therefore could not be completed as requested. + ble_err_att_insufficient_encryption = ble_errspc_att + 15, //The attribute requires encryption before it can be read or written. + ble_err_att_unsupported_group_type = ble_errspc_att + 16, //The attribute type is not a supported grouping attribute as defined by a higher layer specification. + ble_err_att_insufficient_resources = ble_errspc_att + 17, //Insufficient Resources to complete the request + ble_err_att_application = ble_errspc_att + 128, //Application error code defined by a higher layer specification. + ble_err_success = 0, //No error + ble_err_invalid_param = ble_errspc_bg + 128, //Command contained invalid parameter + ble_err_wrong_state = ble_errspc_bg + 129, //Device is in wrong state to receive command + ble_err_out_of_memory = ble_errspc_bg + 130, //Device has run out of memory + ble_err_not_implemented = ble_errspc_bg + 131, //Feature is not implemented + ble_err_invalid_command = ble_errspc_bg + 132, //Command was not recognized + ble_err_timeout = ble_errspc_bg + 133, //Command or Procedure failed due to timeout + ble_err_not_connected = ble_errspc_bg + 134, //Connection handle passed is to command is not a valid handle + ble_err_flow = ble_errspc_bg + 135, //Command would cause either underflow or overflow error + ble_err_user_attribute = ble_errspc_bg + 136, //User attribute was accessed through API which is not supported + ble_err_invalid_license_key = ble_errspc_bg + 137, //No valid license key found + ble_err_command_too_long = ble_errspc_bg + 138, //Command maximum length exceeded + ble_err_out_of_bonds = ble_errspc_bg + 139, //Bonding procedure can't be started because device has no space left for bond. + ble_err_smp_passkey_entry_failed = ble_errspc_smp + 1, //The user input of passkey failed, for example, the user cancelled the operation + ble_err_smp_oob_not_available = ble_errspc_smp + 2, //Out of Band data is not available for authentication + ble_err_smp_authentication_requirements = ble_errspc_smp + 3, //The pairing procedure cannot be performed as authentication requirements cannot be met due to IO capabilities of one or both devices + ble_err_smp_confirm_value_failed = ble_errspc_smp + 4, //The confirm value does not match the calculated compare value + ble_err_smp_pairing_not_supported = ble_errspc_smp + 5, //Pairing is not supported by the device + ble_err_smp_encryption_key_size = ble_errspc_smp + 6, //The resultant encryption key size is insufficient for the security requirements of this device + ble_err_smp_command_not_supported = ble_errspc_smp + 7, //The SMP command received is not supported on this device + ble_err_smp_unspecified_reason = ble_errspc_smp + 8, //Pairing failed due to an unspecified reason + ble_err_smp_repeated_attempts = ble_errspc_smp + 9, //Pairing or authentication procedure is disallowed because too little time has elapsed since last pairing request or security request + ble_err_smp_invalid_parameters = ble_errspc_smp + 10, //The Invalid Parameters error code indicates: the command length is invalid or a parameter is outside of the specified range. + ble_err_last +} errorcode_t; #endif -PACKSTRUCT(struct ble_msg_system_reset_cmd_t -{ - uint8 boot_in_dfu; +PACKSTRUCT(struct ble_msg_system_reset_cmd_t { + uint8 boot_in_dfu; }); -PACKSTRUCT(struct ble_msg_system_address_get_rsp_t -{ - bd_addr address; +PACKSTRUCT(struct ble_msg_system_address_get_rsp_t { + bd_addr address; }); -PACKSTRUCT(struct ble_msg_system_reg_write_cmd_t -{ - uint16 address; - uint8 value; +PACKSTRUCT(struct ble_msg_system_reg_write_cmd_t { + uint16 address; + uint8 value; }); -PACKSTRUCT(struct ble_msg_system_reg_write_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_system_reg_write_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_system_reg_read_cmd_t -{ - uint16 address; +PACKSTRUCT(struct ble_msg_system_reg_read_cmd_t { + uint16 address; }); -PACKSTRUCT(struct ble_msg_system_reg_read_rsp_t -{ - uint16 address; - uint8 value; +PACKSTRUCT(struct ble_msg_system_reg_read_rsp_t { + uint16 address; + uint8 value; }); -PACKSTRUCT(struct ble_msg_system_get_counters_rsp_t -{ - uint8 txok; - uint8 txretry; - uint8 rxok; - uint8 rxfail; - uint8 mbuf; +PACKSTRUCT(struct ble_msg_system_get_counters_rsp_t { + uint8 txok; + uint8 txretry; + uint8 rxok; + uint8 rxfail; + uint8 mbuf; }); -PACKSTRUCT(struct ble_msg_system_get_connections_rsp_t -{ - uint8 maxconn; +PACKSTRUCT(struct ble_msg_system_get_connections_rsp_t { + uint8 maxconn; }); -PACKSTRUCT(struct ble_msg_system_read_memory_cmd_t -{ - uint32 address; - uint8 length; +PACKSTRUCT(struct ble_msg_system_read_memory_cmd_t { + uint32 address; + uint8 length; }); -PACKSTRUCT(struct ble_msg_system_read_memory_rsp_t -{ - uint32 address; - uint8array data; +PACKSTRUCT(struct ble_msg_system_read_memory_rsp_t { + uint32 address; + uint8array data; }); -PACKSTRUCT(struct ble_msg_system_get_info_rsp_t -{ - uint16 major; - uint16 minor; - uint16 patch; - uint16 build; - uint16 ll_version; - uint8 protocol_version; - uint8 hw; +PACKSTRUCT(struct ble_msg_system_get_info_rsp_t { + uint16 major; + uint16 minor; + uint16 patch; + uint16 build; + uint16 ll_version; + uint8 protocol_version; + uint8 hw; }); -PACKSTRUCT(struct ble_msg_system_endpoint_tx_cmd_t -{ - uint8 endpoint; - uint8array data; +PACKSTRUCT(struct ble_msg_system_endpoint_tx_cmd_t { + uint8 endpoint; + uint8array data; }); -PACKSTRUCT(struct ble_msg_system_endpoint_tx_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_system_endpoint_tx_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_system_whitelist_append_cmd_t -{ - bd_addr address; - uint8 address_type; +PACKSTRUCT(struct ble_msg_system_whitelist_append_cmd_t { + bd_addr address; + uint8 address_type; }); -PACKSTRUCT(struct ble_msg_system_whitelist_append_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_system_whitelist_append_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_system_whitelist_remove_cmd_t -{ - bd_addr address; - uint8 address_type; +PACKSTRUCT(struct ble_msg_system_whitelist_remove_cmd_t { + bd_addr address; + uint8 address_type; }); -PACKSTRUCT(struct ble_msg_system_whitelist_remove_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_system_whitelist_remove_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_system_endpoint_rx_cmd_t -{ - uint8 endpoint; - uint8 size; +PACKSTRUCT(struct ble_msg_system_endpoint_rx_cmd_t { + uint8 endpoint; + uint8 size; }); -PACKSTRUCT(struct ble_msg_system_endpoint_rx_rsp_t -{ - uint16 result; - uint8array data; +PACKSTRUCT(struct ble_msg_system_endpoint_rx_rsp_t { + uint16 result; + uint8array data; }); -PACKSTRUCT(struct ble_msg_system_endpoint_set_watermarks_cmd_t -{ - uint8 endpoint; - uint8 rx; - uint8 tx; +PACKSTRUCT(struct ble_msg_system_endpoint_set_watermarks_cmd_t { + uint8 endpoint; + uint8 rx; + uint8 tx; }); -PACKSTRUCT(struct ble_msg_system_endpoint_set_watermarks_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_system_endpoint_set_watermarks_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_system_boot_evt_t -{ - uint16 major; - uint16 minor; - uint16 patch; - uint16 build; - uint16 ll_version; - uint8 protocol_version; - uint8 hw; +PACKSTRUCT(struct ble_msg_system_boot_evt_t { + uint16 major; + uint16 minor; + uint16 patch; + uint16 build; + uint16 ll_version; + uint8 protocol_version; + uint8 hw; }); -PACKSTRUCT(struct ble_msg_system_debug_evt_t -{ - uint8array data; +PACKSTRUCT(struct ble_msg_system_debug_evt_t { + uint8array data; }); -PACKSTRUCT(struct ble_msg_system_endpoint_watermark_rx_evt_t -{ - uint8 endpoint; - uint8 data; +PACKSTRUCT(struct ble_msg_system_endpoint_watermark_rx_evt_t { + uint8 endpoint; + uint8 data; }); -PACKSTRUCT(struct ble_msg_system_endpoint_watermark_tx_evt_t -{ - uint8 endpoint; - uint8 data; +PACKSTRUCT(struct ble_msg_system_endpoint_watermark_tx_evt_t { + uint8 endpoint; + uint8 data; }); -PACKSTRUCT(struct ble_msg_system_script_failure_evt_t -{ - uint16 address; - uint16 reason; +PACKSTRUCT(struct ble_msg_system_script_failure_evt_t { + uint16 address; + uint16 reason; }); -PACKSTRUCT(struct ble_msg_system_protocol_error_evt_t -{ - uint16 reason; +PACKSTRUCT(struct ble_msg_system_protocol_error_evt_t { + uint16 reason; }); -PACKSTRUCT(struct ble_msg_flash_ps_save_cmd_t -{ - uint16 key; - uint8array value; +PACKSTRUCT(struct ble_msg_flash_ps_save_cmd_t { + uint16 key; + uint8array value; }); -PACKSTRUCT(struct ble_msg_flash_ps_save_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_flash_ps_save_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_flash_ps_load_cmd_t -{ - uint16 key; +PACKSTRUCT(struct ble_msg_flash_ps_load_cmd_t { + uint16 key; }); -PACKSTRUCT(struct ble_msg_flash_ps_load_rsp_t -{ - uint16 result; - uint8array value; +PACKSTRUCT(struct ble_msg_flash_ps_load_rsp_t { + uint16 result; + uint8array value; }); -PACKSTRUCT(struct ble_msg_flash_ps_erase_cmd_t -{ - uint16 key; +PACKSTRUCT(struct ble_msg_flash_ps_erase_cmd_t { + uint16 key; }); -PACKSTRUCT(struct ble_msg_flash_erase_page_cmd_t -{ - uint8 page; +PACKSTRUCT(struct ble_msg_flash_erase_page_cmd_t { + uint8 page; }); -PACKSTRUCT(struct ble_msg_flash_erase_page_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_flash_erase_page_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_flash_write_words_cmd_t -{ - uint16 address; - uint8array words; +PACKSTRUCT(struct ble_msg_flash_write_words_cmd_t { + uint16 address; + uint8array words; }); -PACKSTRUCT(struct ble_msg_flash_ps_key_evt_t -{ - uint16 key; - uint8array value; +PACKSTRUCT(struct ble_msg_flash_ps_key_evt_t { + uint16 key; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attributes_write_cmd_t -{ - uint16 handle; - uint8 offset; - uint8array value; +PACKSTRUCT(struct ble_msg_attributes_write_cmd_t { + uint16 handle; + uint8 offset; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attributes_write_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_attributes_write_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_attributes_read_cmd_t -{ - uint16 handle; - uint16 offset; +PACKSTRUCT(struct ble_msg_attributes_read_cmd_t { + uint16 handle; + uint16 offset; }); -PACKSTRUCT(struct ble_msg_attributes_read_rsp_t -{ - uint16 handle; - uint16 offset; - uint16 result; - uint8array value; +PACKSTRUCT(struct ble_msg_attributes_read_rsp_t { + uint16 handle; + uint16 offset; + uint16 result; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attributes_read_type_cmd_t -{ - uint16 handle; +PACKSTRUCT(struct ble_msg_attributes_read_type_cmd_t { + uint16 handle; }); -PACKSTRUCT(struct ble_msg_attributes_read_type_rsp_t -{ - uint16 handle; - uint16 result; - uint8array value; +PACKSTRUCT(struct ble_msg_attributes_read_type_rsp_t { + uint16 handle; + uint16 result; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attributes_user_read_response_cmd_t -{ - uint8 connection; - uint8 att_error; - uint8array value; +PACKSTRUCT(struct ble_msg_attributes_user_read_response_cmd_t { + uint8 connection; + uint8 att_error; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attributes_user_write_response_cmd_t -{ - uint8 connection; - uint8 att_error; +PACKSTRUCT(struct ble_msg_attributes_user_write_response_cmd_t { + uint8 connection; + uint8 att_error; }); -PACKSTRUCT(struct ble_msg_attributes_value_evt_t -{ - uint8 connection; - uint8 reason; - uint16 handle; - uint16 offset; - uint8array value; +PACKSTRUCT(struct ble_msg_attributes_value_evt_t { + uint8 connection; + uint8 reason; + uint16 handle; + uint16 offset; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attributes_user_read_request_evt_t -{ - uint8 connection; - uint16 handle; - uint16 offset; - uint8 maxsize; +PACKSTRUCT(struct ble_msg_attributes_user_read_request_evt_t { + uint8 connection; + uint16 handle; + uint16 offset; + uint8 maxsize; }); -PACKSTRUCT(struct ble_msg_attributes_status_evt_t -{ - uint16 handle; - uint8 flags; +PACKSTRUCT(struct ble_msg_attributes_status_evt_t { + uint16 handle; + uint8 flags; }); -PACKSTRUCT(struct ble_msg_connection_disconnect_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_disconnect_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_disconnect_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_connection_disconnect_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_connection_get_rssi_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_get_rssi_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_get_rssi_rsp_t -{ - uint8 connection; - int8 rssi; +PACKSTRUCT(struct ble_msg_connection_get_rssi_rsp_t { + uint8 connection; + int8 rssi; }); -PACKSTRUCT(struct ble_msg_connection_update_cmd_t -{ - uint8 connection; - uint16 interval_min; - uint16 interval_max; - uint16 latency; - uint16 timeout; +PACKSTRUCT(struct ble_msg_connection_update_cmd_t { + uint8 connection; + uint16 interval_min; + uint16 interval_max; + uint16 latency; + uint16 timeout; }); -PACKSTRUCT(struct ble_msg_connection_update_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_connection_update_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_connection_version_update_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_version_update_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_version_update_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_connection_version_update_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_connection_channel_map_get_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_channel_map_get_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_channel_map_get_rsp_t -{ - uint8 connection; - uint8array map; +PACKSTRUCT(struct ble_msg_connection_channel_map_get_rsp_t { + uint8 connection; + uint8array map; }); -PACKSTRUCT(struct ble_msg_connection_channel_map_set_cmd_t -{ - uint8 connection; - uint8array map; +PACKSTRUCT(struct ble_msg_connection_channel_map_set_cmd_t { + uint8 connection; + uint8array map; }); -PACKSTRUCT(struct ble_msg_connection_channel_map_set_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_connection_channel_map_set_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_connection_features_get_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_features_get_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_features_get_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_connection_features_get_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_connection_get_status_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_get_status_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_get_status_rsp_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_get_status_rsp_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_raw_tx_cmd_t -{ - uint8 connection; - uint8array data; +PACKSTRUCT(struct ble_msg_connection_raw_tx_cmd_t { + uint8 connection; + uint8array data; }); -PACKSTRUCT(struct ble_msg_connection_raw_tx_rsp_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_connection_raw_tx_rsp_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_connection_status_evt_t -{ - uint8 connection; - uint8 flags; - bd_addr address; - uint8 address_type; - uint16 conn_interval; - uint16 timeout; - uint16 latency; - uint8 bonding; +PACKSTRUCT(struct ble_msg_connection_status_evt_t { + uint8 connection; + uint8 flags; + bd_addr address; + uint8 address_type; + uint16 conn_interval; + uint16 timeout; + uint16 latency; + uint8 bonding; }); -PACKSTRUCT(struct ble_msg_connection_version_ind_evt_t -{ - uint8 connection; - uint8 vers_nr; - uint16 comp_id; - uint16 sub_vers_nr; +PACKSTRUCT(struct ble_msg_connection_version_ind_evt_t { + uint8 connection; + uint8 vers_nr; + uint16 comp_id; + uint16 sub_vers_nr; }); -PACKSTRUCT(struct ble_msg_connection_feature_ind_evt_t -{ - uint8 connection; - uint8array features; +PACKSTRUCT(struct ble_msg_connection_feature_ind_evt_t { + uint8 connection; + uint8array features; }); -PACKSTRUCT(struct ble_msg_connection_raw_rx_evt_t -{ - uint8 connection; - uint8array data; +PACKSTRUCT(struct ble_msg_connection_raw_rx_evt_t { + uint8 connection; + uint8array data; }); -PACKSTRUCT(struct ble_msg_connection_disconnected_evt_t -{ - uint8 connection; - uint16 reason; +PACKSTRUCT(struct ble_msg_connection_disconnected_evt_t { + uint8 connection; + uint16 reason; }); -PACKSTRUCT(struct ble_msg_attclient_find_by_type_value_cmd_t -{ - uint8 connection; - uint16 start; - uint16 end; - uint16 uuid; - uint8array value; +PACKSTRUCT(struct ble_msg_attclient_find_by_type_value_cmd_t { + uint8 connection; + uint16 start; + uint16 end; + uint16 uuid; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attclient_find_by_type_value_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_find_by_type_value_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_read_by_group_type_cmd_t -{ - uint8 connection; - uint16 start; - uint16 end; - uint8array uuid; +PACKSTRUCT(struct ble_msg_attclient_read_by_group_type_cmd_t { + uint8 connection; + uint16 start; + uint16 end; + uint8array uuid; }); -PACKSTRUCT(struct ble_msg_attclient_read_by_group_type_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_read_by_group_type_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_read_by_type_cmd_t -{ - uint8 connection; - uint16 start; - uint16 end; - uint8array uuid; +PACKSTRUCT(struct ble_msg_attclient_read_by_type_cmd_t { + uint8 connection; + uint16 start; + uint16 end; + uint8array uuid; }); -PACKSTRUCT(struct ble_msg_attclient_read_by_type_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_read_by_type_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_find_information_cmd_t -{ - uint8 connection; - uint16 start; - uint16 end; +PACKSTRUCT(struct ble_msg_attclient_find_information_cmd_t { + uint8 connection; + uint16 start; + uint16 end; }); -PACKSTRUCT(struct ble_msg_attclient_find_information_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_find_information_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_read_by_handle_cmd_t -{ - uint8 connection; - uint16 chrhandle; +PACKSTRUCT(struct ble_msg_attclient_read_by_handle_cmd_t { + uint8 connection; + uint16 chrhandle; }); -PACKSTRUCT(struct ble_msg_attclient_read_by_handle_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_read_by_handle_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_attribute_write_cmd_t -{ - uint8 connection; - uint16 atthandle; - uint8array data; +PACKSTRUCT(struct ble_msg_attclient_attribute_write_cmd_t { + uint8 connection; + uint16 atthandle; + uint8array data; }); -PACKSTRUCT(struct ble_msg_attclient_attribute_write_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_attribute_write_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_write_command_cmd_t -{ - uint8 connection; - uint16 atthandle; - uint8array data; +PACKSTRUCT(struct ble_msg_attclient_write_command_cmd_t { + uint8 connection; + uint16 atthandle; + uint8array data; }); -PACKSTRUCT(struct ble_msg_attclient_write_command_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_write_command_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_indicate_confirm_cmd_t -{ - uint8 connection; +PACKSTRUCT(struct ble_msg_attclient_indicate_confirm_cmd_t { + uint8 connection; }); -PACKSTRUCT(struct ble_msg_attclient_indicate_confirm_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_indicate_confirm_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_read_long_cmd_t -{ - uint8 connection; - uint16 chrhandle; +PACKSTRUCT(struct ble_msg_attclient_read_long_cmd_t { + uint8 connection; + uint16 chrhandle; }); -PACKSTRUCT(struct ble_msg_attclient_read_long_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_read_long_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_prepare_write_cmd_t -{ - uint8 connection; - uint16 atthandle; - uint16 offset; - uint8array data; +PACKSTRUCT(struct ble_msg_attclient_prepare_write_cmd_t { + uint8 connection; + uint16 atthandle; + uint16 offset; + uint8array data; }); -PACKSTRUCT(struct ble_msg_attclient_prepare_write_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_prepare_write_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_execute_write_cmd_t -{ - uint8 connection; - uint8 commit; +PACKSTRUCT(struct ble_msg_attclient_execute_write_cmd_t { + uint8 connection; + uint8 commit; }); -PACKSTRUCT(struct ble_msg_attclient_execute_write_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_execute_write_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_read_multiple_cmd_t -{ - uint8 connection; - uint8array handles; +PACKSTRUCT(struct ble_msg_attclient_read_multiple_cmd_t { + uint8 connection; + uint8array handles; }); -PACKSTRUCT(struct ble_msg_attclient_read_multiple_rsp_t -{ - uint8 connection; - uint16 result; +PACKSTRUCT(struct ble_msg_attclient_read_multiple_rsp_t { + uint8 connection; + uint16 result; }); -PACKSTRUCT(struct ble_msg_attclient_indicated_evt_t -{ - uint8 connection; - uint16 attrhandle; +PACKSTRUCT(struct ble_msg_attclient_indicated_evt_t { + uint8 connection; + uint16 attrhandle; }); -PACKSTRUCT(struct ble_msg_attclient_procedure_completed_evt_t -{ - uint8 connection; - uint16 result; - uint16 chrhandle; +PACKSTRUCT(struct ble_msg_attclient_procedure_completed_evt_t { + uint8 connection; + uint16 result; + uint16 chrhandle; }); -PACKSTRUCT(struct ble_msg_attclient_group_found_evt_t -{ - uint8 connection; - uint16 start; - uint16 end; - uint8array uuid; +PACKSTRUCT(struct ble_msg_attclient_group_found_evt_t { + uint8 connection; + uint16 start; + uint16 end; + uint8array uuid; }); -PACKSTRUCT(struct ble_msg_attclient_attribute_found_evt_t -{ - uint8 connection; - uint16 chrdecl; - uint16 value; - uint8 properties; - uint8array uuid; +PACKSTRUCT(struct ble_msg_attclient_attribute_found_evt_t { + uint8 connection; + uint16 chrdecl; + uint16 value; + uint8 properties; + uint8array uuid; }); -PACKSTRUCT(struct ble_msg_attclient_find_information_found_evt_t -{ - uint8 connection; - uint16 chrhandle; - uint8array uuid; +PACKSTRUCT(struct ble_msg_attclient_find_information_found_evt_t { + uint8 connection; + uint16 chrhandle; + uint8array uuid; }); -PACKSTRUCT(struct ble_msg_attclient_attribute_value_evt_t -{ - uint8 connection; - uint16 atthandle; - uint8 type; - uint8array value; +PACKSTRUCT(struct ble_msg_attclient_attribute_value_evt_t { + uint8 connection; + uint16 atthandle; + uint8 type; + uint8array value; }); -PACKSTRUCT(struct ble_msg_attclient_read_multiple_response_evt_t -{ - uint8 connection; - uint8array handles; +PACKSTRUCT(struct ble_msg_attclient_read_multiple_response_evt_t { + uint8 connection; + uint8array handles; }); -PACKSTRUCT(struct ble_msg_sm_encrypt_start_cmd_t -{ - uint8 handle; - uint8 bonding; +PACKSTRUCT(struct ble_msg_sm_encrypt_start_cmd_t { + uint8 handle; + uint8 bonding; }); -PACKSTRUCT(struct ble_msg_sm_encrypt_start_rsp_t -{ - uint8 handle; - uint16 result; +PACKSTRUCT(struct ble_msg_sm_encrypt_start_rsp_t { + uint8 handle; + uint16 result; }); -PACKSTRUCT(struct ble_msg_sm_set_bondable_mode_cmd_t -{ - uint8 bondable; +PACKSTRUCT(struct ble_msg_sm_set_bondable_mode_cmd_t { + uint8 bondable; }); -PACKSTRUCT(struct ble_msg_sm_delete_bonding_cmd_t -{ - uint8 handle; +PACKSTRUCT(struct ble_msg_sm_delete_bonding_cmd_t { + uint8 handle; }); -PACKSTRUCT(struct ble_msg_sm_delete_bonding_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_sm_delete_bonding_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_sm_set_parameters_cmd_t -{ - uint8 mitm; - uint8 min_key_size; - uint8 io_capabilities; +PACKSTRUCT(struct ble_msg_sm_set_parameters_cmd_t { + uint8 mitm; + uint8 min_key_size; + uint8 io_capabilities; }); -PACKSTRUCT(struct ble_msg_sm_passkey_entry_cmd_t -{ - uint8 handle; - uint32 passkey; +PACKSTRUCT(struct ble_msg_sm_passkey_entry_cmd_t { + uint8 handle; + uint32 passkey; }); -PACKSTRUCT(struct ble_msg_sm_passkey_entry_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_sm_passkey_entry_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_sm_get_bonds_rsp_t -{ - uint8 bonds; +PACKSTRUCT(struct ble_msg_sm_get_bonds_rsp_t { + uint8 bonds; }); -PACKSTRUCT(struct ble_msg_sm_set_oob_data_cmd_t -{ - uint8array oob; +PACKSTRUCT(struct ble_msg_sm_set_oob_data_cmd_t { + uint8array oob; }); -PACKSTRUCT(struct ble_msg_sm_smp_data_evt_t -{ - uint8 handle; - uint8 packet; - uint8array data; +PACKSTRUCT(struct ble_msg_sm_smp_data_evt_t { + uint8 handle; + uint8 packet; + uint8array data; }); -PACKSTRUCT(struct ble_msg_sm_bonding_fail_evt_t -{ - uint8 handle; - uint16 result; +PACKSTRUCT(struct ble_msg_sm_bonding_fail_evt_t { + uint8 handle; + uint16 result; }); -PACKSTRUCT(struct ble_msg_sm_passkey_display_evt_t -{ - uint8 handle; - uint32 passkey; +PACKSTRUCT(struct ble_msg_sm_passkey_display_evt_t { + uint8 handle; + uint32 passkey; }); -PACKSTRUCT(struct ble_msg_sm_passkey_request_evt_t -{ - uint8 handle; +PACKSTRUCT(struct ble_msg_sm_passkey_request_evt_t { + uint8 handle; }); -PACKSTRUCT(struct ble_msg_sm_bond_status_evt_t -{ - uint8 bond; - uint8 keysize; - uint8 mitm; - uint8 keys; +PACKSTRUCT(struct ble_msg_sm_bond_status_evt_t { + uint8 bond; + uint8 keysize; + uint8 mitm; + uint8 keys; }); -PACKSTRUCT(struct ble_msg_gap_set_privacy_flags_cmd_t -{ - uint8 peripheral_privacy; - uint8 central_privacy; +PACKSTRUCT(struct ble_msg_gap_set_privacy_flags_cmd_t { + uint8 peripheral_privacy; + uint8 central_privacy; }); -PACKSTRUCT(struct ble_msg_gap_set_mode_cmd_t -{ - uint8 discover; - uint8 connect; +PACKSTRUCT(struct ble_msg_gap_set_mode_cmd_t { + uint8 discover; + uint8 connect; }); -PACKSTRUCT(struct ble_msg_gap_set_mode_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_set_mode_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_discover_cmd_t -{ - uint8 mode; +PACKSTRUCT(struct ble_msg_gap_discover_cmd_t { + uint8 mode; }); -PACKSTRUCT(struct ble_msg_gap_discover_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_discover_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_connect_direct_cmd_t -{ - bd_addr address; - uint8 addr_type; - uint16 conn_interval_min; - uint16 conn_interval_max; - uint16 timeout; - uint16 latency; +PACKSTRUCT(struct ble_msg_gap_connect_direct_cmd_t { + bd_addr address; + uint8 addr_type; + uint16 conn_interval_min; + uint16 conn_interval_max; + uint16 timeout; + uint16 latency; }); -PACKSTRUCT(struct ble_msg_gap_connect_direct_rsp_t -{ - uint16 result; - uint8 connection_handle; +PACKSTRUCT(struct ble_msg_gap_connect_direct_rsp_t { + uint16 result; + uint8 connection_handle; }); -PACKSTRUCT(struct ble_msg_gap_end_procedure_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_end_procedure_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_connect_selective_cmd_t -{ - uint16 conn_interval_min; - uint16 conn_interval_max; - uint16 timeout; - uint16 latency; +PACKSTRUCT(struct ble_msg_gap_connect_selective_cmd_t { + uint16 conn_interval_min; + uint16 conn_interval_max; + uint16 timeout; + uint16 latency; }); -PACKSTRUCT(struct ble_msg_gap_connect_selective_rsp_t -{ - uint16 result; - uint8 connection_handle; +PACKSTRUCT(struct ble_msg_gap_connect_selective_rsp_t { + uint16 result; + uint8 connection_handle; }); -PACKSTRUCT(struct ble_msg_gap_set_filtering_cmd_t -{ - uint8 scan_policy; - uint8 adv_policy; - uint8 scan_duplicate_filtering; +PACKSTRUCT(struct ble_msg_gap_set_filtering_cmd_t { + uint8 scan_policy; + uint8 adv_policy; + uint8 scan_duplicate_filtering; }); -PACKSTRUCT(struct ble_msg_gap_set_filtering_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_set_filtering_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_set_scan_parameters_cmd_t -{ - uint16 scan_interval; - uint16 scan_window; - uint8 active; +PACKSTRUCT(struct ble_msg_gap_set_scan_parameters_cmd_t { + uint16 scan_interval; + uint16 scan_window; + uint8 active; }); -PACKSTRUCT(struct ble_msg_gap_set_scan_parameters_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_set_scan_parameters_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_set_adv_parameters_cmd_t -{ - uint16 adv_interval_min; - uint16 adv_interval_max; - uint8 adv_channels; +PACKSTRUCT(struct ble_msg_gap_set_adv_parameters_cmd_t { + uint16 adv_interval_min; + uint16 adv_interval_max; + uint8 adv_channels; }); -PACKSTRUCT(struct ble_msg_gap_set_adv_parameters_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_set_adv_parameters_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_set_adv_data_cmd_t -{ - uint8 set_scanrsp; - uint8array adv_data; +PACKSTRUCT(struct ble_msg_gap_set_adv_data_cmd_t { + uint8 set_scanrsp; + uint8array adv_data; }); -PACKSTRUCT(struct ble_msg_gap_set_adv_data_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_set_adv_data_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_set_directed_connectable_mode_cmd_t -{ - bd_addr address; - uint8 addr_type; +PACKSTRUCT(struct ble_msg_gap_set_directed_connectable_mode_cmd_t { + bd_addr address; + uint8 addr_type; }); -PACKSTRUCT(struct ble_msg_gap_set_directed_connectable_mode_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_gap_set_directed_connectable_mode_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_gap_scan_response_evt_t -{ - int8 rssi; - uint8 packet_type; - bd_addr sender; - uint8 address_type; - uint8 bond; - uint8array data; +PACKSTRUCT(struct ble_msg_gap_scan_response_evt_t { + int8 rssi; + uint8 packet_type; + bd_addr sender; + uint8 address_type; + uint8 bond; + uint8array data; }); -PACKSTRUCT(struct ble_msg_gap_mode_changed_evt_t -{ - uint8 discover; - uint8 connect; +PACKSTRUCT(struct ble_msg_gap_mode_changed_evt_t { + uint8 discover; + uint8 connect; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_irq_cmd_t -{ - uint8 port; - uint8 enable_bits; - uint8 falling_edge; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_irq_cmd_t { + uint8 port; + uint8 enable_bits; + uint8 falling_edge; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_irq_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_irq_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_set_soft_timer_cmd_t -{ - uint32 time; - uint8 handle; - uint8 single_shot; +PACKSTRUCT(struct ble_msg_hardware_set_soft_timer_cmd_t { + uint32 time; + uint8 handle; + uint8 single_shot; }); -PACKSTRUCT(struct ble_msg_hardware_set_soft_timer_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_set_soft_timer_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_adc_read_cmd_t -{ - uint8 input; - uint8 decimation; - uint8 reference_selection; +PACKSTRUCT(struct ble_msg_hardware_adc_read_cmd_t { + uint8 input; + uint8 decimation; + uint8 reference_selection; }); -PACKSTRUCT(struct ble_msg_hardware_adc_read_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_adc_read_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_direction_cmd_t -{ - uint8 port; - uint8 direction; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_direction_cmd_t { + uint8 port; + uint8 direction; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_direction_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_direction_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_function_cmd_t -{ - uint8 port; - uint8 function; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_function_cmd_t { + uint8 port; + uint8 function; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_function_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_function_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_pull_cmd_t -{ - uint8 port; - uint8 tristate_mask; - uint8 pull_up; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_pull_cmd_t { + uint8 port; + uint8 tristate_mask; + uint8 pull_up; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_config_pull_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_io_port_config_pull_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_write_cmd_t -{ - uint8 port; - uint8 mask; - uint8 data; +PACKSTRUCT(struct ble_msg_hardware_io_port_write_cmd_t { + uint8 port; + uint8 mask; + uint8 data; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_write_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_io_port_write_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_read_cmd_t -{ - uint8 port; - uint8 mask; +PACKSTRUCT(struct ble_msg_hardware_io_port_read_cmd_t { + uint8 port; + uint8 mask; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_read_rsp_t -{ - uint16 result; - uint8 port; - uint8 data; +PACKSTRUCT(struct ble_msg_hardware_io_port_read_rsp_t { + uint16 result; + uint8 port; + uint8 data; }); -PACKSTRUCT(struct ble_msg_hardware_spi_config_cmd_t -{ - uint8 channel; - uint8 polarity; - uint8 phase; - uint8 bit_order; - uint8 baud_e; - uint8 baud_m; +PACKSTRUCT(struct ble_msg_hardware_spi_config_cmd_t { + uint8 channel; + uint8 polarity; + uint8 phase; + uint8 bit_order; + uint8 baud_e; + uint8 baud_m; }); -PACKSTRUCT(struct ble_msg_hardware_spi_config_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_spi_config_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_spi_transfer_cmd_t -{ - uint8 channel; - uint8array data; +PACKSTRUCT(struct ble_msg_hardware_spi_transfer_cmd_t { + uint8 channel; + uint8array data; }); -PACKSTRUCT(struct ble_msg_hardware_spi_transfer_rsp_t -{ - uint16 result; - uint8 channel; - uint8array data; +PACKSTRUCT(struct ble_msg_hardware_spi_transfer_rsp_t { + uint16 result; + uint8 channel; + uint8array data; }); -PACKSTRUCT(struct ble_msg_hardware_i2c_read_cmd_t -{ - uint8 address; - uint8 stop; - uint8 length; +PACKSTRUCT(struct ble_msg_hardware_i2c_read_cmd_t { + uint8 address; + uint8 stop; + uint8 length; }); -PACKSTRUCT(struct ble_msg_hardware_i2c_read_rsp_t -{ - uint16 result; - uint8array data; +PACKSTRUCT(struct ble_msg_hardware_i2c_read_rsp_t { + uint16 result; + uint8array data; }); -PACKSTRUCT(struct ble_msg_hardware_i2c_write_cmd_t -{ - uint8 address; - uint8 stop; - uint8array data; +PACKSTRUCT(struct ble_msg_hardware_i2c_write_cmd_t { + uint8 address; + uint8 stop; + uint8array data; }); -PACKSTRUCT(struct ble_msg_hardware_i2c_write_rsp_t -{ - uint8 written; +PACKSTRUCT(struct ble_msg_hardware_i2c_write_rsp_t { + uint8 written; }); -PACKSTRUCT(struct ble_msg_hardware_set_txpower_cmd_t -{ - uint8 power; +PACKSTRUCT(struct ble_msg_hardware_set_txpower_cmd_t { + uint8 power; }); -PACKSTRUCT(struct ble_msg_hardware_timer_comparator_cmd_t -{ - uint8 timer; - uint8 channel; - uint8 mode; - uint16 comparator_value; +PACKSTRUCT(struct ble_msg_hardware_timer_comparator_cmd_t { + uint8 timer; + uint8 channel; + uint8 mode; + uint16 comparator_value; }); -PACKSTRUCT(struct ble_msg_hardware_timer_comparator_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_hardware_timer_comparator_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_hardware_io_port_status_evt_t -{ - uint32 timestamp; - uint8 port; - uint8 irq; - uint8 state; +PACKSTRUCT(struct ble_msg_hardware_io_port_status_evt_t { + uint32 timestamp; + uint8 port; + uint8 irq; + uint8 state; }); -PACKSTRUCT(struct ble_msg_hardware_soft_timer_evt_t -{ - uint8 handle; +PACKSTRUCT(struct ble_msg_hardware_soft_timer_evt_t { + uint8 handle; }); -PACKSTRUCT(struct ble_msg_hardware_adc_result_evt_t -{ - uint8 input; - int16 value; +PACKSTRUCT(struct ble_msg_hardware_adc_result_evt_t { + uint8 input; + int16 value; }); -PACKSTRUCT(struct ble_msg_test_phy_tx_cmd_t -{ - uint8 channel; - uint8 length; - uint8 type; +PACKSTRUCT(struct ble_msg_test_phy_tx_cmd_t { + uint8 channel; + uint8 length; + uint8 type; }); -PACKSTRUCT(struct ble_msg_test_phy_rx_cmd_t -{ - uint8 channel; +PACKSTRUCT(struct ble_msg_test_phy_rx_cmd_t { + uint8 channel; }); -PACKSTRUCT(struct ble_msg_test_phy_end_rsp_t -{ - uint16 counter; +PACKSTRUCT(struct ble_msg_test_phy_end_rsp_t { + uint16 counter; }); -PACKSTRUCT(struct ble_msg_test_get_channel_map_rsp_t -{ - uint8array channel_map; +PACKSTRUCT(struct ble_msg_test_get_channel_map_rsp_t { + uint8array channel_map; }); -PACKSTRUCT(struct ble_msg_test_debug_cmd_t -{ - uint8array input; +PACKSTRUCT(struct ble_msg_test_debug_cmd_t { + uint8array input; }); -PACKSTRUCT(struct ble_msg_test_debug_rsp_t -{ - uint8array output; +PACKSTRUCT(struct ble_msg_test_debug_rsp_t { + uint8array output; }); -PACKSTRUCT(struct ble_msg_test_channel_mode_cmd_t -{ - uint8 mode; +PACKSTRUCT(struct ble_msg_test_channel_mode_cmd_t { + uint8 mode; }); -PACKSTRUCT(struct ble_msg_dfu_reset_cmd_t -{ - uint8 dfu; +PACKSTRUCT(struct ble_msg_dfu_reset_cmd_t { + uint8 dfu; }); -PACKSTRUCT(struct ble_msg_dfu_flash_set_address_cmd_t -{ - uint32 address; +PACKSTRUCT(struct ble_msg_dfu_flash_set_address_cmd_t { + uint32 address; }); -PACKSTRUCT(struct ble_msg_dfu_flash_set_address_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_dfu_flash_set_address_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_dfu_flash_upload_cmd_t -{ - uint8array data; +PACKSTRUCT(struct ble_msg_dfu_flash_upload_cmd_t { + uint8array data; }); -PACKSTRUCT(struct ble_msg_dfu_flash_upload_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_dfu_flash_upload_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_dfu_flash_upload_finish_rsp_t -{ - uint16 result; +PACKSTRUCT(struct ble_msg_dfu_flash_upload_finish_rsp_t { + uint16 result; }); -PACKSTRUCT(struct ble_msg_dfu_boot_evt_t -{ - uint32 version; +PACKSTRUCT(struct ble_msg_dfu_boot_evt_t { + uint32 version; }); PACKSTRUCT( -struct ble_cmd_packet -{ - struct ble_header header; +struct ble_cmd_packet { + struct ble_header header; -union{ - uint8 handle; + union{ + uint8 handle; - uint8 payload; + uint8 payload; - struct ble_msg_system_reset_cmd_t system_reset_cmd; - struct ble_msg_system_reg_write_cmd_t system_reg_write_cmd; - struct ble_msg_system_reg_read_cmd_t system_reg_read_cmd; - struct ble_msg_system_read_memory_cmd_t system_read_memory_cmd; - struct ble_msg_system_endpoint_tx_cmd_t system_endpoint_tx_cmd; - struct ble_msg_system_whitelist_append_cmd_t system_whitelist_append_cmd; - struct ble_msg_system_whitelist_remove_cmd_t system_whitelist_remove_cmd; - struct ble_msg_system_endpoint_rx_cmd_t system_endpoint_rx_cmd; - struct ble_msg_system_endpoint_set_watermarks_cmd_t system_endpoint_set_watermarks_cmd; - struct ble_msg_system_boot_evt_t system_boot_evt; - struct ble_msg_system_debug_evt_t system_debug_evt; - struct ble_msg_system_endpoint_watermark_rx_evt_t system_endpoint_watermark_rx_evt; - struct ble_msg_system_endpoint_watermark_tx_evt_t system_endpoint_watermark_tx_evt; - struct ble_msg_system_script_failure_evt_t system_script_failure_evt; - struct ble_msg_system_protocol_error_evt_t system_protocol_error_evt; - struct ble_msg_system_address_get_rsp_t system_address_get_rsp; - struct ble_msg_system_reg_write_rsp_t system_reg_write_rsp; - struct ble_msg_system_reg_read_rsp_t system_reg_read_rsp; - struct ble_msg_system_get_counters_rsp_t system_get_counters_rsp; - struct ble_msg_system_get_connections_rsp_t system_get_connections_rsp; - struct ble_msg_system_read_memory_rsp_t system_read_memory_rsp; - struct ble_msg_system_get_info_rsp_t system_get_info_rsp; - struct ble_msg_system_endpoint_tx_rsp_t system_endpoint_tx_rsp; - struct ble_msg_system_whitelist_append_rsp_t system_whitelist_append_rsp; - struct ble_msg_system_whitelist_remove_rsp_t system_whitelist_remove_rsp; - struct ble_msg_system_endpoint_rx_rsp_t system_endpoint_rx_rsp; - struct ble_msg_system_endpoint_set_watermarks_rsp_t system_endpoint_set_watermarks_rsp; - struct ble_msg_flash_ps_save_cmd_t flash_ps_save_cmd; - struct ble_msg_flash_ps_load_cmd_t flash_ps_load_cmd; - struct ble_msg_flash_ps_erase_cmd_t flash_ps_erase_cmd; - struct ble_msg_flash_erase_page_cmd_t flash_erase_page_cmd; - struct ble_msg_flash_write_words_cmd_t flash_write_words_cmd; - struct ble_msg_flash_ps_key_evt_t flash_ps_key_evt; - struct ble_msg_flash_ps_save_rsp_t flash_ps_save_rsp; - struct ble_msg_flash_ps_load_rsp_t flash_ps_load_rsp; - struct ble_msg_flash_erase_page_rsp_t flash_erase_page_rsp; - struct ble_msg_attributes_write_cmd_t attributes_write_cmd; - struct ble_msg_attributes_read_cmd_t attributes_read_cmd; - struct ble_msg_attributes_read_type_cmd_t attributes_read_type_cmd; - struct ble_msg_attributes_user_read_response_cmd_t attributes_user_read_response_cmd; - struct ble_msg_attributes_user_write_response_cmd_t attributes_user_write_response_cmd; - struct ble_msg_attributes_value_evt_t attributes_value_evt; - struct ble_msg_attributes_user_read_request_evt_t attributes_user_read_request_evt; - struct ble_msg_attributes_status_evt_t attributes_status_evt; - struct ble_msg_attributes_write_rsp_t attributes_write_rsp; - struct ble_msg_attributes_read_rsp_t attributes_read_rsp; - struct ble_msg_attributes_read_type_rsp_t attributes_read_type_rsp; - struct ble_msg_connection_disconnect_cmd_t connection_disconnect_cmd; - struct ble_msg_connection_get_rssi_cmd_t connection_get_rssi_cmd; - struct ble_msg_connection_update_cmd_t connection_update_cmd; - struct ble_msg_connection_version_update_cmd_t connection_version_update_cmd; - struct ble_msg_connection_channel_map_get_cmd_t connection_channel_map_get_cmd; - struct ble_msg_connection_channel_map_set_cmd_t connection_channel_map_set_cmd; - struct ble_msg_connection_features_get_cmd_t connection_features_get_cmd; - struct ble_msg_connection_get_status_cmd_t connection_get_status_cmd; - struct ble_msg_connection_raw_tx_cmd_t connection_raw_tx_cmd; - struct ble_msg_connection_status_evt_t connection_status_evt; - struct ble_msg_connection_version_ind_evt_t connection_version_ind_evt; - struct ble_msg_connection_feature_ind_evt_t connection_feature_ind_evt; - struct ble_msg_connection_raw_rx_evt_t connection_raw_rx_evt; - struct ble_msg_connection_disconnected_evt_t connection_disconnected_evt; - struct ble_msg_connection_disconnect_rsp_t connection_disconnect_rsp; - struct ble_msg_connection_get_rssi_rsp_t connection_get_rssi_rsp; - struct ble_msg_connection_update_rsp_t connection_update_rsp; - struct ble_msg_connection_version_update_rsp_t connection_version_update_rsp; - struct ble_msg_connection_channel_map_get_rsp_t connection_channel_map_get_rsp; - struct ble_msg_connection_channel_map_set_rsp_t connection_channel_map_set_rsp; - struct ble_msg_connection_features_get_rsp_t connection_features_get_rsp; - struct ble_msg_connection_get_status_rsp_t connection_get_status_rsp; - struct ble_msg_connection_raw_tx_rsp_t connection_raw_tx_rsp; - struct ble_msg_attclient_find_by_type_value_cmd_t attclient_find_by_type_value_cmd; - struct ble_msg_attclient_read_by_group_type_cmd_t attclient_read_by_group_type_cmd; - struct ble_msg_attclient_read_by_type_cmd_t attclient_read_by_type_cmd; - struct ble_msg_attclient_find_information_cmd_t attclient_find_information_cmd; - struct ble_msg_attclient_read_by_handle_cmd_t attclient_read_by_handle_cmd; - struct ble_msg_attclient_attribute_write_cmd_t attclient_attribute_write_cmd; - struct ble_msg_attclient_write_command_cmd_t attclient_write_command_cmd; - struct ble_msg_attclient_indicate_confirm_cmd_t attclient_indicate_confirm_cmd; - struct ble_msg_attclient_read_long_cmd_t attclient_read_long_cmd; - struct ble_msg_attclient_prepare_write_cmd_t attclient_prepare_write_cmd; - struct ble_msg_attclient_execute_write_cmd_t attclient_execute_write_cmd; - struct ble_msg_attclient_read_multiple_cmd_t attclient_read_multiple_cmd; - struct ble_msg_attclient_indicated_evt_t attclient_indicated_evt; - struct ble_msg_attclient_procedure_completed_evt_t attclient_procedure_completed_evt; - struct ble_msg_attclient_group_found_evt_t attclient_group_found_evt; - struct ble_msg_attclient_attribute_found_evt_t attclient_attribute_found_evt; - struct ble_msg_attclient_find_information_found_evt_t attclient_find_information_found_evt; - struct ble_msg_attclient_attribute_value_evt_t attclient_attribute_value_evt; - struct ble_msg_attclient_read_multiple_response_evt_t attclient_read_multiple_response_evt; - struct ble_msg_attclient_find_by_type_value_rsp_t attclient_find_by_type_value_rsp; - struct ble_msg_attclient_read_by_group_type_rsp_t attclient_read_by_group_type_rsp; - struct ble_msg_attclient_read_by_type_rsp_t attclient_read_by_type_rsp; - struct ble_msg_attclient_find_information_rsp_t attclient_find_information_rsp; - struct ble_msg_attclient_read_by_handle_rsp_t attclient_read_by_handle_rsp; - struct ble_msg_attclient_attribute_write_rsp_t attclient_attribute_write_rsp; - struct ble_msg_attclient_write_command_rsp_t attclient_write_command_rsp; - struct ble_msg_attclient_indicate_confirm_rsp_t attclient_indicate_confirm_rsp; - struct ble_msg_attclient_read_long_rsp_t attclient_read_long_rsp; - struct ble_msg_attclient_prepare_write_rsp_t attclient_prepare_write_rsp; - struct ble_msg_attclient_execute_write_rsp_t attclient_execute_write_rsp; - struct ble_msg_attclient_read_multiple_rsp_t attclient_read_multiple_rsp; - struct ble_msg_sm_encrypt_start_cmd_t sm_encrypt_start_cmd; - struct ble_msg_sm_set_bondable_mode_cmd_t sm_set_bondable_mode_cmd; - struct ble_msg_sm_delete_bonding_cmd_t sm_delete_bonding_cmd; - struct ble_msg_sm_set_parameters_cmd_t sm_set_parameters_cmd; - struct ble_msg_sm_passkey_entry_cmd_t sm_passkey_entry_cmd; - struct ble_msg_sm_set_oob_data_cmd_t sm_set_oob_data_cmd; - struct ble_msg_sm_smp_data_evt_t sm_smp_data_evt; - struct ble_msg_sm_bonding_fail_evt_t sm_bonding_fail_evt; - struct ble_msg_sm_passkey_display_evt_t sm_passkey_display_evt; - struct ble_msg_sm_passkey_request_evt_t sm_passkey_request_evt; - struct ble_msg_sm_bond_status_evt_t sm_bond_status_evt; - struct ble_msg_sm_encrypt_start_rsp_t sm_encrypt_start_rsp; - struct ble_msg_sm_delete_bonding_rsp_t sm_delete_bonding_rsp; - struct ble_msg_sm_passkey_entry_rsp_t sm_passkey_entry_rsp; - struct ble_msg_sm_get_bonds_rsp_t sm_get_bonds_rsp; - struct ble_msg_gap_set_privacy_flags_cmd_t gap_set_privacy_flags_cmd; - struct ble_msg_gap_set_mode_cmd_t gap_set_mode_cmd; - struct ble_msg_gap_discover_cmd_t gap_discover_cmd; - struct ble_msg_gap_connect_direct_cmd_t gap_connect_direct_cmd; - struct ble_msg_gap_connect_selective_cmd_t gap_connect_selective_cmd; - struct ble_msg_gap_set_filtering_cmd_t gap_set_filtering_cmd; - struct ble_msg_gap_set_scan_parameters_cmd_t gap_set_scan_parameters_cmd; - struct ble_msg_gap_set_adv_parameters_cmd_t gap_set_adv_parameters_cmd; - struct ble_msg_gap_set_adv_data_cmd_t gap_set_adv_data_cmd; - struct ble_msg_gap_set_directed_connectable_mode_cmd_t gap_set_directed_connectable_mode_cmd; - struct ble_msg_gap_scan_response_evt_t gap_scan_response_evt; - struct ble_msg_gap_mode_changed_evt_t gap_mode_changed_evt; - struct ble_msg_gap_set_mode_rsp_t gap_set_mode_rsp; - struct ble_msg_gap_discover_rsp_t gap_discover_rsp; - struct ble_msg_gap_connect_direct_rsp_t gap_connect_direct_rsp; - struct ble_msg_gap_end_procedure_rsp_t gap_end_procedure_rsp; - struct ble_msg_gap_connect_selective_rsp_t gap_connect_selective_rsp; - struct ble_msg_gap_set_filtering_rsp_t gap_set_filtering_rsp; - struct ble_msg_gap_set_scan_parameters_rsp_t gap_set_scan_parameters_rsp; - struct ble_msg_gap_set_adv_parameters_rsp_t gap_set_adv_parameters_rsp; - struct ble_msg_gap_set_adv_data_rsp_t gap_set_adv_data_rsp; - struct ble_msg_gap_set_directed_connectable_mode_rsp_t gap_set_directed_connectable_mode_rsp; - struct ble_msg_hardware_io_port_config_irq_cmd_t hardware_io_port_config_irq_cmd; - struct ble_msg_hardware_set_soft_timer_cmd_t hardware_set_soft_timer_cmd; - struct ble_msg_hardware_adc_read_cmd_t hardware_adc_read_cmd; - struct ble_msg_hardware_io_port_config_direction_cmd_t hardware_io_port_config_direction_cmd; - struct ble_msg_hardware_io_port_config_function_cmd_t hardware_io_port_config_function_cmd; - struct ble_msg_hardware_io_port_config_pull_cmd_t hardware_io_port_config_pull_cmd; - struct ble_msg_hardware_io_port_write_cmd_t hardware_io_port_write_cmd; - struct ble_msg_hardware_io_port_read_cmd_t hardware_io_port_read_cmd; - struct ble_msg_hardware_spi_config_cmd_t hardware_spi_config_cmd; - struct ble_msg_hardware_spi_transfer_cmd_t hardware_spi_transfer_cmd; - struct ble_msg_hardware_i2c_read_cmd_t hardware_i2c_read_cmd; - struct ble_msg_hardware_i2c_write_cmd_t hardware_i2c_write_cmd; - struct ble_msg_hardware_set_txpower_cmd_t hardware_set_txpower_cmd; - struct ble_msg_hardware_timer_comparator_cmd_t hardware_timer_comparator_cmd; - struct ble_msg_hardware_io_port_status_evt_t hardware_io_port_status_evt; - struct ble_msg_hardware_soft_timer_evt_t hardware_soft_timer_evt; - struct ble_msg_hardware_adc_result_evt_t hardware_adc_result_evt; - struct ble_msg_hardware_io_port_config_irq_rsp_t hardware_io_port_config_irq_rsp; - struct ble_msg_hardware_set_soft_timer_rsp_t hardware_set_soft_timer_rsp; - struct ble_msg_hardware_adc_read_rsp_t hardware_adc_read_rsp; - struct ble_msg_hardware_io_port_config_direction_rsp_t hardware_io_port_config_direction_rsp; - struct ble_msg_hardware_io_port_config_function_rsp_t hardware_io_port_config_function_rsp; - struct ble_msg_hardware_io_port_config_pull_rsp_t hardware_io_port_config_pull_rsp; - struct ble_msg_hardware_io_port_write_rsp_t hardware_io_port_write_rsp; - struct ble_msg_hardware_io_port_read_rsp_t hardware_io_port_read_rsp; - struct ble_msg_hardware_spi_config_rsp_t hardware_spi_config_rsp; - struct ble_msg_hardware_spi_transfer_rsp_t hardware_spi_transfer_rsp; - struct ble_msg_hardware_i2c_read_rsp_t hardware_i2c_read_rsp; - struct ble_msg_hardware_i2c_write_rsp_t hardware_i2c_write_rsp; - struct ble_msg_hardware_timer_comparator_rsp_t hardware_timer_comparator_rsp; - struct ble_msg_test_phy_tx_cmd_t test_phy_tx_cmd; - struct ble_msg_test_phy_rx_cmd_t test_phy_rx_cmd; - struct ble_msg_test_debug_cmd_t test_debug_cmd; - struct ble_msg_test_channel_mode_cmd_t test_channel_mode_cmd; - struct ble_msg_test_phy_end_rsp_t test_phy_end_rsp; - struct ble_msg_test_get_channel_map_rsp_t test_get_channel_map_rsp; - struct ble_msg_test_debug_rsp_t test_debug_rsp; - struct ble_msg_dfu_reset_cmd_t dfu_reset_cmd; - struct ble_msg_dfu_flash_set_address_cmd_t dfu_flash_set_address_cmd; - struct ble_msg_dfu_flash_upload_cmd_t dfu_flash_upload_cmd; - struct ble_msg_dfu_boot_evt_t dfu_boot_evt; - struct ble_msg_dfu_flash_set_address_rsp_t dfu_flash_set_address_rsp; - struct ble_msg_dfu_flash_upload_rsp_t dfu_flash_upload_rsp; - struct ble_msg_dfu_flash_upload_finish_rsp_t dfu_flash_upload_finish_rsp; -}); + struct ble_msg_system_reset_cmd_t system_reset_cmd; + struct ble_msg_system_reg_write_cmd_t system_reg_write_cmd; + struct ble_msg_system_reg_read_cmd_t system_reg_read_cmd; + struct ble_msg_system_read_memory_cmd_t system_read_memory_cmd; + struct ble_msg_system_endpoint_tx_cmd_t system_endpoint_tx_cmd; + struct ble_msg_system_whitelist_append_cmd_t system_whitelist_append_cmd; + struct ble_msg_system_whitelist_remove_cmd_t system_whitelist_remove_cmd; + struct ble_msg_system_endpoint_rx_cmd_t system_endpoint_rx_cmd; + struct ble_msg_system_endpoint_set_watermarks_cmd_t system_endpoint_set_watermarks_cmd; + struct ble_msg_system_boot_evt_t system_boot_evt; + struct ble_msg_system_debug_evt_t system_debug_evt; + struct ble_msg_system_endpoint_watermark_rx_evt_t system_endpoint_watermark_rx_evt; + struct ble_msg_system_endpoint_watermark_tx_evt_t system_endpoint_watermark_tx_evt; + struct ble_msg_system_script_failure_evt_t system_script_failure_evt; + struct ble_msg_system_protocol_error_evt_t system_protocol_error_evt; + struct ble_msg_system_address_get_rsp_t system_address_get_rsp; + struct ble_msg_system_reg_write_rsp_t system_reg_write_rsp; + struct ble_msg_system_reg_read_rsp_t system_reg_read_rsp; + struct ble_msg_system_get_counters_rsp_t system_get_counters_rsp; + struct ble_msg_system_get_connections_rsp_t system_get_connections_rsp; + struct ble_msg_system_read_memory_rsp_t system_read_memory_rsp; + struct ble_msg_system_get_info_rsp_t system_get_info_rsp; + struct ble_msg_system_endpoint_tx_rsp_t system_endpoint_tx_rsp; + struct ble_msg_system_whitelist_append_rsp_t system_whitelist_append_rsp; + struct ble_msg_system_whitelist_remove_rsp_t system_whitelist_remove_rsp; + struct ble_msg_system_endpoint_rx_rsp_t system_endpoint_rx_rsp; + struct ble_msg_system_endpoint_set_watermarks_rsp_t system_endpoint_set_watermarks_rsp; + struct ble_msg_flash_ps_save_cmd_t flash_ps_save_cmd; + struct ble_msg_flash_ps_load_cmd_t flash_ps_load_cmd; + struct ble_msg_flash_ps_erase_cmd_t flash_ps_erase_cmd; + struct ble_msg_flash_erase_page_cmd_t flash_erase_page_cmd; + struct ble_msg_flash_write_words_cmd_t flash_write_words_cmd; + struct ble_msg_flash_ps_key_evt_t flash_ps_key_evt; + struct ble_msg_flash_ps_save_rsp_t flash_ps_save_rsp; + struct ble_msg_flash_ps_load_rsp_t flash_ps_load_rsp; + struct ble_msg_flash_erase_page_rsp_t flash_erase_page_rsp; + struct ble_msg_attributes_write_cmd_t attributes_write_cmd; + struct ble_msg_attributes_read_cmd_t attributes_read_cmd; + struct ble_msg_attributes_read_type_cmd_t attributes_read_type_cmd; + struct ble_msg_attributes_user_read_response_cmd_t attributes_user_read_response_cmd; + struct ble_msg_attributes_user_write_response_cmd_t attributes_user_write_response_cmd; + struct ble_msg_attributes_value_evt_t attributes_value_evt; + struct ble_msg_attributes_user_read_request_evt_t attributes_user_read_request_evt; + struct ble_msg_attributes_status_evt_t attributes_status_evt; + struct ble_msg_attributes_write_rsp_t attributes_write_rsp; + struct ble_msg_attributes_read_rsp_t attributes_read_rsp; + struct ble_msg_attributes_read_type_rsp_t attributes_read_type_rsp; + struct ble_msg_connection_disconnect_cmd_t connection_disconnect_cmd; + struct ble_msg_connection_get_rssi_cmd_t connection_get_rssi_cmd; + struct ble_msg_connection_update_cmd_t connection_update_cmd; + struct ble_msg_connection_version_update_cmd_t connection_version_update_cmd; + struct ble_msg_connection_channel_map_get_cmd_t connection_channel_map_get_cmd; + struct ble_msg_connection_channel_map_set_cmd_t connection_channel_map_set_cmd; + struct ble_msg_connection_features_get_cmd_t connection_features_get_cmd; + struct ble_msg_connection_get_status_cmd_t connection_get_status_cmd; + struct ble_msg_connection_raw_tx_cmd_t connection_raw_tx_cmd; + struct ble_msg_connection_status_evt_t connection_status_evt; + struct ble_msg_connection_version_ind_evt_t connection_version_ind_evt; + struct ble_msg_connection_feature_ind_evt_t connection_feature_ind_evt; + struct ble_msg_connection_raw_rx_evt_t connection_raw_rx_evt; + struct ble_msg_connection_disconnected_evt_t connection_disconnected_evt; + struct ble_msg_connection_disconnect_rsp_t connection_disconnect_rsp; + struct ble_msg_connection_get_rssi_rsp_t connection_get_rssi_rsp; + struct ble_msg_connection_update_rsp_t connection_update_rsp; + struct ble_msg_connection_version_update_rsp_t connection_version_update_rsp; + struct ble_msg_connection_channel_map_get_rsp_t connection_channel_map_get_rsp; + struct ble_msg_connection_channel_map_set_rsp_t connection_channel_map_set_rsp; + struct ble_msg_connection_features_get_rsp_t connection_features_get_rsp; + struct ble_msg_connection_get_status_rsp_t connection_get_status_rsp; + struct ble_msg_connection_raw_tx_rsp_t connection_raw_tx_rsp; + struct ble_msg_attclient_find_by_type_value_cmd_t attclient_find_by_type_value_cmd; + struct ble_msg_attclient_read_by_group_type_cmd_t attclient_read_by_group_type_cmd; + struct ble_msg_attclient_read_by_type_cmd_t attclient_read_by_type_cmd; + struct ble_msg_attclient_find_information_cmd_t attclient_find_information_cmd; + struct ble_msg_attclient_read_by_handle_cmd_t attclient_read_by_handle_cmd; + struct ble_msg_attclient_attribute_write_cmd_t attclient_attribute_write_cmd; + struct ble_msg_attclient_write_command_cmd_t attclient_write_command_cmd; + struct ble_msg_attclient_indicate_confirm_cmd_t attclient_indicate_confirm_cmd; + struct ble_msg_attclient_read_long_cmd_t attclient_read_long_cmd; + struct ble_msg_attclient_prepare_write_cmd_t attclient_prepare_write_cmd; + struct ble_msg_attclient_execute_write_cmd_t attclient_execute_write_cmd; + struct ble_msg_attclient_read_multiple_cmd_t attclient_read_multiple_cmd; + struct ble_msg_attclient_indicated_evt_t attclient_indicated_evt; + struct ble_msg_attclient_procedure_completed_evt_t attclient_procedure_completed_evt; + struct ble_msg_attclient_group_found_evt_t attclient_group_found_evt; + struct ble_msg_attclient_attribute_found_evt_t attclient_attribute_found_evt; + struct ble_msg_attclient_find_information_found_evt_t attclient_find_information_found_evt; + struct ble_msg_attclient_attribute_value_evt_t attclient_attribute_value_evt; + struct ble_msg_attclient_read_multiple_response_evt_t attclient_read_multiple_response_evt; + struct ble_msg_attclient_find_by_type_value_rsp_t attclient_find_by_type_value_rsp; + struct ble_msg_attclient_read_by_group_type_rsp_t attclient_read_by_group_type_rsp; + struct ble_msg_attclient_read_by_type_rsp_t attclient_read_by_type_rsp; + struct ble_msg_attclient_find_information_rsp_t attclient_find_information_rsp; + struct ble_msg_attclient_read_by_handle_rsp_t attclient_read_by_handle_rsp; + struct ble_msg_attclient_attribute_write_rsp_t attclient_attribute_write_rsp; + struct ble_msg_attclient_write_command_rsp_t attclient_write_command_rsp; + struct ble_msg_attclient_indicate_confirm_rsp_t attclient_indicate_confirm_rsp; + struct ble_msg_attclient_read_long_rsp_t attclient_read_long_rsp; + struct ble_msg_attclient_prepare_write_rsp_t attclient_prepare_write_rsp; + struct ble_msg_attclient_execute_write_rsp_t attclient_execute_write_rsp; + struct ble_msg_attclient_read_multiple_rsp_t attclient_read_multiple_rsp; + struct ble_msg_sm_encrypt_start_cmd_t sm_encrypt_start_cmd; + struct ble_msg_sm_set_bondable_mode_cmd_t sm_set_bondable_mode_cmd; + struct ble_msg_sm_delete_bonding_cmd_t sm_delete_bonding_cmd; + struct ble_msg_sm_set_parameters_cmd_t sm_set_parameters_cmd; + struct ble_msg_sm_passkey_entry_cmd_t sm_passkey_entry_cmd; + struct ble_msg_sm_set_oob_data_cmd_t sm_set_oob_data_cmd; + struct ble_msg_sm_smp_data_evt_t sm_smp_data_evt; + struct ble_msg_sm_bonding_fail_evt_t sm_bonding_fail_evt; + struct ble_msg_sm_passkey_display_evt_t sm_passkey_display_evt; + struct ble_msg_sm_passkey_request_evt_t sm_passkey_request_evt; + struct ble_msg_sm_bond_status_evt_t sm_bond_status_evt; + struct ble_msg_sm_encrypt_start_rsp_t sm_encrypt_start_rsp; + struct ble_msg_sm_delete_bonding_rsp_t sm_delete_bonding_rsp; + struct ble_msg_sm_passkey_entry_rsp_t sm_passkey_entry_rsp; + struct ble_msg_sm_get_bonds_rsp_t sm_get_bonds_rsp; + struct ble_msg_gap_set_privacy_flags_cmd_t gap_set_privacy_flags_cmd; + struct ble_msg_gap_set_mode_cmd_t gap_set_mode_cmd; + struct ble_msg_gap_discover_cmd_t gap_discover_cmd; + struct ble_msg_gap_connect_direct_cmd_t gap_connect_direct_cmd; + struct ble_msg_gap_connect_selective_cmd_t gap_connect_selective_cmd; + struct ble_msg_gap_set_filtering_cmd_t gap_set_filtering_cmd; + struct ble_msg_gap_set_scan_parameters_cmd_t gap_set_scan_parameters_cmd; + struct ble_msg_gap_set_adv_parameters_cmd_t gap_set_adv_parameters_cmd; + struct ble_msg_gap_set_adv_data_cmd_t gap_set_adv_data_cmd; + struct ble_msg_gap_set_directed_connectable_mode_cmd_t gap_set_directed_connectable_mode_cmd; + struct ble_msg_gap_scan_response_evt_t gap_scan_response_evt; + struct ble_msg_gap_mode_changed_evt_t gap_mode_changed_evt; + struct ble_msg_gap_set_mode_rsp_t gap_set_mode_rsp; + struct ble_msg_gap_discover_rsp_t gap_discover_rsp; + struct ble_msg_gap_connect_direct_rsp_t gap_connect_direct_rsp; + struct ble_msg_gap_end_procedure_rsp_t gap_end_procedure_rsp; + struct ble_msg_gap_connect_selective_rsp_t gap_connect_selective_rsp; + struct ble_msg_gap_set_filtering_rsp_t gap_set_filtering_rsp; + struct ble_msg_gap_set_scan_parameters_rsp_t gap_set_scan_parameters_rsp; + struct ble_msg_gap_set_adv_parameters_rsp_t gap_set_adv_parameters_rsp; + struct ble_msg_gap_set_adv_data_rsp_t gap_set_adv_data_rsp; + struct ble_msg_gap_set_directed_connectable_mode_rsp_t gap_set_directed_connectable_mode_rsp; + struct ble_msg_hardware_io_port_config_irq_cmd_t hardware_io_port_config_irq_cmd; + struct ble_msg_hardware_set_soft_timer_cmd_t hardware_set_soft_timer_cmd; + struct ble_msg_hardware_adc_read_cmd_t hardware_adc_read_cmd; + struct ble_msg_hardware_io_port_config_direction_cmd_t hardware_io_port_config_direction_cmd; + struct ble_msg_hardware_io_port_config_function_cmd_t hardware_io_port_config_function_cmd; + struct ble_msg_hardware_io_port_config_pull_cmd_t hardware_io_port_config_pull_cmd; + struct ble_msg_hardware_io_port_write_cmd_t hardware_io_port_write_cmd; + struct ble_msg_hardware_io_port_read_cmd_t hardware_io_port_read_cmd; + struct ble_msg_hardware_spi_config_cmd_t hardware_spi_config_cmd; + struct ble_msg_hardware_spi_transfer_cmd_t hardware_spi_transfer_cmd; + struct ble_msg_hardware_i2c_read_cmd_t hardware_i2c_read_cmd; + struct ble_msg_hardware_i2c_write_cmd_t hardware_i2c_write_cmd; + struct ble_msg_hardware_set_txpower_cmd_t hardware_set_txpower_cmd; + struct ble_msg_hardware_timer_comparator_cmd_t hardware_timer_comparator_cmd; + struct ble_msg_hardware_io_port_status_evt_t hardware_io_port_status_evt; + struct ble_msg_hardware_soft_timer_evt_t hardware_soft_timer_evt; + struct ble_msg_hardware_adc_result_evt_t hardware_adc_result_evt; + struct ble_msg_hardware_io_port_config_irq_rsp_t hardware_io_port_config_irq_rsp; + struct ble_msg_hardware_set_soft_timer_rsp_t hardware_set_soft_timer_rsp; + struct ble_msg_hardware_adc_read_rsp_t hardware_adc_read_rsp; + struct ble_msg_hardware_io_port_config_direction_rsp_t hardware_io_port_config_direction_rsp; + struct ble_msg_hardware_io_port_config_function_rsp_t hardware_io_port_config_function_rsp; + struct ble_msg_hardware_io_port_config_pull_rsp_t hardware_io_port_config_pull_rsp; + struct ble_msg_hardware_io_port_write_rsp_t hardware_io_port_write_rsp; + struct ble_msg_hardware_io_port_read_rsp_t hardware_io_port_read_rsp; + struct ble_msg_hardware_spi_config_rsp_t hardware_spi_config_rsp; + struct ble_msg_hardware_spi_transfer_rsp_t hardware_spi_transfer_rsp; + struct ble_msg_hardware_i2c_read_rsp_t hardware_i2c_read_rsp; + struct ble_msg_hardware_i2c_write_rsp_t hardware_i2c_write_rsp; + struct ble_msg_hardware_timer_comparator_rsp_t hardware_timer_comparator_rsp; + struct ble_msg_test_phy_tx_cmd_t test_phy_tx_cmd; + struct ble_msg_test_phy_rx_cmd_t test_phy_rx_cmd; + struct ble_msg_test_debug_cmd_t test_debug_cmd; + struct ble_msg_test_channel_mode_cmd_t test_channel_mode_cmd; + struct ble_msg_test_phy_end_rsp_t test_phy_end_rsp; + struct ble_msg_test_get_channel_map_rsp_t test_get_channel_map_rsp; + struct ble_msg_test_debug_rsp_t test_debug_rsp; + struct ble_msg_dfu_reset_cmd_t dfu_reset_cmd; + struct ble_msg_dfu_flash_set_address_cmd_t dfu_flash_set_address_cmd; + struct ble_msg_dfu_flash_upload_cmd_t dfu_flash_upload_cmd; + struct ble_msg_dfu_boot_evt_t dfu_boot_evt; + struct ble_msg_dfu_flash_set_address_rsp_t dfu_flash_set_address_rsp; + struct ble_msg_dfu_flash_upload_rsp_t dfu_flash_upload_rsp; + struct ble_msg_dfu_flash_upload_finish_rsp_t dfu_flash_upload_finish_rsp; + }); -}ALIGNED; +} ALIGNED; /**Reset device**/ #define ble_cmd_system_reset(boot_in_dfu) ble_send_message (ble_cmd_system_reset_idx,boot_in_dfu) /**Hello - command for testing**/ @@ -2220,12 +2011,12 @@ union{ /**List all bonded devices**/ #define ble_cmd_sm_get_bonds() ble_send_message (ble_cmd_sm_get_bonds_idx) /** - Set out-of-band encryption data for device - Device does not allow any other kind of pairing except oob if oob data is set. - **/ + Set out-of-band encryption data for device + Device does not allow any other kind of pairing except oob if oob data is set. + **/ #define ble_cmd_sm_set_oob_data(oob_len,oob_data) ble_send_message (ble_cmd_sm_set_oob_data_idx,oob_len,oob_data) -/**Set GAP central/peripheral privacy flags - **/ +/**Set GAP central/peripheral privacy flags + **/ #define ble_cmd_gap_set_privacy_flags(peripheral_privacy,central_privacy) ble_send_message (ble_cmd_gap_set_privacy_flags_idx,peripheral_privacy,central_privacy) /**Set discoverable and connectable mode**/ #define ble_cmd_gap_set_mode(discover,connect) ble_send_message (ble_cmd_gap_set_mode_idx,discover,connect) @@ -2246,9 +2037,9 @@ union{ /**Set advertisement or scan response data. Use broadcast mode to advertise data**/ #define ble_cmd_gap_set_adv_data(set_scanrsp,adv_data_len,adv_data_data) ble_send_message (ble_cmd_gap_set_adv_data_idx,set_scanrsp,adv_data_len,adv_data_data) /**Sets device to Directed Connectable Mode - Uses fast advertisement procedure for 1.28s after which device enters nonconnectable mode. + Uses fast advertisement procedure for 1.28s after which device enters nonconnectable mode. If device has valid reconnection characteristic value, it is used for connection - otherwise passed address and address type are used + otherwise passed address and address type are used **/ #define ble_cmd_gap_set_directed_connectable_mode(address,addr_type) ble_send_message (ble_cmd_gap_set_directed_connectable_mode_idx,address,addr_type) /**Configure I/O-port interrupts**/ @@ -2468,13 +2259,13 @@ void ble_rsp_sm_passkey_entry(const struct ble_msg_sm_passkey_entry_rsp_t *msg); void ble_rsp_sm_get_bonds(const struct ble_msg_sm_get_bonds_rsp_t *msg); /** - Set out-of-band encryption data for device - Device does not allow any other kind of pairing except oob if oob data is set. - **/ + Set out-of-band encryption data for device + Device does not allow any other kind of pairing except oob if oob data is set. + **/ void ble_rsp_sm_set_oob_data(const void *nul); -/**Set GAP central/peripheral privacy flags - **/ +/**Set GAP central/peripheral privacy flags + **/ void ble_rsp_gap_set_privacy_flags(const void *nul); /**Set discoverable and connectable mode**/ @@ -2505,9 +2296,9 @@ void ble_rsp_gap_set_adv_parameters(const struct ble_msg_gap_set_adv_parameters_ void ble_rsp_gap_set_adv_data(const struct ble_msg_gap_set_adv_data_rsp_t *msg); /**Sets device to Directed Connectable Mode - Uses fast advertisement procedure for 1.28s after which device enters nonconnectable mode. + Uses fast advertisement procedure for 1.28s after which device enters nonconnectable mode. If device has valid reconnection characteristic value, it is used for connection - otherwise passed address and address type are used + otherwise passed address and address type are used **/ void ble_rsp_gap_set_directed_connectable_mode(const struct ble_msg_gap_set_directed_connectable_mode_rsp_t *msg); @@ -2690,17 +2481,16 @@ void ble_evt_dfu_boot(const struct ble_msg_dfu_boot_evt_t *msg); -struct ble_class_handler_t -{ - const struct ble_msg **msgs; - uint8 maxhandlers; +struct ble_class_handler_t { + const struct ble_msg **msgs; + uint8 maxhandlers; }; extern struct ble_class_handler_t ble_class_rsp_handlers[ble_cls_last]; -extern struct ble_class_handler_t ble_class_evt_handlers[ble_cls_last]; - -void ble_default(const void*); +extern struct ble_class_handler_t ble_class_evt_handlers[ble_cls_last]; + +void ble_default(const void *); #ifdef __cplusplus } #endif - + #endif diff --git a/sw/tools/bluegiga_usb_dongle/main.c b/sw/tools/bluegiga_usb_dongle/main.c index 1514c06653..e098263059 100644 --- a/sw/tools/bluegiga_usb_dongle/main.c +++ b/sw/tools/bluegiga_usb_dongle/main.c @@ -1,3 +1,14 @@ +/* + * This file is derived from an example Bluegiga ANSI C BGLib demo application: Health Thermometer Collector + * This is an intermediately program meant to bridge the connection between paparazzi ground station + * and a paparazzi controlled drone with a bluetooth unit. The bluetooth unit needs to be flashed with + * the code as found in the "Onboard" folder. + * + * Author: Kirk Scheper + * Email: kirkscheper@gmail.com + * Last edit: 19/10/15 + */ + // Bluegiga ANSI C BGLib demo application: Health Thermometer Collector // // Contact: support@bluegiga.com @@ -155,12 +166,14 @@ int count[8] = {0, 0, 0, 0, 0, 0, 0, 0}, send_count[8] = {0, 0, 0, 0, 0, 0, 0, 0 int rssi_count = 0; int last0 = 0, last1 = 0; +uint8_t connection_interval = 10; // connection interval in ms + int ac_id[8] = { -1, -1, -1, -1, -1, -1, -1, -1}; -unsigned int insert_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}, - extract_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}, - send_insert_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}, - send_extract_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +unsigned int insert_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +unsigned int extract_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +unsigned int send_insert_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +unsigned int send_extract_idx[8] = {0, 0, 0, 0, 0, 0, 0, 0}; #define CLARG_PORT 1 #define CLARG_ACTION 2 @@ -190,14 +203,14 @@ enum actions action = action_none; // list all possible states typedef enum { - state_disconnected, // start/idle state - state_connecting, // connection in progress but not established - state_connected, // connection established - state_finding_services, // listing services (searching for services) - state_finding_attributes, // listing attributes (searching for characteristics) - state_listening_measurements, // indications enabled, waiting for updates from sensor - state_finish, // application process complete, will exit immediately - state_last // enum tail placeholder + state_disconnected, // start/idle state + state_connecting, // connection in progress but not established + state_connected, // connection established + state_finding_services, // listing services (searching for services) + state_finding_attributes, // listing attributes (searching for characteristics) + state_listening_measurements, // indications enabled, waiting for updates from sensor + state_finish, // application process complete, will exit immediately + state_last // enum tail placeholder } states; states state = state_disconnected; @@ -231,10 +244,12 @@ bd_addr connect_addr; void usage(char *exe) { - fprintf(stderr,"Missing arguments, Possible call structure:\n"); - fprintf(stderr,"[lists available com ports] %s list\n", exe); - fprintf(stderr,"[Connect direct to one drone]%s \n", exe); - fprintf(stderr,"[Scan and connect to all drones] %s \n", exe); + fprintf(stderr, "Missing arguments, Possible call structure:\n"); + fprintf(stderr, "[lists available com ports] %s list\n", exe); + fprintf(stderr, "[Connect direct to one drone]%s \n", + exe); + fprintf(stderr, "[Scan and connect to all drones] %s \n", + exe); } /** @@ -245,7 +260,7 @@ void usage(char *exe) void change_state(states new_state) { #ifdef DEBUG - fprintf(stderr,"DEBUG: State changed: %s --> %s\n", state_names[state], state_names[new_state]); + fprintf(stderr, "DEBUG: State changed: %s --> %s\n", state_names[state], state_names[new_state]); #endif state = new_state; } @@ -288,13 +303,13 @@ int cmp_addr(const uint8 first[], const uint8 second[]) */ void print_bdaddr(bd_addr bdaddr) { - fprintf(stderr,"%02x:%02x:%02x:%02x:%02x:%02x", - bdaddr.addr[5], - bdaddr.addr[4], - bdaddr.addr[3], - bdaddr.addr[2], - bdaddr.addr[1], - bdaddr.addr[0]); + fprintf(stderr, "%02x:%02x:%02x:%02x:%02x:%02x", + bdaddr.addr[5], + bdaddr.addr[4], + bdaddr.addr[3], + bdaddr.addr[2], + bdaddr.addr[1], + bdaddr.addr[0]); } /** @@ -306,15 +321,15 @@ void print_bdaddr(bd_addr bdaddr) */ void print_raw_packet(struct ble_header *hdr, unsigned char *data) { - fprintf(stderr,"Incoming packet: "); + fprintf(stderr, "Incoming packet: "); int i; for (i = 0; i < sizeof(*hdr); i++) { - fprintf(stderr,"%02x ", ((unsigned char *)hdr)[i]); + fprintf(stderr, "%02x ", ((unsigned char *)hdr)[i]); } for (i = 0; i < hdr->lolen; i++) { - fprintf(stderr,"%02x ", data[i]); + fprintf(stderr, "%02x ", data[i]); } - fprintf(stderr,"\n"); + fprintf(stderr, "\n"); } /** @@ -328,12 +343,12 @@ void print_raw_packet(struct ble_header *hdr, unsigned char *data) void send_api_packet(uint8 len1, uint8 *data1, uint16 len2, uint8 *data2) { #ifdef DEBUG - // display outgoing BGAPI packet - print_raw_packet((struct ble_header *)data1, data2, 1); + // display outgoing BGAPI packet + print_raw_packet((struct ble_header *)data1, data2, 1); #endif if (uart_tx(len1, data1) || uart_tx(len2, data2)) { // uart_tx returns non-zero on failure - fprintf(stderr,"ERROR: Writing to serial port failed\n"); + fprintf(stderr, "ERROR: Writing to serial port failed\n"); exit(1); } } @@ -351,33 +366,32 @@ int read_api_packet(int timeout_ms) r = uart_rx(sizeof(hdr), (unsigned char *)&hdr, timeout_ms); if (!r) { - return -1; // timeout - } - else if (r < 0) { - printf("ERROR: Reading header failed. Error code:%d\n", r); - return 1; + return -1; // timeout + } else if (r < 0) { + printf("ERROR: Reading header failed. Error code:%d\n", r); + return 1; } if (hdr.lolen) { - r = uart_rx(hdr.lolen, data, timeout_ms); - if (r <= 0) { - printf("ERROR: Reading data failed. Error code:%d\n", r); - return 1; - } + r = uart_rx(hdr.lolen, data, timeout_ms); + if (r <= 0) { + printf("ERROR: Reading data failed. Error code:%d\n", r); + return 1; + } } // use BGLib function to create correct ble_msg structure based on the header // (header contains command class/ID info, used to identify the right structure to apply) const struct ble_msg *msg = ble_get_msg_hdr(hdr); - #ifdef DEBUG - // display incoming BGAPI packet - print_raw_packet(&hdr, data, 0); - #endif +#ifdef DEBUG + // display incoming BGAPI packet + print_raw_packet(&hdr, data, 0); +#endif if (!msg) { - printf("ERROR: Unknown message received\n"); - exit(1); + printf("ERROR: Unknown message received\n"); + exit(1); } // call the appropriate handler function with any payload data @@ -411,14 +425,14 @@ void enable_indications(uint8 connection_handle, uint16 client_configuration_han */ void ble_rsp_system_get_info(const struct ble_msg_system_get_info_rsp_t *msg) { - fprintf(stderr,"Build: %u, protocol_version: %u, hardware: ", msg->build, msg->protocol_version); + fprintf(stderr, "Build: %u, protocol_version: %u, hardware: ", msg->build, msg->protocol_version); switch (msg->hw) { - case 0x01: printf("BLE112"); break; - case 0x02: printf("BLE113"); break; - case 0x03: printf("BLED112"); break; - default: printf("Unknown"); + case 0x01: printf("BLE112"); break; + case 0x02: printf("BLE113"); break; + case 0x03: printf("BLED112"); break; + default: printf("Unknown"); } - fprintf(stderr,"\n"); + fprintf(stderr, "\n"); if (action == action_info) { change_state(state_finish); } } @@ -433,14 +447,14 @@ void ble_rsp_system_get_info(const struct ble_msg_system_get_info_rsp_t *msg) void ble_evt_gap_scan_response(const struct ble_msg_gap_scan_response_evt_t *msg) { if (action == action_broadcast) { - fprintf(stderr,"advertisement from: "); + fprintf(stderr, "advertisement from: "); print_bdaddr(msg->sender); - fprintf(stderr," data: "); + fprintf(stderr, " data: "); int i; for (i = 0; i < msg->data.len; i++) { - fprintf(stderr,"%02x ", msg->data.data[i]); + fprintf(stderr, "%02x ", msg->data.data[i]); } - fprintf(stderr,"\n"); + fprintf(stderr, "\n"); if (sock[0]) sendto(sock[0], msg->data.data, msg->data.len, MSG_DONTWAIT, (struct sockaddr *)&send_addr[0], sizeof(struct sockaddr)); @@ -451,7 +465,7 @@ void ble_evt_gap_scan_response(const struct ble_msg_gap_scan_response_evt_t *msg // Check if this device already found, if not add to the list if (!connect_all) { - fprintf(stderr,"New device found: "); + fprintf(stderr, "New device found: "); // Parse data for (i = 0; i < msg->data.len;) { @@ -460,15 +474,15 @@ void ble_evt_gap_scan_response(const struct ble_msg_gap_scan_response_evt_t *msg if (i + len > msg->data.len) { break; } // not enough data uint8 type = msg->data.data[i++]; switch (type) { - case 0x01: + case 0x01: // flags field break; - case 0x02: + case 0x02: // partial list of 16-bit UUIDs - case 0x03: + case 0x03: // complete list of 16-bit UUIDs - /* + /* for (j = 0; j < len - 1; j += 2) { // loop through UUIDs 2 bytes at a time @@ -482,28 +496,26 @@ void ble_evt_gap_scan_response(const struct ble_msg_gap_scan_response_evt_t *msg */ break; - case 0x04: + case 0x04: // partial list of 32-bit UUIDs - case 0x05: + case 0x05: // complete list of 32-bit UUIDs - for (j = 0; j < len - 1; j += 4) - { - // loop through UUIDs 4 bytes at a time - // TODO: test for desired UUID here, if 32-bit UUID + for (j = 0; j < len - 1; j += 4) { + // loop through UUIDs 4 bytes at a time + // TODO: test for desired UUID here, if 32-bit UUID } break; - case 0x06: + case 0x06: // partial list of 128-bit UUIDs - case 0x07: + case 0x07: // complete list of 128-bit UUIDs - for (j = 0; j < len - 1; j += 16) - { - // loop through UUIDs 16 bytes at a time - // TODO: test for desired UUID here, if 128-bit UUID + for (j = 0; j < len - 1; j += 16) { + // loop through UUIDs 16 bytes at a time + // TODO: test for desired UUID here, if 128-bit UUID } break; - case 0x09: // device name + case 0x09: // device name name = malloc(len); memcpy(name, msg->data.data + i, len - 1); name[len - 1] = '\0'; @@ -514,17 +526,17 @@ void ble_evt_gap_scan_response(const struct ble_msg_gap_scan_response_evt_t *msg print_bdaddr(msg->sender); // printf(" RSSI:%d", msg->rssi); - fprintf(stderr," Name:"); - if (name) { fprintf(stderr,"%s", name); } - else { fprintf(stderr,"Unknown"); } - fprintf(stderr,"\n"); + fprintf(stderr, " Name:"); + if (name) { fprintf(stderr, "%s", name); } + else { fprintf(stderr, "Unknown"); } + fprintf(stderr, "\n"); free(name); } // automatically connect if responding device has appropriate mac address header if (connect_all && cmp_addr(msg->sender.addr, MAC_ADDR) >= 4) { - fprintf(stderr,"Trying to connect to "); print_bdaddr(msg->sender); fprintf(stderr,"\n"); + fprintf(stderr, "Trying to connect to "); print_bdaddr(msg->sender); fprintf(stderr, "\n"); //change_state(state_connecting); // connection interval unit 1.25ms // connection interval must be divisible by number of connection * 2.5ms and larger than minimum (7.5ms) @@ -537,7 +549,7 @@ void ble_evt_gap_scan_response(const struct ble_msg_gap_scan_response_evt_t *msg // - 48 = 16*1.25ms = 20ms maximum connection interval // - 100 = 100*10ms = 1000ms supervision timeout // - 9 = 9 connection interval max slave latency - ble_cmd_gap_connect_direct(&msg->sender.addr, gap_address_type_public, 6, 16, 100, 9); + ble_cmd_gap_connect_direct(&msg->sender.addr, gap_address_type_public, 6, 16, 100, 0); } } } @@ -552,20 +564,21 @@ void ble_evt_connection_status(const struct ble_msg_connection_status_evt_t *msg { // updated connection if (msg->flags & connection_parameters_change) { - fprintf(stderr,"Connection %d parameters updated, interval %fms\n", msg->connection, msg->conn_interval * 1.25); + fprintf(stderr, "Connection %d parameters updated, interval %fms\n", msg->connection, msg->conn_interval * 1.25); } // Encrypted previous connection else if (msg->flags & connection_encrypted) { - fprintf(stderr,"Connection with %d is encrypted\n", msg->connection); + fprintf(stderr, "Connection with %d is encrypted\n", msg->connection); } // Connection request completed else if (msg->flags & connection_completed) { if (msg->connection + 1 > connected_devices) { connected_devices++; } //change_state(state_connected); - fprintf(stderr,"Connected, nr: %d, connection interval: %d = %fms\n", msg->connection, msg->conn_interval, - msg->conn_interval * 1.25); + connection_interval = msg->conn_interval * 1.25; + fprintf(stderr, "Connected, nr: %d, connection interval: %d = %fms\n", msg->connection, msg->conn_interval, + msg->conn_interval * 1.25); connected[msg->connection] = 1; if (rec_addr[msg->connection].sin_family != AF_INET && send_port && recv_port) { @@ -591,7 +604,7 @@ void ble_evt_connection_status(const struct ble_msg_connection_status_evt_t *msg perror("Bind failed"); exit(1); } - fprintf(stderr,"Comms port opened on port: %d %d\n", send_port + msg->connection, recv_port + msg->connection); + fprintf(stderr, "Comms port opened on port: %d %d\n", send_port + msg->connection, recv_port + msg->connection); } // Handle for Drone Data configuration already known @@ -623,7 +636,7 @@ void ble_evt_attclient_group_found(const struct ble_msg_attclient_group_found_ev uint16 uuid = (msg->uuid.data[1] << 8) | msg->uuid.data[0]; if (state == state_finding_services) { - fprintf(stderr,"length: %d uuid: %x\n", msg->uuid.len, uuid); + fprintf(stderr, "length: %d uuid: %x\n", msg->uuid.len, uuid); } // First data service found @@ -646,7 +659,7 @@ void ble_evt_attclient_procedure_completed(const struct ble_msg_attclient_proced if (state == state_finding_services) { // Data service not found if (drone_handle_start == 0) { - fprintf(stderr,"No Drone service found\n"); + fprintf(stderr, "No Drone service found\n"); change_state(state_finish); } // Find drone service attributes @@ -657,7 +670,7 @@ void ble_evt_attclient_procedure_completed(const struct ble_msg_attclient_proced } else if (state == state_finding_attributes) { // Client characteristic configuration not found if (drone_handle_configuration == 0) { - fprintf(stderr,"No Client Characteristic Configuration found for Drone Data service\n"); + fprintf(stderr, "No Client Characteristic Configuration found for Drone Data service\n"); change_state(state_finish); } // Enable drone notifications @@ -728,7 +741,7 @@ void ble_evt_attclient_attribute_value(const struct ble_msg_attclient_attribute_ if (ac_id[msg->connection] == -1 && msg->value.data[0] == 0x99) { ac_id[msg->connection] = msg->value.data[2]; - fprintf(stderr,"\nAC_ID = %d\n", ac_id[msg->connection]); + fprintf(stderr, "\nAC_ID = %d\n", ac_id[msg->connection]); } //memcpy(&send_buf[msg->connection][send_insert_idx[msg->connection]], msg->value.data, msg->value.len); @@ -755,10 +768,10 @@ void ble_evt_connection_disconnected(const struct ble_msg_connection_disconnecte // remove found device from list //change_state(state_disconnected); - fprintf(stderr,"Connection %d terminated\n" , msg->connection); + fprintf(stderr, "Connection %d terminated\n" , msg->connection); if (!connect_all) { - ble_cmd_gap_connect_direct(&connect_addr, gap_address_type_public, 6, 16, 100, 9); - fprintf(stderr,"Trying to reconnection to "); + ble_cmd_gap_connect_direct(&connect_addr, gap_address_type_public, 6, 16, 100, 0); + fprintf(stderr, "Trying to reconnection to "); print_bdaddr(connect_addr); } //change_state(state_connecting); @@ -768,19 +781,19 @@ void ble_evt_connection_disconnected(const struct ble_msg_connection_disconnecte void ble_rsp_connection_update(const struct ble_msg_connection_update_rsp_t *msg) { - fprintf(stderr,"Connection update result from %d: %x\n", msg->connection, msg->result); + fprintf(stderr, "Connection update result from %d: %x\n", msg->connection, msg->result); } void ble_rsp_system_address_get(const struct ble_msg_system_address_get_rsp_t *msg) { - fprintf(stderr,"My address: "); + fprintf(stderr, "My address: "); print_bdaddr(msg->address); - fprintf(stderr,"\n"); + fprintf(stderr, "\n"); } void *send_msg() { - fprintf(stderr,"Bluegiga comms thread started\n"); + fprintf(stderr, "Bluegiga comms thread started\n"); uint8_t device = 0, bt_msg_len = 0; uint16_t diff = 0; while (state != state_finish) { @@ -806,7 +819,7 @@ void *send_msg() while (ac_id[device] != -1 && device < 8) { diff = (insert_idx[device] - extract_idx[device] + BUF_SIZE) % BUF_SIZE; if (diff) { - bt_msg_len = diff < 18 ? diff : 18; + bt_msg_len = diff < 19 ? diff : 19; // msg length in max 20 but one header byte added on bluegiga to lisa //if (bt_msg_len > 18) // fprintf(stderr,"Long msg: %d, buff size: %d\n", bt_msg_len, diff); //ble_cmd_attclient_attribute_write(device, drone_handle_measurement, bt_msg_len[device], &data_buf[device][extract_idx[device]]); @@ -816,7 +829,7 @@ void *send_msg() } device++; } // next device - usleep(10000); // ~100Hz, max spi speed on lisa is 200Hz + usleep(connection_interval * 1000); // send messages at max intervals of the connection interval } // repeat } pthread_exit(NULL); @@ -824,19 +837,18 @@ void *send_msg() void *recv_paparazzi_comms() { - fprintf(stderr,"Paparazzi comms thread started\n"); + fprintf(stderr, "Paparazzi comms thread started\n"); unsigned char device = 0; while (state != state_finish) { if (state == state_listening_measurements) { if (action == action_broadcast) { if (sock[0]) { - bytes_recv = recvfrom(sock[0], recv_data, BUF_SIZE, MSG_DONTWAIT, (struct sockaddr *)&rec_addr[0], (socklen_t *)&sin_size); + bytes_recv = recvfrom(sock[0], recv_data, BUF_SIZE, MSG_DONTWAIT, (struct sockaddr *)&rec_addr[0], + (socklen_t *)&sin_size); if (bytes_recv > 0) { send_count[0] += bytes_recv; - // for (i = 0; i 0) { // TODO: can overtake extract! send_count[device] += bytes_recv; - // for (i = 0; i 0) break; + if (read_api_packet(UART_TIMEOUT) > 0) { break; } } change_state(state_finish); diff --git a/sw/tools/bluegiga_usb_dongle/stubs.c b/sw/tools/bluegiga_usb_dongle/stubs.c index ef73a50e2d..95240bf3cf 100644 --- a/sw/tools/bluegiga_usb_dongle/stubs.c +++ b/sw/tools/bluegiga_usb_dongle/stubs.c @@ -394,7 +394,7 @@ void ble_rsp_test_debug(const struct ble_msg_test_debug_rsp_t *msg) void ble_rsp_test_channel_mode(const void *nul) { -} +} void ble_rsp_dfu_reset(const void *nul) { diff --git a/sw/tools/bluegiga_usb_dongle/uart.c b/sw/tools/bluegiga_usb_dongle/uart.c index 60afa4633a..9e63e06e77 100644 --- a/sw/tools/bluegiga_usb_dongle/uart.c +++ b/sw/tools/bluegiga_usb_dongle/uart.c @@ -13,7 +13,7 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // @@ -29,9 +29,9 @@ #include "uart.h" #ifdef PLATFORM_WIN - #ifdef _MSC_VER - #define snprintf _snprintf - #endif +#ifdef _MSC_VER +#define snprintf _snprintf +#endif // Windows implementation of UART access // see https://msdn.microsoft.com/en-us/library/aa363194(v=vs.85).aspx for reference @@ -43,181 +43,183 @@ HANDLE serial_handle; DCB dcb; // Windows-only serial port device listing -void uart_list_devices() { - char name[] = "Bluegiga Bluetooth Low Energy"; +void uart_list_devices() +{ + char name[] = "Bluegiga Bluetooth Low Energy"; - BYTE* pbuf = NULL; - DWORD reqSize = 0; - DWORD n = 0; - HDEVINFO hDevInfo; + BYTE *pbuf = NULL; + DWORD reqSize = 0; + DWORD n = 0; + HDEVINFO hDevInfo; - //guid for ports - static const GUID guid = { 0x4d36e978, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; + //guid for ports + static const GUID guid = { 0x4d36e978, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; - char *str; - char tmp[MAX_PATH + 1]; - int i; - SP_DEVINFO_DATA DeviceInfoData; + char *str; + char tmp[MAX_PATH + 1]; + int i; + SP_DEVINFO_DATA DeviceInfoData; - snprintf(tmp, MAX_PATH, "%s (COM%%d)", name); + snprintf(tmp, MAX_PATH, "%s (COM%%d)", name); - DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); - hDevInfo = SetupDiGetClassDevs(&guid, //Retrieve all ports - 0L, - NULL, DIGCF_PRESENT); - if(hDevInfo == INVALID_HANDLE_VALUE) - return; - - while (1) { - if (!SetupDiEnumDeviceInfo(hDevInfo, n++, &DeviceInfoData)) - { - SetupDiDestroyDeviceInfoList(hDevInfo); - return; - } - reqSize = 0; - SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, NULL, 0, &reqSize); - pbuf = (BYTE*)malloc(reqSize > 1 ? reqSize : 1); - if (!SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, pbuf, reqSize, NULL)) - { - free(pbuf); - continue; - } - str = (char*)pbuf; - if (sscanf(str, tmp, &i) == 1) - { - printf("%s\n", str); - //emit DeviceFound(str,QString("\\\\.\\COM%1").arg(i)); - } - free(pbuf); - } + DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + hDevInfo = SetupDiGetClassDevs(&guid, //Retrieve all ports + 0L, + NULL, DIGCF_PRESENT); + if (hDevInfo == INVALID_HANDLE_VALUE) { return; + } + + while (1) { + if (!SetupDiEnumDeviceInfo(hDevInfo, n++, &DeviceInfoData)) { + SetupDiDestroyDeviceInfoList(hDevInfo); + return; + } + reqSize = 0; + SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, NULL, 0, &reqSize); + pbuf = (BYTE *)malloc(reqSize > 1 ? reqSize : 1); + if (!SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, pbuf, reqSize, NULL)) { + free(pbuf); + continue; + } + str = (char *)pbuf; + if (sscanf(str, tmp, &i) == 1) { + printf("%s\n", str); + //emit DeviceFound(str,QString("\\\\.\\COM%1").arg(i)); + } + free(pbuf); + } + return; } -int uart_find_serialport(char *name) { - BYTE* pbuf = NULL; - DWORD reqSize = 0; - DWORD n = 0; - HDEVINFO hDevInfo; - // GUID for ports - static const GUID guid = { 0x4d36e978, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; - char *str; - char tmp[MAX_PATH+1]; - int i; - SP_DEVINFO_DATA DeviceInfoData; +int uart_find_serialport(char *name) +{ + BYTE *pbuf = NULL; + DWORD reqSize = 0; + DWORD n = 0; + HDEVINFO hDevInfo; + // GUID for ports + static const GUID guid = { 0x4d36e978, 0xe325, 0x11ce, { 0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 } }; + char *str; + char tmp[MAX_PATH + 1]; + int i; + SP_DEVINFO_DATA DeviceInfoData; - snprintf(tmp, MAX_PATH, "%s (COM%%d)", name); + snprintf(tmp, MAX_PATH, "%s (COM%%d)", name); - DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); - hDevInfo = SetupDiGetClassDevs(&guid, 0L, NULL, DIGCF_PRESENT); - if(hDevInfo == INVALID_HANDLE_VALUE) - return -1; - - while (1) { - if (!SetupDiEnumDeviceInfo(hDevInfo, n++, &DeviceInfoData)) - { - SetupDiDestroyDeviceInfoList(hDevInfo); - return -1; - } - reqSize = 0; - SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, NULL, 0, &reqSize); - pbuf = malloc(reqSize > 1 ? reqSize : 1); - if (!SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, pbuf, reqSize, NULL)) - { - free(pbuf); - continue; - } - str = (char*)pbuf; - if (sscanf(str, tmp, &i) == 1) - { - free(pbuf); - SetupDiDestroyDeviceInfoList(hDevInfo); - return i; - } - free(pbuf); - } + DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + hDevInfo = SetupDiGetClassDevs(&guid, 0L, NULL, DIGCF_PRESENT); + if (hDevInfo == INVALID_HANDLE_VALUE) { return -1; + } + + while (1) { + if (!SetupDiEnumDeviceInfo(hDevInfo, n++, &DeviceInfoData)) { + SetupDiDestroyDeviceInfoList(hDevInfo); + return -1; + } + reqSize = 0; + SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, NULL, 0, &reqSize); + pbuf = malloc(reqSize > 1 ? reqSize : 1); + if (!SetupDiGetDeviceRegistryPropertyA(hDevInfo, &DeviceInfoData, SPDRP_FRIENDLYNAME, NULL, pbuf, reqSize, NULL)) { + free(pbuf); + continue; + } + str = (char *)pbuf; + if (sscanf(str, tmp, &i) == 1) { + free(pbuf); + SetupDiDestroyDeviceInfoList(hDevInfo); + return i; + } + free(pbuf); + } + return -1; } -int uart_open(char *port) { - char str[20]; +int uart_open(char *port) +{ + char str[20]; - snprintf(str, sizeof(str) - 1, "\\\\.\\%s", port); - serial_handle = CreateFileA(str, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - 0, //FILE_FLAG_OVERLAPPED, - NULL); + snprintf(str, sizeof(str) - 1, "\\\\.\\%s", port); + serial_handle = CreateFileA(str, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, //FILE_FLAG_OVERLAPPED, + NULL); - if (serial_handle == INVALID_HANDLE_VALUE) { - return -1; - } + if (serial_handle == INVALID_HANDLE_VALUE) { + return -1; + } - memset(&dcb, 0, sizeof(DCB)); - dcb.DCBlength = sizeof(DCB); - // 115200 bps, 8 data bits, no parity, and 1 stop bit - dcb.BaudRate = CBR_115200; // baud rate - dcb.ByteSize = 8; // data size, xmit and rcv - dcb.Parity = NOPARITY; // parity bit - dcb.StopBits = ONESTOPBIT; // stop bit - dcb.fOutxCtsFlow = 1; // CTS flow control monitoring - dcb.fRtsControl = 1; // RTS flow control output - - if (!SetCommState(serial_handle, &dcb)) { - return -2; - } + memset(&dcb, 0, sizeof(DCB)); + dcb.DCBlength = sizeof(DCB); + // 115200 bps, 8 data bits, no parity, and 1 stop bit + dcb.BaudRate = CBR_115200; // baud rate + dcb.ByteSize = 8; // data size, xmit and rcv + dcb.Parity = NOPARITY; // parity bit + dcb.StopBits = ONESTOPBIT; // stop bit + dcb.fOutxCtsFlow = 1; // CTS flow control monitoring + dcb.fRtsControl = 1; // RTS flow control output - return 0; + if (!SetCommState(serial_handle, &dcb)) { + return -2; + } + + return 0; } -void uart_close() { - CloseHandle(serial_handle); +void uart_close() +{ + CloseHandle(serial_handle); } -int uart_tx(int len, unsigned char *data) { - DWORD r, written; - while (len) { - r = WriteFile(serial_handle, data, len, &written, NULL); - if (!r) { - return -1; - } - len -= written; - data += written; +int uart_tx(int len, unsigned char *data) +{ + DWORD r, written; + while (len) { + r = WriteFile(serial_handle, data, len, &written, NULL); + if (!r) { + return -1; } - return 0; + len -= written; + data += written; + } + return 0; } -int uart_rx(int len, unsigned char *data, int timeout_ms) { - int l = len; - DWORD r, rread; - COMMTIMEOUTS timeouts; - - timeouts.ReadIntervalTimeout = MAXDWORD; - timeouts.ReadTotalTimeoutMultiplier = 0; - timeouts.ReadTotalTimeoutConstant = timeout_ms; - timeouts.WriteTotalTimeoutMultiplier = 0; - timeouts.WriteTotalTimeoutConstant = 0; - SetCommTimeouts(serial_handle, &timeouts); - - while (len) { - r = ReadFile(serial_handle, data, len, &rread, NULL); - if (!r) { - l = GetLastError(); - if (l == ERROR_SUCCESS) { - return 0; - } - return -1; - } else { - if (rread == 0) { - return 0; - } - } - len -= rread; - data += rread; - } +int uart_rx(int len, unsigned char *data, int timeout_ms) +{ + int l = len; + DWORD r, rread; + COMMTIMEOUTS timeouts; - return l; + timeouts.ReadIntervalTimeout = MAXDWORD; + timeouts.ReadTotalTimeoutMultiplier = 0; + timeouts.ReadTotalTimeoutConstant = timeout_ms; + timeouts.WriteTotalTimeoutMultiplier = 0; + timeouts.WriteTotalTimeoutConstant = 0; + SetCommTimeouts(serial_handle, &timeouts); + + while (len) { + r = ReadFile(serial_handle, data, len, &rread, NULL); + if (!r) { + l = GetLastError(); + if (l == ERROR_SUCCESS) { + return 0; + } + return -1; + } else { + if (rread == 0) { + return 0; + } + } + len -= rread; + data += rread; + } + + return l; } #else // POSIX or Mac OS X @@ -252,34 +254,35 @@ int uart_open(char *port) */ tcgetattr(serial_handle, &options); - /* - * Set the baud rates to 115200... - */ - cfsetispeed(&options, B115200); - cfsetospeed(&options, B115200); + /* + * Set the baud rates to 115200... + */ + cfsetispeed(&options, B115200); + cfsetospeed(&options, B115200); - /* - * Enable the receiver and set parameters ... - */ - options.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS | HUPCL); - options.c_cflag |= (CS8 | CLOCAL | CREAD); - options.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHONL | ECHOCTL | ECHOPRT | ECHOKE | IEXTEN); - options.c_iflag &= ~(INPCK | IXON | IXOFF | IXANY | ICRNL); - options.c_oflag &= ~(OPOST | ONLCR); + /* + * Enable the receiver and set parameters ... + */ + options.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS | HUPCL); + options.c_cflag |= (CS8 | CLOCAL | CREAD); + options.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHONL | ECHOCTL | ECHOPRT | ECHOKE | IEXTEN); + options.c_iflag &= ~(INPCK | IXON | IXOFF | IXANY | ICRNL); + options.c_oflag &= ~(OPOST | ONLCR); - //printf( "size of c_cc = %d\n", sizeof( options.c_cc ) ); - for (i = 0; i < sizeof(options.c_cc); i++) - options.c_cc[i] = _POSIX_VDISABLE; + //printf( "size of c_cc = %d\n", sizeof( options.c_cc ) ); + for (i = 0; i < sizeof(options.c_cc); i++) { + options.c_cc[i] = _POSIX_VDISABLE; + } - options.c_cc[VTIME] = 0; - options.c_cc[VMIN] = 1; + options.c_cc[VTIME] = 0; + options.c_cc[VMIN] = 1; - /* - * Set the new options for the port... - */ - tcsetattr(serial_handle, TCSAFLUSH, &options); + /* + * Set the new options for the port... + */ + tcsetattr(serial_handle, TCSAFLUSH, &options); - return 0; + return 0; } void uart_close() { @@ -290,16 +293,16 @@ int uart_tx(int len, unsigned char *data) { ssize_t written; - while (len) { - written = write(serial_handle, data, len); - if (written < 1) { - return -1; - } - len -= written; - data += written; + while (len) { + written = write(serial_handle, data, len); + if (written < 1) { + return -1; } + len -= written; + data += written; + } - return 0; + return 0; } int uart_rx(int len, unsigned char *data, int timeout_ms) { diff --git a/sw/tools/bluegiga_usb_dongle/uart.h b/sw/tools/bluegiga_usb_dongle/uart.h index 216adc82e0..a4d4ab48d8 100644 --- a/sw/tools/bluegiga_usb_dongle/uart.h +++ b/sw/tools/bluegiga_usb_dongle/uart.h @@ -13,7 +13,7 @@ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. //