Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marchbold/8609d4dcb6901cf9d81d to your computer and use it in GitHub Desktop.
Save marchbold/8609d4dcb6901cf9d81d to your computer and use it in GitHub Desktop.
Bluetooth LE: Start scanning as a central for advertising peripheral devices
BluetoothLE.service.centralManager.addEventListener( PeripheralEvent.DISCOVERED, central_peripheralDiscoveredHandler );
if (!BluetoothLE.service.centralManager.scanForPeripherals())
{
// There was an error starting to scan, check the state of the adapter!
}
...
private function central_peripheralDiscoveredHandler( event:PeripheralEvent ):void
{
// event.peripheral will contain a Peripheral object with information about the Peripheral
trace( "peripheral discovered: "+ event.peripheral.name );
}
// com.distriqt.BluetoothLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment