publishing the FLIC API so I can use it with Linux and gatttool as well
I do stuff with BTLE on Linux. I have written an interface to the TI SensorTAG so I can read out values. Would like to use Flic in a similar way. Just publish all the BTLE UUIDs etc.
Good news! With Flic 2 we will publish the communication protocol so that it can be connected to anything with BLE. https://flic.io/flic2
Co M commented
15 minutes, write your GATT server using
I did some tests and it is possible to detect flic button presses in a very "hackish" way:
Use the "hcitool" command included in the Bluez library (I am using bluez-5.11 on Debian):
[your bluez directory]/tools/hcitool lescan
This will start listening for Bluetooth LE devices (until you press Ctrl+C). The instant you press your Flic you should see it pop up in this list. The output should look something like this:
LE Scan ...
80:E4:DA:xx:xx:xx F014xXxX <-- This is a Flic!
So it should be trivial to call that command inside a python script (using a shell pipe) and wait for the MAC to pop up and react!
That's it: A proof-of-concept Flic for Linux detector that should be able to run on a Raspberry Pi.
Now, it would be really great if the Flic team would publish details on how to detect the kind of button press (single-press, double-press, long-press, ...)
So far I have tried accessing the BLE characteristics of the Flic (you have like 1-2 seconds to issue commands until the Flic connection is lost). So far I have found following characteristics using gatttool:
gatttool -b 80:E4:xx:xx:xx:xx -I
Attempting to connect to 80:E4:xx:xx:xx:xx
attr handle: 0x0001, end grp handle: 0x0009 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x0016 uuid: f02adfc0-26e7-11e4-9edc-0002a5d5c51b
handle: 0x0002, char properties: 0x02, char value handle: 0x0003, uuid: 00002a00-0000-1000-8000-00805f9b34fb
handle: 0x0004, char properties: 0x02, char value handle: 0x0005, uuid: 00002a01-0000-1000-8000-00805f9b34fb
handle: 0x0006, char properties: 0x0a, char value handle: 0x0007, uuid: 00002a02-0000-1000-8000-00805f9b34fb
handle: 0x0008, char properties: 0x02, char value handle: 0x0009, uuid: 00002a04-0000-1000-8000-00805f9b34fb
handle: 0x000d, char properties: 0x22, char value handle: 0x000e, uuid: 00002a05-0000-1000-8000-00805f9b34fb
handle: 0x0011, char properties: 0x1e, char value handle: 0x0012, uuid: cc7efce0-26e8-11e4-8fd2-0002a5d5c51b
handle: 0x0014, char properties: 0x12, char value handle: 0x0015, uuid: 06053ec0-26e9-11e4-adc2-0002a5d5c51b
handle: 0x0001, uuid: 2800
handle: 0x0002, uuid: 2803
handle: 0x0003, uuid: 2a00
handle: 0x0004, uuid: 2803
handle: 0x0005, uuid: 2a01
handle: 0x0006, uuid: 2803
handle: 0x0007, uuid: 2a02
handle: 0x0008, uuid: 2803
handle: 0x0009, uuid: 2a04
handle: 0x000c, uuid: 2800
handle: 0x000d, uuid: 2803
handle: 0x000e, uuid: 2a05
handle: 0x000f, uuid: 2902
handle: 0x0010, uuid: 2800
handle: 0x0011, uuid: 2803
handle: 0x0012, uuid: cc7efce0-26e8-11e4-8fd2-0002a5d5c51b
handle: 0x0013, uuid: 2902
handle: 0x0014, uuid: 2803
handle: 0x0015, uuid: 06053ec0-26e9-11e4-adc2-0002a5d5c51b
handle: 0x0016, uuid: 2902
Discover descriptors finished: No attribute found within the given range
Now you can access the data of each characteristics. e.g. to read characteristic with handle 0x0010 just enter:
[80:E4:xx:xx:xx:xx][LE]> char-read-hnd 0x0010
So far I have not found any data that changes according to the type of button press. MAybe you have more luck!
Greetings from Munich,
As I understand it Flic doesn't completely use the Bluetooth LE standard and they added some things of their own. That probably means standard BTLE tools and libraries won't work with it. I tried connecting to it using gatttool, but it only seemed to connect briefly (about a second) and I wasn't able to send or receive any data. I unfortunately don't know enough about BTLE to hack my way forward further.
If I remember correctly, in the Indiegogo comments they did say they had a Linux library for internal use, which they might release later. I'd rather directly use BTLE, but as that doesn't seem to be an option I guess we'll have to wait until they release the library.
Can't you just sniff it? It's only three functions, so it shouldn't be very hard to decipher which one is what.
FLIC API for Linux, Mac OS x and PC:s equipped with bluetooth would be great.
Daniel Allen commented
Linux support would enable the killer combination: flic + Raspberry pi!
Vitor Coelho commented
I have interested in this one too. I'm building a car system based on a cheaper hardware running ubuntu to put in my van for a loong trip but sometimes you got some problem or just its embarrassing when not works with some accent of a friend or when talk with a computer will turn your girl down :P
An integration would be useful to panic, power and music buttons as a second option in "urgent" times..