LNS Exported Functions
- group LNS_Exported_Functions
Functions
-
uint8_t lns_add_service(void *p_func)
Add location and navigation service to the Bluetooth Host.
Example usage
void profile_init() { server_init(service_num); lns_id = lns_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 lns_set_parameter(T_LNS_PARAM_TYPE param_type, uint8_t len, void *p_value)
Set a Location and Navigation service parameter.
This function can be called with a Location and Navigation service parameter type and it will set the Location and Navigation service parameter. Location and Navigation service parameters are defined in T_LNS_PARAM_TYPE. If the “len” field sets to the size of a “uint16_t”, the “p_value” field must point to a data with type of “uint16_t”.
Example usage
void test(void) { T_LOCATION_AND_SPEED_VALUE_FLAG flag; flag.instantaneous_speed_present = 1; flag.total_distance_present = 1; flag.location_present = 1; flag.elevation_present = 1; flag.heading_present = 1; flag.rolling_time_present = 1; flag.utc_time_present = 1; flag.position_status = 1; flag.speed_and_distance_format = 1; flag.elevation_source = 1; flag.heading_source = 1; flag.rfu = 0; bool ret = lns_set_parameter(LNS_LAS_PARAM_INC_FLAG, 2, &flag); }
- Parameters:
param_type – [in] Location and Navigation service parameter type: T_LNS_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 pointer of uint16_t).
- Return values:
true – Operation success.
false – Operation failure.
- Returns:
Operation result.
-
bool lns_location_and_speed_value_notify(uint8_t conn_id, T_SERVER_ID service_id)
Send location and speed value notification data. Applications shall call lns_set_parameter with param_type LNS_LAS_PARAM_INC_FLAG to set location and speed value first, and then call this API to send the notification value.
Example usage
void test(void) { bool op_result = lns_location_and_speed_value_notify(conn_id, lns_id); }
- Parameters:
conn_id – [in] Connection ID.
service_id – [in] Service ID.
- Return values:
true – Operation success.
false – Operation failure.
- Returns:
Operation result.
Send navigation value notification data. Applications shall call lns_set_parameter with param_type LNS_NAVIGATION_PARAM_INC_FLAG to set navigation value first, and then call this API to send the notification value.
Example usage
void test(void) { bool op_result = lns_navigation_value_notify(conn_id, lns_id); }
- Parameters:
conn_id – [in] Connection ID.
service_id – [in] Service ID.
- Return values:
true – Operation success.
false – Operation failure.
- Returns:
Operation result.
-
uint8_t lns_add_service(void *p_func)