This module will enable your iOS app to use AtlBeacon, an open alternative to iBeacon.
Note that this beacon spec doesn't integrate with iOS as good as iBeacon. In other words, it won't work if your app is not running (foreground or background)
This module code is based CharruaLab/AltBeacon.
<modules>
<module platform="iphone">co.altitude.altbeacon</module>
</modules>
var altbeacon = require('co.altitude.altbeacon');
altbeacon.initialize("079106D1-D6CC-442A-8D1D-E7A89599786B");
altbeacon.configure({
debugCentral: true,
debugPeripheral: true,
debugProximity: true
});
altbeacon.addEventListener('foundDevice', function(e){
Ti.API.debug("Device '+"e.device"+' is in range: "+ e.range);
});
altbeacon.addEventListener('lostDevice', function(e){
Ti.API.debug("Device '+"e.device"+' is out of range");
});
altbeacon.startBroadcasting();
altbeacon.startDetecting();
Initialize the beacon with the specified UUID.
- uuid: this will be your beacon UUID
- null
Configure the beacon and debug options.
- options
- debugCentral: Boolean
- debugPeripheral: Boolean
- debugProximity: Boolean
- updateInterval: Float
- processPeripheralInterval: Float
- restartScanInterval: Float
- service: UUID
- characteristic: UUID
- null
Start broadcasting the beacon.
- null
Start broadcasting the beacon.
- null
Shortcut that will call startBroadcasting() and startDetecting().
- null
Stop broadcasting the beacon.
- null
Stop broadcasting the beacon.
- null
Shortcut that will call stopBroadcasting() and stopDetecting().
- null
A list with all devices found. Will be fired for every scan if any devices are found.
{
devices: [{<device_uuid>: <range>}]
}
Will be fired every time a device is in range
{
device: <uuid>,
range: [0-3]
}
Will be fired every time a device is in range
{
device: <uuid>
}
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2014 Marco Ferreira
Cheers!