blob: b198f7e52a9e6623720aa5c08319752371d1de52 (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
#import <Foundation/Foundation.h>
#import "SDLManager.h"
#import "NSMapTable+Subscripting.h"
#import "SDLConfiguration.h"
#import "SDLConnectionManagerType.h"
#import "SDLFileManagerConfiguration.h"
#import "SDLLifecycleConfiguration.h"
#import "SDLLifecycleManager.h"
#import "SDLLockScreenConfiguration.h"
#import "SDLLockScreenManager.h"
#import "SDLLockScreenPresenter.h"
#import "SDLLogConfiguration.h"
#import "SDLManagerDelegate.h"
#import "SDLNotificationDispatcher.h"
#import "SDLResponseDispatcher.h"
#import "SDLRPCRequestNotification.h"
#import "SDLRPCResponseNotification.h"
#import "SDLRPCNotificationNotification.h"
#import "SDLSoftButtonManager.h"
#import "SDLStateMachine.h"
#import "SDLTextAndGraphicManager.h"
NS_ASSUME_NONNULL_BEGIN
#pragma mark - SDLManager Private Interface
@interface SDLManager ()
@property (strong, nonatomic) SDLLifecycleManager *lifecycleManager;
@end
#pragma mark - SDLManager Implementation
@implementation SDLManager
#pragma mark Lifecycle
- (instancetype)init {
return [self initWithConfiguration:[SDLConfiguration configurationWithLifecycle:[SDLLifecycleConfiguration defaultConfigurationWithAppName:@"SDL APP" fullAppId:@"001"] lockScreen:[SDLLockScreenConfiguration enabledConfiguration] logging:[SDLLogConfiguration defaultConfiguration] fileManager:[SDLFileManagerConfiguration defaultConfiguration]] delegate:nil];
}
- (instancetype)initWithConfiguration:(SDLConfiguration *)configuration delegate:(nullable id<SDLManagerDelegate>)delegate {
self = [super init];
if (!self) {
return nil;
}
_lifecycleManager = [[SDLLifecycleManager alloc] initWithConfiguration:configuration delegate:delegate];
return self;
}
- (void)startWithReadyHandler:(SDLManagerReadyBlock)readyHandler {
[self.lifecycleManager startWithReadyHandler:readyHandler];
}
- (void)stop {
[self.lifecycleManager stop];
}
#pragma mark - Passthrough getters / setters
- (SDLConfiguration *)configuration {
return self.lifecycleManager.configuration;
}
- (nullable SDLHMILevel)hmiLevel {
return self.lifecycleManager.hmiLevel;
}
- (SDLFileManager *)fileManager {
return self.lifecycleManager.fileManager;
}
- (SDLPermissionManager *)permissionManager {
return self.lifecycleManager.permissionManager;
}
- (nullable SDLStreamingMediaManager *)streamManager {
return self.lifecycleManager.streamManager;
}
- (SDLScreenManager *)screenManager {
return self.lifecycleManager.screenManager;
}
- (SDLSystemCapabilityManager *)systemCapabilityManager {
return self.lifecycleManager.systemCapabilityManager;
}
- (nullable SDLRegisterAppInterfaceResponse *)registerResponse {
return self.lifecycleManager.registerResponse;
}
- (nullable NSString *)authToken {
return self.lifecycleManager.authToken;
}
- (nullable id<SDLManagerDelegate>)delegate {
return self.lifecycleManager.delegate;
}
- (void)setDelegate:(nullable id<SDLManagerDelegate>)delegate {
self.lifecycleManager.delegate = delegate;
}
- (NSArray<__kindof NSOperation *> *)pendingRPCTransactions {
return self.lifecycleManager.rpcOperationQueue.operations;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (nullable SDLProxy *)proxy {
return self.lifecycleManager.proxy;
}
#pragma clang diagnostic pop
#pragma mark SDLConnectionManager Protocol
- (void)sendRPC:(__kindof SDLRPCMessage *)rpc {
[self.lifecycleManager sendRPC:rpc];
}
- (void)sendRequest:(SDLRPCRequest *)request {
[self sendRequest:request withResponseHandler:nil];
}
- (void)sendRequest:(__kindof SDLRPCRequest *)request withResponseHandler:(nullable SDLResponseHandler)handler {
[self.lifecycleManager sendRequest:(__kindof SDLRPCMessage *)request withResponseHandler:handler];
}
- (void)sendRequests:(NSArray<SDLRPCRequest *> *)requests progressHandler:(nullable SDLMultipleAsyncRequestProgressHandler)progressHandler completionHandler:(nullable SDLMultipleRequestCompletionHandler)completionHandler {
[self.lifecycleManager sendRequests:requests progressHandler:progressHandler completionHandler:completionHandler];
}
- (void)sendSequentialRequests:(NSArray<SDLRPCRequest *> *)requests progressHandler:(nullable SDLMultipleSequentialRequestProgressHandler)progressHandler completionHandler:(nullable SDLMultipleRequestCompletionHandler)completionHandler {
[self.lifecycleManager sendSequentialRequests:requests progressHandler:progressHandler completionHandler:completionHandler];
}
#pragma mark - RPC Subscriptions
- (id)subscribeToRPC:(SDLNotificationName)rpcName withBlock:(SDLRPCUpdatedBlock)block {
return [[NSNotificationCenter defaultCenter] addObserverForName:rpcName object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
SDLRPCMessage *message = note.userInfo[SDLNotificationUserInfoObject];
block(message);
}];
}
- (void)subscribeToRPC:(SDLNotificationName)rpcName withObserver:(id)observer selector:(SEL)selector {
[[NSNotificationCenter defaultCenter] addObserver:observer selector:selector name:rpcName object:nil];
}
- (void)unsubscribeFromRPC:(SDLNotificationName)rpcName withObserver:(id)observer {
[[NSNotificationCenter defaultCenter] removeObserver:observer name:rpcName object:nil];
}
@end
NS_ASSUME_NONNULL_END
|