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

Feeding data into the BDS example

I've recently been playing around with Bluetooth Developer Studio, and I can see it's potential despite it having a few annoying bugs.

I've set up a custom service by re-purposing the Battery Service for now (For some reason I couldn't get an exact copy of the battery service to actually send any sort of data value despite my best efforts). Now I'm trying to figure out how to actually pass data from read from the TWI into these characteristics and have them update.

I can't seem to understand where I should be putting data to make this happen. Am I missing something obvious here?

Parents
  • What problems did you have with the battery service? In the generated code you can set the battery level with ble_bas_battery_level_set(), which is defined in ble_bas.c. I just tested by adding the battery service (unmodified) to a design with the heart rate profile, and what I set with ble_bas_battery_level_set() is what I read as the attribute value in Master Control Panel.

  • I see. I also have problems getting proper code generated for a custom BAS. I will report the problem to the software team. To be honest there are many issues with Nordic's BDS plugin at the moment, and I do not know when an update will be available.

    Regarding the ble_bas_battery_level_set() function for the battery service, it can be called from anywhere. However you need to pass a pointer to the instance of ble_bas_t (m_bas), which is a static variable in service_if.c, so you have to wrap it somehow. For a hackish solution you could always just make it non-static, and declare it as extern in main.c and access it directly.

Reply
  • I see. I also have problems getting proper code generated for a custom BAS. I will report the problem to the software team. To be honest there are many issues with Nordic's BDS plugin at the moment, and I do not know when an update will be available.

    Regarding the ble_bas_battery_level_set() function for the battery service, it can be called from anywhere. However you need to pass a pointer to the instance of ble_bas_t (m_bas), which is a static variable in service_if.c, so you have to wrap it somehow. For a hackish solution you could always just make it non-static, and declare it as extern in main.c and access it directly.

Children
No Data
Related