Bluetooth LE Profile API document
Bluetooth LE Profile API document Rev.1.00 [May 22, 2020]

Detailed Description

Functions

ble_status_t R_BLE_GATTC_Init (uint8_t cb_num)
 This function initializes the GATT Client and registers the number of the callbacks for GATT Client event. More...
 
ble_status_t R_BLE_GATTC_RegisterCb (ble_gattc_app_cb_t cb, uint8_t priority)
 This function registers a callback function for GATT Client event. More...
 
ble_status_t R_BLE_GATTC_DeregisterCb (ble_gattc_app_cb_t cb)
 This function deregisters the callback function for GATT Client event. More...
 
ble_status_t R_BLE_GATTC_ReqExMtu (uint16_t conn_hdl, uint16_t mtu)
 This function sends a MTU Exchange Request PDU to a GATT Server in order to change the current MTU. More...
 
ble_status_t R_BLE_GATTC_DiscAllPrimServ (uint16_t conn_hdl)
 This function discovers all Primary Services in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_DiscPrimServ (uint16_t conn_hdl, uint8_t *p_uuid, uint8_t uuid_type)
 This function discovers Primary Service specified by p_uuid in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_DiscAllSecondServ (uint16_t conn_hdl)
 This function discovers all Secondary Services in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_DiscIncServ (uint16_t conn_hdl, st_ble_gatt_hdl_range_t *p_range)
 This function discovers Included Services within the specified attribute handle range in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_DiscAllChar (uint16_t conn_hdl, st_ble_gatt_hdl_range_t *p_range)
 This function discovers Characteristic within the specified attribute handle range in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_DiscCharByUuid (uint16_t conn_hdl, uint8_t *p_uuid, uint8_t uuid_type, st_ble_gatt_hdl_range_t *p_range)
 This function discovers Characteristic specified by uuid within the specified attribute handle range in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_DiscAllCharDesc (uint16_t conn_hdl, st_ble_gatt_hdl_range_t *p_range)
 This function discovers Characteristic Descriptor within the specified attribute handle range in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_ReadChar (uint16_t conn_hdl, uint16_t value_hdl)
 This function reads a Characteristic/Characteristic Descriptor in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_ReadCharUsingUuid (uint16_t conn_hdl, uint8_t *p_uuid, uint8_t uuid_type, st_ble_gatt_hdl_range_t *p_range)
 This function reads a Characteristic in a GATT Server using a specified UUID. More...
 
ble_status_t R_BLE_GATTC_ReadLongChar (uint16_t conn_hdl, uint16_t value_hdl, uint16_t offset)
 This function reads a Long Characteristic in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_ReadMultiChar (uint16_t conn_hdl, st_ble_gattc_rd_multi_req_param_t *p_list)
 This function reads multiple Characteristics in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_WriteCharWithoutRsp (uint16_t conn_hdl, st_ble_gatt_hdl_value_pair_t *p_write_data)
 This function writes a Characteristic in a GATT Server without response. More...
 
ble_status_t R_BLE_GATTC_SignedWriteChar (uint16_t conn_hdl, st_ble_gatt_hdl_value_pair_t *p_write_data)
 This function writes Signed Data to a Characteristic in a GATT Server without response. More...
 
ble_status_t R_BLE_GATTC_WriteChar (uint16_t conn_hdl, st_ble_gatt_hdl_value_pair_t *p_write_data)
 This function writes a Characteristic in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_WriteLongChar (uint16_t conn_hdl, st_ble_gatt_hdl_value_pair_t *p_write_data, uint16_t offset)
 This function writes a Long Characteristic in a GATT Server. More...
 
ble_status_t R_BLE_GATTC_ReliableWrites (uint16_t conn_hdl, st_ble_gattc_reliable_writes_char_pair_t *p_char_pair, uint8_t pair_num, uint8_t auto_flag)
 This function performs the Reliable Writes procedure described in GATT Specification. More...
 
ble_status_t R_BLE_GATTC_ExecWrite (uint16_t conn_hdl, uint8_t exe_flag)
 If the auto execute of Reliable Writes is not specified by R_BLE_GATTC_ReliableWrites(), this function is used to execute a write to Characteristic. More...
 

Function Documentation

◆ R_BLE_GATTC_Init()

ble_status_t R_BLE_GATTC_Init ( uint8_t  cb_num)

This function initializes the GATT Client and registers the number of the callbacks for GATT Client event.

Specify the cb_num parameter to a value between 1 and BLE_GATTC_MAX_CB.
R_BLE_GATTC_RegisterCb() registers the callback.
The result of this API call is returned by a return value.

Parameters
[in]cb_numThe number of callbacks to be registered.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_ARG(0x0003)The cb_num parameter is out of range.

Events
none

Message Sequence Chart

◆ R_BLE_GATTC_RegisterCb()

ble_status_t R_BLE_GATTC_RegisterCb ( ble_gattc_app_cb_t  cb,
uint8_t  priority 
)

This function registers a callback function for GATT Client event.

The number of the callback that may be registered by this function is the value specified by R_BLE_GATTC_Init().
The result of this API call is returned by a return value.

Parameters
[in]cbCallback function for GATT Client event.

[in]priorityThe priority of the callback function.
Valid range is 1 <= priority <= BLE_GATTC_MAX_CB.
A lower priority number means a higher priority level.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The cb parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The priority parameter is out of range.
BLE_ERR_CONTEXT_FULL(0x000B)Host stack has already registered the maximum number of callbacks.

Events
none

Message Sequence Chart

◆ R_BLE_GATTC_DeregisterCb()

ble_status_t R_BLE_GATTC_DeregisterCb ( ble_gattc_app_cb_t  cb)

This function deregisters the callback function for GATT Client event.

The result of this API call is returned by a return value.

Parameters
[in]cbThe callback function to be deregistered.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The cb parameter is specified as NULL.
BLE_ERR_NOT_FOUND(0x000D)The callback has not been registered.

Events
none

◆ R_BLE_GATTC_ReqExMtu()

ble_status_t R_BLE_GATTC_ReqExMtu ( uint16_t  conn_hdl,
uint16_t  mtu 
)

This function sends a MTU Exchange Request PDU to a GATT Server in order to change the current MTU.

MTU Exchange Response is notified by BLE_GATTC_EVENT_EX_MTU_RSP event.
The new MTU is the minimum value of the mtu parameter specified by this function and the mtu field in BLE_GATTC_EVENT_EX_MTU_RSP event.
Default MTU size is 23 bytes.
The result of this API call is returned by a return value.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be sent.

[in]mtuThe maximum size(in bytes) of the GATT PDU that GATT Client can receive.
Valid range is 23 <= mtu <= 247.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_ARG(0x0003)The mtu parameter is out of range.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscAllPrimServ()

ble_status_t R_BLE_GATTC_DiscAllPrimServ ( uint16_t  conn_hdl)

This function discovers all Primary Services in a GATT Server.

When 16-bit UUID Primary Service has been discovered, BLE_GATTC_EVENT_PRIM_SERV_16_DISC_IND event is notified to the application layer.
When 128-bit UUID Primary Service has been discovered, BLE_GATTC_EVENT_PRIM_SERV_128_DISC_IND event is notified to the application layer.
When the Primary Service discovery has been completed, BLE_GATTC_EVENT_ALL_PRIM_SERV_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_OPERATION(0x0009)This function was called while processing other request.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscPrimServ()

ble_status_t R_BLE_GATTC_DiscPrimServ ( uint16_t  conn_hdl,
uint8_t *  p_uuid,
uint8_t  uuid_type 
)

This function discovers Primary Service specified by p_uuid in a GATT Server.

When Primary Service whose uuid is the same as the specified uuid has been discovered, BLE_GATTC_EVENT_PRIM_SERV_16_DISC_IND event or BLE_GATTC_EVENT_PRIM_SERV_128_DISC_IND event is notified to the application layer.
When the Primary Service discovery has been completed, BLE_GATTC_EVENT_PRIM_SERV_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.

[in]p_uuidUUID of Primary Service to be discovered.

[in]uuid_typeUUID type(16-bit or 128-bit).
macro description
BLE_GATT_16_BIT_UUID_FORMAT(0x01) 16-bit UUID
BLE_GATT_128_BIT_UUID_FORMAT(0x02) 128-bit UUID
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_uuid parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The uuid_type parameter is out of range.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscAllSecondServ()

ble_status_t R_BLE_GATTC_DiscAllSecondServ ( uint16_t  conn_hdl)

This function discovers all Secondary Services in a GATT Server.

When a 16-bit UUID Secondary Service has been discovered, BLE_GATTC_EVENT_SECOND_SERV_16_DISC_IND event is notified to the application layer.
When a 128-bit UUID Secondary Service has been discovered, BLE_GATTC_EVENT_SECOND_SERV_128_DISC_IND event is notified to the application layer.
When the Secondary Service discovery has been completed, BLE_GATTC_EVENT_ALL_SECOND_SERV_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscIncServ()

ble_status_t R_BLE_GATTC_DiscIncServ ( uint16_t  conn_hdl,
st_ble_gatt_hdl_range_t p_range 
)

This function discovers Included Services within the specified attribute handle range in a GATT Server.

When Included Service that includes 16-bit UUID Service has been discovered, BLE_GATTC_EVENT_INC_SERV_16_DISC_IND event is notified to the application layer.
When Included Service that includes 128-bit UUID Service has been discovered, BLE_GATTC_EVENT_INC_SERV_128_DISC_IND event is notified to the application layer.
When the Included Service discovery has been completed, BLE_GATTC_EVENT_INC_SERV_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.

[in]p_rangeRetrieval range of Included Service.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_range parameter is specified as NULL.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscAllChar()

ble_status_t R_BLE_GATTC_DiscAllChar ( uint16_t  conn_hdl,
st_ble_gatt_hdl_range_t p_range 
)

This function discovers Characteristic within the specified attribute handle range in a GATT Server.

When 16-bit UUID Characteristic has been discovered, BLE_GATTC_EVENT_CHAR_16_DISC_IND event is notified to the application layer.
When 128-bit UUID Characteristic has been discovered, BLE_GATTC_EVENT_CHAR_128_DISC_IND event is notified to the application layer.
When the Characteristic discovery has been completed, BLE_GATTC_EVENT_ALL_CHAR_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.

[in]p_rangeRetrieval range of Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_range parameter is specified as NULL.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscCharByUuid()

ble_status_t R_BLE_GATTC_DiscCharByUuid ( uint16_t  conn_hdl,
uint8_t *  p_uuid,
uint8_t  uuid_type,
st_ble_gatt_hdl_range_t p_range 
)

This function discovers Characteristic specified by uuid within the specified attribute handle range in a GATT Server.

When 16-bit UUID Characteristic has been discovered, BLE_GATTC_EVENT_CHAR_16_DISC_IND event is notified to the application layer.
When 128-bit UUID Characteristic has been discovered, BLE_GATTC_EVENT_CHAR_128_DISC_IND event is notified to the application layer.
When the Characteristic discovery has been completed, BLE_GATTC_EVENT_CHAR_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.

[in]p_uuidUUID of Characteristic to be discovered.

[in]uuid_typeUUID type of Characteristic to be discovered.
macro description
BLE_GATT_16_BIT_UUID_FORMAT(0x01) The p_uuid parameter is 16-bit UUID.
BLE_GATT_128_BIT_UUID_FORMAT(0x02) The p_uuid parameter is 128-bit UUID.


[in]p_rangeRetrieval range of Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_uuid parameter or the p_range parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The uuid_type parameter is out of range.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_DiscAllCharDesc()

ble_status_t R_BLE_GATTC_DiscAllCharDesc ( uint16_t  conn_hdl,
st_ble_gatt_hdl_range_t p_range 
)

This function discovers Characteristic Descriptor within the specified attribute handle range in a GATT Server.

When 16-bit UUID Characteristic Descriptor has been discovered, BLE_GATTC_EVENT_CHAR_DESC_16_DISC_IND event is notified to the application layer.
When 128-bit UUID Characteristic Descriptor has been discovered, BLE_GATTC_EVENT_CHAR_DESC_128_DISC_IND event is notified to the application layer.
When the Characteristic Descriptor discovery has been completed, BLE_GATTC_EVENT_ALL_CHAR_DESC_DISC_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be discovered.

[in]p_rangeRetrieval range of Characteristic Descriptor.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_range parameter is specified as NULL.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_ReadChar()

ble_status_t R_BLE_GATTC_ReadChar ( uint16_t  conn_hdl,
uint16_t  value_hdl 
)

This function reads a Characteristic/Characteristic Descriptor in a GATT Server.

The result of the read is notified in BLE_GATTC_EVENT_CHAR_READ_RSP event.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be read.

[in]value_hdlValue handle of the Characteristic/Characteristic Descriptor to be read.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_ARG(0x0003)0 is specified in the value_hdl parameter.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_ReadCharUsingUuid()

ble_status_t R_BLE_GATTC_ReadCharUsingUuid ( uint16_t  conn_hdl,
uint8_t *  p_uuid,
uint8_t  uuid_type,
st_ble_gatt_hdl_range_t p_range 
)

This function reads a Characteristic in a GATT Server using a specified UUID.

The result of the read is notified in BLE_GATTC_EVENT_CHAR_READ_BY_UUID_RSP event.

Parameters
[in]conn_hdlConnection handle that identifies Characteristic to be read to GATT Server.

[in]p_uuidUUID of the Characteristic to be read.

[in]uuid_typeUUID type of the Characteristic to be read.
macro description
BLE_GATT_16_BIT_UUID_FORMAT(0x01) The p_uuid parameter is 16-bit UUID.
BLE_GATT_128_BIT_UUID_FORMAT(0x02) The p_uuid parameter is 128-bit UUID.


[in]p_rangeRetrieval range of Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_uuid parameter or the p_range parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The uuid_type parameter is out of range.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_ReadLongChar()

ble_status_t R_BLE_GATTC_ReadLongChar ( uint16_t  conn_hdl,
uint16_t  value_hdl,
uint16_t  offset 
)

This function reads a Long Characteristic in a GATT Server.

The contents of the Long Characteristic that has been read is notified every MTU-1 bytes to the application layer by BLE_GATTC_EVENT_CHAR_READ_RSP event.
When all of the contents has been received in GATT Client, BLE_GATTC_EVENT_LONG_CHAR_READ_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be read.

[in]value_hdlValue handle of the Long Characteristic to be read.

[in]offsetOffset that indicates the location to be read.
Normally, set 0 to this parameter.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_ARG(0x0003)0 is specified in the value_hdl parameter.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_ReadMultiChar()

ble_status_t R_BLE_GATTC_ReadMultiChar ( uint16_t  conn_hdl,
st_ble_gattc_rd_multi_req_param_t p_list 
)

This function reads multiple Characteristics in a GATT Server.

The contents of the multiple Characteristics that has been read is notified to the application layer by BLE_GATTC_EVENT_MULTI_CHAR_READ_RSP event.

Parameters
[in]conn_hdlConnection handle that identifies Characteristic to be read to GATT Server.

[in]p_listList of Value Handles that point the Characteristics to be read.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_list parameter or the p_hdl_list field in the p_list parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)0 is specified in the list_count field in the p_list parameter.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_WriteCharWithoutRsp()

ble_status_t R_BLE_GATTC_WriteCharWithoutRsp ( uint16_t  conn_hdl,
st_ble_gatt_hdl_value_pair_t p_write_data 
)

This function writes a Characteristic in a GATT Server without response.

The result is returned from the API.

Parameters
[in]conn_hdlConnection handle that identifies Characteristic to be read to GATT Server.

[in]p_write_dataValue to be written to the Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_write_data parameter or the p_value field in the value field in the p_write_data parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The reason for this error is as follows:
  • 0 is specified in the value_len field in the p_value field in the p_write_data parameter.
  • 0 is specified in the attr_hdl field in the p_write_data parameter.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events
none

Message Sequence Chart

◆ R_BLE_GATTC_SignedWriteChar()

ble_status_t R_BLE_GATTC_SignedWriteChar ( uint16_t  conn_hdl,
st_ble_gatt_hdl_value_pair_t p_write_data 
)

This function writes Signed Data to a Characteristic in a GATT Server without response.

The result of this API call is returned by a return value.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be written.

[in]p_write_dataSigned Data to be written to the Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_write_data parameter or the p_value field in the value field in the p_write_data parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The reason for this error is as follows:
  • 0 is specified in the value_len field in the value field in the p_write_data parameter.
  • 0 is specified in the attr_hdl field in the p_write_data parameter.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function or Signed Data.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events
none

Message Sequence Chart

◆ R_BLE_GATTC_WriteChar()

ble_status_t R_BLE_GATTC_WriteChar ( uint16_t  conn_hdl,
st_ble_gatt_hdl_value_pair_t p_write_data 
)

This function writes a Characteristic in a GATT Server.

The result of the write is notified in BLE_GATTC_EVENT_CHAR_WRITE_RSP event.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be written.

[in]p_write_dataValue to be written to the Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_write_data parameter or the p_value field in the value field in the p_write_data parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The reason for this error is as follows:
  • 0 is specified in the value_len field in the value field in the p_write_data parameter.
  • 0 is specified in the attr_hdl field in the p_write_data parameter.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_WriteLongChar()

ble_status_t R_BLE_GATTC_WriteLongChar ( uint16_t  conn_hdl,
st_ble_gatt_hdl_value_pair_t p_write_data,
uint16_t  offset 
)

This function writes a Long Characteristic in a GATT Server.

The result of a write that has been done every segmentation is notified to the application layer in BLE_GATTC_EVENT_CHAR_PART_WRITE_RSP event.
The maximum writable size to a Long Characteristic with this function is 512 bytes.
When all of the contents has been written to the Long Characteristic, BLE_GATTC_EVENT_LONG_CHAR_WRITE_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be written.

[in]p_write_dataValue to be written to the Long Characteristic.

[in]offsetOffset that indicates the location to be written. Normally, set 0 to this parameter.
If this parameter sets to a value other than 0, adjust the offset parameter and the length of the value to be written not to exceed the length of the Long Characteristic.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The p_write_data parameter or the p_value field in the value field in the p_write_data parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The reason for this error is as follows:
  • The value_len field in the value field in the p_write_data parameter is 0.
  • The sum of the value_len field in the value field in the p_write_data parameter and the offset parameter larger than 512.
  • The attr_hdl field in the p_write_data parameter is 0.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_ReliableWrites()

ble_status_t R_BLE_GATTC_ReliableWrites ( uint16_t  conn_hdl,
st_ble_gattc_reliable_writes_char_pair_t p_char_pair,
uint8_t  pair_num,
uint8_t  auto_flag 
)

This function performs the Reliable Writes procedure described in GATT Specification.

When the data written to the Characteristic has been transmitted, BLE_GATTC_EVENT_CHAR_PART_WRITE_RSP event is notified to the application layer.
If the data included in the event is different from the data that GATT Client has sent, host stack automatically cancels the Reliable Writes.
After all of the contents has been sent to the GATT Server, if the auto_flag parameter has been set to BLE_GATTC_EXEC_AUTO, the GATT Server automatically writes the data to the Characteristic.
If the auto_flag parameter has been set to BLE_GATTC_EXEC_NOT_AUTO, BLE_GATTC_EVENT_RELIABLE_WRITES_TX_COMP event notifies the application layer in GATT Client that all of the contents has been sent to the GATT Server. Then GATT Client requests for writing the data to the Characteristic to the GATT Server with R_BLE_GATTC_ExecWrite().
When the write has been done, BLE_GATTC_EVENT_RELIABLE_WRITES_COMP event is notified to the application layer.

Parameters
[in]conn_hdlConnection handle identifying the GATT Server to be written.

[in]p_char_pairPair of Characteristic Value and Characteristic Value Handle identifying the Characteristic to be written by Reliable Writes.

[in]pair_numThe number of the pairs specified by the p_char_pair parameter.
Valid range is 0 < pair_num <= BLE_GATTC_RELIABLE_WRITES_MAX_CHAR_PAIR .

[in]auto_flagThe flag that indicates whether auto execution or not.
macro description
BLE_GATTC_EXEC_AUTO(0x01) Auto execution.
BLE_GATTC_EXEC_NOT_AUTO(0x02) Not auto execution.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_PTR(0x0001)The reason for this error is as follows:
  • The p_char_pair parameter is specified as NULL.
  • The p_value field in the value field in the write_data field in the p_char_pair parameter is specified as NULL.
BLE_ERR_INVALID_ARG(0x0003)The reason for this error is as follows:
  • The pair_num parameter or the auto_flag parameter is out of range.
  • The value_len field in the value field in the write_data field in the p_char_pair parameter is 0.
BLE_ERR_INVALID_OPERATION(0x0009)While processing other request, this function was called.
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function or to store the temporary write data.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart

◆ R_BLE_GATTC_ExecWrite()

ble_status_t R_BLE_GATTC_ExecWrite ( uint16_t  conn_hdl,
uint8_t  exe_flag 
)

If the auto execute of Reliable Writes is not specified by R_BLE_GATTC_ReliableWrites(), this function is used to execute a write to Characteristic.

When all of the contents has been sent to the GATT Server, BLE_GATTC_EVENT_RELIABLE_WRITES_TX_COMP event notifies the application layer.
After this event has been received, execute the write by this function.
The result of the write is notified by BLE_GATTC_EVENT_RELIABLE_WRITES_COMP event.

Parameters
[in]conn_hdlConnection handle identifying the target GATT Server.

[in]exe_flagThe flag that indicates whether execution or cancellation.
macro description
BLE_GATTC_EXECUTE_WRITE_CANCEL_FLAG(0x00) Execute the write.
BLE_GATTC_EXECUTE_WRITE_EXEC_FLAG(0x01) Cancel the write.
Return values
BLE_SUCCESS(0x0000)Success
BLE_ERR_INVALID_ARG(0x0003)The exe_flag parameter is out of range.
BLE_ERR_INVALID_OPERATION(0x0009)The reason for this error is as follows:
BLE_ERR_MEM_ALLOC_FAILED(0x000C)Insufficient memory is needed to generate this function.
BLE_ERR_INVALID_HDL(0x000E)The GATT Server specified by conn_hdl was not found.

Events

Message Sequence Chart