Created
October 7, 2014 07:37
-
-
Save xmen4u/c3937d237b7655b74ef6 to your computer and use it in GitHub Desktop.
ble - ibeacon for tessel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tessel = require('tessel'); | |
var bleLib = require('ble-ble113a'); | |
var bleadvertise = require('bleadvertise'); | |
var uuid = "D8EE2A9F24176669F9508C97F10AAB5B"; // Apple's example UUID | |
var major = '01'; | |
var minor = '10'; | |
var iBeaconData = new Buffer(uuid+major+minor, 'hex'); // Create data Buffer | |
var packet = { | |
flags: [0x04], // BLE only | |
mfrData : iBeaconData | |
} | |
var ad = bleadvertise.serialize(packet); | |
var beacon = bleLib.use(tessel.port['D'], function(){ | |
beacon.setAdvertisingData(ad, function(){ | |
beacon.startAdvertising(); | |
console.log('Beaconing'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment