The name of the Asset in Lens Studio.
Readonly Experimental Wearable OnlyonEvent for Bluetooth status changes. Currently unused.
Readonly Experimental Wearable OnlystatusGet the current status of the Bluetooth adapter.
ReadonlyuniqueExperimental Wearable OnlyConnect to a GATT server on a given device address.
deviceAddress Address to which to connect. Received in Bluetooth.ScanResult.deviceAddress
Returns: Promise resolving to a {Bluetooth.BluetoothGatt} object if successful. The Promise is rejected if the connection cannot be made.
Returns the name of this object's type.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Experimental Wearable OnlyStart a scan for Bluetooth GATT devices. The first device which passes the predicate will be returned, at which point the scan will stop.
filters Filters to apply to the scan. If a device passes any filter then the predicate will be invoked for that device. If no filters are passed then the predicate will be invoked for all devices.
settings Bluetooth.ScanSettings to configure the scan.
predicate Predicate to select a device. Returning true will stop the scan and return the device.
Returns: Promise resolving to the first device which passes the predicate. The promise is rejected if the scan times out.
var scanFilter = new Bluetooth.ScanFilter();
var scanSettings = new Bluetooth.ScanSettings();
scanSettings.timeoutSeconds = 30;
scanSettings.scanMode = Bluetooth.ScanMode.LowPower;
var scanResult = await script.bluetoothModule.startScan([scanFilter], scanSettings,
function(result) {
print("Running predicate on " + result.deviceName);
return result.deviceName == "[DEVICE NAME]";
}
);
print("Found GATT device " + scanResult.deviceName);
Experimental Wearable OnlyStop a scan for Bluetooth devices, if one is running.
Provides access to Bluetooth GATT devices. APIs include scanning for and connecting to these devices, and reading and writing to their descriptors and characteristics.
Example