@interface VLDBluetoothPeripheralController : NSObject
class VLDBluetoothPeripheralController : NSObject
VLDBluetoothPeripheralController is the primary interface for detecting and reading from Bluetooth peripherals. All peripheral updates are given to the peripheral controller’s delegate object (VLDBluetoothPeripheralControllerDelegate).
The peripheral controller only performs one operation at a time. Any current operations must finish or be cancelled before a new operation can be started. The two possible operations are pairPeripheral: and readFromPeripheral:.
If the VLDBluetoothPeripheral has
requiresPairing set to true, then you must first
call pairPeripheral: to ensure that we are able to communicate with the peripheral and
to do any necessary pairing. When you call pairPeripheral:, you should then present
to the user the instructions of the VLDBluetoothPeripheral. When the
bluetoothPeripheralController:didPairPeripheral: callback is called, you can assume
all pairing has been done and it is now safe to call readFromPeripheral:.
To get a reading from a peripheral, call readFromPeripheral: and pass in the VLDBluetoothPeripheral object that you want to take a reading from. The reading operation will have multiple callbacks at different stages that are reported to the VLDBluetoothPeripheralControllerDelegate. When the VLDRecord object is returned via callback, it is also simultaneously uploaded to Validic. Do not submit these records to Validic as they have already been submitted.
The object that acts as the delegate of the peripheral controller.
Must conform to VLDBluetoothPeripheralControllerDelegate protocol.
Pairs a Bluetooth peripheral.
Returns NO if the controller is already pairing or reading from a peripheral.
Returns YES if the controller is available.
- (BOOL)pairPeripheral:(VLDBluetoothPeripheral *)peripheral;
func pairPeripheral(_ peripheral: VLDBluetoothPeripheral!) -> Bool
the peripheral to pair with.
Reads from a Bluetooth peripheral
Returns NO if the controller is already pairing or reading from a peripheral
Returns YES if the controller is available
- (BOOL)readFromPeripheral:(VLDBluetoothPeripheral *)peripheral;
func read(from peripheral: VLDBluetoothPeripheral!) -> Bool
the peripheral to read from.
Cancels all Bluetooth operations and disconnects from any connected peripherals
A new read or pair operation cannot begin until the current operation is finished or cancelled.
Determines if a read or pair operation is currently in progress
If an operation is in progress, it will need to be cancelled before a new operation can be started.
func operationInProgress() -> Bool