BleManager allows you to discover, connect and read data from BLE peripheral devices. This library is supported by iOS 7.1+.
Events:
StateChanged (State As Int) DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double) Disconnected Connected (Services As List) DataAvailable (Service As String, Characteristics As Map) WriteComplete (Characteristic As String, Success As Boolean)
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.
Returns a numeric value from which you can find the properties of the specified characteristic.
GetPeripheralObjectAsObject
Returns the connected peripheral object. To be used with NativeObject.
GetServiceObject (ServiceAsString) AsObject
Returns the service object. To be used with NativeObject.
Initialize (EventNameAsString)
Initializes the object. The StateChanged event will be raised after this method with the current BLE state.
IsInitializedAsBoolean
Tests whether this object was initialized.
LastUpdatedCharacteristicAsString [read only]
Returns the characteristic that was last updated. This property can be used inside the DataAvailable event to find which characteristic was last updated (the Map will include all the characteristics).
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. Note that you must call ReadData once before you can call this method. The DataAvailable will be raised when the data of this characteristic is available.
Scan (ServiceUUIDsAsList)
Starts scanning for devices. 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 monitors value changes. Note that you must call ReadData once before you can call this method. The DataAvailable method will be raised when the value of the characteristic changes. Service - The service id (as returned in the Connected event). Characteristic - The characteristic id (as returned in the DataAvailable event). Notify - True to add a listener, false to remove it.
StateAsInt [read only]
Returns the current state.
STATE_POWERED_OFFAsInt [read only]
STATE_POWERED_ONAsInt [read only]
STATE_RESETTINGAsInt [read only]
STATE_UNAUTHORIZEDAsInt [read only]
STATE_UNKNOWNAsInt [read only]
STATE_UNSUPPORTEDAsInt [read only]
StopScan
Stops scanning for new devices.
TagAsObject
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
Writes the data to the specified characteristic. You must call ReadData once and wait for the DataAvailable event before you can use this method. Note that this method does not raise any event. Service - The service id (as returned in the Connected event). Characteristic - The characteristic id (as returned in the DataAvailable event). Data - Data to write.
Initializes the object and set the subs that will handle the events.
IsInitializedAsBoolean
Tests whether this object was initialized.
Start (NameAsString)
Starts advertising and listening for connections. Name - The peripheral name (will be advertised).
StateAsInt [read only]
Returns the current state.
STATE_POWERED_OFFAsInt [read only]
STATE_POWERED_ONAsInt [read only]
STATE_RESETTINGAsInt [read only]
STATE_UNAUTHORIZEDAsInt [read only]
STATE_UNKNOWNAsInt [read only]
STATE_UNSUPPORTEDAsInt [read only]
Stop
Stops advertising.
TagAsObject
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
Write (CentralsAsList, Data() AsByte)
Writes data to the subscribed centrals via a notification. Centrals - An array or list with the subscribed central ids. Pass Null to send to all. Data - Data to send. Maximum size is 20 bytes.
Top