SPS Exported Functions

group SPS_Exported_Functions

Functions

bool sps_set_parameter(T_SPS_PARAM_TYPE param_type, uint8_t len, void *p_value)

Set a scan parameter service parameter.

This function can be called with a SPS parameter type T_SPS_PARAM_TYPE and it will set the SPS parameter. The 'p_value' field must point to an appropriate data type that meets the requirements for the corresponding parameter type. (For example, if required data length for parameter type is 1 octets, p_value should be cast to a pointer of uint8_t.)

Example usage

void test(void)
{
    bool ret = sps_set_parameter(SPS_PARAM_SCAN_REFRESH, 1, &refresh_value);
}
Parameters:
  • param_type -- [in] Scan parameter service parameter type: T_SPS_PARAM_TYPE.

  • len -- [in] Length of data to write.

  • p_value -- [in] Pointer to data to write.

Return values:
  • true -- Operation success.

  • false -- Operation failure.

Returns:

Operation result.

T_SERVER_ID sps_add_service(void *p_func)

Add scan parameters service to the Bluetooth Host.

Example usage

void profile_init()
{
    server_init(service_num);
    sps_id = sps_add_service(app_handle_profile_message);
}
Parameters:

p_func -- [in] Callback when service attribute was read, write or CCCD update.

Return values:
  • 0xFF -- Operation failure.

  • others -- Service ID assigned by Bluetooth Host.

Returns:

Service ID generated by the Bluetooth Host: T_SERVER_ID.

bool sps_scan_interval_window_value_notify(uint8_t conn_id, uint8_t service_id, uint8_t sps_refresh_value)

Send notification.

Example usage

void test(void)
{
     bool ret = sps_scan_interval_window_value_notify(conn_id, sps_id, sps_refresh_value);
}
Parameters:
  • conn_id -- [in] Connection ID.

  • service_id -- [in] Service ID of service.

  • sps_refresh_value -- [in] Characteristic value to notify.

Return values:
  • true -- Operation success.

  • false -- Operation failed.

Returns:

Notification action result.