Object Server#

The Object Transfer Service(OTS) Static Object Server provides an instance of OTS Object Server implemented using static GATT. This component is instantiable, meaning that several named instances can be created. For each instance, a configuration header, an instance header and a source file is generated to encapsulate functionalities and initialize and manage the instance. These instance variables are available in a generated header file, sl_bt_ots_server_instances.h. The instances are initialized automatically after the boot event of the Bluetooth stack. Selecting this component will include the Object Transfer Service (OTS) Object Server Core component, which is the implementation of the OTS Object Server API.

Modules#

sl_bt_ots_server_capabilities_t

sl_bt_ots_server_callbacks_t

sl_bt_ots_server_client_db_entry_t

sl_bt_ots_server

Typedefs#

typedef struct sl_bt_ots_server *

OTS Object Server handle.

typedef void(*
sl_bt_ots_server_connection_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client)
typedef void(*
sl_bt_ots_subscription_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_subscription_status_t status)
typedef sl_bt_ots_olcp_response_code_t(*
sl_bt_ots_server_olcp_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_olcp_event_t event, sl_bt_ots_olcp_parameters_t *parameters, uint32_t *number_of_objects)
typedef sl_bt_ots_oacp_response_code_t(*
sl_bt_ots_server_oacp_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_oacp_event_t event, sl_bt_ots_oacp_parameters_t *parameters, sl_bt_ots_oacp_response_data_t *response_data, uint16_t *max_sdu, uint16_t *max_pdu)
sl_bt_ots_server_data_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, int32_t current_offset, void *data, int32_t size)
typedef void(*
sl_bt_ots_server_data_transfer_finished_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_transfer_result_t result)
typedef void(*
sl_bt_ots_server_data_transmit_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, uint32_t current_offset, uint32_t size, uint8_t **data, uint32_t *data_size)
typedef sl_bt_ots_object_metadata_write_response_code_t(*
sl_bt_ots_server_object_metadata_write_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_metadata_write_event_type_t event, sl_bt_ots_object_metadata_write_parameters_t *parameters)
typedef sl_bt_ots_object_metadata_read_response_code_t(*
sl_bt_ots_server_object_metadata_read_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_metadata_read_event_type_t event, sl_bt_ots_object_metadata_read_parameters_t *parameters)
typedef sl_bt_ots_object_metadata_write_response_code_t(*
sl_bt_ots_server_object_list_filter_wtite_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_list_filter_content_t *filter)
typedef sl_bt_ots_object_metadata_read_response_code_t(*
sl_bt_ots_server_object_list_filter_read_callback_t)(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_list_filter_content_t *filter)
typedef struct sl_bt_ots_server

OTS Object Server instance type.

Functions#

sl_status_t
sl_bt_ots_server_init(sl_bt_ots_server_handle_t server, sl_bt_ots_gattdb_handles_t *handles, sl_bt_ots_server_callbacks_t *callbacks)
sl_status_t
sl_bt_ots_server_set_current_object(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_properties_t *properties, sl_bt_ots_object_size_t *size)
sl_status_t
sl_bt_ots_server_get_current_object(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object)
sl_status_t
sl_bt_ots_server_abort(sl_bt_ots_server_handle_t server, uint16_t client)
sl_status_t
sl_bt_ots_server_object_changed(sl_bt_ots_server_handle_t server, sl_bt_ots_object_id_t *object, sl_bt_ots_object_changed_flags_t flags)
sl_status_t
sl_bt_ots_server_increase_credit(sl_bt_ots_server_handle_t server, uint16_t client, uint16_t credit)

Typedef Documentation#

sl_bt_ots_server_handle_t#

typedef struct sl_bt_ots_server* sl_bt_ots_server_handle_t

OTS Object Server handle.


Definition at line 69 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_connection_callback_t#

typedef void(* sl_bt_ots_server_connection_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client) )(sl_bt_ots_server_handle_t server, uint16_t client)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

OTS Object Server callback function prototype for client connection or disconnection


Definition at line 77 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_subscription_callback_t#

typedef void(* sl_bt_ots_subscription_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_subscription_status_t status) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_subscription_status_t status)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]status

Subscription status.

OTS callback function prototype for indication subscription status


Definition at line 86 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_olcp_callback_t#

typedef sl_bt_ots_olcp_response_code_t(* sl_bt_ots_server_olcp_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_olcp_event_t event, sl_bt_ots_olcp_parameters_t *parameters, uint32_t *number_of_objects) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_olcp_event_t event, sl_bt_ots_olcp_parameters_t *parameters, uint32_t *number_of_objects)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Object ID.

[in]event

OLCP event.

[in]parameters

OLCP event parameters.

[out]number_of_objects

Number of objects in case of that opcode/event.

OTS Object Server callback function prototype to handle OLCP events Returns

  • OLCP response code


Definition at line 100 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_oacp_callback_t#

typedef sl_bt_ots_oacp_response_code_t(* sl_bt_ots_server_oacp_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_oacp_event_t event, sl_bt_ots_oacp_parameters_t *parameters, sl_bt_ots_oacp_response_data_t *response_data, uint16_t *max_sdu, uint16_t *max_pdu) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_oacp_event_t event, sl_bt_ots_oacp_parameters_t *parameters, sl_bt_ots_oacp_response_data_t *response_data, uint16_t *max_sdu, uint16_t *max_pdu)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Object ID.

[in]event

OACP event.

[in]parameters

OACP event parameters.

[out]response_data

The response data

[inout]max_sdu

The Maximum Service Data Unit size the local channel endpoint can accept

Range: 23 to 65533.

Caller passes a suggested value of SDU as an input.

[inout]max_pdu

The maximum PDU payload size the local channel endpoint can accept

Range:23 to 252.

PDU and SDU are optimal when SDU = n * PDU + 2. Caller passes a suggested value of PDU as an input.

OTS Object Server callback function prototype to handle OACP events Returns

  • OACP response code


Definition at line 134 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_data_callback_t#

typedef sl_bt_ots_l2cap_credit_t(* sl_bt_ots_server_data_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, int32_t current_offset, void *data, int32_t size) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, int32_t current_offset, void *data, int32_t size)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Object ID.

[in]current_offset

Current offset from the beginning of the object.

[in]data

Pointer to the received data.

[in]size

Size of the received data.

OTS Object Server callback function prototype to handle data reception Returns

  • Credits to give to the transmitter.


Definition at line 153 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_data_transfer_finished_t#

typedef void(* sl_bt_ots_server_data_transfer_finished_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_transfer_result_t result) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_transfer_result_t result)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Object ID.

[in]result

Size of the data.

OTS Object Server callback function prototype to handle transmission status


Definition at line 167 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_data_transmit_callback_t#

typedef void(* sl_bt_ots_server_data_transmit_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, uint32_t current_offset, uint32_t size, uint8_t **data, uint32_t *data_size) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, uint32_t current_offset, uint32_t size, uint8_t **data, uint32_t *data_size)
Parameters
[in]server

Client handle.

[in]object

Object ID reference.

[in]offset

Current offset of requested data

[in]size

Maximum size of requested data

[out]data

Pointer of pointer to data

[out]data_size

Size of the provided data

OTS Object Server callback function prototype to handle data transmission


Definition at line 181 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_object_metadata_write_callback_t#

typedef sl_bt_ots_object_metadata_write_response_code_t(* sl_bt_ots_server_object_metadata_write_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_metadata_write_event_type_t event, sl_bt_ots_object_metadata_write_parameters_t *parameters) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_metadata_write_event_type_t event, sl_bt_ots_object_metadata_write_parameters_t *parameters)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Object ID.

[in]event

Metadata write event.

[in]parameters

Metadata event parameters.

OTS Object Server callback function prototype to handle metadata writes Returns

  • Response code


Definition at line 198 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_object_metadata_read_callback_t#

typedef sl_bt_ots_object_metadata_read_response_code_t(* sl_bt_ots_server_object_metadata_read_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_metadata_read_event_type_t event, sl_bt_ots_object_metadata_read_parameters_t *parameters) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t *object, sl_bt_ots_object_metadata_read_event_type_t event, sl_bt_ots_object_metadata_read_parameters_t *parameters)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Object ID.

[in]event

Metadata read event.

[out]parameters

Metadata event parameters to be filled.

OTS Object Server callback function prototype to handle metadata writes Returns

  • Response code


Definition at line 213 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_object_list_filter_wtite_callback_t#

typedef sl_bt_ots_object_metadata_write_response_code_t(* sl_bt_ots_server_object_list_filter_wtite_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_list_filter_content_t *filter) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_list_filter_content_t *filter)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]filter

Pointer to the filter

OTS Object Server callback function prototype to set Object List Filter Returns

  • Response code


Definition at line 226 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_object_list_filter_read_callback_t#

typedef sl_bt_ots_object_metadata_read_response_code_t(* sl_bt_ots_server_object_list_filter_read_callback_t) (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_list_filter_content_t *filter) )(sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_list_filter_content_t *filter)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[out]filter

Pointer to the filter to be filled.

OTS Object Server callback function prototype to get Object List Filter Returns

  • Response code


Definition at line 237 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_t#

typedef struct sl_bt_ots_server sl_bt_ots_server_t

OTS Object Server instance type.


Definition at line 283 of file common/ots/inc/sl_bt_ots_server.h

Function Documentation#

sl_bt_ots_server_init#

sl_status_t sl_bt_ots_server_init (sl_bt_ots_server_handle_t server, sl_bt_ots_gattdb_handles_t * handles, sl_bt_ots_server_callbacks_t * callbacks)
Parameters
[in]server

Server handle.

[in]handles

GATT database handles.

[in]callbacks

Callbacks to handle requests.

Initialize the OTS Object Server. Returns

  • Response code


Definition at line 295 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_set_current_object#

sl_status_t sl_bt_ots_server_set_current_object (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t * object, sl_bt_ots_object_properties_t * properties, sl_bt_ots_object_size_t * size)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]object

Pointer to the Object ID. If NULL, Current Object will set to Invalid Object.

[in]properties

Pointer to the Object Properties. If NULL, all OACP actions will be passed using the callbacks. If not NULL, the server will respond with OACP response codes automatically and pass only the OACP operations those are permitted by the given object properties.

[in]size

Pointer to the Object Size. If NULL, all OACP actions will be passed using the callbacks. If not NULL, the server will respond with OACP response codes automatically and pass only the OACP operations those are permitted by the given object size and server capability configuration.

Set the current object on the server for the specified client Returns

  • Response code


Definition at line 318 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_get_current_object#

sl_status_t sl_bt_ots_server_get_current_object (sl_bt_ots_server_handle_t server, uint16_t client, sl_bt_ots_object_id_t * object)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[out]object

Pointer to the Object ID.

Get the current object on the server for the specified client Returns

  • Response code


Definition at line 331 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_abort#

sl_status_t sl_bt_ots_server_abort (sl_bt_ots_server_handle_t server, uint16_t client)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

Abort transmission on the Object Server instance for a specified client. Returns

  • Response code


Definition at line 341 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_object_changed#

sl_status_t sl_bt_ots_server_object_changed (sl_bt_ots_server_handle_t server, sl_bt_ots_object_id_t * object, sl_bt_ots_object_changed_flags_t flags)
Parameters
[in]server

Server handle.

[in]object

Pointer to the Object ID.

[in]flags

The following masks can be used to indicate the nature of change:

  • SL_BT_OTS_OBJECT_CHANGE_CONTENTS_MASK : object contents changed

  • SL_BT_OTS_OBJECT_CHANGE_METADATA_MASK : metadata changed

  • SL_BT_OTS_OBJECT_CHANGE_CREATION_MASK : object creation

  • SL_BT_OTS_OBJECT_CHANGE_DELETION_MASK : object deletion

Indicate that an object has been changed on the server. Returns

  • Response code


Definition at line 356 of file common/ots/inc/sl_bt_ots_server.h

sl_bt_ots_server_increase_credit#

sl_status_t sl_bt_ots_server_increase_credit (sl_bt_ots_server_handle_t server, uint16_t client, uint16_t credit)
Parameters
[in]server

Server handle.

[in]client

Connection handle for the client.

[in]credit

Number of credit to give (in packets).

Increase the credit for the L2CAP transfer that is in progress Returns

  • Response code


Definition at line 367 of file common/ots/inc/sl_bt_ots_server.h

Macro Definition Documentation#

SL_BT_OTS_SERVER_CONFIG_INDICATION_QUEUE_SIZE#

#define SL_BT_OTS_SERVER_CONFIG_INDICATION_QUEUE_SIZE
Value:
5

Definition at line 45 of file common/ots/config/sl_bt_ots_server_config.h