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.

  • My feeling is that BDS with the Nordic plugin can be good for experimenting, but not for generating code for real products. At least not in its current state.

    What I meant with wrapping it was that you could make a battery_level_set() function in service_if.c and add the prototype to the corresponding header file that is included in main.c. Then you could call that from main. It could look something like this:

    uint32_t battery_level_set(uint8_t level)
    {
        ble_bas_battery_level_t batlev;
        batlev.level = level;
        return ble_bas_battery_level_set(&m_bas, &batlev);
    }
    

    I must admit that I have not played that much with BDS, but yes, I think the need for this is down to the way code is generated by the plugin, and that it makes it not so interesting for development (at least for now).

Reply
  • My feeling is that BDS with the Nordic plugin can be good for experimenting, but not for generating code for real products. At least not in its current state.

    What I meant with wrapping it was that you could make a battery_level_set() function in service_if.c and add the prototype to the corresponding header file that is included in main.c. Then you could call that from main. It could look something like this:

    uint32_t battery_level_set(uint8_t level)
    {
        ble_bas_battery_level_t batlev;
        batlev.level = level;
        return ble_bas_battery_level_set(&m_bas, &batlev);
    }
    

    I must admit that I have not played that much with BDS, but yes, I think the need for this is down to the way code is generated by the plugin, and that it makes it not so interesting for development (at least for now).

Children
No Data
Related