26 #ifndef M2MB_BLE_DRIVER_H 27 #define M2MB_BLE_DRIVER_H 54 #define M2MB_BLE_MAX_DEVICE_NAME_LENGTH (39+1) 55 #define M2MB_BLE_MAX_MANUFACTURER_NAME_LENGTH M2MB_BLE_MAX_DEVICE_NAME_LENGTH 56 #define M2MB_BLE_FIXPIN_SIZE 6 57 #define M2MB_BLE_ADV_DATA_SIZE 31 58 #define M2MB_BLE_SCAN_RSP_DATA_SIZE 31 59 #define M2MB_BLE_BOND_ENTRIES_MAX 20 61 #define M2MB_BLE_MAX_GATT_SERVER_SERVICES 10 63 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_HANDLE 0x01 64 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_READ_NOT_PERMITTED 0x02 65 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_WRITE_NOT_PERMITTED 0x03 66 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_PDU 0x04 67 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHENTICATION 0x05 68 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_REQUEST_NOT_SUPPORTED 0x06 69 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_OFFSET 0x07 70 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHORIZATION 0x08 71 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_FOUND 0x0A 72 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_LONG 0x0B 73 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0C 74 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_ATTRIBUTE_VALUE_LENGTH 0x0D 75 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION 0x0F 76 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNSUPPORTED_GROUP_TYPE 0x10 77 #define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_RESOURCES 0x11 79 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_BROADCAST 0x01 80 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_READ 0x02 81 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE 0x04 82 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE 0x08 83 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_NOTIFY 0x10 84 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_INDICATE 0x20 85 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_AUTHENTICATED_SIGNED_WRITES 0x40 86 #define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_EXTENDED_PROPERTIES 0x80 92 #define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_BLUETOOTH_SIG 0x01 93 #define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_USB_IMPLEMENTORS_FORUM 0x02 M2MB_BLE_CONNECTABILITY_MODE_T
Enumeration of BLE connectability modes.
Structure used for SSP confirmation.
#define M2MB_BLE_MAX_MANUFACTURER_NAME_LENGTH
UINT16 pnpid_product_version
M2MB_BLE_DISCOVERABILITY_MODE_T discover_mode
M2MB_BLE_DISCOVERABILITY_MODE_T
Enumeration of BLE discoverability modes.
M2MB_BLE_BD_ADDR_T BD_ADDR
Structure which stores all information of an GATT element.
UINT16 connection_interval_max
UINT16 advertise_interval_max
struct M2MB_BLE_BOND_LIST_INFO_S M2MB_BLE_BOND_LIST_INFO_T
Structure to hold information of bonded devices.
Structure for 128 bit UUID.
M2MB_BLE_RESPONSE_T m2mb_ble_set_phy(M2MB_BLE_HANDLE ble_handle, UINT8 conn_id, M2MB_BLE_PHYS_INFO_T phy_pref, M2MB_BLE_PHY_CODED_OPTIONS_T phy_coded_options)
Set the PHY options.
struct M2MB_BLE_CENTRAL_NOTIFY_INDICATE_DATA_S M2MB_BLE_CENTRAL_NOTIFY_INDICATE_DATA_T
Structure to hold notification and indication data from remote GATT server.
M2MB_BLE_GATT_SERVER_EVENT_DETAILS_T gatt_attrib
UINT32 peripheral_connect_id
struct M2MB_BLE_SECURITY_CFG_S M2MB_BLE_SECURITY_CFG_T
Structure for BLE security configuration parameters.
M2MB_BLE_RESPONSE_T m2mb_ble_bond_delete(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BD_ADDR_T bd_addr)
Deletes the bond information of a BLE device from the bonded list.
M2MB_BLE_DATA_LENGTH_CHANGE_INFO_T data_len
struct M2MB_BLE_DEVICE_INFO_S M2MB_BLE_DEVICE_INFO_T
Structure to hold connected peer BLE device information.
M2MB_BLE_RESPONSE_T m2mb_ble_conf(M2MB_BLE_HANDLE ble_handle, UINT8 num_cmds,...)
BLE configuration GET / SET.
Basic functionality of Operating systems.
void(* m2mb_ble_event_callback)(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_USER_EVENTS_T ble_event, UINT16 resp_size, void *resp, void *userdata)
BLE callback function prototype.
M2MB_BLE_ADDRESS_TYPE_T identity_address_type
M2MB_BLE_RESPONSE_T m2mb_ble_shutdown(M2MB_BLE_HANDLE ble_handle)
BLE stack shutdown.
struct M2MB_BLE_UUID_32_S M2MB_BLE_UUID_32_T
Structure for 32 bit UUID.
M2MB_BLE_CONN_PARAM_T connection_params
UINT8 scan_response_data[M2MB_BLE_SCAN_RSP_DATA_SIZE]
M2MB_BLE_BD_ADDR_T remote_bd_addr
M2MB_BLE_UUID_TYPE_T uuid_type
M2MB_BLE_BD_ADDR_T remote_bd_address
M2MB_BLE_PAIRABILITY_MODE_T pair_mode
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_secure_ccccd(M2MB_BLE_HANDLE ble_handle)
Secure all client characteristic descriptors of a new service.
M2MB_BLE_ADVERTISE_EVENT_TYPE_T
Enumeration of BLE Advertise event types.
M2MB_BLE_RESPONSE_T m2mb_ble_cccd_request(M2MB_BLE_HANDLE ble_handle, INT32 connection_id, INT32 char_handle, M2MB_BLE_CCCD_T cccd_val)
Enables and disables a Notication/Indication on a client characteristic descriptor.
struct M2MB_BLE_UUID_S M2MB_BLE_UUID_T
Structure which holds 16 bit / 32 bit / 128 bit UUID value.
M2MB_BLE_RESPONSE_T m2mb_ble_initialize(M2MB_BLE_HANDLE *ble_handle, m2mb_ble_event_callback ble_callback, void *user_data)
BLE stack initialization.
M2MB_BLE_RESPONSE_T m2mb_ble_write_value_command(M2MB_BLE_HANDLE ble_handle, INT32 connection_id, INT32 char_handle, UINT8 *value, UINT16 value_len)
Write command on a discovered characteristic.
struct M2MB_BLE_SCAN_REPORT_DATA_S M2MB_BLE_SCAN_REPORT_DATA_T
Structure for scan results in Central mode.
M2MB_BLE_RESPONSE_T m2mb_ble_write_value_request(M2MB_BLE_HANDLE ble_handle, INT32 connection_id, INT32 char_handle, UINT8 *value, UINT16 value_len)
Write value request on a discovered characteristic.
M2MB_BLE_UUID_128_T uuid_128
struct M2MB_BLE_GATT_ELEMENT_S M2MB_BLE_GATT_ELEMENT_T
Structure which stores all information of an GATT element.
#define M2MB_BLE_FIXPIN_SIZE
struct M2MB_BLE_PERIPHERAL_CFG_S M2MB_BLE_PERIPHERAL_CFG_T
Structure for BLE peripheral configuration parameters.
Structure which contains GATT element information.
M2MB_BLE_PHYS_INFO_T rx_phy
INT8 device_name[M2MB_BLE_MAX_DEVICE_NAME_LENGTH+1]
This file contains the public APIs and structures of the heap module.
BOOLEAN remote_device_is_master
M2MB_BLE_GATT_ATTRIB_TYPE_T type
M2MB_BLE_SCAN_REPORT_DATA_T scan_data
M2MB_BLE_WLAN_START_MODE
Enumeration for WLAN mode to start at the time of BLE initialization.
M2MB_BLE_BD_ADDR_T identity_address_bdaddr
#define M2MB_BLE_SCAN_RSP_DATA_SIZE
UINT16 advertise_interval_min
M2MB_BLE_RESPONSE_T m2mb_ble_scan_start(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BD_ADDR_T bd_addr)
Start to scan for BLE devices.
M2MB_BLE_GATT_ATTRIB_TYPE_T
Enumeration that defines GATT element type.
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_characteristic_add(M2MB_BLE_HANDLE ble_handle, UINT8 properties, M2MB_BLE_UUID_T characteristic_uuid)
Add BLE GATT characteristic in a service.
M2MB_BLE_RESPONSE_T m2mb_ble_sspconf_reply(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BD_ADDR_T bd_addr, M2MB_BLE_ADDRESS_TYPE_T bd_addr_type, UINT32 confirmation_flag)
SSP CONF reply used as part of BLE pairing procedure.
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_serv_send_data(M2MB_BLE_HANDLE ble_handle, UINT32 serv_id, UINT32 char_id, UINT8 *value, UINT16 value_len, M2MB_BLE_CCCD_T cccd)
Send GATT server data to remote GATT client.
M2MB_BLE_CENTRAL_CFG_T ble_central_cfg
M2MB_BLE_ROLE_T
Enumeration of BLE roles.
Structure for BLE connection parameters configuration.
struct M2MB_BLE_BD_NAME_S M2MB_BLE_BD_NAME_T
Structure to store Bluetooth device name.
M2MB_BLE_UPDATED_PHY_INFO_T updated_phy_info
M2MB_BLE_IO_CAPABILITY_T
Enumeration of BLE IO capabilities.
M2MB_BLE_RESPONSE_T m2mb_ble_connid_device_info_get(M2MB_BLE_HANDLE ble_handle, UINT8 conn_id, M2MB_BLE_DEVICE_INFO_T *dev_info)
Get connected peer device information using connection ID.
M2MB_BLE_RESPONSE_T m2mb_ble_connect(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BD_ADDR_T bd_addr, M2MB_BLE_ADDRESS_TYPE_T bd_addr_type, INT32 *connection_id)
Connect to a BLE peripheral device.
M2MB_BLE_PIN_REQUEST_CTX_T ssp_pin
M2MB_BLE_CCCD_T
Enumeration of Notify / Indicate enable of an Client Characteristic Descriptor.
M2MB_BLE_IO_CAPABILITY_T iocapability
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_complete(M2MB_BLE_HANDLE ble_handle, UINT32 *service_id)
Stop adding new characteristics to a GATT service.
M2MB_BLE_CONN_PARAM_T ble_conn_param
#define M2MB_BLE_MAX_DEVICE_NAME_LENGTH
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_service_add(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_UUID_T service_uuid)
Add a new BLE GATT service.
M2MB_BLE_SECURITY_CFG_T ble_security_cfg
M2MB_BLE_ADDRESS_TYPE_T remote_address_type
Structure for scan results in Central mode.
struct M2MB_BLE_USER_EVENT_CTX_S M2MB_BLE_USER_EVENT_CTX_T
Structure to hold all the information required related to an event notified to the application...
struct M2MB_BLE_CONN_PARAM_S M2MB_BLE_CONN_PARAM_T
Structure for BLE connection parameters configuration.
UINT16 connection_interval_min
M2MB_BLE_PHYS_INFO_T
Enumeration of BLE PHY modes.
struct M2MB_BLE_DIS_INFO_S M2MB_BLE_DIS_INFO_T
Structure for BLE Device information service configuration parameters.
M2MB_BLE_CONNECTABILITY_MODE_T connect_mode
M2MB_BLE_ADDRESS_TYPE_T bd_addr_type
#define M2MB_BLE_ADV_DATA_SIZE
M2MB_BLE_UUID_16_T uuid_16
struct M2MB_BLE_BD_ADDR_S M2MB_BLE_BD_ADDR_T
Structure to store BLE address.
M2MB_BLE_CENTRAL_NOTIFY_INDICATE_DATA_T notify_data
M2MB_BLE_ADDRESS_TYPE_T remote_bd_addr_type
struct M2MB_BLE_CGF_S M2MB_BLE_CGF_T
Structure for all BLE configuration parameters.
M2MB_BLE_RESPONSE_T m2mb_ble_ssppin_reply(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BD_ADDR_T bd_addr, M2MB_BLE_ADDRESS_TYPE_T bd_addr_type, INT32 ssppin, UINT8 accept_flag)
SSP Pin reply used as part of BLE pairing procedure.
struct M2MB_BLE_GATT_SERVER_EVENT_DETAILS_S M2MB_BLE_GATT_SERVER_EVENT_DETAILS_T
Structure to hold information for a GATT server event.
M2MB_BLE_BD_ADDR_T remote_bd_addr
Structure to store Bluetooth device name.
UINT8 data[M2MB_BLE_ADV_DATA_SIZE]
M2MB_BLE_PERIPHERAL_CFG_T ble_peripheral_cfg
M2MB_BLE_ADVERTISE_EVENT_TYPE_T bd_adv_type
struct M2MB_BLE_UUID_16_S M2MB_BLE_UUID_16_T
Structure for 16 bit UUID.
UINT32 remote_dev_supported_phys
Structure for Rx and Tx PHY information.
M2MB_BLE_ADV_TYPE_T
Enumeration of BLE advertisement types.
M2MB_BLE_RESPONSE_T m2mb_ble_wlan_config_set(M2MB_BLE_WLAN_START_MODE wlan_start_mode)
WLAN mode to start at the time of BLE initialization.
M2MB_BLE_BD_ADDR_T ble_bd_address
M2MB_BLE_PAIRABILITY_MODE_T
Enumeration of BLE pairability modes.
M2MB_BLE_UUID_TYPE_T
Enumeration of UUIDs suuported.
M2MB_BLE_DIS_INFO_T ble_dis_param
Structure for BLE Device information service configuration parameters.
M2MB_BLE_ROLE_T remote_bd_role
M2MB_BLE_RESPONSE_T m2mb_ble_scan_stop(M2MB_BLE_HANDLE ble_handle)
Stop the BLE device scaning.
M2MB_BLE_RESPONSE_T m2mb_ble_bdaddr_device_info_get(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BD_ADDR_T bd_addr, M2MB_BLE_DEVICE_INFO_T *dev_info)
Get connected peer device information using remote BD address.
Structure to hold information of bonded devices.
Structure for 32 bit UUID.
Structure for BLE peripheral configuration parameters.
UINT32 central_connect_id
INT8 ble_manufacturer_name[M2MB_BLE_MAX_MANUFACTURER_NAME_LENGTH+1]
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_characteristic_value_add(M2MB_BLE_HANDLE ble_handle, UINT16 permissions, UINT16 value_len, UINT8 *value, UINT32 *characteristic_id)
Add BLE GATT characteristic value in a service.
Structure to store BLE address.
INT8 M2MB_BLE_BOARDSTR_T[16]
Type definition to hold Bluetooth device name in string format.
M2MB_BLE_CENTRAL_SCAN_FILTER_DUPLICATES_T
Enumeration of Scan filter policy.
UINT8 fix_pin[M2MB_BLE_FIXPIN_SIZE+1]
UINT8 advertise_data[M2MB_BLE_ADV_DATA_SIZE]
M2MB_BLE_RESPONSE_T m2mb_ble_read_value_request(M2MB_BLE_HANDLE ble_handle, INT32 connection_id, INT32 char_handle, UINT8 **value, UINT16 *value_len)
Read value request on a discovered characteristic.
M2MB_BLE_USER_EVENTS_T
Enumeration of BLE events from M2MB layer to application.
M2MB_BLE_ADDRESS_TYPE_T
Enumeration of BLE address types.
Structure to hold information for a GATT server event.
M2MB_BLE_PHY_CODED_OPTIONS_T
Enumeration of BLE Coded PHY options.
Structure for all BLE configuration parameters.
UINT8 bd_name[M2MB_BLE_MAX_DEVICE_NAME_LENGTH]
Structure for BLE security configuration parameters.
M2MB_BLE_CONFIG_PARAM_T
Enumeration of BLE configuration parameters.
M2MB_BLE_RESPONSE_T m2mb_ble_disconnect(M2MB_BLE_HANDLE ble_handle, INT32 connection_id)
Disconnects from a connected BLE peripheral device.
Structure for BLE central configuration parameters.
HANDLE M2MB_BLE_HANDLE
Type definition for BLE handle.
Structure to hold all the information required related to an event notified to the application...
struct M2MB_BLE_CENTRAL_CFG_S M2MB_BLE_CENTRAL_CFG_T
Structure for BLE central configuration parameters.
M2MB_BLE_RESPONSE_T m2mb_ble_advertise(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_ADV_TYPE_T adv_type)
BLE advertise start and stop funtion.
M2MB_BLE_ADDRESS_TYPE_T remote_bd_address_type
M2MB_BLE_RESPONSE_T m2mb_ble_central_initiate_pairing(M2MB_BLE_HANDLE ble_handle, UINT8 conn_id)
Initiate pairing to a connected device in Central mode.
M2MB_BLE_RESPONSE_T
Enumeration of BLE response status types.
M2MB_BLE_GENERAL_PARAM_T ble_gen_param
Structure to hold notification and indication data from remote GATT server.
M2MB_BLE_ADDRESS_TYPE_T remote_bd_addr_type
M2MB_BLE_RESPONSE_T m2mb_ble_start_discovery(M2MB_BLE_HANDLE ble_handle, INT32 connection_id, M2MB_BLE_UUID_T uuid, M2MB_BLE_GATT_SRVD_T *results)
Discovery of services and characteristics of a GATT server.
M2MB_BLE_BD_ADDR_T remote_address
Structure for BLE generic configuration parameters.
UINT16 supervision_timeout
M2MB_BLE_PHYS_INFO_T tx_phy
M2MB_BLE_RESPONSE_T m2mb_ble_bond_list_get(M2MB_BLE_HANDLE ble_handle, M2MB_BLE_BOND_LIST_INFO_T *bond_list_info, UINT32 *num_of_entries)
Gets the list of bonded devices.
M2MB_BLE_GATT_ELEMENT_T * gatt_elements
UINT16 ble_device_appearance
M2MB_BLE_UUID_32_T uuid_32
INT8 ble_device_name[M2MB_BLE_MAX_DEVICE_NAME_LENGTH+1]
Structure which holds 16 bit / 32 bit / 128 bit UUID value.
struct M2MB_BLE_GENERAL_PARAM_S M2MB_BLE_GENERAL_PARAM_T
Structure for BLE generic configuration parameters.
struct M2MB_BLE_UUID_128_S M2MB_BLE_UUID_128_T
Structure for 128 bit UUID.
Structure to hold connected peer BLE device information.
Structure for 16 bit UUID.
UINT16 pnpid_vendor_id_source
M2MB_BLE_CONN_PARAM_T conn_params
struct M2MB_BLE_GATT_SRVD_S M2MB_BLE_GATT_SRVD_T
Structure which contains GATT element information.
M2MB_BLE_SSP_REQUEST_CTX_T ssp_conf
Structure for Rx and Tx octet length.
UINT8 ble_bond_store_support
M2MB_BLE_RESPONSE_T m2mb_ble_data_len_set(M2MB_BLE_HANDLE ble_handle, UINT8 conn_id, UINT16 tx_octets)
Set data length used in Link Layer for data length extension.