diff options
Diffstat (limited to 'SmartDeviceLink/SDLFuelRange.m')
-rw-r--r-- | SmartDeviceLink/SDLFuelRange.m | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLFuelRange.m b/SmartDeviceLink/SDLFuelRange.m index 1512a0957..f8e54736d 100644 --- a/SmartDeviceLink/SDLFuelRange.m +++ b/SmartDeviceLink/SDLFuelRange.m @@ -15,6 +15,20 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLFuelRange +- (instancetype)initWithType:(nullable SDLFuelType)type range:(float)range level:(float)level levelState:(nullable SDLComponentVolumeStatus)levelState capacity:(float)capacity capacityUnit:(nullable SDLCapacityUnit)capacityUnit { + self = [super init]; + if (!self) { + return nil; + } + self.type = type; + self.range = @(range); + self.level = @(level); + self.levelState = levelState; + self.capacity = @(capacity); + self.capacityUnit = capacityUnit; + return self; +} + - (void)setType:(nullable SDLFuelType)type { [self.store sdl_setObject:type forName:SDLRPCParameterNameType]; } @@ -31,6 +45,41 @@ NS_ASSUME_NONNULL_BEGIN return [self.store sdl_objectForName:SDLRPCParameterNameRange ofClass:NSNumber.class error:nil]; } +- (void)setLevel:(nullable NSNumber<SDLFloat> *)level { + [self.store sdl_setObject:level forName:SDLRPCParameterNameLevel]; +} + +- (nullable NSNumber<SDLFloat> *)level { + NSError *error = nil; + return [self.store sdl_objectForName:SDLRPCParameterNameLevel ofClass:NSNumber.class error:&error]; +} + +- (void)setLevelState:(nullable SDLComponentVolumeStatus)levelState { + [self.store sdl_setObject:levelState forName:SDLRPCParameterNameLevelState]; +} + +- (nullable SDLComponentVolumeStatus)levelState { + NSError *error = nil; + return [self.store sdl_enumForName:SDLRPCParameterNameLevelState error:&error]; +} + +- (void)setCapacity:(nullable NSNumber<SDLFloat> *)capacity { + [self.store sdl_setObject:capacity forName:SDLRPCParameterNameCapacity]; +} + +- (nullable NSNumber<SDLFloat> *)capacity { + NSError *error = nil; + return [self.store sdl_objectForName:SDLRPCParameterNameCapacity ofClass:NSNumber.class error:&error]; +} + +- (void)setCapacityUnit:(nullable SDLCapacityUnit)capacityUnit { + [self.store sdl_setObject:capacityUnit forName:SDLRPCParameterNameCapacityUnit]; +} + +- (nullable SDLCapacityUnit)capacityUnit { + NSError *error = nil; + return [self.store sdl_enumForName:SDLRPCParameterNameCapacityUnit error:&error]; +} @end |