StateChanged (State As Int) DeviceFound (Name As String, DeviceId As String, AdvertisingData As Map, RSSI As Double) Disconnected Connected (Services As List) DataAvailable (ServiceId As String, Characteristics As Map) WriteComplete (Characteristic As String, Status As Int) RssiAvailable (Success As Boolean, RSSI As Double) MtuChanged (Success As Boolean, MTU As Int)
Connects to a device with the given id. You can only connect to previously discovered devices. Note that the Disconnected event will be raised if the connection has failed.
Connect2 (DeviceIdAsString, AutoConnectAsBoolean)
Similar to Connect. Allows you to disable auto connection.
Returns a List with all the records with the specified type. This is useful when there could be several records with the same type. Each item in the list is an array of bytes.
Initialize (EventNameAsString)
Initializes the object. The StateChanged event will be raised after this method with the current BLE state.
ReadData (ServiceAsString)
Asynchronously reads all characteristics from the given service. The DataAvailable will be raised when the data is available.
Asynchronously reads the value of the specified characteristic. The DataAvailable will be raised when the data of this characteristic is available.
ReadRemoteRssi
Reads the RSSI value of a connected device. The RssiAvailable event will be raised when the value is available.
RequestMtu (MTUAsInt) AsBoolean
Requests to change the MTU size (packet size). The MtuChanged event will be raised. Should be called after a connection is established. Returns True if the request was sent successfully. Only available on Android 5+. Does nothing on older versions.
Scan (ServiceUUIDsAsList)
Starts scanning for devices. The DeviceFound event will be raised when a device is found. ServiceUUIDs - A list (or array) with service uuids. Devices that don't advertise these uuids will not be discovered. Pass Null to discover all devices.
Adds or removes a notification listener that monitor value changes. The DataAvailable event will be raised when the value of the characteristic changes. Returns True if successful. Service - The service id (as returned in the Connected event). Characteristic - The characteristic id. Notify - True to add a listener, false to remove it.