VLDBluetoothPeripheralControllerDelegate
Objective-C
@protocol VLDBluetoothPeripheralControllerDelegate <NSObject>
Swift
protocol VLDBluetoothPeripheralControllerDelegate
The VLDBluetoothPeripheralControllerDelegate protocol provides callbacks to indicate the status of a pairPeripheral: or readFromPeripheral: operation. When performing a readFromPeripheral: operation you should listen for the bluetoothPeripheralController:isReadyToReadFromPeripheral: callback and then display to the user the readingInstructions from the VLDBluetoothPeripheral object.
-
Callback once a peripheral has been successfully found and paired if needed
Declaration
Objective-C
- (void)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller didPairPeripheral:(VLDBluetoothPeripheral *)peripheral;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, didPairPeripheral peripheral: VLDBluetoothPeripheral!)
Parameters
controller
The VLDBluetoothPeripheralController instance that was doing the pairing
peripheral
The bluetooth peripheral that was being paired
-
Callback if the peripheral was unable to be paired, or if the pairPeripheral: operation was cancelled
Declaration
Objective-C
- (void)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller didNotPairPeripheral:(VLDBluetoothPeripheral *)peripheral error:(NSError *)error;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, didNotPairPeripheral peripheral: VLDBluetoothPeripheral!, error: Any!)
Parameters
controller
The VLDBluetoothPeripheralController instance that was doing the pairing
peripheral
The bluetooth peripheral that was being paired
error
An NSError object with a code from the values in VLDBluetoothErrorCode indicating the type of error that occured
-
Callback indicating that the user can now begin taking a measurement with the peripheral
Declaration
Objective-C
- (void)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller isReadyToReadFromPeripheral:(VLDBluetoothPeripheral *)peripheral;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, isReadyToReadFrom peripheral: VLDBluetoothPeripheral!)
Parameters
controller
The VLDBluetoothPeripheralController instance that is taking a reading
peripheral
The bluetooth peripheral that is being read from
-
Callback passing back the VLDRecord objects with the measurement data received from the peripheral and asking if they should be submitted to Validic
Declaration
Objective-C
- (BOOL)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller shouldSubmitReadings:(NSArray<__kindof VLDRecord *> *)records fromPeripheral:(VLDBluetoothPeripheral *)peripheral;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, shouldSubmitReadings records: Any!, from peripheral: VLDBluetoothPeripheral!) -> Any!
Parameters
controller
The VLDBluetoothPeripheralController instance that took the readings
records
An array of records containing the readings received from the peripheral. Most peripherals will return a single reading, some may return more.
peripheral
The bluetooth peripheral that the readings came from
-
Callback indicating that the readFromPeripheral: operation was cancelled
Declaration
Objective-C
- (void)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller didCancelReadingForPeripheral:(VLDBluetoothPeripheral *)peripheral;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, didCancelReadingFor peripheral: VLDBluetoothPeripheral!)
Parameters
controller
The VLDBluetoothPeripheralController instance that was taking a reading
peripheral
The bluetooth peripheral that was being read from
-
Callback indicating attempt to get a reading from the peripheral failed
Declaration
Objective-C
- (void)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller readingFailedForPeripheral:(VLDBluetoothPeripheral *)peripheral error:(NSError *)error;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, readingFailedFor peripheral: VLDBluetoothPeripheral!, error: Any!)
Parameters
controller
The VLDBluetoothPeripheralController instance that was taking a reading
peripheral
The bluetooth peripheral that was being read from
error
An NSError object with a code from the values in VLDBluetoothErrorCode indicating the type of error that occured
-
Callback indicating a serial number was read from a bluetooth connection
Declaration
Objective-C
- (void)bluetoothPeripheralController: (VLDBluetoothPeripheralController *)controller didReadSerialNumber:(NSString *)serialNumber;
Swift
optional func bluetoothPeripheralController(_ controller: VLDBluetoothPeripheralController!, didReadSerialNumber serialNumber: Any!)
Parameters
controller
The VLDBluetoothPeripheralController instance that read the serial number
serialNumber
The serial number string read from the peripheral