RFduino Forum

RFduino => iOS => Topic started by: iphoneappdev on December 11, 2013, 02:11:51 PM

Title: RFduino and ANCS
Post by: iphoneappdev on December 11, 2013, 02:11:51 PM
Hey I recently received my RFduino and I was looking to be able to use it with Apple's built in notification system. I was wondering if anyone had any insight into this. There seems to be very little documentation over this online.

Title: Re: RFduino and ANCS
Post by: bsiever on July 28, 2014, 07:33:14 PM
It doesn't appear to be possible with the current RFduino API.

The provided API only appears to support RFDuino's own Service, configuring advertisement data, and iBeacons. There don't appear to be any hooks for accessing another service (like ANCS).
Title: Re: RFduino and ANCS
Post by: notsolinear on August 02, 2014, 04:00:39 PM
My understanding is that ANCS is where the iOS device acts as a BLE peripheral and some other BLE central device connects to it to receive notifications. At the moment I believe RFduino only supports the BLE "peripheral" role, so it cannot initiate a connection to an iOS device for the purpose of ANCS.
Title: Re: RFduino and ANCS
Post by: bsiever on August 02, 2014, 05:50:48 PM
Just a minor clarification on terms:

In ANCS the iOS device is the server and another device is the client. A server owns the information that the client wants to interact with, like text message notifications. Since the RFduino's current service also acts as a server, not a client, it isn't able to act as a client to ANCS.

The terms Central/Master designates the device that controls the timing of the radio communication whereas Peripheral/Slave refers to the other device. Initially the Central does the listening and the peripheral does the advertising. Once they've connected they are in a Master/Slave relationship. I believe that in ANCS the iOS device is still the Master (controlling radio timing), but it "serves" the data to the Peripheral, which acts as the client. Note that "Central" and "Peripheral" refer to roles that devices can have. The terms Central and Peripheral are used when devices will establish a connection. There are also roles called Broadcaster and Observer.

I don't mean to be pedantic, but BLE is littered with terms with subtle differences. It can certainly be confusing.
Title: Re: RFduino and ANCS
Post by: notsolinear on August 02, 2014, 08:56:50 PM
I did some further reading about ANCS and I see I misspoke.

The typical BLE pattern is that the peripheral runs a GATT server and central runs the GATT client, but for ANCS it appears they use a less common option where the GATT roles are reversed. I'd seen mention of the ability for peripherals to act as GATT clients but wasn't aware ANCS was using it.

With RFduino the ANCS support is doubly hopeless then:  Not only is there no API for acting as a GATT client, you (mostly) can't even control how it acts as a GATT server.
Title: Re: RFduino and ANCS
Post by: danlsk on October 31, 2016, 10:06:48 PM
@bsiever is right about IOS device being GATT server and RFduino as GATT client. Actually, the lack of BLE Stack Soft Device API header file is the problem. But, it is no longer so anymore.

You just have to do this
1. Go to sketch>include library>manage libraries>
2. Install BLEPeripheral

Alternative, you can find the library at github.
Code: [Select]
There included an example for IOS ANCS. Make sure you modified the pin number settings correcting.
Code: [Select]
#define BLE_REQ   -1
#define BLE_RDY   -1
#define BLE_RST   -1

 I have tested to be working fine.
Title: Re: RFduino and ANCS
Post by: tolson on November 01, 2016, 12:22:11 PM
 What APP is needed on the iOS to use with the BLEPehripheral example ANCS sketch?
Or, if built-in what procedure to use to test this stuff out.
Title: Re: RFduino and ANCS
Post by: danlsk on November 01, 2016, 04:12:52 PM
No IOS App needed. Just a simple Sketch will do. You peripheral just subscribed to the service. If you use IOS nrf Connect tool you should be able to see the advertised SolicitedService UUID prior to pairing the device. Nevertheless, you do need to manage the service data to make it meaningful functions. Of course, if you need to provide user option to manage the data filter, you will definitely need an IOS app to do that. That is another level development. But for simple example e.g. blinking LED for incoming call, you don't need that. If I have time, I will post one tutorial in Hackster.io. The BLEPeripheral library has included an ANCS template as an example. I just develop based on that. Pretty easy...