Last active
October 19, 2015 07:33
-
-
Save marchbold/027285b36fc34f7871d7 to your computer and use it in GitHub Desktop.
Handle the state changed event from Bluetooth LE
This file contains hidden or 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
BluetoothLE.service.addEventListener( BluetoothLEEvent.STATE_CHANGED, stateChangedHandler ); | |
switch (BluetoothLE.service.state) | |
{ | |
case BluetoothLEState.STATE_ON: | |
// We can use the Bluetooth LE functions | |
break; | |
case BluetoothLEState.STATE_OFF: | |
case BluetoothLEState.STATE_RESETTING: | |
case BluetoothLEState.STATE_UNAUTHORISED: | |
case BluetoothLEState.STATE_UNSUPPORTED: | |
case BluetoothLEState.STATE_UNKNOWN: | |
// All of these indicate the Bluetooth LE is not available | |
} | |
... | |
private function stateChangedHandler( event:BluetoothLEEvent ):void | |
{ | |
trace( "stateChangedHandler(): "+BluetoothLE.service.state ); | |
} | |
// com.distriqt.BluetoothLE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment