![]() |
WE310F5
39.00.000
|
This section describes the M2MB APIs for BLE functionality. More...
This section describes the M2MB APIs for BLE functionality.
This section describes the M2MB BLE utility APIs.
BLE stands for Bluetooth Low Energy(Bluetooth LE,and marketed as Bluetooth Smart). BLE is a form of wireless communication designed specially for short range communication. BLE is very similar to Wi-Fi in the sense that it allows devices to communicate with each other.However, BLE is meant for situations where battery life is preferred over high data transfer speeds.
M2MB BLE utility functions.
#define M2MB_BLE_ADV_DATA_SIZE 31 |
Advertise data size
Definition at line 57 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_FOUND 0x0A |
Attribute not found error
Definition at line 71 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_LONG 0x0B |
Attribute not long error
Definition at line 72 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHENTICATION 0x05 |
Insufficient Authentication error
Definition at line 67 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHORIZATION 0x08 |
Insufficient authorization error
Definition at line 70 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION 0x0F |
Insufficient encryption error
Definition at line 75 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0C |
Insufficient encryption key size error
Definition at line 73 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_RESOURCES 0x11 |
Insufficient resources error
Definition at line 77 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_ATTRIBUTE_VALUE_LENGTH 0x0D |
Invalid attribute value length error
Definition at line 74 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_HANDLE 0x01 |
Invalid handle error
Definition at line 63 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_OFFSET 0x07 |
Invalid offset error
Definition at line 69 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_PDU 0x04 |
Invalid PDU error
Definition at line 66 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_READ_NOT_PERMITTED 0x02 |
Read not permitted error
Definition at line 64 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_REQUEST_NOT_SUPPORTED 0x06 |
Request not suuported error
Definition at line 68 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNSUPPORTED_GROUP_TYPE 0x10 |
Unsupported group type error
Definition at line 76 of file m2mb_ble_driver.h.
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_WRITE_NOT_PERMITTED 0x03 |
Write not permitted error
Definition at line 65 of file m2mb_ble_driver.h.
#define M2MB_BLE_BOND_ENTRIES_MAX 20 |
Maximum bond entries
Definition at line 59 of file m2mb_ble_driver.h.
#define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_BLUETOOTH_SIG 0x01 |
Definition at line 92 of file m2mb_ble_driver.h.
#define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_USB_IMPLEMENTORS_FORUM 0x02 |
Definition at line 93 of file m2mb_ble_driver.h.
#define M2MB_BLE_FIXPIN_SIZE 6 |
BLE Fix pin size
Definition at line 56 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_AUTHENTICATED_SIGNED_WRITES 0x40 |
Property: Authenticated signed writes
Definition at line 85 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_BROADCAST 0x01 |
Property: Broadcast
Definition at line 79 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_EXTENDED_PROPERTIES 0x80 |
Property: Extended properties The following values define the valid values that the Vendor ID Source field of the DIS PNP characteristic may contain.
Definition at line 86 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_INDICATE 0x20 |
Property: Indicate
Definition at line 84 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_NOTIFY 0x10 |
Property: Notify
Definition at line 83 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_READ 0x02 |
Property: Read
Definition at line 80 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE 0x08 |
Property: Write
Definition at line 82 of file m2mb_ble_driver.h.
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE 0x04 |
Property: Write without response
Definition at line 81 of file m2mb_ble_driver.h.
#define M2MB_BLE_MAX_DEVICE_NAME_LENGTH (39+1) |
Maximum length of BLE Device name
Definition at line 54 of file m2mb_ble_driver.h.
#define M2MB_BLE_MAX_GATT_SERVER_SERVICES 10 |
Maximum GATT services supported
Definition at line 61 of file m2mb_ble_driver.h.
#define M2MB_BLE_MAX_MANUFACTURER_NAME_LENGTH M2MB_BLE_MAX_DEVICE_NAME_LENGTH |
Maximum length of manufactureres name
Definition at line 55 of file m2mb_ble_driver.h.
#define M2MB_BLE_SCAN_RSP_DATA_SIZE 31 |
Scan response data size
Definition at line 58 of file m2mb_ble_driver.h.
typedef struct M2MB_BLE_BD_ADDR_S M2MB_BLE_BD_ADDR_T |
Structure to store BLE address.
Structure for storing BLE MAC address. IF In BLE MAC Addr = 0xAABBCCDDEEFF, then BD_ADDR0 = 0xAA and BD_ADDR5 = 0xFF.
typedef struct M2MB_BLE_BD_NAME_S M2MB_BLE_BD_NAME_T |
Structure to store Bluetooth device name.
Structure for storing Bluetooth device name.
typedef INT8 M2MB_BLE_BOARDSTR_T[16] |
Type definition to hold Bluetooth device name in string format.
Type definition to hold Bluetooth device name in string format.
Definition at line 380 of file m2mb_ble_driver.h.
typedef struct M2MB_BLE_BOND_LIST_INFO_S M2MB_BLE_BOND_LIST_INFO_T |
Structure to hold information of bonded devices.
Structure to hold information of bonded devices.
typedef struct M2MB_BLE_CENTRAL_CFG_S M2MB_BLE_CENTRAL_CFG_T |
Structure for BLE central configuration parameters.
Structure for BLE central configuration parameters.
Structure to hold notification and indication data from remote GATT server.
Structure to hold notification and indication data from remote GATT server.
typedef struct M2MB_BLE_CGF_S M2MB_BLE_CGF_T |
Structure for all BLE configuration parameters.
Structure for all BLE configuration parameters.
typedef struct M2MB_BLE_CONN_PARAM_S M2MB_BLE_CONN_PARAM_T |
Structure for BLE connection parameters configuration.
Structure for BLE connection parameters configuration. These parameters are used by the central after the connection is established.
typedef struct M2MB_BLE_DEVICE_INFO_S M2MB_BLE_DEVICE_INFO_T |
Structure to hold connected peer BLE device information.
Structure to hold connected peer BLE device information both in Central and Peripheral mode.
typedef struct M2MB_BLE_DIS_INFO_S M2MB_BLE_DIS_INFO_T |
Structure for BLE Device information service configuration parameters.
Structure for BLE Device information service configuration parameters.
typedef 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.
Type definition of the user callback to receive asynchronous events from BLE driver. ble_handle represents ble handle, ble_event represents BLE asynchronous events from BLE driver, resp_size represents size of response, resp represents the data from BLE stack userdata represents the user data context
Definition at line 883 of file m2mb_ble_driver.h.
typedef struct M2MB_BLE_GATT_ELEMENT_S M2MB_BLE_GATT_ELEMENT_T |
Structure which stores all information of an GATT element.
Structure for storing all information of an GATT element. This structure is used for service discovery feature.
Structure to hold information for a GATT server event.
Structure to hold information for a GATT server event.
typedef struct M2MB_BLE_GATT_SRVD_S M2MB_BLE_GATT_SRVD_T |
Structure which contains GATT element information.
Structure which contains GATT element information. This structure is used for service discovery feature.
typedef struct M2MB_BLE_GENERAL_PARAM_S M2MB_BLE_GENERAL_PARAM_T |
Structure for BLE generic configuration parameters.
Structure for BLE generic configuration parameters.
typedef HANDLE M2MB_BLE_HANDLE |
Type definition for BLE handle.
Type definition for BLE handle. This BLE handle is provided from M2MB to application at the time of BLE init.
Definition at line 813 of file m2mb_ble_driver.h.
typedef struct M2MB_BLE_PERIPHERAL_CFG_S M2MB_BLE_PERIPHERAL_CFG_T |
Structure for BLE peripheral configuration parameters.
Structure for BLE peripheral configuration parameters.
typedef struct M2MB_BLE_SCAN_REPORT_DATA_S M2MB_BLE_SCAN_REPORT_DATA_T |
Structure for scan results in Central mode.
Structure for scan results in Central mode. When scan for BLE devices, the list of scanned devices information is sent to the application in this format.
typedef struct M2MB_BLE_SECURITY_CFG_S M2MB_BLE_SECURITY_CFG_T |
Structure for BLE security configuration parameters.
Structure for BLE security configuration parameters.
typedef 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.
Structure to hold all the information required related to an event notified to the application. This context information is sent to registerd callback with event type.
typedef struct M2MB_BLE_UUID_128_S M2MB_BLE_UUID_128_T |
Structure for 128 bit UUID.
Structure for storing 128 bit UUID. IF UUID = 0x00112233445566778899AABBCCDDEEFF, then UUID_Byte0 = 0x00, UUID_Byte1 = 0x11 ..... UUID_Byte14 = 0xEE, UUID_Byte15 = 0xFF.
typedef struct M2MB_BLE_UUID_16_S M2MB_BLE_UUID_16_T |
Structure for 16 bit UUID.
Structure for storing 16 bit UUID. IF UUID = 0xAABB, then UUID_Byte0 = 0xAA, UUID_Byte1 = 0xBB.
typedef struct M2MB_BLE_UUID_32_S M2MB_BLE_UUID_32_T |
Structure for 32 bit UUID.
Structure for storing 32 bit UUID. IF UUID = 0xAABBCCDD, then UUID_Byte0 = 0xAA, UUID_Byte1 = 0xBB, UUID_Byte2 = 0xCC, UUID_Byte3 = 0xDD.
typedef struct M2MB_BLE_UUID_S M2MB_BLE_UUID_T |
Structure which holds 16 bit / 32 bit / 128 bit UUID value.
Structure for storing 16 bit / 32 bit / 128 bit UUID value.
Enumeration of BLE address types.
Enumeration of BLE address types.
Definition at line 313 of file m2mb_ble_driver.h.
enum M2MB_BLE_ADV_TYPE_T |
Enumeration of BLE advertisement types.
Enumeration of BLE advertisement types.
Definition at line 865 of file m2mb_ble_driver.h.
Enumeration of BLE Advertise event types.
Enumeration of BLE Advertise event types.
Definition at line 226 of file m2mb_ble_driver.h.
enum M2MB_BLE_CCCD_T |
Enumeration of Notify / Indicate enable of an Client Characteristic Descriptor.
Enumeration that identifies Notify / Indicate enable of an Client Characteristic Descriptor.
Enumerator | |
---|---|
M2MB_BLE_DISABLE_INDICATION_NOTIFICATION_E | Disable notification and indication |
M2MB_BLE_ENABLE_NOTIFICATION_E | Enable notification |
M2MB_BLE_ENABLE_INDICATION_E | Enable indication |
Definition at line 398 of file m2mb_ble_driver.h.
Enumeration of Scan filter policy.
Enumeration of Scan filter policy.
Enumerator | |
---|---|
M2MB_BLE_SCAN_FILTER_DUPLICATE_DISABLE | Duplicate filtering disabled. |
M2MB_BLE_SCAN_FILTER_DUPLICATE_ENABLE | Duplicate filtering enabled. |
Definition at line 682 of file m2mb_ble_driver.h.
Enumeration of BLE configuration parameters.
Enumeration of BLE configuration parameters. All BLE configuration parameters can be set or get using m2mb_ble_conf() function
Definition at line 427 of file m2mb_ble_driver.h.
Enumeration of BLE connectability modes.
Enumeration of BLE connectability modes.
Enumerator | |
---|---|
M2MB_BLE_NON_CONNECTABLE_E | non-connectable mode. |
M2MB_BLE_CONNECTABLE_E | connectable mode. |
M2MB_BLE_DIRECT_CONNECTABLE_E | directed connectable mode. |
Definition at line 240 of file m2mb_ble_driver.h.
Enumeration of BLE discoverability modes.
Enumeration of BLE discoverability modes.
Enumerator | |
---|---|
M2MB_BLE_NON_DISCOVERABLE_MODE_E | Non-discoverable mode. |
M2MB_BLE_LIMITED_DISCOVERABLE_MODE_E | Limited-discoverable mode. |
M2MB_BLE_GENERAL_DISCOVERABLE_MODE_E | General-discoverable mode. |
Definition at line 252 of file m2mb_ble_driver.h.
Enumeration that defines GATT element type.
Enumeration that defines GATT element types.
Definition at line 183 of file m2mb_ble_driver.h.
Enumeration of BLE IO capabilities.
Enumeration of BLE IO capabilities which are used during pairing procedure.
Definition at line 339 of file m2mb_ble_driver.h.
Enumeration of BLE pairability modes.
Enumeration of BLE pairability modes.
Enumerator | |
---|---|
M2MB_BLE_NON_PAIRABLEMODE_E | Non-pairable mode. |
M2MB_BLE_PAIRABLE_MODE_E | Pairable mode. |
M2MB_BLE_PAIRABLE_MODE_ENABLE_EXTENDED_EVENTS_E | Pairable mode with enabling of extended events. |
Definition at line 264 of file m2mb_ble_driver.h.
Enumeration of BLE Coded PHY options.
Enumeration of BLE Coded PHY options.
Definition at line 300 of file m2mb_ble_driver.h.
enum M2MB_BLE_PHYS_INFO_T |
Enumeration of BLE PHY modes.
Enumeration of BLE PHY modes.
Definition at line 288 of file m2mb_ble_driver.h.
enum M2MB_BLE_RESPONSE_T |
Enumeration of BLE response status types.
Enumeration of BLE response status types.
Definition at line 820 of file m2mb_ble_driver.h.
enum M2MB_BLE_ROLE_T |
Enumeration of BLE roles.
Enumeration of BLE roles.
Enumerator | |
---|---|
M2MB_BLE_PERIPHERAL_ROLE_E | Peripheral role |
M2MB_BLE_CENTRAL_ROLE_E | Cetral role |
M2MB_BLE_DUAL_ROLE_E | Both peripheral and central roles |
Definition at line 276 of file m2mb_ble_driver.h.
Enumeration of BLE events from M2MB layer to application.
Enumeration of BLE events from M2MB layer to application. BLE events are notified to the application layer from M2MB to the registered callback function at the time of BLE initialization using m2mb_ble_initialize().
Definition at line 615 of file m2mb_ble_driver.h.
enum M2MB_BLE_UUID_TYPE_T |
Enumeration of UUIDs suuported.
Enumeration that identifies which UUID is used when UUID value is placed in structure M2MB_BLE_UUID_T.
Enumerator | |
---|---|
UUID_TYPE_16_BIT_E | 16 bit UUID type |
UUID_TYPE_32_BIT_E | 32 bit UUID type |
UUID_TYPE_128_BIT_E | 128 bit UUID type |
UUID_INVALID_E | Invalid UUID |
Definition at line 154 of file m2mb_ble_driver.h.
Enumeration for WLAN mode to start at the time of BLE initialization.
Enumeration for WLAN mode to start at the time of BLE initialization.
Enumerator | |
---|---|
M2MB_BLE_WLAN_AP | WLAN AP mode |
M2MB_BLE_WLAN_STA | WLAN Station mode |
M2MB_BLE_WLAN_STA_AP | WLAN mixed mode. Station and AP mode |
Definition at line 410 of file m2mb_ble_driver.h.
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.
This API is used to start and stop the BLE advertisement. This API uses the advertise data sent from the application (using m2mb_ble_conf() API) when advertise is ON.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | adv_type | advertise type ON / OFF |
ble_response = m2mb_ble_advertise(m2m_ble_handle, advParam);
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.
This API is used to get connected peer device information using remote BD address.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | bd_addr | remote BD address |
[out] | dev_info | decvice information of the connected peer device |
ble_response = m2mb_ble_bdaddr_device_info_get(m2m_ble_handle, bd_addr, &dev_info);
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.
This API is used to delete the bond information of a BLE device from the bonded list.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | bd_addr | BLE address |
ble_response = m2mb_ble_bond_delete(m2m_ble_handle, bd_addr);
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.
This API is used to get the list of bonded devices.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[out] | bond_list_info | List of bonded devices |
[out] | num_of_entries | Number of bonded devices filled |
ble_response = m2mb_ble_bond_list_get(m2m_ble_handle, bond_list_info, &num_of_entries);
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.
This API is used to enables and disables a Notication/Indication on a client characteristic descriptor.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | char_handle | attribute handle of the discovered characteristic. |
[in] | cccd_val | value of client characteristic descriptor |
ble_response = m2mb_ble_cccd_request(m2m_ble_handle, conn_id, char_handle, cccd_val);
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.
This API is used to initiate pairing to a connected device in Central mode. This API is used normally when the device in central mode fails to read or write a secured characteristic. This API can also be called any time after a connection is established by the master / central.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | conn_id | connection id |
ble_response = m2mb_ble_central_initiate_pairing(m2m_ble_handle, conn_id);
M2MB_BLE_RESPONSE_T m2mb_ble_conf | ( | M2MB_BLE_HANDLE | ble_handle, |
UINT8 | num_cmds, | ||
... | |||
) |
BLE configuration GET / SET.
This API is used to GET / SET the BLE configuration parameters. This API supports variable length aruguments
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | num_cmds | Number of commands used. Based on this number the variable length arguments are decided. |
ble_response = m2mb_ble_conf(m2m_ble_handle, 2, M2MB_BLE_CFG_BLE_BD_ADDR_GET_E, &bd_addr);
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.
This API is used connect to a BLE peripheral device. This API returns the connection ID of the new connection if successful.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | bd_addr | ble address of the device to be connected to |
[in] | bd_addr_type | ble address type |
[out] | connection_id | connection ID of new connection |
ble_response = m2mb_ble_connect(m2m_ble_handle, bd_addr, bd_addr_type, &connection_id);
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.
This API is used to get connected peer device information using connection ID.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[out] | dev_info | decvice information of the connected peer device |
conn_id can be peripheral connection ID when remote Central device connects to the device or connection ID's of different connected peripherals in central mode.
ble_response = m2mb_ble_connid_device_info_get(m2m_ble_handle, conn_id, &dev_info);
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.
This API is used to set data length used in Link Layer for data length extension.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | tx_octets | maximum number of payload octets that the local Controller should include in a single Link Layer packet |
ble_response = m2mb_ble_data_len_set(m2m_ble_handle, conn_id, data_length);
M2MB_BLE_RESPONSE_T m2mb_ble_disconnect | ( | M2MB_BLE_HANDLE | ble_handle, |
INT32 | connection_id | ||
) |
Disconnects from a connected BLE peripheral device.
This API is used to disconnect from a connected BLE peripheral device.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
ble_response = m2mb_ble_connect(m2m_ble_handle, bd_addr, bd_addr_type, &connection_id);
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.
This API is used to add a new characteristic in a GATT service.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | properties | properties of characteristic |
[in] | characteristic_uuid | UUID of characteristic |
ble_response = m2mb_ble_gatts_characteristic_add(m2m_ble_handle, properties, uuid);
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.
This API is used to add a value for new characteristic in a GATT service. When this API is called new characteristic is added to GATT service data base and new characteristic ID is returned to the application
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | permissions | permissions of characteristic |
[in] | value_len | length of characteristic value |
[in] | value | characteristic value |
[out] | characteristic_id | characteristic id of the new characteristic |
ble_response = m2mb_ble_gatts_characteristic_value_add(m2m_ble_handle, permissions, hex_val_len, hex_val, &characteristic_id);
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_complete | ( | M2MB_BLE_HANDLE | ble_handle, |
UINT32 * | service_id | ||
) |
Stop adding new characteristics to a GATT service.
This API is used stop adding new characteristics to a GATT service. When this API is called new service is added to GATT server data base and new service ID is returned to the application
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[out] | service_id | service id of the new service |
ble_response = m2mb_ble_gatts_complete(m2m_ble_handle, &service_id);
M2MB_BLE_RESPONSE_T m2mb_ble_gatts_secure_ccccd | ( | M2MB_BLE_HANDLE | ble_handle | ) |
Secure all client characteristic descriptors of a new service.
This API is used to secure all client characteristic descriptors of a new service.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
ble_response = m2mb_ble_gatts_secure_ccccd(m2m_ble_handle);
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.
This API is used send GATT server data to remote GATT client, usually, when new data is available on a characteristic (not on READ request from GATT cleint), and when notification or indication is enable on the characteristic.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | service_id | service id |
[in] | char_id | characteristic id |
[in] | value | value of the characteristic |
[in] | value_len | length of the value of the characteristic |
[in] | cccd | CCCD value. |
ble_response = m2mb_ble_gatts_serv_send_data(m2m_ble_handle, service_id, char_id, val, val_length, cccd);
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.
This API is used to add a new service on GATT server.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | service_uuid | UUID of the service |
ble_response = m2mb_ble_gatts_service_add(m2m_ble_handle, uuid);
M2MB_BLE_RESPONSE_T m2mb_ble_initialize | ( | M2MB_BLE_HANDLE * | ble_handle, |
m2mb_ble_event_callback | ble_callback, | ||
void * | user_data | ||
) |
BLE stack initialization.
This API enables and initializes BLE stack.
[out] | ble_handle | Pointer to ble_handle. This is filled by m2mb_ble_initialize API. This should be used in all M2MB BLE API's |
[in] | ble_callback | BLE event callback function pointer. This function is called for all BLE related events with event type. |
[in] | user_data | Pointer to generic ble user data that will be returned as it is in the callback. |
ble_response = m2mb_ble_initialize(&m2m_ble_handle, m2m_ble_callback, NULL);
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.
This API is used to request for reading the value of a discovered characteristic.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | char_handle | attribute handle of the discovered characteristic. |
[out] | value | value of the characteristic |
[out] | value_len | length of the value of the characteristic |
ble_response = m2mb_ble_read_value_request(m2m_ble_handle, conn_id, char_id, &value, &value_len);
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.
This API is used start to scan for BLE devices. This API is used to scan for a particular BLE device or scan for all available BLE devices.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | bd_addr | scan for particular BLE address. When this is set to 0 for all bytes, then it scans for all available BLE devices. |
ble_response = m2mb_ble_scan_start(m2m_ble_handle, bd_addr);
M2MB_BLE_RESPONSE_T m2mb_ble_scan_stop | ( | M2MB_BLE_HANDLE | ble_handle | ) |
Stop the BLE device scaning.
This API is used stop the BLE device scaning.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
ble_response = m2mb_ble_scan_stop(m2m_ble_handle);
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.
This API is used to set the PHY options of a connection.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | phy_pref | PHY preferences |
[in] | phy_coded_options | coded PHY options |
ble_response = m2mb_ble_set_phy(m2m_ble_handle, conn_id, phy_pref, coded_phy_options);
M2MB_BLE_RESPONSE_T m2mb_ble_shutdown | ( | M2MB_BLE_HANDLE | ble_handle | ) |
BLE stack shutdown.
This API shutdown the BLE stack.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
ble_response = m2mb_ble_shutdown(p_m2m_ble_appctx->m2m_ble_handle);
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.
This API is used as part of BLE pairing procedure. This API accepts or denies the pairing procedure.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | bd_addr | Remote BD address. |
[in] | bd_addr_type | Remote BD address type. |
[in] | confirmation_flag | Confirmation flag for same PIN is generated on both BLE devices involved in pairing process. |
ble_response = m2mb_ble_sspconf_reply(m2m_ble_handle, bd_addr, bd_addr_type, confirmation_flag);
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.
This API is used as part of BLE pairing procedure. This API accepts or denies the pairing procedure.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | bd_addr | Remote BD address. |
[in] | bd_addr_type | Remote BD address type. |
[in] | ssppin | SSP passkey. |
[in] | accept_flag | Flag states whether to pair or not. |
ble_response = m2mb_ble_ssppin_reply(m2m_ble_handle, bd_addr, bd_addr_type, SSP_Passkey, accept_flag);
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.
This API is used to discovery of services and characteristics of a GATT server. Primary services of the GATT server are discovered when the value of parameter 'uuid' is set to UUID_INVALID_E. If the value of 'uuid' parameter is a valid discovered primary service UUID value, then the characteristics of the service are discovered.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | uuid | uuid of the service. |
[out] | results | discovered results filled by BLE driver |
ble_response = m2mb_ble_start_discovery(m2m_ble_handle, conn_id, uuid, &gatt_results);
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.
This API is used to start WLAN in particular mode at the time of BLE initializaqtion.
[in] | wlan_start_mode | WLAN mode to start at the time of BLE initialization |
ble_response = m2mb_ble_wlan_config_set(wlan_start_mode);
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.
This API is used to do a write command of a discovered characteristic.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | char_handle | attribute handle of the discovered characteristic. |
[in] | value | value of the characteristic |
[in] | value_len | length of the value of the characteristic |
ble_response = m2mb_ble_write_value_command(m2m_ble_handle, conn_id, char_id, value, value_len);
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.
This API is used to do a write value request of a discovered characteristic.
[in] | ble_handle | ble_handle from m2mb_ble_initialize API |
[in] | connection_id | connection id |
[in] | char_handle | attribute handle of the discovered characteristic. |
[in] | value | value of the characteristic |
[in] | value_len | length of the value of the characteristic |
ble_response = m2mb_ble_write_value_request(m2m_ble_handle, conn_id, char_id, value, value_len);