对象传输服务
对象传输服务提供了管理和控制功能,这些功能支持通过一个独立的面向连接的逻辑链路控制与适配协议进行的批量数据传输。
示例
API 参考
Header File
Functions
-
esp_err_t esp_ble_ots_get_feature(esp_ble_ots_feature_t *out_val)
Read the value of OTS Feature Characteristic.
- 参数
out_val – [out] The pointer to store the OTS Feature Value.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_feature(esp_ble_ots_feature_t *in_val)
Set the value of OTS Feature Characteristic.
- 参数
in_val – [in] The pointer to store OTS Feature value.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_name(uint8_t *out_buf, size_t buf_len, size_t *out_len)
Read the value of Object Name Characteristic.
- 参数
out_buf – [out] The pointer to store the Object Name.
buf_len – [in] Maximum length of the output buffer.
out_len – [out] The pointer to store the actual length of the Object Name (can be NULL if not needed).
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_name(const uint8_t *in_val, size_t in_len)
Set the Object Name Characteristic value.
- 参数
in_val – [in] The pointer to the Object Name data.
in_len – [in] The length of the Object Name data.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_type(uint16_t *out_val)
Read the value of Object Type Characteristic value.
- 参数
out_val – [out] The pointer to store the Object Type.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_type(uint16_t *in_val)
Set the Object Type Characteristic value.
- 参数
in_val – [in] The pointer to store Object Type.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_size(esp_ble_ots_size_t *out_val)
Read the value of Object Size Characteristic value.
- 参数
out_val – [out] The pointer to store the Object Size.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_size(esp_ble_ots_size_t *in_val)
Set the Object Size Characteristic value.
- 参数
in_val – [in] The pointer to store Object Size.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_first_create_time(esp_ble_ots_utc_t *out_val)
Read the value of Object First Create Characteristic value.
- 参数
out_val – [out] The pointer to store the Object First Create Time.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_first_create_time(esp_ble_ots_utc_t *in_val)
Set the Object First Create Characteristic value.
- 参数
in_val – [in] The pointer to store the Object First Create Time.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_last_modify_time(esp_ble_ots_utc_t *out_val)
Read the value of Object Last Modify Characteristic value.
- 参数
out_val – [out] The pointer to store the Object Last Modify Time.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_last_modify_time(esp_ble_ots_utc_t *in_val)
Set the Object Last Modify Characteristic value.
- 参数
in_val – [in] The pointer to store the Object Last Modify Time.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_id(esp_ble_ots_id_t *out_val)
Read the value of Object ID value.
- 参数
out_val – [out] The pointer to store the Object ID.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_id(esp_ble_ots_id_t *in_val)
Set the Object ID value.
- 参数
in_val – [in] The pointer to store the Object ID.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_prop(esp_ble_ots_prop_t *out_val)
Read the value of Object Properties value.
- 参数
out_val – [out] The pointer to store the Object Properties.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_prop(esp_ble_ots_prop_t *in_val)
Set the Object Properties value.
- 参数
in_val – [in] The pointer to store the Object Properties.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_oacp(esp_ble_ots_oacp_t *out_val)
Read the value of Object Action Control Point value.
- 参数
out_val – [out] The pointer to store the Object Action Control Point.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_oacp(esp_ble_ots_oacp_t *in_val, bool need_send)
Set the Object Action Control Point value.
- 参数
in_val – [in] The pointer to store the Object Action Control Point value
need_send – [in] If set to true, the OACP Value will send to remote client.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_olcp(esp_ble_ots_olcp_t *out_val)
Read the value of Object List Control Point value.
- 参数
out_val – [out] The pointer to store the Object List Control Point.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_olcp(esp_ble_ots_olcp_t *in_val, bool need_send)
Set the Object List Control Point value.
- 参数
in_val – [in] The pointer to store the Object List Control Point value
need_send – [in] If set to true, the OLCP Value will send to remote client.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_filter(esp_ble_ots_filter_t *out_val)
Read the value of Object Filter value.
- 参数
out_val – [out] The pointer to store the Object Filter.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_filter(esp_ble_ots_filter_t *in_val)
Set the value of Object Filter value.
- 参数
in_val – [in] The pointer to store the Object Filter.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_get_change(esp_ble_ots_change_t *out_val)
Read the value of Object Change value.
- 参数
out_val – [out] The pointer to store the Object Change.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong parameter
-
esp_err_t esp_ble_ots_set_change(esp_ble_ots_change_t *in_val, bool need_send)
Set the Object Change value.
- 参数
in_val – [in] The pointer to store the Object Change.
need_send – [in] If set to true, the Object Change value will send to remote client.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
-
esp_err_t esp_ble_ots_init(void)
Initialization Object Transfer Service.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong initialization
ESP_ERR_NO_MEM if failed to create mutex
ESP_FAIL on error
-
esp_err_t esp_ble_ots_deinit(void)
Deinitialization Object Transfer Service.
- 返回
ESP_OK on successful
ESP_ERR_INVALID_ARG on wrong deinitialization
ESP_FAIL on error
Structures
-
struct esp_ble_ots_feature_t
OTS Feature Characteristic.
Public Members
-
uint32_t create_op
Create Op Code Supported. 0: False, 1: True
-
uint32_t delete_op
Delete Op Code Supported. 0: False, 1: True
-
uint32_t calculate_op
Calculate Checksum Op Code Supported. 0: False, 1: True
-
uint32_t execute_op
Execute Op Code Supported. 0: False, 1: True
-
uint32_t read_op
Read Op Code Supported. 0: False, 1: True
-
uint32_t write_op
Write Op Code Supported. 0: False, 1: True
-
uint32_t appending_op
Appending Op Code Supported. 0: False, 1: True
-
uint32_t truncation_op
Truncation Op Code Supported. 0: False, 1: True
-
uint32_t patching_op
Patching Op Code Supported. 0: False, 1: True
-
uint32_t abort_op
Abort Op Code Supported. 0: False, 1: True
-
struct esp_ble_ots_feature_t::[anonymous] oacp
The structure of the OACP Features field
-
uint32_t goto_op
Go to Op Code Supported. 0: False, 1: True
-
uint32_t order_op
Order Op Code Supported. 0: False, 1: True
-
uint32_t req_num_op
Request Number of Objects Op Code Supported. 0: False, 1: True
-
uint32_t clear_mark_op
Clear Marking Op Code Supported. 0: False, 1: True
-
struct esp_ble_ots_feature_t::[anonymous] olcp
The structure of the OLCP Features field
-
uint32_t create_op
-
struct esp_ble_ots_size_t
Object Size Characteristic.
-
struct esp_ble_ots_utc_t
UTC.
Public Members
-
uint16_t year
Year as defined by the Gregorian calendar, Valid range 1582 to 9999
-
uint8_t month
Month of the year as defined by the Gregorian calendar, Valid range 1 (January) to 12 (December)
-
uint8_t day
Day of the month as defined by the Gregorian calendar, Valid range 1 to 31
-
uint8_t hours
Number of hours past midnight, Valid range 0 to 23
-
uint8_t minutes
Number of minutes since the start of the hour. Valid range 0 to 59
-
uint8_t seconds
Number of seconds since the start of the minute. Valid range 0 to 59
-
uint16_t year
-
struct esp_ble_ots_id_t
Object ID.
Public Members
-
uint8_t id[6]
Allocated ID. Valid range 0x000000000100 to 0xffffffffffff
-
uint8_t id[6]
-
struct esp_ble_ots_prop_t
Object Properties Characteristic.
Public Members
-
uint32_t delete_prop
Deletion of this object is permitted. 0: False, 1: True
-
uint32_t execute_prop
Execute of this object is permitted. 0: False, 1: True
-
uint32_t read_prop
Reading of this object is permitted. 0: False, 1: True
-
uint32_t write_prop
Writing of this object is permitted. 0: False, 1: True
-
uint32_t append_prop
Appending of this object is permitted. 0: False, 1: True
-
uint32_t truncate_prop
Truncation of this object is permitted. 0: False, 1: True
-
uint32_t patch_prop
Patching of this object is permitted. 0: False, 1: True
-
uint32_t mark_prop
This object is a marked object. 0: False, 1: True
-
uint32_t delete_prop
-
struct esp_ble_ots_oacp_t
Object Action Control Point (OACP)
-
struct esp_ble_ots_olcp_t
Object List Control Point (OLCP)
-
struct esp_ble_ots_olcp_rsp_t
Object List Control Point (OLCP) Response Value.
-
struct esp_ble_ots_filter_t
Object List Filter Characteristic.
-
struct esp_ble_ots_change_t
Object Change Characteristic.
Macros
-
BLE_OTS_ATT_VAL_LEN
Attribute value length
-
BLE_OTS_UUID16
-
BLE_OTS_CHR_UUID16_OTS_FEATURE
-
BLE_OTS_CHR_UUID16_OBJECT_NAME
-
BLE_OTS_CHR_UUID16_OBJECT_TYPE
-
BLE_OTS_CHR_UUID16_OBJECT_SIZE
-
BLE_OTS_CHR_UUID16_OBJECT_FIRST_CREATED
-
BLE_OTS_CHR_UUID16_OBJECT_LAST_MODIFIED
-
BLE_OTS_CHR_UUID16_OBJECT_ID
-
BLE_OTS_CHR_UUID16_OBJECT_PROP
-
BLE_OTS_CHR_UUID16_OBJECT_ACTION_CONTROL_POINT
-
BLE_OTS_CHR_UUID16_OBJECT_LIST_CONTROL_POINT
-
BLE_OTS_CHR_UUID16_OBJECT_LIST_FILTER
-
BLE_OTS_CHR_UUID16_OBJECT_CHANGED
-
BLE_OTS_OACP_CREATE
-
BLE_OTS_OACP_DELETE
-
BLE_OTS_OACP_CALCULATE_CHECKSUM
-
BLE_OTS_OACP_EXECUTE
-
BLE_OTS_OACP_READ
-
BLE_OTS_OACP_WRITE
-
BLE_OTS_OACP_ABORT
-
BLE_OTS_OACP_RESPONSE
-
BLE_OTS_OACP_RSP_SUCCESS
-
BLE_OTS_OACP_RSP_NOT_SUPPORT
-
BLE_OTS_OACP_RSP_INVALID_PARAMETER
-
BLE_OTS_OACP_RSP_INSUFFICIENT_RESOURCES
-
BLE_OTS_OACP_RSP_INVALID_OBJECT
-
BLE_OTS_OACP_RSP_CHANNEL_UNAVAILABLE
-
BLE_OTS_OACP_RSP_UNSUPPORT_TYPE
-
BLE_OTS_OACP_RSP_NOT_PERMIT
-
BLE_OTS_OACP_RSP_OBJECT_LOCK
-
BLE_OTS_OACP_RSP_OPERATION_FAIL
-
BLE_OTS_OLCP_FIRST
-
BLE_OTS_OLCP_LAST
-
BLE_OTS_OLCP_PREVIOUS
-
BLE_OTS_OLCP_NEXT
-
BLE_OTS_OLCP_GO_TO
-
BLE_OTS_OLCP_ORDER
-
BLE_OTS_OLCP_REQ_NUM_OF_OBJ
-
BLE_OTS_OLCP_CLEAR_MARK
-
BLE_OTS_OLCP_RESPONSE
-
BLE_OTS_OLCP_SORT_BY_NAME_ASCENDING
-
BLE_OTS_OLCP_SORT_BY_TYPE_ASCENDING
-
BLE_OTS_OLCP_SORT_BY_SIZE_ASCENDING
-
BLE_OTS_OLCP_SORT_BY_FIRST_CREATE_TIME_ASCENDING
-
BLE_OTS_OLCP_SORT_BY_LAST_MODIFY_TIME_ASCENDING
-
BLE_OTS_OLCP_SORT_BY_NAME_DESCENDING
-
BLE_OTS_OLCP_SORT_BY_TYPE_DESCENDING
-
BLE_OTS_OLCP_SORT_BY_SIZE_DESCENDING
-
BLE_OTS_OLCP_SORT_BY_FIRST_CREATE_TIME_DESCENDING
-
BLE_OTS_OLCP_SORT_BY_LAST_MODIFY_TIME_DESCENDING
-
BLE_OTS_OLCP_RSP_SUCCESS
-
BLE_OTS_OLCP_RSP_NOT_SUPPORT
-
BLE_OTS_OLCP_RSP_INVALID_PARAMETER
-
BLE_OTS_OLCP_RSP_OPERATION_FAIL
-
BLE_OTS_OLCP_RSP_OUT_OF_BOUNDS
-
BLE_OTS_OLCP_RSP_TOO_MANY_OBJECTS
-
BLE_OTS_OLCP_RSP_NO_OBJECT
-
BLE_OTS_OLCP_RSP_OBJECT_ID_NOT_FOUND
-
BLE_OTS_FILTER_NAME_START
-
BLE_OTS_FILTER_NAME_END
-
BLE_OTS_FILTER_NAME_CONTAIN
-
BLE_OTS_FILTER_NAME_EXACTLY
-
BLE_OTS_FILTER_OBJ_TYPE
-
BLE_OTS_FILTER_CREATE_TIME
-
BLE_OTS_FILTER_MODIFY_TIME
-
BLE_OTS_FILTER_CURRENT_SIZE
-
BLE_OTS_FILTER_ALLOC_SIZE
-
BLE_OTS_FILTER_MARK_OBJECT
-
BLE_OTS_OBJ_CHG_SRC
-
BLE_OTS_OBJ_CHG_CONTENT
-
BLE_OTS_OBJ_CHG_METADATA
-
BLE_OTS_OBJ_CHG_CREATION
-
BLE_OTS_OBJ_CHG_DELETION