# Bluetooth Low Energy Stack Abstraction

Bluetooth Low Energy Stack Abstraction Reference.

# Summary

Typedefs

- MsgHandlerCallback_t : BLE abstraction message handler function type.

Variables

- ble_dev_params : Structure to save BLE device parameters provided by the application.

Data Structures

- GAPM_ActivityStatus_t : GAPM activity status.
- GAP_Env_t : GAP environment.
- att_db_desc : Custom service attribute database description.
- cust_svc_desc : Custom service descriptor.
- GATT_Env_t : GATT environment.
- low_power_clock : Application defined low power clocks and sources.
- ble_device_parameter : Application defined BLE device parameters used by BLE stack.
- BASC_Env_t : Battery service client environment.
- BASS_Env_t : Battery service server environment.
- DISS_DeviceInfoField_t : Global DISS specific info structure.
- DISS_DeviceInfo_t : Global DISS info compilation structure.
- DISS_Env_t : DISS state structure.

Enumerations

- gapm_activity_state : GAPM activity state.
- gapm_state : GAPM state.
- cfm_msg_instr_enum : Instructions to send or withhold confirmation message.
- basc_app_msg_id : BASC application task messages.
- bass_app_msg_id : BASS application task messages.

Macros

- GAPM_CFG_ADDR_PUBLIC : GAPM privacy configuration identity address public.
- GAPM_CFG_ADDR_PRIVATE : GAPM privacy configuration identity address private.
- GAPM_CFG_HOST_PRIVACY : GAPM privacy configuration set to host privacy.
- GAPM_CFG_CONTROLLER_PRIVACY : GAPM privacy configuration set to controller privacy.
- GAPM_DEFAULT_ROLE : GAPM default device configuration (used in GAPM_SET_DEV_CONFIG_CMD)
- GAPM_DEFAULT_RENEW_DUR : Default duration for regenerating device address when privacy is enabled (in seconds)
- GAPM_DEFAULT_GAP_START_HDL : Default start handle for GAP service (dynamically allocated)
- GAPM_DEFAULT_GATT_START_HDL : Default start handle for GATT service (dynamically allocated)
- GAPM_DEFAULT_ATT_CFG : Default attribute database configuration.
- GAPM_DEFAULT_TX_OCT_MAX : Default value for the controller's maximum transmitted number of payload octets to be used.
- GAPM_DEFAULT_TX_TIME_MAX : Suggested value for the controller's maximum packet transmission time to be used.
- GAPM_DEFAULT_MTU_MAX : Default maximum MTU acceptable for device (L2CAP)
- GAPM_DEFAULT_MPS_MAX : Default maximum MPS (L2CAP)
- GAPM_DEFAULT_MAX_NB_LECB : Default maximum number of LE Credit based connection that can be established (L2CAP)
- GAPM_DEFAULT_AUDIO_CFG : Default LE Audio Mode Configuration.
- GAP_ROLE_MASTER : GAP master.
- GAP_ROLE_SLAVE : GAP slave.
- GAPM_DEFAULT_ADV_DATA : Default advertisement data (length, data)
- GAPM_DEFAULT_ADV_DATA_LEN : Default length of advertisement data.
- GAPM_DEFAULT_SCANRSP_DATA : Default scan response data.
- GAPM_DEFAULT_SCANRSP_DATA_LEN : Default length of scan response data.
- GAPM_DEFAULT_SCAN_INTERVAL : GAPM default StartConnectionCmd configuration (GAPM_START_CONNECTION_CMD)
- GAPM_DEFAULT_SCAN_WINDOW : Scan window to 50% of the interval.
- GAPM_DEFAULT_CON_INTV_MIN : Default connection interval and slave latency.
- GAPM_DEFAULT_CON_INTV_MAX : 25 ms (units of 1.25ms)
- GAPM_DEFAULT_CON_LATENCY : Slave latency: number of events that can be missed while maintaining a connection.
- GAPM_DEFAULT_SUPERV_TO : Default supervisory timeout.
- GAPM_DEFAULT_CE_LEN_MIN : Recommended minimum duration of connection events 40 ms.
- GAPM_DEFAULT_CE_LEN_MAX : Recommended maximum duration of connection events 40 ms.
- GAPM_DEFAULT_ADV_INTV_MIN : Advertising minimum and maximum interval.
- GAPM_DEFAULT_ADV_INTV_MAX : 40ms (64*0.625ms)
- GAPM_DEFAULT_ADV_CHMAP : Advertising channel map - 37, 38, 39.
- GATTC_DEFAULT_START_HDL : Default GATTC handles.
- GATTC_DEFAULT_END_HDL : GATTC default end handle.
- CS_SERVICE_UUID_16 : Macros to declare a (custom) service with 16, 32 and 128 bit UUID srvidx Service index uuid Service UUID.
- CS_SERVICE_UUID_32 : Custom service with 32 bit UUID.
- CS_SERVICE_UUID_128 : Custom service with 128 bit UUID.
- CS_ATT_SERVICE_128 : Standard declaration/description UUIDs in 16-byte format.
- CS_ATT_CHARACTERISTIC_128 : Custom service characteristic.
- CS_ATT_CLIENT_CHAR_CFG_128 : Custom service attribute for client characteristic configuration.
- CS_ATT_CHAR_USER_DESC_128 : Custom service attribute characteristic user description.
- CS_CHAR_UUID_16 : Macros to define characteristics with 16, 32 and 128 bit UUID attidx_char: Characteristic attribute index attidx_val: Value attribute index uuid UUID perm Permissions (see gattm_att_desc) length Maximum length value (in bytes) data Pointer to the data structure in the application callback Function to transfer the data between the application and the GATTM.
- CS_CHAR_UUID_32 : Custom service characteristic with 32 bit UUID.
- CS_CHAR_UUID_128 : Custom service characteristic with 128 bit UUID.
- CS_CHAR_CCC : Macro to add to the characteristic a CCC attidx CCC attribute index data Pointer to the 2-byte CCC data value in the application callback Function to transfer the CCC data between the application and the GATTM.
- CS_CHAR_USER_DESC : Macro to add to the characteristic a user description attidx Description attribute index length Description length (in bytes) data Pointer to the description string (constant) callback Function to transfer the description string to the GATTM.
- MIN : Macro to Find Minimum.
- HCI_VS_RF_CW_ENABLE_CMD_CODE : Vendor specific to enable CW (RX or TX)
- HCI_VS_RF_CW_DISABLE_CMD_CODE : Vendor specific to enable CW (RX or TX)
- HCI_VS_RF_OUTPUT_PWR_CMD_CODE : Vendor specific to set desired output power.

Functions

- GAP_Initialize : Initialize GAP environment.
- GAP_GetEnv : Get GAP environment.
- GAP_GetProfileAddedTaskId : Get GAP environment added profiles task identifiers.
- GAP_IsAddrPrivateResolvable : Check address if its private resolvable.
- GAP_AddAdvData : Add GAP advertise data.
- GAPM_ResetCmd : Perform GAPM reset with specified GAPM operation.
- GAPM_SoftwareReset : Perform GAPM software reset.
- GAPM_PlatformReset : Perform GAPM platform reset.
- GAPM_SetDevConfigCmd : Prepare and send set the device configuration.
- GAPM_GetDeviceConfig : get Device configuration
- GAPM_ProfileTaskAddCmd : Prepare and Send GAPM_PROFILE_TASK_ADD_CMD to the Bluetooth stack.
- GAPM_GetProfileAddedCount : Get number of profiles added by the Bluetooth stack.
- GAPM_LepsmRegisterCmd : Prepare and send GAPM_LEPSM_REGISTER_CMD to the Bluetooth stack.
- GAPM_GenRandAddrCmd : Prepare and send GAPM_GEN_RAND_ADDR_CMD to the Bluetooth stack.
- GAPM_ResolvAddrCmd : Prepare and send GAPM_RESOLV_ADDR_CMD to the Bluetooth stack.
- GAPM_ActivityCreateAdvCmd : Prepare and send GAPM_ACTIVITY_CREATE_CMD to create an advertising activity.
- GAPM_ActivityCreateScanCmd : Prepare and send GAPM_ACTIVITY_CREATE_CMD to create scan activity.
- GAPM_ActivityCreateInitCmd : Prepare and send GAPM_ACTIVITY_CREATE_CMD to create an initiating activity.
- GAPM_ActivityCreatePeriodSyncCmd : Prepare and send GAPM_ACTIVITY_CREATE_CMD to create a periodic sync activity.
- GAPM_AdvActivityStart : Prepare and send GAPM_ACTIVITY_START_CMD to start an advertising activity.
- GAPM_InitActivityStart : Prepare and send GAPM_ACTIVITY_START_CMD to start an initiating activity.
- GAPM_ScanActivityStart : Prepare and send GAPM_ACTIVITY_START_CMD to start a scanning activity.
- GAPM_PerSyncActivityStart : Prepare and send GAPM_ACTIVITY_START_CMD to start a periodic sync activity.
- GAPM_ActivityStartCmd : Prepare and send GAPM_ACTIVITY_START_CMD to start an activity.
- GAPM_ActivityStop : Prepare and send GAPM_ACTIVITY_STOP_CMD to stop a specified activity.
- GAPM_ActivityStopAll : Prepare and send GAPM_ACTIVITY_STOP_CMD to stop all existing activities.
- GAPM_DeleteActivity : Prepare and send GAPM_ACTIVITY_DELETE_CMD to delete a specified activity.
- GAPM_DeleteAllActivities : Prepare and send GAPM_ACTIVITY_DELETE_CMD to delete all the activities.
- GAPM_ActivityStopCmd : Prepare and send GAPM_ACTIVITY_STOP_CMD to stop a specified activity.
- GAPM_DeleteActivityCmd : Prepare and send GAPM_ACTIVITY_DELETE_CMD to delete activity/activities.
- GAPM_SetAdvDataCmd : Prepare and send GAPM_SET_ADV_DATA_CMD to set an advertising data or scan response data or periodic advertising data.
- GAPM_MsgHandler : Message handler for GAPM events.
- GAPC_ParamUpdateCmd : Prepare and send GAPC_PARAM_UPDATE_CMD to perform an update on parameters.
- GAPC_ParamUpdateCfm : Prepare and send GAPC_PARAM_UPDATE_CFM to accept or reject connection parameters.
- GAPC_ConnectionCfm : Prepare and send GAPC_CONNECTION_CFM in a response to connection request.
- GAPC_DisconnectCmd : Prepare and send GAPC_DISCONNECT_CMD to disconnect link.
- GAPC_IsConnectionActive : Check if the specified connection is active.
- GAPC_DisconnectAll : Prepare and send GAPC_DISCONNECT_CMD to disconnect all the links.
- GAPC_ConnectionCount : Get the number of active connection count.
- GAPC_MasterConnectionCount : Get the master connection count.
- GAPC_SlaveConnectionCount : Get the slave connection count.
- GAPC_GetConnectionInfo : Get the connection information of a specified connection ID.
- GAPC_GetDevInfoCfm_Name : Prepare and send GAPC_GET_DEV_INFO_CFM to send the device name.
- GAPC_GetDevInfoCfm_Appearance : Prepare and send GAPC_GET_DEV_INFO_CFM to send the device appearance.
- GAPC_GetDevInfoCfm_SlvPrefParams : Prepare and send GAPC_GET_DEV_INFO_CFM to send device slave preferred parameters.
- GAPC_GetDevInfoCfm : Prepare and send GAPC_GET_DEV_INFO_CFM to send requested information.
- GAPC_SetDevInfoCfm : Prepare and send GAPC_SET_DEV_INFO_CFM to confirm if the requested device information was written.
- GAPC_BondCfm : GAPC bond and encryption operations.
- GAPC_EncryptCmd : Prepare and send GAPC_ENCRYPT_CMD to request encrypting the connection link.
- GAPC_EncryptCfm : Prepare and send GAPC_ENCRYPT_CFM to confirm an encryption request.
- GAPC_IsBonded : Check if the connection is bonded.
- GAPC_GetBondInfo : Get bond information for the connection.
- GAPC_BondCmd : Prepare and send GAPC_BOND_CMD to initiate a bond procedure.
- GAPC_AddRecordToBondList : Add record to bond list.
- GAPC_MsgHandler : GAPC message handler.
- GAPM_ListSetWlCmd : Prepare and send GAPM_LIST_SET_CMD to set the white list content.
- GAPM_ListSetRalCmd : Prepare and send GAPM_LIST_SET_CMD to set the resolving list content.
- GAPM_IsIRKValid : Check if IRK is valid.
- WhiteList_ResolvableList_Update : Update the white list and the resolve List.
- GAPM_GetWhitelistNumDev : Get number of devices in whitelist.
- GAPM_SetWhitelistNumDev : Set the number of devices in whitelist.
- GAPC_SetPhyCmd : GAPC PHY management operations.
- GAPC_CteTxCfgCmd : GAPC constant Tone extension operations.
- GAPC_CteRxCfgCmd : Prepare and send GAPC_CTE_RX_CFG_CMD to configure CTE RX.
- GAPC_CteReqCtrlCmd : Prepare and send GAPC_CTE_REQ_CTRL_CMD to control CTE requests.
- GAPC_CteRspCtrlCmd : Prepare and send GAPC_CTE_RSP_CTRL_CMD to control CTE reception.
- GAPC_GetInfoCmd : GAPC local and peer device information operations.
- GAPM_PerAdvCteTxCmd : Prepare and send GAPM_PER_ADV_CTE_TX_CTL_CMD to control CTE transmission in a periodic advertising activity.
- GAPM_PerAdvReportCtrlCmd : Prepare and send GAPM_PER_ADV_REPORT_CTRL_CMD to control reception of periodic advertising report in a periodic advertising sync activity.
- GAPM_PerSyncIQSamplingCtrlCmd : Prepare and send GAPM_PER_SYNC_IQ_SAMPLING_CTRL_CMD to control capturing IQ samples from the constant tone extension of periodic advertising packets.
- GATT_Initialize : GATT initialization.
- GATT_GetEnv : Get GATT environment.
- GATT_SetEnvData : Set GATT environment data.
- GATT_GetMaxCustomServiceNumber : Get the maximum number of custom services in GATT.
- GATTM_GetServiceAddedCount : Get GATT added services count.
- GATTM_ResetServiceAttributeDatabaseID : Resets GATT services attribute database ID.
- GATTM_AddAttributeDatabase : Add service and attributes to the Bluetooth stack.
- GATTM_GetHandle : Get the handle for an attribute.
- GATTM_MsgHandler : Handle GATTM messages.
- GATTC_Initialize : GATTC initialization.
- GATTC_DiscByUUIDSvc : GATTC services discovery by UUID.
- GATTC_DiscAllSvc : GATTC all services discovery.
- GATTC_DiscAllChar : GATTC all characteristics discovery.
- GATTC_SendEvtCmd : GATTC send event.
- GATTC_SendEvtCfm : GATTC send event confirmation.
- GATTC_MtuExchange : Prepare and send GATTC_EXC_MTU_CMD to start MTU exchange procedure.
- GATTC_ReadReqInd : GATTC handle read request indication.
- GATTC_WriteReqInd : GATTC handle write request indication.
- GATTC_AttInfoReqInd : GATTC request attribute information.
- GATTC_MsgHandler : Handle GATTM messages.
- Device_BLE_Public_Address_Read : Read the Bluetooth public address to ble_public_addr.
- Device_BLE_Param_Get : Read BLE device parameters.
- rand_func : Generate a pseudo-random number.
- set_app_rand_func : Sets random number generator function to be used by the BLE stack when calling rand_func()
- srand_func : Seeds pseudo-random number generator used by function rand()
- set_app_rand_seed_val : Sets seed value to be used by the BLE stack when calling srand_func()
- default_rf_rssi_func : Default RF to RSSI conversion function to be used by the BLE stack when calling Device_RF_RSSI_Convert().
- set_app_rf_rssi_func : Sets RF to RSSI conversion function to be used by the BLE stack when calling Device_RF_RSSI_Convert()
- MsgHandler_GetTaskAppDesc : Provide an application task descriptor with default handler set to the MsgHandler_Notify function.
- MsgHandler_Add : Add/subscribe a message handler callback function.
- MsgHandler_Notify : Notify the callback functions associated with the msg_id.
- BASC_Initialize : Initialize BASC environment.
- BASC_EnableReq : Enable the client role of the BAS.
- BASC_ReadInfoReq : Prepare and send BASC_READ_INFO_REQ to read value from peer.
- BASC_BattLevelNtfCfgReq : Send a request to change notification configuration.
- BASC_RequestBattLevelOnTimeout : Send a request for periodic battery level update.
- BASC_GetLastBatteryLevel : Read the most recent battery level.
- BASC_GetEnv : Get the BASC environment.
- BASC_MsgHandler : Handle the BASC events.
- BASS_Initialize : Initialize BASS environment.
- BASS_NotifyOnTimeout : BASS configure periodic notification.
- BASS_NotifyOnBattLevelChange : BASS notify peers on battery level change.
- BASS_ProfileTaskAddCmd : Add a battery profile in kernel.
- BASS_EnableReq : Enable the server role in BAS.
- BASS_BattLevelUpdReq : Prepare and send BASS_BATT_LEVEL_UPD_REQ for battery level notification.
- BASS_GetEnv : Get the BASS environment.
- BASS_IsAdded : Check if the BASS is added successfully.
- BASS_MsgHandler : Handle BASS messages.
- DISS_Initialize : Initialize the device information server service environment and configure message handlers.
- DISS_ProfileTaskAddCmd : Send a request to add the device information service in kernel and database.
- DISS_EnvGet : Return a reference to the internal DISS environment structure.
- DISS_IsAdded : Return a boolean indication if the DISS server has been successfully added to the services database.
- DISS_MsgHandler : Handle all the events related to the device information service server.
- DISS_DeviceInfoValueReqInd : Handle the indication when the peer device requests a value.

# Detailed Description

This reference chapter presents a detailed description of all the support provided for the Bluetooth Low Energy Stack Abstraction. This reference includes calling parameters, returned values, and assumptions.