Hi @igorbarinov,
Yes, it's possible to use the BLE module to interact with the ANCS.
Basically, you'd have the module in a scanning state until it found the iOS device:
var tessel = require('tessel');
// Switch to whatever port you're using
var bluetooth = require('ble-ble113a').use(tessel.port['A']);
var options =
{
// Boolean of whether duplicate peripherals should be reported
allowDuplicates:false,
// An array of uuids that, if existing in advertising data, will cause peripheral to be reported as discovered
serviceUUIDs:['7905F431-B5CE-4E99-A40F-4B1E122D00D0']
}
bluetooth.startScanning(options);
bluetooth.on('discover', function(peripheral) {
console.log('found this peripheral!', peripheral)
});
Then, you'll want to retrieve a handle to the service of the Notification Source, Control Point, and Data Source characteristics as outlined in that Apple documentation:
peripheral.discoverServices(['7905F431-B5CE-4E99-A40F-4B1E122D00D0'], function(err, services) {
...
});
Once you have that service, you'll want to get a handle to the Notification Source, Control Point, and Data Source characteristics:
service.discoverCharacteristics(['9FBF120D-6301-42D9-8C58-25E699A21DBD', '69D1D8F3-45E1-49A8-9821-9BBDFDAAD9D9', '22EAC6E9-24D6-4BB5-BE44-B36ACE7C7BFB', function(err, characteristics) {
...
}
The Notification Source and Data Source are characteristics which you can receive notifications from like this:
characteristic.startNotifications();
characteristic.on('notification', function(data) {
...
});
The Control Point requires you to write to it which you can do like so:
var writeBuffer = new Buffer(6);
// Fill the buffer with the command data as shown in the Apple documentation
characteristic.write(writeBuffer, function(err) {
});
The only points I'm not sure about are when the ANCS is available (my LightBlue app was enable to detect is running in an iPhone 6/ iOS 8) and what the authentication looks like. The guide mentions:
"All these characteristics require authorization for access."
Perhaps it requires you to start an encrypted connection? I haven't been able to find documentation around that.
I hope this helps!
-Jon