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 scan parameter service parameter type and it will set the scan parameter service parameter. Scan parameter service parameters are defined in T_SPS_PARAM_TYPE. If the “len” field is set to the size of a “uint16_t”, the “p_value” field must point to data of type “uint16_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. This is dependent on the parameter type and will be cast to the appropriate data type (For example: if data type of param is uint16_t, p_value will be cast to a pointer of uint16_t).

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.