Object Transfer Service

nRF5 SDK v17.1.0

Object Transfer Service module. More...

Data Structures

union ble_ots_obj_properties_t
Properties of an Object Transfer Service object. More...
struct ble_ots_obj_type_t
A structure representing the object type. More...
struct ble_ots_object_t
The structure representing one Object Transfer Service object. More...
struct ble_ots_object_evt_t
The definition of an event from the object characteristics. More...
struct ble_ots_object_chars_init_t
Initialization properties of the Object Transfer Service Object characteristics. More...
struct ble_ots_object_chars_t
The structure holding the state of the OTS object characteristics. More...
struct ble_ots_l2cap_evt_t
l2cap event. More...
struct ble_ots_l2cap_s
The structure holding the l2cap connection oriented channels state. More...
struct ble_ots_l2cap_init_t
The initialization structure of the l2cap module. More...
struct ble_ots_oacp_proc_t
struct ble_ots_oacp_evt_t
Definition of an OACP event. More...
struct ble_ots_oacp_init_t
OACP initialization properties. More...
struct ble_ots_oacp_s
struct ble_ots_evt_t
This structure represents the state of the Object Transfer Service. More...
struct ble_ots_init_t
Structure for initializing the OTS. More...
struct ble_ots_s

Macros

#define BLE_OTS_DEF (_name)
Macro for defining a ble_ots instance. More...
#define NRF_BLE_OTS_SIZE_CHAR_LEN (2*sizeof(uint32_t))
#define BLE_OTS_FEATURE_LEN (2*sizeof(uint32_t))
#define BLE_OTS_NAME_MAX_SIZE 128
#define BLE_OTS_MAX_OBJ_SIZE 1028
#define BLE_OTS_INVALID_CID 0x0000
#define BLE_OTS_PSM 0x0025
#define BLE_OTS_MAX_OACP_SIZE 21
#define BLE_OTS_WRITE_MODE_TRUNCATE (1 << 1)
#define BLE_OTS_WRITE_MODE_NO_TRUNCATE 0

Typedefs

typedef struct ble_ots_s ble_ots_t
typedef struct ble_ots_oacp_s ble_ots_oacp_t
typedef struct ble_ots_l2cap_s ble_ots_l2cap_t
typedef void(* ble_ots_l2cap_evt_handler_t )( ble_ots_l2cap_t *p_ots_l2cap, ble_ots_l2cap_evt_t *p_evt)
L2CAP event handler.
typedef void(* ble_ots_evt_handler_t )( ble_ots_t *p_ots, ble_ots_evt_t *p_evt)
OTS event handler.

Enumerations

enum ble_ots_l2cap_evt_type_t {
BLE_OTS_L2CAP_EVT_CH_CONNECTED ,
BLE_OTS_L2CAP_EVT_CH_DISCONNECTED ,
BLE_OTS_L2CAP_EVT_SEND_COMPLETE ,
BLE_OTS_L2CAP_EVT_RECV_COMPLETE
}
L2cap event types.
enum ble_ots_oacp_proc_type_t {
BLE_OTS_OACP_PROC_CREATE = 0x01,
BLE_OTS_OACP_PROC_DELETE = 0x02,
BLE_OTS_OACP_PROC_CALC_CHKSUM = 0x03,
BLE_OTS_OACP_PROC_EXECUTE = 0x04,
BLE_OTS_OACP_PROC_READ = 0x05,
BLE_OTS_OACP_PROC_WRITE = 0x06,
BLE_OTS_OACP_PROC_ABORT = 0x07,
BLE_OTS_OACP_PROC_RESP = 0x60
}
enum ble_ots_oacp_res_code_t {
BLE_OTS_OACP_RES_SUCCESS = 0x01,
BLE_OTS_OACP_RES_OPCODE_NOT_SUP = 0x02,
BLE_OTS_OACP_RES_INV_PARAM = 0x03,
BLE_OTS_OACP_RES_INSUFF_RES = 0x04,
BLE_OTS_OACP_RES_INV_OBJ = 0x05,
BLE_OTS_OACP_RES_CHAN_UNAVAIL = 0x06,
BLE_OTS_OACP_RES_UNSUP_TYPE = 0x07,
BLE_OTS_OACP_RES_NOT_PERMITTED = 0x08,
BLE_OTS_OACP_RES_OBJ_LOCKED = 0x09,
BLE_OTS_OACP_RES_OPER_FAILED = 0x0A
}
enum ble_ots_evt_type_t {
BLE_OTS_EVT_OACP ,
BLE_OTS_EVT_OBJECT ,
BLE_OTS_EVT_INDICATION_ENABLED ,
BLE_OTS_EVT_INDICATION_DISABLED ,
BLE_OTS_EVT_OBJECT_RECEIVED
}
The event type indicates which module the event is connected to. More...

Functions

uint32_t ble_ots_init ( ble_ots_t *p_ots, ble_ots_init_t *p_ots_init)
Function for initializing the Object Transfer Service. More...
void ble_ots_on_ble_evt ( ble_evt_t const *p_ble_evt, void *p_context)
Function for handling the Application's BLE Stack events. More...
uint32_t ble_ots_object_set_name ( ble_ots_object_chars_t *p_ots_object_chars, ble_ots_object_t *p_object, char const *new_name)
Function for setting the name of an object. More...
uint32_t ble_ots_object_set_type ( ble_ots_object_chars_t *p_ots_object_chars, ble_ots_object_t *p_object, ble_ots_obj_type_t *p_new_type)
Function for setting the type of an object. More...
uint32_t ble_ots_object_set_current_size ( ble_ots_object_chars_t *p_ots_object_chars, ble_ots_object_t *p_object, uint32_t new_current_size)
Function for setting the current size of an object. More...
uint32_t ble_ots_object_set_properties ( ble_ots_object_chars_t *p_ots_object_chars, ble_ots_object_t *p_object, ble_ots_obj_properties_t *p_new_properties)
Function for setting the properties of an object. More...

Detailed Description

Object Transfer Service module.

This is the main module of the OTS service.

Macro Definition Documentation

#define BLE_OTS_DEF ( _name )

Macro for defining a ble_ots instance.

Parameters
_name Name of the instance.
#define BLE_OTS_INVALID_CID   0x0000

Invalid connection ID.

Enumeration Type Documentation

The event type indicates which module the event is connected to.

Enumerator
BLE_OTS_EVT_OBJECT_RECEIVED

If this event is received, data is now available in the current object.

< Types of Object Action Control Point Procedures.

Enumerator
BLE_OTS_OACP_PROC_CREATE

Create object.

BLE_OTS_OACP_PROC_DELETE

Delete object.

BLE_OTS_OACP_PROC_CALC_CHKSUM

Calculate Checksum.

BLE_OTS_OACP_PROC_EXECUTE

Execute Object.

BLE_OTS_OACP_PROC_READ

Read object.

BLE_OTS_OACP_PROC_WRITE

Write object.

BLE_OTS_OACP_PROC_ABORT

Abort object.

BLE_OTS_OACP_PROC_RESP

Procedure response.

Enumerator
BLE_OTS_OACP_RES_SUCCESS

Success.

BLE_OTS_OACP_RES_OPCODE_NOT_SUP

Not supported.

BLE_OTS_OACP_RES_INV_PARAM

Invalid parameter.

BLE_OTS_OACP_RES_INSUFF_RES

Insufficient resources.

BLE_OTS_OACP_RES_INV_OBJ

Invalid object.

BLE_OTS_OACP_RES_CHAN_UNAVAIL

Channel unavailable.

BLE_OTS_OACP_RES_UNSUP_TYPE

Unsupported procedure.

BLE_OTS_OACP_RES_NOT_PERMITTED

Procedure not permitted.

BLE_OTS_OACP_RES_OBJ_LOCKED

Object locked.

BLE_OTS_OACP_RES_OPER_FAILED

Operation Failed.

Function Documentation

uint32_t ble_ots_init ( ble_ots_t * p_ots ,
ble_ots_init_t * p_ots_init
)

Function for initializing the Object Transfer Service.

Parameters
[out] p_ots Object Transfer Service structure. This structure will have to be supplied by the application. It will be initialized by this function, and will later be used to identify this particular service instance.
[in] p_ots_init Information needed to initialize the service.
Returns
NRF_SUCCESS on successful initialization of service, otherwise an error code.
uint32_t ble_ots_object_set_current_size ( ble_ots_object_chars_t * p_ots_object_chars ,
ble_ots_object_t * p_object ,
uint32_t new_current_size
)

Function for setting the current size of an object.

If p_object is the current selected object, and the notifications is enabled, the client will be notified that the object has changed.

Note
If the new current size is smaller than the current size, the object will be truncated.
Parameters
[in] p_ots_object_chars Object Transfer Service Object Characteristics structure.
[in] p_object Pointer to the object where the current size will be changed.
[in] new_current_size The new current size of the object.
Returns
NRF_SUCCESS On success, otherwise an error code.
uint32_t ble_ots_object_set_name ( ble_ots_object_chars_t * p_ots_object_chars ,
ble_ots_object_t * p_object ,
char const * new_name
)

Function for setting the name of an object.

If p_object is the current selected object, and the notifications is enabled, the client will be notified that the object has changed.

Note
If the name of the object is "" on disconnection, the object will be invalidated.
Parameters
[in] p_ots_object_chars Object Transfer Service Object Characteristics structure.
[in] p_object Pointer to the object where the name will be changed.
[in] new_name The new name of the object.
Returns
NRF_SUCCESS On success, otherwise an error code.
uint32_t ble_ots_object_set_properties ( ble_ots_object_chars_t * p_ots_object_chars ,
ble_ots_object_t * p_object ,
ble_ots_obj_properties_t * p_new_properties
)

Function for setting the properties of an object.

If p_object is the current selected object, and the notifications is enabled, the client will be notified that the object has changed.

Parameters
[in] p_ots_object_chars Object Transfer Service Object Characteristics structure.
[in] p_object Pointer to the object where the properties will be changed.
[in] p_new_properties The properties of the object.
Returns
NRF_SUCCESS On success, otherwise an error code.
uint32_t ble_ots_object_set_type ( ble_ots_object_chars_t * p_ots_object_chars ,
ble_ots_object_t * p_object ,
ble_ots_obj_type_t * p_new_type
)

Function for setting the type of an object.

If p_object is the current selected object, and the notifications is enabled, the client will be notified that the object has changed.

Parameters
[in] p_ots_object_chars Object Transfer Service Object Characteristics structure.
[in] p_object Pointer to the object where the type will be changed.
[in] p_new_type Pointer to the new type of the object.
Returns
NRF_SUCCESS On success, otherwise an error code.
void ble_ots_on_ble_evt ( ble_evt_t const * p_ble_evt ,
void * p_context
)

Function for handling the Application's BLE Stack events.

Handles all events from the BLE stack of interest to the Object Transfer Service.

Parameters
[in] p_ble_evt Event received from the BLE stack.
[in] p_context Object Transfer Service structure.