WL865E4-P  36.07.001
M2MB BLE DRIVER

This section describes the M2MB APIs for BLE functionality.. More...

#define M2MB_SSL_FAILURE   -1
 
#define M2MB_SSL_FAILURE   -1
 
#define M2MB_BLE_DATA_BUFFER_LENGTH   517
 
#define M2MB_BLE_PASSKEY   123456
 
#define M2MB_BLE_DEVICE_NAME_SIZE   32
 
#define M2MB_DEFAULT_OOBDATAPRESENT   FALSE
 
#define M2MB_DEFAULT_MITM_PROTECTION   TRUE
 
#define M2MB_DEFAULT_SECURE_CONNECTIONS   TRUE
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_UNKNOWN   0
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_PHONE   64
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_COMPUTER   128
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_WATCH   192
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_SPORTS_WATCH   193
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_CLOCK   256
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_DISPLAY   320
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_GENERIC_REMOTE_CONTROL   384
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_EYE_GLASSES   448
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_TAG   512
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_KEYRING   576
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_MEDIA_PLAYER   640
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_BARCODE_SCANNER   704
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_THERMOMETER   768
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_THERMOMETER_EAR   769
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_HEART_RATE_SENSOR   832
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BELT_HEART_RATE_SENSOR   833
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_BLOOD_PRESSURE   896
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BLOOD_PRESSURE_ARM   897
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BLOOD_PRESSURE_WRIST   898
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HUMAN_INTERFACE_DEVICE   960
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_KEYBOARD   961
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_MOUSE   962
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_JOYSTICK   963
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_GAMEPAD   964
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_DIGITIZER_TABLET   965
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_CARD_READER   966
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_DIGITAL_PEN   967
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_BARCODE_SCANNER   968
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_GLUCOSE_METER   1024
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_RUNNING_WALKING_SENSOR   1088
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_IN_SHOE   1089
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_ON_SHOE   1090
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_ON_HIP   1091
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_CYCLING   1152
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_CYCLING_COMPUTER   1153
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_SPEED_SENSOR   1154
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_CADENCE_SENSOR   1155
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_POWER_SENSOR   1156
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_SPEED_AND_CADENCE_SENSOR   1157
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_PULSE_OXIMETER   3136
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_PULSE_OXIMETER_FINGERTIP   3137
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_PULSE_OXIMETER_WRIST_WORN   3138
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_WEIGHT_SCALE   3200
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_OUTDOOR_SPORTS_ACTIVITY   5184
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_DISPLAY_DEVICE   5185
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE   5186
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_POD   5187
 
#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_AND_NAVIGATION_POD   5188
 
#define M2MB_DEVICE_INFO_FLAGS_LTK_VALID   0x01
 
#define M2MB_DEVICE_INFO_FLAGS_BLE_SERVER   0x02
 
#define M2MB_DEVICE_INFO_FLAGS_BLE_CLIENT   0x04
 
#define M2MB_DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING   0x08
 
#define M2MB_DEVICE_INFO_FLAGS_IRK_VALID   0x10
 
#define M2MB_DEVICE_INFO_FLAGS_ADDED_TO_WHITE_LIST   0x20
 
#define M2MB_DEVICE_INFO_FLAGS_ADDED_TO_RESOLVING_LIST   0x40
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_HANDLE   0x01
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_READ_NOT_PERMITTED   0x02
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_WRITE_NOT_PERMITTED   0x03
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_PDU   0x04
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHENTICATION   0x05
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_REQUEST_NOT_SUPPORTED   0x06
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_OFFSET   0x07
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHORIZATION   0x08
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_PREPARE_QUEUE_FULL   0x09
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_FOUND   0x0A
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_LONG   0x0B
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION_KEY_SIZE   0x0C
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_ATTRIBUTE_VALUE_LENGTH   0x0D
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNLIKELY_ERROR   0x0E
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION   0x0F
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNSUPPORTED_GROUP_TYPE   0x10
 
#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_RESOURCES   0x11
 
#define M2MB_BLE_PARAMETERS_FLAGS_ADVERTISING_PARAMETERS_VALID   0x00000001
 
#define M2MB_BLE_PARAMETERS_FLAGS_SCAN_PARAMETERS_VALID   0x00000002
 
#define M2MB_BLE_PARAMETERS_FLAGS_CONNECTION_PARAMETERS_VALID   0x00000004
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_BROADCAST   0x01
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_READ   0x02
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE   0x04
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE   0x08
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_NOTIFY   0x10
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_INDICATE   0x20
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_AUTHENTICATED_SIGNED_WRITES   0x40
 
#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_EXTENDED_PROPERTIES   0x80
 
#define M2MB_BLE_GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_NOTIFY_ENABLE   0x0001
 
#define M2MB_BLE_GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_INDICATE_ENABLE   0x0002
 
#define M2MB_BLE_GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_BLUETOOTH_UUID_CONSTANT   { 0x02, 0x29 }
 
#define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_BLUETOOTH_SIG   0x01
 
#define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_USB_IMPLEMENTORS_FORUM   0x02
 
#define M2MB_BLE_NON_ALIGNED_WORD_SIZE   (sizeof(M2MB_BLE_NONALIGNEDWORD_T))
 
#define M2MB_BLE_ASSIGN_BD_ADDR(_dest, _a, _b, _c, _d, _e, _f)
 
#define M2MB_BLE_GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_LENGTH   (M2MB_BLE_NON_ALIGNED_WORD_SIZE)
 
#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE   0x01
 
#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_WRITABLE   0x02
 
#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_HIDDEN   0x04
 
#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE   (M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE|M2MB_BLE_GATT_ATTRIBUTE_FLAGS_WRITABLE)
 
#define M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE   0x01
 
#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_KEYPRESS_NOTIFICATIONS   0x00000001
 
#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_SECURE_CONNECTIONS   0x00000002
 
#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_MITM_REQUESTED   0x00000004
 
#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_OOB_DATA_PRESENT   0x00000008
 
#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_LOCAL_OOB_DATA_VALID   0x00000010
 
#define M2MB_BLE_GATT_INITIALIZATION_FLAGS_SUPPORT_LE   0x00000001L
 
#define M2MB_BLE_GATT_INITIALIZATION_FLAGS_DISABLE_SERVICE_CHANGED_CHARACTERISTIC   0x00000004L
 
#define READ_UNALIGNED_BYTE_LITTLE_ENDIAN(_x)   (((UINT8 *)(_x))[0])
 
#define READ_UNALIGNED_WORD_LITTLE_ENDIAN(_x)   ((UINT16)((((UINT16)(((UINT8 *)(_x))[1])) << 8) | ((UINT16)(((UINT8 *)(_x))[0]))))
 
#define ASSIGN_HOST_WORD_TO_LITTLE_ENDIAN_UNALIGNED_WORD(_x, _y)
 
#define M2MB_BLE_COMPARE_BD_ADDR(_x, _y)   (((_x).BD_ADDR0 == (_y).BD_ADDR0) && ((_x).BD_ADDR1 == (_y).BD_ADDR1) && ((_x).BD_ADDR2 == (_y).BD_ADDR2) && ((_x).BD_ADDR3 == (_y).BD_ADDR3) && ((_x).BD_ADDR4 == (_y).BD_ADDR4) && ((_x).BD_ADDR5 == (_y).BD_ADDR5))
 
#define M2MB_BLE_COMPARE_NULL_BD_ADDR(_x)   (((_x).BD_ADDR0 == 0x00) && ((_x).BD_ADDR1 == 0x00) && ((_x).BD_ADDR2 == 0x00) && ((_x).BD_ADDR3 == 0x00) && ((_x).BD_ADDR4 == 0x00) && ((_x).BD_ADDR5 == 0x00))
 
#define BLE_SERVICE_FLAGS   (M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE)
 
#define M2MB_BLE_MAX_PAIRED_DEVICES   7
 
#define M2MB_BLE_ADVERTISING_DATA_MAXIMUM_SIZE   31
 
#define M2MB_BLE_SCAN_RESPONSE_DATA_MAXIMUM_SIZE   31
 
#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_SIZE   (sizeof(M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_T))
 
#define M2MB_BLE_GAP_MAXIMUM_DEVICE_NAME_LENGTH   248
 
#define DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING   0x08
 
#define M2MB_BLE_MINIMUM_LE_SCAN_INTERVAL   3
 
#define M2MB_BLE_MAXIMUM_LE_SCAN_INTERVAL   10240
 
#define M2MB_BLE_MINIMUM_LE_SCAN_WINDOW   3
 
#define M2MB_BLE_MAXIMUM_LE_SCAN_WINDOW   10240
 
#define M2MB_BLE_MINIMUM_LIMITED_DISCOVERABLE_SCAN_LENGTH   11
 
#define M2MB_BLE_MINIMUM_GENERAL_DISCOVERABLE_SCAN_LENGTH   11
 
#define M2MB_BLE_MINIMUM_ADVERTISING_INTERVAL   20
 
#define M2MB_BLE_MAXIMUM_ADVERTISING_INTERVAL   10240
 
#define M2MB_BLE_MINIMUM_NONCONNECTABLE_ADVERTISING_INTERVAL   100
 
#define M2MB_BLE_MINIMUM_PRIMARY_ADVERTISING_INTERVAL   20
 
#define M2MB_BLE_MAXIMUM_PRIMARY_ADVERTISING_INTERVAL   10485759
 
#define M2MB_BLE_MINIMUM_PERIODIC_ADVERTISING_INTERVAL   8
 
#define M2MB_BLE_MAXIMUM_PERIODIC_ADVERTISING_INTERVAL   81919
 
#define M2MB_BLE_MINIMUM_ADVERITISING_HANDLE   0
 
#define M2MB_BLE_MAXIMUM_ADVERITISING_HANDLE   0xEF
 
#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_INTERVAL   3
 
#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_INTERVAL   40959
 
#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_WINDOW   3
 
#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_WINDOW   40959
 
#define M2MB_BLE_MINIMUM_EXTENDED_ADVERTISING_DURATION   0
 
#define M2MB_BLE_MAXIMUM_EXTENDED_ADVERTISING_DURATION   655350
 
#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_DURATION   10
 
#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_DURATION   655350
 
#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_PERIOD   1280
 
#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_PERIOD   83884800
 
#define M2MB_BLE_MINIMUM_MINIMUM_CONNECTION_INTERVAL   8
 
#define M2MB_BLE_MAXIMUM_MINIMUM_CONNECTION_INTERVAL   4000
 
#define M2MB_BLE_MINIMUM_MAXIMUM_CONNECTION_INTERVAL   8
 
#define M2MB_BLE_MAXIMUM_MAXIMUM_CONNECTION_INTERVAL   4000
 
#define M2MB_BLE_BTPS_STRUCTURE_OFFSET(_x, _y)   ((unsigned int)&(((_x *)0)->_y))
 
#define M2MB_BLE_ASSIGN_BLUETOOTH_UUID_16(_dest, _a, _b)
 
#define M2MB_BLE_COMPARE_BLUETOOTH_UUID_16_TO_CONSTANT(_x, _a, _b)
 
#define M2MB_BLE_COMPARE_BLUETOOTH_UUID_128_TO_CONSTANT(_x, _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p)
 
#define M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_SIZE   (sizeof(M2MB_BLE_PERSISTENT_DEVICE_REMOTE_DATA_T))
 
#define M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_FLAG_LTK_VALID   0x01
 
#define M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_FLAG_IDENTITY_VALID   0x02
 
#define M2MB_BLE_PERSISTENT_DATA_SIZE(_x)   (M2MB_BLE_BTPS_STRUCTURE_OFFSET(M2MB_BLE_PERSISTENT_DATA_T, RemoteDevices) + (M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_SIZE * (_x)))
 
enum  M2MB_BLE_GAP_CENTRAL_ADDRESS_RESOLUTION_T {
  M2MB_BLE_GAR_DISABLED_E,
  M2MB_BLE_GAR_ENABLED_E
}
 
enum  M2MB_BLE_GATT_CONNECTION_EVENT_TYPE_T {
  M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_REQUEST_E,
  M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_E,
  M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_CONFIRMATION_E,
  M2MB_BLE_ET_GATT_CONNECTION_DEVICE_DISCONNECTION_E,
  M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_MTU_UPDATE_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVER_INDICATION_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVER_NOTIFICATION_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVICE_DATABASE_UPDATE_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_READ_REQUEST_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CONFIRMATION_E,
  M2MB_BLE_ET_GATT_CONNECTION_DEVICE_BUFFER_EMPTY_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CCCD_READ_REQUEST_E,
  M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CCCD_UPDATE_E
}
 
enum  M2MB_BLE_GATT_SERVER_EVENT_TYPE_T {
  M2MB_BLE_ET_GATT_SERVER_DEVICE_CONNECTION_E,
  M2MB_BLE_ET_GATT_SERVER_DEVICE_DISCONNECTION_E,
  M2MB_BLE_ET_GATT_SERVER_READ_REQUEST_E,
  M2MB_BLE_ET_GATT_SERVER_WRITE_REQUEST_E,
  M2MB_BLE_ET_GATT_SERVER_SIGNED_WRITE_REQUEST_E,
  M2MB_BLE_ET_GATT_SERVER_EXECUTE_WRITE_REQUEST_E,
  M2MB_BLE_ET_GATT_SERVER_EXECUTE_WRITE_CONFIRMATION_E,
  M2MB_BLE_ET_GATT_SERVER_CONFIRMATION_RESPONSE_E,
  M2MB_BLE_ET_GATT_SERVER_DEVICE_CONNECTION_MTU_UPDATE_E,
  M2MB_BLE_ET_GATT_SERVER_DEVICE_BUFFER_EMPTY_E
}
 
enum  M2MB_BLE_GATT_CLIENT_EVENT_TYPE_T {
  M2MB_BLE_ET_GATT_CLIENT_ERROR_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_SERVICE_DISCOVERY_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_SERVICE_DISCOVERY_BY_UUID_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_INCLUDED_SERVICES_DISCOVERY_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_CHARACTERISTIC_DISCOVERY_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_READ_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_READ_LONG_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_READ_BY_UUID_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_READ_MULTIPLE_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_WRITE_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_PREPARE_WRITE_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_EXECUTE_WRITE_RESPONSE_E,
  M2MB_BLE_ET_GATT_CLIENT_EXCHANGE_MTU_RESPONSE_E
}
 
enum  M2MB_BLE_GATT_CONNECTION_TYPE_T {
  M2MB_BLE_GCT_LE_E,
  M2MB_BLE_GCT_BR_EDR_E
}
 
enum  M2MB_BLE_GATT_SERVICE_TYPE_T {
  M2MB_BLE_ST_SECONDARY_E,
  M2MB_BLE_ST_PRIMARY_E
}
 
enum  M2MB_BLE_GATT_UUID_TYPE_T {
  M2MB_BLE_GU_UUID_16_E,
  M2MB_BLE_GU_UUID_128_E,
  M2MB_BLE_GU_UUID_32_E
}
 
enum  M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_TYPE_T {
  M2MB_BLE_AET_PRIMARY_SERVICE_16_E,
  M2MB_BLE_AET_PRIMARY_SERVICE_128_E,
  M2MB_BLE_AET_SECONDARY_SERVICE_16_E,
  M2MB_BLE_AET_SECONDARY_SERVICE_128_E,
  M2MB_BLE_AET_INCLUDE_DEFINITION_E,
  M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_16_E,
  M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_128_E,
  M2MB_BLE_AET_CHARACTERISTIC_VALUE_16_E,
  M2MB_BLE_AET_CHARACTERISTIC_VALUE_128_E,
  M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_16_E,
  M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_128_E,
  M2MB_BLE_AET_PRIMARY_SERVICE_32_E,
  M2MB_BLE_AET_SECONDARY_SERVICE_32_E,
  M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_32_E,
  M2MB_BLE_AET_CHARACTERISTIC_VALUE_32_E,
  M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_32_E
}
 
enum  M2MB_BLE_GATT_REQUEST_ERROR_TYPE_T {
  M2MB_BLE_RET_ERROR_RESPONSE_E,
  M2MB_BLE_RET_PROTOCOL_TIMEOUT_E,
  M2MB_BLE_RET_PREPARE_WRITE_DATA_MISMATCH_E
}
 
enum  M2MB_BLE_GAP_LE_EVENT_TYPE_T {
  M2MB_BLE_ET_LE_REMOTE_FEATURES_RESULT_E,
  M2MB_BLE_ET_LE_ADVERTISING_REPORT_E,
  M2MB_BLE_ET_LE_CONNECTION_COMPLETE_E,
  M2MB_BLE_ET_LE_DISCONNECTION_COMPLETE_E,
  M2MB_BLE_ET_LE_ENCRYPTION_CHANGE_E,
  M2MB_BLE_ET_LE_ENCRYPTION_REFRESH_COMPLETE_E,
  M2MB_BLE_ET_LE_AUTHENTICATION_E,
  M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_E,
  M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_RESPONSE_E,
  M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATED_E,
  M2MB_BLE_ET_LE_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_E,
  M2MB_BLE_ET_LE_DIRECT_ADVERTISING_REPORT_E,
  M2MB_BLE_ET_LE_DATA_LENGTH_CHANGE_E,
  M2MB_BLE_ET_LE_PHY_UPDATE_COMPLETE_E,
  M2MB_BLE_ET_LE_EXTENDED_ADVERTISING_REPORT_E,
  M2MB_BLE_ET_LE_RFU0_E,
  M2MB_BLE_ET_LE_RFU1_E,
  M2MB_BLE_ET_LE_RFU2_E,
  M2MB_BLE_ET_LE_SCAN_TIMEOUT_E,
  M2MB_BLE_ET_LE_ADVERTISING_SET_TERMINATED_E,
  M2MB_BLE_ET_LE_SCAN_REQUEST_RECEIVED_E,
  M2MB_BLE_ET_LE_CHANNEL_SELECTION_ALGORITHM_UPDATE_E
}
 
enum  M2MB_BLE_GAP_LE_ADVERTISING_REPORT_TYPE_T {
  M2MB_BLE_RT_CONNECTABLE_UNDIRECTED_E,
  M2MB_BLE_RT_CONNECTABLE_DIRECTED_E,
  M2MB_BLE_RT_SCANNABLE_UNDIRECTED_E,
  M2MB_BLE_RT_NON_CONNECTABLE_UNDIRECTED_E,
  M2MB_BLE_RT_SCAN_RESPONSE_E
}
 
enum  M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_TYPE_T {
  M2MB_BLE_LAT_LONG_TERM_KEY_REQUEST_E,
  M2MB_BLE_LAT_SECURITY_REQUEST_E,
  M2MB_BLE_LAT_PAIRING_REQUEST_E,
  M2MB_BLE_LAT_CONFIRMATION_REQUEST_E,
  M2MB_BLE_LAT_PAIRING_STATUS_E,
  M2MB_BLE_LAT_ENCRYPTION_INFORMATION_REQUEST_E,
  M2MB_BLE_LAT_IDENTITY_INFORMATION_REQUEST_E,
  M2MB_BLE_LAT_SIGNING_INFORMATION_REQUEST_E,
  M2MB_BLE_LAT_ENCRYPTION_INFORMATION_E,
  M2MB_BLE_LAT_IDENTITY_INFORMATION_E,
  M2MB_BLE_LAT_SIGNING_INFORMATION_E,
  M2MB_BLE_LAT_SECURITY_ESTABLISHMENT_COMPLETE_E,
  M2MB_BLE_LAT_KEYPRESS_NOTIFICATION_E,
  M2MB_BLE_LAT_EXTENDED_PAIRING_REQUEST_E,
  M2MB_BLE_LAT_EXTENDED_CONFIRMATION_REQUEST_E,
  M2MB_BLE_LAT_EXTENDED_OUT_OF_BAND_INFORMATION_E
}
 
enum  M2MB_BLE_GAP_ENCRYPTION_MODE_T {
  M2MB_BLE_EM_DISABLED_E,
  M2MB_BLE_EM_ENABLED_E
}
 
enum  M2MB_BLE_GAP_LE_BONDING_TYPE_T {
  M2MB_BLE_LBT_NO_BONDING_E,
  M2MB_BLE_LBT_BONDING_E
}
 
enum  M2MB_BLE_GAP_LE_ONFIRMATION_REQUEST_TYPE_T {
  M2MB_BLE_CRT_NONE_E,
  M2MB_BLE_CRT_PASSKEY_E,
  M2MB_BLE_CRT_DISPLAY_E,
  M2MB_BLE_CRT_OOB_E,
  M2MB_BLE_CRT_DISPLAY_YES_NO_E,
  M2MB_BLE_CRT_OOB_SECURE_CONNECTIONS_E
}
 
enum  M2MB_BLE_GAP_LE_KEYPRESS_T {
  M2MB_BLE_LKP_ENTRY_STARTED_E,
  M2MB_BLE_LKP_DIGIT_ENTERED_E,
  M2MB_BLE_LKP_DIGIT_ERASED_E,
  M2MB_BLE_LKP_CLEARED_E,
  M2MB_BLE_LKP_ENTRY_COMPLETED_E
}
 
enum  M2MB_BLE_GAP_LE_PHY_TYPE_T {
  M2MB_BLE_LPT_PHY_LE_1M_E,
  M2MB_BLE_LPT_PHY_LE_2M_E,
  M2MB_BLE_LPT_PHY_LE_CODED_E
}
 
enum  M2MB_BLE_GAP_LE_ADVERTISING_DATA_STATUS_T {
  M2MB_BLE_DS_COMPLETE_E,
  M2MB_BLE_DS_INCOMPLETE_DATA_PENDING_E,
  M2MB_BLE_DS_INCOMPLETE_DATA_TRUNCATED_E
}
 
enum  M2MB_BLE_GAP_LE_AUTHENTICATION_RESPONSE_TYPE_T {
  M2MB_BLE_LAR_LONG_TERM_KEY_E,
  M2MB_BLE_LAR_OUT_OF_BAND_DATA_E,
  M2MB_BLE_LAR_PAIRING_CAPABILITIES_E,
  M2MB_BLE_LAR_PASSKEY_E,
  M2MB_BLE_LAR_CONFIRMATION_E,
  M2MB_BLE_LAR_ERROR_E,
  M2MB_BLE_LAR_ENCRYPTION_INFORMATION_E,
  M2MB_BLE_LAR_IDENTITY_INFORMATION_E,
  M2MB_BLE_LAR_SIGNING_INFORMATION_E,
  M2MB_BLE_LAR_KEY_PRESS_E
}
 
enum  M2MB_BLE_GAP_LE_CONNECTABILITY_MODE_T {
  M2MB_BLE_LCM_NON_CONNECTABLE_E,
  M2MB_BLE_LCM_CONNECTABLE_E,
  M2MB_BLE_LCM_DIRECT_CONNECTABLE_E,
  M2MB_BLE_LCM_LOW_DUTY_CYCLE_DIRECT_CONNECTABLE_E
}
 
enum  M2MB_BLE_GAP_DISCOVERABILITY_MODE_T {
  M2MB_BLE_DM_NON_DISCOVERABLE_MODE_E,
  M2MB_BLE_DM_LIMITED_DISCOVERABLE_MODE_E,
  M2MB_BLE_DM_GENERAL_DISCOVERABLE_MODE_E
}
 
enum  M2MB_BLE_GAP_LE_PAIRABILITY_MODE_T {
  M2MB_BLE_LPM_NON_PAIRABLEMODE_E,
  M2MB_BLE_LPM_PAIRABLE_MODE_E,
  M2MB_BLE_LPM_PAIRABLE_MODE_ENABLE_EXTENDED_EVENTS_E
}
 
enum  M2MB_BLE_GAP_LE_IO_CAPABILITY_T {
  M2MB_BLE_LIC_DISPLAY_ONLY_E,
  M2MB_BLE_LIC_DISPLAY_YES_NO_E,
  M2MB_BLE_LIC_KEYBOARD_ONLY_E,
  M2MB_BLE_LIC_NO_INPUT_NO_OUTPUT_E,
  M2MB_BLE_LIC_KEYBOARD_DISPLAY_E
}
 
enum  M2MB_BLE_GAP_LE_FILTER_POLICY_T {
  M2MB_BLE_FP_NO_FILTER_E,
  M2MB_BLE_FP_WHITE_LIST_E,
  M2MB_BLE_FP_NO_WHITE_LIST_DIRECTED_RPA_E,
  M2MB_BLE_FP_WHITE_LIST_DIRECTED_RPA_E
}
 
enum  M2MB_BLE_GAP_LE_ADDRESS_TYPE_T {
  M2MB_BLE_LAT_PUBLIC_E,
  M2MB_BLE_LAT_RANDOM_E,
  M2MB_BLE_LAT_PUBLIC_IDENTITY_E,
  M2MB_BLE_LAT_RANDOM_IDENTITY_E,
  M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,
  M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PRIVATE_E,
  M2MB_BLE_LAT_ANONYMOUS_E
}
 
enum  M2MB_BLE_GAP_LE_CHANNEL_SELECTION_ALGORITHM_T {
  M2MB_BLE_SA_ALGORITHM_NUM1_E,
  M2MB_BLE_SA_ALGORITHM_NUM2_E
}
 
enum  M2MB_BLE_HCI_DRIVERTYPE_T {
  M2MB_BLE_COMM_DRIVER_E,
  M2MB_BLE_USB_DRIVER_E
}
 
enum  M2MB_BLE_HCI_COMM_PROTOCOL_T {
  M2MB_BLE_COMM_PROTOCOL_UART_E,
  M2MB_BLE_COMM_PROTOCOL_UART_RTS_CTS_E,
  M2MB_BLE_COMM_PROTOCOL_BCSP_E,
  M2MB_BLE_COMM_PROTOCOL_BCSP_MUZZLED_E,
  M2MB_BLE_COMM_PROTOCOL_H4DS_E,
  M2MB_BLE_COMM_PROTOCOL_H4DS_RTS_CTS_E,
  M2MB_BLE_COMM_PROTOCOL_HCILL_E,
  M2MB_BLE_COMM_PROTOCOL_HCILL_RTS_CTS_E,
  M2MB_BLE_COMM_PROTOCOL_3WIRE_E,
  M2MB_BLE_COMM_PROTOCOL_3WIRE_RTS_CTS_E,
  M2MB_BLE_COMM_PROTOCOL_SIBS_E,
  M2MB_BLE_COMM_PROTOCOL_SIBS_RTS_CTS_E
}
 
enum  M2MB_BLE_HCI_USB_DRIVER_T {
  M2MB_BLE_USB_DRIVER_SS1_E,
  M2MB_BLE_USB_DRIVER_GARMIN_E
}
 
enum  M2MB_BLE_GATT_Service_DISCOVERY_EVENT_TYPE_T {
  M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_INDICATION_E,
  M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_COMPLETE_E
}
 
enum  M2MB_BLE_GAP_LE_SCAN_TYPE_T {
  M2MB_BLE_ST_PASSIVE_E,
  M2MB_BLE_ST_ACTIVE_E
}
 
enum  M2MB_BLE_GAP_LE_EXTENDED_SCAN_FILTER_DUPLICATES_TYPE_T {
  M2MB_BLE_FD_DISABLED_E,
  M2MB_BLE_FD_ENABLED_E,
  M2MB_BLE_FD_ENABLED_RESET_EACH_SCAN_PERIOD_E
}
 
typedef struct M2MB_BLE_NONALIGNEDWORD M2MB_BLE_NONALIGNEDWORD_T
 
typedef HANDLE M2MB_PERSIST_HANDLE_T
 
typedef struct M2MB_BLE_CLIENT_INFO M2MB_BLE_CLIENT_INFO_T
 
typedef struct M2MB_BLE_GAPS_CLIENT_INFO M2MB_BLE_GAPS_CLIENT_INFO_T
 
typedef struct M2MB_BLE_SEND_INFO M2MB_BLE_SEND_INFO_T
 
typedef struct M2MB_BLE_GAPS_DEVICE_APPEARANCE_MAP M2MB_BLE_GAPS_DEVICE_APPEARANCE_MAP_T
 
typedef struct M2MB_BLE_DATA_BUFF M2MB_BLE_DATA_BUFF_T
 
typedef struct M2MB_BLE_BD_ADDR_S M2MB_BLE_BD_ADDR_T
 
typedef struct M2MB_BLE_SECURE_CONNECTIONS_CONFIRMATION M2MB_BLE_SECURE_CONNECTIONS_CONFIRMATION_T
 
typedef struct M2MB_BLE_SECURE_CONNECTIONS_RANDOMIZER M2MB_BLE_SECURE_CONNECTIONS_RANDOMIZER_T
 
typedef struct M2MB_BLE_RANDOM_NUMBER M2MB_BLE_RANDOM_NUMBER_T
 
typedef struct M2MB_BLE_ENCRYPTION_KEY M2MB_BLE_ENCRYPTION_KEY_T
 
typedef struct M2MB_BLE_LONG_TERM_KEY M2MB_BLE_LONG_TERM_KEY_T
 
typedef struct M2MB_BLE_UUID_16 M2MB_BLE_UUID_16_T
 
typedef struct M2MB_BLE_UUID_32 M2MB_BLE_UUID_32_T
 
typedef struct M2MB_BLE_UUID_128 M2MB_BLE_UUID_128_T
 
typedef struct M2MB_BLE_ATT_AUTHENTICATION_SIGNATURE M2MB_BLE_ATT_AUTHENTICATION_SIGNATURE_T
 
typedef struct M2MB_BLE_LE_FEATURES M2MB_BLE_LE_FEATURES_T
 
typedef struct M2MB_BLE__ADVERTISING_DATA M2MB_BLE_ADVERTISING_DATA_T
 
typedef struct M2MB_BLE_SCAN_RESPONSE_DATA M2MB_BLE_SCAN_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_UUID M2MB_BLE_GATT_UUID_T
 
typedef struct M2MB_BLE_GATT_EXCHANGE_MTU_RESPONSE_DATA M2MB_BLE_GATT_EXCHANGE_MTU_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_EXECUTE_WRITE_RESPONSE_DATA M2MB_BLE_GATT_EXECUTE_WRITE_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_PREPARE_WRITE_RESPONSE_DATA M2MB_BLE_GATT_PREPARE_WRITE_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_WRITE_RESPONSE_DATA M2MB_BLE_GATT_WRITE_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_READ_MULTIPLE_RESPONSE_DATA M2MB_BLE_GATT_READ_MULTIPLE_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_READ_LONG_RESPONSE_DATA M2MB_BLE_GATT_READ_LONG_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_READ_EVENT_ENTRY M2MB_BLE_GATT_READ_EVENT_ENTRY_T
 
typedef struct M2MB_BLE_GATT_READ_BY_UUID_RESPONSE_DATA M2MB_BLE_GATT_READ_BY_UUID_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_READ_RESPONSE_DATA M2MB_BLE_GATT_READ_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVICE_INFORMATION M2MB_BLE_GATT_SERVICE_INFORMATION_T
 
typedef struct M2MB_BLE_GATT_REQUEST_ERROR_DATA M2MB_BLE_GATT_REQUEST_ERROR_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVICE_DISCOVERY_RESPONSE_DATA M2MB_BLE_GATT_SERVICE_DISCOVERY_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_INCLUDE_INFORMATION M2MB_BLE_GATT_INCLUDE_INFORMATION_T
 
typedef struct M2MB_BLE_GATT_SERVICE_INFORMATION_BY_UUID M2MB_BLE_GATT_SERVICE_INFORMATION_BY_UUID_T
 
typedef struct M2MB_BLE_GATT_SERVICE_DISCOVERY_BY_UUID_RESPONSE_DATA M2MB_BLE_GATT_SERVICE_DISCOVERY_BY_UUID_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_INCLUDED_SERVICES_DISCOVERY_RESPONSE_DATA M2MB_BLE_GATT_INCLUDED_SERVICES_DISCOVERY_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_VALUE M2MB_BLE_GATT_CHARACTERISTIC_VALUE_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DISCOVERY_RESPONSE_DATA M2MB_BLE_GATT_CHARACTERISTIC_DISCOVERY_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_RESPONSE_DATA M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_RESPONSE_DATA_T
 
typedef struct M2MB_BLE_GATT_CLIENT_EVENT_DATA M2MB_BLE_GATT_CLIENT_EVENT_DATA_T
 
typedef struct M2MB_BLE_GATT_DEVICE_CONNECTION_REQUEST_DATA M2MB_BLE_GATT_DEVICE_CONNECTION_REQUEST_DATA_T
 
typedef struct M2MB_BLE_GATT_DEVICE_CONNECTION_DATA M2MB_BLE_GATT_DEVICE_CONNECTION_DATA_T
 
typedef struct M2MB_BLE_GATT_DEVICE_CONNECTION_CONFIRMATION_DATA M2MB_BLE_GATT_DEVICE_CONNECTION_CONFIRMATION_DATA_T
 
typedef struct M2MB_BLE_GATT_DEVICE_CONFIRMATION_REQUEST_DATA M2MB_BLE_GATT_DEVICE_CONFIRMATION_REQUEST_DATA_T
 
typedef struct M2MB_BLE_GATT_DEVICE_DISCONNECTION_DATA M2MB_BLE_GATT_DEVICE_DISCONNECTION_DATA_T
 
typedef struct M2MB_BLE_GATT_DEVICE_BUFFER_EMPTY_DATA M2MB_BLE_GATT_DEVICE_BUFFER_EMPTY_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVER_NOTIFICATION_DATA M2MB_BLE_GATT_SERVER_NOTIFICATION_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVER_INDICATION_DATA M2MB_BLE_GATT_SERVER_INDICATION_DATA_T
 
typedef struct M2MB_BLE_SERVER_INFO M2MB_BLE_SERVER_INFO_T
 
typedef struct M2MB_BLE_GATT_DEVICE_CONNECTION_MTU_UPDATE_DATA M2MB_BLE_GATT_DEVICE_CONNECTION_MTU_UPDATE_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVICE_CHANGED_DATA M2MB_BLE_GATT_SERVICE_CHANGED_DATA_T
 
typedef struct M2MB_BLE_GATT_CONNECTION_SERVICE_DATABASE_UPDATE_DATA M2MB_BLE_GATT_CONNECTION_SERVICE_DATABASE_UPDATE_DATA_T
 
typedef struct M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_READ_DATA M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_READ_DATA_T
 
typedef struct M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CONFIRMATION_DATA M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CONFIRMATION_DATA_T
 
typedef struct M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CCCD_READ_DATA M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CCCD_READ_DATA_T
 
typedef struct M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CCCD_UPDATE_DATA M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CCCD_UPDATE_DATA_T
 
typedef struct M2MB_BLE_GATT_CONNECTION_EVENT_DATA M2MB_BLE_GATT_CONNECTION_EVENT_DATA_T
 
typedef struct M2MB_BLE_GATT_READ_REQUEST_DATA M2MB_BLE_GATT_READ_REQUEST_DATA_T
 
typedef struct M2MB_BLE_GATT_WRITE_RRQUEST_DATA M2MB_BLE_GATT_WRITE_RRQUEST_DATA_T
 
typedef struct M2MB_BLE_GATT_SIGNED_WRITE_REQUEST_DATA M2MB_BLE_GATT_SIGNED_WRITE_REQUEST_DATA_T
 
typedef struct M2MB_BLE_GATT_EXECUTE_WRITE_REQUEST_DATA M2MB_BLE_GATT_EXECUTE_WRITE_REQUEST_DATA_T
 
typedef struct M2MB_BLE_GATT_EXECUTE_WRITE_CONFIRMATION_DATA M2MB_BLE_GATT_EXECUTE_WRITE_CONFIRMATION_DATA_T
 
typedef struct M2MB_BLE_GATT_CONFIRMATION_DATA M2MB_BLE_GATT_CONFIRMATION_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T
 
typedef struct M2MB_BLE_GATT_ATTRIBUTE_HANDLE_GROUP M2MB_BLE_GATT_ATTRIBUTE_HANDLE_GROUP_T
 
typedef struct M2MB_BLE_GATT_PRIMARY_SERVICE_16_ENTRY M2MB_BLE_GATT_PRIMARY_SERVICE_16_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DECLARATION_16_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_DECLARATION_16_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_VALUE_16_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_VALUE_16_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_16_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_16_ENTRY_T
 
typedef struct M2MB_BLE_GATT_PRIMARY_SERVICE_128_ENTRY M2MB_BLE_GATT_PRIMARY_SERVICE_128_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DECLARATION_128_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_DECLARATION_128_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_VALUE_128_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_VALUE_128_ENTRY_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_128_ENTRY M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_128_ENTRY_T
 
typedef struct M2MB_BLE_GATT_SERVER_EVENT_DATA M2MB_BLE_GATT_SERVER_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_WHITE_LIST_ENTRY M2MB_BLE_GAP_LE_WHITE_LIST_ENTRY_T
 
typedef struct M2MB_BLE_GAP_LE_RESOLVING_LIST_ENTRY M2MB_BLE_GAP_LE_RESOLVING_LIST_ENTRY_T
 
typedef struct M2MB_BLE_GAP_LE_PARAM M2MB_BLE_GAP_LE_PARAM_T
 
typedef struct M2MB_BLE_GAP_LE_CONNECTABILITY_PARAMETERS M2MB_BLE_GAP_LE_CONNECTABILITY_PARAMETERS_T
 
typedef struct M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS_T
 
typedef struct M2MB_BLE_GAP_LE_CONNECTION_PARAMETERS M2MB_BLE_GAP_LE_CONNECTION_PARAMETERS_T
 
typedef struct M2MB_BLE_GAP_LE_REMOTE_FEATURES_EVENT_DATA M2MB_BLE_GAP_LE_REMOTE_FEATURES_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_ADVERTISING_DATA_ENTRY M2MB_BLE_GAP_LE_ADVERTISING_DATA_ENTRY_T
 
typedef struct M2MB_BLE_GAP_LE_ADVERTISING_DATA M2MB_BLE_GAP_LE_ADVERTISING_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_ADVERTISING_REPORT_DATA M2MB_BLE_GAP_LE_ADVERTISING_REPORT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_ADVERTISING_REPORT_EVENT_DATA M2MB_BLE_GAP_LE_ADVERTISING_REPORT_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_DIRECT_ADVERTISING_REPORT_DATA M2MB_BLE_GAP_LE_DIRECT_ADVERTISING_REPORT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_DIRECT_ADVERTISING_REPORT_EVENT_DATA M2MB_BLE_GAP_LE_DIRECT_ADVERTISING_REPORT_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_CURRENT_CONNECTION_PARAMETERS M2MB_BLE_GAP_LE_CURRENT_CONNECTION_PARAMETERS_T
 
typedef struct M2MB_BLE_GAP_LE_CONNECTION_COMPLETE_EVENT_DATA M2MB_BLE_GAP_LE_CONNECTION_COMPLETE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_DISCONNECTION_COMPLETE_EVENT_DATA M2MB_BLE_GAP_LE_DISCONNECTION_COMPLETE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_ENCRYPTION_CHANGE_EVENT_DATA M2MB_BLE_GAP_LE_ENCRYPTION_CHANGE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_ENCRYPTION_REFRESH_COMPLETE_EVENT_DATA M2MB_BLE_GAP_LE_ENCRYPTION_REFRESH_COMPLETE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_KEY_REQUEST_INFO M2MB_BLE_GAP_LE_KEY_REQUEST_INFO_T
 
typedef struct M2MB_BLE_GAP_LE_KEY_DISTRIBUTION M2MB_BLE_GAP_LE_KEY_DISTRIBUTION_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_KEY_DISTRIBUTION M2MB_BLE_GAP_LE_EXTENDED_KEY_DISTRIBUTION_T
 
typedef struct M2MB_BLE_GAP_LE_PAIRING_CAPABILITIES M2MB_BLE_GAP_LE_PAIRING_CAPABILITIES_T
 
typedef struct M2MB_BLE_GAP_LE_SECURE_CONNECTIONS_OOB_DATA M2MB_BLE_GAP_LE_SECURE_CONNECTIONS_OOB_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_T
 
typedef struct M2MB_BLE_GAP_LE_SECURITY_REQUEST M2MB_BLE_GAP_LE_SECURITY_REQUEST_T
 
typedef struct M2MB_BLE_GAP_LE_CONFIRMATION_REQUEST M2MB_BLE_GAP_LE_CONFIRMATION_REQUEST_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_CONFIRMATION_REQUEST M2MB_BLE_GAP_LE_EXTENDED_CONFIRMATION_REQUEST_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_OUT_OF_BAND_INFORMATION M2MB_BLE_GAP_LE_EXTENDED_OUT_OF_BAND_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_PAIRING_STATUS M2MB_BLE_GAP_LE_PAIRING_STATUS_T
 
typedef struct M2MB_BLE_GAP_LE_ENCRYPTION_REQUEST_INFORMATION M2MB_BLE_GAP_LE_ENCRYPTION_REQUEST_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_ENCRYPTION_INFORMATION M2MB_BLE_GAP_LE_ENCRYPTION_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_IDENTITY_INFORMATION M2MB_BLE_GAP_LE_IDENTITY_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_SIGNING_INFORMATION M2MB_BLE_GAP_LE_SIGNING_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_SECURITY_ESTABLISHMENT_COMPLETE M2MB_BLE_GAP_LE_SECURITY_ESTABLISHMENT_COMPLETE_T
 
typedef struct M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_EVENT_DATA M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATE_RESPONSE_EVENT_DATA M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATE_RESPONSE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATED_EVENT_DATA M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATED_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_EVENT_DATA M2MB_BLE_GAP_LE_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_DATA_LENGTH_CHANGE_EVENT_DATA M2MB_BLE_GAP_LE_DATA_LENGTH_CHANGE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_PHY_UPDATE_COMPLETE_EVENT_DATA M2MB_BLE_GAP_LE_PHY_UPDATE_COMPLETE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_REPORT_DATA M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_REPORT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_REPORT_EVENT_DATA M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_REPORT_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_ADVERTISING_SET_TERMINATED_EVENT_DATA M2MB_BLE_GAP_LE_ADVERTISING_SET_TERMINATED_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_SCAN_REQUEST_RECEIVED_EVENT_DATA M2MB_BLE_GAP_LE_SCAN_REQUEST_RECEIVED_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_CHANNEL_SELECTION_ALGORITHM_UPDATE_EVENT_DATA M2MB_BLE_GAP_LE_CHANNEL_SELECTION_ALGORITHM_UPDATE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_EVENT_DATA M2MB_BLE_GAP_LE_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_LONG_TERM_KEY_INFORMATION M2MB_BLE_GAP_LE_LONG_TERM_KEY_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_OOB_DATA M2MB_BLE_GAP_LE_OOB_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_SLAVE_SECURITY_INFORMATION M2MB_BLE_GAP_LE_SLAVE_SECURITY_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_MASTER_SECURITY_INFORMATION M2MB_BLE_GAP_LE_MASTER_SECURITY_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_SECURITY_INFORMATION M2MB_BLE_GAP_LE_SECURITY_INFORMATION_T
 
typedef struct M2MB_BLE_GAP_LE_AUTHENTICATION_RESPONSE_INFORMATION M2MB_BLE_GAP_LE_AUTHENTICATION_RESPONSE_INFORMATION_T
 
typedef struct M2MB_BLE_HCI_COMMDRIVERINFORMATION M2MB_BLE_HCI_COMMDRIVERINFORMATION_T
 
typedef struct M2MB_BLE_HCI_USBDRIVERINFORMATION M2MB_BLE_HCI_USBDRIVERINFORMATION_T
 
typedef struct M2MB_BLE_HCI_DRIVERINFORMATION M2MB_BLE_HCI_DRIVERINFORMATION_T
 
typedef struct M2MB_BLE_SCAN_PARAMETERS M2MB_BLE_SCAN_PARAMETERS_T
 
typedef struct M2MB_BLE_PARAM M2MB_BLE_PARAM_T
 
typedef struct M2MB_BLE_DEVICE_INFO M2MB_BLE_DEVICE_INFO_T
 
typedef struct M2MB_BLE_DIS_PNP_ID_DATA M2MB_BLE_DIS_PNP_ID_DATA_T
 
typedef struct M2MB_BLE_INIT_PARAM M2MB_BLE_INIT_PARAM_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTION_INFORMATION M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTION_INFORMATION_T
 
typedef struct M2MB_BLE_GATT_CHARACTERISTIC_INFORMATION M2MB_BLE_GATT_CHARACTERISTIC_INFORMATION_T
 
typedef struct M2MB_BLE_GATT_SERVICE_DISCOVERY_INDICATION_DATA M2MB_BLE_GATT_SERVICE_DISCOVERY_INDICATION_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVICE_DISCOVERY_COMPLETE_DATA M2MB_BLE_GATT_SERVICE_DISCOVERY_COMPLETE_DATA_T
 
typedef struct M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_CONNECTION_PARAMETERS M2MB_BLE_GAP_LE_EXTENDED_CONNECTION_PARAMETERS_T
 
typedef struct M2MB_BLE_GAP_LE_EXTENDED_SCANNING_PHY_PARAMETERS M2MB_BLE_GAP_LE_EXTENDED_SCANNING_PHY_PARAMETERS_T
 
typedef struct M2MB_BLE_PASSKEY_RSP_S M2MB_BLE_PASSKEY_RSP_T
 
typedef struct M2MB_BLE_PERSISTENT_DEVICE_REMOTE_DATA M2MB_BLE_PERSISTENT_DEVICE_REMOTE_DATA_T
 
typedef struct M2MB_BLE_PERSISTENT_DATA M2MB_BLE_PERSISTENT_DATA_T
 
typedef VOID(* M2MB_BLE_GAP_LE_EVENT_CB_T) (UINT32 BluetoothStackID, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
 Declared type that represents the Prototype Function for the GAP LE event callback. More...
 
typedef VOID(* M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_CB_T) (UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
 This declared type represents the prototype function for GATT Service Discovery Event data callback. This function will be called whenever a GATT server event occurs that is associated with the specified Bluetooth stack ID. More...
 
typedef VOID(* M2MB_BLE_GATT_CLIENT_EVENT_CB_T) (UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
 The following function is for an GATT Client Event Callback. More...
 
typedef VOID(* M2MB_BLE_GATT_SERVER_EVENT_CB_T) (UINT32 BluetoothStackID, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_Server_Event_Data, UINT32 CallbackParameter)
 The following function is for an GATT Server Event Callback. More...
 
typedef VOID(* M2MB_BLE_GATT_CONNECT_USER_CB_T) (VOID *ctx, UINT32 eventType, M2MB_BLE_DEVICE_INFO_T *deviceInfo)
 This declared type represents the prototype function for a connection event user callback. More...
 
typedef VOID(* M2MB_BLE_PASSKEY_USER_CB_T) (VOID *ctx, UINT32 eventType, M2MB_BLE_PASSKEY_RSP_T passKeyResp)
 Declared type that represents the Prototype Function for the passkey response data user callback. More...
 
typedef VOID(* M2MB_BLE_GAP_PAIR_STATUS_USER_CB_T) (VOID *ctx, UINT32 eventType, M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
 Declared type that represents the Prototype Function for the pairing status user callback. More...
 
INT32 m2mb_ble_init (M2MB_BLE_INIT_PARAM_T *initParam)
 BLE Interface Initialization. More...
 
INT32 m2mb_ble_set_pairable (UINT32 pairMode)
 BLE Set Pairable Mode. More...
 
INT32 m2mb_ble_set_disc (UINT32 discMode)
 BLE Set discoverable Mode. More...
 
INT32 m2mb_ble_set_connect (UINT32 connMode)
 BLE Set the connect Mode. More...
 
UINT32 m2mb_ble_bluetooth_stack_id_get (VOID)
 BLE Get the StackId. More...
 
INT32 m2mb_ble_set_io_capabilities (UINT32 bleStackId, UINT32 ioCap)
 BLE Set the IoCapability. More...
 
UINT32 m2mb_ble_gaps_instance_id_get (VOID)
 BLE Get the gaps instanceId. More...
 
INT32 m2mb_ble_service_register (UINT32 bleStackId, UINT8 serviceFlag, UINT32 srviceAttCnt, M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *ServiceTable, M2MB_BLE_GATT_ATTRIBUTE_HANDLE_GROUP_T *ServiceHandleGroupResult, M2MB_BLE_GATT_SERVER_EVENT_CB_T ServerEventCallback, UINT32 CallbackParameter)
 BLE Registers a GATT service with the local GATT server. More...
 
VOID m2mb_ble_service_deregister (UINT32 serviceId)
 BLE De-registers a previously registered GATT service that was registered via a successful call to the m2mb_ble_service_register() function. More...
 
void m2mb_ble_advParamGet (M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS_T *advParam)
 BLE Advertising params get. More...
 
void m2mb_ble_advParamSet (M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS_T advParam)
 BLE Advertising params set. More...
 
VOID m2mb_ble_advteriseDataInit (UINT8 enableFlag)
 BLE Advertising data init. More...
 
VOID m2mb_ble_scanRespDataInit (UINT8 enableFlag)
 BLE Scan Response data init. More...
 
INT32 m2mb_ble_advertise (UINT32 enable)
 BLE Advertise enable. More...
 
INT32 m2mb_ble_send_notification (UINT32 serviceId, char *msg, UINT32 len, UINT32 attOffset)
 Provides a mechanism for a service handler to send a GATT attribute handle/value notification to a remote, connected, GATT client. More...
 
INT32 m2mb_ble_send_indication (UINT32 serviceId, char *msg, UINT32 len, UINT32 attOffset)
 Provides a mechanism for a service handler to send a GATT attribute handle/value notification to a remote, connected, GATT client. More...
 
INT32 m2mb_ble_read_response (UINT32 bleStackId, UINT32 transactionId, UINT32 dataLen, UINT8 *data)
 Responds with a successful response to a received M2MB_BLE_ET_GATT_SERVER_READ_REQUEST_E event. More...
 
INT32 m2mb_ble_write_response (UINT32 bleStackId, UINT32 transactionId)
 Provides a mechanism for a service handler to successfully respond to a received GATT/ATT write request (M2MB_BLE_ET_GATT_SERVER_WRITE_REQUEST_E) event. More...
 
INT32 m2mb_ble_error_response (UINT32 bleStackId, UINT32 transactionId, UINT16 attOffset, UINT8 errCode)
 Provides a mechanism for a service handler to respond to a received GATT/ATT request with an error response. More...
 
INT32 m2mb_ble_gap_le_perform_scan (UINT32 bleStackId, M2MB_BLE_GAP_LE_SCAN_TYPE_T scanType, UINT32 scanInterval, UINT32 scanWindow, M2MB_BLE_GAP_LE_ADDRESS_TYPE_T localAddressType, M2MB_BLE_GAP_LE_FILTER_POLICY_T filterPolicy, M2MB_BOOL_T filterDuplicates, M2MB_BLE_GAP_LE_EVENT_CB_T gapLeEventCb, UINT32 cbParam)
 Starts an LE scan procedure. More...
 
INT32 m2mb_ble_gap_le_cancel_scan (UINT32 bleStackId)
 Cancels a scan process that was started via a successful call to the m2mb_ble_gap_le_perform_scan() function. More...
 
INT32 m2mb_ble_gap_le_create_connection (UINT32 bleStackId, UINT32 scanInterval, UINT32 scanWindow, M2MB_BLE_GAP_LE_FILTER_POLICY_T initatorFilterPolicy, M2MB_BLE_GAP_LE_ADDRESS_TYPE_T remoteAddressType, M2MB_BLE_BD_ADDR_T *remoteDevice, M2MB_BLE_GAP_LE_ADDRESS_TYPE_T localAddressType, M2MB_BLE_GAP_LE_CONNECTION_PARAMETERS_T *connectionParameters, M2MB_BLE_GAP_LE_EVENT_CB_T gapLeEventCb, UINT32 cbParam)
 Enables the local host to create a connection to a remote device using the Bluetooth LE radio. More...
 
INT32 m2mb_ble_gap_le_cancel_create_connection (UINT32 bleStackId)
 Cancels a connection establishment procedure that was started via a successful call to the m2mb_ble_gap_le_create_connection() function. More...
 
INT32 m2mb_ble_gap_le_query_encryption_mode (UINT32 bleStackId, M2MB_BLE_BD_ADDR_T remoteAddress, M2MB_BLE_GAP_ENCRYPTION_MODE_T *gapEncryptionMode)
 Queries the current Encryption Mode. More...
 
INT32 m2mb_ble_disconnect_device (UINT32 bleStackId, UINT32 connId)
 Enables the local host to disconnect a currently connected LE device. More...
 
INT32 m2mb_ble_gatt_start_service_discovery (UINT32 bleStackId, UINT32 connectionID, UINT32 numberOfUUID, M2MB_BLE_GATT_UUID_T *uuidList, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_CB_T serviceDiscoveryCb, UINT32 cbParam)
 Performs a service discovery operation that will automatically discover all included services, characteristics, and characteristic descriptors for either all services supported by a remote device or all services of a specified UUID that are supported by a remote device. More...
 
INT32 m2mb_ble_gatt_read_value_request (UINT32 bleStackId, UINT32 connectionId, UINT16 attributeHandle, M2MB_BLE_GATT_CLIENT_EVENT_CB_T gattClientEventCb, UINT32 cbParam)
 Performs a read request on a remote device for a specific attribute value. More...
 
INT32 m2mb_ble_gatt_write_request (UINT32 bleStackId, UINT32 connectionId, UINT16 attributeHandle, UINT16 attributeLength, VOID *attributrValue, M2MB_BLE_GATT_CLIENT_EVENT_CB_T gattClientEventCb, UINT32 cbParam)
 Performs a write request to a remote device for a specified attribute. More...
 
VOID m2mb_ble_set_get_connection_cb (VOID *cbCtx, M2MB_BLE_GATT_CONNECT_USER_CB_T cb)
 This function is used to set and get the connection callback function. More...
 
VOID m2mb_ble_set_passkey_cb (VOID *cbCtx, M2MB_BLE_PASSKEY_USER_CB_T cb)
 This function is used to set the passkey call back. More...
 
VOID m2mb_ble_set_pairing_status_cb (VOID *cbCtx, M2MB_BLE_GAP_PAIR_STATUS_USER_CB_T cb)
 This function is used to set the pairing status callback function. More...
 
INT32 m2mb_ble_gap_query_local_bdAddr (UINT32 bleStackID, M2MB_BLE_BD_ADDR_T *bdAddr)
 Queries (and reports) the device address of the local Bluetooth device. More...
 
UINT32 m2mb_ble_bluetooth_dis_id_get ()
 BLE get the device instance Id. More...
 
UINT32 m2mb_ble_get_gatt_mtu ()
 BLE get the MTU size. More...
 
UINT32 m2mb_ble_get_connection_count ()
 BLE get the connection count value. More...
 
INT32 m2mb_ble_dis_query_pnp_id (UINT32 bleStackId, UINT32 disInstanceId, M2MB_BLE_DIS_PNP_ID_DATA_T *pnpIdData)
 Queries the current PnP ID Data characteristic value on the specified DIS instance. More...
 
INT32 m2mb_ble_dis_set_pnp_id (UINT32 bleStackId, UINT32 disInstanceId, M2MB_BLE_DIS_PNP_ID_DATA_T *pnpIdData)
 Queries the current PnP ID Data characteristic value on the specified DIS instance. More...
 
INT32 m2mb_ble_gap_le_set_advertising_data (UINT32 bleStackId, UINT32 len, M2MB_BLE_ADVERTISING_DATA_T *advertisingData)
 Sets the advertising data that is used during the advertising procedure. More...
 
M2MB_BLE_DEVICE_INFO_Tm2mb_ble_get_current_peer_device_info ()
 The following function searches the specified List for the specified Connection bluetooth device address. More...
 
INT32 m2mb_ble_gaps_set_device_name (UINT32 bleStackId, UINT32 gapsInstanceId, char *deviceName)
 Sets the device name characteristic of a generic device on the specified GAP Service Instance. More...
 
INT32 m2mb_ble_gaps_query_device_name (UINT32 bleStackId, UINT32 gapsInstanceId, char *deviceName)
 Queries the current device name characteristic of a generic device from the specified GAP Service Instance. More...
 
INT32 m2mb_ble_gap_le_set_scan_response_data (UINT32 bleStackId, UINT32 len, M2MB_BLE_SCAN_RESPONSE_DATA_T *scanRespData)
 Queries the current device name characteristic of a generic device from the specified GAP Service Instance. More...
 
UINT8 m2mb_ble_justworksPairingStatus_Get (VOID)
 The following function is used to check whether Just Works pairing is used during the connection process. More...
 
INT32 m2mb_ble_txpower_set (UINT32 bleStackId, M2MB_BOOL_T conn, INT8 txPower)
 
INT32 m2mb_ble_txpower_get (UINT32 bleStackId, M2MB_BOOL_T conn, INT8 *txPower)
 
INT32 m2mb_ble_txtest (UINT32 BluetoothStackID, UINT8 TX_Frequency, UINT8 Length_Of_Test_Data, UINT8 Packet_Payload, UINT8 *StatusResult)
 
INT32 m2mb_ble_rxtest (UINT32 BluetoothStackID, UINT8 RX_Frequency, UINT8 *StatusResult)
 

Detailed Description

This section describes the M2MB APIs for BLE functionality..

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.

Macro Definition Documentation

◆ ASSIGN_HOST_WORD_TO_LITTLE_ENDIAN_UNALIGNED_WORD

#define ASSIGN_HOST_WORD_TO_LITTLE_ENDIAN_UNALIGNED_WORD (   _x,
  _y 
)
Value:
{ \
((UINT8 *)(_x))[0] = ((UINT8)(((UINT16)(_y)) & 0xFF)); \
((UINT8 *)(_x))[1] = ((UINT8)((((UINT16)(_y)) >> 8) & 0xFF)); \
}
unsigned char UINT8
Definition: m2mb_types.h:83
unsigned short UINT16
Definition: m2mb_types.h:84

The following MACRO is a utility MACRO that exists to aid in the
Comparison of two M2MB_BLE_BD_ADDR_T variables.This MACRO only
returns whether the two M2MB_BLE_BD_ADDR_T variables are equal
(MACRO returns boolean result) NOT less than/greater than. The
two parameters to this MACRO are both of type M2MB_BLE_BD_ADDR_T
and represent the M2MB_BLE_BD_ADDR_T variables to compare.

Definition at line 258 of file m2mb_ble_driver.h.

◆ BLE_SERVICE_FLAGS

#define BLE_SERVICE_FLAGS   (M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE)

The following persist device handle

Definition at line 292 of file m2mb_ble_driver.h.

◆ DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING

#define DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING   0x08

Definition at line 3398 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ADVERTISING_DATA_MAXIMUM_SIZE

#define M2MB_BLE_ADVERTISING_DATA_MAXIMUM_SIZE   31

The following type defines the buffer that is used to write or
read the advertising data to be advertised by the local device
(Version 4.0 + LE).The size of this buffer is always fixed.

Definition at line 592 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ASSIGN_BD_ADDR

#define M2MB_BLE_ASSIGN_BD_ADDR (   _dest,
  _a,
  _b,
  _c,
  _d,
  _e,
  _f 
)
Value:
{ \
(_dest).BD_ADDR0 = (_f); \
(_dest).BD_ADDR1 = (_e); \
(_dest).BD_ADDR2 = (_d); \
(_dest).BD_ADDR3 = (_c); \
(_dest).BD_ADDR4 = (_b); \
(_dest).BD_ADDR5 = (_a); \
}

The following defines the valid length of the GATT Client Characteristic Configuration descriptor.

Definition at line 192 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ASSIGN_BLUETOOTH_UUID_16

#define M2MB_BLE_ASSIGN_BLUETOOTH_UUID_16 (   _dest,
  _a,
  _b 
)
Value:
{ \
(_dest).UUID_Byte0 = (_b); (_dest).UUID_Byte1 = (_a); \
}

The following MACRO is a utility MACRO that exists to aid in the
Comparison of two M2MB_BLE_UUID_16_T variables.This MACRO only
returns whether the two M2MB_BLE_UUID_16_T variables are equal
(MACRO returns boolean result) NOT less than/greater than. The
first parameter the the M2MB_BLE_UUID_16_T variable.The next two are the individual byte values to do the comparison with.The
bytes are NOT in Little Endian Format.

Definition at line 3706 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_FOUND

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_FOUND   0x0A

Definition at line 137 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_LONG

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_LONG   0x0B

Definition at line 138 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHENTICATION

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHENTICATION   0x05

Definition at line 132 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHORIZATION

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_AUTHORIZATION   0x08

Definition at line 135 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION   0x0F

Definition at line 142 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION_KEY_SIZE

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_ENCRYPTION_KEY_SIZE   0x0C

Definition at line 139 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_RESOURCES

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INSUFFICIENT_RESOURCES   0x11

The following define the valid values (bit mask) for ble parameters

Definition at line 144 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_ATTRIBUTE_VALUE_LENGTH

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_ATTRIBUTE_VALUE_LENGTH   0x0D

Definition at line 140 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_HANDLE

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_HANDLE   0x01

Definition at line 128 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_OFFSET

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_OFFSET   0x07

Definition at line 134 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_PDU

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_INVALID_PDU   0x04

Definition at line 131 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_PREPARE_QUEUE_FULL

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_PREPARE_QUEUE_FULL   0x09

Definition at line 136 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_READ_NOT_PERMITTED

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_READ_NOT_PERMITTED   0x02

Definition at line 129 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_REQUEST_NOT_SUPPORTED

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_REQUEST_NOT_SUPPORTED   0x06

Definition at line 133 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNLIKELY_ERROR

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNLIKELY_ERROR   0x0E

Definition at line 141 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNSUPPORTED_GROUP_TYPE

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_UNSUPPORTED_GROUP_TYPE   0x10

Definition at line 143 of file m2mb_ble_driver.h.

◆ M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_WRITE_NOT_PERMITTED

#define M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_WRITE_NOT_PERMITTED   0x03

Definition at line 130 of file m2mb_ble_driver.h.

◆ M2MB_BLE_BTPS_STRUCTURE_OFFSET

#define M2MB_BLE_BTPS_STRUCTURE_OFFSET (   _x,
  _y 
)    ((unsigned int)&(((_x *)0)->_y))

The following MACRO is a utility MACRO that exists to assign the
individual Byte values into the specified UUID variable. The
Bytes are NOT in Little Endian Format, however they ARE assigned
to the UUID variable in Little Endian Format. The first parameter is the UUID variable (of type M2MB_BLE_UUID_16_T) to assign, and
the next 2 parameters are the Individual UUID Byte values to
assign to the UUID variable.

Definition at line 3694 of file m2mb_ble_driver.h.

◆ M2MB_BLE_COMPARE_BD_ADDR

#define M2MB_BLE_COMPARE_BD_ADDR (   _x,
  _y 
)    (((_x).BD_ADDR0 == (_y).BD_ADDR0) && ((_x).BD_ADDR1 == (_y).BD_ADDR1) && ((_x).BD_ADDR2 == (_y).BD_ADDR2) && ((_x).BD_ADDR3 == (_y).BD_ADDR3) && ((_x).BD_ADDR4 == (_y).BD_ADDR4) && ((_x).BD_ADDR5 == (_y).BD_ADDR5))

The following MACRO is a utility MACRO that exists to aid in the
Comparison of a M2MB_BLE_BD_ADDR_T variables to the NULL BD_ADDR. This MACRO only returns whether the the M2MB_BLE_BD_ADDR_T
variable is equal to the NULL BD_ADDR (MACRO returns boolean
result) NOT less than/greater than. The parameter to this MACRO
is the M2MB_BLE_BD_ADDR_T structure to compare to the NULL
BD_ADDR.

Definition at line 277 of file m2mb_ble_driver.h.

◆ M2MB_BLE_COMPARE_BLUETOOTH_UUID_128_TO_CONSTANT

#define M2MB_BLE_COMPARE_BLUETOOTH_UUID_128_TO_CONSTANT (   _x,
  _a,
  _b,
  _c,
  _d,
  _e,
  _f,
  _g,
  _h,
  _i,
  _j,
  _k,
  _l,
  _m,
  _n,
  _o,
  _p 
)
Value:
( \
((_x).UUID_Byte0 == (_p)) && ((_x).UUID_Byte1 == (_o)) && ((_x).UUID_Byte2 == (_n)) && \
((_x).UUID_Byte3 == (_m)) && ((_x).UUID_Byte4 == (_l)) && ((_x).UUID_Byte5 == (_k)) && \
((_x).UUID_Byte6 == (_j)) && ((_x).UUID_Byte7 == (_i)) && ((_x).UUID_Byte8 == (_h)) && \
((_x).UUID_Byte9 == (_g)) && ((_x).UUID_Byte10 == (_f)) && ((_x).UUID_Byte11 == (_e)) && \
((_x).UUID_Byte12 == (_d)) && ((_x).UUID_Byte13 == (_c)) && ((_x).UUID_Byte14 == (_b)) && \
((_x).UUID_Byte15 == (_a)) \
)

Structure that represents a container structure for Passkey response to the user.

Definition at line 3743 of file m2mb_ble_driver.h.

◆ M2MB_BLE_COMPARE_BLUETOOTH_UUID_16_TO_CONSTANT

#define M2MB_BLE_COMPARE_BLUETOOTH_UUID_16_TO_CONSTANT (   _x,
  _a,
  _b 
)
Value:
( \
((_x).UUID_Byte1 == (_a)) && ((_x).UUID_Byte0 == (_b)) \
)

The following MACRO is a utility MACRO that exists to aid in the
Comparison of two M2MB_BLE_UUID_128_T variables. This MACRO only returns whether the two M2MB_BLE_UUID_128_T variables are equal
(MACRO returns boolean result) NOT less than/greater than.The
first parameter this MACRO is of type M2MB_BLE_UUID_128_T
represents the M2MB_BLE_UUID_128_T variable to compare. The next parameters are the constant UUID bytes to do the comparison with. The individual bytes are NOT in Little Endian Format.

Definition at line 3724 of file m2mb_ble_driver.h.

◆ M2MB_BLE_COMPARE_NULL_BD_ADDR

#define M2MB_BLE_COMPARE_NULL_BD_ADDR (   _x)    (((_x).BD_ADDR0 == 0x00) && ((_x).BD_ADDR1 == 0x00) && ((_x).BD_ADDR2 == 0x00) && ((_x).BD_ADDR3 == 0x00) && ((_x).BD_ADDR4 == 0x00) && ((_x).BD_ADDR5 == 0x00))

The following bit-masks define the sevice flags

Definition at line 287 of file m2mb_ble_driver.h.

◆ M2MB_BLE_DATA_BUFFER_LENGTH

#define M2MB_BLE_DATA_BUFFER_LENGTH   517

BLE Length of data buffer

Definition at line 54 of file m2mb_ble_driver.h.

◆ M2MB_BLE_DEVICE_NAME_SIZE

#define M2MB_BLE_DEVICE_NAME_SIZE   32

BLE device name max size

Definition at line 58 of file m2mb_ble_driver.h.

◆ M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_BLUETOOTH_SIG

#define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_BLUETOOTH_SIG   0x01

Definition at line 174 of file m2mb_ble_driver.h.

◆ M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_USB_IMPLEMENTORS_FORUM

#define M2MB_BLE_DIS_PNP_ID_VENDOR_SOURCE_USB_IMPLEMENTORS_FORUM   0x02

Definition at line 175 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BELT_HEART_RATE_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BELT_HEART_RATE_SENSOR   833

Definition at line 82 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BLOOD_PRESSURE_ARM

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BLOOD_PRESSURE_ARM   897

Definition at line 84 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BLOOD_PRESSURE_WRIST

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_BLOOD_PRESSURE_WRIST   898

Definition at line 85 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_CADENCE_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_CADENCE_SENSOR   1155

Definition at line 103 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_CYCLING_COMPUTER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_CYCLING_COMPUTER   1153

Definition at line 101 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_POWER_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_POWER_SENSOR   1156

Definition at line 104 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_SPEED_AND_CADENCE_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_SPEED_AND_CADENCE_SENSOR   1157

Definition at line 105 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_SPEED_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_CYCLING_SPEED_SENSOR   1154

Definition at line 102 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_BARCODE_SCANNER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_BARCODE_SCANNER   704

Definition at line 78 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_BLOOD_PRESSURE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_BLOOD_PRESSURE   896

Definition at line 83 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_CLOCK

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_CLOCK   256

Definition at line 71 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_COMPUTER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_COMPUTER   128

Definition at line 68 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_CYCLING

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_CYCLING   1152

Definition at line 100 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_DISPLAY

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_DISPLAY   320

Definition at line 72 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_EYE_GLASSES

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_EYE_GLASSES   448

Definition at line 74 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_GENERIC_REMOTE_CONTROL

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_GENERIC_REMOTE_CONTROL   384

Definition at line 73 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_GLUCOSE_METER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_GLUCOSE_METER   1024

Definition at line 95 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_HEART_RATE_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_HEART_RATE_SENSOR   832

Definition at line 81 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_KEYRING

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_KEYRING   576

Definition at line 76 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_MEDIA_PLAYER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_MEDIA_PLAYER   640

Definition at line 77 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_OUTDOOR_SPORTS_ACTIVITY

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_OUTDOOR_SPORTS_ACTIVITY   5184

Definition at line 110 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_PHONE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_PHONE   64

Definition at line 67 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_PULSE_OXIMETER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_PULSE_OXIMETER   3136

Definition at line 106 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_RUNNING_WALKING_SENSOR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_RUNNING_WALKING_SENSOR   1088

Definition at line 96 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_TAG

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_TAG   512

Definition at line 75 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_THERMOMETER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_THERMOMETER   768

Definition at line 79 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_WATCH

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_WATCH   192

Definition at line 69 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_WEIGHT_SCALE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_GENERIC_WEIGHT_SCALE   3200

Definition at line 109 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_BARCODE_SCANNER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_BARCODE_SCANNER   968

Definition at line 94 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_CARD_READER

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_CARD_READER   966

Definition at line 92 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_DIGITAL_PEN

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_DIGITAL_PEN   967

Definition at line 93 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_DIGITIZER_TABLET

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_DIGITIZER_TABLET   965

Definition at line 91 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_GAMEPAD

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_GAMEPAD   964

Definition at line 90 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_JOYSTICK

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_JOYSTICK   963

Definition at line 89 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_KEYBOARD

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_KEYBOARD   961

Definition at line 87 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_MOUSE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HID_MOUSE   962

Definition at line 88 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HUMAN_INTERFACE_DEVICE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_HUMAN_INTERFACE_DEVICE   960

Definition at line 86 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_AND_NAVIGATION_DISPLAY_DEVICE   5186

Definition at line 112 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_AND_NAVIGATION_POD

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_AND_NAVIGATION_POD   5188

The following define the valid values (bit mask) for Device info

Definition at line 114 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_DISPLAY_DEVICE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_DISPLAY_DEVICE   5185

Definition at line 111 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_POD

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_OUTDOOR_SPORTS_ACTIVITY_LOCATION_POD   5187

Definition at line 113 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_PULSE_OXIMETER_FINGERTIP

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_PULSE_OXIMETER_FINGERTIP   3137

Definition at line 107 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_PULSE_OXIMETER_WRIST_WORN

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_PULSE_OXIMETER_WRIST_WORN   3138

Definition at line 108 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_IN_SHOE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_IN_SHOE   1089

Definition at line 97 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_ON_HIP

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_ON_HIP   1091

Definition at line 99 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_ON_SHOE

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_RUNNING_WALKING_SENSOR_ON_SHOE   1090

Definition at line 98 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_SPORTS_WATCH

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_SPORTS_WATCH   193

Definition at line 70 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_THERMOMETER_EAR

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_THERMOMETER_EAR   769

Definition at line 80 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_UNKNOWN

#define M2MB_BLE_GAP_DEVICE_APPEARANCE_VALUE_UNKNOWN   0

Definition at line 66 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_KEYPRESS_NOTIFICATIONS

#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_KEYPRESS_NOTIFICATIONS   0x00000001

Indicates support for Secure Connections Pairing.

Definition at line 232 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_LOCAL_OOB_DATA_VALID

#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_LOCAL_OOB_DATA_VALID   0x00000010

The following constants represent the defined flag bit-mask values. Initialize GATT to support LE.

Definition at line 240 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_MITM_REQUESTED

#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_MITM_REQUESTED   0x00000004

Indicates that out of band data is present for other device.

Definition at line 236 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_OOB_DATA_PRESENT

#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_OOB_DATA_PRESENT   0x00000008

Indicates if LocalOOBData member of M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_T structure is valid.

Definition at line 238 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_SECURE_CONNECTIONS

#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_FLAGS_SECURE_CONNECTIONS   0x00000002

Indicates request for Man in the Middle protection.

Definition at line 234 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_SIZE

#define M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_SIZE   (sizeof(M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_T))

HCI type and structure The following type declaration represents the structure of all Data that is needed to open an HCI Port. The following Type Declaration defines the currently supported
Physical Bluetooth HCI Device Interfaces that are supported by
the HCI Packet Driver.

Definition at line 3181 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_MAXIMUM_DEVICE_NAME_LENGTH

#define M2MB_BLE_GAP_MAXIMUM_DEVICE_NAME_LENGTH   248

All the structure and prototype for central device support

Definition at line 3395 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_ATTRIBUTE_FLAGS_HIDDEN

#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_HIDDEN   0x04

GATT attribute is hidden. GATT attribute is readable and writable.

Definition at line 222 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE

#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE   0x01

GATT attribute is readable.

Definition at line 220 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE

#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE   (M2MB_BLE_GATT_ATTRIBUTE_FLAGS_READABLE|M2MB_BLE_GATT_ATTRIBUTE_FLAGS_WRITABLE)

The following bit-masks define the allowable flags that may be specified in the Service_Flags parameter.

Definition at line 224 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_ATTRIBUTE_FLAGS_WRITABLE

#define M2MB_BLE_GATT_ATTRIBUTE_FLAGS_WRITABLE   0x02

GATT attribute is writable.

Definition at line 221 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_AUTHENTICATED_SIGNED_WRITES

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_AUTHENTICATED_SIGNED_WRITES   0x40

Definition at line 158 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_BROADCAST

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_BROADCAST   0x01

Definition at line 152 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_EXTENDED_PROPERTIES

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_EXTENDED_PROPERTIES   0x80

The following define GATT Client Configuration Characteristic Definitions

Definition at line 159 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_INDICATE

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_INDICATE   0x20

Definition at line 157 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_NOTIFY

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_NOTIFY   0x10

Definition at line 156 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_READ

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_READ   0x02

Definition at line 153 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE   0x08

Definition at line 155 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE

#define M2MB_BLE_GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE   0x04

Definition at line 154 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_BLUETOOTH_UUID_CONSTANT

#define M2MB_BLE_GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_BLUETOOTH_UUID_CONSTANT   { 0x02, 0x29 }

The following values define the valid values that the Vendor ID Source field of the DIS PNP characteristic may contain.

Definition at line 168 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_LENGTH

#define M2MB_BLE_GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_LENGTH   (M2MB_BLE_NON_ALIGNED_WORD_SIZE)

The following bit masks define that allowable flags that may be specified in the Attribute_Flags member of the M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T structure.

Definition at line 215 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_INDICATE_ENABLE

#define M2MB_BLE_GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_INDICATE_ENABLE   0x0002

The following defines the GATT Client Characteristic Configuration UUID that is used when building the service tables.

Definition at line 163 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_NOTIFY_ENABLE

#define M2MB_BLE_GATT_CLIENT_CONFIGURATION_CHARACTERISTIC_NOTIFY_ENABLE   0x0001

Definition at line 162 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_INITIALIZATION_FLAGS_DISABLE_SERVICE_CHANGED_CHARACTERISTIC

#define M2MB_BLE_GATT_INITIALIZATION_FLAGS_DISABLE_SERVICE_CHANGED_CHARACTERISTIC   0x00000004L

Read unaligned BYTE little endian

Definition at line 249 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_INITIALIZATION_FLAGS_SUPPORT_LE

#define M2MB_BLE_GATT_INITIALIZATION_FLAGS_SUPPORT_LE   0x00000001L

Disable the Service Changed Characteristic when GATT is initialized.

Definition at line 246 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE

#define M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE   0x01

Initialize GATT service to support LE Indicates capability of sending keypress notifications.

Definition at line 229 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAX_PAIRED_DEVICES

#define M2MB_BLE_MAX_PAIRED_DEVICES   7

Maxmium paired devices allowed Generic event types and structures Structure that contains the attribute handles that will need to be cached by a client in order to only do service discovery once.

Definition at line 297 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_ADVERITISING_HANDLE

#define M2MB_BLE_MAXIMUM_ADVERITISING_HANDLE   0xEF

Minimum extended scan interval. This is specified in milli-seconds.

Definition at line 3458 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_ADVERTISING_INTERVAL

#define M2MB_BLE_MAXIMUM_ADVERTISING_INTERVAL   10240

Minimum allowable advertising interval if non-connectable advertising is being used.

Definition at line 3430 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_EXTENDED_ADVERTISING_DURATION

#define M2MB_BLE_MAXIMUM_EXTENDED_ADVERTISING_DURATION   655350

Minimum extended scan duration. This is specified in milli-seconds.

Definition at line 3482 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_EXTENDED_SCAN_DURATION

#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_DURATION   655350

Minimum extended scan period. This is specified in milli-seconds.

Definition at line 3490 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_EXTENDED_SCAN_INTERVAL

#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_INTERVAL   40959

Minimum extended scan window. This is specified in milli-seconds.

Definition at line 3466 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_EXTENDED_SCAN_PERIOD

#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_PERIOD   83884800

Minimum allowable connection interval (min) that may be specified (in milliseconds).

Definition at line 3498 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_EXTENDED_SCAN_WINDOW

#define M2MB_BLE_MAXIMUM_EXTENDED_SCAN_WINDOW   40959

Minimum extended advertising duration. This is specified in milli-seconds.

Definition at line 3474 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_LE_SCAN_INTERVAL

#define M2MB_BLE_MAXIMUM_LE_SCAN_INTERVAL   10240

Minimum allowable LE scan window (in milliseconds) that can be used with the qapi_BLE_GAP_LE_Perform_Scan() function.

Definition at line 3408 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_LE_SCAN_WINDOW

#define M2MB_BLE_MAXIMUM_LE_SCAN_WINDOW   10240

Minimum allowable scan length (in seconds) for limited discoverable mode scans.

Definition at line 3416 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_MAXIMUM_CONNECTION_INTERVAL

#define M2MB_BLE_MAXIMUM_MAXIMUM_CONNECTION_INTERVAL   4000

Structure that represents the container structure for holding all the GATT service discovery event data.

Definition at line 3514 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_MINIMUM_CONNECTION_INTERVAL

#define M2MB_BLE_MAXIMUM_MINIMUM_CONNECTION_INTERVAL   4000

Minimum allowable connection interval (max) that may be specified (in milliseconds).

Definition at line 3506 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_PERIODIC_ADVERTISING_INTERVAL

#define M2MB_BLE_MAXIMUM_PERIODIC_ADVERTISING_INTERVAL   81919

Minimum advertising handle that may be specified with the extended advertising API's.

Definition at line 3450 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MAXIMUM_PRIMARY_ADVERTISING_INTERVAL

#define M2MB_BLE_MAXIMUM_PRIMARY_ADVERTISING_INTERVAL   10485759

Minimum periodic advertising interval value that may be used with periodic advertising.

Definition at line 3442 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_ADVERITISING_HANDLE

#define M2MB_BLE_MINIMUM_ADVERITISING_HANDLE   0

Maximum advertising handle that may be specified with the extended advertising API's.

Definition at line 3454 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_ADVERTISING_INTERVAL

#define M2MB_BLE_MINIMUM_ADVERTISING_INTERVAL   20

Maximum allowable advertising interval.

Definition at line 3427 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_EXTENDED_ADVERTISING_DURATION

#define M2MB_BLE_MINIMUM_EXTENDED_ADVERTISING_DURATION   0

Maximum extended advertising duration. This is specified in milli-seconds.

Definition at line 3478 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_EXTENDED_SCAN_DURATION

#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_DURATION   10

Maximum extended scan duration. This is specified in milli-seconds.

Definition at line 3486 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_EXTENDED_SCAN_INTERVAL

#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_INTERVAL   3

Maximum extended scan interval. This is specified in milli-seconds.

Definition at line 3462 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_EXTENDED_SCAN_PERIOD

#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_PERIOD   1280

Maximum extended scan period. This is specified in milli-seconds.

Definition at line 3494 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_EXTENDED_SCAN_WINDOW

#define M2MB_BLE_MINIMUM_EXTENDED_SCAN_WINDOW   3

Maximum extended scan window. This is specified in milli-seconds.

Definition at line 3470 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_GENERAL_DISCOVERABLE_SCAN_LENGTH

#define M2MB_BLE_MINIMUM_GENERAL_DISCOVERABLE_SCAN_LENGTH   11

Minimum allowable advertising interval.

Definition at line 3424 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_LE_SCAN_INTERVAL

#define M2MB_BLE_MINIMUM_LE_SCAN_INTERVAL   3

< Minimum allowable LE scan interval (in milliseconds) that can be used with the qapi_BLE_GAP_LE_Perform_Scan() function. Maximum allowable LE scan interval (in milliseconds) that can be used with the qapi_BLE_GAP_LE_Perform_Scan() function.

Definition at line 3404 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_LE_SCAN_WINDOW

#define M2MB_BLE_MINIMUM_LE_SCAN_WINDOW   3

Maximum allowable LE scan window (in milliseconds) that can be used with the qapi_BLE_GAP_LE_Perform_Scan() function.

Definition at line 3412 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_LIMITED_DISCOVERABLE_SCAN_LENGTH

#define M2MB_BLE_MINIMUM_LIMITED_DISCOVERABLE_SCAN_LENGTH   11

Minimum allowable scan length (in seconds) for general discoverable mode scans.

Definition at line 3420 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_MAXIMUM_CONNECTION_INTERVAL

#define M2MB_BLE_MINIMUM_MAXIMUM_CONNECTION_INTERVAL   8

Maximum allowable connection interval (max) that may be specified (in milliseconds).

Definition at line 3510 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_MINIMUM_CONNECTION_INTERVAL

#define M2MB_BLE_MINIMUM_MINIMUM_CONNECTION_INTERVAL   8

Maximum allowable connection interval (min) that may be specified (in milliseconds).

Definition at line 3502 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_NONCONNECTABLE_ADVERTISING_INTERVAL

#define M2MB_BLE_MINIMUM_NONCONNECTABLE_ADVERTISING_INTERVAL   100

Minimum primary advertising interval value that may be used with extended advertising.

Definition at line 3434 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_PERIODIC_ADVERTISING_INTERVAL

#define M2MB_BLE_MINIMUM_PERIODIC_ADVERTISING_INTERVAL   8

Maximum periodic advertising interval value that may be used with periodic advertising.

Definition at line 3446 of file m2mb_ble_driver.h.

◆ M2MB_BLE_MINIMUM_PRIMARY_ADVERTISING_INTERVAL

#define M2MB_BLE_MINIMUM_PRIMARY_ADVERTISING_INTERVAL   20

Maximum primary advertising interval value that may be used with extended advertising.

Definition at line 3438 of file m2mb_ble_driver.h.

◆ M2MB_BLE_NON_ALIGNED_WORD_SIZE

#define M2MB_BLE_NON_ALIGNED_WORD_SIZE   (sizeof(M2MB_BLE_NONALIGNEDWORD_T))

The following MACRO is a utility MACRO that exists to assign the
individual Byte values into the specified BD_ADDR variable. The
Bytes are NOT in Little Endian Format, however, they are assigned to the BD_ADDR variable in Little Endian Format. The first
parameter is the BD_ADDR variable (of type qapi_BLE_BD_ADDR_t) to assign, and the next six parameters are the Individual BD_ADDR
Byte values to assign to the variable.

Definition at line 182 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PARAMETERS_FLAGS_ADVERTISING_PARAMETERS_VALID

#define M2MB_BLE_PARAMETERS_FLAGS_ADVERTISING_PARAMETERS_VALID   0x00000001

Definition at line 147 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PARAMETERS_FLAGS_CONNECTION_PARAMETERS_VALID

#define M2MB_BLE_PARAMETERS_FLAGS_CONNECTION_PARAMETERS_VALID   0x00000004

The following define GATT Characteristic Properties Definitions

Definition at line 149 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PARAMETERS_FLAGS_SCAN_PARAMETERS_VALID

#define M2MB_BLE_PARAMETERS_FLAGS_SCAN_PARAMETERS_VALID   0x00000002

Definition at line 148 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PASSKEY

#define M2MB_BLE_PASSKEY   123456

BLE fixed passkey value

Definition at line 56 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PERSISTENT_DATA_SIZE

#define M2MB_BLE_PERSISTENT_DATA_SIZE (   _x)    (M2MB_BLE_BTPS_STRUCTURE_OFFSET(M2MB_BLE_PERSISTENT_DATA_T, RemoteDevices) + (M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_SIZE * (_x)))

Definition at line 3822 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_FLAG_IDENTITY_VALID

#define M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_FLAG_IDENTITY_VALID   0x02

Structure that represents a container structure for persistent data for bonding.

Definition at line 3806 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_FLAG_LTK_VALID

#define M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_FLAG_LTK_VALID   0x01

persistent remote device data IRDK valid flag.

Definition at line 3804 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_SIZE

#define M2MB_BLE_PERSISTENT_REMOTE_DEVICE_DATA_SIZE   (sizeof(M2MB_BLE_PERSISTENT_DEVICE_REMOTE_DATA_T))

persistent remote device data LTK valid flag.

Definition at line 3802 of file m2mb_ble_driver.h.

◆ M2MB_BLE_SCAN_RESPONSE_DATA_MAXIMUM_SIZE

#define M2MB_BLE_SCAN_RESPONSE_DATA_MAXIMUM_SIZE   31

The following type defines the buffer that is used to write or
read the scan response data to be advertised by the local device
(Version 4.0 + LE).The size of this buffer is always fixed.

Definition at line 609 of file m2mb_ble_driver.h.

◆ M2MB_DEFAULT_MITM_PROTECTION

#define M2MB_DEFAULT_MITM_PROTECTION   TRUE

BLE default value of MITM protection

Definition at line 61 of file m2mb_ble_driver.h.

◆ M2MB_DEFAULT_OOBDATAPRESENT

#define M2MB_DEFAULT_OOBDATAPRESENT   FALSE

BLE default value of OOB data

Definition at line 60 of file m2mb_ble_driver.h.

◆ M2MB_DEFAULT_SECURE_CONNECTIONS

#define M2MB_DEFAULT_SECURE_CONNECTIONS   TRUE

BLE default value of secure connection The following define the value GAP Device Appearance Values.

Definition at line 62 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_ADDED_TO_RESOLVING_LIST

#define M2MB_DEVICE_INFO_FLAGS_ADDED_TO_RESOLVING_LIST   0x40

The following constants represent the defined Attribute Protocol. Error Codes that are defined by the protocol itself.

Definition at line 123 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_ADDED_TO_WHITE_LIST

#define M2MB_DEVICE_INFO_FLAGS_ADDED_TO_WHITE_LIST   0x20

Definition at line 122 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_BLE_CLIENT

#define M2MB_DEVICE_INFO_FLAGS_BLE_CLIENT   0x04

Definition at line 119 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_BLE_SERVER

#define M2MB_DEVICE_INFO_FLAGS_BLE_SERVER   0x02

Definition at line 118 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_IRK_VALID

#define M2MB_DEVICE_INFO_FLAGS_IRK_VALID   0x10

Definition at line 121 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_LTK_VALID

#define M2MB_DEVICE_INFO_FLAGS_LTK_VALID   0x01

Definition at line 117 of file m2mb_ble_driver.h.

◆ M2MB_DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING

#define M2MB_DEVICE_INFO_FLAGS_SERVICE_DISCOVERY_OUTSTANDING   0x08

Definition at line 120 of file m2mb_ble_driver.h.

◆ M2MB_SSL_FAILURE [1/2]

#define M2MB_SSL_FAILURE   -1

Macro for Generic failure

Definition at line 51 of file m2mb_ble_driver.h.

◆ M2MB_SSL_FAILURE [2/2]

#define M2MB_SSL_FAILURE   -1

Macro for Generic failure

Definition at line 51 of file m2mb_ble_driver.h.

◆ READ_UNALIGNED_BYTE_LITTLE_ENDIAN

#define READ_UNALIGNED_BYTE_LITTLE_ENDIAN (   _x)    (((UINT8 *)(_x))[0])

Read unaligned WORD little endian

Definition at line 252 of file m2mb_ble_driver.h.

◆ READ_UNALIGNED_WORD_LITTLE_ENDIAN

#define READ_UNALIGNED_WORD_LITTLE_ENDIAN (   _x)    ((UINT16)((((UINT16)(((UINT8 *)(_x))[1])) << 8) | ((UINT16)(((UINT8 *)(_x))[0]))))

Assign Host WORD to unaligned WORD little endian

Definition at line 255 of file m2mb_ble_driver.h.

Typedef Documentation

◆ M2MB_BLE_ADVERTISING_DATA_T

The following define determines the maximum fixed size that is
used to define the Scan Response Data that can be sent/received in scanning packets for a device.

◆ M2MB_BLE_ATT_AUTHENTICATION_SIGNATURE_T

The following type declaration represents the structure of LE feature Type

◆ M2MB_BLE_BD_ADDR_T

The following type declaration represents the structure of a single Secure Connections Confirmation, C used for OOB mechanism of LE Secure Connections (Version 4.2).

◆ M2MB_BLE_CLIENT_INFO_T

The following structure represents the information we will store on a Discovered GAP Service.

◆ M2MB_BLE_DATA_BUFF_T

The following type declaration represents the structure of a single Bluetooth Board Address.

◆ M2MB_BLE_DEVICE_INFO_T

Structure that represents all the data contained in the DIS PNP ID value.

◆ M2MB_BLE_DIS_PNP_ID_DATA_T

Structure that represents all the default initialization required to open BLE stack.

◆ M2MB_BLE_ENCRYPTION_KEY_T

The following type declaration represents the structure of a single Long Term Key (Version 4.0 + LE).

◆ M2MB_BLE_GAP_LE_ADVERTISING_DATA_ENTRY_T

Structure that represents all the entries in an Advertising Data Structure.

◆ M2MB_BLE_GAP_LE_ADVERTISING_DATA_T

Structure that represents container structure that is used to represent all the entries in an LE Advertising Report data field.

◆ M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS_T

Structure that represents the type of advertising parameters that may be passed into the connection create() function.

◆ M2MB_BLE_GAP_LE_ADVERTISING_REPORT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_ADVERTISING_REPORT_E event. The structure is used to return Advertising Reports returned from multiple devices.

◆ M2MB_BLE_GAP_LE_ADVERTISING_REPORT_EVENT_DATA_T

This structure is a container that is used to represent all the entries in a LE Direct Advertising Report data field.

◆ M2MB_BLE_GAP_LE_ADVERTISING_SET_TERMINATED_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_SCAN_REQUEST_RECEIVED_E vent that is sent by the controller to indicate that a scan request has been received.This event will only received if a scan response is received and the advertising set it is received for requested these events.

◆ M2MB_BLE_GAP_LE_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_DATA_LENGTH_CHANGE_E event.

◆ M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_E event. All members of this structure are specified in milliseconds except Slave_Latency, which is specified in the number of connection events.

◆ M2MB_BLE_GAP_LE_AUTHENTICATION_RESPONSE_INFORMATION_T

◆ M2MB_BLE_GAP_LE_CHANNEL_SELECTION_ALGORITHM_UPDATE_EVENT_DATA_T

This structure is a container structure that holds all GAP LE Event Data.

◆ M2MB_BLE_GAP_LE_CONFIRMATION_REQUEST_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_EXTENDED_CONFIRMATION_REQUEST_E.

◆ M2MB_BLE_GAP_LE_CONNECTABILITY_PARAMETERS_T

Structure that represents the type of advertising parameters that may be passed into the set advertise enable() function.

◆ M2MB_BLE_GAP_LE_CONNECTION_COMPLETE_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_DISCONNECTION_COMPLETE_E event.

◆ M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_RESPONSE_E event..

◆ M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATE_RESPONSE_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATED_E event.

◆ M2MB_BLE_GAP_LE_CONNECTION_PARAMETER_UPDATED_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_E event.

◆ M2MB_BLE_GAP_LE_CONNECTION_PARAMETERS_T

Structure that represents the GAP LE Remote Features Response Event Data that is returned from the read remote features() function in the M2MB_BLE_ET_LE_REMOTE_FEATURES_E GAP LE Event.

◆ M2MB_BLE_GAP_LE_CURRENT_CONNECTION_PARAMETERS_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_CONNECTION_COMPLETE_E event.

◆ M2MB_BLE_GAP_LE_DATA_LENGTH_CHANGE_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_PHY_UPDATE_COMPLETE_E event.

◆ M2MB_BLE_GAP_LE_DIRECT_ADVERTISING_REPORT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_DIRECT_ADVERTISING_REPORT_E event.

◆ M2MB_BLE_GAP_LE_DIRECT_ADVERTISING_REPORT_EVENT_DATA_T

This structure is a container structure for all connection parameters that are present for all LE connections.

◆ M2MB_BLE_GAP_LE_DISCONNECTION_COMPLETE_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_ENCRYPTION_CHANGE_E event.

◆ M2MB_BLE_GAP_LE_ENCRYPTION_CHANGE_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_ENCRYPTION_REFRESH_COMPLETE_E event.

◆ M2MB_BLE_GAP_LE_ENCRYPTION_INFORMATION_T

Structure that represents the structure of data that is used to specify the current identity information.

◆ M2MB_BLE_GAP_LE_ENCRYPTION_REFRESH_COMPLETE_EVENT_DATA_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_LONG_TERM_KEY_REQUEST_E.

◆ M2MB_BLE_GAP_LE_ENCRYPTION_REQUEST_INFORMATION_T

Structure that represents the structure of data that is used to specify the current encryption information..

◆ M2MB_BLE_GAP_LE_EVENT_CB_T

typedef VOID(* M2MB_BLE_GAP_LE_EVENT_CB_T) (UINT32 BluetoothStackID, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)

Declared type that represents the Prototype Function for the GAP LE event callback.

This function is called whenever a callback has been registered for the specified GAP LE action that is associated with the specified Bluetooth Stack ID. This function passes to the caller the Bluetooth Stack ID, the GAP LE event data of the specified event, and the GAP LE event callback parameter that was specified when this callback was installed.

The caller should use the contents of the GAP LE event data only in the context of this callback. If the caller requires the data for a longer period of time, the callback function must copy the data into another data buffer.

This function is guaranteed not to be invoked more than once simultaneously for the specified installed callback (i.e., this function does not have be reentrant). It should be noted, however, that if the same callback is installed more than once, then the callbacks will be called serially. Because of this, the processing in this function should be as efficient as possible.

It should also be noted that this function is called in the thread context of a thread that the user does not own. Therefore, processing in this function should be as efficient as possible (this argument holds anyway because other GAP LE events will not be processed while this function call is outstanding).

This function must not block and wait for events that can only be satisfied by receiving other GAP LE events. A deadlock will occur because no GAP LE event callbacks will be issued while this function is currently outstanding.

Parameters
[in]BluetoothStackIDUnique identifier assigned to this Bluetooth Protocol Stack.
[in]GAP_LE_Event_DataPointer to the passed GAP LE Event data.
[in]CallbackParameterUser-defined parameter (e.g., tag value) that was defined in the callback registration.
Returns
None.
Note
<Notes>

VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter);

VOID m2m_ble_readVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
void *blePairReadCtx = NULL;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
//
}
}
break;
break;
default:
break;
}
}
}
VOID m2m_ble_newreadVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
UINT8 readFlag = 1;
UINT32 ret;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
default:
break;
}
}
}
VOID m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle,
m2m_ble_newreadVal_cb, charHndle);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_read_cb);
ret = m2mb_ble_gatt_read_value_request(bleStackId, connectionId, Characteristic_Handle, m2m_ble_readVal_cb, Characteristic_Handle);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

Definition at line 4147 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EVENT_DATA_T

Structure that represents the structure of data that is used to specify the LTK and key size.

◆ M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_REPORT_DATA_T

Structure that represents the data returned in a GAP M2MB_BLE_ET_LE_EXTENDED_ADVERTISING_REPORT_E event.The structure is used to return Extended_Advertising Reports returned from multiple devices..

◆ M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_REPORT_EVENT_DATA_T

Structure that represents the information returned in an M2MB_BLE_ET_LE_ADVERTISING_SET_TERMINATED_E event that is sent by the controller to indicate that advertising for the specified advertising set has terminated..

◆ M2MB_BLE_GAP_LE_EXTENDED_CONFIRMATION_REQUEST_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_EXTENDED_OUT_OF_BAND_INFORMATION_E.

◆ M2MB_BLE_GAP_LE_EXTENDED_CONNECTION_PARAMETERS_T

Structure that represents the parameters that are used when scanning for a particular PHY. The Scan_Interval and Scan_Window (specified in milli-seconds) must satisfy the following equation: Scan_Window <= Scan_Interval if Scan_Window == Scan_Interval, LE Scanning will be performed continuously.

◆ M2MB_BLE_GAP_LE_EXTENDED_KEY_DISTRIBUTION_T

Structure that represents the information that is requested in a M2MB_BLE_LAT_PAIRING_REQUEST_E of the M2MB_BLE_ET_LE_AUTHENTICATION_E event

◆ M2MB_BLE_GAP_LE_EXTENDED_OUT_OF_BAND_INFORMATION_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_PAIRING_STATUS_E.

◆ M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the M2MB_LE_AUTHENTICATION_EVENT_Type of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_SECURITY_REQUEST_E.

◆ M2MB_BLE_GAP_LE_EXTENDED_SCANNING_PHY_PARAMETERS_T

The following MACRO is a utility MACRO that exists to calculate
the offset position of a particular structure member from the
start of the structure. This MACRO accepts as the first parameter, the physical name of the structure (the type name, NOT the
variable name). The second parameter to this MACRO represents the actual structure member that the offset is to be determined. This MACRO returns an unsigned integer that represents the offset (in
bytes) of the structure member.

◆ M2MB_BLE_GAP_LE_IDENTITY_INFORMATION_T

Structure that represents the structure of data that is used to specify the current signing information..

◆ M2MB_BLE_GAP_LE_KEY_DISTRIBUTION_T

Structure that represents the extended Initiator and Responder Key Distribution fields in the M2MB_BLE_GAP_LE_EXTENDED_PAIRING_CAPABILITIES_T structure

◆ M2MB_BLE_GAP_LE_KEY_REQUEST_INFO_T

Structure that represents the Initiator and Responder Key Distribution fields in the M2MB_BLE_GAP_LE_PAIRING_CAPABILITIES_T structure.

◆ M2MB_BLE_GAP_LE_LONG_TERM_KEY_INFORMATION_T

Structure that represents the structure of data that is used to specify the Out Of Band Information when pairing.

◆ M2MB_BLE_GAP_LE_MASTER_SECURITY_INFORMATION_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_E event. All members of this structure are specified in milliseconds except Slave_Latency, which is specified in the number of connection events.

◆ M2MB_BLE_GAP_LE_OOB_DATA_T

Type declaration that represents the structure of information stored in the M2MB_BLE_GAP_LE_SECURITY_INFORMATION_T structure.

◆ M2MB_BLE_GAP_LE_PAIRING_CAPABILITIES_T

Structure that represents the structure of data that is used to specify the Secure Connections Out Of Band Information when pairing (Version 4.2).

◆ M2MB_BLE_GAP_LE_PAIRING_STATUS_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_ENCRYPTION_INFORMATION_E.

◆ M2MB_BLE_GAP_LE_PARAM_T

Structure that represents the type of connectability parameters that may be passed into the advertise enable() function. The Direct_Address_Type and Direct_Address fields are only used if the Connectability_Mode field is set to M2MB_BLE_LCM_DIRECT_CONNECTABLE_E or M2MB_BLE_LCM_LOW_DUTY_CYCLE_DIRECT_CONNECTABLE_E.

◆ M2MB_BLE_GAP_LE_PHY_UPDATE_COMPLETE_EVENT_DATA_T

Structure that represents a container structure that is used to represent all the entries in an LE Extended Advertising Report Data Field This structure is used so that all fields are easy to parse and access (i.e. there are no MACRO's required to access variable length records).

The Raw_Report_Length and Raw_Report_Data members contain the length (in bytes) of the actual report received, as well as a pointer to the actual bytes present in the report, respectively.

If the Data_Status member is set to M2MB_BLE_DS_INCOMPLETE_DATA_PENDING_E then more advertising reports will be received with additional data from the advertiser. If the Data_Status member is set to dsIncomplete_DataTruncated then the data received is not all of the data advertised, however no more events are pending for this advertiser. The following enumerated types may be returned with the Address_Type member:

  • M2MB_BLE_LAT_PUBLIC_E
  • M2MB_BLE_LAT_RANDOM_E
  • M2MB_BLE_LAT_PUBLIC_IDENTITY_E
  • M2MB_BLE_LAT_RANDOM_IDENTITY_E

The M2MB_BLE_LAT_PUBLIC_IDENTITY_E and M2MB_BLE_LAT_RANDOM_IDENTITY_E types will only be returned if the address resolution in the controller has been enabled. The Periodic_Advertising_Interval member is specified in milliseconds. The Direct_Address_Type and Direct_BD_ADDR members are only valid if the M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_EVENT_TYPE_DIRECTED bit is set in the Event_Type_Flags member. The Secondary_PHY member is only valid if the M2MB_BLE_GAP_LE_EXTENDED_ADVERTISING_EVENT_TYPE_SECONDARY_PHY_ VALID bit is set in the Event_Type_Flags.

◆ M2MB_BLE_GAP_LE_REMOTE_FEATURES_EVENT_DATA_T

Structure that represents an individual Advertising Report Structure Entry that is present in an LE Advertising Report.

◆ M2MB_BLE_GAP_LE_RESOLVING_LIST_ENTRY_T

Structure that represents the data structure for GAP LE parameters.

◆ M2MB_BLE_GAP_LE_SCAN_REQUEST_RECEIVED_EVENT_DATA_T

Enumeration of the channel selection algorithms that may be used to determine the hopping frequencies for an LE Data Connection.

◆ M2MB_BLE_GAP_LE_SECURE_CONNECTIONS_OOB_DATA_T

Structure that represents the structure of data that is used to specify the Secure Connections Out Of Band Information when pairing (Version 4.2).

◆ M2MB_BLE_GAP_LE_SECURITY_ESTABLISHMENT_COMPLETE_T

Structure that represents the data that can be returned in the GAP LE Authentication Callback.

◆ M2MB_BLE_GAP_LE_SECURITY_INFORMATION_T

Structure that represents the GAP Authentication response information.

◆ M2MB_BLE_GAP_LE_SECURITY_REQUEST_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_CONFIRMATION_REQUEST_E. The DisplayPasskey member is only valid when RequestType is M2MB_BLE_CRT_DISPLAY_E, and this member should be display to the user to allow the remote device to enter it. The DisplayPasskey member is between 000,000 and 999,999 and all digits must be displayed, including leading zeros.

◆ M2MB_BLE_GAP_LE_SIGNING_INFORMATION_T

Structure that represents the data returned in a GAP LE M2MB_BLE_ET_LE_AUTHENTICATION_E event when the GAP_LE_AUTHENTICATION_EVENT_TYPE of the M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T structure is set to M2MB_BLE_LAT_SECURITY_ESTABLISHMENT_COMPLETE_E.

◆ M2MB_BLE_GAP_LE_SLAVE_SECURITY_INFORMATION_T

Type declaration that represents the structure of information stored in the M2MB_BLE_GAP_LE_SECURITY_INFORMATION_T structure.

◆ M2MB_BLE_GAP_LE_WHITE_LIST_ENTRY_T

Structure that represents the data structure for a Resolving List entry that is used with the Resolving List Management functions in this module.

◆ M2MB_BLE_GAP_PAIR_STATUS_USER_CB_T

typedef VOID(* M2MB_BLE_GAP_PAIR_STATUS_USER_CB_T) (VOID *ctx, UINT32 eventType, M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)

Declared type that represents the Prototype Function for the pairing status user callback.

This function is called whenever a callback has been registered for the specified pairing status event data.

Parameters
[in]ctxUser defined callback context.
[in]eventTypeIt is authentication type based event.
[in]authInfoAuthentication information data.
Returns
None.
Note
<Notes>

m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo);

VOID m2m_ble_readVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
void *blePairReadCtx = NULL;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
//
}
}
break;
break;
default:
break;
}
}
}
VOID m2m_ble_newreadVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
UINT8 readFlag = 1;
UINT32 ret;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
default:
break;
}
}
}
VOID m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle,
m2m_ble_newreadVal_cb, charHndle);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_read_cb);
ret = m2mb_ble_gatt_read_value_request(bleStackId, connectionId, Characteristic_Handle, m2m_ble_readVal_cb, Characteristic_Handle);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

Definition at line 5840 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAPS_CLIENT_INFO_T

The following structure represents the bytes sent from the BLE devices.

◆ M2MB_BLE_GAPS_DEVICE_APPEARANCE_MAP_T

The following structure represents the data buffer

◆ M2MB_BLE_GATT_ATTRIBUTE_HANDLE_GROUP_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_PRIMARY_SERVICE_16_E.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DECLARATION_128_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_128_E.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DECLARATION_16_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_CHARACTERISTIC_VALUE_16_E.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTION_INFORMATION_T

Structure that represents the information that is returned about a discovered GATT Characteristic.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_128_ENTRY_T

Structure that represents the container structure for holding all the GATT server event data.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_16_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_PRIMARY_SERVICE_128_E.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_RESPONSE_DATA_T

Structure that represents the container structure for holding all the GATT client event data.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DESCRIPTOR_ENTRY_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_RESPONSE_E event.

◆ M2MB_BLE_GATT_CHARACTERISTIC_DISCOVERY_RESPONSE_DATA_T

Structure that represents the data that is in a characteristic descriptor discovery event entry.

◆ M2MB_BLE_GATT_CHARACTERISTIC_ENTRY_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_CHARACTERISTIC_DISCOVERY_RESPONSE_E event.

◆ M2MB_BLE_GATT_CHARACTERISTIC_INFORMATION_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_INDICATION_E event.

◆ M2MB_BLE_GATT_CHARACTERISTIC_VALUE_128_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_128_E..

◆ M2MB_BLE_GATT_CHARACTERISTIC_VALUE_16_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_16_E.

◆ M2MB_BLE_GATT_CHARACTERISTIC_VALUE_T

Structure that represents the data that is contained in a characteristic entry.

◆ M2MB_BLE_GATT_CLIENT_EVENT_CB_T

typedef VOID(* M2MB_BLE_GATT_CLIENT_EVENT_CB_T) (UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)

The following function is for an GATT Client Event Callback.

This function will be called whenever a GATT Response is received for a request that was made when this function was registered. This
function passes to the caller the GATT Client Event Data that
occurred and the GATT Client Event Callback Parameter that was
specified when this Callback was installed. The caller is free to use the contents of the GATT Client Event Data ONLY in the context of this callback. If the caller requires the Data for a longer
period of time, then the callback function MUST copy the data into another Data Buffer. This function is guaranteed NOT to be
invoked more than once simultaneously for the specified installed callback (i.e. this function DOES NOT have be reentrant). It
Needs to be noted however, that if the same Callback is installed more than once, then the callbacks will be called serially.
Because of this, the processing in this function should be as
efficient as possible. It should also be noted that this function is called in the Thread Context of a Thread that the User does NOT own. Therefore, processing in this function should be as
efficient as possible (this argument holds anyway because another GATT Event (Server/Client or Connection) will not be processed
while this function call is outstanding).

Parameters
[in]BluetoothStackIDUnique identifier assigned to this Bluetooth Protocol Stack.
[in]GATT_Client_Event_DataPointer to the passed GATT client Event data.
[in]CallbackParameterUser-defined parameter (e.g., tag value) that was defined in the callback registration.
Returns
None.
Note
<Notes>

m2mb_ble_gatt_client_event_cb_gaps(UINT32 bluetoothStackId, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 CallbackParameter);

VOID m2mb_ble_gatt_client_event_cb_gaps(UINT32 bluetoothStackId, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 CallbackParameter)
{
char *NameBuffer;
UINT16 appearance;
M2MB_BLE_BOARDSTR_T BoardStr;
//M2MB_BLE_DEBUG_PRINTF("%s:\r\n",__FUNCTION__);
if ((bluetoothStackId) && (GATT_Client_Event_Data))
{
switch (GATT_Client_Event_Data->Event_Data_Type)
{
if (GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data)
{
M2MB_BLE_DEBUG_PRINTF("Error Response\r\n");
m2mb_ble_bdaddr_to_str(GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->RemoteDevice,BoardStr);
M2MB_BLE_DEBUG_PRINTF("Connection ID:%u\r\n", GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->ConnectionID);
M2MB_BLE_DEBUG_PRINTF("Transaction ID:%u\r\n", GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->TransactionID);
M2MB_BLE_DEBUG_PRINTF("Connection Type:%s\r\n", (GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->ConnectionType == M2MB_BLE_GCT_LE_E)?"LE":"BR/EDR");
M2MB_BLE_DEBUG_PRINTF("BD_ADDR:%s\r\n", BoardStr);
M2MB_BLE_DEBUG_PRINTF("Error Type:%s\r\n", (GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->ErrorType == M2MB_BLE_RET_ERROR_RESPONSE_E)?"Response Error":"Response Timeout");
{
M2MB_BLE_DEBUG_PRINTF("Request Opcode:0x%02X\r\n", GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->RequestOpCode);
M2MB_BLE_DEBUG_PRINTF("Request Handle:0x%04X\r\n", GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->RequestHandle);
M2MB_BLE_DEBUG_PRINTF("Error Code:0x%02X\r\n", GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->ErrorCode);
M2MB_BLE_DEBUG_PRINTF("Error Mesg:%s\r\n", errorCodeStr[GATT_Client_Event_Data->Event_Data.GATT_Request_Error_Data->ErrorCode]);
}
}
else
M2MB_BLE_DEBUG_PRINTF("Error - Null Error Response Data\r\n");
break;
if(GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data)
{
M2MB_BLE_LOG_VERBOSE_PRINTF("Exchange MTU Response\r\n");
m2mb_ble_bdaddr_to_str(GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data->RemoteDevice, BoardStr);
M2MB_BLE_LOG_VERBOSE_PRINTF("Connection ID:%u\r\n", GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data->ConnectionID);
M2MB_BLE_LOG_VERBOSE_PRINTF("Transaction ID:%u\r\n", GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data->TransactionID);
M2MB_BLE_LOG_VERBOSE_PRINTF("Connection Type:%s\r\n", (GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data->ConnectionType == QAPI_BLE_GCT_LE_E)?"LE":"BR/EDR");
M2MB_BLE_LOG_VERBOSE_PRINTF("BD_ADDR:%s\r\n", BoardStr);
M2MB_BLE_LOG_VERBOSE_PRINTF("MTU:%u\r\n", GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data->ServerMTU);
maxMtuSize = GATT_Client_Event_Data->Event_Data.GATT_Exchange_MTU_Response_Data->ServerMTU;
}
else
{
M2MB_BLE_DEBUG_PRINTF("Error-Null Write Response Data\r\n");
}
break;
if (GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data)
{
if ((DeviceInfo = m2mb_ble_search_device_info_entry_by_bdaddr(&deviceInfoList,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice)) != NULL)
{
if ((UINT16)CallbackParameter == DeviceInfo->gapsClientInfo.deviceNameHandle)
{
if ((NameBuffer = (char *)malloc(GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->AttributeValueLength+1)) != NULL)
{
memset (NameBuffer, 0, GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->AttributeValueLength+1);
memcpy (NameBuffer, GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->AttributeValue, GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->AttributeValueLength);
M2MB_BLE_LOG_VERBOSE_PRINTF("Remote Device Name:%s\r\n", NameBuffer);
free(NameBuffer);
}
}
else
{
if ((UINT16)CallbackParameter == DeviceInfo->gapsClientInfo.deviceAppearanceHandle)
{
if (GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->AttributeValueLength == QAPI_BLE_GAP_DEVICE_APPEARANCE_VALUE_LENGTH)
{
if (m2mb_ble_appearance_to_string(appearance, &NameBuffer))
M2MB_BLE_LOG_VERBOSE_PRINTF("Remote Device Appearance:%s(%u)\r\n", NameBuffer, appearance);
else
M2MB_BLE_LOG_VERBOSE_PRINTF("Remote Device Appearance:Unknown(%u)\r\n", appearance);
}
else
M2MB_BLE_LOG_VERBOSE_PRINTF("Invalid Remote Appearance Value Length:%u\r\n", GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->AttributeValueLength);
}
}
}
}
else
{
M2MB_BLE_DEBUG_PRINTF("Error - Null Read Response Data\r\n");
}
break;
default:
break;
}
}
}
VOID m2m_ble_readVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
void *blePairReadCtx = NULL;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
//
}
}
break;
break;
default:
break;
}
}
}
VOID m2m_ble_newreadVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
UINT8 readFlag = 1;
UINT32 ret;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
default:
break;
}
}
}
VOID m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle,
m2m_ble_newreadVal_cb, charHndle);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
UINT32 MTU, bleStackId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
m2mb_ble_gatt_exchange_mtu_request(bleStackId, DeviceInfo->connectionId, MTU, m2mb_ble_gatt_client_event_cb_gaps, 0);
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_read_cb);
ret = m2mb_ble_gatt_read_value_request(bleStackId, connectionId, Characteristic_Handle, m2m_ble_readVal_cb, Characteristic_Handle);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

Definition at line 4883 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CLIENT_EVENT_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_REQUEST_E event.

◆ M2MB_BLE_GATT_CONFIRMATION_DATA_T

Structure that represents the format of an attribute entry for a GATT Service.

◆ M2MB_BLE_GATT_CONNECT_USER_CB_T

typedef VOID(* M2MB_BLE_GATT_CONNECT_USER_CB_T) (VOID *ctx, UINT32 eventType, M2MB_BLE_DEVICE_INFO_T *deviceInfo)

This declared type represents the prototype function for a connection event user callback.

The caller should use the contents of the device info Data only in the context of this callback.

Parameters
[in]ctxUser defined callback context.
[in]eventTypeIt is connection based event.
[in]deviceInfoPointer to structure filled with device information details.
Returns
None.
Note
<Notes>

m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo);

VOID m2m_ble_readVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
void *blePairReadCtx = NULL;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
//
}
}
break;
break;
default:
break;
}
}
}
VOID m2m_ble_newreadVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
UINT8 readFlag = 1;
UINT32 ret;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
default:
break;
}
}
}
VOID m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle,
m2m_ble_newreadVal_cb, charHndle);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_read_cb);
ret = m2mb_ble_gatt_read_value_request(bleStackId, connectionId, Characteristic_Handle, m2m_ble_readVal_cb, Characteristic_Handle);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

Definition at line 5411 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CONNECTION_EVENT_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVER_READ_REQUEST_E event.

◆ M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CCCD_READ_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CCCD_UPDATE_E event.

◆ M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CCCD_UPDATE_DATA_T

Structure that represents the container structure for holding all the GATT connection event data.

◆ M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_CONFIRMATION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CCCD_READ_REQUEST_E event.

◆ M2MB_BLE_GATT_CONNECTION_SERVICE_CHANGED_READ_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CONFIRMATION_E event.

◆ M2MB_BLE_GATT_CONNECTION_SERVICE_DATABASE_UPDATE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_READ_REQUEST_E event.

◆ M2MB_BLE_GATT_DEVICE_BUFFER_EMPTY_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVER_NOTIFICATION_E event.

◆ M2MB_BLE_GATT_DEVICE_CONFIRMATION_REQUEST_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_DISCONNECTION_E event.

◆ M2MB_BLE_GATT_DEVICE_CONNECTION_CONFIRMATION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONFIRMATION_REQUEST_E event.

◆ M2MB_BLE_GATT_DEVICE_CONNECTION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_CONFIRMATION_E event.

◆ M2MB_BLE_GATT_DEVICE_CONNECTION_MTU_UPDATE_DATA_T

Structure that represents the structure of the Service Changed characteristic value.

◆ M2MB_BLE_GATT_DEVICE_CONNECTION_REQUEST_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_E event. GATT Connection ID is unique and is used to identity a connection with a remote device

◆ M2MB_BLE_GATT_DEVICE_DISCONNECTION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_BUFFER_EMPTY_E event.

◆ M2MB_BLE_GATT_EXCHANGE_MTU_RESPONSE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_EXECUTE_WRITE_RESPONSE_E event.

◆ M2MB_BLE_GATT_EXECUTE_WRITE_CONFIRMATION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVER_CONFIRMATION_RESPONSE_E event.

◆ M2MB_BLE_GATT_EXECUTE_WRITE_REQUEST_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVER_EXECUTE_WRITE_CONFIRMATION_E event.

◆ M2MB_BLE_GATT_EXECUTE_WRITE_RESPONSE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_PREPARE_WRITE_RESPONSE_E event.

◆ M2MB_BLE_GATT_INCLUDE_INFORMATION_T

Structure that represents the information that is returned about a GATT service from a GATT service discovery procedure.

◆ M2MB_BLE_GATT_INCLUDED_SERVICES_DISCOVERY_RESPONSE_DATA_T

Structure that represents the data that is in a characteristic declaration value entry.

◆ M2MB_BLE_GATT_PREPARE_WRITE_RESPONSE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_WRITE_RESPONSE_E event.

◆ M2MB_BLE_GATT_PRIMARY_SERVICE_128_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_128_E

◆ M2MB_BLE_GATT_PRIMARY_SERVICE_16_ENTRY_T

Structure that represents the structure of the data that must be specified for a M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T of type M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_16_E.

◆ M2MB_BLE_GATT_READ_BY_UUID_RESPONSE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_READ_RESPONSE_E event.

◆ M2MB_BLE_GATT_READ_EVENT_ENTRY_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_READ_BY_UUID_RESPONSE_E event.

◆ M2MB_BLE_GATT_READ_LONG_RESPONSE_DATA_T

Structure that represents the structure of a GATT read response event entry.

◆ M2MB_BLE_GATT_READ_MULTIPLE_RESPONSE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_READ_LONG_RESPONSE_E event.

◆ M2MB_BLE_GATT_READ_REQUEST_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVER_WRITE_REQUEST_E event.

◆ M2MB_BLE_GATT_READ_RESPONSE_DATA_T

Structure that represents the information that is returned about a GATT Service from a GATT service discovery procedure.

◆ M2MB_BLE_GATT_REQUEST_ERROR_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_SERVICE_DISCOVERY_RESPONSE_E event.

◆ M2MB_BLE_GATT_SERVER_EVENT_CB_T

typedef VOID(* M2MB_BLE_GATT_SERVER_EVENT_CB_T) (UINT32 BluetoothStackID, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_Server_Event_Data, UINT32 CallbackParameter)

The following function is for an GATT Server Event Callback.

This function will be called whenever a GATT Request is made to the server who registers this function that cannot be handled internally by GATT. This function passes to the caller the GATT Server Event Data that occurred and the GATT Server Event Callback.

Parameters
[in]BluetoothStackIDUnique identifier assigned to this Bluetooth Protocol Stack.
[in]GATT_Server_Event_DataPointer to the passed GATT server Event data.
[in]CallbackParameterUser-defined parameter (e.g., tag value) that was defined in the callback registration.
Returns
None.
Note
<Notes>

m2m_ble_genericServiceCb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_genericServiceCb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
UINT8 temp[517] = {0};
M2MB_BLE_GAP_ENCRYPTION_MODE_T gapEncryptionMode;
INT8* buffer = NULL;
INT32 ret ;
UINT8 serviceNum = (UINT8)CallbackParameter;
if(bluetoothStackId && GATT_ServerEventData)
{
{
memset(temp, 0x0, sizeof(temp));
switch (GATT_ServerEventData->Event_Data_Type)
{
break;
break;
if (GATT_ServerEventData->Event_Data.GATT_Read_Request_Data)
{
if(GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[%s,%d]: AttribOffset = %d, AttributeLength = %d\r\n", __FUNCTION__, __LINE__, attribOffset, attribValLen);
if(M2MB_OK == m2m_ble_cccdAttribCheck(serviceNum, attribOffset))
{
UINT16 cccdVal;
m2m_ble_cccdRead(serviceNum, attribOffset, &cccdVal);
cccdVal <<= 8;
m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
2, (UINT8 *)&cccdVal);
return;
}
int res = m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
strlen((const char *)temp), temp);
if(res)
{
//Do nothing
}
}
else
{
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
}
}
else
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: Invalid Read Request Event Data\r\n", __FUNCTION__, __LINE__);
}
break;
break;
}
}
}
}
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

Definition at line 5115 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_SERVER_EVENT_DATA_T

GAP LE event types and structures The following type declaration represents the structure of all GAP LE that is needed for gap events.

◆ M2MB_BLE_GATT_SERVER_INDICATION_DATA_T

Structure that contains the attribute handles that will need to be cached by a Server.

◆ M2MB_BLE_GATT_SERVER_NOTIFICATION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVER_NOTIFICATION_E event.

◆ M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T

Structure that represents GATT attribute handle group.

◆ M2MB_BLE_GATT_SERVICE_CHANGED_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_SERVICE_DATABASE_UPDATE_E event.

◆ M2MB_BLE_GATT_SERVICE_DISCOVERY_BY_UUID_RESPONSE_DATA_T

◆ M2MB_BLE_GATT_SERVICE_DISCOVERY_COMPLETE_DATA_T

Structure that represents the container structure for holding all the GATT service discovery event data.

◆ M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_CB_T

typedef VOID(* M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_CB_T) (UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)

This declared type represents the prototype function for GATT Service Discovery Event data callback. This function will be called whenever a GATT server event occurs that is associated with the specified Bluetooth stack ID.

The caller should use the contents of the GATT Event Data only in the context of this callback. If the caller requires the data for a longer period of time, the callback function must copy the data into another data buffer.

This function is guaranteed not to be invoked more than once simultaneously for the specified installed callback (i.e., this function does not have be reentrant). It should be noted, however, that if the same callback is installed more than once, the callbacks will be called serially. Because of this, the processing in this function should be as efficient as possible.

It should also be noted that this function is called in the Thread Context of a Thread that the user does not own. Therefore, processing in this function should be as efficient as possible (this argument holds anyway because another GATT Service Discovery Event will not be processed while this function call is outstanding).

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]GATT_Service_Discovery_Event_DataPointer to astructure that contains information about the event that has occurred.
[in]CallbackParameterUser-defined value that was supplied as an input parameter from a prior GATT request.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter);

VOID m2m_ble_readVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
void *blePairReadCtx = NULL;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
//
}
}
break;
break;
default:
break;
}
}
}
VOID m2m_ble_newreadVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
UINT8 readFlag = 1;
UINT32 ret;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
default:
break;
}
}
}
VOID m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle,
m2m_ble_newreadVal_cb, charHndle);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_read_cb);
ret = m2mb_ble_gatt_read_value_request(bleStackId, connectionId, Characteristic_Handle, m2m_ble_readVal_cb, Characteristic_Handle);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

Definition at line 4467 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T

Enumeration of the different values for duplicate filter that can be enabled with extended scanning.

◆ M2MB_BLE_GATT_SERVICE_DISCOVERY_INDICATION_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_COMPLETE_E event.

◆ M2MB_BLE_GATT_SERVICE_DISCOVERY_RESPONSE_DATA_T

Structure that represents the structure of information that is returned about a GATT included service declaration from a GATT find included services procedure. The UUID member is only valid for an included service if the UUID_Valid member is TRUE. Otherwise, it is invalid and should be ignored.

◆ M2MB_BLE_GATT_SERVICE_INFORMATION_BY_UUID_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_SERVICE_DISCOVERY_BY_UUID_RESPONSE_E event.

◆ M2MB_BLE_GATT_SERVICE_INFORMATION_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_ERROR_RESPONSE_E event. The RequestHandle and ErrorCode members are valid only if the Error_Type member is M2MB_BLE_RET_ERROR_RESPONSE_E.

◆ M2MB_BLE_GATT_SIGNED_WRITE_REQUEST_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVER_EXECUTE_WRITE_REQUEST_E event.

◆ M2MB_BLE_GATT_UUID_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_EXCHANGE_MTU_RESPONSE_E event.

◆ M2MB_BLE_GATT_WRITE_RESPONSE_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CLIENT_READ_MULTIPLE_RESPONSE_E event. The AttributeValuesLength is the TOTAL length (in bytes) of ALL attribute values, not the length of an individual attribute value.

◆ M2MB_BLE_GATT_WRITE_RRQUEST_DATA_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_SERVER_SIGNED_WRITE_REQUEST_E event.

◆ M2MB_BLE_HCI_COMMDRIVERINFORMATION_T

The following type declaration defines the HCI USB Driver that
that will be used as the physical HCI Transport Driver for the USB Device that is to be opened.

◆ M2MB_BLE_HCI_DRIVERINFORMATION_T

The following type declaration represents the structure of scan parameters.

◆ M2MB_BLE_HCI_USBDRIVERINFORMATION_T

The following type declaration defines the HCI USB Driver that
that will be used as the physical HCI Transport Driver for the USB Device that is to be opened.

◆ M2MB_BLE_INIT_PARAM_T

The following defines the maximum allowable GAP Device Name.

◆ M2MB_BLE_LE_FEATURES_T

The following define determines the maximum fixed size that is used to define the Advertising Data that can be sent/received in advertising packets for a device.

◆ M2MB_BLE_LONG_TERM_KEY_T

Enumeration that represents the different Central Address Resolution values that can be specified.

◆ M2MB_BLE_NONALIGNEDWORD_T

< Unaligned Generic 16 Bit

◆ M2MB_BLE_PARAM_T

The following type declaration represents the structure of device information. It hold a list of information on all paired devices.

◆ M2MB_BLE_PASSKEY_RSP_T

Structure that represents a container structure for persistent remote device data for bonding.

◆ M2MB_BLE_PASSKEY_USER_CB_T

typedef VOID(* M2MB_BLE_PASSKEY_USER_CB_T) (VOID *ctx, UINT32 eventType, M2MB_BLE_PASSKEY_RSP_T passKeyResp)

Declared type that represents the Prototype Function for the passkey response data user callback.

This function is called whenever a callback has been registered for the specified passkey response data event.

Parameters
[in]ctxUser defined callback context.
[in]eventTypeIt is security type based event.
[in]passKeyRespPasskey response data.
Returns
None.
Note
<Notes>

m2m_s2w_ble_ssppin_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_PASSKEY_RSP_T passKeyResp);

VOID m2m_s2w_ble_ssppin_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_PASSKEY_RSP_T passKeyResp)
{
switch(eventType)
{
break;
break;
break;
default:
break;
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
VOID*sspCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_passkey_cb(sspCtx,m2m_s2w_ble_ssppin_cb);
return M2MB_OK;
}

Definition at line 5544 of file m2mb_ble_driver.h.

◆ M2MB_BLE_PERSISTENT_DATA_T

total persistent device data size.

◆ M2MB_BLE_PERSISTENT_DEVICE_REMOTE_DATA_T

persistent remote device data size.

◆ M2MB_BLE_RANDOM_NUMBER_T

The following represents the structure of a single Encryption Key(Version 4.0 + LE).

◆ M2MB_BLE_SCAN_PARAMETERS_T

The following type declaration represents the structure of advertising,connection and scan parameters.

◆ M2MB_BLE_SCAN_RESPONSE_DATA_T

These GATT events are issued to the application via callbacks registered to receive connection events. The following event types are no longer valid but left in the enumerated list for legacy purposes. Therefore, they do not need to be handled by the upper layer application.

◆ M2MB_BLE_SECURE_CONNECTIONS_CONFIRMATION_T

The following type declaration represents the structure of a single Secure Connections Confirmation, C used for OOB mechanism of LE Secure Connections (Version 4.2).

◆ M2MB_BLE_SECURE_CONNECTIONS_RANDOMIZER_T

The following represents the structure of a Random Number that is used during Encryption (Version 4.0 + LE).

◆ M2MB_BLE_SEND_INFO_T

The following structure represents the device appearance mapping on a Discovered GAP Service.

◆ M2MB_BLE_SERVER_INFO_T

Structure that represents the data returned in a GATT M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_MTU_UPDATE_E event.

◆ M2MB_BLE_UUID_128_T

The following structure defines the container structure that will hold the Authentication Signature data (if present in an Attribute Protocol PDU).

◆ M2MB_BLE_UUID_16_T

The following type declaration represents the structure of a single 32 Bit Universally Unique Identifier (UUID).

◆ M2MB_BLE_UUID_32_T

The following type declaration represents the structure of a single 128 Bit Universally Unique Identifier (UUID).

◆ M2MB_PERSIST_HANDLE_T

Definition at line 295 of file m2mb_ble_driver.h.

Enumeration Type Documentation

◆ M2MB_BLE_GAP_CENTRAL_ADDRESS_RESOLUTION_T

Enumerator
M2MB_BLE_GAR_DISABLED_E 

Disabled.

M2MB_BLE_GAR_ENABLED_E 

Enabled.

Definition at line 507 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_DISCOVERABILITY_MODE_T

Enumerator
M2MB_BLE_DM_NON_DISCOVERABLE_MODE_E 

Indicates the GAP Non-discoverable mode.

M2MB_BLE_DM_LIMITED_DISCOVERABLE_MODE_E 

Indicates the GAP Limited-discoverable mode.

M2MB_BLE_DM_GENERAL_DISCOVERABLE_MODE_E 

Indicates the GAP General-discoverable mode.

Definition at line 2051 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_ENCRYPTION_MODE_T

Enumerator
M2MB_BLE_EM_DISABLED_E 

Indicates the link is not encrypted.

M2MB_BLE_EM_ENABLED_E 

Indicates the link encryption is enabled.

Definition at line 1918 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_ADDRESS_TYPE_T

Enumerator
M2MB_BLE_LAT_PUBLIC_E 

Indicates a public address.

M2MB_BLE_LAT_RANDOM_E 

Indicates a random address.

M2MB_BLE_LAT_PUBLIC_IDENTITY_E 

Indicates a public identity address.

M2MB_BLE_LAT_RANDOM_IDENTITY_E 

Indicates a random identity address.

M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E 

Indicates the local use of a resolvable private address with the fall-back of using the devices public address.

M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PRIVATE_E 

Indicates the local use of a resolvable private address with the fall-back of using currently configured random address.

M2MB_BLE_LAT_ANONYMOUS_E 

Indicates that address is that of anonymous device (address not present in advertising packet.

Definition at line 2122 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_ADVERTISING_DATA_STATUS_T

Enumerator
M2MB_BLE_DS_COMPLETE_E 

Complete.

M2MB_BLE_DS_INCOMPLETE_DATA_PENDING_E 

Data Pending.

M2MB_BLE_DS_INCOMPLETE_DATA_TRUNCATED_E 

Data Truncated.

Definition at line 1999 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_ADVERTISING_REPORT_TYPE_T

Enumerator
M2MB_BLE_RT_CONNECTABLE_UNDIRECTED_E 

Indicates an undirected connectable report.

M2MB_BLE_RT_CONNECTABLE_DIRECTED_E 

Indicates a directed connectable report.

M2MB_BLE_RT_SCANNABLE_UNDIRECTED_E 

Indicates an undirected scannable report.

M2MB_BLE_RT_NON_CONNECTABLE_UNDIRECTED_E 

Indicates a non-connectable undirected report.

M2MB_BLE_RT_SCAN_RESPONSE_E 

Indicates a scan response report.

Definition at line 1864 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_TYPE_T

Enumerator
M2MB_BLE_LAT_LONG_TERM_KEY_REQUEST_E 

Indicates a long term key request authentication event.

M2MB_BLE_LAT_SECURITY_REQUEST_E 

Indicates a security request authentication event.

M2MB_BLE_LAT_PAIRING_REQUEST_E 

Indicates a pairing request authentication event.

M2MB_BLE_LAT_CONFIRMATION_REQUEST_E 

Indicates a confirmation request authentication event.

M2MB_BLE_LAT_PAIRING_STATUS_E 

Indicates a pairing status authentication event.

M2MB_BLE_LAT_ENCRYPTION_INFORMATION_REQUEST_E 

Indicates an encryption information request authentication event.

M2MB_BLE_LAT_IDENTITY_INFORMATION_REQUEST_E 

Indicates an identity information request authentication event.

M2MB_BLE_LAT_SIGNING_INFORMATION_REQUEST_E 

Indicates a signing information request authentication event.

M2MB_BLE_LAT_ENCRYPTION_INFORMATION_E 

Indicates an encryption information authentication event.

M2MB_BLE_LAT_IDENTITY_INFORMATION_E 

Indicates an identity information authentication event.

M2MB_BLE_LAT_SIGNING_INFORMATION_E 

Indicates a signing information authentication event.

M2MB_BLE_LAT_SECURITY_ESTABLISHMENT_COMPLETE_E 

Indicates a security establishment complete authentication event.

M2MB_BLE_LAT_KEYPRESS_NOTIFICATION_E 

Indicates a keypress notification authentication event.

M2MB_BLE_LAT_EXTENDED_PAIRING_REQUEST_E 

Indicates an extended pairing request authentication event.

M2MB_BLE_LAT_EXTENDED_CONFIRMATION_REQUEST_E 

Indicates an extended confirmation request authentication event.

M2MB_BLE_LAT_EXTENDED_OUT_OF_BAND_INFORMATION_E 

Indicates an extended out of band information request authentication event.

Definition at line 1881 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_AUTHENTICATION_RESPONSE_TYPE_T

Enumerator
M2MB_BLE_LAR_LONG_TERM_KEY_E 

Indicates the long term key authentication response.

M2MB_BLE_LAR_OUT_OF_BAND_DATA_E 

Indicates the out of band data authentication response.

M2MB_BLE_LAR_PAIRING_CAPABILITIES_E 

Indicates the pairing capabilities authentication response.

M2MB_BLE_LAR_PASSKEY_E 

Indicates the passkey authentication response.

M2MB_BLE_LAR_CONFIRMATION_E 

Indicates the confirmation authentication response.

M2MB_BLE_LAR_ERROR_E 

Indicates the error authentication response.

M2MB_BLE_LAR_ENCRYPTION_INFORMATION_E 

Indicates the encryption information authentication response.

M2MB_BLE_LAR_IDENTITY_INFORMATION_E 

Indicates the identity information authentication response.

M2MB_BLE_LAR_SIGNING_INFORMATION_E 

Indicates the signing information authentication response.

M2MB_BLE_LAR_KEY_PRESS_E 

Indicates the keypress authentication response.

Definition at line 2013 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_BONDING_TYPE_T

Enumerator
M2MB_BLE_LBT_NO_BONDING_E 

Indicates no bonding type.

M2MB_BLE_LBT_BONDING_E 

Indicates bonding type.

Definition at line 1929 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_CHANNEL_SELECTION_ALGORITHM_T

Enumerator
M2MB_BLE_SA_ALGORITHM_NUM1_E 

Channel selection algorithm 1.

M2MB_BLE_SA_ALGORITHM_NUM2_E 

Channel selection algorithm 2.

Definition at line 2960 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_CONNECTABILITY_MODE_T

Enumerator
M2MB_BLE_LCM_NON_CONNECTABLE_E 

Indicates non-connectable mode.

M2MB_BLE_LCM_CONNECTABLE_E 

Indicates connectable mode.

M2MB_BLE_LCM_DIRECT_CONNECTABLE_E 

Indicates directed connectable mode.

M2MB_BLE_LCM_LOW_DUTY_CYCLE_DIRECT_CONNECTABLE_E 

Indicates low duty cycle directed connectable mode.

Definition at line 2038 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EVENT_TYPE_T

Enumerator
M2MB_BLE_ET_LE_REMOTE_FEATURES_RESULT_E 

Indicates an LE remote features result event.

M2MB_BLE_ET_LE_ADVERTISING_REPORT_E 

Indicates an LE advertising report event.

M2MB_BLE_ET_LE_CONNECTION_COMPLETE_E 

Indicates an LE connection complete event.

M2MB_BLE_ET_LE_DISCONNECTION_COMPLETE_E 

Indicates an LE disconnection complete event.

M2MB_BLE_ET_LE_ENCRYPTION_CHANGE_E 

Indicates an LE encryption change event.

M2MB_BLE_ET_LE_ENCRYPTION_REFRESH_COMPLETE_E 

Indicates an LE encryption refresh event.

M2MB_BLE_ET_LE_AUTHENTICATION_E 

Indicates an LE authentication event (which will have sub-events).

M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_REQUEST_E 

Indicates an LE connection parameter update request event.

M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATE_RESPONSE_E 

Indicates an LE connection parameter update response event.

M2MB_BLE_ET_LE_CONNECTION_PARAMETER_UPDATED_E 

Indicates an LE connection parameter updated event.

M2MB_BLE_ET_LE_AUTHENTICATED_PAYLOAD_TIMEOUT_EXPIRED_E 

Indicates that the LE Authenticated Payload Timeout expired for the specified connection.

M2MB_BLE_ET_LE_DIRECT_ADVERTISING_REPORT_E 

Indicates an LE direct advertising report event.

M2MB_BLE_ET_LE_DATA_LENGTH_CHANGE_E 

Indicates an LE data length change event.

M2MB_BLE_ET_LE_PHY_UPDATE_COMPLETE_E 

Indicates an LE PHY update complete event.

M2MB_BLE_ET_LE_EXTENDED_ADVERTISING_REPORT_E 

Indicates an LE extended advertising report event.

M2MB_BLE_ET_LE_RFU0_E 

Reserved for future use.

M2MB_BLE_ET_LE_RFU1_E 

Reserved for future use.

M2MB_BLE_ET_LE_RFU2_E 

Reserved for future use.

M2MB_BLE_ET_LE_SCAN_TIMEOUT_E 

Indicates an LE scan timeout event.

M2MB_BLE_ET_LE_ADVERTISING_SET_TERMINATED_E 

Indicates an LE advertising set has been terminated.

M2MB_BLE_ET_LE_SCAN_REQUEST_RECEIVED_E 

Indicates an LE extended advertising report event.

M2MB_BLE_ET_LE_CHANNEL_SELECTION_ALGORITHM_UPDATE_E 

Indicates an LE channel selection algorithm update event.

Definition at line 1814 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_EXTENDED_SCAN_FILTER_DUPLICATES_TYPE_T

Enumerator
M2MB_BLE_FD_DISABLED_E 

Disabled.

M2MB_BLE_FD_ENABLED_E 

Enabled.

M2MB_BLE_FD_ENABLED_RESET_EACH_SCAN_PERIOD_E 

Enabled and reset each scan period.

Definition at line 3620 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_FILTER_POLICY_T

Enumerator
M2MB_BLE_FP_NO_FILTER_E 

Indicates that no filtering should be done.

M2MB_BLE_FP_WHITE_LIST_E 

Indicates that filtering should be done based on the white list.

M2MB_BLE_FP_NO_WHITE_LIST_DIRECTED_RPA_E 

Indicates that no filtering should be done and that directed advertisements containing a resolvable private addresses (RPA) should be allowed.

M2MB_BLE_FP_WHITE_LIST_DIRECTED_RPA_E 

Indicates that filtering should be done based on the white list and that directed advertisements containing an RPA should be allowed.

Definition at line 2095 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_IO_CAPABILITY_T

Enumerator
M2MB_BLE_LIC_DISPLAY_ONLY_E 

Indicates device can only display a value.

M2MB_BLE_LIC_DISPLAY_YES_NO_E 

Indicates device can only display a value and ask a yes/no confirmation.

M2MB_BLE_LIC_KEYBOARD_ONLY_E 

Indicates device can only input a value.

M2MB_BLE_LIC_NO_INPUT_NO_OUTPUT_E 

Indicates device has no input and no output capability.

M2MB_BLE_LIC_KEYBOARD_DISPLAY_E 

Indicates device can both input and display a value.

Definition at line 2076 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_KEYPRESS_T

Enumerator
M2MB_BLE_LKP_ENTRY_STARTED_E 

Indicates passkey input has started.

M2MB_BLE_LKP_DIGIT_ENTERED_E 

Indicates a digit has been entered.

M2MB_BLE_LKP_DIGIT_ERASED_E 

Indicates a digit has been erased.

M2MB_BLE_LKP_CLEARED_E 

Indicates that passkey has been cleared.

M2MB_BLE_LKP_ENTRY_COMPLETED_E 

Indicates passkey input has completed.

Definition at line 1969 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_ONFIRMATION_REQUEST_TYPE_T

Enumerator
M2MB_BLE_CRT_NONE_E 

Indicates a request for just works confirmation request.

M2MB_BLE_CRT_PASSKEY_E 

Indicates a request for passkey input.

M2MB_BLE_CRT_DISPLAY_E 

Indicates a request for passkey display.

M2MB_BLE_CRT_OOB_E 

Indicates a request for Out of Band data.

M2MB_BLE_CRT_DISPLAY_YES_NO_E 

Indicates a request for displaying a passkey and answering yes/no of user.

M2MB_BLE_CRT_OOB_SECURE_CONNECTIONS_E 

Indicates a request for secure connections Out of Band data.

Definition at line 1947 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_PAIRABILITY_MODE_T

Enumerator
M2MB_BLE_LPM_NON_PAIRABLEMODE_E 

Indicates Non-pairable mode.

M2MB_BLE_LPM_PAIRABLE_MODE_E 

Indicates Pairable mode.

M2MB_BLE_LPM_PAIRABLE_MODE_ENABLE_EXTENDED_EVENTS_E 

Indicates Pairable mode with enabling of extended events.

Definition at line 2062 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_PHY_TYPE_T

Enumerator
M2MB_BLE_LPT_PHY_LE_1M_E 

Indicates the LE 1 megabit PHY.

M2MB_BLE_LPT_PHY_LE_2M_E 

Indicates the LE 2 megabit PHY.

M2MB_BLE_LPT_PHY_LE_CODED_E 

Indicates the LE coded PHY.

Definition at line 1986 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GAP_LE_SCAN_TYPE_T

Enumerator
M2MB_BLE_ST_PASSIVE_E 

Indicates that a passive scan (receive only) should be started.

M2MB_BLE_ST_ACTIVE_E 

Indicates that a active scan (transmit/receive) should be started.

Definition at line 3528 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CLIENT_EVENT_TYPE_T

Enumerator
M2MB_BLE_ET_GATT_CLIENT_ERROR_RESPONSE_E 

GATT client error response event.

M2MB_BLE_ET_GATT_CLIENT_SERVICE_DISCOVERY_RESPONSE_E 

GATT client service discovery response event.

M2MB_BLE_ET_GATT_CLIENT_SERVICE_DISCOVERY_BY_UUID_RESPONSE_E 

GATT client service discovery by UUID response event.

M2MB_BLE_ET_GATT_CLIENT_INCLUDED_SERVICES_DISCOVERY_RESPONSE_E 

GATT client include services discovery response event.

M2MB_BLE_ET_GATT_CLIENT_CHARACTERISTIC_DISCOVERY_RESPONSE_E 

GATT client Characteristic discovery response event.

M2MB_BLE_ET_GATT_CLIENT_CHARACTERISTIC_DESCRIPTOR_DISCOVERY_RESPONSE_E 

GATT client Characteristic Descriptor discovery response event.

M2MB_BLE_ET_GATT_CLIENT_READ_RESPONSE_E 

GATT client read response event.

M2MB_BLE_ET_GATT_CLIENT_READ_LONG_RESPONSE_E 

GATT client read long response event.

M2MB_BLE_ET_GATT_CLIENT_READ_BY_UUID_RESPONSE_E 

GATT client read by UUID response event.

M2MB_BLE_ET_GATT_CLIENT_READ_MULTIPLE_RESPONSE_E 

GATT client read multiple response event.

M2MB_BLE_ET_GATT_CLIENT_WRITE_RESPONSE_E 

GATT client write response event.

M2MB_BLE_ET_GATT_CLIENT_PREPARE_WRITE_RESPONSE_E 

GATT client prepare write response event.

M2MB_BLE_ET_GATT_CLIENT_EXECUTE_WRITE_RESPONSE_E 

GATT client execute write response event.

M2MB_BLE_ET_GATT_CLIENT_EXCHANGE_MTU_RESPONSE_E 

GATT client exchanged MTU response event.

Definition at line 688 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CONNECTION_EVENT_TYPE_T

Enumerator
M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_REQUEST_E 

GATT device connection request event.

M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_E 

GATT device connection open request event.

M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_CONFIRMATION_E 

GATT device connection confirmation event.

M2MB_BLE_ET_GATT_CONNECTION_DEVICE_DISCONNECTION_E 

GATT device disconnection event.

M2MB_BLE_ET_GATT_CONNECTION_DEVICE_CONNECTION_MTU_UPDATE_E 

GATT device MTU update event.

M2MB_BLE_ET_GATT_CONNECTION_SERVER_INDICATION_E 

GATT server indication event.

M2MB_BLE_ET_GATT_CONNECTION_SERVER_NOTIFICATION_E 

GATT server notification event.

M2MB_BLE_ET_GATT_CONNECTION_SERVICE_DATABASE_UPDATE_E 

GATT service database updated event.

M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_READ_REQUEST_E 

GATT Service Changed read request event.

M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CONFIRMATION_E 

GATT Service Changed confirmation event.

M2MB_BLE_ET_GATT_CONNECTION_DEVICE_BUFFER_EMPTY_E 

GATT device buffer empty event.

M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CCCD_READ_REQUEST_E 

GATT Service Changed CCCD read request event.

M2MB_BLE_ET_GATT_CONNECTION_SERVICE_CHANGED_CCCD_UPDATE_E 

GATT Service Changed CCCD write request event.

Definition at line 627 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_CONNECTION_TYPE_T

Enumerator
M2MB_BLE_GCT_LE_E 

LE connection.

M2MB_BLE_GCT_BR_EDR_E 

BR/EDR connection.

Definition at line 726 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_REQUEST_ERROR_TYPE_T

Enumerator
M2MB_BLE_RET_ERROR_RESPONSE_E 

Error response.

M2MB_BLE_RET_PROTOCOL_TIMEOUT_E 

Protocol Timeout.

M2MB_BLE_RET_PREPARE_WRITE_DATA_MISMATCH_E 

Prepare Write data mismatch.

Definition at line 789 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_SERVER_EVENT_TYPE_T

Enumerator
M2MB_BLE_ET_GATT_SERVER_DEVICE_CONNECTION_E 

GATT server connection event.

M2MB_BLE_ET_GATT_SERVER_DEVICE_DISCONNECTION_E 

GATT server disconnection event.

M2MB_BLE_ET_GATT_SERVER_READ_REQUEST_E 

GATT server read request event.

M2MB_BLE_ET_GATT_SERVER_WRITE_REQUEST_E 

GATT server write request event.

M2MB_BLE_ET_GATT_SERVER_SIGNED_WRITE_REQUEST_E 

GATT server signed write request event.

M2MB_BLE_ET_GATT_SERVER_EXECUTE_WRITE_REQUEST_E 

GATT server execute write request event.

M2MB_BLE_ET_GATT_SERVER_EXECUTE_WRITE_CONFIRMATION_E 

GATT server execute write confirmation event.

M2MB_BLE_ET_GATT_SERVER_CONFIRMATION_RESPONSE_E 

GATT server confirmation response event.

M2MB_BLE_ET_GATT_SERVER_DEVICE_CONNECTION_MTU_UPDATE_E 

GATT server connection MTU update event.

M2MB_BLE_ET_GATT_SERVER_DEVICE_BUFFER_EMPTY_E 

GATT server device buffer empty.

Definition at line 661 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_TYPE_T

Enumerator
M2MB_BLE_AET_PRIMARY_SERVICE_16_E 

Primary service declaration with 16 bit UUID.

M2MB_BLE_AET_PRIMARY_SERVICE_128_E 

Primary service declaration with 128 bit UUID.

M2MB_BLE_AET_SECONDARY_SERVICE_16_E 

Secondary service declaration with 16 bit UUID.

M2MB_BLE_AET_SECONDARY_SERVICE_128_E 

Secondary service declaration with 128 bit UUID.

M2MB_BLE_AET_INCLUDE_DEFINITION_E 

Include definition.

M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_16_E 

Characteristic Declaration with 16 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_128_E 

Characteristic Declaration with 128 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_VALUE_16_E 

Characteristic Value with 16 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_VALUE_128_E 

Characteristic Value with 128 bit bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_16_E 

Characteristic Descriptor with 16 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_128_E 

Characteristic Descriptor with 128 bit UUID.

M2MB_BLE_AET_PRIMARY_SERVICE_32_E 

Primary service declaration with 32 bit UUID.

M2MB_BLE_AET_SECONDARY_SERVICE_32_E 

Secondary service declaration with 32 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_DECLARATION_32_E 

Characteristic declaration with 32 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_VALUE_32_E 

Characteristic Value with 32 bit UUID.

M2MB_BLE_AET_CHARACTERISTIC_DESCRIPTOR_32_E 

Characteristic Descriptor with 32 bit UUID.

Definition at line 752 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_Service_DISCOVERY_EVENT_TYPE_T

Enumerator
M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_INDICATION_E 

GATT client service discovery indication event.

M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_COMPLETE_E 

GATT client service discovery complete event.

Definition at line 3519 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_SERVICE_TYPE_T

Enumerator
M2MB_BLE_ST_SECONDARY_E 

Secondary.

M2MB_BLE_ST_PRIMARY_E 

Primary.

Definition at line 733 of file m2mb_ble_driver.h.

◆ M2MB_BLE_GATT_UUID_TYPE_T

Enumerator
M2MB_BLE_GU_UUID_16_E 

16-bit UUID.

M2MB_BLE_GU_UUID_128_E 

128-bit UUID.

M2MB_BLE_GU_UUID_32_E 

32-bit UUID.

Definition at line 742 of file m2mb_ble_driver.h.

◆ M2MB_BLE_HCI_COMM_PROTOCOL_T

Enumerator
M2MB_BLE_COMM_PROTOCOL_UART_E 
M2MB_BLE_COMM_PROTOCOL_UART_RTS_CTS_E 
M2MB_BLE_COMM_PROTOCOL_BCSP_E 
M2MB_BLE_COMM_PROTOCOL_BCSP_MUZZLED_E 
M2MB_BLE_COMM_PROTOCOL_H4DS_E 
M2MB_BLE_COMM_PROTOCOL_H4DS_RTS_CTS_E 
M2MB_BLE_COMM_PROTOCOL_HCILL_E 
M2MB_BLE_COMM_PROTOCOL_HCILL_RTS_CTS_E 
M2MB_BLE_COMM_PROTOCOL_3WIRE_E 
M2MB_BLE_COMM_PROTOCOL_3WIRE_RTS_CTS_E 
M2MB_BLE_COMM_PROTOCOL_SIBS_E 
M2MB_BLE_COMM_PROTOCOL_SIBS_RTS_CTS_E 

Definition at line 3207 of file m2mb_ble_driver.h.

◆ M2MB_BLE_HCI_DRIVERTYPE_T

Enumerator
M2MB_BLE_COMM_DRIVER_E 

COM/Serial Port HCI Connection Type.

M2MB_BLE_USB_DRIVER_E 

USB HCI Connection Type.

Definition at line 3193 of file m2mb_ble_driver.h.

◆ M2MB_BLE_HCI_USB_DRIVER_T

Enumerator
M2MB_BLE_USB_DRIVER_SS1_E 
M2MB_BLE_USB_DRIVER_GARMIN_E 

Definition at line 3254 of file m2mb_ble_driver.h.

Function Documentation

◆ m2mb_ble_advertise()

INT32 m2mb_ble_advertise ( UINT32  enable)

BLE Advertise enable.

This function is responsible to enable the LE advertising.

Parameters
[in]enable1- the enable flag to advertise and 0- disable advertise
Returns
Returns zero -OK successful, Returns -1 - ERROR
Note
<Notes>

m2mb_ble_advertise(advEnable);

int main()
{
INT32 ret;
UINT32 bleStackId,enableFlag;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
// if customize advertise is enabled
if(1 == advEnable)
{
enableFlag = 1;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_advParamGet()

void m2mb_ble_advParamGet ( M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS_T advParam)

BLE Advertising params get.

This function is used to get the advertising parameters used when performing a BLE Advertising Procedure.

Parameters
[in,out]advParampointer to the structure of advertising params.
Returns
None.
Note
<Notes>

m2mb_ble_advParamGet(&advParam);

int main()
{
INT32 ret;
UINT32 bleStackId,gapsInstanceId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_advParamGet(&advParam);
return M2MB_OK;
}

◆ m2mb_ble_advParamSet()

void m2mb_ble_advParamSet ( M2MB_BLE_GAP_LE_ADVERTISING_PARAMETERS_T  advParam)

BLE Advertising params set.

This function is used to set the parameters used when performing a BLE Advertising Procedure.

Parameters
[in]advParamstructure of advertising params filled with values.
Returns
None.
Note
<Notes>

m2mb_ble_advParamSet(advParam);

int main()
{
INT32 ret;
UINT32 bleStackId,gapsInstanceId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_advteriseDataInit()

VOID m2mb_ble_advteriseDataInit ( UINT8  enableFlag)

BLE Advertising data init.

This function is used to initialized the advertising data.

Parameters
[in]enableFlagset the flag for initialization.
Returns
None.
Note
<Notes>

m2mb_ble_advteriseDataInit(enableFlag);

int main()
{
INT32 ret;
UINT32 bleStackId,enableFlag;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
// if customize advertise is enabled
if(1 == advEnable)
{
enableFlag = 1;
}
return M2MB_OK;
}

◆ m2mb_ble_bluetooth_dis_id_get()

UINT32 m2mb_ble_bluetooth_dis_id_get ( )

BLE get the device instance Id.

The following function return disInstanceId.

Returns
Positive device instanceId value.
An error code negative.
Note
<Notes>

m2mb_ble_bluetooth_dis_id_get();

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,devInstanceId;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
devInstanceId = m2mb_ble_bluetooth_dis_id_get();
return M2MB_OK;
}

◆ m2mb_ble_bluetooth_stack_id_get()

UINT32 m2mb_ble_bluetooth_stack_id_get ( VOID  )

BLE Get the StackId.

This API is used to get the bluetooth stackId.

Returns
Returns positive unique bluetooth stack id, Returns -1 - ERROR
Note
<Notes>

m2mb_ble_bluetooth_stack_id_get();

int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_dis_query_pnp_id()

INT32 m2mb_ble_dis_query_pnp_id ( UINT32  bleStackId,
UINT32  disInstanceId,
M2MB_BLE_DIS_PNP_ID_DATA_T pnpIdData 
)

Queries the current PnP ID Data characteristic value on the specified DIS instance.

If this function is successful, this function returns zero, and the buffer that pnpIdData points to will be filled with PnP ID Data .

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]disInstanceIdDevice service instance ID.
[in]pnpIdDataPointer to return the current PNP ID Data for the specified DIS Instance.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_dis_query_pnp_id(bleStackID, disSrvID, &pnpIdData);

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,disSrvID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
if((bleStackID > 0) && (disSrvID > 0))
{
m2mb_ble_dis_query_pnp_id(bleStackID, disSrvID, &pnpIdData);
}
return M2MB_OK;
}

◆ m2mb_ble_dis_set_pnp_id()

INT32 m2mb_ble_dis_set_pnp_id ( UINT32  bleStackId,
UINT32  disInstanceId,
M2MB_BLE_DIS_PNP_ID_DATA_T pnpIdData 
)

Queries the current PnP ID Data characteristic value on the specified DIS instance.

If this function is successful, this function returns zero, and the buffer that pnpIdData points to will be filled with PnP ID Data .

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]disInstanceIdDevice service instance ID.
[in]pnpIdDataValue to be entered as the PNP ID Data for the specified DIS Instance.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_dis_set_pnp_id(bleStackID, disSrvID, &pnpIdData);

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,disSrvID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
if((bleStackID > 0) && (disSrvID > 0))
{
if(!m2mb_ble_dis_query_pnp_id(bleStackID, disSrvID, &pnpIdData))
{
pnpIdData.VendorID = (UINT16)VendorID;
if(0 != m2mb_ble_dis_set_pnp_id(bleStackID, disSrvID, &pnpIdData))
{
return M2MB_ERROR;
}
}
else
{
return M2MB_ERROR;
}
}
return M2MB_OK;
}

◆ m2mb_ble_disconnect_device()

INT32 m2mb_ble_disconnect_device ( UINT32  bleStackId,
UINT32  connId 
)

Enables the local host to disconnect a currently connected LE device.

This function is used to disconnect the LE device.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]connIdSpecifies the connection handle of the currently connected device.
Returns
Zero if the scan procedure was successfully started.
An error code negative.
Note
<Notes>

m2mb_ble_disconnect_device(bleStackId,connectionId);

VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_disconnect_device(bleStackId,connectionId);
if(ret == M2MB_OK)
{
return M2MB_OK;
}
return M2MB_OK;
}

◆ m2mb_ble_error_response()

INT32 m2mb_ble_error_response ( UINT32  bleStackId,
UINT32  transactionId,
UINT16  attOffset,
UINT8  errCode 
)

Provides a mechanism for a service handler to respond to a received GATT/ATT request with an error response.

The AttributeOffset parameter must be less than or equal to the last index in the service table that was registered in the call to the m2mb_ble_service_register() function.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]transactionIdTransaction ID of the original read request.
[in]attOffsetAttribute offset of the first attribute that causes the error. This value will be greater than or equal to zero (specifies the very first attribute in the service) and less than the maximum number of attributes contained in the service.
[in]errCodeError code to return as a response to the request.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID, GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->AttributeOffset, M2MB_BLE_ATT_PROTOCOL_ERROR_CODE_ATTRIBUTE_NOT_LONG);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_genericServiceCb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
UINT8 temp[517] = {0};
M2MB_BLE_GAP_ENCRYPTION_MODE_T gapEncryptionMode;
INT8* buffer = NULL;
INT32 ret ;
UINT8 serviceNum = (UINT8)CallbackParameter;
if(bluetoothStackId && GATT_ServerEventData)
{
{
memset(temp, 0x0, sizeof(temp));
switch (GATT_ServerEventData->Event_Data_Type)
{
break;
break;
if (GATT_ServerEventData->Event_Data.GATT_Read_Request_Data)
{
if(GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[%s,%d]: AttribOffset = %d, AttributeLength = %d\r\n", __FUNCTION__, __LINE__, attribOffset, attribValLen);
if(M2MB_OK == m2m_ble_cccdAttribCheck(serviceNum, attribOffset))
{
UINT16 cccdVal;
m2m_ble_cccdRead(serviceNum, attribOffset, &cccdVal);
cccdVal <<= 8;
m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
2, (UINT8 *)&cccdVal);
return;
}
int res = m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
strlen((const char *)temp), temp);
if(res)
{
//Do nothing
}
}
else
{
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
}
}
else
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: Invalid Read Request Event Data\r\n", __FUNCTION__, __LINE__);
}
break;
if (GATT_ServerEventData->Event_Data.GATT_Write_Request_Data)
{
if (GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
int res = m2mb_ble_write_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->TransactionID);
if(res)
{
//Do Nothing
}
}
else
{
}
}
else
{
//Do Nothing
}
break;
}
}
}
}
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_cancel_create_connection()

INT32 m2mb_ble_gap_le_cancel_create_connection ( UINT32  bleStackId)

Cancels a connection establishment procedure that was started via a successful call to the m2mb_ble_gap_le_create_connection() function.

This function does not disconnect a connected device, it merely stops the connection process (scanning and connecting).

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
Returns
Zero if the connection process was successfully canceled.
An error code negative.
Note
<Notes>

m2mb_ble_gap_le_cancel_create_connection(bleStackId);

VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
switch(eventType)
{
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_cancel_scan()

INT32 m2mb_ble_gap_le_cancel_scan ( UINT32  bleStackId)

Cancels a scan process that was started via a successful call to the m2mb_ble_gap_le_perform_scan() function.

If this function returns success, the GAP LE callback that was installed with the m2mb_ble_gap_le_perform_scan() function will not be called.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
Returns
Zero if the scan procedure was successfully canceled.
An error code negative.
Note
<Notes>

m2mb_ble_gap_le_cancel_scan(bleStackId);

VOID m2m_s2w_ble_scan_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 cbParam)
{
UINT32 Index,Index2,bleStackId;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
{
// process scan results accrodingly
}
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_create_connection()

INT32 m2mb_ble_gap_le_create_connection ( UINT32  bleStackId,
UINT32  scanInterval,
UINT32  scanWindow,
M2MB_BLE_GAP_LE_FILTER_POLICY_T  initatorFilterPolicy,
M2MB_BLE_GAP_LE_ADDRESS_TYPE_T  remoteAddressType,
M2MB_BLE_BD_ADDR_T remoteDevice,
M2MB_BLE_GAP_LE_ADDRESS_TYPE_T  localAddressType,
M2MB_BLE_GAP_LE_CONNECTION_PARAMETERS_T connectionParameters,
M2MB_BLE_GAP_LE_EVENT_CB_T  gapLeEventCb,
UINT32  cbParam 
)

Enables the local host to create a connection to a remote device using the Bluetooth LE radio.

This function is provided to establish an LE master connection to a remote device. This function allows the use of the Bluetooth white-list and can be used to specify a specific set of devices to which to connect.

This function is asynchronous in nature and the caller is informed when the connection is established via the callbackfunction.

If the InitatorFilterPolicy parameter is set to M2MB_BLE_FP_WHITE_LIST_E, the RemoteAddressType and RemoteDevice parameter are not used and NULL values may be passed in for them.

If the local Bluetooth controller is a version 4.0 or 4.1 compliant controller, only the following types may be used for the RemoteAddressType and the LocalAddressType parameters: M2MB_BLE_LAT_PUBLIC_E M2MB_BLE_LAT_RANDOM_E

The M2MB_BLE_LAT_PUBLIC_IDENTITY_E and M2MB_BLE_LAT_RANDOM_IDENTITY_E indicate that the RemoteDevice parameter is an identity address (a semipermanent address that can be used to refer to the device) that was received from the remote device (along with the remote device's IRK) during a successful LE Pairing process. Note that these two types are only valid for this API if the local controller is a version 4.2 or greater Bluetooth controller.

Note that if the final two enumerated types are specified (M2MB_BLE_LAT_RESOLVABLE_FALLBACK_XXX), the RemoteAddressType and RemoteAddress parameters must be specified and valid, as they will be used to search the Resolving List to find the local IRK to use when creating the connection. Also note that these two types are only valid for this API if the local controller is a version 4.2 or greater Bluetooth controller.

Types may be specified for the RemoteAddressType and the LocalAddressType parameters.

The following types may not be used with the InitatorFilterPolicy parameter:

M2MB_BLE_FP_NO_WHITE_LIST_DIRECTED_RPA_E M2MB_BLE_FP_WHITE_LIST_DIRECTED_RPA_E

These values may only be used with the m2mb_ble_gap_le_perform_scan() function..

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]scanIntervalSpecifies interval to use while scanning.
[in]scanWindowSpecifies window to use while scanning.
[in]initatorFilterPolicyFilter policy to apply when scanning.
[in]remoteAddressTypeSpecifies the type of the remote device address to connect with (if not using white-list filter).
[in]remoteDeviceSpecifies the remote device address to connect with. This value is required if no filter is specified as the filter policy.
[in]localAddressTypeSpecifies the type of the address the local device is to use when connecting to the remote device.
[in]connectionParametersSpecifies the parameters to use when actually establishing the connection to the remote device
[in]gapLeEventCbPointer to a callback function to be used by the GAP layer to dispatch GAP LE Event information for this request.
[in]cbParamUser-defined value to be used by the GAP layer as an input parameter for the callback.
Returns
Zero if the connection request was successful.
An error code negative.
Note
<Notes>

m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress, M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);

VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
switch(eventType)
{
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_perform_scan()

INT32 m2mb_ble_gap_le_perform_scan ( UINT32  bleStackId,
M2MB_BLE_GAP_LE_SCAN_TYPE_T  scanType,
UINT32  scanInterval,
UINT32  scanWindow,
M2MB_BLE_GAP_LE_ADDRESS_TYPE_T  localAddressType,
M2MB_BLE_GAP_LE_FILTER_POLICY_T  filterPolicy,
M2MB_BOOL_T  filterDuplicates,
M2MB_BLE_GAP_LE_EVENT_CB_T  gapLeEventCb,
UINT32  cbParam 
)

Starts an LE scan procedure.

Only ONE scan can be performed at any given time. Calling this function while an outstanding scan is in progress will fail. The caller can call the m2mb_ble_gap_le_cancel_scan() function to cancel a currently executing scanning procedure.

The ScanInterval and ScanWindow parameters (specified in milliseconds) must satisfy the following equation:

        ScanWindow <= ScanInterval

If ScanWindow == ScanInterval,LE Scanning will be performed continuously.

All scan period time parameters are specified in seconds

If the local Bluetooth controller is a version 4.0 or 4.1 compliant controller then only the: M2MB_BLE_LAT_PUBLIC_E M2MB_BLE_LAT_RANDOM_E

Note that if the final two enumerated types are specified (M2MB_BLE_LAT_RESOLVABLE_FALLBACK_XXX), the controller will attempt to generate a Resolvable Private Address to place in the scan request packets if the advertiser is in the resolving list. If the device is not in the resolving list, the controller will use either the public address (M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E) or the random address set via qapi_BLE_GAP_LE_Set_Random_Address() (M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PRIVATE_E). Note that these two types are only valid for this API if the local controller is a version 4.2 or greater Bluetooth controller.

Note that for the M2MB_BLE_FP_NO_WHITE_LIST_DIRECTED_RPA_E and M2MB_BLE_FP_WHITE_LIST_DIRECTED_RPA_E types, they may only be used if the local controller is a 4.2 or greater compliant controller.

If either of the M2MB_BLE_FP_NO_WHITE_LIST_DIRECTED_RPA_E or M2MB_BLE_FP_WHITE_LIST_DIRECTED_RPA_E types is specified for the FilterPolicy, the application can expect to receive the M2MB_BLE_ET_LE_DIRECT_ADVERTISING_REPORT_E event when a directed advertisement that is directed towards a resolvable private address is received by the controller.

If the QAPI_BLE_FP_NO_WHITE_LIST_DIRECTED_RPA_E type is used for the FilterPolicy parameter, the device can expect to receive advertising reports based on the following criteria:

  • All undirected advertising packets
  • All directed advertising packets where the initiator address (the device for whom the packets are intended) is a resolvable private address
  • All directed advertising packets address to the local device

When this type is used, the application can expect to receive M2MB_BLE_ET_LE_DIRECT_ADVERTISING_REPORT_E events when directed advertising packets where the initiator address is a resolvable private address. The application can then use the local IRK(s) to determine if the directed advertisement is intended to be received by the device and then can make an application decision on whether to connect to the device.

If the M2MB_BLE_FP_WHITE_LIST_DIRECTED_RPA_E type is used for the ilterPolicy parameter, the device can expect to receive advertising reports based on the following criteria:

  • All undirected advertising packets from devices where the advertiser's address is stored in the white list
  • All directed advertising packets where the initiator address (the device for whom the packets are intended) is a resolvable private address
  • All directed advertising packets addressed to the local device

When this type is used, the application can expect to receive M2MB_BLE_ET_LE_DIRECT_ADVERTISING_REPORT_E events when directed advertising packets where the initiator address is a resolvable private address. The application can then use the local IRK(s) to determine if the directed advertisement is intended to be received by the local device and then can make an application decision on whether to connect to the device.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]scanTypeSpecifies the type of scan to perform.
[in]scanIntervalSpecifies interval to use while scanning.
[in]scanWindowSpecifies window to use while scanning.
[in]localAddressTypeSpecifies the type of the address the local device is to use when connecting to the remote device.
[in]filterPolicyFilter policy to apply when scanning.
[in]filterDuplicatesSpecifies whether or not the host controller is to filter duplicate scan responses.
[in]gapLeEventCbPointer to a callback function to be used by the GAP layer to dispatch GAP LE Event information for this request.
[in]cbParamUser-defined value to be used by the GAP layer as an input parameter for the callback.
Returns
Zero if the scan procedure was successfully started.
An error code negative.
Note
<Notes>

m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow, M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);

VOID m2m_s2w_ble_scan_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 cbParam)
{
UINT32 Index,Index2,bleStackId;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
{
// process scan results accrodingly
}
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_query_encryption_mode()

INT32 m2mb_ble_gap_le_query_encryption_mode ( UINT32  bleStackId,
M2MB_BLE_BD_ADDR_T  remoteAddress,
M2MB_BLE_GAP_ENCRYPTION_MODE_T gapEncryptionMode 
)

Queries the current Encryption Mode.

This function is used to queries the current Encryption Mode.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]remoteAddressSpecifies the remote device address address of the connected device to query the link encryption mode.
[out]gapEncryptionModePointer to store the link encryption mode. This parameter is not optional, and cannot be NULL. If this function returns success, this will point to one of the following values:
M2MB_BLE_EM_DISABLED_E
M2MB_BLE_EM_ENABLED_E.
Returns
Zero if the connection request was successful.
An error code negative.
Note
<Notes>

Example

VOID m2m_ble_genericServiceCb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
UINT8 temp[517] = {0};
M2MB_BLE_GAP_ENCRYPTION_MODE_T gapEncryptionMode;
INT8* buffer = NULL;
INT32 ret ;
UINT8 serviceNum = (UINT8)CallbackParameter;
if(bluetoothStackId && GATT_ServerEventData)
{
{
memset(temp, 0x0, sizeof(temp));
switch (GATT_ServerEventData->Event_Data_Type)
{
break;
break;
if (GATT_ServerEventData->Event_Data.GATT_Read_Request_Data)
{
if(GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
if(!((m2mb_ble_gap_le_query_encryption_mode(bluetoothStackId, GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->RemoteDevice, &gapEncryptionMode) == 0) && (gapEncryptionMode == M2MB_BLE_EM_ENABLED_E)))
{
if(readSecPerm.encrypWithAuthFlag || readSecPerm.encrypWithLesecAuthFlag)
{
}
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: Read: No security failure\r\n", __FUNCTION__, __LINE__);
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
errorCode);
//m2m_printf(ble_handle, "Send read error\r\n");
if(res)
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: m2mb_ble_error_response() failed\r\n", __FUNCTION__, __LINE__, res);
}
return;
}
else
{
if(readSecPerm.encrypWithAuthFlag && (1 == justworksFlag))
{
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
errorCode);
if(res)
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: m2mb_ble_error_response() failed\r\n", __FUNCTION__, __LINE__, res);
}
return;
}
}
if(M2MB_OK == m2m_ble_cccdAttribCheck(serviceNum, attribOffset))
{
UINT16 cccdVal;
m2m_ble_cccdRead(serviceNum, attribOffset, &cccdVal);
cccdVal <<= 8;
m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
2, (UINT8 *)&cccdVal);
return;
}
int res = m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
strlen((const char *)temp), temp);
if(res)
{
//Do nothing
}
}
else
{
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
}
}
else
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: Invalid Read Request Event Data\r\n", __FUNCTION__, __LINE__);
}
break;
if (GATT_ServerEventData->Event_Data.GATT_Write_Request_Data)
{
if (GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
int res = m2mb_ble_write_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->TransactionID);
if(res)
{
//Do Nothing
}
}
else
{
}
}
else
{
//Do Nothing
}
break;
}
}
}
}
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_set_advertising_data()

INT32 m2mb_ble_gap_le_set_advertising_data ( UINT32  bleStackId,
UINT32  len,
M2MB_BLE_ADVERTISING_DATA_T advertisingData 
)

Sets the advertising data that is used during the advertising procedure.

Advertising data consists of zero or more tuples that consist of: Length (bytes)
Type (bytes)
Data (zero or more bytes)

Also, note that the advertising data itself is a fixed length. If the list of the tuples of the advertising data is not long enough to fill the required advertising length, the bytes containing the binary value zero (0x00) should be used to pad the data (until the end of the required advertising data size).

The Length and Advertising_Data parameters are optional. If the intention is to set advertising data whose length is zero, the Length and Advertising_Data parameters may be set to 0 and NULL respectively.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]lenNumber of significant advertising data bytes contained in the advertising data.
[in]advertisingDataPointer to a buffer that contains the advertising data. This buffer must be at least: M2MB_BLE_ADVERTISING_DATA_MAXIMUM_SIZE bytes long. Note that the length parameter specifies the actual number of bytes that are valid. The remaining bytes should be padded with zeros.
Returns
Zero if the advertising data was successfully set.
An error code negative.
Note
<Notes>

m2mb_ble_gap_le_set_advertising_data(bleStackId, length+1, &(AdvertisingData);

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,disSrvID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
M2MB_BLE_ADVERTISING_DATA_T AdvertisingData;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
if(0 == m2mb_ble_gap_le_set_advertising_data(bleStackId, length+1, &(AdvertisingData)))
{
return M2MB_OK;
}
return M2MB_OK;
}

◆ m2mb_ble_gap_le_set_scan_response_data()

INT32 m2mb_ble_gap_le_set_scan_response_data ( UINT32  bleStackId,
UINT32  len,
M2MB_BLE_SCAN_RESPONSE_DATA_T scanRespData 
)

Queries the current device name characteristic of a generic device from the specified GAP Service Instance.

The Name parameter must be a pointer to a NULL-terminated ASCII String of at most M2MB_BLE_GAP_MAXIMUM_DEVICE_NAME_LENGTH (not counting the trailing NULL terminator).

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]lenNumber of significant advertising data bytes contained in the advertising data.
[in]scanRespDataPointer to a buffer that contains the response data. This buffer must be at least M2MB_BLE_SCAN_RESPONSE_DATA_MAXIMUM_SIZE bytes long. Note that the length parameter specifies the actual number of bytes that are valid. The remaining bytes should be padded with zeros.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_gap_le_set_scan_response_data(bleStackId, Length, &(ScanResponseData));

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,bleGapsInstanceID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0,Length;
char localDeviceName[64] = {0};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_gap_le_set_scan_response_data(bleStackId, Length, &(ScanResponseData));
return M2MB_OK;
}

◆ m2mb_ble_gap_query_local_bdAddr()

INT32 m2mb_ble_gap_query_local_bdAddr ( UINT32  bleStackID,
M2MB_BLE_BD_ADDR_T bdAddr 
)

Queries (and reports) the device address of the local Bluetooth device.

If this function is successful, this function returns zero, and the buffer that bdAddr points to will be filled with the Board Address read from the Local Device. If this function returns a negative value, the bdAddr of the Local Device was not able to be queried (error condition).

Parameters
[in]bleStackIDUnique identifier assigned to this Bluetooth Protocol Stack.
[in]bdAddrPointer to memory in which to receive the local device address.
Returns
Zero if successfully.
An error code negative.
Note
<Notes>

m2mb_ble_gap_query_local_bdAddr(bleStackId,&bdAddress);

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gap_query_local_bdAddr(bleStackId,&bdAddress);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gaps_instance_id_get()

UINT32 m2mb_ble_gaps_instance_id_get ( VOID  )

BLE Get the gaps instanceId.

This API is used to get the bluetooth gaps instanceId.

Returns
Returns positive unique gaps instance id, Returns -1 - ERROR
Note
<Notes>

m2mb_ble_gaps_instance_id_get()

int main()
{
INT32 ret;
UINT32 bleStackId,gapsInstanceId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
gapsInstanceId = m2mb_ble_gaps_instance_id_get();
return M2MB_OK;
}

◆ m2mb_ble_gaps_query_device_name()

INT32 m2mb_ble_gaps_query_device_name ( UINT32  bleStackId,
UINT32  gapsInstanceId,
char *  deviceName 
)

Queries the current device name characteristic of a generic device from the specified GAP Service Instance.

The Name parameter must be a pointer to a NULL-terminated ASCII String of at most M2MB_BLE_GAP_MAXIMUM_DEVICE_NAME_LENGTH (not counting the trailing NULL terminator).

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]gapsInstanceIdDevice service instance ID.
[in]deviceNamePointer to a structure to return the current Device for the specified GAPS Service Instance.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_gaps_query_device_name(bleStackID, bleGapsInstanceID, localDeviceName);

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,bleGapsInstanceID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
char localDeviceName[64] = {0};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
bleGapsInstanceID = m2mb_ble_gaps_instance_id_get();
if (!m2mb_ble_gap_query_local_bdAddr(bleStackID, &BD_ADDR))
{
sprintf(localDeviceName, "%s_%02x%02x%02x", deviceName,
BD_ADDR.BD_ADDR2, BD_ADDR.BD_ADDR1, BD_ADDR.BD_ADDR0);
}
if(0 == m2mb_ble_gaps_query_device_name(bleStackID, bleGapsInstanceID, localDeviceName))
{
return M2MB_OK;
}
return M2MB_OK;
}

◆ m2mb_ble_gaps_set_device_name()

INT32 m2mb_ble_gaps_set_device_name ( UINT32  bleStackId,
UINT32  gapsInstanceId,
char *  deviceName 
)

Sets the device name characteristic of a generic device on the specified GAP Service Instance.

The Name parameter must be a pointer to a NULL-terminated ASCII String of at most M2MB_BLE_GAP_MAXIMUM_DEVICE_NAME_LENGTH (not counting the trailing NULL terminator).

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]gapsInstanceIdDevice service instance ID.
[in]deviceNameDevice Name to set as the current Device Name for the specified GAP Service Instance.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_gaps_set_device_name(bleStackID, bleGapsInstanceID, localDeviceName));

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,bleGapsInstanceID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
char localDeviceName[64] = {0};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
bleGapsInstanceID = m2mb_ble_gaps_instance_id_get();
if (!m2mb_ble_gap_query_local_bdAddr(bleStackID, &BD_ADDR))
{
sprintf(localDeviceName, "%s_%02x%02x%02x", deviceName,
BD_ADDR.BD_ADDR2, BD_ADDR.BD_ADDR1, BD_ADDR.BD_ADDR0);
}
if(0 != m2mb_ble_gaps_set_device_name(bleStackID, bleGapsInstanceID, localDeviceName))
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gatt_read_value_request()

INT32 m2mb_ble_gatt_read_value_request ( UINT32  bleStackId,
UINT32  connectionId,
UINT16  attributeHandle,
M2MB_BLE_GATT_CLIENT_EVENT_CB_T  gattClientEventCb,
UINT32  cbParam 
)

Performs a read request on a remote device for a specific attribute value.

If successful, the return value will contain the Transaction ID that can be used to cancel the request.

Possible events: M2MB_BLE_ET_GATT_CLIENT_READ_RESPONSE_E

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]connectionIdConnection ID of the currently connected remote GATT server device.
[in]attributeHandleAttribute handle of the attribute that is to be read.
[in]gattClientEventCbCallback function registered to receive the read value response event.
[in]cbParamCallback parameter that will be passed to the specified ServiceDiscoveryCallback when called with the result of the service discovery operation.
Returns
Zero if the scan procedure was successfully started.
An error code negative.
Note
<Notes>

m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle, m2m_ble_readVal_cb, charHndle);

VOID m2m_ble_readVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
void *blePairReadCtx = NULL;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Read_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
//
}
}
break;
break;
default:
break;
}
}
}
VOID m2m_ble_newreadVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
INT8 *readBuff;
UINT16 dataLen;
INT8 *hexStr;
UINT8 readFlag = 1;
UINT32 ret;
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
default:
break;
}
}
}
VOID m2mb_ble_pairing_status_read_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_read_value_request(bleStackId, connHndle,charHndle,
m2m_ble_newreadVal_cb, charHndle);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_read_cb);
ret = m2mb_ble_gatt_read_value_request(bleStackId, connectionId, Characteristic_Handle, m2m_ble_readVal_cb, Characteristic_Handle);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gatt_start_service_discovery()

INT32 m2mb_ble_gatt_start_service_discovery ( UINT32  bleStackId,
UINT32  connectionID,
UINT32  numberOfUUID,
M2MB_BLE_GATT_UUID_T uuidList,
M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_CB_T  serviceDiscoveryCb,
UINT32  cbParam 
)

Performs a service discovery operation that will automatically discover all included services, characteristics, and characteristic descriptors for either all services supported by a remote device or all services of a specified UUID that are supported by a remote device.

This function is provided to simplify the GATT service discovery process.

The NumberOfUUID and UUIDList parameters are optional and may be set to 0 and NULL respectively. If these parameters are not specified, all services on the specified remote device will be discovered.

Only one service discovery operation per remote device can be outstanding at a time.

Possible events:

  • M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_INDICATION_E
  • M2MB_BLE_ET_GATT_SERVICE_DISCOVERY_COMPLETE_E
Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]connectionIDConnection ID of the currently connected remote GATT server device.
[in]numberOfUUIDOption parameter that, if specified, contains the number of UUIDs that are contained in the UUIDList parameter.
[in]uuidListOptional list of Service UUIDs to attempt to discover on the specified remote device.
[in]serviceDiscoveryCbCallback function that will be called with the result of the service discovery operation.
[in]cbParamCallback parameter that will be passed to the specified ServiceDiscoveryCallback when called with the result of the service discovery operation.
Returns
Zero if the scan procedure was successfully started.
An error code negative.
Note
<Notes>

m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0, NULL,m2mb_ble_service_discovery_event_cb,NULL);

VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_gatt_write_request()

INT32 m2mb_ble_gatt_write_request ( UINT32  bleStackId,
UINT32  connectionId,
UINT16  attributeHandle,
UINT16  attributeLength,
VOID attributrValue,
M2MB_BLE_GATT_CLIENT_EVENT_CB_T  gattClientEventCb,
UINT32  cbParam 
)

Performs a write request to a remote device for a specified attribute.

This function will not write an attribute value with a length greater than the current MTU - 3.

This function may write less than the number of requested bytes. This can happen if the number of bytes to write is less than what can fit in the MTU for the specified connection. The data in the M2MB_BLE_ET_GATT_CLIENT_WRITE_RESPONSE_E that is dispatched if the remote device accepts the request indicates the number of bytes that were written to the remote device.

Possible events: M2MB_BLE_ET_GATT_CLIENT_WRITE_RESPONSE_E

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]connectionIdConnection ID of the currently connected remote GATT server device.
[in]attributeHandleAttribute handle of the attribute that is to be write.
[in]attributeLengthLength (in bytes) of the actual attribute value data to write to the specified attribute.
[in]attributrValueBuffer that contains (at least) as many bytes a specified by the AttributeLength parameter .
[in]gattClientEventCbCallback function registered to receive the read value response event.
[in]cbParamCallback parameter that will be passed to the specified ServiceDiscoveryCallback when called with the result of the service discovery operation.
Returns
Zero if the scan procedure was successfully started.
An error code negative.
Note
<Notes>

m2mb_ble_gatt_write_request(bleStackId, connectionId, Characteristic_Handle, length, byteArray, m2m_ble_writeVal_cb, (UINT32)NULL);

VOID m2m_ble_writeVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
{
ret = m2mb_ble_send_pairing_request(bleStackId,GATT_Client_Event_Data->Event_Data.GATT_Write_Response_Data->RemoteDevice,TRUE);
if(ret == M2MB_OK)
{
// do notthing
}
break;
}
break;
break;
}
}
}
VOID m2m_ble_newwriteVal_cb(UINT32 BluetoothStackID, M2MB_BLE_GATT_CLIENT_EVENT_DATA_T *GATT_Client_Event_Data, UINT32 cbParam)
{
if((BluetoothStackID) && (GATT_Client_Event_Data))
{
switch(GATT_Client_Event_Data->Event_Data_Type)
{
break;
break;
}
}
}
VOID m2mb_ble_pairing_status_write_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_WRITE_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_write_request(bleStackId, connHndle, charHndle,
length, byteArray, m2m_ble_newwriteVal_cb, (UINT32)NULL);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_write_cb);
ret = m2mb_ble_gatt_write_request(bleStackId, connectionId, Characteristic_Handle, length, byteArray, m2m_ble_writeVal_cb, (UINT32)NULL);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_get_connection_count()

UINT32 m2mb_ble_get_connection_count ( )

BLE get the connection count value.

The following function return connection count value.

Returns
Positive connection count if connection is done.
Note
<Notes>

m2mb_ble_get_connection_count();

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,devInstanceId;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_get_current_peer_device_info()

M2MB_BLE_DEVICE_INFO_T* m2mb_ble_get_current_peer_device_info ( )

The following function searches the specified List for the specified Connection bluetooth device address.

The following function searches the specified List for the specified Connection bluetooth device address.

Returns
bluetooth device address if successful.
An error code negative.
Note
<Notes>

m2mb_ble_get_current_peer_device_info();

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,disSrvID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_get_gatt_mtu()

UINT32 m2mb_ble_get_gatt_mtu ( )

BLE get the MTU size.

The following function return MTU size.

Returns
Positive MTU size.
Note
<Notes>

m2mb_ble_get_gatt_mtu();

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,devInstanceId;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 mtuSize;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
mtuSize = m2mb_ble_get_gatt_mtu();
return M2MB_OK;
}

◆ m2mb_ble_init()

INT32 m2mb_ble_init ( M2MB_BLE_INIT_PARAM_T initParam)

BLE Interface Initialization.

This API initializes the BLE stack interface depend on the the BLE driver and initialized parameters.

Parameters
[in]initParamUser should pass the default initialized param using M2MB_BLE_INIT_PARAM_T.
Returns
Returns 0 - Ok SuccessFull. Returns -1 - ERROR
Note
m2mb_ble_init function should be called before any function of BLE module.

m2mb_ble_init(&bleInitParam);

int main()
{
INT32 ret;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_justworksPairingStatus_Get()

UINT8 m2mb_ble_justworksPairingStatus_Get ( VOID  )

The following function is used to check whether Just Works pairing is used during the connection process.

The following function is used to check whether Just Works pairing is used during the connection process.

Returns
One if Just works is used
Zero if Just works is not used
Note
<Notes>

m2mb_ble_justworksPairingStatus_Get();

int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval,bleGapsInstanceID;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
UINT32 connCount;
UINT8 justworksFlag;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0,Length;
char localDeviceName[64] = {0};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_read_response()

INT32 m2mb_ble_read_response ( UINT32  bleStackId,
UINT32  transactionId,
UINT32  dataLen,
UINT8 data 
)

Responds with a successful response to a received M2MB_BLE_ET_GATT_SERVER_READ_REQUEST_E event.

This function only allows a successful response to be sent. If an error response is required, the m2mb_ble_error_response() function should be used to respond with the error information.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]transactionIdTransaction ID of the original read request.
[in]dataLenSpecifies the amount of data to return.This is the amount of data(in bytes)pointed to by the Data parameter.
[in]dataSpecifies the buffer that contains the data to return in the read response. This buffer must point to a buffer that contains (at least) as many bytes as specified by the DataLength parameter.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID, strlen((const char *)temp), temp);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_genericServiceCb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
UINT8 temp[517] = {0};
M2MB_BLE_GAP_ENCRYPTION_MODE_T gapEncryptionMode;
INT8* buffer = NULL;
INT32 ret ;
UINT8 serviceNum = (UINT8)CallbackParameter;
if(bluetoothStackId && GATT_ServerEventData)
{
{
memset(temp, 0x0, sizeof(temp));
switch (GATT_ServerEventData->Event_Data_Type)
{
break;
break;
if (GATT_ServerEventData->Event_Data.GATT_Read_Request_Data)
{
if(GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[%s,%d]: AttribOffset = %d, AttributeLength = %d\r\n", __FUNCTION__, __LINE__, attribOffset, attribValLen);
if(M2MB_OK == m2m_ble_cccdAttribCheck(serviceNum, attribOffset))
{
UINT16 cccdVal;
m2m_ble_cccdRead(serviceNum, attribOffset, &cccdVal);
cccdVal <<= 8;
m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
2, (UINT8 *)&cccdVal);
return;
}
int res = m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
strlen((const char *)temp), temp);
if(res)
{
//Do nothing
}
}
else
{
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
}
}
else
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: Invalid Read Request Event Data\r\n", __FUNCTION__, __LINE__);
}
break;
break;
}
}
}
}
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_rxtest()

INT32 m2mb_ble_rxtest ( UINT32  BluetoothStackID,
UINT8  RX_Frequency,
UINT8 StatusResult 
)

◆ m2mb_ble_scanRespDataInit()

VOID m2mb_ble_scanRespDataInit ( UINT8  enableFlag)

BLE Scan Response data init.

This function is used to initialized the Scan Response data.

Parameters
[in]enableFlagset the flag for initialization.
Returns
None.
Note
<Notes>

m2mb_ble_scanRespDataInit(enableFlag);

int main()
{
INT32 ret;
UINT32 bleStackId,enableFlag;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
// if customize advertise is enabled
if(1 == advEnable)
{
enableFlag = 1;
}
return M2MB_OK;
}

◆ m2mb_ble_send_indication()

INT32 m2mb_ble_send_indication ( UINT32  serviceId,
char *  msg,
UINT32  len,
UINT32  attOffset 
)

Provides a mechanism for a service handler to send a GATT attribute handle/value notification to a remote, connected, GATT client.

Indications require the client to acknowledge that the indication was received.

The serviceId parameter must have been returned from a successful call to the m2mb_ble_service_register() function. If a successful return value is returned, it will be greater than zero and less than or equal to AttributeValueLength(len) parameter.

Parameters
[in]serviceIdService ID of the service that is sending the indication. Returned in a successful call to m2mb_ble_service_register().
[in]msgBuffer that contains the value data to be indicated. This buffer must contain (at least) the number of bytes specified by the len parameter.
[in]lenLength (in bytes) of the attribute value data that is to be indicated.
[in]attOffsetAttribute offset of the first attribute that causes the error. This value will be greater than or equal to zero (specifies the very first attribute in the service) and less than the maximum number of attributes contained in the service.
Returns
Positive, nonzero value if successful. This value represents the number of attribute value bytes that will be sent in the indication.
An error code negative.
Note
<Notes>

Example

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret,numBytesSent
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
numBytesSent = m2mb_ble_send_indication(atCmdServiceId[srvNum], (char *)msg, len, offset);
if(numBytesSent < 0)
{
turn M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_send_notification()

INT32 m2mb_ble_send_notification ( UINT32  serviceId,
char *  msg,
UINT32  len,
UINT32  attOffset 
)

Provides a mechanism for a service handler to send a GATT attribute handle/value notification to a remote, connected, GATT client.

Notifications do not require the client to acknowledge that the notification was received.

The serviceId parameter must have been returned from a successful call to the m2mb_ble_service_register() function. If a successful return value is returned, it will be greater than zero and less than or equal to AttributeValueLength(len) parameter.

Parameters
[in]serviceIdService ID of the service that is sending the indication. Returned in a successful call to m2mb_ble_service_register().
[in]msgBuffer that contains the value data to be indicated. This buffer must contain (at least) the number of bytes specified by the len parameter.
[in]lenLength (in bytes) of the attribute value data that is to be notified.
[in]attOffsetAttribute offset of the first attribute that causes the error. This value will be greater than or equal to zero (specifies the very first attribute in the service) and less than the maximum number of attributes contained in the service.
Returns
Positive, nonzero value if successful. This value represents the number of attribute value bytes that will be sent in the notification.
An error code negative.
Note
<Notes>

m2mb_ble_send_notification(atCmdServiceId[srvNum], (char *)msg, len, offset);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret,numBytesSent
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
numBytesSent = m2mb_ble_send_notification(atCmdServiceId[srvNum], (char *)msg, len, offset);
if(numBytesSent < 0)
{
return M2MB_ERROR;
}
numBytesSent = m2mb_ble_send_indication(atCmdServiceId[srvNum], (char *)msg, len, offset);
if(numBytesSent < 0)
{
turn M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_service_deregister()

VOID m2mb_ble_service_deregister ( UINT32  serviceId)

BLE De-registers a previously registered GATT service that was registered via a successful call to the m2mb_ble_service_register() function.

This function will free all resources that are being utilized by the service being removed from the GATT database.

Parameters
[in]serviceIdSpecifies the service ID of the service that is to be removed. This value is the successful return value from the call to m2mb_ble_service_register().
Returns
None.
Note
<Notes>

m2mb_ble_service_deregister(serviceId);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId,serviceId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
serviceId = atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_service_register()

INT32 m2mb_ble_service_register ( UINT32  bleStackId,
UINT8  serviceFlag,
UINT32  srviceAttCnt,
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T ServiceTable,
M2MB_BLE_GATT_ATTRIBUTE_HANDLE_GROUP_T ServiceHandleGroupResult,
M2MB_BLE_GATT_SERVER_EVENT_CB_T  ServerEventCallback,
UINT32  CallbackParameter 
)

BLE Registers a GATT service with the local GATT server.

This function registers a service with the specified service attributes with the local GATT server.This function will return the unique service ID which is used to identify the service as well as the starting and ending attribute handles of the service in the local GATT service. The first entry in the array pointed to by service will be allocated with the starting handle specified in the ServiceHandleGroupResult structure. The second entry will be allocated at the starting Handle + 1, and so on. serviceFlag is a bitmask that is made up of bitmasks of the form M2MB_BLE_GATT_SERVICE_FLAGS_XXX. The serviceFlag may not be zero, i.e., at least one M2MB_BLE_GATT_SERVICE_FLAGS_XXX must be set for this call to succeed. The ServiceHandleGroupResult parameter is both an input and an output parameter. If the following test is true (and Starting_Handle and Ending_Handle members are greater than zero), the GATT layer will attempt to assign the service into the specified location in the ServiceTable:

ServiceHandleGroupResult->Ending_Handle == (ServiceHandleGroupResult->Starting_Handle + (NumberOfServiceAttributeEntries - 1))

If the specified location is not available, this function will return the error code M2MB_BLE_BTGATT_ERROR_INSUFFICIENT_HANDLES. The Service Table passed to this function is stored as a reference and as such its associated memory must be maintained by the application until the service has been removed.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol.
[in]serviceFlagSpecifies the current service flags to apply to the registered service. The value of this parameter is a bitmask of zero or more of the following values: M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE M2MB_BLE_GATT_SERVICE_FLAGS_BR_EDR_SERVICE
[in]srviceAttCntSpecifies the total number of service attribute entries that are contained in the ServiceTable parameter.
[in]ServiceTablePointer to an array of service attribute entries that specify all of the service attributes for the registered service.
[in,out]ServiceHandleGroupResulthis parameter is both an input and output parameter.On input, this parameter can be used to request that GATT place the service at a specific handle range in the GATT database. This is accomplished by setting the Starting_Handle and Ending_Handle members of this structure to the requested handle range in the GATT database.If these members are zero, or otherwise invalid on input, the GATT layer will place the service in the first available region in the GATT database. On output,GATT will return the handle range of the registered service if this function returns success.
[in]ServerEventCallbackCallback function that is registered to receive events that are associated with the specified service.
[in]CallbackParameterUser-defined parameter that will be passed back to the user in the callback function.
Returns
Positive, nonzero value if successful.This value represents the service ID that uniquely identifies the service in the local GATT database.
An error code if negative.
Returns positive unique gaps instance id, Returns -1 - ERROR
Note
<Notes>

m2mb_ble_service_register(bleStackId,M2MB_BLE_GATT_SERVICE_FLAGS_LE_SERVICE, atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]), &serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_connect()

INT32 m2mb_ble_set_connect ( UINT32  connMode)

BLE Set the connect Mode.

This API is used to set the connect mode of the ble device.

Parameters
[in]connModeSet the connect mode flag.
Returns
Returns 0 - Ok SuccessFull. Returns -1 - ERROR
Note
<Notes>

m2mb_ble_set_connect(connMode);

int main()
{
INT32 ret;
UINT32 connMode;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
connMode = M2M_BLE_GAP_CONNECTABILITY_MODE;
ret = m2mb_ble_set_connect(connMode);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_disc()

INT32 m2mb_ble_set_disc ( UINT32  discMode)

BLE Set discoverable Mode.

This API is used to set the d mode of the BLE device.

Parameters
[in]discModeSet the discoverable mode flag.
Returns
Returns 0 - Ok SuccessFull. Returns -1 - ERROR
Note
<Notes>

m2mb_ble_set_disc(discMode);

int main()
{
INT32 ret;
UINT32 discMode;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
discMode = M2M_BLE_GAP_DISCOVERABILITY_MODE;
ret = m2mb_ble_set_disc(discMode);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_get_connection_cb()

VOID m2mb_ble_set_get_connection_cb ( VOID cbCtx,
M2MB_BLE_GATT_CONNECT_USER_CB_T  cb 
)

This function is used to set and get the connection callback function.

This function used to set and get the connection callback function.

Parameters
[in]cbCtxgatt connection callback Context.
[in]cbCallback parameter that will be passed to the specified when the connection events occurs.
Returns
None.
Note
<Notes>

m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)

VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
switch(eventType)
{
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_io_capabilities()

INT32 m2mb_ble_set_io_capabilities ( UINT32  bleStackId,
UINT32  ioCap 
)

BLE Set the IoCapability.

This API is used to set the IoCapability of the ble device.

Parameters
[in]bleStackIdBluetooth stack id for the device.
[in]ioCapIoCapability value type. IoCapability Types: M2MB_BLE_LIC_DISPLAY_ONLY_E, M2MB_BLE_LIC_DISPLAY_YES_NO_E, M2MB_BLE_LIC_KEYBOARD_ONLY_E, M2MB_BLE_LIC_NO_INPUT_NO_OUTPUT_E, M2MB_BLE_LIC_KEYBOARD_DISPLAY_E
Returns
Returns 0 - Ok SuccessFull. Returns -1 - ERROR
Note
<Notes>

m2mb_ble_set_io_capabilities(bleStackId,ioCap);

int main()
{
INT32 ret;
UINT32 bleStackId,ioCap;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
ioCap = 0; // 0/1/2/3
ret = m2mb_ble_set_io_capabilities(bleStackId,ioCap);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_pairable()

INT32 m2mb_ble_set_pairable ( UINT32  pairMode)

BLE Set Pairable Mode.

This API is used to set the pairability mode of the BLE device.

Parameters
[in]pairModeSet the pairable mode flag.
Returns
Returns 0 - Ok SuccessFull. Returns -1 - ERROR
Note
<Notes>

m2mb_ble_set_pairable(pairMode);

int main()
{
INT32 ret;
UINT32 pairMode;
M2MB_BLE_INIT_PARAM_T bleInitParam;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
pairMode = M2M_BLE_GAP_PAIRABILITY_MODE;
ret = m2mb_ble_set_pairable(pairMode);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_pairing_status_cb()

VOID m2mb_ble_set_pairing_status_cb ( VOID cbCtx,
M2MB_BLE_GAP_PAIR_STATUS_USER_CB_T  cb 
)

This function is used to set the pairing status callback function.

This function used to set the pairing status callback function.

Parameters
[in]cbCtxGATT connection callback Context.
[in]cbCallback parameter that will be passed to the specified when the pairing status events occurs.
Returns
None.
Note
<Notes>

m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_write_cb);

VOID m2mb_ble_pairing_status_write_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_GAP_LE_AUTHENTICATION_EVENT_DATA_T *authInfo)
{
M2M_S2W_BLE_PAIR_WRITE_RSP_T rsp;
switch(eventType)
{
if(!(rsp.pairstatus))
{
m2mb_ble_gatt_write_request(bleStackId, connHndle, charHndle,
length, byteArray, m2m_ble_newwriteVal_cb, (UINT32)NULL);
}
break;
default:
break;
}
}
VOID m2mb_ble_service_discovery_event_cb(UINT32 bleStackId, M2MB_BLE_GATT_SERVICE_DISCOVERY_EVENT_DATA_T *GATT_Service_Discovery_Event_Data, UINT32 CallbackParameter)
{
switch(GATT_Service_Discovery_Event_Data->Event_Data_Type)
{
//Print all service and char UUIDs
break;
break;
}
}
VOID m2mb_ble_conn_gatt_connection_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_DEVICE_INFO_T *deviceInfo)
{
UINT8 *hexStr;
UINT32 connectionId;
switch(eventType)
{
connectionId = DeviceInfo->connectionId;
break
break;
break;
default:
break;
}
}
VOID m2mb_ble_gap_event_cb(UINT32 bluetoothStackId, M2MB_BLE_GAP_LE_EVENT_DATA_T *GAP_LE_Event_Data, UINT32 CallbackParameter)
{
INT32 Result;
if((bluetoothStackId) && (GAP_LE_Event_Data))
{
switch(GAP_LE_Event_Data->Event_Data_Type)
{
break;
break;
case QAPI_BLE_ET_LE_CONNECTION_COMPLETE_E:
break;
break;
default:
break;
}
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy,connectionId,Characteristic_Handle;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
scanWindow = 500;
scanInterval = 2000;
filterPolicy = 0;
ret = m2mb_ble_gap_le_perform_scan(bleStackId,M2MB_BLE_ST_ACTIVE_E,scanInterval,scanWindow,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,filterPolicy,TRUE,m2m_s2w_ble_scan_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
connectionParameters.Connection_Interval_Min = 400;
connectionParameters.Connection_Interval_Max = 400;
connectionParameters.Slave_Latency = 0;
connectionParameters.Minimum_Connection_Length = 0;
connectionParameters.Maximum_Connection_Length = 10000;
connectionParameters.Supervision_Timeout = 32000;
m2mb_ble_set_get_connection_cb(bleConnCtx,m2mb_ble_conn_gatt_connection_cb);
ret = m2mb_ble_gap_le_create_connection(bleStackId,scanInterval,scanWindow,0,(M2MB_BLE_GAP_LE_ADDRESS_TYPE_T)bdType,&bdAddress,
M2MB_BLE_LAT_RESOLVABLE_FALLBACK_PUBLIC_E,&connectionParameters,m2mb_ble_gap_event_cb,cbParam);
if(M2MB_OK != ret)
{
return M2MB_ERROR;
}
ret = m2mb_ble_gatt_start_service_discovery(bleStackId,connectionId,0,
NULL,m2mb_ble_service_discovery_event_cb,NULL);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_pairing_status_cb(blePairCtx,m2mb_ble_pairing_status_write_cb);
ret = m2mb_ble_gatt_write_request(bleStackId, connectionId, Characteristic_Handle, length, byteArray, m2m_ble_writeVal_cb, (UINT32)NULL);
if(retVal < 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}

◆ m2mb_ble_set_passkey_cb()

VOID m2mb_ble_set_passkey_cb ( VOID cbCtx,
M2MB_BLE_PASSKEY_USER_CB_T  cb 
)

This function is used to set the passkey call back.

This function used to set the passkey call back function.

Parameters
[in]cbCtxGATT connection callback Context.
[in]cbCallback parameter that will be passed to the specified when the connection events occurs.
Returns
None.
Note
<Notes>

m2mb_ble_set_passkey_cb(sspCtx,m2m_s2w_ble_ssppin_cb);

VOID m2m_s2w_ble_ssppin_cb(VOID *cbCtx,UINT32 eventType,M2MB_BLE_PASSKEY_RSP_T passKeyResp)
{
switch(eventType)
{
break;
break;
break;
default:
break;
}
}
int main()
{
INT32 ret;
UINT32 bleStackId,scanWindow,scanInterval;
UINT32 filterPolicy;
M2MB_BLE_INIT_PARAM_T bleInitParam;
M2MB_BLE_BD_ADDR_T bdAddress;
VOID *bleConnCtx = NULL;
VOID*sspCtx = NULL;
UINT32 cbParam = 0;
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
m2mb_ble_set_passkey_cb(sspCtx,m2m_s2w_ble_ssppin_cb);
return M2MB_OK;
}

◆ m2mb_ble_txpower_get()

INT32 m2mb_ble_txpower_get ( UINT32  bleStackId,
M2MB_BOOL_T  conn,
INT8 txPower 
)

◆ m2mb_ble_txpower_set()

INT32 m2mb_ble_txpower_set ( UINT32  bleStackId,
M2MB_BOOL_T  conn,
INT8  txPower 
)

◆ m2mb_ble_txtest()

INT32 m2mb_ble_txtest ( UINT32  BluetoothStackID,
UINT8  TX_Frequency,
UINT8  Length_Of_Test_Data,
UINT8  Packet_Payload,
UINT8 StatusResult 
)

◆ m2mb_ble_write_response()

INT32 m2mb_ble_write_response ( UINT32  bleStackId,
UINT32  transactionId 
)

Provides a mechanism for a service handler to successfully respond to a received GATT/ATT write request (M2MB_BLE_ET_GATT_SERVER_WRITE_REQUEST_E) event.

This function only allows a successful response to be sent. If an error response is required, the m2mb_ble_error_response() function should be used to respond with the error information.

Parameters
[in]bleStackIdUnique identifier assigned to this Bluetooth Protocol Stack.
[in]transactionIdTransaction ID of the original read request.
Returns
Zero if successful.
An error code negative.
Note
<Notes>

m2mb_ble_write_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->TransactionID);

#define M2M_AT_MAX_SERVICES_SUPPORTED 5
typedef VOID (*m2m_ble_atCmdServiceCb_t)(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter);
VOID m2m_ble_genericServiceCb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
UINT8 temp[517] = {0};
M2MB_BLE_GAP_ENCRYPTION_MODE_T gapEncryptionMode;
INT8* buffer = NULL;
INT32 ret ;
UINT8 serviceNum = (UINT8)CallbackParameter;
if(bluetoothStackId && GATT_ServerEventData)
{
{
memset(temp, 0x0, sizeof(temp));
switch (GATT_ServerEventData->Event_Data_Type)
{
break;
break;
if (GATT_ServerEventData->Event_Data.GATT_Read_Request_Data)
{
if(GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[%s,%d]: AttribOffset = %d, AttributeLength = %d\r\n", __FUNCTION__, __LINE__, attribOffset, attribValLen);
if(M2MB_OK == m2m_ble_cccdAttribCheck(serviceNum, attribOffset))
{
UINT16 cccdVal;
m2m_ble_cccdRead(serviceNum, attribOffset, &cccdVal);
cccdVal <<= 8;
m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
2, (UINT8 *)&cccdVal);
return;
}
int res = m2mb_ble_read_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
strlen((const char *)temp), temp);
if(res)
{
//Do nothing
}
}
else
{
int res = m2mb_ble_error_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Read_Request_Data->TransactionID,
}
}
else
{
M2MB_BLE_ATTR_UTIL_DEBUG_PRINTF("[ERROR][%s,%d]: Invalid Read Request Event Data\r\n", __FUNCTION__, __LINE__);
}
break;
if (GATT_ServerEventData->Event_Data.GATT_Write_Request_Data)
{
if (GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueOffset == 0)
{
UINT16 attribOffset = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeOffset;
UINT16 attribValLen = GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->AttributeValueLength;
int res = m2mb_ble_write_response(bluetoothStackId,GATT_ServerEventData->Event_Data.GATT_Write_Request_Data->TransactionID);
if(res)
{
//Do Nothing
}
}
else
{
}
}
else
{
//Do Nothing
}
break;
}
}
}
}
VOID m2m_ble_service1Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service2Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service3Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service4Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
VOID m2m_ble_service5Cb(UINT32 bluetoothStackId, M2MB_BLE_GATT_SERVER_EVENT_DATA_T *GATT_ServerEventData, UINT32 CallbackParameter)
{
m2m_ble_genericServiceCb(bluetoothStackId, GATT_ServerEventData, CallbackParameter);
}
int main()
{
INT32 ret;
UINT32 bleStackId;
M2MB_BLE_INIT_PARAM_T bleInitParam;
UINT32 len,offset;
char *msg;
M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *pAtCmdServices[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceId[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT32 atCmdServiceAttCnt[M2M_AT_MAX_SERVICES_SUPPORTED];
UINT8 atCmdRegisteredSrvCnt = 0;
m2m_ble_atCmdServiceCb_t atCmdServCb[M2M_AT_MAX_SERVICES_SUPPORTED] = {
m2m_ble_service1Cb,
m2m_ble_service2Cb,
m2m_ble_service3Cb,
m2m_ble_service4Cb,
m2m_ble_service5Cb,
};
memset(&bleInitParam,0,sizeof(bleInitParam));
bleInitParam.manufacturerName = (UINT8 *)malloc(64);
bleInitParam.modelNumber = (UINT8 *)malloc(64);
bleInitParam.softwareRevision = (UINT8 *)malloc(64);
bleInitParam.hardwareRevision = (UINT8 *)malloc(64);
bleInitParam.firmwareRevision = (UINT8 *)malloc(64);
strcpy(bleInitParam.manufacturerName,"Telit Wireless Solutions");
strcpy(bleInitParam.modelNumber,"4.2.1.1");
strcpy(bleInitParam.softwareRevision,"4.2");
strcpy(bleInitParam.hardwareRevision,"4.2");
strcpy(bleInitParam.firmwareRevision,"1.0");
bleInitParam.enAddrResolution = TRUE;
bleInitParam.resolvableAddrTimeout = 60;
bleInitParam.pnpIdData.VendorID_Source = 0x008F;
bleInitParam.pnpIdData.VendorID = 0x01;
bleInitParam.pnpIdData.ProductID = 0xB01A;
bleInitParam.pnpIdData.ProductVersion = 0x0700;
ret = m2mb_ble_init(&bleInitParam);
free(bleInitParam.manufacturerName);
free(bleInitParam.modelNumber);
free(bleInitParam.softwareRevision);
free(bleInitParam.hardwareRevision);
free(bleInitParam.firmwareRevision);
if(ret != M2MB_OK)
{
return M2MB_ERROR;
}
serviceHandleGroup.Starting_Handle = 0;
serviceHandleGroup.Ending_Handle = 0;
atCmdServiceAttCnt[atCmdRegisteredSrvCnt],(M2MB_BLE_GATT_SERVICE_ATTRIBUTE_ENTRY_T *)(pAtCmdServices[atCmdRegisteredSrvCnt]),
&serviceHandleGroup, atCmdServCb[atCmdRegisteredSrvCnt], atCmdRegisteredSrvCnt);
if (ret > 0)
{
atCmdServiceId[atCmdRegisteredSrvCnt] = (UINT32)ret;
atCmdRegisteredSrvCnt++;
ret = M2MB_OK;
}
else
{
ret = M2MB_ERROR;
}
ret = m2mb_ble_advertise(advEnable);
if(retVal != 0)
{
return M2MB_ERROR;
}
return M2MB_OK;
}