Code Monkey home page Code Monkey logo

mbed-os-ble-utils's Introduction

Mbed OS BLE utilities

This repository contains code helping with prototyping ble applications.

It used by examples in the https://github.com/ARMmbed/mbed-os-example-ble repository.

License and contributions

The software is provided under the Apache-2.0 license. Contributions to this project are accepted under the same license.

mbed-os-ble-utils's People

Contributors

paul-szczepanek-arm avatar rajkan01 avatar saheerb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbed-os-ble-utils's Issues

Does adding in a GATT service list to the start_advertising() function (found in ble_process.h) require an override to start_advertising()

I am struggling to understand the class architecture between the class BLEProcess and the class GattServerProcess when linked to your own ble app class (e.g. as demonstrated in the ble examples BLE_GattServer_CharacteristicUpdates and BLE_GattServer_CharacteristicWrite).

My aim is to get my app to advertise the Gatt Service and none of the above examples do this. The above examples simply advertise the app name, which was set within the start_advertising() function (as found in ble_process.h).

So how does one go changing this without overriding the start_advertising function.

It appears to me that the class architecture of these utility helpers is wrong as the ble_process class needs to get access to the services set within the ble.gattServer().addService(example_service) command which is done at the app level.

Maybe someone can explain the logic used.

Is there a reason to time out advertising after 4 seconds and then restart advertising again (found within ble_process.h).

I was testing ble_process.h and was perplexed by some behaviour I had observed.

I then discovered this:
error = _gap.startAdvertising(_adv_handle, ble::adv_duration_t(ble::millisecond_t(4000)));
and then this function

/** Restarts main activity */
    void onAdvertisingEnd(const ble::AdvertisingEndEvent &event)
    {
        start_activity();
    }

No comment is made as to why this behaviour was inserted into what I had assumed would be a generic default library using indefinite advertising _gap.startAdvertising(_adv_handle)

Should BLEProcess and BLEApp run dispatch_forever()?

I'd prefer if an EventQueue I created was only truly executed in the code I control.

BLEProcess has signfiicantly simplified some of the code I previously had, but I had to comment out the call to dispatch_forever() in start() in my local copy so I could execute it when I needed it.

The callback object is not called when connected to a peer (ble_process.h on_connect)

I am using the utility libraries as per this repo. It is working except that when the onConnectionComplete event triggers, I cannot get the _post_connect_cb condition to trigger. As such my own on_connect function is never called within my app class.

Reviewing the code and the other BLE examples I noticed that the app "start" function is successfully called when the _post_init_cb condition is triggered within the on_init_complete event.

Now I could not figure out why it is necessary for _post_connect_cb to include const ble::ConnectionCompleteEvent &event as one of the parameters within _post_connect_cb.

Maybe someone can explain. Because, when I removed this parameter it now works. _post_connect_cb is successfully triggered when I have my own function upon a onConnectionComplete event.

No examples can be found using ble_app.h

I cannot find any examples that demonstrate implementation of ble_app.h (find header comment difficult to follow). I've looked through mbed-os-example-ble and mbed-os-experimental-ble-services repos.

Allow more custimozation of the advertising payload

Some missing features:

  • appearance
  • intervals
  • service data
  • manufacturer data
  • scan response

Appearance and intervals seem both obvious and easy. It's possible that the others should be in some sort of callback.
I'm not sure what's best to do here though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.