This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How do I do Sample Data write from Central to Peripheral device via WRITE_REQ

Hi,

I'm using Central multilink peripheral example to get connected with Our Custom Peripheral App (iOS). I'm able to receive the data from Peripheral device, Now i need to SEND the data to peripheral App.

Can someone suggest me an example from where i can do a sample data write to peripheral device via WRITE_REQ, the characteristic type is NOTIFY, WRITE. Let me know also if type needs to be modified as well??

Thanks Brajesh

Parents
  • You should have a look at nRF UART for iOS, source code available here.

    For the peripheral part you should have a a look at tx_char_add() in ble_app_uart.

    You should set

    char_md.char_props.write         = 1;
    

    and

    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);
    

    Edit 17.08.2015: Sorry, I was a bit quick on the trigger there.

    I recommend having a look at ble_app_uart_c. Available on Github here. More specifically ble_uart_c_write_string()

  • It means "The attribute handle given was not valid on this server." It could be that you are trying to write to the CCCD, which doesn't exist if you remove the notify type. Are you sure you are using attribute handle of the characterisitic value? Not the attribute handle of the CCCD? Have you tested your iOS peripheral with another central application? For example Master Control Panel for PC, or nRF Master Control Panel for Android?

Reply
  • It means "The attribute handle given was not valid on this server." It could be that you are trying to write to the CCCD, which doesn't exist if you remove the notify type. Are you sure you are using attribute handle of the characterisitic value? Not the attribute handle of the CCCD? Have you tested your iOS peripheral with another central application? For example Master Control Panel for PC, or nRF Master Control Panel for Android?

Children
No Data
Related