System#

System.

Commands and events in this class can be used to access and query the local device.

Modules#

sl_bt_evt_system_boot

sl_bt_evt_system_stopped

sl_bt_evt_system_error

sl_bt_evt_system_resource_exhausted

sl_bt_evt_system_external_signal

sl_bt_evt_system_awake

sl_bt_evt_system_soft_timer

Enumerations#

enum
sl_bt_system_linklayer_config_key_halt = 0x1
sl_bt_system_linklayer_config_key_priority_range = 0x2
sl_bt_system_linklayer_config_key_scan_channels = 0x3
sl_bt_system_linklayer_config_key_set_flags = 0x4
sl_bt_system_linklayer_config_key_clr_flags = 0x5
sl_bt_system_linklayer_config_key_set_afh_interval = 0x7
sl_bt_system_linklayer_config_key_set_periodic_advertising_status_report = 0x8
sl_bt_system_linklayer_config_key_set_priority_table = 0x9
sl_bt_system_linklayer_config_key_set_rx_packet_filtering = 0xa
sl_bt_system_linklayer_config_key_set_simultaneous_scanning = 0xb
sl_bt_system_linklayer_config_key_set_channelmap_flags = 0xc
sl_bt_system_linklayer_config_key_low_power_mode_power_limit = 0xd
sl_bt_system_linklayer_config_key_power_control_golden_range = 0x10
sl_bt_system_linklayer_config_key_active_scanner_backoff_upper_limit = 0x11
sl_bt_system_linklayer_config_key_afh_rssi_threshold = 0x12
sl_bt_system_linklayer_config_key_afh_channel_cooldown = 0x13
sl_bt_system_linklayer_config_key_set_report_all_scan_rsps = 0x14
}

These Keys are used to configure Link Layer Operation.

Functions#

sl_status_t
sl_status_t
sl_bt_system_get_version(uint16_t *major, uint16_t *minor, uint16_t *patch, uint16_t *build, uint32_t *bootloader, uint32_t *hash)
sl_status_t
sl_bt_system_halt(uint8_t halt)
sl_status_t
sl_bt_system_linklayer_configure(uint8_t key, size_t data_len, const uint8_t *data)
sl_status_t
sl_bt_system_set_tx_power(int16_t min_power, int16_t max_power, int16_t *set_min, int16_t *set_max)
sl_status_t
sl_bt_system_get_tx_power_setting(int16_t *support_min, int16_t *support_max, int16_t *set_min, int16_t *set_max, int16_t *rf_path_gain)
sl_status_t
sl_bt_system_set_identity_address(bd_addr address, uint8_t type)
sl_status_t
sl_bt_system_get_identity_address(bd_addr *address, uint8_t *type)
sl_status_t
sl_bt_system_get_random_data(uint8_t length, size_t max_data_size, size_t *data_len, uint8_t *data)
sl_status_t
sl_bt_system_data_buffer_write(size_t data_len, const uint8_t *data)
sl_status_t
sl_bt_system_get_counters(uint8_t reset, uint16_t *tx_packets, uint16_t *rx_packets, uint16_t *crc_errors, uint16_t *failures)
sl_status_t
sl_bt_system_set_lazy_soft_timer(uint32_t time, uint32_t slack, uint8_t handle, uint8_t single_shot)
SL_BGAPI_DEPRECATED void
sl_bt_system_reset(uint8_t dfu)

Macros#

#define
#define
#define
#define
#define
#define
#define
#define

Enumeration Documentation#

sl_bt_system_linklayer_config_key_t#

sl_bt_system_linklayer_config_key_t

These Keys are used to configure Link Layer Operation.

Enumerator
sl_bt_system_linklayer_config_key_halt

(0x1) Same as system_halt command, value-0 Stop Radio 1- Start Radio

sl_bt_system_linklayer_config_key_priority_range

(0x2) Sets the RAIL priority_mapping offset field of the link layer priority configuration structure to the first byte of the value field.

sl_bt_system_linklayer_config_key_scan_channels

(0x3) Sets channels to scan on. The first byte of the value is the channel map. 0x1 = Channel 37, 0x2 = Channel 38, 0x4 = Channel 39

sl_bt_system_linklayer_config_key_set_flags

(0x4) Sets the link layer configuration flags. The value is a little endian 32-bit integer. Flag Values:

  • 0x00000001 - Disable Feature Exchange in peripheral role of the connection

  • 0x00000002 - Disable Feature Exchange in central role of the connection

sl_bt_system_linklayer_config_key_clr_flags

(0x5) The value is flags to clear. Flags are the same as in SET_FLAGS command.

sl_bt_system_linklayer_config_key_set_afh_interval

(0x7) Set the afh_scan_interval. Value is in units of 10 ms. Setting the interval to 0 will result in using the default value of 1 second.

sl_bt_system_linklayer_config_key_set_periodic_advertising_status_report

(0x8) Enable or disable the status report of periodic advertising on an advertising set. When enabled, event sl_bt_evt_periodic_advertiser_status will be generated for each scheduled transmission. Value: 2 bytes

  • Byte 1 - The advertising set handle

  • Byte 2 - The status report state

    • 0: Disable the status report

    • 1: Enable the status report

Default: The status report on any advertising sets is disabled.

sl_bt_system_linklayer_config_key_set_priority_table

(0x9) The value contains a priority table to be copied over the existing table. If the value is smaller than the full table, only those values are updated. See sl_bt_bluetooth_ll_priorities struct for the definition of a priority table.

sl_bt_system_linklayer_config_key_set_rx_packet_filtering

(0xa) Configure and enable or disable RX packet filtering feature. Value: >= 5 bytes.

  • Byte 1 - The filter count

  • Byte 2 - The filter offset

  • Byte 3 - The length of the filter list

  • Byte 4 - The bitmask flags

  • Rest of the data - The filter list

sl_bt_system_linklayer_config_key_set_simultaneous_scanning

(0xb) Enable or disable simultaneous scanning on the 1M and Coded PHYs. Value: 1 byte.

  • 0 - Disable simultaneous scanning.

  • 1 - Enable simultaneous scanning.

sl_bt_system_linklayer_config_key_set_channelmap_flags

(0xc) Configure channelmap adaptivity flags. Value: 4 bytes.

  • 0 - Disable the adaptivity in the AFH feature.

  • 1 - Enable the adaptivity in the AFH feature.

sl_bt_system_linklayer_config_key_low_power_mode_power_limit

(0xd) Set power limits for the low power mode where the frequency adaptivity is disabled or the current channel mapping with adaptivity enabled does not allow to use a high transmission power. A limit value must not exceed the maximum that the regulations in the region of use allow. The value is an 8-bytes long array consisting of 4 int16_t items specifying the power limits in 0.1 dBm unit for different PHYs in the following order,

  • Item 1 - The power limit for 1M PHY

  • Item 2 - The power limit for 2M PHY

  • Item 3 - The power limit for Coded PHY S=8

  • Item 4 - The power limit for Coded PHY S=2

sl_bt_system_linklayer_config_key_power_control_golden_range

(0x10) Set Power Control golden range parameters. The value is a 8-bytes long array that consists of 4 pairs of golden range configurations. In each pair, the first byte is the lower RSSI boundary and the second byte is the upper RSSI boundary. RSSI values are in dBm. This configuration is not allowed if there are active Bluetooth connections.

  • Byte 1 - Minimal RSSI on 1M PHY

  • Byte 2 - Maximal RSSI on 1M PHY

  • Byte 3 - Minimal RSSI on 2M PHY

  • Byte 4 - Maximal RSSI on 2M PHY

  • Byte 5 - Minimal RSSI on Coded PHY S=8

  • Byte 6 - Maximal RSSI on Coded PHY S=8

  • Byte 7 - Minimal RSSI on Coded PHY S=2

  • Byte 8 - Maximal RSSI on Coded PHY S=2

sl_bt_system_linklayer_config_key_active_scanner_backoff_upper_limit

(0x11) Value: uint16_t Adjust upper limit for backoff counter. If 0 restores default value of 256 Value must be between 16 - 256

sl_bt_system_linklayer_config_key_afh_rssi_threshold

(0x12) Value: int8_t Configures RSSI limit for AFH channel blocking

sl_bt_system_linklayer_config_key_afh_channel_cooldown

(0x13) Value: int16_t Configures how long channel is blocked after activity is detected Default: 8000

sl_bt_system_linklayer_config_key_set_report_all_scan_rsps

(0x14) Value: uint8_t 0 - default, only reports scan responses that is received after sending scan_req nonzero - Will report all scan responses that are received on primary advertising channels


Definition at line 298 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

Function Documentation#

sl_bt_system_hello#

sl_status_t sl_bt_system_hello ()

Verify whether the communication between the host and the device is functional.

NOTE: This command is available even if the Bluetooth stack has not been started. See sl_bt_system_start_bluetooth for description of how the Bluetooth stack is started.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1191 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_start_bluetooth#

sl_status_t sl_bt_system_start_bluetooth ()

If the Bluetooth on-demand start component is not included in the application build, the Bluetooth stack is automatically started when the device boots up. In this configuration, the on-demand start command is not available and the command returns the error SL_STATUS_NOT_AVAILABLE.

When the Bluetooth on-demand start component is included in the application build, this command is used by the application to request starting the Bluetooth stack when the application needs it. If the command returns a success result, the stack starts to asynchronously allocate the resources and configure the Bluetooth stack based on the configuration passed at initialization time.

The Bluetooth stack cannot be restarted while it's still stopping after issuing the command sl_bt_system_stop_bluetooth. If sl_bt_system_start_bluetooth is called when stopping is still on-going the command returns the error SL_STATUS_INVALID_STATE. The application must wait for the sl_bt_evt_system_stopped event before attempting to restart the stack.

Successful start of the stack is indicated by the sl_bt_evt_system_boot event. The configured classes and Bluetooth stack features are available after the application has received the sl_bt_evt_system_boot event. If starting the Bluetooth stack fails, the error is indicated to the application with the sl_bt_evt_system_error event.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.

Events

  • sl_bt_evt_system_boot - Triggered when the Bluetooth stack has succesfully started and is ready to accept commands from the application

  • sl_bt_evt_system_error - Triggered if the command to start the Bluetooth stack was accepted but the asynchronous starting of the stack has failed


Definition at line 1231 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_stop_bluetooth#

sl_status_t sl_bt_system_stop_bluetooth ()

If the Bluetooth on-demand start component is not included in the application build, the Bluetooth stack is automatically started when the device boots up. In this configuration, the stop command is not available and the command returns the error SL_STATUS_NOT_AVAILABLE.

When the Bluetooth on-demand start component is included in the application build, this command is used by the application to stop the Bluetooth stack when the application no longer needs it. This command gracefully restores Bluetooth to an idle state by disconnecting any active connections and stopping any on-going advertising and scanning. Any resources that were allocated when the stack was started are freed when the stack has finished stopping. After this command, the BGAPI classes other than System become unavailable.

Stopping the Bluetooth stack with this command is asynchronous and the completion is indicated by the sl_bt_evt_system_stopped event. The application can use the command sl_bt_system_start_bluetooth to restart the stack any time after it has received the sl_bt_evt_system_stopped event. If the application needs to stop the Bluetooth stack immediately, use the command sl_bt_system_forcefully_stop_bluetooth. That command can also be used to immediately complete the asynchronous stopping if the command sl_bt_system_stop_bluetooth has not completed in expected time period.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.

Events


Definition at line 1266 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_forcefully_stop_bluetooth#

sl_status_t sl_bt_system_forcefully_stop_bluetooth ()

If the Bluetooth on-demand start component is not included in the application build, the Bluetooth stack is automatically started when the device boots up. In this configuration, the stop command is not available and the command returns the error SL_STATUS_NOT_AVAILABLE.

When the Bluetooth on-demand start component is included in the application build, this command is used by the application to forcefully stop the Bluetooth stack when the application no longer needs it. This command immediately stops all active Bluetooth operations such as advertising, scanning, and connections. Active connections are forcefully closed without performing the ACL Termination procedure. This can result in the observation of connection loss or supervision timeout on the remote device. Only use this command for special cases, for example, when stopping Bluetooth with sl_bt_system_stop_bluetooth did not complete in expected time period.

Stopping the Bluetooth stack with this command is immediate and it directly triggers the sl_bt_evt_system_stopped event. Any resources that were allocated when the stack was started are freed. After this command, the BGAPI classes other than System become unavailable. The application can use the command sl_bt_system_start_bluetooth to continue using Bluetooth later.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.

Events


Definition at line 1300 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_get_version#

sl_status_t sl_bt_system_get_version (uint16_t * major, uint16_t * minor, uint16_t * patch, uint16_t * build, uint32_t * bootloader, uint32_t * hash)
Parameters
[out]major

Major release version

[out]minor

Minor release version

[out]patch

Patch release number

[out]build

Build number

[out]bootloader

Unused. Ignore this field.

[out]hash

Version hash

Get the firmware version information.

NOTE: This command is available even if the Bluetooth stack has not been started. See sl_bt_system_start_bluetooth for description of how the Bluetooth stack is started.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1320 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_reboot#

void sl_bt_system_reboot ()

Reset the system into user application mode, i.e., reboot the user application. This command does not have a response. To boot into a DFU mode, use the Bootloader API bootloader_rebootAndInstall.

NOTE: This command is available even if the Bluetooth stack has not been started. See sl_bt_system_start_bluetooth for description of how the Bluetooth stack is started.

Events

  • sl_bt_evt_system_boot -

    Sent after the device has booted in user application mode and Bluetooth stack has started.

    Note: This event will not be sent when the Bluetooth on-demand start feature is used because Bluetooth stack will not start automatically.


Definition at line 1349 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_halt#

sl_status_t sl_bt_system_halt (uint8_t halt)
Parameters
[in]halt

Values:

  • 1: halt

  • 0: resume

Force radio to idle state and allow device to sleep. Advertising, scanning, connections, and software timers are halted by this command. Halted operations resume after calling this command with parameter 0. Connections stay alive if the system is resumed before connection supervision timeout.

Use this command only for a short time period (maximum few seconds). Although it halts Bluetooth activity, all tasks and operations still exist inside the stack with their own concepts of time. Halting the system for a long time period may have negative consequences on stack's internal states.

NOTE: The software timer is also halted. Hardware interrupts are the only way to wake up from energy mode 2 when the system is halted.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1373 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_linklayer_configure#

sl_status_t sl_bt_system_linklayer_configure (uint8_t key, size_t data_len, const uint8_t * data)
Parameters
[in]key

Enum sl_bt_system_linklayer_config_key_t. Key to configure. Values:

  • sl_bt_system_linklayer_config_key_halt (0x1): Same as system_halt command, value-0 Stop Radio 1- Start Radio

  • sl_bt_system_linklayer_config_key_priority_range (0x2): Sets the RAIL priority_mapping offset field of the link layer priority configuration structure to the first byte of the value field.

  • sl_bt_system_linklayer_config_key_scan_channels (0x3): Sets channels to scan on. The first byte of the value is the channel map. 0x1 = Channel 37, 0x2 = Channel 38, 0x4 = Channel 39

  • sl_bt_system_linklayer_config_key_set_flags (0x4): Sets the link layer configuration flags. The value is a little endian 32-bit integer. Flag Values:

    • 0x00000001 - Disable Feature Exchange in peripheral role of the connection

    • 0x00000002 - Disable Feature Exchange in central role of the connection

  • sl_bt_system_linklayer_config_key_clr_flags (0x5): The value is flags to clear. Flags are the same as in SET_FLAGS command.

  • sl_bt_system_linklayer_config_key_set_afh_interval (0x7): Set the afh_scan_interval. Value is in units of 10 ms. Setting the interval to 0 will result in using the default value of 1 second.

  • sl_bt_system_linklayer_config_key_set_periodic_advertising_status_report (0x8): Enable or disable the status report of periodic advertising on an advertising set. When enabled, event sl_bt_evt_periodic_advertiser_status will be generated for each scheduled transmission. Value: 2 bytes

    • Byte 1 - The advertising set handle

    • Byte 2 - The status report state

      • 0: Disable the status report

      • 1: Enable the status report

    Default: The status report on any advertising sets is disabled.

  • sl_bt_system_linklayer_config_key_set_priority_table (0x9): The value contains a priority table to be copied over the existing table. If the value is smaller than the full table, only those values are updated. See sl_bt_bluetooth_ll_priorities struct for the definition of a priority table.

  • sl_bt_system_linklayer_config_key_set_rx_packet_filtering (0xa): Configure and enable or disable RX packet filtering feature. Value: >= 5 bytes.

    • Byte 1 - The filter count

    • Byte 2 - The filter offset

    • Byte 3 - The length of the filter list

    • Byte 4 - The bitmask flags

    • Rest of the data - The filter list

  • sl_bt_system_linklayer_config_key_set_simultaneous_scanning (0xb): Enable or disable simultaneous scanning on the 1M and Coded PHYs. Value: 1 byte.

    • 0 - Disable simultaneous scanning.

    • 1 - Enable simultaneous scanning.

  • sl_bt_system_linklayer_config_key_set_channelmap_flags (0xc): Configure channelmap adaptivity flags. Value: 4 bytes.

    • 0 - Disable the adaptivity in the AFH feature.

    • 1 - Enable the adaptivity in the AFH feature.

  • sl_bt_system_linklayer_config_key_low_power_mode_power_limit (0xd): Set power limits for the low power mode where the frequency adaptivity is disabled or the current channel mapping with adaptivity enabled does not allow to use a high transmission power. A limit value must not exceed the maximum that the regulations in the region of use allow. The value is an 8-bytes long array consisting of 4 int16_t items specifying the power limits in 0.1 dBm unit for different PHYs in the following order,

    • Item 1 - The power limit for 1M PHY

    • Item 2 - The power limit for 2M PHY

    • Item 3 - The power limit for Coded PHY S=8

    • Item 4 - The power limit for Coded PHY S=2

  • sl_bt_system_linklayer_config_key_power_control_golden_range (0x10): Set Power Control golden range parameters. The value is a 8-bytes long array that consists of 4 pairs of golden range configurations. In each pair, the first byte is the lower RSSI boundary and the second byte is the upper RSSI boundary. RSSI values are in dBm. This configuration is not allowed if there are active Bluetooth connections.

    • Byte 1 - Minimal RSSI on 1M PHY

    • Byte 2 - Maximal RSSI on 1M PHY

    • Byte 3 - Minimal RSSI on 2M PHY

    • Byte 4 - Maximal RSSI on 2M PHY

    • Byte 5 - Minimal RSSI on Coded PHY S=8

    • Byte 6 - Maximal RSSI on Coded PHY S=8

    • Byte 7 - Minimal RSSI on Coded PHY S=2

    • Byte 8 - Maximal RSSI on Coded PHY S=2

  • sl_bt_system_linklayer_config_key_active_scanner_backoff_upper_limit (0x11): Value: uint16_t Adjust upper limit for backoff counter. If 0 restores default value of 256 Value must be between 16 - 256

  • sl_bt_system_linklayer_config_key_afh_rssi_threshold (0x12): Value: int8_t Configures RSSI limit for AFH channel blocking

  • sl_bt_system_linklayer_config_key_afh_channel_cooldown (0x13): Value: int16_t Configures how long channel is blocked after activity is detected Default: 8000

  • sl_bt_system_linklayer_config_key_set_report_all_scan_rsps (0x14): Value: uint8_t 0 - default, only reports scan responses that is received after sending scan_req nonzero - Will report all scan responses that are received on primary advertising channels

[in]data_len

Length of data in data

[in]data

Configuration data. Length and contents of the data field depend on the key value used.

Send configuration data to the link layer. This command fine tunes low-level Bluetooth operations.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1488 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_set_tx_power#

sl_status_t sl_bt_system_set_tx_power (int16_t min_power, int16_t max_power, int16_t * set_min, int16_t * set_max)
Parameters
[in]min_power

Minimum radiated TX power. Unit: 0.1 dBm. For example, the value 10 means 1 dBm.

[in]max_power

Maximum radiated TX power. Unit: 0.1 dBm. For example, the value 10 means 1 dBm.

[out]set_min

The selected minimum radiated TX power. Unit: 0.1 dBm

[out]set_max

The selected maximum radiated TX power. Unit: 0.1 dBm

Set the global minimum and maximum radiated TX power levels for Bluetooth. This returns selected power levels that are radiated from the antenna at TX. The transmitter power at antenna pin will apply the RF TX path gain to match this setting. RF TX path gain can be set in the Bluetooth configuration. If the GATT server contains a TX power service, the TX Power Level attribute will be updated with the selected maximum power level.

A selected power level may be different than the requested value because of Bluetooth feature restrictions or the device's radio characteristics. For Bluetooth connections, the maximum radiated TX power is limited to 10 dBm if Adaptive Frequency Hopping (AFH) is not enabled.

The minimum TX power setting is used by LE power control. It has no effect in Bluetooth stack if the LE power control feature is not enabled. However, the application may still use this setting for other purposes, e.g., setting the minimum TX power for DTM transmitter test.

The minimum and maximum radiated TX power levels can also be configured in the Bluetooth configuration and passed into the Bluetooth stack initialization. By default, the minimum radiated TX power level is configured to -3 dBm and the maximum radiated TX power level to 8 dBm.

NOTE: Do not use this command while advertising or scanning. Furthermore, the stack does not allow setting TX powers during connections.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1529 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_get_tx_power_setting#

sl_status_t sl_bt_system_get_tx_power_setting (int16_t * support_min, int16_t * support_max, int16_t * set_min, int16_t * set_max, int16_t * rf_path_gain)
Parameters
[out]support_min

The minimum radiated TX power the device supports. Unit: 0.1 dBm

[out]support_max

The maximum radiated TX power the device supports. Unit: 0.1 dBm

[out]set_min

The minimum radiated TX power currently set in stack. Unit: 0.1 dBm

[out]set_max

The maximum radiated TX power currently set in stack. Unit: 0.1 dBm

[out]rf_path_gain

TX RF path gain. Unit: 0.1 dBm

Get TX power settings including the minimum and maximum radiated TX power levels the device supports, the minimum and maximum radiated TX power levels currently set in the stack, and the TX RF path gain configuration.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1553 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_set_identity_address#

sl_status_t sl_bt_system_set_identity_address (bd_addr address, uint8_t type)
Parameters
[in]address

Bluetooth identity address in little endian format

[in]type

Enum sl_bt_gap_address_type_t. Identity address type. Values:

  • sl_bt_gap_public_address (0x0): Public device address

  • sl_bt_gap_static_address (0x1): Static device address

Deprecated . The Bluetooth stack does not provide a replacement for storing an address persistently. User application can implement its own logic of retrieving the address from persistent storage or with other means and use it as the identity address in Bluetooth stack with command sl_bt_gap_set_identity_address.

Store a custom Bluetooth identity address in the Bluetooth region of NVM3. The address can be a public device address or a static device address. NVM3 keys used for the address and its type are in the key range owned by the Bluetooth stack. The stack returns an error if the static device address does not conform to the Bluetooth specification.

The new address will be effective in the next system reboot. The stack will use the address in the NVM3 keys when present. Otherwise, it uses the default Bluetooth public device address which is programmed at production.

The stack treats 00:00:00:00:00:00 and ff:ff:ff:ff:ff:ff as invalid addresses. Therefore, passing one of them into this command will cause the stack to delete the NVM3 keys and use the default address in the next system reboot.

Note: Because the NVM3 keys are located in flash and flash wearing can occur, avoid calling this command regularly.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1594 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_get_identity_address#

sl_status_t sl_bt_system_get_identity_address (bd_addr * address, uint8_t * type)
Parameters
[out]address

Bluetooth identity address in little endian format

[out]type

Enum sl_bt_gap_address_type_t. Identity address type. Values:

  • sl_bt_gap_public_address (0x0): Public device address

  • sl_bt_gap_static_address (0x1): Static device address

Deprecated and replaced by sl_bt_gap_get_identity_address.

Read the Bluetooth identity address used by the device, which can be a public or random static device address.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1612 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_get_random_data#

sl_status_t sl_bt_system_get_random_data (uint8_t length, size_t max_data_size, size_t * data_len, uint8_t * data)
Parameters
[in]length

Length of random data.

[in]max_data_size

Size of output buffer passed in data

[out]data_len

On return, set to the length of output data written to data

[out]data

Random data

Get random data.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1627 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_data_buffer_write#

sl_status_t sl_bt_system_data_buffer_write (size_t data_len, const uint8_t * data)
Parameters
[in]data_len

Length of data in data

[in]data

Data to write

Write data into the system data buffer. Data will be appended to the end of existing data.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1643 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_data_buffer_clear#

sl_status_t sl_bt_system_data_buffer_clear ()

Remove all data from the system data buffer.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1654 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_get_counters#

sl_status_t sl_bt_system_get_counters (uint8_t reset, uint16_t * tx_packets, uint16_t * rx_packets, uint16_t * crc_errors, uint16_t * failures)
Parameters
[in]reset

Reset counters if the parameter value is not zero.

[out]tx_packets

The number of successfully transmitted packets

[out]rx_packets

The number of successfully received packets

[out]crc_errors

The number of received packets with CRC errors

[out]failures

The number of radio failures, such as aborted TX/RX packets, scheduling failures, and so on.

Get packet and error counters. Passing a non-zero value also resets counters.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 1670 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_set_lazy_soft_timer#

sl_status_t sl_bt_system_set_lazy_soft_timer (uint32_t time, uint32_t slack, uint8_t handle, uint8_t single_shot)
Parameters
[in]time

An interval between how often to send events in hardware clock ticks (1 second is equal to 32768 ticks).

The smallest interval value supported is 328, which is around 10 milliseconds. Any parameters between 0 and 328 will be rounded up to 328. The maximum value is 2147483647, which corresponds to about 18.2 hours.

If time is 0, removes the scheduled timer with the same handle.

[in]slack

Slack time in hardware clock ticks

[in]handle

Timer handle to use, which is returned in timeout event

[in]single_shot

Timer mode. Values:

  • 0: false (timer is repeating)

  • 1: true (timer runs only once)

Deprecated . Use the sleeptimer component (in platform services category) for timers. Because the sleeptimer does not support a timer with slack yet, the Bluetooth stack will continue to support this command until another component provides the functionality.

Start a software timer with slack. The slack parameter allows the stack to optimize wakeups and save power. The timer event is triggered between time and time + slack.

Multiple concurrent timers can be running simultaneously. 256 unique timer handles (IDs) are available. The maximum number of concurrent timers is configurable at device initialization. Up to 16 concurrent timers can be configured. The default configuration is 4. As the RAM for storing timer data is pre-allocated at initialization, an application should not configure the amount more than it needs for minimizing RAM usage.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.

Events


Definition at line 1716 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_system_reset#

SL_BGAPI_DEPRECATED void sl_bt_system_reset (uint8_t dfu)
Parameters
[in]dfu

This parameter is unused and is ignored by the Bluetooth stack.

Deprecated and replaced by sl_bt_system_reboot.

Reset the system into user application mode, i.e., reboot the user application. This command does not have a response. To boot into a DFU mode, use the Bootloader API bootloader_rebootAndInstall.

NOTE: This command is available even if the Bluetooth stack has not been started. See sl_bt_system_start_bluetooth for description of how the Bluetooth stack is started.

Events

  • sl_bt_evt_system_boot -

    Sent after the device has booted in user application mode and Bluetooth stack has started.

    Note: This event will not be sent when the Bluetooth on-demand start feature is used because Bluetooth stack will not start automatically.


Definition at line 1747 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

Macro Definition Documentation#

sl_bt_cmd_system_hello_id#

#define sl_bt_cmd_system_hello_id
Value:
0x00010020

Definition at line 258 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_start_bluetooth_id#

#define sl_bt_cmd_system_start_bluetooth_id
Value:
0x1c010020

Definition at line 259 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_stop_bluetooth_id#

#define sl_bt_cmd_system_stop_bluetooth_id
Value:
0x1d010020

Definition at line 260 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_forcefully_stop_bluetooth_id#

#define sl_bt_cmd_system_forcefully_stop_bluetooth_id
Value:
0x1e010020

Definition at line 261 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_get_version_id#

#define sl_bt_cmd_system_get_version_id
Value:
0x1b010020

Definition at line 262 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_reboot_id#

#define sl_bt_cmd_system_reboot_id
Value:
0x1f010020

Definition at line 263 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_halt_id#

#define sl_bt_cmd_system_halt_id
Value:
0x0c010020

Definition at line 264 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_linklayer_configure_id#

#define sl_bt_cmd_system_linklayer_configure_id
Value:
0x0e010020

Definition at line 265 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_set_tx_power_id#

#define sl_bt_cmd_system_set_tx_power_id
Value:
0x17010020

Definition at line 266 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_get_tx_power_setting_id#

#define sl_bt_cmd_system_get_tx_power_setting_id
Value:
0x18010020

Definition at line 267 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_set_identity_address_id#

#define sl_bt_cmd_system_set_identity_address_id
Value:
0x13010020

Definition at line 268 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_get_identity_address_id#

#define sl_bt_cmd_system_get_identity_address_id
Value:
0x15010020

Definition at line 269 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_get_random_data_id#

#define sl_bt_cmd_system_get_random_data_id
Value:
0x0b010020

Definition at line 270 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_data_buffer_write_id#

#define sl_bt_cmd_system_data_buffer_write_id
Value:
0x12010020

Definition at line 271 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_data_buffer_clear_id#

#define sl_bt_cmd_system_data_buffer_clear_id
Value:
0x14010020

Definition at line 272 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_get_counters_id#

#define sl_bt_cmd_system_get_counters_id
Value:
0x0f010020

Definition at line 273 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_set_lazy_soft_timer_id#

#define sl_bt_cmd_system_set_lazy_soft_timer_id
Value:
0x1a010020

Definition at line 274 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_cmd_system_reset_id#

#define sl_bt_cmd_system_reset_id
Value:
0x01010020

Definition at line 275 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_hello_id#

#define sl_bt_rsp_system_hello_id
Value:
0x00010020

Definition at line 276 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_start_bluetooth_id#

#define sl_bt_rsp_system_start_bluetooth_id
Value:
0x1c010020

Definition at line 277 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_stop_bluetooth_id#

#define sl_bt_rsp_system_stop_bluetooth_id
Value:
0x1d010020

Definition at line 278 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_forcefully_stop_bluetooth_id#

#define sl_bt_rsp_system_forcefully_stop_bluetooth_id
Value:
0x1e010020

Definition at line 279 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_get_version_id#

#define sl_bt_rsp_system_get_version_id
Value:
0x1b010020

Definition at line 280 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_reboot_id#

#define sl_bt_rsp_system_reboot_id
Value:
0x1f010020

Definition at line 281 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_halt_id#

#define sl_bt_rsp_system_halt_id
Value:
0x0c010020

Definition at line 282 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_linklayer_configure_id#

#define sl_bt_rsp_system_linklayer_configure_id
Value:
0x0e010020

Definition at line 283 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_set_tx_power_id#

#define sl_bt_rsp_system_set_tx_power_id
Value:
0x17010020

Definition at line 284 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_get_tx_power_setting_id#

#define sl_bt_rsp_system_get_tx_power_setting_id
Value:
0x18010020

Definition at line 285 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_set_identity_address_id#

#define sl_bt_rsp_system_set_identity_address_id
Value:
0x13010020

Definition at line 286 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_get_identity_address_id#

#define sl_bt_rsp_system_get_identity_address_id
Value:
0x15010020

Definition at line 287 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_get_random_data_id#

#define sl_bt_rsp_system_get_random_data_id
Value:
0x0b010020

Definition at line 288 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_data_buffer_write_id#

#define sl_bt_rsp_system_data_buffer_write_id
Value:
0x12010020

Definition at line 289 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_data_buffer_clear_id#

#define sl_bt_rsp_system_data_buffer_clear_id
Value:
0x14010020

Definition at line 290 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_get_counters_id#

#define sl_bt_rsp_system_get_counters_id
Value:
0x0f010020

Definition at line 291 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_set_lazy_soft_timer_id#

#define sl_bt_rsp_system_set_lazy_soft_timer_id
Value:
0x1a010020

Definition at line 292 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h

sl_bt_rsp_system_reset_id#

#define sl_bt_rsp_system_reset_id
Value:
0x01010020

Definition at line 293 of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h