Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Atmel BLE SDK

Data Structures

struct  adv_element
 advertisement data element More...
 
struct  ble_custom_event_cb
 
struct  ble_custom_event_cb_t
 All BLE Custom event callback types. More...
 
struct  gatt_service_handler
 GATT service handles. More...
 

Macros

#define ADV_INTERVAL_SIZE   2
 
#define ALERT_LEVEL_CHAR_UUID   (0x2A06)
 
#define APPEARANCE_SIZE   2
 Length of Adv data types. More...
 
#define BAT_CHAR_BAT_LEVEL_UUID   (0x2A19)
 battery level characteristic uuid More...
 
#define BAT_CHAR_PRESENTATION_FORMAT_DESCRIPTOR   0x0000
 Characteristic presentation format descriptor. More...
 
#define BAT_CHAR_PRESENTATION_FORMAT_EXPONENT   0x00
 Characteristic presentation format exponent. More...
 
#define BAT_CHAR_PRESENTATION_FORMAT_NAMESPACE   0x01
 Characteristic presentation format namespace. More...
 
#define BAT_CHAR_PRESENTATION_FORMAT_UNIT   BAT_SERVICE_UUID
 Characteristic presentation format unit. More...
 
#define BAT_CHAR_PRESENTATION_FORMAT_VALUE   0x04
 characteristic presentation format value More...
 
#define BAT_SERVICE_UUID   (0x180F)
 battery service uuid More...
 
#define BLE_ADDITIONAL_CONNECTED_STATE_HANDLER   ble_dummy_handler
 
#define BLE_ADDITIONAL_DISCONNECTED_STATE_HANDLER   ble_dummy_handler
 
#define BLE_ADDITIONAL_ENCRYPTION_CHANGED_HANDLER   ble_dummy_handler
 
#define BLE_ADDITIONAL_PAIR_DONE_HANDLER   ble_dummy_handler
 
#define BLE_AUTHENTICATION_LEVEL   (AT_BLE_MODE1_L2_AUTH_PAIR_ENC)
 
#define BLE_BOND_REQ   (true)
 
#define BLE_CHARACTERISTIC_CHANGED   ble_dummy_handler
 
#define BLE_CHARACTERISTIC_FOUND_HANDLER   ble_dummy_handler
 
#define BLE_CHARACTERISTIC_READ_RESPONSE   ble_dummy_handler
 
#define BLE_CHARACTERISTIC_WRITE_RESPONSE   ble_dummy_handler
 
#define BLE_CONN_PARAM_UPDATE_DONE   ble_conn_param_update
 
#define BLE_CONNECTED_STATE_HANDLER(param)
 
#define BLE_DESCRIPTOR_FOUND_HANDLER   ble_dummy_handler
 
#define BLE_DEVICE_NAME   "MCHP-BLE"
 default device name More...
 
#define BLE_DISCONNECTED_STATE_HANDLER(param)
 
#define BLE_DISCOVERY_COMPLETE_HANDLER   ble_dummy_handler
 
#define BLE_ENCRYPTION_REQUEST   ble_encryption_request_handler
 
#define BLE_ENCRYPTION_STATUS_CHANGED(param)
 
#define BLE_EVENT_TIMEOUT   (0)
 event timeout More...
 
#define BLE_MITM_REQ   (true)
 
#define BLE_NOTIFICATION_RECEIVED_HANDLER   ble_dummy_handler
 
#define BLE_PAIR_DONE(param)
 
#define BLE_PAIR_ENABLE   (false)
 
#define BLE_PAIR_KEY_REQUEST   ble_pair_key_request_handler
 
#define BLE_PAIR_REQUEST   ble_pair_request_handler
 
#define BLE_PRIMARY_SERVICE_FOUND_HANDLER   ble_dummy_handler
 
#define BLE_PROFILE_INIT   ble_dummy_handler
 
#define BLE_SCAN_DATA_HANDLER(x, y)   BLE_UNUSED2_VAR(x, &y)
 
#define BLE_SCAN_INFO_HANDLER   ble_dummy_handler
 
#define BLE_SCAN_REPORT_HANDLER   ble_dummy_handler
 
#define BLE_SERVICE_CHANGED   ble_dummy_handler
 
#define BLE_SLAVE_SEC_REQUEST   ble_slave_security_handler
 
#define BODY_SENSOR_LOCATION_CHAR_UUID   (0x2A38)
 Body Sensor location characteristic uuid. More...
 
#define BREDR_NOT_SUPPORTED   ((uint8_t) 1 << 2)
 
#define CSC_ENDPOINT_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa6\x85\xe5\x11\x35\x39\xa1\xbb\x5a\xfd")
 CSC Endpoint Characteristic UUID. More...
 
#define CSC_SERVICE_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa6\x85\xe5\x11\x35\x39\xa0\xbb\x5a\xfd")
 CSC Service UUID. More...
 
#define CURRENT_TIME_CHAR_UUID   (0x2A2B)
 
#define CURRENT_TIME_SERVICE_UUID   (0x1805)
 
#define DIS_CHAR_FIRMWARE_REVISION_UUID   (0x2A26)
 
#define DIS_CHAR_HARDWARE_REVISION_UUID   (0x2A27)
 
#define DIS_CHAR_IEEE_REG_CERT_DATA_LIST_UUID   (0x2A2A)
 
#define DIS_CHAR_MANUFACTURER_NAME_UUID   (0x2A29)
 
#define DIS_CHAR_MODEL_NUMBER_UUID   (0x2A24)
 
#define DIS_CHAR_PNP_ID_UUID   (0x2A50)
 
#define DIS_CHAR_SERIAL_NUMBER_UUID   (0x2A25)
 
#define DIS_CHAR_SOFTWARE_REVISION_UUID   (0x2A28)
 
#define DIS_CHAR_SYSTEM_ID_UUID   (0x2A23)
 
#define DIS_SERVICE_UUID   (0x180A)
 
#define HEART_RATE_CONTROL_POINT_CHAR_UUID   (0x2A39)
 Heart Rate Control Point characteristic uuid. More...
 
#define HEART_RATE_MEASUREMENT_CHAR_UUID   (0x2A37)
 heart rate measurement characteristic uuid More...
 
#define HEART_RATE_SERVICE_UUID   (0x180D)
 
#define IMMEDIATE_ALERT_SERVICE_UUID   (0x1802)
 
#define LE_BREDR_CAPABLE_CONTROLLER   ((uint8_t) 1 << 3)
 
#define LE_BREDR_CAPABLE_HOST   ((uint8_t) 1 << 4)
 
#define LE_GENERAL_DISCOVERABLE_MODE   ((uint8_t) 1 << 1)
 
#define LE_LIMITED_DISCOVERABLE_MODE   ((uint8_t) 1 << 0)
 Observer related declarations. More...
 
#define LINK_LOSS_SERVICE_UUID   (0x1803)
 
#define MAX_DEVICE_CONNECTED   (1)
 maximum number of devices connected More...
 
#define SPS_CHAR_SCAN_INT_VALUE_UUID   (0x2A4F)
 scan interval characteristic uuid More...
 
#define SPS_CHAR_SCAN_REFRESH_UUID   (0x2A31)
 scan refresh characteristic uuid More...
 
#define SPS_SERVICE_UUID   (0x1813)
 Scan param service uuid. More...
 
#define TOTAL_CHARACTERISTIC_NUM   1
 
#define TX_POWER_LEVEL_CHAR_UUID   (0x2A07)
 
#define TX_POWER_LEVEL_SIZE   1
 
#define TX_POWER_SERVICE_UUID   (0x1804)
 
#define UUID_MCHP_PROPRIETARY_SERVICE_16   0x55,0xE4,0x05,0xD2,0xAF,0x9F,0xA9,0x8F,0xE5,0x4A,0x7D,0xFE,0x43,0x53,0x53,0x49
 
#define UUID_MCHP_TRANS_CTRL_16   0x7e,0x3b,0x07,0xff,0x1c,0x51,0x49,0x2f,0xb3,0x39,0x8a,0x4c,0x43,0x53,0x53,0x49
 
#define UUID_MCHP_TRANS_RX_16   0xB3,0x9B,0x72,0x34,0xBE,0xEC,0xD4,0xA8,0xF4,0x43,0x41,0x88,0x43,0x53,0x53,0x49
 
#define UUID_MCHP_TRANS_TX_16   0x16,0x96,0x24,0x47,0xC6,0x23,0x61,0xBA,0xD9,0x4B,0x4D,0x1E,0x43,0x53,0x53,0x49
 
#define WIFI_CON_APPARAM_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\x89\x86\xe4\x11\x29\xd2\x03\x00\x88\x77")
 
#define WIFI_CON_SERVICE_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\x89\x86\xe4\x11\x29\xd2\x01\x00\x88\x77")
 Service UUID's. More...
 
#define WIFI_CON_STATE_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\x89\x86\xe4\x11\x29\xd2\x02\x00\x88\x77")
 
#define WIFI_SCAN_APCOUNT_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x03\x00\x8c\xfb")
 
#define WIFI_SCAN_APDETAILS_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x00\x01\x8c\xfb")
 
#define WIFI_SCAN_MODE_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x02\x00\x8c\xfb")
 
#define WIFI_SCAN_SERVICE_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x01\x00\x8c\xfb")
 

Typedefs

typedef struct adv_element adv_element_t
 advertisement data element More...
 
typedef at_ble_status_t(* ble_characteristic_changed_callback_t )(at_ble_characteristic_changed_t *)
 
typedef struct ble_custom_event_cb ble_custom_event_cb_t
 
typedef enum ble_device_ll_state ble_device_ll_state_t
 
typedef at_ble_status_t(* ble_event_callback_t )(void *params)
 
typedef void(* ble_gap_event_callback_t )(at_ble_handle_t)
 
typedef struct gatt_service_handler gatt_service_handler_t
 GATT service handles. More...
 

Enumerations

enum  ble_device_ll_state {
  BLE_DEVICE_IDLE_STATE,
  PERIPHERAL_ADVERTISING_STATE,
  CENTRAL_SCANNING_STATE,
  PERIPHERAL_CONNECTED_STATE,
  PERIPHERAL_PAIRED_STATE,
  PERIPHERAL_ENCRYPTION_STATE,
  PERIPHERAL_DISCONNECTED_STATE
}
 
enum  gap_ad_type {
  FLAGS = 0x01,
  INCOMPLETE_LIST_16BIT_SERV_UUIDS,
  COMPLETE_LIST_16BIT_SERV_UUIDS,
  INCOMPLETE_LIST_32BIT_SERV_UUIDS,
  COMPLETE_LIST_32BIT_SERV_UUIDS,
  INCOMPLETE_LIST_128BIT_SERV_UUIDS,
  COMPLETE_LIST_128BIT_SERV_UUIDS,
  SHORTENED_LOCAL_NAME,
  COMPLETE_LOCAL_NAME,
  TX_POWER_LEVEL,
  CLASS_OF_DEVICE = 0x0D,
  SIMPLE_PAIRING_HASHING,
  SIMPLE_PAIRING_RANDOMIZER,
  DEVICE_ID,
  SECURITY_MANAGER_OOB_FLAGS,
  SLAVE_CONNECTION_INTERVAL_RANGE,
  LIST_16BIT_SERV_SOLICITATION_UUIDS = 0x14,
  LIST_128BIT_SERV_SOLICITATION_UUIDS,
  SERVICE_DATA,
  PUBLIC_TARGET_ADDRESS,
  RANDOM_TARGET_ADDRESS,
  APPEARANCE,
  ADVERTISING_INTERVAL,
  LE_BLUETOOTH_DEVICE_ADDRESS,
  LE_ROLE,
  SIMPLE_PAIRING_HASHING_C256,
  SIMPLE_PAIRING_RANDOMIZER_R256,
  SERVICE_DATA_32BIT = 0x20,
  SERVICE_DATA_128BIT,
  LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE,
  LE_SECURE_CONNECTIONS_RANDOM_VALUE,
  THREED_INFORMATION_DATA = 0x3D,
  MANUFACTURER_SPECIFIC_DATA = 0xFF
}
 Gap Advertisement Types. More...
 

Functions

void bat_init_service (gatt_service_handler_t *battery_serv, uint8_t *battery_value)
 Battery service and characteristic initialization(Called only once by user). More...
 
at_ble_status_t bat_primary_service_define (gatt_service_handler_t *battery_service)
 Register a battery service instance inside stack. More...
 
at_ble_status_t bat_update_char_value (gatt_service_handler_t *battery_serv, uint8_t char_data)
 Update the battery characteristic value after defining the services using bat_primary_service_define. More...
 
void ble_conn_param_update (at_ble_conn_param_update_done_t *conn_param_update)
 function used to update the connection parameter. More...
 
void ble_connected_state_handler (at_ble_connected_t *conn_params)
 function called when the AT_BLE_CONNECTED event is received from the stack. More...
 
void ble_device_init (at_ble_addr_t *addr)
 function sets both device address and device name which are exposed to all other devices. More...
 
void ble_disconnected_state_handler (at_ble_disconnected_t *disconnect)
 function called when the AT_BLE_DISCONNECTED event is received from the stack. More...
 
void ble_discovery_complete_handler (at_ble_discovery_complete_t *discover_status)
 function called when the AT_BLE_DISCOVERY_COMPLETE event is received from the stack. More...
 
static void ble_dummy_handler (void *param)
 
void ble_encryption_request_handler (at_ble_encryption_request_t *encry_req)
 function called when the AT_BLE_ENCRYPTION_REQUEST event is received from stack. More...
 
void ble_encryption_status_change_handler (at_ble_encryption_status_changed_t *encry_status)
 function called when the AT_BLE_ENCRYPTION_STATUS_CHANGED event is received from stack. More...
 
void ble_event_manager (at_ble_events_t events, void *event_params)
 function handling all the events from the stack, responsible for calling the respective functions initialized for the events. More...
 
at_ble_status_t ble_event_task (void)
 function to handle the BLE event task. More...
 
at_ble_status_t ble_pair_done_handler (at_ble_pair_done_t *pairing_params)
 function called when the AT_BLE_PAIR_DONE event is received from stack. More...
 
void ble_pair_key_request_handler (at_ble_pair_key_request_t *pair_key)
 function called when the AT_BLE_PAIR_KEY_REQUEST event is received from stack. More...
 
void ble_pair_request_handler (at_ble_pair_request_t *at_ble_pair_req)
 function called when the AT_BLE_PAIR_REQUEST event is received from stack. More...
 
at_ble_status_t ble_send_slave_sec_request (at_ble_handle_t conn_handle)
 function to send slave security request. More...
 
at_ble_status_t ble_set_device_name (uint8_t *name, uint8_t name_len)
 function to set the device name. More...
 
void ble_slave_security_handler (at_ble_slave_sec_request_t *slave_sec_req)
 slave security handler More...
 
static at_ble_status_t BLE_UNUSED2_VAR (void *param1_var, void *param2_var)
 
void register_ble_characteristic_changed_cb (ble_characteristic_changed_callback_t char_changed_cb_fn)
 Register callback function, to be triggered when characteristic value is changed. More...
 
void register_ble_connected_event_cb (ble_gap_event_callback_t connected_cb_fn)
 Register callback function, to be triggered when connected to the device. More...
 
void register_ble_disconnected_event_cb (ble_gap_event_callback_t disconnected_cb_fn)
 Register callback function, to be triggered when disconnected from the peer device. More...
 
void register_ble_paired_event_cb (ble_gap_event_callback_t paired_cb_fn)
 Register callback function, to be triggered when pairing procedure is completed. More...
 

#define ADV_INTERVAL_SIZE   2
#define ALERT_LEVEL_CHAR_UUID   (0x2A06)
#define APPEARANCE_SIZE   2

Length of Adv data types.

#define BAT_CHAR_BAT_LEVEL_UUID   (0x2A19)

battery level characteristic uuid

Referenced by bat_init_service().

#define BAT_CHAR_PRESENTATION_FORMAT_DESCRIPTOR   0x0000

Characteristic presentation format descriptor.

Referenced by bat_init_service().

#define BAT_CHAR_PRESENTATION_FORMAT_EXPONENT   0x00

Characteristic presentation format exponent.

Referenced by bat_init_service().

#define BAT_CHAR_PRESENTATION_FORMAT_NAMESPACE   0x01

Characteristic presentation format namespace.

Referenced by bat_init_service().

#define BAT_CHAR_PRESENTATION_FORMAT_UNIT   BAT_SERVICE_UUID

Characteristic presentation format unit.

Referenced by bat_init_service().

#define BAT_CHAR_PRESENTATION_FORMAT_VALUE   0x04

characteristic presentation format value

Referenced by bat_init_service().

#define BAT_SERVICE_UUID   (0x180F)

battery service uuid

Referenced by bat_init_service(), and ble_bat_start_advertise().

#define BLE_ADDITIONAL_CONNECTED_STATE_HANDLER   ble_dummy_handler
#define BLE_ADDITIONAL_DISCONNECTED_STATE_HANDLER   ble_dummy_handler
#define BLE_ADDITIONAL_ENCRYPTION_CHANGED_HANDLER   ble_dummy_handler
#define BLE_ADDITIONAL_PAIR_DONE_HANDLER   ble_dummy_handler
#define BLE_AUTHENTICATION_LEVEL   (AT_BLE_MODE1_L2_AUTH_PAIR_ENC)
#define BLE_BOND_REQ   (true)
#define BLE_CHARACTERISTIC_CHANGED   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_CHARACTERISTIC_FOUND_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_CHARACTERISTIC_READ_RESPONSE   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_CHARACTERISTIC_WRITE_RESPONSE   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_CONN_PARAM_UPDATE_DONE   ble_conn_param_update

Referenced by ble_event_manager().

#define BLE_CONNECTED_STATE_HANDLER (   param)
Value:
#define BLE_ADDITIONAL_CONNECTED_STATE_HANDLER
Definition: ble_manager.h:508
void ble_connected_state_handler(at_ble_connected_t *conn_params)
function to handle connected event received from stack
Definition: ble_manager.c:351

Referenced by ble_event_manager().

#define BLE_DESCRIPTOR_FOUND_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_DEVICE_NAME   "MCHP-BLE"

default device name

Referenced by ble_device_init().

#define BLE_DISCONNECTED_STATE_HANDLER (   param)
Value:
#define BLE_ADDITIONAL_DISCONNECTED_STATE_HANDLER
Definition: ble_manager.h:512
void ble_disconnected_state_handler(at_ble_disconnected_t *disconnect)
function handles disconnection event received from stack
Definition: ble_manager.c:405

Referenced by ble_event_manager().

#define BLE_DISCOVERY_COMPLETE_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_ENCRYPTION_REQUEST   ble_encryption_request_handler

Referenced by ble_event_manager().

#define BLE_ENCRYPTION_STATUS_CHANGED (   param)
Value:
void ble_encryption_status_change_handler(at_ble_encryption_status_changed_t *encry_status)
function handles encryption status change
Definition: ble_manager.c:657
#define BLE_ADDITIONAL_ENCRYPTION_CHANGED_HANDLER
Definition: ble_manager.h:563

Referenced by ble_event_manager().

#define BLE_EVENT_TIMEOUT   (0)

event timeout

Referenced by ble_event_task(), and m2m_ble_event_get().

#define BLE_MITM_REQ   (true)
#define BLE_NOTIFICATION_RECEIVED_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_PAIR_DONE (   param)
Value:
at_ble_status_t ble_pair_done_handler(at_ble_pair_done_t *pairing_params)
function handles pair done event
Definition: ble_manager.c:632
#define BLE_ADDITIONAL_PAIR_DONE_HANDLER
Definition: ble_manager.h:559

Referenced by ble_event_manager().

#define BLE_PAIR_ENABLE   (false)
#define BLE_PAIR_KEY_REQUEST   ble_pair_key_request_handler

Referenced by ble_event_manager().

#define BLE_PAIR_REQUEST   ble_pair_request_handler

Referenced by ble_event_manager().

#define BLE_PRIMARY_SERVICE_FOUND_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_PROFILE_INIT   ble_dummy_handler

Referenced by ble_device_init().

#define BLE_SCAN_DATA_HANDLER (   x,
 
)    BLE_UNUSED2_VAR(x, &y)
#define BLE_SCAN_INFO_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_SCAN_REPORT_HANDLER   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_SERVICE_CHANGED   ble_dummy_handler

Referenced by ble_event_manager().

#define BLE_SLAVE_SEC_REQUEST   ble_slave_security_handler

Referenced by ble_event_manager().

#define BODY_SENSOR_LOCATION_CHAR_UUID   (0x2A38)

Body Sensor location characteristic uuid.

#define BREDR_NOT_SUPPORTED   ((uint8_t) 1 << 2)
#define CSC_ENDPOINT_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa6\x85\xe5\x11\x35\x39\xa1\xbb\x5a\xfd")

CSC Endpoint Characteristic UUID.

#define CSC_SERVICE_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa6\x85\xe5\x11\x35\x39\xa0\xbb\x5a\xfd")

CSC Service UUID.

#define CURRENT_TIME_CHAR_UUID   (0x2A2B)
#define CURRENT_TIME_SERVICE_UUID   (0x1805)
#define DIS_CHAR_FIRMWARE_REVISION_UUID   (0x2A26)
#define DIS_CHAR_HARDWARE_REVISION_UUID   (0x2A27)
#define DIS_CHAR_IEEE_REG_CERT_DATA_LIST_UUID   (0x2A2A)
#define DIS_CHAR_MANUFACTURER_NAME_UUID   (0x2A29)
#define DIS_CHAR_MODEL_NUMBER_UUID   (0x2A24)
#define DIS_CHAR_PNP_ID_UUID   (0x2A50)
#define DIS_CHAR_SERIAL_NUMBER_UUID   (0x2A25)
#define DIS_CHAR_SOFTWARE_REVISION_UUID   (0x2A28)
#define DIS_CHAR_SYSTEM_ID_UUID   (0x2A23)
#define DIS_SERVICE_UUID   (0x180A)
#define HEART_RATE_CONTROL_POINT_CHAR_UUID   (0x2A39)

Heart Rate Control Point characteristic uuid.

#define HEART_RATE_MEASUREMENT_CHAR_UUID   (0x2A37)

heart rate measurement characteristic uuid

#define HEART_RATE_SERVICE_UUID   (0x180D)
#define IMMEDIATE_ALERT_SERVICE_UUID   (0x1802)
#define LE_BREDR_CAPABLE_CONTROLLER   ((uint8_t) 1 << 3)
#define LE_BREDR_CAPABLE_HOST   ((uint8_t) 1 << 4)
#define LE_GENERAL_DISCOVERABLE_MODE   ((uint8_t) 1 << 1)
#define LE_LIMITED_DISCOVERABLE_MODE   ((uint8_t) 1 << 0)

Observer related declarations.

#define LINK_LOSS_SERVICE_UUID   (0x1803)
#define MAX_DEVICE_CONNECTED   (1)

maximum number of devices connected

#define SPS_CHAR_SCAN_INT_VALUE_UUID   (0x2A4F)

scan interval characteristic uuid

#define SPS_CHAR_SCAN_REFRESH_UUID   (0x2A31)

scan refresh characteristic uuid

#define SPS_SERVICE_UUID   (0x1813)

Scan param service uuid.

#define TOTAL_CHARACTERISTIC_NUM   1
#define TX_POWER_LEVEL_CHAR_UUID   (0x2A07)
#define TX_POWER_LEVEL_SIZE   1
#define TX_POWER_SERVICE_UUID   (0x1804)
#define UUID_MCHP_PROPRIETARY_SERVICE_16   0x55,0xE4,0x05,0xD2,0xAF,0x9F,0xA9,0x8F,0xE5,0x4A,0x7D,0xFE,0x43,0x53,0x53,0x49
#define UUID_MCHP_TRANS_CTRL_16   0x7e,0x3b,0x07,0xff,0x1c,0x51,0x49,0x2f,0xb3,0x39,0x8a,0x4c,0x43,0x53,0x53,0x49
#define UUID_MCHP_TRANS_RX_16   0xB3,0x9B,0x72,0x34,0xBE,0xEC,0xD4,0xA8,0xF4,0x43,0x41,0x88,0x43,0x53,0x53,0x49
#define UUID_MCHP_TRANS_TX_16   0x16,0x96,0x24,0x47,0xC6,0x23,0x61,0xBA,0xD9,0x4B,0x4D,0x1E,0x43,0x53,0x53,0x49
#define WIFI_CON_APPARAM_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\x89\x86\xe4\x11\x29\xd2\x03\x00\x88\x77")
#define WIFI_CON_SERVICE_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\x89\x86\xe4\x11\x29\xd2\x01\x00\x88\x77")

Service UUID's.

#define WIFI_CON_STATE_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\x89\x86\xe4\x11\x29\xd2\x02\x00\x88\x77")
#define WIFI_SCAN_APCOUNT_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x03\x00\x8c\xfb")
#define WIFI_SCAN_APDETAILS_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x00\x01\x8c\xfb")
#define WIFI_SCAN_MODE_CHAR_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x02\x00\x8c\xfb")
#define WIFI_SCAN_SERVICE_UUID   ("\x1b\xc5\xd5\xa5\x02\x00\xa1\x85\xe4\x11\x24\xd2\x01\x00\x8c\xfb")

typedef struct adv_element adv_element_t

advertisement data element

typedef at_ble_status_t(* ble_characteristic_changed_callback_t)(at_ble_characteristic_changed_t *)
typedef at_ble_status_t(* ble_event_callback_t)(void *params)
typedef void(* ble_gap_event_callback_t)(at_ble_handle_t)

GATT service handles.

Enumerator
BLE_DEVICE_IDLE_STATE 

Device is in idle state.

PERIPHERAL_ADVERTISING_STATE 

Peripheral state in advertisement.

CENTRAL_SCANNING_STATE 

Central in scanning state.

PERIPHERAL_CONNECTED_STATE 

Device stopped advertisement/scanning and Connection established.

PERIPHERAL_PAIRED_STATE 

Device paired with peer device.

PERIPHERAL_ENCRYPTION_STATE 

Device GAP state in Encryption state.

PERIPHERAL_DISCONNECTED_STATE 

Device disconnected from peer device.

Gap Advertisement Types.

Enumerator
FLAGS 

flags

INCOMPLETE_LIST_16BIT_SERV_UUIDS 

incomplete list of 16bits service uuids

COMPLETE_LIST_16BIT_SERV_UUIDS 

complete list of 16bits service uuids

INCOMPLETE_LIST_32BIT_SERV_UUIDS 

incomplete list of 32bits service uuids

COMPLETE_LIST_32BIT_SERV_UUIDS 

complete list of 32bits service uuids

INCOMPLETE_LIST_128BIT_SERV_UUIDS 

incomplete list of 128bits service uuids

COMPLETE_LIST_128BIT_SERV_UUIDS 

complete list of 128bits of service uuids

SHORTENED_LOCAL_NAME 

shortened local name of the device

COMPLETE_LOCAL_NAME 

complete local name of the device

TX_POWER_LEVEL 

TX power level.

CLASS_OF_DEVICE 

class of the device

SIMPLE_PAIRING_HASHING 

simple pairing hashing

SIMPLE_PAIRING_RANDOMIZER 

simple pairing randomizer

DEVICE_ID 

device id

SECURITY_MANAGER_OOB_FLAGS 

security manager out of band flags

SLAVE_CONNECTION_INTERVAL_RANGE 

slave connection interval range

LIST_16BIT_SERV_SOLICITATION_UUIDS 

list of 16bits service solicitation uuid

LIST_128BIT_SERV_SOLICITATION_UUIDS 

list of 128bits service solicitation uuids

SERVICE_DATA 

service data

PUBLIC_TARGET_ADDRESS 

public target address

RANDOM_TARGET_ADDRESS 

random target address

APPEARANCE 

appearance

ADVERTISING_INTERVAL 

advertising interval

LE_BLUETOOTH_DEVICE_ADDRESS 

le bluetooth device address

LE_ROLE 

le role

SIMPLE_PAIRING_HASHING_C256 

simple pairing hashing c256

SIMPLE_PAIRING_RANDOMIZER_R256 

simple pairing randomizer r256

SERVICE_DATA_32BIT 

service data 32bits

SERVICE_DATA_128BIT 

service data 128bits

LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE 

le secure connection confirmation value

LE_SECURE_CONNECTIONS_RANDOM_VALUE 

le secure connection random value

THREED_INFORMATION_DATA 

threed information data

MANUFACTURER_SPECIFIC_DATA 

manufacturer specific data

void bat_init_service ( gatt_service_handler_t battery_serv,
uint8_t *  battery_value 
)

Battery service and characteristic initialization(Called only once by user).

Parameters
[in]battery_servbattery service instance
[in]battery_valuenot implemented
Returns
none

Battery service and characteristic initialization(Called only once by user).

Parameters
[in]battery_servgatt service information
[in]battery_valuenot implemented
Returns
none

References AT_BLE_ATTR_NO_PERMISSIONS, AT_BLE_ATTR_READABLE_NO_AUTHN_NO_AUTHR, AT_BLE_ATTR_WRITABLE_NO_AUTHN_NO_AUTHR, AT_BLE_CHAR_NOTIFY, AT_BLE_CHAR_READ, AT_BLE_UUID_16, BAT_CHAR_BAT_LEVEL_UUID, BAT_CHAR_PRESENTATION_FORMAT_DESCRIPTOR, BAT_CHAR_PRESENTATION_FORMAT_EXPONENT, BAT_CHAR_PRESENTATION_FORMAT_NAMESPACE, BAT_CHAR_PRESENTATION_FORMAT_UNIT, BAT_CHAR_PRESENTATION_FORMAT_VALUE, BAT_SERVICE_UUID, battery_init_value, at_ble_characteristic_t::char_val_handle, at_ble_characteristic_t::client_config_handle, at_ble_characteristic_t::client_config_permissions, at_ble_char_presentation_t::description, at_ble_char_presentation_t::exponent, at_ble_char_presentation_t::format, at_ble_characteristic_t::init_value, at_ble_char_presentation_t::name_space, NULL, presentation_format, at_ble_characteristic_t::presentation_format, at_ble_characteristic_t::properties, gatt_service_handler::serv_chars, gatt_service_handler::serv_handle, gatt_service_handler::serv_uuid, at_ble_characteristic_t::server_config_handle, at_ble_characteristic_t::server_config_permissions, at_ble_uuid_t::type, at_ble_char_presentation_t::unit, at_ble_characteristic_t::user_desc, at_ble_characteristic_t::user_desc_handle, at_ble_characteristic_t::user_desc_len, at_ble_characteristic_t::user_desc_max_len, at_ble_characteristic_t::user_desc_permissions, at_ble_uuid_t::uuid, at_ble_characteristic_t::uuid, at_ble_characteristic_t::value_init_len, at_ble_characteristic_t::value_max_len, and at_ble_characteristic_t::value_permissions.

Referenced by ble_bat_profile_init().

at_ble_status_t bat_primary_service_define ( gatt_service_handler_t battery_service)

Register a battery service instance inside stack.

Parameters
[in]battery_servicebattery service instance
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

Register a battery service instance inside stack.

Parameters
[in]battery_servicegatt service information
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

References at_ble_primary_service_define(), NULL, gatt_service_handler::serv_chars, gatt_service_handler::serv_handle, and gatt_service_handler::serv_uuid.

Referenced by ble_bat_profile_init().

at_ble_status_t bat_update_char_value ( gatt_service_handler_t battery_serv,
uint8_t  char_data 
)

Update the battery characteristic value after defining the services using bat_primary_service_define.

Parameters
[in]battery_servbattery service instance
[in]char_dataNew battery level
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

Update the battery characteristic value after defining the services using bat_primary_service_define.

Parameters
[in]battery_servgatt service information
[in]char_datanew characteristic value information
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

References at_ble_characteristic_value_set(), AT_BLE_FAILURE, at_ble_notification_send(), AT_BLE_SUCCESS, at_ble_characteristic_t::char_val_handle, DBG_LOG, DBG_LOG_DEV, and gatt_service_handler::serv_chars.

Referenced by ble_bat_process().

void ble_conn_param_update ( at_ble_conn_param_update_done_t conn_param_update)

function used to update the connection parameter.

Parameters
[in]conn_param_updateat_ble_conn_param_update_done_t parameters to be updated.
Returns
none.

function used to update the connection parameter.

References at_ble_conn_param_update_done_t::con_intv, at_ble_conn_param_update_done_t::con_latency, DBG_LOG, and at_ble_conn_param_update_done_t::superv_to.

void ble_connected_state_handler ( at_ble_connected_t conn_params)

function called when the AT_BLE_CONNECTED event is received from the stack.

Parameters
[in]conn_paramsconnection parameters at_ble_connected_t.
Returns
none.

function called when the AT_BLE_CONNECTED event is received from the stack.

References at_ble_addr_t::addr, AT_BLE_SUCCESS, ble_connected_cb, ble_send_slave_sec_request(), at_ble_connected_t::conn_status, DBG_LOG, at_ble_connected_t::handle, NULL, and at_ble_connected_t::peer_addr.

void ble_device_init ( at_ble_addr_t addr)

function sets both device address and device name which are exposed to all other devices.

Parameters
[in]addraddress to be set as a device address.
Returns
none.

function sets both device address and device name which are exposed to all other devices.

References AT_BLE_SUCCESS, BLE_DEVICE_NAME, ble_init(), BLE_PROFILE_INIT, ble_set_device_name(), DBG_LOG, and NULL.

Referenced by ble_bat_init().

void ble_disconnected_state_handler ( at_ble_disconnected_t disconnect)

function called when the AT_BLE_DISCONNECTED event is received from the stack.

Parameters
[in]disconnectat_ble_disconnected_t information about the disconnection.
Returns
none.

function called when the AT_BLE_DISCONNECTED event is received from the stack.

References ble_disconnected_cb, DBG_LOG, at_ble_disconnected_t::handle, NULL, and at_ble_disconnected_t::reason.

void ble_discovery_complete_handler ( at_ble_discovery_complete_t discover_status)

function called when the AT_BLE_DISCOVERY_COMPLETE event is received from the stack.

Parameters
[in]discover_statusstatus of the discovery.
Returns
none.
static void ble_dummy_handler ( void *  param)
inlinestatic

References DBG_LOG_DEV, and UNUSED.

void ble_encryption_request_handler ( at_ble_encryption_request_t encry_req)

function called when the AT_BLE_ENCRYPTION_REQUEST event is received from stack.

Parameters
[in]encry_reqencryption request from the peer device.
Returns
none.

function called when the AT_BLE_ENCRYPTION_REQUEST event is received from stack.

References at_ble_encryption_request_reply(), auth_info, at_ble_LTK_t::ediv, at_ble_encryption_request_t::ediv, at_ble_connected_t::handle, at_ble_LTK_t::nb, and at_ble_encryption_request_t::nb.

void ble_encryption_status_change_handler ( at_ble_encryption_status_changed_t encry_status)

function called when the AT_BLE_ENCRYPTION_STATUS_CHANGED event is received from stack.

Parameters
[in]encry_statuschanged encryption status.
Returns
none.

function called when the AT_BLE_ENCRYPTION_STATUS_CHANGED event is received from stack.

References AT_BLE_SUCCESS, ble_paired_cb, DBG_LOG, at_ble_connected_t::handle, at_ble_encryption_status_changed_t::handle, NULL, and at_ble_encryption_status_changed_t::status.

void ble_event_manager ( at_ble_events_t  events,
void *  event_params 
)

function handling all the events from the stack, responsible for calling the respective functions initialized for the events.

Parameters
[in]eventsevents received from the stack at_ble_events_t.
[in]event_paramsdata received from stack for the respective event received.
Returns
none.

Undefined event received

Scan info needs to be delivered either adv data or scan response data.
Refer to at_ble_scan_info_t

Scan report received at the end of scan period if AT_BLE_SCAN_GEN_DISCOVERY or AT_BLE_SCAN_LIM_DISCOVERY are used.
Refer to at_ble_scan_report_t

Used random address.
Refer to at_ble_rand_addr_changed_t

connected to a peer device.
Refer to at_ble_connected_t

peer device connection terminated.
Refer to at_ble_disconnected_t

connection parameters updated. It is required to call at_ble_conn_update_reply function to send response back if needed.
Refer to at_ble_conn_param_update_done_t

peer device asks for connection parameters update.
Refer to at_ble_conn_param_update_request_t

reported RX power value.
Refer to at_ble_rx_power_value_t

Pairing procedure is completed.
Refer to at_ble_pair_done_t

A central device asks for Pairing.
Refer to at_ble_pair_request_t

Slave security request.
Refer to at_ble_slave_sec_request_t

A passkey or OOB data is requested as part of pairing procedure.
Refer to at_ble_pair_key_request_t

Encryption is requested by a master device.
Refer to at_ble_encryption_request_t

Encryption status changed.
Refer to at_ble_encryption_status_changed_t

Resolve random address status.
Refer to at_ble_resolv_rand_addr_status_t

A primary service is found.
Refer to at_ble_primary_service_found_t

An included service is found .
Refer to at_ble_included_service_found_t

A Characteristic is found.
Refer to at_ble_characteristic_found_t

A descriptor is found.
Refer to at_ble_descriptor_found_t

A discover operation has completed.
Refer to at_ble_discovery_complete_t

Characteristic read procedure is done.
Refer to at_ble_characteristic_read_response_t

Characteristic multiple read procedure is done.
Refer to at_ble_characteristic_read_response_t

Characteristic write procedure is done.
Refer to at_ble_characteristic_write_response_t

A Notification is received.
Refer to at_ble_notification_received_t

An Indication is received.
Refer to at_ble_indication_received_t

The peer confirmed that it has received an Indication.
Refer to at_ble_indication_confirmed_t

The peer has changed a characteristic value.
Refer to at_ble_characteristic_changed_t

The peer has confirmed that it has received the service changed notification.
Refer to at_ble_service_changed_notification_confirmed_t

The peer asks for a write Authorization.
Refer to at_ble_write_authorize_request_t

The peer asks for a read Authorization.
Refer to at_ble_read_authorize_request_t

An L2CAP packet received from a registered custom CID.
Refer to at_ble_l2cap_rx_t

A user-defined event is delivered to the system

References AT_BLE_CHARACTERISTIC_CHANGED, AT_BLE_CHARACTERISTIC_FOUND, AT_BLE_CHARACTERISTIC_READ_MULTIBLE_RESPONSE, AT_BLE_CHARACTERISTIC_READ_RESPONSE, AT_BLE_CHARACTERISTIC_WRITE_RESPONSE, AT_BLE_CONN_PARAM_UPDATE_DONE, AT_BLE_CONN_PARAM_UPDATE_REQUEST, AT_BLE_CONNECTED, AT_BLE_CUSTOM_EVENT, AT_BLE_DESCRIPTOR_FOUND, AT_BLE_DISCONNECTED, AT_BLE_DISCOVERY_COMPLETE, AT_BLE_ENCRYPTION_REQUEST, AT_BLE_ENCRYPTION_STATUS_CHANGED, AT_BLE_INCLUDED_SERVICE_FOUND, AT_BLE_INDICATION_CONFIRMED, AT_BLE_INDICATION_RECEIVED, AT_BLE_L2CAP_RX, AT_BLE_NOTIFICATION_RECEIVED, AT_BLE_PAIR_DONE, AT_BLE_PAIR_KEY_REQUEST, AT_BLE_PAIR_REQUEST, AT_BLE_PRIMARY_SERVICE_FOUND, AT_BLE_RAND_ADDR_CHANGED, AT_BLE_READ_AUTHORIZE_REQUEST, AT_BLE_RESOLV_RAND_ADDR_STATUS, AT_BLE_RX_POWER_VALUE, AT_BLE_SCAN_INFO, AT_BLE_SCAN_REPORT, AT_BLE_SERVICE_CHANGED_NOTIFICATION_CONFIRMED, AT_BLE_SLAVE_SEC_REQUEST, AT_BLE_UNDEFINED_EVENT, AT_BLE_WRITE_AUTHORIZE_REQUEST, ble_char_changed_cb, BLE_CHARACTERISTIC_CHANGED, BLE_CHARACTERISTIC_FOUND_HANDLER, BLE_CHARACTERISTIC_READ_RESPONSE, BLE_CHARACTERISTIC_WRITE_RESPONSE, BLE_CONN_PARAM_UPDATE_DONE, BLE_CONNECTED_STATE_HANDLER, BLE_DESCRIPTOR_FOUND_HANDLER, BLE_DISCONNECTED_STATE_HANDLER, BLE_DISCOVERY_COMPLETE_HANDLER, BLE_ENCRYPTION_REQUEST, BLE_ENCRYPTION_STATUS_CHANGED, BLE_NOTIFICATION_RECEIVED_HANDLER, BLE_PAIR_DONE, BLE_PAIR_KEY_REQUEST, BLE_PAIR_REQUEST, BLE_PRIMARY_SERVICE_FOUND_HANDLER, BLE_SCAN_INFO_HANDLER, BLE_SCAN_REPORT_HANDLER, BLE_SERVICE_CHANGED, BLE_SLAVE_SEC_REQUEST, DBG_LOG_DEV, and NULL.

Referenced by ble_bat_process_event(), and ble_event_task().

at_ble_status_t ble_event_task ( void  )

function to handle the BLE event task.

Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

function to handle the BLE event task.

function to get event from stack

References at_ble_event_get(), AT_BLE_FAILURE, AT_BLE_SUCCESS, ble_event_manager(), BLE_EVENT_TIMEOUT, and params.

at_ble_status_t ble_pair_done_handler ( at_ble_pair_done_t pairing_params)

function called when the AT_BLE_PAIR_DONE event is received from stack.

Parameters
[in]pairing_paramsat_ble_pair_done_t pair done information.
Returns
AT_BLE_SUCCESS operation completed successfully.
AT_BLE_FAILURE Generic error.

function called when the AT_BLE_PAIR_DONE event is received from stack.

References app_device_bond, at_ble_disconnect(), AT_BLE_SUCCESS, AT_BLE_TERMINATED_BY_USER, at_ble_pair_done_t::auth, auth_info, ble_paired_cb, DBG_LOG, at_ble_connected_t::handle, at_ble_pair_done_t::handle, NULL, and at_ble_pair_done_t::status.

void ble_pair_key_request_handler ( at_ble_pair_key_request_t pair_key)

function called when the AT_BLE_PAIR_KEY_REQUEST event is received from stack.

Parameters
[in]pair_keyat_ble_pair_key_request_t key details for the pairing request.
Returns
none.

function called when the AT_BLE_PAIR_KEY_REQUEST event is received from stack.

References at_ble_disconnect(), AT_BLE_FAILURE, at_ble_pair_key_reply(), AT_BLE_PAIR_PASSKEY, AT_BLE_PAIR_PASSKEY_DISPLAY, AT_BLE_PAIR_PASSKEY_ENTRY, AT_BLE_PASSKEY_LEN, AT_BLE_SUCCESS, AT_BLE_TERMINATED_BY_USER, DBG_LOG, DBG_LOG_CONT, DBG_LOG_DEV, at_ble_pair_key_request_t::handle, at_ble_pair_key_request_t::passkey_type, and at_ble_pair_key_request_t::type.

at_ble_status_t ble_send_slave_sec_request ( at_ble_handle_t  conn_handle)

function to send slave security request.

Parameters
[in]conn_handleconnection handle.
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

function to send slave security request.

References AT_BLE_FAILURE, at_ble_send_slave_sec_request(), AT_BLE_SUCCESS, DBG_LOG, and DBG_LOG_DEV.

Referenced by ble_connected_state_handler().

at_ble_status_t ble_set_device_name ( uint8_t *  name,
uint8_t  name_len 
)

function to set the device name.

Parameters
[in]namename of the device.
[in]name_lenlength of the device name.
Returns
AT_BLE_SUCCESS operation completed successfully.
AT_BLE_FAILURE Generic error.

function to set the device name.

References at_ble_device_name_set(), AT_BLE_INVALID_PARAM, and NULL.

Referenced by ble_device_init().

static at_ble_status_t BLE_UNUSED2_VAR ( void *  param1_var,
void *  param2_var 
)
inlinestatic

References AT_BLE_SUCCESS, DBG_LOG_DEV, and UNUSED.

void register_ble_characteristic_changed_cb ( ble_characteristic_changed_callback_t  char_changed_cb_fn)

Register callback function, to be triggered when characteristic value is changed.

Parameters
[in]char_changed_cb_fnfunction called when characteristic value is changed.
Returns
none.

Register callback function, to be triggered when characteristic value is changed.

References ble_char_changed_cb.

void register_ble_connected_event_cb ( ble_gap_event_callback_t  connected_cb_fn)

Register callback function, to be triggered when connected to the device.

Parameters
[in]connected_cb_fnfunction called when disconnected from the device.
Returns
none.

Register callback function, to be triggered when connected to the device.

References ble_connected_cb.

void register_ble_disconnected_event_cb ( ble_gap_event_callback_t  disconnected_cb_fn)

Register callback function, to be triggered when disconnected from the peer device.

Parameters
[in]disconnected_cb_fnfunction called when disconnected from the peer device.
Returns
none.

Register callback function, to be triggered when disconnected from the peer device.

References ble_disconnected_cb.

Referenced by ble_bat_profile_init().

void register_ble_paired_event_cb ( ble_gap_event_callback_t  paired_cb_fn)

Register callback function, to be triggered when pairing procedure is completed.

Parameters
[in]paired_cb_fnfunction called when pairing is completed.
Returns
none.

Register callback function, to be triggered when pairing procedure is completed.

References ble_paired_cb.

Referenced by ble_bat_profile_init().