summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLWeatherData.m
blob: e10663fabbfa81a68e8a9050edcdf09d93a3ecc7 (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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
//
//  SDLWeatherData.m
//  SmartDeviceLink
//
//  Created by Nicole on 2/7/19.
//  Copyright © 2019 smartdevicelink. All rights reserved.
//

#import "SDLWeatherData.h"

#import "NSMutableDictionary+Store.h"
#import "SDLDateTime.h"
#import "SDLImage.h"
#import "SDLRPCParameterNames.h"
#import "SDLTemperature.h"

NS_ASSUME_NONNULL_BEGIN

@implementation SDLWeatherData

- (instancetype)initWithCurrentTemperature:(nullable SDLTemperature *)currentTemperature temperatureHigh:(nullable SDLTemperature *)temperatureHigh temperatureLow:(nullable SDLTemperature *)temperatureLow apparentTemperature:(nullable SDLTemperature *)apparentTemperature apparentTemperatureHigh:(nullable SDLTemperature *)apparentTemperatureHigh apparentTemperatureLow:(nullable SDLTemperature *)apparentTemperatureLow weatherSummary:(nullable NSString *)weatherSummary time:(nullable SDLDateTime *)time humidity:(nullable NSNumber<SDLFloat> *)humidity cloudCover:(nullable NSNumber<SDLFloat> *)cloudCover moonPhase:(nullable NSNumber<SDLFloat> *)moonPhase windBearing:(nullable NSNumber<SDLInt> *)windBearing windGust:(nullable NSNumber<SDLFloat> *)windGust windSpeed:(nullable NSNumber<SDLFloat> *)windSpeed nearestStormBearing:(nullable NSNumber<SDLInt> *)nearestStormBearing nearestStormDistance:(nullable NSNumber<SDLInt> *)nearestStormDistance precipAccumulation:(nullable NSNumber<SDLFloat> *)precipAccumulation precipIntensity:(nullable NSNumber<SDLFloat> *)precipIntensity precipProbability:(nullable NSNumber<SDLFloat> *)precipProbability precipType:(nullable NSString *)precipType visibility:(nullable NSNumber<SDLFloat> *)visibility weatherIcon:(nullable SDLImage *)weatherIcon {
    self = [self init];
    if (!self) {
        return nil;
    }

    self.currentTemperature = currentTemperature;
    self.temperatureHigh = temperatureHigh;
    self.temperatureLow = temperatureLow;
    self.apparentTemperature = apparentTemperature;
    self.apparentTemperatureHigh = apparentTemperatureHigh;
    self.apparentTemperatureLow = apparentTemperatureLow;
    self.weatherSummary = weatherSummary;
    self.time = time;
    self.humidity = humidity;
    self.cloudCover = cloudCover;
    self.moonPhase = moonPhase;
    self.windBearing = windBearing;
    self.windGust = windGust;
    self.windSpeed = windSpeed;
    self.nearestStormBearing = nearestStormBearing;
    self.nearestStormDistance = nearestStormDistance;
    self.precipAccumulation = precipAccumulation;
    self.precipIntensity = precipIntensity;
    self.precipProbability = precipProbability;
    self.precipType = precipType;
    self.visibility = visibility;
    self.weatherIcon = weatherIcon;

    return self;
}

- (void)setCurrentTemperature:(nullable SDLTemperature *)currentTemperature {
    [store sdl_setObject:currentTemperature forName:SDLRPCParameterNameCurrentTemperature];
}

- (nullable SDLTemperature *)currentTemperature {
    return [store sdl_objectForName:SDLRPCParameterNameCurrentTemperature ofClass:SDLTemperature.class error:nil];
}

- (void)setTemperatureHigh:(nullable SDLTemperature *)temperatureHigh {
    [store sdl_setObject:temperatureHigh forName:SDLRPCParameterNameTemperatureHigh];
}

- (nullable SDLTemperature *)temperatureHigh {
    return [store sdl_objectForName:SDLRPCParameterNameTemperatureHigh ofClass:SDLTemperature.class error:nil];
}

- (void)setTemperatureLow:(nullable SDLTemperature *)temperatureLow {
    [store sdl_setObject:temperatureLow forName:SDLRPCParameterNameTemperatureLow];
}

- (nullable SDLTemperature *)temperatureLow {
    return [store sdl_objectForName:SDLRPCParameterNameTemperatureLow ofClass:SDLTemperature.class error:nil];
}

- (void)setApparentTemperature:(nullable SDLTemperature *)apparentTemperature {
    [store sdl_setObject:apparentTemperature forName:SDLRPCParameterNameApparentTemperature];
}

- (nullable SDLTemperature *)apparentTemperature {
    return [store sdl_objectForName:SDLRPCParameterNameApparentTemperature ofClass:SDLTemperature.class error:nil];
}

- (void)setApparentTemperatureHigh:(nullable SDLTemperature *)apparentTemperatureHigh {
    [store sdl_setObject:apparentTemperatureHigh forName:SDLRPCParameterNameApparentTemperatureHigh];
}

- (nullable SDLTemperature *)apparentTemperatureHigh {
    return [store sdl_objectForName:SDLRPCParameterNameApparentTemperatureHigh ofClass:SDLTemperature.class error:nil];
}

- (void)setApparentTemperatureLow:(nullable SDLTemperature *)apparentTemperatureLow {
    [store sdl_setObject:apparentTemperatureLow forName:SDLRPCParameterNameApparentTemperatureLow];
}

- (nullable SDLTemperature *)apparentTemperatureLow {
    return [store sdl_objectForName:SDLRPCParameterNameApparentTemperatureLow ofClass:SDLTemperature.class error:nil];
}

- (void)setWeatherSummary:(nullable NSString *)weatherSummary {
    [store sdl_setObject:weatherSummary forName:SDLRPCParameterNameWeatherSummary];
}

- (nullable NSString *)weatherSummary {
    return [store sdl_objectForName:SDLRPCParameterNameWeatherSummary ofClass:NSString.class error:nil];
}

- (void)setTime:(nullable SDLDateTime *)time {
    [store sdl_setObject:time forName:SDLRPCParameterNameTime];
}

- (nullable SDLDateTime *)time {
    return [store sdl_objectForName:SDLRPCParameterNameTime ofClass:SDLDateTime.class error:nil];
}

- (void)setHumidity:(nullable NSNumber<SDLFloat> *)humidity {
    [store sdl_setObject:humidity forName:SDLRPCParameterNameHumidity];
}

- (nullable NSNumber<SDLFloat> *)humidity {
    return [store sdl_objectForName:SDLRPCParameterNameHumidity ofClass:NSNumber.class error:nil];
}

- (void)setCloudCover:(nullable NSNumber<SDLFloat> *)cloudCover {
    [store sdl_setObject:cloudCover forName:SDLRPCParameterNameCloudCover];
}

- (nullable NSNumber<SDLFloat> *)cloudCover {
    return [store sdl_objectForName:SDLRPCParameterNameCloudCover ofClass:NSNumber.class error:nil];
}

- (void)setMoonPhase:(nullable NSNumber<SDLFloat> *)moonPhase {
    [store sdl_setObject:moonPhase forName:SDLRPCParameterNameMoonPhase];
}

- (nullable NSNumber<SDLFloat> *)moonPhase {
    return [store sdl_objectForName:SDLRPCParameterNameMoonPhase ofClass:NSNumber.class error:nil];
}

- (void)setWindBearing:(nullable NSNumber<SDLInt> *)windBearing {
    [store sdl_setObject:windBearing forName:SDLRPCParameterNameWindBearing];
}

- (nullable NSNumber<SDLInt> *)windBearing {
    return [store sdl_objectForName:SDLRPCParameterNameWindBearing ofClass:NSNumber.class error:nil];
}

- (void)setWindGust:(nullable NSNumber<SDLFloat> *)windGust {
    [store sdl_setObject:windGust forName:SDLRPCParameterNameWindGust];
}

- (nullable NSNumber<SDLFloat> *)windGust {
    return [store sdl_objectForName:SDLRPCParameterNameWindGust ofClass:NSNumber.class error:nil];
}

- (void)setWindSpeed:(nullable NSNumber<SDLFloat> *)windSpeed {
    [store sdl_setObject:windSpeed forName:SDLRPCParameterNameWindSpeed];
}

- (nullable NSNumber<SDLFloat> *)windSpeed {
    return [store sdl_objectForName:SDLRPCParameterNameWindSpeed ofClass:NSNumber.class error:nil];
}

- (void)setNearestStormBearing:(nullable NSNumber<SDLInt> *)nearestStormBearing {
    [store sdl_setObject:nearestStormBearing forName:SDLRPCParameterNameNearestStormBearing];
}

- (nullable NSNumber<SDLInt> *)nearestStormBearing {
    return [store sdl_objectForName:SDLRPCParameterNameNearestStormBearing ofClass:NSNumber.class error:nil];
}

- (void)setNearestStormDistance:(nullable NSNumber<SDLInt> *)nearestStormDistance {
    [store sdl_setObject:nearestStormDistance forName:SDLRPCParameterNameNearestStormDistance];
}

- (nullable NSNumber<SDLInt> *)nearestStormDistance {
    return [store sdl_objectForName:SDLRPCParameterNameNearestStormDistance ofClass:NSNumber.class error:nil];
}

- (void)setPrecipAccumulation:(nullable NSNumber<SDLFloat> *)precipAccumulation {
    [store sdl_setObject:precipAccumulation forName:SDLRPCParameterNamePrecipAccumulation];
}

- (nullable NSNumber<SDLFloat> *)precipAccumulation {
    return [store sdl_objectForName:SDLRPCParameterNamePrecipAccumulation ofClass:NSNumber.class error:nil];
}

- (void)setPrecipIntensity:(nullable NSNumber<SDLFloat> *)precipIntensity {
    [store sdl_setObject:precipIntensity forName:SDLRPCParameterNamePrecipIntensity];
}

- (nullable NSNumber<SDLFloat> *)precipIntensity {
    return [store sdl_objectForName:SDLRPCParameterNamePrecipIntensity ofClass:NSNumber.class error:nil];
}

- (void)setPrecipProbability:(nullable NSNumber<SDLFloat> *)precipProbability {
    [store sdl_setObject:precipProbability forName:SDLRPCParameterNamePrecipProbability];
}

- (nullable NSNumber<SDLFloat> *)precipProbability {
    return [store sdl_objectForName:SDLRPCParameterNamePrecipProbability ofClass:NSNumber.class error:nil];
}

- (void)setPrecipType:(nullable NSString *)precipType {
    [store sdl_setObject:precipType forName:SDLRPCParameterNamePrecipType];
}

- (nullable NSString *)precipType {
    return [store sdl_objectForName:SDLRPCParameterNamePrecipType ofClass:NSString.class error:nil];
}

- (void)setVisibility:(nullable NSNumber<SDLFloat> *)visibility {
    [store sdl_setObject:visibility forName:SDLRPCParameterNameVisibility];
}

- (nullable NSNumber<SDLFloat> *)visibility {
    return [store sdl_objectForName:SDLRPCParameterNameVisibility ofClass:NSNumber.class error:nil];
}

- (void)setWeatherIcon:(nullable SDLImage *)weatherIcon {
    [store sdl_setObject:weatherIcon forName:SDLRPCParameterNameWeatherIcon];
}

- (nullable SDLImage *)weatherIcon {
    return [store sdl_objectForName:SDLRPCParameterNameWeatherIcon ofClass:SDLImage.class error:nil];
}

@end

NS_ASSUME_NONNULL_END