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

S130 general purpose application

Hi,

I am trying make general-purpose s130 app that will be able to connect to central and peripheral at the same time and to exchange informations between them. At the beggining my app should connect to peripheral and discover all its services. After that it should create its own services (at peripheral side) based on earlier discovered ones. Then communication peripheral-my device- central would be possible.

As far I managed to connect and discover services from peripheral and connect to central. I also succed in creating new services and making them available for central. Problem is communication between them.

My question is is it even possible to make the app like this on nRF51? Or maybe someone has created similar app and would be able to help me or give me some advice?

I know that tere is "ble_hrs_csrs example" but in that example we know about all services - so it is different than my app.

  • What is the 'problem of communication between them'? It seems pretty direct (although inefficient), when the central reads the value of one of your characteristics, you read it from the peripheral you're connected to and return it. if the central writes to you, you write to the peripheral, if the central subscribes to a characteristic, you subscribe to it on your connected peripheral and when you receive updates, you send them on, and when it unsubscribes again, you do likewise. All you do is mirror the calls the central makes to you.

    What is the problem you're having doing that?

  • So, I managed to read values from peripheral through central/peripheral device, but there is a problem with writing values on peripherals. It seems ok, all error codes are "success" but when I am trying to read that value after writing it I always get original value - nothing changes on peripheral.

    On my c/p device, after I get "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST" ,which is write request, I use "sd_ble_gattc_write()" to write proper value on peripheral. Then, after getting response from it - "BLE_GATTC_EVT_WRITE_RSP" I use sd_ble_gatts_rw_authorize_reply() to send reply to my central device (master control panel). Should I store some values somewhere? I do not do that. Can it be a problem?

  • Note that BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST could mean both read and write. Are you separating the two events in your code?

  • I had problem with handle values but now everything is ok. Now I am facing problem with notofications. I can enable or disable them but I have no idea why I don`t get any BLE_GATTC_EVT_HVX event. Any advice? Oh, and thank you for previous answers.

  • Are you trying to turn on notifications from the "top" central? Turning on notifications is essentially doing a write command to a descriptor (the cccd) of a characteristic. Your relay device must catch these write commands and create its own write commands for the peripheral devices. How are you implementing it? Please confirm that the write commands arrive at the peripheral devices, and that the write command is to the correct handles.

Related