-
Notifications
You must be signed in to change notification settings - Fork 47
/
RZBMockCentralManager.h
64 lines (43 loc) · 2.56 KB
/
RZBMockCentralManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// RZBMockCentralManager.h
// RZBluetooth
//
// Created by Brian King on 7/23/15.
// Copyright (c) 2015 Raizlabs. All rights reserved.
//
@import CoreBluetooth;
#import "RZBDefines.h"
@class RZBMockPeripheral;
@protocol RZBMockCentralManagerDelegate;
NS_ASSUME_NONNULL_BEGIN
@interface RZBMockCentralManager : NSObject
@property(weak, nonatomic) id<CBCentralManagerDelegate> delegate;
@property(weak, nonatomic) id<RZBMockCentralManagerDelegate> mockDelegate;
@property(strong, nonatomic) dispatch_queue_t queue;
@property(assign) CBManagerState state;
@property(strong) NSDictionary *options;
@property(strong) NSMutableDictionary *peripheralsByUUID;
@property(nonatomic, assign, readonly) BOOL isScanning;
@property(assign) NSUInteger fakeActionCount;
- (instancetype)initWithDelegate:(id<CBCentralManagerDelegate>)delegate queue:(dispatch_queue_t)queue options:(NSDictionary *)options;
- (NSArray *)retrievePeripheralsWithIdentifiers:(NSArray *)identifiers;
- (NSArray *)retrieveConnectedPeripheralsWithServices:(NSArray *)serviceUUIDs;
- (void)scanForPeripheralsWithServices:(NSArray *)serviceUUIDs options:(NSDictionary *)options;
- (void)stopScan;
- (void)connectPeripheral:(CBPeripheral *)peripheral options:(NSDictionary *)options;
- (void)cancelPeripheralConnection:(CBPeripheral *)peripheral;
- (RZBMockPeripheral *)peripheralForUUID:(NSUUID *)uuid;
- (void)fakeStateChange:(CBManagerState)state;
- (void)fakeScanPeripheralWithUUID:(NSUUID *)peripheralUUID advInfo:(NSDictionary *)info RSSI:(NSNumber *)RSSI;
- (void)fakeConnectPeripheralWithUUID:(NSUUID *)peripheralUUID error:(NSError *__nullable)error;
- (void)fakeDisconnectPeripheralWithUUID:(NSUUID *)peripheralUUID error:(NSError *__nullable)error;
@end
@protocol RZBMockCentralManagerDelegate <NSObject>
- (void)mockCentralManager:(RZBMockCentralManager *)mockCentralManager retrievePeripheralsWithIdentifiers:(NSArray *)identifiers;
- (NSArray *)mockCentralManager:(RZBMockCentralManager *)mockCentralManager retrieveConnectedPeripheralsWithServices:(NSArray *)serviceUUIDs;
- (void)mockCentralManager:(RZBMockCentralManager *)mockCentralManager scanForPeripheralsWithServices:(NSArray *)services options:(NSDictionary *)options;
- (void)mockCentralManagerStopScan:(RZBMockCentralManager *)mockCentralManager;
- (void)mockCentralManager:(RZBMockCentralManager *)mockCentralManager connectPeripheral:(RZBMockPeripheral *)peripheral options:(NSDictionary *)options;
- (void)mockCentralManager:(RZBMockCentralManager *)mockCentralManager cancelPeripheralConnection:(RZBMockPeripheral *)peripheral;
@end
NS_ASSUME_NONNULL_END