Pixels Plugin for Unity
Enable communications with Pixels dice using Bluetooth Low Energy.
Loading...
Searching...
No Matches
SGBleRequest.h
Go to the documentation of this file.
1
6#ifndef SGBleRequest_h
7#define SGBleRequest_h
8
9#import <Foundation/Foundation.h>
10
11NS_ASSUME_NONNULL_BEGIN
12
17typedef NS_ENUM(NSInteger, SGBleRequestType)
18{
19 SGBleRequestTypeUnknown = 0,
20 SGBleRequestTypeConnect,
21 SGBleRequestTypeDisconnect,
22 SGBleRequestTypeReadRssi,
23 SGBleRequestTypeReadValue,
24 SGBleRequestTypeWriteValue,
25 SGBleRequestTypeSetNotifyValue,
26};
27
32typedef NSError * _Nullable (^SGBleRequestExecuteHandler)();
33
38typedef void (^SGBleRequestCompletionHandler)(NSError * _Nullable error);
39
46@interface SGBleRequest : NSObject
48{
49 SGBleRequestType _type;
50 SGBleRequestExecuteHandler _executeHandler;
51 SGBleRequestCompletionHandler _completionHandler;
52}
53
54// Property getters
55- (SGBleRequestType)type;
57
61@property(readonly, getter=type) SGBleRequestType type;
62
70- (instancetype)initWithRequestType:(SGBleRequestType)requestType executeHandler:(SGBleRequestExecuteHandler)executeHandler completionHandler: (nullable SGBleRequestCompletionHandler)completionHandler;
71
75- (nullable NSError *)execute;
76
80- (void)notifyResult:(nullable NSError *)error;
81
85+ (NSString *)requestTypeToString:(SGBleRequestType)typeSGBleRequest;
86
87@end
88
89NS_ASSUME_NONNULL_END
90
91#endif /* SGBleRequest_h */
NSError *_Nullable(^ SGBleRequestExecuteHandler)()
Internal type, runs the Bluetooth operation associated with a SGBleRequest object.
Definition SGBleRequest.h:32
void(^ SGBleRequestCompletionHandler)(NSError *_Nullable error)
Internal type, completion handler for operations associated with a SGBleRequest object.
Definition SGBleRequest.h:38
Internal type, represents a Bluetooth operation to be performed on a peripheral. Used by SGBlePeriphe...
Definition SGBleRequest.h:47