Android Programming Press on the image to return to the main documentation page.

iBLE

List of types:

BleManager
PeripheralManager

BleManager

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)

Members:


  Connect (DeviceId As String)

  Disconnect

  GetCharacteristicObject (ServiceId As String, CharacteristicId As String) As Object

  GetCharacteristicProperties (Service As String, Characteristic As String) As Int

  GetPeripheralObject As Object

  GetServiceObject (Service As String) As Object

  Initialize (EventName As String)

  IsInitialized As Boolean

  LastUpdatedCharacteristic As String [read only]

  ReadData (Service As String)

  ReadData2 (Service As String, Characteristic As String)

  Scan (ServiceUUIDs As List)

  Scan2 (ServiceUUIDs As List, AllowDuplicates As Boolean)

  SetNotify (Service As String, Characteristic As String, Notify As Boolean)

  State As Int [read only]

  STATE_POWERED_OFF As Int [read only]

  STATE_POWERED_ON As Int [read only]

  STATE_RESETTING As Int [read only]

  STATE_UNAUTHORIZED As Int [read only]

  STATE_UNKNOWN As Int [read only]

  STATE_UNSUPPORTED As Int [read only]

  StopScan

  Tag As Object

  WriteData (Service As String, Characteristic As String, Data() As Byte)

  WriteDataWithResponse (Service As String, Characteristic As String, Data() As Byte)

Members description:

Connect (DeviceId As String)
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.
Disconnect
Disconnects a connected device.
GetCharacteristicObject (ServiceId As String, CharacteristicId As String) As Object
Returns the characteristic object. To be used with NativeObject.
GetCharacteristicProperties (Service As String, Characteristic As String) As Int
Returns a numeric value from which you can find the properties of the specified characteristic.
GetPeripheralObject As Object
Returns the connected peripheral object. To be used with NativeObject.
GetServiceObject (Service As String) As Object
Returns the service object. To be used with NativeObject.
Initialize (EventName As String)
Initializes the object. The StateChanged event will be raised after this method with the current BLE state.
IsInitialized As Boolean
Tests whether this object was initialized.
LastUpdatedCharacteristic As String [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 (Service As String)
Asynchronously reads all characteristics from the given service. The DataAvailable will be raised when the data is available.
ReadData2 (Service As String, Characteristic As String)
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 (ServiceUUIDs As List)
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.
Scan2 (ServiceUUIDs As List, AllowDuplicates As Boolean)
Similar to Scan. If AllowDuplicates is true then the DeviceFound event will be raised whenever a packet is received.
SetNotify (Service As String, Characteristic As String, Notify As Boolean)
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.
State As Int [read only]
Returns the current state.
STATE_POWERED_OFF As Int [read only]
STATE_POWERED_ON As Int [read only]
STATE_RESETTING As Int [read only]
STATE_UNAUTHORIZED As Int [read only]
STATE_UNKNOWN As Int [read only]
STATE_UNSUPPORTED As Int [read only]
StopScan
Stops scanning for new devices.
Tag As Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
WriteData (Service As String, Characteristic As String, Data() As Byte)
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.
WriteDataWithResponse (Service As String, Characteristic As String, Data() As Byte)
Similar to WriteData. Writes the data and expects a response.

PeripheralManager


Events:

StateChanged (State As Int)
Subscribe (CentralId As String)
Unsubscribe(CentralId As String)
NewData (Data() As Byte)

Members:


  Initialize (EventName As String)

  IsInitialized As Boolean

  Start (Name As String)

  State As Int [read only]

  STATE_POWERED_OFF As Int [read only]

  STATE_POWERED_ON As Int [read only]

  STATE_RESETTING As Int [read only]

  STATE_UNAUTHORIZED As Int [read only]

  STATE_UNKNOWN As Int [read only]

  STATE_UNSUPPORTED As Int [read only]

  Stop

  Tag As Object

  Write (Centrals As List, Data() As Byte)

Members description:

Initialize (EventName As String)
Initializes the object and set the subs that will handle the events.
IsInitialized As Boolean
Tests whether this object was initialized.
Start (Name As String)
Starts advertising and listening for connections.
Name - The peripheral name (will be advertised).
State As Int [read only]
Returns the current state.
STATE_POWERED_OFF As Int [read only]
STATE_POWERED_ON As Int [read only]
STATE_RESETTING As Int [read only]
STATE_UNAUTHORIZED As Int [read only]
STATE_UNKNOWN As Int [read only]
STATE_UNSUPPORTED As Int [read only]
Stop
Stops advertising.
Tag As Object
Gets or sets the Tag object. This is a placeholder for any object you like to tie to this object.
Write (Centrals As List, Data() As Byte)
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