Hello.
I am developing with reference to multi-roll and central sample projects. One of the functions I want to implement is to send data from central to multi-role.
How to send data
・ Notify
・ Read
・ Write
I think that there are three, but because it is not sent regularly, “Write” was adopted.
Write used in the central project is to make Central start Notify for multi-role. The data is transmitted as 2-byte data as the CCCD value.
The structure used for transmission is shown below.
p_msg-> req.write_req.gattc_params.handle = handle_cccd;
p_msg-> req.write_req.gattc_params.len = WRITE_MESSAGE_LENGTH; ⇒2
p_msg-> req.write_req.gattc_params.p_value = p_msg-> req.write_req.gattc_value;
p_msg-> req.write_req.gattc_params.offset = 0;
p_msg-> req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_REQ;
p_msg-> req.write_req.gattc_value [0] = LSB_16 (cccd_val);
p_msg-> req.write_req.gattc_value [1] = MSB_16 (cccd_val);
p_msg-> conn_handle = conn_handle;
p_msg-> type = WRITE_REQ;
In this structure, the data is related
1.p_msg-> req.write_req.gattc_params.len
2.p_msg-> req.write_req.gattc_params.p_value
I thought. However, when len = 4 and p_value was set to "test", the operation on the central side stopped.
So return len = 2 and change write_op
When changed from BLE_GATT_OP_WRITE_REQ to BLE_GATT_OP_WRITE_CMD and executed,
BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE
Is displayed, but nothing is displayed on the multi-roll side. (When BLE_GATT_OP_WRITE_REQ, "BLE_GATTS_EVT_WRITE" was received)
To summarize the questions so far,
・ How to send 3 bytes or more data by Write?
・When using BLE_GATT_OP_WRITE_CMD as the method, which event is called on the multi-roll side (reception side)?
please teach me. Thank you.
The environment is as follows.
SoftDevice: S132
IDE: SES
BLE Device: NRF52832
SDK version: 15.30
Central project: ble_peripheral⇒ble_app_hrs_c
multirole project: experimental⇒ble_app_multirole_lesc