Partial implementation of BlueGiga's BGAPI for use with the BLE112/3 modules over UART.

Hi there! I recently started using BLE112 modules with the mbed LPC1768 MCU, and I realized there was no implementation of BlueGiga's BGAPI available for mbed. This library implements only a few commands, but if you're looking to get started, this is a good place to look.

This was developed against BGAPI v1.3.2. I make no guarantees as to how well it will work with newer revisions of the software.

Committer:
dishbreak
Date:
Tue May 19 07:30:40 2015 +0000
Revision:
7:63daf39f20e1
Parent:
6:23d9a99dcde0
Adding Scan Result callback support.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dishbreak 2:3ce9a31a6a7e 1 #ifndef API_DATATYPES_H
dishbreak 2:3ce9a31a6a7e 2 #define API_DATATYPES_H
dishbreak 6:23d9a99dcde0 3 /** @file api_datatypes.h
dishbreak 6:23d9a99dcde0 4 * @brief Data structures that the API uses for responses and commands. */
dishbreak 2:3ce9a31a6a7e 5
dishbreak 2:3ce9a31a6a7e 6 /** Data structure returned from Get Info command. */
dishbreak 2:3ce9a31a6a7e 7 typedef struct {
dishbreak 6:23d9a99dcde0 8 uint16_t major; ///< Major version (e.g. 1)
dishbreak 6:23d9a99dcde0 9 uint16_t minor; ///< Minor version (e.g. 3)
dishbreak 6:23d9a99dcde0 10 uint16_t patch; ///< Patch version (e.g. 2)
dishbreak 6:23d9a99dcde0 11 uint16_t build; ///< Build number (e.g. 122)
dishbreak 6:23d9a99dcde0 12 uint16_t ll_version; ///< Link Layer Version
dishbreak 6:23d9a99dcde0 13 uint8_t protocol_version; ///< BGAPI Version
dishbreak 6:23d9a99dcde0 14 uint8_t hw; ///< Hardware Version
dishbreak 2:3ce9a31a6a7e 15 } ble_msg_system_get_info_rsp_t;
dishbreak 2:3ce9a31a6a7e 16
dishbreak 2:3ce9a31a6a7e 17
dishbreak 5:7c7220a316ed 18 /** Data structure passed into the Reset command. */
dishbreak 3:8f43af513d87 19 typedef struct {
dishbreak 6:23d9a99dcde0 20 uint8_t boot_in_dfu; ///< Determine whether or not to boot into Device Firmware Update (DFU) mode. 1 for booting into DFU, 0 otherwise.
dishbreak 3:8f43af513d87 21 } ble_msg_system_reset_t;
dishbreak 3:8f43af513d87 22
dishbreak 6:23d9a99dcde0 23 /** Data structure returned from Boot event. */
dishbreak 3:8f43af513d87 24 typedef struct {
dishbreak 6:23d9a99dcde0 25 uint16_t major; ///< Major version (e.g. 1)
dishbreak 6:23d9a99dcde0 26 uint16_t minor; ///< Minor version (e.g. 3)
dishbreak 6:23d9a99dcde0 27 uint16_t patch; ///< Patch version (e.g. 2)
dishbreak 6:23d9a99dcde0 28 uint16_t build; ///< Build number (e.g. 122)
dishbreak 6:23d9a99dcde0 29 uint16_t ll_version; ///< Link Layer Version
dishbreak 6:23d9a99dcde0 30 uint8_t protocol_version; ///< BGAPI Version
dishbreak 6:23d9a99dcde0 31 uint8_t hw; ///< Hardware Version
dishbreak 3:8f43af513d87 32 } ble_msg_system_boot_evt_t;
dishbreak 3:8f43af513d87 33
dishbreak 6:23d9a99dcde0 34 /** Data structure returned from Discover command. */
dishbreak 6:23d9a99dcde0 35 typedef struct {
dishbreak 6:23d9a99dcde0 36 uint16_t result; ///< Result. Non-zero value indicates an error.
dishbreak 6:23d9a99dcde0 37 } ble_msg_gap_discover_rsp_t;
dishbreak 6:23d9a99dcde0 38
dishbreak 7:63daf39f20e1 39
dishbreak 7:63daf39f20e1 40
dishbreak 7:63daf39f20e1 41 /** Data structure representing a scan result */
dishbreak 7:63daf39f20e1 42 typedef struct {
dishbreak 7:63daf39f20e1 43 int8_t rssi; ///< RSSI value (dBm).
dishbreak 7:63daf39f20e1 44 uint8_t packet_type; ///< Scan response header.
dishbreak 7:63daf39f20e1 45 uint8_t hw_addr[6]; ///< BLE Hardware Address.
dishbreak 7:63daf39f20e1 46 uint8_t address_type; ///< Address type. 1 for random, 0 for public.
dishbreak 7:63daf39f20e1 47 uint8_t bond; ///< Bond handle if known bond for device, 0xff otherwise.
dishbreak 7:63daf39f20e1 48 uint8_t *data; ///< Service data.
dishbreak 7:63daf39f20e1 49 uint8_t data_len; ///< Service data length (in bytes).
dishbreak 7:63daf39f20e1 50 } ble_msg_gap_scan_result_evt_t;
dishbreak 7:63daf39f20e1 51
dishbreak 2:3ce9a31a6a7e 52 #endif