NordicPlayground / nRF51-multi-role-conn-observer-advertiser

Runs an Observer or Advertiser role (timeslot API) with a Connection. Provides a HCI interface to the Observer and Advertiser. Advertiser provides SCAN REQs back to application.
42 stars 25 forks source link

Observer examples? #8

Open henris42 opened 9 years ago

henris42 commented 9 years ago

Hi, would it be possible to have some working observer examples? Like for example iBeacon listener? .. the API & docs so far make implementing this by myself rather non-trivial..:)

trond-snekvik commented 9 years ago

We hope to add some more detailed (and cleaner) examples in the future, but for a quick start, I suggest that you extend upon the existing Observer project.

All the application specific stuff for the timeslotted operation is contained in the observer/main.c file. This file implements a non-filtering advertisement observer, which reports all advertisements to the UART. The interesting part is going on at line 181, where the observer spins until it gets a scan report from the framework. In this project, the observer only extracts the event type, advertisement address and RSSI from the event, but the event also contains the entire payload from the advertisement, from which you could start extracting information like iBeacon messages. I'm afraid dissecting the payload of the advertisements is somewhat out of scope for the framework (at least for now), but you can take a look at this stackoverflow answer to get started on filtering iBeacon devices from others.

I'll leave this issue open until we've added some extra examples.