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()

  • Thanks Petter,

    I see a problem here. I'm trying to use the same API to write data to Peripheral. For that i needed, cccd_handle and connection handle that i extracted after connecting with iPhone peripheral.

    Initially i was getting error no 17(BUSY) , but now i get "READ/WRITE API Returns Success log" though the iOS App doesn't get anything at all.

    To validate the API, i tried to write on nRF Peripheral device instead of iPhone App. There i get EVT_WRITE twice (Once for notif_enable from Central and second for sample data write from Central) and i am able to read it on nRF peripheral device.

    But iPhone App doesn't get any data.

    Is there any different configuration to do the transfer with iPhone Peripheral device ??

Reply
  • Thanks Petter,

    I see a problem here. I'm trying to use the same API to write data to Peripheral. For that i needed, cccd_handle and connection handle that i extracted after connecting with iPhone peripheral.

    Initially i was getting error no 17(BUSY) , but now i get "READ/WRITE API Returns Success log" though the iOS App doesn't get anything at all.

    To validate the API, i tried to write on nRF Peripheral device instead of iPhone App. There i get EVT_WRITE twice (Once for notif_enable from Central and second for sample data write from Central) and i am able to read it on nRF peripheral device.

    But iPhone App doesn't get any data.

    Is there any different configuration to do the transfer with iPhone Peripheral device ??

Children
No Data
Related