armmbed / mbed-os-ble-utils Goto Github PK
View Code? Open in Web Editor NEWmbed os BLE utilities used by ble examples
License: Apache License 2.0
mbed os BLE utilities used by ble examples
License: Apache License 2.0
Some missing features:
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.
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)
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.
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.