PTDBleDevice Class Reference
Inherits from | NSObject |
---|---|
Conforms to | CBPeripheralDelegate |
Declared in | PTDBleDevice.h |
Other Methods
Virtual methods
– profileDiscovered:
Called when a BLE profile is discovered.
- (void)profileDiscovered:(BleProfile *)profile
Discussion
This method can be overridden to notify a subclass when a new BLE profile is discovered. After a profile is discovered, it should then be validated.
Declared In
PTDBleDevice.h
– rssiDidUpdateWithError:
Called when a device’s RSSI is updated. Override this in your PTDBleDevice subclass to handle its data.
- (void)rssiDidUpdateWithError:(NSError *)error
Declared In
PTDBleDevice.h
– servicesHaveBeenModified
Called when a device’s services are modified. Override this in your PTDBleDevice subclass to handle its data.
- (void)servicesHaveBeenModified
Declared In
PTDBleDevice.h
– notificationStateUpdatedWithError:
Called when iOS encounters an error when updating a characteristic notification state. Override this in your PTDBleDevice subclass to handle its data.
- (void)notificationStateUpdatedWithError:(NSError *)error
Declared In
PTDBleDevice.h
Delegate
delegate
The PTDBleDeviceDelegate delegate object for the device. Set your class as the delegate to receive messages and responses from the device.
@property (nonatomic, weak) id<PTDBleDeviceDelegate> delegate
Declared In
PTDBleDevice.h
Identifying a Device
identifier
The UUID of the CoreBluetooth peripheral associated with the Device. This is not guaranteed to be the same between different devices. If a bluetooth cache is cleared, this UUID is not guaranteed to stay the same. For more info, refer to the Apple identifier documentation
@property (nonatomic, readonly) NSUUID *identifier
Declared In
PTDBleDevice.h
name
The Device’s name. For more info, refer to the Apple name documentation
@property (nonatomic, readonly) NSString *name
Declared In
PTDBleDevice.h
lastDiscovered
Represents last time this device was discovered while scanning.
@property (nonatomic, readonly) NSDate *lastDiscovered
Declared In
PTDBleDevice.h
advertisementData
Bluetooth LE advertising data. A dictionary containing CBAdvertisementDataLocalNameKey
@property (nonatomic, readonly) NSDictionary *advertisementData
Declared In
PTDBleDevice.h
Monitoring a Device's Connection State
state
The current connection state of the Device. See PTDBleDeviceState for more details.
@property (nonatomic, readonly) PTDBleDeviceState state
Discussion
if (device.state == PTDBleDeviceState_Discovered) { NSLog(@“Device discovered, try connecting”); } else if (device.state == PTDBleDeviceState_ConnectedAndValidated) { NSLog(@“Device connected, try calling an API”); }
Declared In
PTDBleDevice.h
Accessing a Device's Received Signal Strength Indicator (RSSI) Data
– readRSSI
Requests the Device’s current RSSI.
- (void)readRSSI
Discussion
When you call this method to read the Device’s RSSI, the device calls the [PTDBleDeviceDelegate deviceDidUpdateRSSI:error:] method of its delegate object. If the Device’s RSSI is successfully retrieved, you can access it through the Device’s RSSI property.
Declared In
PTDBleDevice.h
RSSI
The Device’s RSSI. For more info, refer to the Apple RSSI documentation
@property (nonatomic, readonly) NSNumber *RSSI
Declared In
PTDBleDevice.h