blob: ce6c827a73d5b6fd6800b2cb4b1cf93c484e0bc6 (
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
|
//
// SDLAppServiceManifest.m
// SmartDeviceLink
//
// Created by Nicole on 1/25/19.
// Copyright © 2019 smartdevicelink. All rights reserved.
//
#import "SDLAppServiceManifest.h"
#import "NSMutableDictionary+Store.h"
#import "SDLRPCParameterNames.h"
#import "SDLFunctionID.h"
#import "SDLImage.h"
#import "SDLMediaServiceManifest.h"
#import "SDLNavigationServiceManifest.h"
#import "SDLSyncMsgVersion.h"
#import "SDLWeatherServiceManifest.h"
NS_ASSUME_NONNULL_BEGIN
@implementation SDLAppServiceManifest
- (instancetype)initWithAppServiceType:(SDLAppServiceType)serviceType {
self = [super init];
if (!self) {
return self;
}
self.serviceType = serviceType;
return self;
}
- (instancetype)initWithMediaServiceName:(nullable NSString *)serviceName serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest {
return [self initWithServiceName:serviceName serviceType:SDLAppServiceTypeMedia serviceIcon:serviceIcon allowAppConsumers:allowAppConsumers rpcSpecVersion:rpcSpecVersion handledRPCs:handledRPCs mediaServiceManifest:mediaServiceManifest weatherServiceManifest:nil navigationServiceManifest:nil];
}
- (instancetype)initWithWeatherServiceName:(nullable NSString *)serviceName serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs weatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest {
return [self initWithServiceName:serviceName serviceType:SDLAppServiceTypeWeather serviceIcon:serviceIcon allowAppConsumers:allowAppConsumers rpcSpecVersion:rpcSpecVersion handledRPCs:handledRPCs mediaServiceManifest:nil weatherServiceManifest:weatherServiceManifest navigationServiceManifest:nil];
}
- (instancetype)initWithNavigationServiceName:(nullable NSString *)serviceName serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs navigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest {
return [self initWithServiceName:serviceName serviceType:SDLAppServiceTypeNavigation serviceIcon:serviceIcon allowAppConsumers:allowAppConsumers rpcSpecVersion:rpcSpecVersion handledRPCs:handledRPCs mediaServiceManifest:nil weatherServiceManifest:nil navigationServiceManifest:navigationServiceManifest];
}
- (instancetype)initWithServiceName:(nullable NSString *)serviceName serviceType:(SDLAppServiceType)serviceType serviceIcon:(nullable SDLImage *)serviceIcon allowAppConsumers:(BOOL)allowAppConsumers rpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion handledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs mediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest weatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest navigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest {
self = [self initWithAppServiceType:serviceType];
if (!self) {
return self;
}
self.serviceName = serviceName;
self.serviceIcon = serviceIcon;
self.allowAppConsumers = @(allowAppConsumers);
self.rpcSpecVersion = rpcSpecVersion;
self.handledRPCs = handledRPCs;
self.mediaServiceManifest = mediaServiceManifest;
self.weatherServiceManifest = weatherServiceManifest;
self.navigationServiceManifest = navigationServiceManifest;
return self;
}
- (void)setServiceName:(nullable NSString *)serviceName {
[store sdl_setObject:serviceName forName:SDLRPCParameterNameServiceName];
}
- (nullable NSString *)serviceName {
return [store sdl_objectForName:SDLRPCParameterNameServiceName ofClass:NSString.class error:nil];
}
- (void)setServiceType:(NSString *)serviceType {
[store sdl_setObject:serviceType forName:SDLRPCParameterNameServiceType];
}
- (NSString *)serviceType {
NSError *error = nil;
return [store sdl_objectForName:SDLRPCParameterNameServiceType ofClass:NSString.class error:&error];
}
- (void)setServiceIcon:(nullable SDLImage *)serviceIcon {
[store sdl_setObject:serviceIcon forName:SDLRPCParameterNameServiceIcon];
}
- (nullable SDLImage *)serviceIcon {
return [store sdl_objectForName:SDLRPCParameterNameServiceIcon ofClass:SDLImage.class error:nil];
}
- (void)setAllowAppConsumers:(nullable NSNumber<SDLBool> *)allowAppConsumers {
[store sdl_setObject:allowAppConsumers forName:SDLRPCParameterNameAllowAppConsumers];
}
- (nullable NSNumber<SDLBool> *)allowAppConsumers {
return [store sdl_objectForName:SDLRPCParameterNameAllowAppConsumers ofClass:NSNumber.class error:nil];
}
- (void)setRpcSpecVersion:(nullable SDLSyncMsgVersion *)rpcSpecVersion {
[store sdl_setObject:rpcSpecVersion forName:SDLRPCParameterNameRPCSpecVersion];
}
- (nullable SDLSyncMsgVersion *)rpcSpecVersion {
return [store sdl_objectForName:SDLRPCParameterNameRPCSpecVersion ofClass:SDLSyncMsgVersion.class error:nil];
}
- (void)setHandledRPCs:(nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs {
[store sdl_setObject:handledRPCs forName:SDLRPCParameterNameHandledRPCs];
}
- (nullable NSArray<NSNumber<SDLInt> *> *)handledRPCs {
return [store sdl_objectsForName:SDLRPCParameterNameHandledRPCs ofClass:NSNumber.class error:nil];
}
- (void)setWeatherServiceManifest:(nullable SDLWeatherServiceManifest *)weatherServiceManifest {
[store sdl_setObject:weatherServiceManifest forName:SDLRPCParameterNameWeatherServiceManifest];
}
- (nullable SDLWeatherServiceManifest *)weatherServiceManifest {
return [store sdl_objectForName:SDLRPCParameterNameWeatherServiceManifest ofClass:SDLWeatherServiceManifest.class error:nil];
}
- (void)setMediaServiceManifest:(nullable SDLMediaServiceManifest *)mediaServiceManifest {
[store sdl_setObject:mediaServiceManifest forName:SDLRPCParameterNameMediaServiceManifest];
}
- (nullable SDLMediaServiceManifest *)mediaServiceManifest {
return [store sdl_objectForName:SDLRPCParameterNameMediaServiceManifest ofClass:SDLMediaServiceManifest.class error:nil];
}
- (void)setNavigationServiceManifest:(nullable SDLNavigationServiceManifest *)navigationServiceManifest {
[store sdl_setObject:navigationServiceManifest forName:SDLRPCParameterNameNavigationServiceManifest];
}
- (nullable SDLNavigationServiceManifest *)navigationServiceManifest {
return [store sdl_objectForName:SDLRPCParameterNameNavigationServiceManifest ofClass:SDLNavigationServiceManifest.class error:nil];
}
@end
NS_ASSUME_NONNULL_END
|