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
|
//
// SDLLifecycleManager.h
// SmartDeviceLink-iOS
//
// Created by Joel Fischer on 7/19/16.
// Copyright © 2016 smartdevicelink. All rights reserved.
//
#import "SDLNotificationConstants.h"
#import <Foundation/Foundation.h>
#import "SDLHMILevel.h"
#import "SDLLanguage.h"
@class SDLConfiguration;
@class SDLFileManager;
@class SDLLifecycleConfiguration;
@class SDLLockScreenConfiguration;
@class SDLLockScreenManager;
@class SDLNotificationDispatcher;
@class SDLOnHashChange;
@class SDLPermissionManager;
@class SDLProxy;
@class SDLPutFile;
@class SDLRegisterAppInterfaceResponse;
@class SDLResponseDispatcher;
@class SDLRPCNotification;
@class SDLRPCRequest;
@class SDLRPCResponse;
@class SDLStateMachine;
@class SDLStreamingMediaManager;
@protocol SDLManagerDelegate;
NS_ASSUME_NONNULL_BEGIN
typedef NSString SDLLifecycleState;
extern SDLLifecycleState *const SDLLifecycleStateStopped;
extern SDLLifecycleState *const SDLLifecycleStateStarted;
extern SDLLifecycleState *const SDLLifecycleStateReconnecting;
extern SDLLifecycleState *const SDLLifecycleStateConnected;
extern SDLLifecycleState *const SDLLifecycleStateRegistered;
extern SDLLifecycleState *const SDLLifecycleStateSettingUpManagers;
extern SDLLifecycleState *const SDLLifecycleStatePostManagerProcessing;
extern SDLLifecycleState *const SDLLifecycleStateUnregistering;
extern SDLLifecycleState *const SDLLifecycleStateReady;
typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);
@interface SDLLifecycleManager : NSObject
@property (copy, nonatomic, readonly) SDLConfiguration *configuration;
@property (weak, nonatomic, nullable) id<SDLManagerDelegate> delegate;
@property (strong, nonatomic) SDLFileManager *fileManager;
@property (strong, nonatomic) SDLPermissionManager *permissionManager;
@property (strong, nonatomic, readonly, nullable) SDLStreamingMediaManager *streamManager;
@property (strong, nonatomic) SDLLockScreenManager *lockScreenManager;
@property (strong, nonatomic, readonly) SDLNotificationDispatcher *notificationDispatcher;
@property (strong, nonatomic, readonly) SDLResponseDispatcher *responseDispatcher;
@property (strong, nonatomic, readonly) SDLStateMachine *lifecycleStateMachine;
// Deprecated internal proxy object
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (strong, nonatomic, nullable) SDLProxy *proxy;
#pragma clang diagnostic pop
@property (assign, nonatomic) UInt16 lastCorrelationId;
@property (copy, nonatomic, readonly) SDLLifecycleState *lifecycleState;
@property (copy, nonatomic, nullable) SDLHMILevel hmiLevel;
@property (strong, nonatomic, nullable) SDLRegisterAppInterfaceResponse *registerResponse;
#pragma mark Lifecycle
/**
* Initialize the manager with a configuration. Call `startWithHandler` to begin waiting for a connection.
*
* @param configuration Your app's unique configuration for setup.
* @param delegate An optional delegate to be notified of hmi level changes and startup and shutdown. It is recommended that you implement this.
*
* @return An instance of SDLManager
*/
- (instancetype)initWithConfiguration:(SDLConfiguration *)configuration delegate:(nullable id<SDLManagerDelegate>)delegate NS_DESIGNATED_INITIALIZER;
/**
* Start the manager, which will tell it to start looking for a connection. Once one does, it will automatically run the setup process and call the readyBlock when done.
*
* @param readyHandler The block called when the manager is ready to be used or an error occurs while attempting to become ready.
*/
- (void)startWithReadyHandler:(SDLManagerReadyBlock)readyHandler;
/**
* Stop the manager, it will disconnect if needed and no longer look for a connection. You probably don't need to call this method ever.
*/
- (void)stop;
#pragma mark Send RPC Requests
/**
* Send an RPC request and don't bother with the response or error. If you need the response or error, call sendRequest:withCompletionHandler: instead.
*
* @param request The RPC request to send
*/
- (void)sendRequest:(SDLRPCRequest *)request;
/**
* Send an RPC request and set a completion handler that will be called with the response when the response returns.
*
* @param request The RPC request to send
* @param handler The handler that will be called when the response returns
*/
- (void)sendRequest:(SDLRPCRequest *)request withResponseHandler:(nullable SDLResponseHandler)handler;
@end
NS_ASSUME_NONNULL_END
|