The Bluetooth low energy device manager.
More...
#import <BLEDeviceManager.h>
Inherits NSObject, <CBCentralManagerDelegate>, and <CBPeripheralDelegate>.
The Bluetooth low energy device manager.
This class manages the connection and communication with a BLE device. It uses the defined protocol to decode and encode the sent messages between the RFDuino and the PC.
Since the device manager is handling the imcoming messages, blink detection messages are recognized here. In normal operating mode (blink detection) a timer is used to start blurring the screen if there was no blink in a user defined time interval. Every incoming blink message from the RFDuino will reset this timer. If the user wants a blurring screen depends on the global setting made by control-clicking the ApplicationIcon in the menubar.
Based on the BLE-Chat-Demo: https://github.com/nandev/BLE-Chat-Demo
- Author
- Benjamin Thiemann
- Date
- 2017/01/17
◆ abortScanning()
This method aborts the current scan for Bluetooth low energy devices.
◆ calibrationComplete()
- (void) calibrationComplete |
|
|
|
This method is invoked when the calibration process is completed. The BLE device manager will go into normal mode and, depending on whether blurring is desired, the blurring timer will be started.
◆ communicateMessage:withData:()
- (void) communicateMessage: |
|
(BLE_OUT_MESSAGE) |
message |
withData: |
|
(NSNumber *) |
data |
|
|
| |
This method represents a message receiver. By calling this method and passing a BLE_OUT_MESSAGE a corresponding communication with the connected device will take place. If there is addional data to send, the data has to be passed via the obj
parameter.
- See also
- BLE_OUT_MESSAGE
- Parameters
-
message | The outgoing message to the connected device. |
data | The data to be send. |
◆ connectToDevice:()
- (void) connectToDevice: |
|
(CBPeripheral *) |
device |
|
This method establishes a connection to the given device.
- Parameters
-
device | The device to connect to. |
◆ disconnectFromDevice()
- (void) disconnectFromDevice |
|
|
|
This method disconnects from the current device.
◆ getConnectedDevice()
- (CBPeripheral *) getConnectedDevice |
|
|
|
This method returns the connected device as a CBPeripheral object.
- Returns
- The connected device.
◆ getCurrentProfile()
This methods returns the current user profile.
- Returns
- The current user profile.
◆ getEnforcedBlinks()
- (NSUInteger) getEnforcedBlinks |
|
|
|
This method returns the enforced blinks counter.
- Returns
- The current counter of enforced blinks.
◆ hasConnection()
This method returns the connection state.
- Returns
- The connection state.
◆ requestBatteryLevel()
- (void) requestBatteryLevel |
|
|
|
This methods requests the battery level. The value sent by the RFDuino is stored in batterLevel.
◆ scanForDevices()
This method scans for Bluetooth low energy devices.
◆ setProfile:()
This method sets the current user profile to the given profile by sending the profiles calibration data to the device. There it is stored and used from now on until this method is called again or the device is reset. The RFDuino has no possibility to nonvolatile store the parameters.
- Parameters
-
profile | The user profile to set. |
◆ sharedInstance()
+ (instancetype) sharedInstance |
|
|
|
This method returns the shared instance of this singleton class.
◆ startCalibrationWithDevice()
- (void) startCalibrationWithDevice |
|
|
|
This methods starts a calibration process with the connected device. The RFDuino will now start sending calibration data.
◆ stopCalibrationWithDevice()
- (void) stopCalibrationWithDevice |
|
|
|
This methods stop a calibration process with the connected device. The RFDuino will now stop sending calibration data.
◆ wantsBlurring:()
- (void) wantsBlurring: |
|
(BOOL) |
blurring |
|
This method sets the current value of whethe the user wants to have the screen blurred or not.
- Parameters
-
blurring | The new value for wantsBlurring. |
◆ autoConnect
Boolean value that indicates whether an autoconnect to the last known device is desired.
◆ autoScan
Boolean value that indicates whether an autoscan is desired.
◆ batteryLevel
◆ BLEDevices
- (NSMutableArray*) BLEDevices |
|
protected |
Stores all found BLE devices.
◆ disconnect_characteristic
- (CBCharacteristic*) disconnect_characteristic |
|
protected |
CoreBluetooth characteristic for disconnecting. Stores additional information about the device.
◆ enforcedBlinks
- (NSUInteger) enforcedBlinks |
|
protected |
The counter for enforced blinks.
◆ hardwareState
- (NSString*) hardwareState |
|
protected |
The bluetooth hardware state (turned off, not supported and so on)
◆ isCalibrating
Boolean value that indicates whether a calibration is ongoing.
◆ isConnected
Boolean value that indicates whether a connection to a device is established.
◆ lastKnownDevice
- (NSString*) lastKnownDevice |
|
protected |
The last known CoreBluetooth peripheral's UUID string.
◆ lastKnownPeripheral
- (CBPeripheral*) lastKnownPeripheral |
|
protected |
The last known CoreBluetooth peripheral a connection has been established to.
◆ loadedService
Boolean value that indicates whether a service is loaded.
◆ manager
- (CBCentralManager*) manager |
|
protected |
The CoreBluetooth central manager.
◆ noBlinkTimeInterval
- (NSUInteger) noBlinkTimeInterval |
|
protected |
The allowed time interval without a blink.
◆ packageCounter
- (NSUInteger) packageCounter |
|
protected |
◆ peripheral
- (CBPeripheral*) peripheral |
|
protected |
The CoreBluetooth peripheral a connection is established to.
◆ repeatingTimer
- (NSTimer*) repeatingTimer |
|
protected |
The timer to stop time with a blink.
◆ send_characteristic
- (CBCharacteristic*) send_characteristic |
|
protected |
CoreBluetooth characteristic for sending. Stores additional information about the device.
◆ state
The state the instance of this class is currently in.
◆ userProfile
The current user profile.
◆ wantsBlurring
Boolean value that indicates whether blurring is desired.
The documentation for this class was generated from the following files: