Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening an App (iPhone) via bluetooth low energy

Hello I do hope someone can help me with this question as i thought it would be easy at first! I'm a studying EE student who is not that good with code but trying!

Let me tell you my goal at the end of this.....

I would like to be able to open an app on the iPhone and then execute a bit of code to send a message, all via Bluetooth.

I would like to be able to pair this small Bluetooth device to the iPhone only once and be able for it to be in sleep mode (500 nano amps :D awesome) and when I turn it on (via a small switch) it will open an app and send that message. (the app is already done, you just have to press a button on the app in order to send the message, that's why I would like to use a Bluetooth device so you don't have to have the app open at all times!)

Sorry for the long paragraph but I need help! I have the Bluegiga BLE113 dev kit and im overwhelmed with all the information they give you! But I don't see anywhere where I connect to the iPhone and do what I want to do.

Has anyone done this before, can you steer me in the right direction?

like image 506
gradedcatfood Avatar asked Nov 09 '13 00:11

gradedcatfood


2 Answers

As long as the person downloading the app has previously opened the app and they've agreed to backgrounding capabilities, then yes you can send the message in the background (if already connected). However, you cannot force your app into the foreground on a non-jailbroken iOS device.

Check out the BLE Transfer App sample code to get you started.

like image 102
Tommy Devoy Avatar answered Sep 29 '22 02:09

Tommy Devoy


I guess what you need is:

  1. the periperal implements the peripheral role
  2. the app implements the central role
  3. the app is trying to connect to the peripheral continuously (connectPeripheral:options:)
  4. the peripheral wakes up on trigger and the phone connection request completes
  5. the peripheral signals to the central using a characteristic change notification
  6. the app receives the notification and executes the business functionality of your desire
  7. the peripheral goes to sleep again
  8. the app receives the disconnect event and starts a connectPeripheral:options: immediately
  9. the app should utilize the new restoration feature of Core Bluetooth (watch the WWDC 2013 session 703 video)

This is just an outline and you need to know lots of small things to get it right. I suggest you try to go ahead and implement piece by piece and if you get stuck, ask a new questions. As @tdevoy suggested, the BTLE Transfer App is a good starting point. The Heart Rate Monitor is also a good source of info (OSX API is the same as the iOS).

like image 29
allprog Avatar answered Sep 29 '22 00:09

allprog