PunchThrough LightBlue how do you make a virtual device send a notification? - ios

I'm developing an Android app that is a BLE central. I don't yet have access to the peripheral device. This would be a typical scenario for a virtual device simulator like LightBlue. I can scan and connect client-peri and I can enable notifications by writing the CCCD. If I use LightBlue's Time profile I can get Current Time characteristic notifications once per second. What I need to do is to add a custom characteristic and make that send notifications either at a specified interval or preferrably when pressing a button. How do I do that?
I'm also all ears for other methods or apps that can help me. I can't program my own peripheral app because I only have an iPhone and I don't have access to a development environment for iOS at the moment.
Hoping for insights!
thanks!

Related

iOS CoreBluetooth Notifications

Squirrels on my balcony eat my jalapeƱos. I pointed a camera to the place where my jalapeƱos grow and using a simple motion detection software on my computer on the balcony I know when squirrels show up.
I figured out how to establish a Bluetooth Low Energy communication between my computer and my iPhone (my computer is the central and the smartphone is a peripheral).
Is there a way how to invoke a push notificaiton using Bluetooth Low Energy that shows up on my phone whenever my camera detects a squirrel? I want to know if it is possible without an Internet connection.
In a word, no. Push notifications require an internet connection. However, do you specifically want APNS, or do you just want a way to wake up your app and display a message to the user when you receive a BLE message from your computer?
I believe you can set up your iPhone app to get BLE notices from the background. If you can do that then you can code your app to trigger a LOCAL notification (different from a push notification, but similar in terms of the UX)

subscribe notification characteristics linux/ios

I am trying to write a simple Gatt peripheral on linux device. I am currently able to see my service thanks to btgatt-client binary. I can read/write characteristics, enable notification, etc... I am using API from src/shared/gatt-db.h from bluez5, inspiration comes from tools/btgatt-server.c
However I am not able to make it work with my ios application without success. The subscription to notification failed. This ios application is able to work with a CC2541 bluetooth device so this is not an issue in ios side.
To enable the notification subscription I put some changes on the property value in the creation of the characteristics function like this :
gatt_db_service_add_characteristic(service, &uuid,
BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_NOTIFY
signal_live_read_cb,
signal_live_write_cb,
server);
Do I forget to call some specific code to make it work correctly ?

Alerting from a ble device

Do the likes of flic, tile and pebblebee implement their own ble services/characteristics ? Or are they using standard ble profiles ?
I'm building a ble device and would like to make the phone alert/ring when a button is pressed on the device and googling doesn't suggest a standard.
The simple answer, both devices have to have a immediate alert service exposed in order to have 2 way alerting.
I'm using a microchip rn4020 which wasn't scanning the central device for services, once I corrected that i could see the phone app was presenting the immediate alert service.

Activating an iOS app when Bluetooth connection connects

Is such a thing possible? I know certain apps such as VOIP apps have permission to run constantly, but I'm uncertain my app idea would be allowed to always run.
It depends on what you mean by "Activating an app".
You can operate as a Bluetooth Central in background mode and your app can receive notifications that a Bluetooth Low Energy service has been detected (if you are scanning for that service) or a device has connected (if you have a pending connect for that device).
You can then interact with the peripheral briefly (transfer a small amount of information for example) or display a notification to the user, but you cannot bring your app to the foreground preempting whatever the user is currently doing.
This project demonstrates CoreBluetooth background connection - https://github.com/paulw11/BTBackground

Initiating CoreBluetooth reconnect from peripheral

I've got an iPhone, I've got a bluetooth low energy (aka Bluetooth 4.o) device. The two have connected in the past. But now they're apart. Something happened, words were said that couldn't be taken back, and now they've disconnected.
Now they're in the same room again. The BTLE device wants to connect again. It doesn't want to wait for the iPhone to call it. It's taking the initiative. It wants to talk to the iPhone, and get that app they used to share launched again.
How do I set up the iPhone code to support this?
(Wow, corny.)
You have to leave the app connecting to the device, so when the device becomes available the app will connect to it (so long as the app is alive). Just call [centralManager connectPeripheral] on the CMPeripheral, so the phone will keep listening for the device and connect immediately when it sees it. That doesn't time out, so you can just leave it running forever.
If no app is to connect to the peripheral, there's nothing the peripheral can do to change that.
This is a little late, but here's what I would do to accomplish this:
When your device wants to connect, have it advertise a special service.
Assuming the phone is already scanning for devices, it will see the service and you can auto-connect to it.
Now you can have the periphal trigger whatever you like on the central by updating a characteristic, etc.
Of course, this relies on the phone scanning at the time you need the action to trigger, but that is the nature of the beast.

Resources