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

Transfer received data from one service and send that data out on another service.

Hi, 

To build the context: I have two peripherals, Sensor 1 and Sensor 2. Sensor 1 has been running off of a NUS service to transmit data. Sensor 2 has been running off of a Custom service to transmit and received data. The data from Sensor 1 needs to pass through a relay nRF52 to Sensor 2. 

I've been trying to utilize the the shell of the relay example to receive data from one peripheral (sensor1) and send that data to another peripheral (sensor 2) with another new service (that contains both the NUS service and the Custom service's characteristics (2 TX and 1 RX)). I have been able to view all data coming to the relay, but I haven't been able to figure out how to take the data received and send back out on the same service to the other characteristic (i.e. Sensor 1 -> Sensor 2). 

It seems like I cannot update my characteristic conn_handle properly to be able to send back out to the other peripheral. Is there a way to do this? Or is it very difficult with the collective characteristics all combined into one service? Should I have two separate Services running on the relay nRF and pass data between the two Services? If so, how would this transfer between Services work?

Thanks!

Parents
  • Hi

    I assume the relay device is acting as a client to both of the sensors?

    If so you should have separate service instances for each sensor, which you have to map to the connection handle of each connection. 

    Then you just have to keep track of the two devices in your application. Once you receive some data from sensor 1 you need to send it out using the service instance of sensor 2.

    Best regards
    Torbjørn

  • Hi Torbjørn, 

    Thanks for getting back to me. After digging in a bunch more the past few days, this is exactly the conclusion I arrived at. I've implemented and this works. I'm just working on trying to figure out some of the hard errors that occasionally show up when I try to pass the data from one sensor to the next. Often times these failures are right after a getting data and trying to pass to the other service to be sent out. I'll keep looking into this and post a question on a different thread if I can't get it figured out. 

    Thanks!

Reply
  • Hi Torbjørn, 

    Thanks for getting back to me. After digging in a bunch more the past few days, this is exactly the conclusion I arrived at. I've implemented and this works. I'm just working on trying to figure out some of the hard errors that occasionally show up when I try to pass the data from one sensor to the next. Often times these failures are right after a getting data and trying to pass to the other service to be sent out. I'll keep looking into this and post a question on a different thread if I can't get it figured out. 

    Thanks!

Children
Related