blob: f103c4ac6cf68f962e7337ddde4299f47565d40e (
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
//
// SDLSendLocation.m
// SmartDeviceLink
#import "SDLSendLocation.h"
#import "SDLNames.h"
NS_ASSUME_NONNULL_BEGIN
@implementation SDLSendLocation
- (instancetype)init {
self = [super initWithName:SDLNameSendLocation];
if (!self) {
return nil;
}
return self;
}
- (instancetype)initWithLongitude:(double)longitude latitude:(double)latitude locationName:(nullable NSString *)locationName locationDescription:(nullable NSString *)locationDescription address:(nullable NSArray<NSString *> *)address phoneNumber:(nullable NSString *)phoneNumber image:(nullable SDLImage *)image {
return [self initWithLongitude:longitude latitude:latitude locationName:locationName locationDescription:locationDescription displayAddressLines:address phoneNumber:phoneNumber image:image deliveryMode:nil timeStamp:nil address:nil];
}
- (instancetype)initWithLongitude:(double)longitude latitude:(double)latitude locationName:(nullable NSString *)locationName locationDescription:(nullable NSString *)locationDescription displayAddressLines:(nullable NSArray<NSString *> *)displayAddressLines phoneNumber:(nullable NSString *)phoneNumber image:(nullable SDLImage *)image deliveryMode:(nullable SDLDeliveryMode)deliveryMode timeStamp:(nullable SDLDateTime *)timeStamp address:(nullable SDLOasisAddress *)address {
self = [self init];
if (!self) {
return nil;
}
self.longitudeDegrees = @(longitude);
self.latitudeDegrees = @(latitude);
self.locationName = locationName;
self.locationDescription = locationDescription;
self.addressLines = displayAddressLines;
self.phoneNumber = phoneNumber;
self.locationImage = image;
self.deliveryMode = deliveryMode;
self.timeStamp = timeStamp;
self.address = address;
return self;
}
- (void)setLongitudeDegrees:(nullable NSNumber<SDLFloat> *)longitudeDegrees {
if (longitudeDegrees != nil) {
parameters[SDLNameLongitudeDegrees] = longitudeDegrees;
} else {
[parameters removeObjectForKey:SDLNameLongitudeDegrees];
}
}
- (nullable NSNumber<SDLFloat> *)longitudeDegrees {
return parameters[SDLNameLongitudeDegrees];
}
- (void)setLatitudeDegrees:(nullable NSNumber<SDLFloat> *)latitudeDegrees {
if (latitudeDegrees != nil) {
parameters[SDLNameLatitudeDegrees] = latitudeDegrees;
} else {
[parameters removeObjectForKey:SDLNameLatitudeDegrees];
}
}
- (nullable NSNumber<SDLFloat> *)latitudeDegrees {
return parameters[SDLNameLatitudeDegrees];
}
- (void)setLocationName:(nullable NSString *)locationName {
if (locationName != nil) {
parameters[SDLNameLocationName] = locationName;
} else {
[parameters removeObjectForKey:SDLNameLocationName];
}
}
- (nullable NSString *)locationName {
return parameters[SDLNameLocationName];
}
- (void)setAddressLines:(nullable NSArray<NSString *> *)addressLines {
if (addressLines != nil) {
parameters[SDLNameAddressLines] = addressLines;
} else {
[parameters removeObjectForKey:SDLNameAddressLines];
}
}
- (nullable NSString *)locationDescription {
return parameters[SDLNameLocationDescription];
}
- (void)setLocationDescription:(nullable NSString *)locationDescription {
if (locationDescription != nil) {
parameters[SDLNameLocationDescription] = locationDescription;
} else {
[parameters removeObjectForKey:SDLNameLocationDescription];
}
}
- (nullable NSArray<NSString *> *)addressLines {
return parameters[SDLNameAddressLines];
}
- (void)setPhoneNumber:(nullable NSString *)phoneNumber {
if (phoneNumber != nil) {
parameters[SDLNamePhoneNumber] = phoneNumber;
} else {
[parameters removeObjectForKey:SDLNamePhoneNumber];
}
}
- (nullable NSString *)phoneNumber {
return parameters[SDLNamePhoneNumber];
}
- (void)setLocationImage:(nullable SDLImage *)locationImage {
if (locationImage != nil) {
parameters[SDLNameLocationImage] = locationImage;
} else {
[parameters removeObjectForKey:SDLNameLocationImage];
}
}
- (nullable SDLImage *)locationImage {
id obj = parameters[SDLNameLocationImage];
if (obj == nil || [obj isKindOfClass:[SDLImage class]]) {
return (SDLImage *)obj;
} else {
return [[SDLImage alloc] initWithDictionary:obj];
}
}
- (void)setDeliveryMode:(nullable SDLDeliveryMode)deliveryMode {
if (deliveryMode != nil) {
parameters[SDLNameDeliveryMode] = deliveryMode;
} else {
[parameters removeObjectForKey:SDLNameDeliveryMode];
}
}
- (nullable SDLDeliveryMode)deliveryMode {
return parameters[SDLNameDeliveryMode];
}
- (void)setTimeStamp:(nullable SDLDateTime *)timeStamp {
if (timeStamp != nil) {
parameters[SDLNameLocationTimeStamp] = timeStamp;
} else {
[parameters removeObjectForKey:SDLNameLocationTimeStamp];
}
}
- (nullable SDLDateTime *)timeStamp {
id obj = parameters[SDLNameLocationTimeStamp];
if (obj == nil || [obj isKindOfClass:[SDLDateTime class]]) {
return (SDLDateTime *)obj;
} else {
return [[SDLDateTime alloc] initWithDictionary:obj];
}
}
- (void)setAddress:(nullable SDLOasisAddress *)address {
if (address != nil) {
parameters[SDLNameAddress] = address;
} else {
[parameters removeObjectForKey:SDLNameAddress];
}
}
- (nullable SDLOasisAddress *)address {
id obj = parameters[SDLNameAddress];
if (obj == nil || [obj isKindOfClass:[SDLOasisAddress class]]) {
return (SDLOasisAddress *)obj;
} else {
return [[SDLOasisAddress alloc] initWithDictionary:obj];
}
}
@end
NS_ASSUME_NONNULL_END
|