YMSCBDescriptor Class Reference
Inherits from | NSObject |
---|---|
Declared in | YMSCBDescriptor.h YMSCBDescriptor.m |
Overview
Base class for defining a Bluetooth LE descriptor.
YMSCBDescriptor holds an instance of CBDescriptor (cbDescriptor).
The implementation of this class is TBD.
Other Methods
cbDescriptor
Pointer to actual CBDescriptor
@property (atomic, strong) CBDescriptor *cbDescriptor
Discussion
Pointer to actual CBDescriptor
Declared In
YMSCBDescriptor.h
UUID
Descriptor UUID
@property (atomic, readonly) CBUUID *UUID
Discussion
Descriptor UUID
Declared In
YMSCBDescriptor.h
parent
Pointer to parent peripheral.
@property (atomic, weak) YMSCBPeripheral *parent
Discussion
Pointer to parent peripheral.
Declared In
YMSCBDescriptor.h
readCallbacks
FIFO queue for reads.
@property (atomic, strong) NSMutableArray *readCallbacks
Declared In
YMSCBDescriptor.h
writeCallbacks
FIFO queue for writes.
@property (atomic, strong) NSMutableArray *writeCallbacks
Declared In
YMSCBDescriptor.h
Issuing a Write Request
– writeValue:withBlock:
Issue write with value data and execute callback block writeCallback upon response.
- (void)writeValue:(NSData *)data withBlock:(void ( ^ ) ( NSError *error ))writeCallback
Parameters
data |
The value to be written |
---|---|
writeCallback |
Callback block to execute upon response. |
Discussion
Issue write with value data and execute callback block writeCallback upon response.
The callback block writeCallback has one argument: error
:
error
is populated with the returnederror
object from the delegate method peripheral:didWriteValueForCharacteristic:error: implemented in YMSCBPeripheral.
Declared In
YMSCBDescriptor.h
– writeByte:withBlock:
Issue write with byte val and execute callback block writeCallback upon response.
- (void)writeByte:(int8_t)val withBlock:(void ( ^ ) ( NSError *error ))writeCallback
Parameters
val |
Byte value to be written |
---|---|
writeCallback |
Callback block to execute upon response. |
Discussion
Issue write with byte val and execute callback block writeCallback upon response.
The callback block writeCallback has one argument: error
:
error
is populated with the returnederror
object from the delegate method peripheral:didWriteValueForCharacteristic:error: implemented in YMSCBPeripheral.
Declared In
YMSCBDescriptor.h
Issuing a Read Request
– readValueWithBlock:
Issue read and execute callback block readCallback upon response.
- (void)readValueWithBlock:(void ( ^ ) ( NSData *data , NSError *error ))readCallback
Parameters
readCallback |
Callback block to execute upon response. |
---|
Discussion
Issue read and execute callback block readCallback upon response.
The callback block readCallback has two arguments: data
and error
:
data
is populated with thevalue
property of [YMSCBCharacteristic cbCharacteristic].error
is populated with the returnederror
object from the delegate method peripheral:didUpdateValueForCharacteristic:error: implemented in YMSCBPeripheral.
Declared In
YMSCBDescriptor.h
Callback Handler Methods
– executeReadCallback:error:
Handler method to process first callback in readCallbacks.
- (void)executeReadCallback:(NSData *)data error:(NSError *)error
Parameters
data |
Value returned from read request. |
---|---|
error |
Error object, if failed. |
Discussion
Handler method to process first callback in readCallbacks.
Declared In
YMSCBDescriptor.h
– executeWriteCallback:
Handler method to process first callback in writeCallbacks.
- (void)executeWriteCallback:(NSError *)error
Parameters
error |
Error object, if failed. |
---|
Discussion
Handler method to process first callback in writeCallbacks.
Declared In
YMSCBDescriptor.h