diff options
author | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-08-10 21:43:42 +0300 |
---|---|---|
committer | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-08-10 21:47:06 +0300 |
commit | 67a8c0e6e6aaa20e3ff9c1f24cf959cee6a72ef3 (patch) | |
tree | efb9346bb9ac1096ca507ede4e89e6fba72f603c | |
parent | 1638fdb4cff73473eeb1498554be3bc68715e0ab (diff) | |
download | sdl_ios-67a8c0e6e6aaa20e3ff9c1f24cf959cee6a72ef3.tar.gz |
0266 "New vehicle data GearStatus": code review 4, fix GetVehicleData*, PRNDL and connected tests.
-rw-r--r-- | SmartDeviceLink/SDLGetVehicleData.h | 481 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGetVehicleData.m | 218 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGetVehicleDataResponse.h | 287 | ||||
-rw-r--r-- | SmartDeviceLink/SDLGetVehicleDataResponse.m | 178 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPRNDL.h | 102 | ||||
-rw-r--r-- | SmartDeviceLink/SDLPRNDL.m | 56 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPRNDLSpec.m | 28 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m | 551 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m | 433 |
9 files changed, 1039 insertions, 1295 deletions
diff --git a/SmartDeviceLink/SDLGetVehicleData.h b/SmartDeviceLink/SDLGetVehicleData.h index b62f96151..2a62e4a7b 100644 --- a/SmartDeviceLink/SDLGetVehicleData.h +++ b/SmartDeviceLink/SDLGetVehicleData.h @@ -1,187 +1,124 @@ -/* - * Copyright (c) 2020, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +// SDLGetVehicleData.h +// -#import "SDLRPCRequest.h" -NS_ASSUME_NONNULL_BEGIN +#import "SDLRPCRequest.h" /** - * Non periodic vehicle data read request. + * Requests current values of specific published vehicle data items. * - * @since SDL 2.0.0 + * Function Group: Location, VehicleInfo and DrivingChara + * HMILevel needs to be FULL, LIMITED or BACKGROUND + * Since SmartDeviceLink 2.0 + * See SDLSubscribeVehicleData, SDLUnsubscribeVehicleData */ -@interface SDLGetVehicleData : SDLRPCRequest -/** - * Convenience init for getting data for all possible vehicle data items. - * - * @param accelerationPedalPosition Get accelerationPedalPosition data - * @param airbagStatus Get airbagStatus data - * @param beltStatus Get beltStatus data - * @param bodyInformation Get bodyInformation data - * @param clusterModeStatus Get clusterModeStatus data - * @param deviceStatus Get deviceStatus data - * @param driverBraking Get driverBraking data - * @param eCallInfo Get eCallInfo data - * @param emergencyEvent Get emergencyEvent data - * @param engineTorque Get engineTorque data - * @param externalTemperature Get externalTemperature data - * @param fuelLevel Get fuelLevel data - * @param fuelLevelState Get fuelLevelState data - * @param gps Get gps data - * @param headLampStatus Get headLampStatus data - * @param instantFuelConsumption Get instantFuelConsumption data - * @param myKey Get myKey data - * @param odometer Get odometer data - * @param prndl Get prndl data - * @param rpm Get rpm data - * @param speed Get speed data - * @param steeringWheelAngle Get steeringWheelAngle data - * @param tirePressure Get tirePressure data - * @param vin Get vin data - * @param wiperStatus Get wiperStatus data - * @return A SDLGetVehicleData object - */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo emergencyEvent:(BOOL)emergencyEvent engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gearStatus:gps:headLampStatus:instantFuelConsumption:myKey:odometer:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:vin:wiperStatus: instead"); +NS_ASSUME_NONNULL_BEGIN + +@interface SDLGetVehicleData : SDLRPCRequest /** * Convenience init for getting data for all possible vehicle data items. * - * @param accelerationPedalPosition Get accelerationPedalPosition data - * @param airbagStatus Get airbagStatus data - * @param beltStatus Get beltStatus data - * @param bodyInformation Get bodyInformation data - * @param clusterModeStatus Get clusterModeStatus data - * @param deviceStatus Get deviceStatus data - * @param driverBraking Get driverBraking data - * @param eCallInfo Get eCallInfo data - * @param electronicParkBrakeStatus Get electronicParkBrakeStatus data - * @param emergencyEvent Get emergencyEvent data - * @param engineOilLife Get engineOilLife data - * @param engineTorque Get engineTorque data - * @param externalTemperature Get externalTemperature data - * @param fuelLevel Get fuelLevel data - * @param fuelLevelState Get fuelLevelState data - * @param fuelRange Get fuelRange data - * @param gps Get gps data - * @param headLampStatus Get headLampStatus data - * @param instantFuelConsumption Get instantFuelConsumption data - * @param myKey Get myKey data - * @param odometer Get odometer data - * @param prndl Get prndl data - * @param rpm Get rpm data - * @param speed Get speed data - * @param steeringWheelAngle Get steeringWheelAngle data - * @param tirePressure Get tirePressure data - * @param turnSignal Get turnSignal data - * @param vin Get vin data - * @param wiperStatus Get wiperStatus data - * @returnA SDLGetVehicleData object - */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gearStatus:gps:headLampStatus:instantFuelConsumption:myKey:odometer:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:vin:wiperStatus: instead"); - + * @param accelerationPedalPosition Get accelerationPedalPosition data + * @param airbagStatus Get airbagStatus data + * @param beltStatus Get beltStatus data + * @param bodyInformation Get bodyInformation data + * @param clusterModeStatus Get clusterModeStatus data + * @param deviceStatus Get deviceStatus data + * @param driverBraking Get driverBraking data + * @param eCallInfo Get eCallInfo data + * @param emergencyEvent Get emergencyEvent data + * @param engineTorque Get engineTorque data + * @param externalTemperature Get externalTemperature data + * @param fuelLevel Get fuelLevel data + * @param fuelLevelState Get fuelLevelState data + * @param gps Get gps data + * @param headLampStatus Get headLampStatus data + * @param instantFuelConsumption Get instantFuelConsumption data + * @param myKey Get myKey data + * @param odometer Get odometer data + * @param prndl Get prndl data + * @param rpm Get rpm data + * @param speed Get speed data + * @param steeringWheelAngle Get steeringWheelAngle data + * @param tirePressure Get tirePressure data + * @param vin Get vin data + * @param wiperStatus Get wiperStatus data + * @return A SDLGetVehicleData object + */ +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo emergencyEvent:(BOOL)emergencyEvent engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey: instead"); /** * Convenience init for getting data for all possible vehicle data items. * - * @param accelerationPedalPosition Get accelerationPedalPosition data - * @param airbagStatus Get airbagStatus data - * @param beltStatus Get beltStatus data - * @param bodyInformation Get bodyInformation data - * @param cloudAppVehicleID Get cloudAppVehicleID data - * @param clusterModeStatus Get clusterModeStatus data - * @param deviceStatus Get deviceStatus data - * @param driverBraking Get driverBraking data - * @param eCallInfo Get eCallInfo data - * @param electronicParkBrakeStatus Get electronicParkBrakeStatus data - * @param emergencyEvent Get emergencyEvent data - * @param engineOilLife Get engineOilLife data - * @param engineTorque Get engineTorque data - * @param externalTemperature Get externalTemperature data - * @param fuelLevel Get fuelLevel data - * @param fuelLevelState Get fuelLevelState data - * @param fuelRange Get fuelRange data - * @param gps Get gps data - * @param headLampStatus Get headLampStatus data - * @param instantFuelConsumption Get instantFuelConsumption data - * @param myKey Get myKey data - * @param odometer Get odometer data - * @param prndl Get prndl data - * @param rpm Get rpm data - * @param speed Get speed data - * @param steeringWheelAngle Get steeringWheelAngle data - * @param tirePressure Get tirePressure data - * @param turnSignal Get turnSignal data - * @param vin Get vin data - * @param wiperStatus Get wiperStatus data - * @return A SDLGetVehicleData object - */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gearStatus:gps:headLampStatus:instantFuelConsumption:myKey:odometer:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:vin:wiperStatus: instead"); - + * @param accelerationPedalPosition Get accelerationPedalPosition data + * @param airbagStatus Get airbagStatus data + * @param beltStatus Get beltStatus data + * @param bodyInformation Get bodyInformation data + * @param clusterModeStatus Get clusterModeStatus data + * @param deviceStatus Get deviceStatus data + * @param driverBraking Get driverBraking data + * @param eCallInfo Get eCallInfo data + * @param electronicParkBrakeStatus Get electronicParkBrakeStatus data + * @param emergencyEvent Get emergencyEvent data + * @param engineOilLife Get engineOilLife data + * @param engineTorque Get engineTorque data + * @param externalTemperature Get externalTemperature data + * @param fuelLevel Get fuelLevel data + * @param fuelLevelState Get fuelLevelState data + * @param fuelRange Get fuelRange data + * @param gps Get gps data + * @param headLampStatus Get headLampStatus data + * @param instantFuelConsumption Get instantFuelConsumption data + * @param myKey Get myKey data + * @param odometer Get odometer data + * @param prndl Get prndl data + * @param rpm Get rpm data + * @param speed Get speed data + * @param steeringWheelAngle Get steeringWheelAngle data + * @param tirePressure Get tirePressure data + * @param turnSignal Get turnSignal data + * @param vin Get vin data + * @param wiperStatus Get wiperStatus data + * @return A SDLGetVehicleData object + */ +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey: instead"); /** * Convenience init for getting data for all possible vehicle data items. * - * @param accelerationPedalPosition Get accelerationPedalPosition data - * @param airbagStatus Get airbagStatus data - * @param beltStatus Get beltStatus data - * @param bodyInformation Get bodyInformation data - * @param cloudAppVehicleID Get cloudAppVehicleID data - * @param clusterModeStatus Get clusterModeStatus data - * @param deviceStatus Get deviceStatus data - * @param driverBraking Get driverBraking data - * @param eCallInfo Get eCallInfo data - * @param electronicParkBrakeStatus Get electronicParkBrakeStatus data - * @param emergencyEvent Get emergencyEvent data - * @param engineOilLife Get engineOilLife data - * @param engineTorque Get engineTorque data - * @param externalTemperature Get externalTemperature data - * @param fuelLevel Get fuelLevel data - * @param fuelLevelState Get fuelLevelState data - * @param fuelRange Get fuelRange data - * @param gearStatus Get gearStatus data - * @param gps Get gps data - * @param headLampStatus Get headLampStatus data - * @param instantFuelConsumption Get instantFuelConsumption data - * @param myKey Get myKey data - * @param odometer Get odometer data - * @param rpm Get rpm data - * @param speed Get speed data - * @param steeringWheelAngle Get steeringWheelAngle data - * @param tirePressure Get tirePressure data - * @param turnSignal Get turnSignal data - * @param vin Get vin data - * @param wiperStatus Get wiperStatus data - * @return A SDLGetVehicleData object - */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gearStatus:(BOOL)gearStatus gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus; + * @param accelerationPedalPosition Get accelerationPedalPosition data + * @param airbagStatus Get airbagStatus data + * @param beltStatus Get beltStatus data + * @param bodyInformation Get bodyInformation data + * @param cloudAppVehicleID Get cloudAppVehicleID data + * @param clusterModeStatus Get clusterModeStatus data + * @param deviceStatus Get deviceStatus data + * @param driverBraking Get driverBraking data + * @param eCallInfo Get eCallInfo data + * @param electronicParkBrakeStatus Get electronicParkBrakeStatus data + * @param emergencyEvent Get emergencyEvent data + * @param engineOilLife Get engineOilLife data + * @param engineTorque Get engineTorque data + * @param externalTemperature Get externalTemperature data + * @param fuelLevel Get fuelLevel data + * @param fuelLevelState Get fuelLevelState data + * @param fuelRange Get fuelRange data + * @param gps Get gps data + * @param headLampStatus Get headLampStatus data + * @param instantFuelConsumption Get instantFuelConsumption data + * @param myKey Get myKey data + * @param odometer Get odometer data + * @param prndl Get prndl data + * @param rpm Get rpm data + * @param speed Get speed data + * @param steeringWheelAngle Get steeringWheelAngle data + * @param tirePressure Get tirePressure data + * @param turnSignal Get turnSignal data + * @param vin Get vin data + * @param wiperStatus Get wiperStatus data + * @return A SDLGetVehicleData object + */ +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey: instead"); /** * note: RPC generator produced initializer @@ -196,7 +133,6 @@ NS_ASSUME_NONNULL_BEGIN * @param turnSignal - turnSignal * @param vin - vin * @param gearStatus - gearStatus - * @param prndl - prndl * @param tirePressure - tirePressure * @param odometer - odometer * @param beltStatus - beltStatus @@ -218,249 +154,184 @@ NS_ASSUME_NONNULL_BEGIN * @param myKey - myKey * @return A SDLGetVehicleData object */ -- (instancetype)initWithGps:(nullable NSNumber<SDLBool> *)gps speed:(nullable NSNumber<SDLBool> *)speed rpm:(nullable NSNumber<SDLBool> *)rpm fuelLevel:(nullable NSNumber<SDLBool> *)fuelLevel fuelLevel_State:(nullable NSNumber<SDLBool> *)fuelLevel_State instantFuelConsumption:(nullable NSNumber<SDLBool> *)instantFuelConsumption fuelRange:(nullable NSNumber<SDLBool> *)fuelRange externalTemperature:(nullable NSNumber<SDLBool> *)externalTemperature turnSignal:(nullable NSNumber<SDLBool> *)turnSignal vin:(nullable NSNumber<SDLBool> *)vin gearStatus:(nullable NSNumber<SDLBool> *)gearStatus prndl:(nullable NSNumber<SDLBool> *)prndl tirePressure:(nullable NSNumber<SDLBool> *)tirePressure odometer:(nullable NSNumber<SDLBool> *)odometer beltStatus:(nullable NSNumber<SDLBool> *)beltStatus bodyInformation:(nullable NSNumber<SDLBool> *)bodyInformation deviceStatus:(nullable NSNumber<SDLBool> *)deviceStatus driverBraking:(nullable NSNumber<SDLBool> *)driverBraking wiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus headLampStatus:(nullable NSNumber<SDLBool> *)headLampStatus engineTorque:(nullable NSNumber<SDLBool> *)engineTorque accPedalPosition:(nullable NSNumber<SDLBool> *)accPedalPosition steeringWheelAngle:(nullable NSNumber<SDLBool> *)steeringWheelAngle engineOilLife:(nullable NSNumber<SDLBool> *)engineOilLife electronicParkBrakeStatus:(nullable NSNumber<SDLBool> *)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSNumber<SDLBool> *)cloudAppVehicleID eCallInfo:(nullable NSNumber<SDLBool> *)eCallInfo airbagStatus:(nullable NSNumber<SDLBool> *)airbagStatus emergencyEvent:(nullable NSNumber<SDLBool> *)emergencyEvent clusterModeStatus:(nullable NSNumber<SDLBool> *)clusterModeStatus myKey:(nullable NSNumber<SDLBool> *)myKey; +- (instancetype)initWithGps:(nullable NSNumber<SDLBool> *)gps speed:(nullable NSNumber<SDLBool> *)speed rpm:(nullable NSNumber<SDLBool> *)rpm fuelLevel:(nullable NSNumber<SDLBool> *)fuelLevel fuelLevel_State:(nullable NSNumber<SDLBool> *)fuelLevel_State instantFuelConsumption:(nullable NSNumber<SDLBool> *)instantFuelConsumption fuelRange:(nullable NSNumber<SDLBool> *)fuelRange externalTemperature:(nullable NSNumber<SDLBool> *)externalTemperature turnSignal:(nullable NSNumber<SDLBool> *)turnSignal vin:(nullable NSNumber<SDLBool> *)vin gearStatus:(nullable NSNumber<SDLBool> *)gearStatus tirePressure:(nullable NSNumber<SDLBool> *)tirePressure odometer:(nullable NSNumber<SDLBool> *)odometer beltStatus:(nullable NSNumber<SDLBool> *)beltStatus bodyInformation:(nullable NSNumber<SDLBool> *)bodyInformation deviceStatus:(nullable NSNumber<SDLBool> *)deviceStatus driverBraking:(nullable NSNumber<SDLBool> *)driverBraking wiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus headLampStatus:(nullable NSNumber<SDLBool> *)headLampStatus engineTorque:(nullable NSNumber<SDLBool> *)engineTorque accPedalPosition:(nullable NSNumber<SDLBool> *)accPedalPosition steeringWheelAngle:(nullable NSNumber<SDLBool> *)steeringWheelAngle engineOilLife:(nullable NSNumber<SDLBool> *)engineOilLife electronicParkBrakeStatus:(nullable NSNumber<SDLBool> *)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSNumber<SDLBool> *)cloudAppVehicleID eCallInfo:(nullable NSNumber<SDLBool> *)eCallInfo airbagStatus:(nullable NSNumber<SDLBool> *)airbagStatus emergencyEvent:(nullable NSNumber<SDLBool> *)emergencyEvent clusterModeStatus:(nullable NSNumber<SDLBool> *)clusterModeStatus myKey:(nullable NSNumber<SDLBool> *)myKey; /** - * A boolean value. If true, requests Acc Pedal Position data. - * - * Optional. + * A boolean value. If true, requests Gear Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gearStatus; /** - * A boolean value. If true, requests Air Bag Status data. - * - * Optional. + * A boolean value. If true, requests GPS data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *gps; /** - * A boolean value. If true, requests Belt Status data. - * - * Optional. + * A boolean value. If true, requests Speed data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *speed; /** - * A boolean value. If true, requests Body Information data. - * - * Optional. + * A boolean value. If true, requests RPM data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *rpm; /** - A boolean value. If true, requests the Cloud App Vehicle ID. - - Optional. + * A boolean value. If true, requests Fuel Level data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *fuelLevel; /** - * A boolean value. If true, requests Cluster Mode Status data. - * - * Optional. + * A boolean value. If true, requests Fuel Level State data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *fuelLevel_State; /** - * A boolean value. If true, requests Device Status data. - * - * Optional. + * A boolean value. If true, requests Fuel Range data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *fuelRange; /** - * A boolean value. If true, requests Driver Braking data. - * - * Optional. + * A boolean value. If true, requests Instant Fuel Consumption data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *instantFuelConsumption; /** - * A boolean value. If true, requests Emergency Call Info data. - * - * Optional. + * A boolean value. If true, requests External Temperature data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *externalTemperature; /** - A boolean value. If true, requests Electronic Parking Brake status data. - - Optional. + * A boolean value. If true, requests the Vehicle Identification Number. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *vin; /** - * A boolean value. If true, requests Emergency Event (if it occurred) data. - * - * Optional. + * A boolean value. If true, requests PRNDL data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl __deprecated_msg("use gearStatus instead"); /** - * A boolean value. If true, requests Engine Oil Life data. - * - * Optional. + * A boolean value. If true, requests Tire Pressure data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *tirePressure; /** - * A boolean value. If true, requests Engine Torque data. - * - * Optional. + * A boolean value. If true, requests Odometer data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *odometer; /** - * A boolean value. If true, requests External Temperature data. - * - * Optional. + * A boolean value. If true, requests Belt Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *beltStatus; /** - * A boolean value. If true, requests Fuel Level data. - * - * Optional. + * A boolean value. If true, requests Body Information data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *bodyInformation; /** - * A boolean value. If true, requests Fuel Level State data. - * - * Optional. + * A boolean value. If true, requests Device Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *deviceStatus; /** - * A boolean value. If true, requests Fuel Range data. - * Optional. + * A boolean value. If true, requests Driver Braking data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *driverBraking; /** - * See GearStatus - * - * Optional. - * - * @since SDL 7.0.0 + * A boolean value. If true, requests Wiper Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gearStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *wiperStatus; /** - * A boolean value. If true, requests GPS data. - * - * Optional. + * A boolean value. If true, requests Head Lamp Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *headLampStatus; /** - * A boolean value. If true, requests Head Lamp Status data. - * - * Optional. + * A boolean value. If true, requests Engine Oil Life data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *headLampStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; /** - * A boolean value. If true, requests Instant Fuel Consumption data. - * - * Optional. + * A boolean value. If true, requests Engine Torque data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *engineTorque; /** - * A boolean value. If true, requests PRNDL data. - * - * Optional. - * - * @deprecated - * @since SDL 7.0.0 + * A boolean value. If true, requests Acc Pedal Position data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl __deprecated_msg("use gearStatus instead"); +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *accPedalPosition; /** - * A boolean value. If true, requests MyKey data. - * - * Optional. + * A boolean value. If true, requests Steering Wheel Angle data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *steeringWheelAngle; /** - * A boolean value. If true, requests Odometer data. - * - * Optional. + * A boolean value. If true, requests Emergency Call Info data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *eCallInfo; /** - * A boolean value. If true, requests RPM data. - * - * Optional. + * A boolean value. If true, requests Air Bag Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *airbagStatus; /** - * A boolean value. If true, requests Speed data. - * - * Optional. + * A boolean value. If true, requests Emergency Event (if it occurred) data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *emergencyEvent; /** - * A boolean value. If true, requests Steering Wheel Angle data. - * - * Optional. + * A boolean value. If true, requests Cluster Mode Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *clusterModeStatus; /** - * A boolean value. If true, requests Tire Pressure data. - * - * Optional. + * A boolean value. If true, requests MyKey data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *myKey; /** - A boolean value. If true, requests Turn Signal data. - - Optional. + A boolean value. If true, requests Electronic Parking Brake status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *electronicParkBrakeStatus; /** - * A boolean value. If true, requests the Vehicle Identification Number. - * - * Optional. + A boolean value. If true, requests Turn Signal data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *vin; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *turnSignal; /** - * A boolean value. If true, requests Wiper Status data. - * - * Optional. + A boolean value. If true, requests the Cloud App Vehicle ID. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *cloudAppVehicleID; /** - Gets the OEM custom vehicle data value for any given OEM custom vehicle data name. - + Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. + @param vehicleDataName The name of the OEM custom vehicle data item. - @return The state of an OEM custom vehicle data item for the given vehicle data name. + @param vehicleDataState A boolean value. If true, requests the OEM custom vehicle data item. Added in SmartDeviceLink 6.0 */ -- (nullable NSNumber<SDLBool> *)getOEMCustomVehicleData:(NSString *)vehicleDataName; +- (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(BOOL)vehicleDataState NS_SWIFT_NAME(setOEMCustomVehicleData(name:state:)); /** - Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. - + Gets the OEM custom vehicle data value for any given OEM custom vehicle data name. + @param vehicleDataName The name of the OEM custom vehicle data item. - @param vehicleDataState A boolean value. If true, requests the OEM custom vehicle data item. + @return The state of an OEM custom vehicle data item for the given vehicle data name. Added in SmartDeviceLink 6.0 */ -- (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(BOOL)vehicleDataState NS_SWIFT_NAME(setOEMCustomVehicleData(name:state:)); +- (nullable NSNumber<SDLBool> *)getOEMCustomVehicleData:(NSString *)vehicleDataName; @end NS_ASSUME_NONNULL_END + diff --git a/SmartDeviceLink/SDLGetVehicleData.m b/SmartDeviceLink/SDLGetVehicleData.m index ee0098d0f..a45f47505 100644 --- a/SmartDeviceLink/SDLGetVehicleData.m +++ b/SmartDeviceLink/SDLGetVehicleData.m @@ -1,39 +1,12 @@ -/* - * Copyright (c) 2020, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +// SDLGetVehicleData.m +// + -#import "NSMutableDictionary+Store.h" #import "SDLGetVehicleData.h" -#import "SDLRPCFunctionNames.h" + +#import "NSMutableDictionary+Store.h" #import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" NS_ASSUME_NONNULL_BEGIN @@ -42,74 +15,46 @@ NS_ASSUME_NONNULL_BEGIN #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - (instancetype)init { - self = [super initWithName:SDLRPCFunctionNameGetVehicleData]; - if (!self) { - return nil; + if (self = [super initWithName:SDLRPCFunctionNameGetVehicleData]) { } return self; } #pragma clang diagnostic pop - (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo emergencyEvent:(BOOL)emergencyEvent engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { - return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure turnSignal:NO vin:vin wiperStatus:wiperStatus]; + self = [self initWithGps:@(gps) speed:@(speed) rpm:@(rpm) fuelLevel:@(fuelLevel) fuelLevel_State:@(fuelLevelState) instantFuelConsumption:@(instantFuelConsumption) fuelRange:nil externalTemperature:@(externalTemperature) turnSignal:nil vin:@(vin) gearStatus:nil tirePressure:@(tirePressure) odometer:@(odometer) beltStatus:@(beltStatus) bodyInformation:@(bodyInformation) deviceStatus:@(deviceStatus) driverBraking:@(driverBraking) wiperStatus:@(wiperStatus) headLampStatus:@(headLampStatus) engineTorque:@(engineTorque) accPedalPosition:@(accelerationPedalPosition) steeringWheelAngle:@(steeringWheelAngle) engineOilLife:nil electronicParkBrakeStatus:nil cloudAppVehicleID:nil eCallInfo:@(eCallInfo) airbagStatus:@(airbagStatus) emergencyEvent:@(emergencyEvent) clusterModeStatus:@(clusterModeStatus) myKey:@(myKey)]; + if (self) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + self.prndl = @(prndl); +#pragma clang diagnostic pop + } + return self; } - (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { - return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation cloudAppVehicleID:NO clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:electronicParkBrakeStatus emergencyEvent:emergencyEvent engineOilLife:engineOilLife engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:fuelRange gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure turnSignal:turnSignal vin:vin wiperStatus:wiperStatus]; -} - -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { - self = [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation cloudAppVehicleID:cloudAppVehicleID clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:electronicParkBrakeStatus emergencyEvent:emergencyEvent engineOilLife:engineOilLife engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:fuelRange gearStatus:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure turnSignal:turnSignal vin:vin wiperStatus:wiperStatus]; + self = [self initWithGps:@(gps) speed:@(speed) rpm:@(rpm) fuelLevel:@(fuelLevel) fuelLevel_State:@(fuelLevelState) instantFuelConsumption:@(instantFuelConsumption) fuelRange:@(fuelRange) externalTemperature:@(externalTemperature) turnSignal:@(turnSignal) vin:@(vin) gearStatus:nil tirePressure:@(tirePressure) odometer:@(odometer) beltStatus:@(beltStatus) bodyInformation:@(bodyInformation) deviceStatus:@(deviceStatus) driverBraking:@(driverBraking) wiperStatus:@(wiperStatus) headLampStatus:@(headLampStatus) engineTorque:@(engineTorque) accPedalPosition:@(accelerationPedalPosition) steeringWheelAngle:@(steeringWheelAngle) engineOilLife:@(engineOilLife) electronicParkBrakeStatus:@(electronicParkBrakeStatus) cloudAppVehicleID:nil eCallInfo:@(eCallInfo) airbagStatus:@(airbagStatus) emergencyEvent:@(emergencyEvent) clusterModeStatus:@(clusterModeStatus) myKey:@(myKey)]; + if (self) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" self.prndl = @(prndl); #pragma clang diagnostic pop + } return self; } -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gearStatus:(BOOL)gearStatus gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { - self = [self init]; - if (!self) { - return nil; +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { + self = [self initWithGps:@(gps) speed:@(speed) rpm:@(rpm) fuelLevel:@(fuelLevel) fuelLevel_State:@(fuelLevelState) instantFuelConsumption:@(instantFuelConsumption) fuelRange:@(fuelRange) externalTemperature:@(externalTemperature) turnSignal:@(turnSignal) vin:@(vin) gearStatus:nil tirePressure:@(tirePressure) odometer:@(odometer) beltStatus:@(beltStatus) bodyInformation:@(bodyInformation) deviceStatus:@(deviceStatus) driverBraking:@(driverBraking) wiperStatus:@(wiperStatus) headLampStatus:@(headLampStatus) engineTorque:@(engineTorque) accPedalPosition:@(accelerationPedalPosition) steeringWheelAngle:@(steeringWheelAngle) engineOilLife:@(engineOilLife) electronicParkBrakeStatus:@(electronicParkBrakeStatus) cloudAppVehicleID:@(cloudAppVehicleID) eCallInfo:@(eCallInfo) airbagStatus:@(airbagStatus) emergencyEvent:@(emergencyEvent) clusterModeStatus:@(clusterModeStatus) myKey:@(myKey)]; + if (self) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + self.prndl = @(prndl); +#pragma clang diagnostic pop } - - self.accPedalPosition = @(accelerationPedalPosition); - self.airbagStatus = @(airbagStatus); - self.beltStatus = @(beltStatus); - self.bodyInformation = @(bodyInformation); - self.cloudAppVehicleID = @(cloudAppVehicleID); - self.clusterModeStatus = @(clusterModeStatus); - self.deviceStatus = @(deviceStatus); - self.driverBraking = @(driverBraking); - self.eCallInfo = @(eCallInfo); - self.electronicParkBrakeStatus = @(electronicParkBrakeStatus); - self.emergencyEvent = @(emergencyEvent); - self.engineOilLife = @(engineOilLife); - self.engineTorque = @(engineTorque); - self.externalTemperature = @(externalTemperature); - self.fuelLevel = @(fuelLevel); - self.fuelLevel_State = @(fuelLevelState); - self.fuelRange = @(fuelRange); - self.myKey = @(myKey); - self.odometer = @(odometer); - self.gps = @(gps); - self.headLampStatus = @(headLampStatus); - self.instantFuelConsumption = @(instantFuelConsumption); - self.gearStatus = @(gearStatus); - self.rpm = @(rpm); - self.speed = @(speed); - self.steeringWheelAngle = @(steeringWheelAngle); - self.tirePressure = @(tirePressure); - self.turnSignal = @(turnSignal); - self.vin = @(vin); - self.wiperStatus = @(wiperStatus); - return self; } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -- (instancetype)initWithGps:(nullable NSNumber<SDLBool> *)gps speed:(nullable NSNumber<SDLBool> *)speed rpm:(nullable NSNumber<SDLBool> *)rpm fuelLevel:(nullable NSNumber<SDLBool> *)fuelLevel fuelLevel_State:(nullable NSNumber<SDLBool> *)fuelLevel_State instantFuelConsumption:(nullable NSNumber<SDLBool> *)instantFuelConsumption fuelRange:(nullable NSNumber<SDLBool> *)fuelRange externalTemperature:(nullable NSNumber<SDLBool> *)externalTemperature turnSignal:(nullable NSNumber<SDLBool> *)turnSignal vin:(nullable NSNumber<SDLBool> *)vin gearStatus:(nullable NSNumber<SDLBool> *)gearStatus prndl:(nullable NSNumber<SDLBool> *)prndl tirePressure:(nullable NSNumber<SDLBool> *)tirePressure odometer:(nullable NSNumber<SDLBool> *)odometer beltStatus:(nullable NSNumber<SDLBool> *)beltStatus bodyInformation:(nullable NSNumber<SDLBool> *)bodyInformation deviceStatus:(nullable NSNumber<SDLBool> *)deviceStatus driverBraking:(nullable NSNumber<SDLBool> *)driverBraking wiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus headLampStatus:(nullable NSNumber<SDLBool> *)headLampStatus engineTorque:(nullable NSNumber<SDLBool> *)engineTorque accPedalPosition:(nullable NSNumber<SDLBool> *)accPedalPosition steeringWheelAngle:(nullable NSNumber<SDLBool> *)steeringWheelAngle engineOilLife:(nullable NSNumber<SDLBool> *)engineOilLife electronicParkBrakeStatus:(nullable NSNumber<SDLBool> *)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSNumber<SDLBool> *)cloudAppVehicleID eCallInfo:(nullable NSNumber<SDLBool> *)eCallInfo airbagStatus:(nullable NSNumber<SDLBool> *)airbagStatus emergencyEvent:(nullable NSNumber<SDLBool> *)emergencyEvent clusterModeStatus:(nullable NSNumber<SDLBool> *)clusterModeStatus myKey:(nullable NSNumber<SDLBool> *)myKey { +- (instancetype)initWithGps:(nullable NSNumber<SDLBool> *)gps speed:(nullable NSNumber<SDLBool> *)speed rpm:(nullable NSNumber<SDLBool> *)rpm fuelLevel:(nullable NSNumber<SDLBool> *)fuelLevel fuelLevel_State:(nullable NSNumber<SDLBool> *)fuelLevel_State instantFuelConsumption:(nullable NSNumber<SDLBool> *)instantFuelConsumption fuelRange:(nullable NSNumber<SDLBool> *)fuelRange externalTemperature:(nullable NSNumber<SDLBool> *)externalTemperature turnSignal:(nullable NSNumber<SDLBool> *)turnSignal vin:(nullable NSNumber<SDLBool> *)vin gearStatus:(nullable NSNumber<SDLBool> *)gearStatus tirePressure:(nullable NSNumber<SDLBool> *)tirePressure odometer:(nullable NSNumber<SDLBool> *)odometer beltStatus:(nullable NSNumber<SDLBool> *)beltStatus bodyInformation:(nullable NSNumber<SDLBool> *)bodyInformation deviceStatus:(nullable NSNumber<SDLBool> *)deviceStatus driverBraking:(nullable NSNumber<SDLBool> *)driverBraking wiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus headLampStatus:(nullable NSNumber<SDLBool> *)headLampStatus engineTorque:(nullable NSNumber<SDLBool> *)engineTorque accPedalPosition:(nullable NSNumber<SDLBool> *)accPedalPosition steeringWheelAngle:(nullable NSNumber<SDLBool> *)steeringWheelAngle engineOilLife:(nullable NSNumber<SDLBool> *)engineOilLife electronicParkBrakeStatus:(nullable NSNumber<SDLBool> *)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSNumber<SDLBool> *)cloudAppVehicleID eCallInfo:(nullable NSNumber<SDLBool> *)eCallInfo airbagStatus:(nullable NSNumber<SDLBool> *)airbagStatus emergencyEvent:(nullable NSNumber<SDLBool> *)emergencyEvent clusterModeStatus:(nullable NSNumber<SDLBool> *)clusterModeStatus myKey:(nullable NSNumber<SDLBool> *)myKey { self = [self init]; if (!self) { return nil; @@ -125,7 +70,6 @@ NS_ASSUME_NONNULL_BEGIN self.turnSignal = turnSignal; self.vin = vin; self.gearStatus = gearStatus; - self.prndl = prndl; self.tirePressure = tirePressure; self.odometer = odometer; self.beltStatus = beltStatus; @@ -147,15 +91,13 @@ NS_ASSUME_NONNULL_BEGIN self.myKey = myKey; return self; } -#pragma clang diagnostic pop - (void)setGps:(nullable NSNumber<SDLBool> *)gps { [self.parameters sdl_setObject:gps forName:SDLRPCParameterNameGPS]; } - (nullable NSNumber<SDLBool> *)gps { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:NSNumber.class error:nil]; } - (void)setSpeed:(nullable NSNumber<SDLBool> *)speed { @@ -163,8 +105,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)speed { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:NSNumber.class error:nil]; } - (void)setRpm:(nullable NSNumber<SDLBool> *)rpm { @@ -172,8 +113,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)rpm { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:NSNumber.class error:nil]; } - (void)setFuelLevel:(nullable NSNumber<SDLBool> *)fuelLevel { @@ -181,8 +121,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)fuelLevel { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:NSNumber.class error:nil]; } - (void)setFuelLevel_State:(nullable NSNumber<SDLBool> *)fuelLevel_State { @@ -190,8 +129,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)fuelLevel_State { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevelState ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevelState ofClass:NSNumber.class error:nil]; } - (void)setFuelRange:(nullable NSNumber<SDLBool> *)fuelRange { @@ -199,8 +137,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)fuelRange { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelRange ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelRange ofClass:NSNumber.class error:nil]; } - (void)setInstantFuelConsumption:(nullable NSNumber<SDLBool> *)instantFuelConsumption { @@ -208,8 +145,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)instantFuelConsumption { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:NSNumber.class error:nil]; } - (void)setExternalTemperature:(nullable NSNumber<SDLBool> *)externalTemperature { @@ -217,8 +153,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)externalTemperature { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:NSNumber.class error:nil]; } - (void)setVin:(nullable NSNumber<SDLBool> *)vin { @@ -226,17 +161,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)vin { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameVIN ofClass:NSNumber.class error:&error]; -} - -- (void)setGearStatus:(nullable NSNumber<SDLBool> *)gearStatus { - [self.parameters sdl_setObject:gearStatus forName:SDLRPCParameterNameGearStatus]; -} - -- (nullable NSNumber<SDLBool> *)gearStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGearStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameVIN ofClass:NSNumber.class error:nil]; } - (void)setPrndl:(nullable NSNumber<SDLBool> *)prndl { @@ -244,8 +169,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)prndl { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNamePRNDL ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNamePRNDL ofClass:NSNumber.class error:nil]; } - (void)setTirePressure:(nullable NSNumber<SDLBool> *)tirePressure { @@ -253,8 +177,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)tirePressure { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:NSNumber.class error:nil]; } - (void)setOdometer:(nullable NSNumber<SDLBool> *)odometer { @@ -262,8 +185,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)odometer { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:NSNumber.class error:nil]; } - (void)setBeltStatus:(nullable NSNumber<SDLBool> *)beltStatus { @@ -271,8 +193,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)beltStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:NSNumber.class error:nil]; } - (void)setBodyInformation:(nullable NSNumber<SDLBool> *)bodyInformation { @@ -280,8 +201,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)bodyInformation { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:NSNumber.class error:nil]; } - (void)setDeviceStatus:(nullable NSNumber<SDLBool> *)deviceStatus { @@ -289,8 +209,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)deviceStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:NSNumber.class error:nil]; } - (void)setDriverBraking:(nullable NSNumber<SDLBool> *)driverBraking { @@ -298,8 +217,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)driverBraking { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:NSNumber.class error:nil]; } - (void)setWiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus { @@ -307,8 +225,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)wiperStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameWiperStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameWiperStatus ofClass:NSNumber.class error:nil]; } - (void)setHeadLampStatus:(nullable NSNumber<SDLBool> *)headLampStatus { @@ -316,8 +233,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)headLampStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:NSNumber.class error:nil]; } - (void)setEngineOilLife:(nullable NSNumber<SDLBool> *)engineOilLife { @@ -325,8 +241,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)engineOilLife { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:NSNumber.class error:nil]; } - (void)setEngineTorque:(nullable NSNumber<SDLBool> *)engineTorque { @@ -334,8 +249,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)engineTorque { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:NSNumber.class error:nil]; } - (void)setAccPedalPosition:(nullable NSNumber<SDLBool> *)accPedalPosition { @@ -343,8 +257,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)accPedalPosition { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:NSNumber.class error:nil]; } - (void)setSteeringWheelAngle:(nullable NSNumber<SDLBool> *)steeringWheelAngle { @@ -352,8 +265,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)steeringWheelAngle { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:NSNumber.class error:nil]; } - (void)setECallInfo:(nullable NSNumber<SDLBool> *)eCallInfo { @@ -361,8 +273,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)eCallInfo { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:NSNumber.class error:nil]; } - (void)setAirbagStatus:(nullable NSNumber<SDLBool> *)airbagStatus { @@ -370,8 +281,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)airbagStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:NSNumber.class error:nil]; } - (void)setEmergencyEvent:(nullable NSNumber<SDLBool> *)emergencyEvent { @@ -379,8 +289,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)emergencyEvent { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:NSNumber.class error:nil]; } - (void)setClusterModeStatus:(nullable NSNumber<SDLBool> *)clusterModeStatus { @@ -388,8 +297,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)clusterModeStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModeStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModeStatus ofClass:NSNumber.class error:nil]; } - (void)setMyKey:(nullable NSNumber<SDLBool> *)myKey { @@ -397,8 +305,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)myKey { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:NSNumber.class error:nil]; } - (void)setElectronicParkBrakeStatus:(nullable NSNumber<SDLBool> *)electronicParkBrakeStatus { @@ -406,8 +313,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)electronicParkBrakeStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameElectronicParkBrakeStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameElectronicParkBrakeStatus ofClass:NSNumber.class error:nil]; } - (void)setTurnSignal:(nullable NSNumber<SDLBool> *)turnSignal { @@ -415,8 +321,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)turnSignal { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTurnSignal ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTurnSignal ofClass:NSNumber.class error:nil]; } - (void)setCloudAppVehicleID:(nullable NSNumber<SDLBool> *)cloudAppVehicleID { @@ -424,8 +329,16 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)cloudAppVehicleID { + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:nil]; +} + +- (void)setGearStatus:(nullable NSNumber<SDLBool> *)gearStatus { + [self.parameters sdl_setObject:gearStatus forName:SDLRPCParameterNameGearStatus]; +} + +- (nullable NSNumber<SDLBool> *)gearStatus { NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameGearStatus ofClass:NSNumber.class error:&error]; } - (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(BOOL)vehicleDataState { @@ -433,8 +346,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)getOEMCustomVehicleData:(NSString *)vehicleDataName { - NSError *error = nil; - return [self.parameters sdl_objectForName:vehicleDataName ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:vehicleDataName ofClass:NSNumber.class error:nil]; } @end diff --git a/SmartDeviceLink/SDLGetVehicleDataResponse.h b/SmartDeviceLink/SDLGetVehicleDataResponse.h index c9899cd19..29854ce60 100644 --- a/SmartDeviceLink/SDLGetVehicleDataResponse.h +++ b/SmartDeviceLink/SDLGetVehicleDataResponse.h @@ -1,39 +1,11 @@ -/* - * Copyright (c) 2020, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +// SDLGetVehicleDataResponse.h +// + +#import "SDLRPCResponse.h" #import "SDLComponentVolumeStatus.h" #import "SDLElectronicParkBrakeStatus.h" #import "SDLPRNDL.h" -#import "SDLRPCResponse.h" #import "SDLTurnSignal.h" #import "SDLVehicleDataEventStatus.h" #import "SDLWiperStatus.h" @@ -47,258 +19,235 @@ @class SDLEmergencyEvent; @class SDLFuelRange; @class SDLGearStatus; -@class SDLHeadLampStatus; @class SDLGPSData; +@class SDLHeadLampStatus; @class SDLMyKey; @class SDLTireStatus; -NS_ASSUME_NONNULL_BEGIN /** - * @since SDL 2.0.0 + * Response to SDLGetVehicleData + * + * Since SmartDeviceLink 2.0 */ -@interface SDLGetVehicleDataResponse : SDLRPCResponse -/** - Accelerator pedal position (percentage depressed) +NS_ASSUME_NONNULL_BEGIN - Optional. - */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *accPedalPosition; +@interface SDLGetVehicleDataResponse : SDLRPCResponse /** - The status of the air bags - - Optional. + * Convenience init. + * + * @param gps - gps + * @param speed - @(speed) + * @param rpm - rpm + * @param fuelLevel - @(fuelLevel) + * @param fuelLevel_State - fuelLevel_State + * @param instantFuelConsumption - @(instantFuelConsumption) + * @param fuelRange - fuelRange + * @param externalTemperature - @(externalTemperature) + * @param turnSignal - turnSignal + * @param vin - vin + * @param gearStatus - gearStatus + * @param tirePressure - tirePressure + * @param odometer - odometer + * @param beltStatus - beltStatus + * @param bodyInformation - bodyInformation + * @param deviceStatus - deviceStatus + * @param driverBraking - driverBraking + * @param wiperStatus - wiperStatus + * @param headLampStatus - headLampStatus + * @param engineTorque - @(engineTorque) + * @param accPedalPosition - @(accPedalPosition) + * @param steeringWheelAngle - @(steeringWheelAngle) + * @param engineOilLife - @(engineOilLife) + * @param electronicParkBrakeStatus - electronicParkBrakeStatus + * @param cloudAppVehicleID - cloudAppVehicleID + * @param eCallInfo - eCallInfo + * @param airbagStatus - airbagStatus + * @param emergencyEvent - emergencyEvent + * @param clusterModeStatus - clusterModeStatus + * @param myKey - myKey + * @return A SDLGetVehicleDataResponse object + */ +- (instancetype)initWithGps:(nullable SDLGPSData *)gps speed:(float)speed rpm:(nullable NSNumber<SDLUInt> *)rpm fuelLevel:(float)fuelLevel fuelLevel_State:(nullable SDLComponentVolumeStatus)fuelLevel_State instantFuelConsumption:(float)instantFuelConsumption fuelRange:(nullable NSArray<SDLFuelRange *> *)fuelRange externalTemperature:(float)externalTemperature turnSignal:(nullable SDLTurnSignal)turnSignal vin:(nullable NSString *)vin gearStatus:(nullable SDLGearStatus *)gearStatus tirePressure:(nullable SDLTireStatus *)tirePressure odometer:(nullable NSNumber<SDLUInt> *)odometer beltStatus:(nullable SDLBeltStatus *)beltStatus bodyInformation:(nullable SDLBodyInformation *)bodyInformation deviceStatus:(nullable SDLDeviceStatus *)deviceStatus driverBraking:(nullable SDLVehicleDataEventStatus)driverBraking wiperStatus:(nullable SDLWiperStatus)wiperStatus headLampStatus:(nullable SDLHeadLampStatus *)headLampStatus engineTorque:(float)engineTorque accPedalPosition:(float)accPedalPosition steeringWheelAngle:(float)steeringWheelAngle engineOilLife:(float)engineOilLife electronicParkBrakeStatus:(nullable SDLElectronicParkBrakeStatus)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSString *)cloudAppVehicleID eCallInfo:(nullable SDLECallInfo *)eCallInfo airbagStatus:(nullable SDLAirbagStatus *)airbagStatus emergencyEvent:(nullable SDLEmergencyEvent *)emergencyEvent clusterModeStatus:(nullable SDLClusterModeStatus *)clusterModeStatus myKey:(nullable SDLMyKey *)myKey; + +/** + * The Gear Status */ -@property (strong, nonatomic, nullable) SDLAirbagStatus *airbagStatus; +@property (strong, nonatomic, nullable) SDLGearStatus *gearStatus; /** - The status of the seat belts - - Optional. + The car current GPS coordinates */ -@property (strong, nonatomic, nullable) SDLBeltStatus *beltStatus; +@property (nullable, strong, nonatomic) SDLGPSData *gps; /** - The body information including power modes - - Optional. + The vehicle speed in kilometers per hour */ -@property (strong, nonatomic, nullable) SDLBodyInformation *bodyInformation; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *speed; /** - The cloud app vehicle ID - - Optional. + The number of revolutions per minute of the engine. */ -@property (strong, nonatomic, nullable) NSString *cloudAppVehicleID; +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *rpm; /** - The status modes of the cluster - - Optional. + The fuel level in the tank (percentage) */ -@property (strong, nonatomic, nullable) SDLClusterModeStatus *clusterModeStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *fuelLevel; /** - The IVI system status including signal and battery strength - - Optional. + The fuel level state */ -@property (strong, nonatomic, nullable) SDLDeviceStatus *deviceStatus; +@property (nullable, strong, nonatomic) SDLComponentVolumeStatus fuelLevel_State; /** - The status of the brake pedal + The estimate range in KM the vehicle can travel based on fuel level and consumption - Optional. + Optional, Array of length 0 - 100, of SDLFuelRange */ -@property (strong, nonatomic, nullable) SDLVehicleDataEventStatus driverBraking; +@property (nullable, strong, nonatomic) NSArray<SDLFuelRange *> *fuelRange; /** - Emergency Call notification and confirmation data - - Optional. + The instantaneous fuel consumption in microlitres */ -@property (strong, nonatomic, nullable) SDLECallInfo *eCallInfo; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *instantFuelConsumption; /** - The status of the electronic parking brake - - Optional. + The external temperature in degrees celsius. */ -@property (strong, nonatomic, nullable) SDLElectronicParkBrakeStatus electronicParkBrakeStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *externalTemperature; /** - Information related to an emergency event (and if it occurred) - - Optional. + The Vehicle Identification Number */ -@property (strong, nonatomic, nullable) SDLEmergencyEvent *emergencyEvent; +@property (nullable, strong, nonatomic) NSString *vin; /** - The estimated percentage (0% - 100%) of remaining oil life of the engine - - Optional. + The current gear shift state of the user's vehicle */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineOilLife; +@property (strong, nonatomic, nullable) SDLPRNDL prndl __deprecated_msg("use gearStatus.actualGear instead"); /** - Torque value for engine (in Nm) on non-diesel variants - - Optional. + The current pressure warnings for the user's vehicle */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineTorque; +@property (nullable, strong, nonatomic) SDLTireStatus *tirePressure; /** - The external temperature in degrees celsius. - - Optional + Odometer reading in km */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *externalTemperature; +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *odometer; /** - The fuel level in the tank (percentage) - - Optional + The status of the seat belts */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *fuelLevel; +@property (nullable, strong, nonatomic) SDLBeltStatus *beltStatus; /** - The fuel level state - - Optional + The body information including power modes */ -@property (strong, nonatomic, nullable) SDLComponentVolumeStatus fuelLevel_State; +@property (nullable, strong, nonatomic) SDLBodyInformation *bodyInformation; /** - The estimate range in KM the vehicle can travel based on fuel level and consumption - - Optional, Array of length 0 - 100, of SDLFuelRange + The IVI system status including signal and battery strength */ -@property (strong, nonatomic, nullable) NSArray<SDLFuelRange *> *fuelRange; +@property (nullable, strong, nonatomic) SDLDeviceStatus *deviceStatus; /** - * See GearStatus - * - * Optional. - * - * @since SDL 7.0.0 + The status of the brake pedal */ -@property (strong, nonatomic, nullable) SDLGearStatus *gearStatus; +@property (nullable, strong, nonatomic) SDLVehicleDataEventStatus driverBraking; /** - The car current GPS coordinates - - Optional. + The status of the wipers */ -@property (strong, nonatomic, nullable) SDLGPSData *gps; +@property (nullable, strong, nonatomic) SDLWiperStatus wiperStatus; /** Status of the head lamps - - Optional. */ -@property (strong, nonatomic, nullable) SDLHeadLampStatus *headLampStatus; +@property (nullable, strong, nonatomic) SDLHeadLampStatus *headLampStatus; /** - The instantaneous fuel consumption in microlitres - - Optional + The estimated percentage (0% - 100%) of remaining oil life of the engine */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *instantFuelConsumption; +@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineOilLife; /** - * The current gear shift state of the user's vehicle - * - * Optional. - * @deprecated - * @since SDL 7.0.0 + Torque value for engine (in Nm) on non-diesel variants */ -@property (strong, nonatomic, nullable) SDLPRNDL prndl __deprecated_msg("use gearStatus instead"); +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *engineTorque; /** - Information related to the MyKey feature - - Optional. + Accelerator pedal position (percentage depressed) */ -@property (strong, nonatomic, nullable) SDLMyKey *myKey; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *accPedalPosition; /** - Odometer reading in km - - Optional. + Current angle of the steering wheel (in deg) */ -@property (strong, nonatomic, nullable) NSNumber<SDLInt> *odometer; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *steeringWheelAngle; /** - The number of revolutions per minute of the engine. - - Optional + Emergency Call notification and confirmation data */ -@property (strong, nonatomic, nullable) NSNumber<SDLInt> *rpm; +@property (nullable, strong, nonatomic) SDLECallInfo *eCallInfo; /** - The vehicle speed in kilometers per hour - - Optional + The status of the air bags */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *speed; +@property (nullable, strong, nonatomic) SDLAirbagStatus *airbagStatus; /** - Current angle of the steering wheel (in deg) - - Optional. + Information related to an emergency event (and if it occurred) */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *steeringWheelAngle; +@property (nullable, strong, nonatomic) SDLEmergencyEvent *emergencyEvent; /** - The current pressure warnings for the user's vehicle - - Optional. + The status modes of the cluster */ -@property (strong, nonatomic, nullable) SDLTireStatus *tirePressure; +@property (nullable, strong, nonatomic) SDLClusterModeStatus *clusterModeStatus; /** - The status of the turn signal - - Optional. + Information related to the MyKey feature */ -@property (strong, nonatomic, nullable) SDLTurnSignal turnSignal; +@property (nullable, strong, nonatomic) SDLMyKey *myKey; /** - The Vehicle Identification Number - - Optional + The status of the electronic parking brake */ -@property (strong, nonatomic, nullable) NSString *vin; +@property (nullable, strong, nonatomic) SDLElectronicParkBrakeStatus electronicParkBrakeStatus; /** - The status of the wipers + The status of the turn signal + */ +@property (nullable, strong, nonatomic) SDLTurnSignal turnSignal; - Optional. +/** + The cloud app vehicle ID */ -@property (strong, nonatomic, nullable) SDLWiperStatus wiperStatus; +@property (nullable, strong, nonatomic) NSString *cloudAppVehicleID; /** - Gets the OEM custom vehicle data item for any given OEM custom vehicle data name. - + Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. + @param vehicleDataName The name of the OEM custom vehicle data item. - @return An OEM custom vehicle data object for the given vehicle data name. + @param vehicleDataState An object containing the OEM custom vehicle data item. Added in SmartDeviceLink 6.0 */ -- (nullable NSObject *)getOEMCustomVehicleData:(NSString *)vehicleDataName; +- (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(NSObject *)vehicleDataState NS_SWIFT_NAME(setOEMCustomVehicleData(name:state:)); /** - Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. + Gets the OEM custom vehicle data item for any given OEM custom vehicle data name. @param vehicleDataName The name of the OEM custom vehicle data item. - @param vehicleDataState An object containing the OEM custom vehicle data item. + @return An OEM custom vehicle data object for the given vehicle data name. Added in SmartDeviceLink 6.0 */ -- (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(NSObject *)vehicleDataState NS_SWIFT_NAME(setOEMCustomVehicleData(name:state:)); +- (nullable NSObject *)getOEMCustomVehicleData:(NSString *)vehicleDataName; @end diff --git a/SmartDeviceLink/SDLGetVehicleDataResponse.m b/SmartDeviceLink/SDLGetVehicleDataResponse.m index f5a397e4b..a5359d71f 100644 --- a/SmartDeviceLink/SDLGetVehicleDataResponse.m +++ b/SmartDeviceLink/SDLGetVehicleDataResponse.m @@ -1,58 +1,25 @@ -/* - * Copyright (c) 2020, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +// SDLGetVehicleDataResponse.m +// + + +#import "SDLGetVehicleDataResponse.h" #import "NSMutableDictionary+Store.h" #import "SDLAirbagStatus.h" -#import "SDLBodyInformation.h" #import "SDLBeltStatus.h" +#import "SDLBodyInformation.h" #import "SDLClusterModeStatus.h" -#import "SDLComponentVolumeStatus.h" #import "SDLDeviceStatus.h" #import "SDLECallInfo.h" -#import "SDLElectronicParkBrakeStatus.h" #import "SDLEmergencyEvent.h" #import "SDLFuelRange.h" -#import "SDLGetVehicleDataResponse.h" #import "SDLGearStatus.h" #import "SDLGPSData.h" #import "SDLHeadLampStatus.h" #import "SDLMyKey.h" -#import "SDLPRNDL.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" #import "SDLTireStatus.h" -#import "SDLTurnSignal.h" -#import "SDLVehicleDataEventStatus.h" -#import "SDLWiperStatus.h" NS_ASSUME_NONNULL_BEGIN @@ -69,13 +36,50 @@ NS_ASSUME_NONNULL_BEGIN } #pragma clang diagnostic pop +- (instancetype)initWithGps:(nullable SDLGPSData *)gps speed:(float)speed rpm:(nullable NSNumber<SDLUInt> *)rpm fuelLevel:(float)fuelLevel fuelLevel_State:(nullable SDLComponentVolumeStatus)fuelLevel_State instantFuelConsumption:(float)instantFuelConsumption fuelRange:(nullable NSArray<SDLFuelRange *> *)fuelRange externalTemperature:(float)externalTemperature turnSignal:(nullable SDLTurnSignal)turnSignal vin:(nullable NSString *)vin gearStatus:(nullable SDLGearStatus *)gearStatus tirePressure:(nullable SDLTireStatus *)tirePressure odometer:(nullable NSNumber<SDLUInt> *)odometer beltStatus:(nullable SDLBeltStatus *)beltStatus bodyInformation:(nullable SDLBodyInformation *)bodyInformation deviceStatus:(nullable SDLDeviceStatus *)deviceStatus driverBraking:(nullable SDLVehicleDataEventStatus)driverBraking wiperStatus:(nullable SDLWiperStatus)wiperStatus headLampStatus:(nullable SDLHeadLampStatus *)headLampStatus engineTorque:(float)engineTorque accPedalPosition:(float)accPedalPosition steeringWheelAngle:(float)steeringWheelAngle engineOilLife:(float)engineOilLife electronicParkBrakeStatus:(nullable SDLElectronicParkBrakeStatus)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSString *)cloudAppVehicleID eCallInfo:(nullable SDLECallInfo *)eCallInfo airbagStatus:(nullable SDLAirbagStatus *)airbagStatus emergencyEvent:(nullable SDLEmergencyEvent *)emergencyEvent clusterModeStatus:(nullable SDLClusterModeStatus *)clusterModeStatus myKey:(nullable SDLMyKey *)myKey { + self = [self init]; + if (!self) { + return nil; + } + self.gps = gps; + self.speed = @(speed); + self.rpm = rpm; + self.fuelLevel = @(fuelLevel); + self.fuelLevel_State = fuelLevel_State; + self.instantFuelConsumption = @(instantFuelConsumption); + self.fuelRange = fuelRange; + self.externalTemperature = @(externalTemperature); + self.turnSignal = turnSignal; + self.vin = vin; + self.gearStatus = gearStatus; + self.tirePressure = tirePressure; + self.odometer = odometer; + self.beltStatus = beltStatus; + self.bodyInformation = bodyInformation; + self.deviceStatus = deviceStatus; + self.driverBraking = driverBraking; + self.wiperStatus = wiperStatus; + self.headLampStatus = headLampStatus; + self.engineTorque = @(engineTorque); + self.accPedalPosition = @(accPedalPosition); + self.steeringWheelAngle = @(steeringWheelAngle); + self.engineOilLife = @(engineOilLife); + self.electronicParkBrakeStatus = electronicParkBrakeStatus; + self.cloudAppVehicleID = cloudAppVehicleID; + self.eCallInfo = eCallInfo; + self.airbagStatus = airbagStatus; + self.emergencyEvent = emergencyEvent; + self.clusterModeStatus = clusterModeStatus; + self.myKey = myKey; + return self; +} + - (void)setGps:(nullable SDLGPSData *)gps { [self.parameters sdl_setObject:gps forName:SDLRPCParameterNameGPS]; } - (nullable SDLGPSData *)gps { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:SDLGPSData.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:SDLGPSData.class error:nil]; } - (void)setSpeed:(nullable NSNumber<SDLFloat> *)speed { @@ -83,8 +87,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)speed { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:NSNumber.class error:nil]; } - (void)setRpm:(nullable NSNumber<SDLInt> *)rpm { @@ -92,8 +95,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLInt> *)rpm { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:NSNumber.class error:nil]; } - (void)setFuelLevel:(nullable NSNumber<SDLFloat> *)fuelLevel { @@ -101,8 +103,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)fuelLevel { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:NSNumber.class error:nil]; } - (void)setFuelLevel_State:(nullable SDLComponentVolumeStatus)fuelLevel_State { @@ -110,8 +111,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLComponentVolumeStatus)fuelLevel_State { - NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNameFuelLevelState error:&error]; + return [self.parameters sdl_enumForName:SDLRPCParameterNameFuelLevelState error:nil]; } - (void)setInstantFuelConsumption:(nullable NSNumber<SDLFloat> *)instantFuelConsumption { @@ -123,13 +123,11 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSArray<SDLFuelRange *> *)fuelRange { - NSError *error = nil; - return [self.parameters sdl_objectsForName:SDLRPCParameterNameFuelRange ofClass:SDLFuelRange.class error:&error]; + return [self.parameters sdl_objectsForName:SDLRPCParameterNameFuelRange ofClass:SDLFuelRange.class error:nil]; } - (nullable NSNumber<SDLFloat> *)instantFuelConsumption { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:NSNumber.class error:nil]; } - (void)setExternalTemperature:(nullable NSNumber<SDLFloat> *)externalTemperature { @@ -137,8 +135,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)externalTemperature { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:NSNumber.class error:nil]; } - (void)setVin:(nullable NSString *)vin { @@ -146,8 +143,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSString *)vin { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameVIN ofClass:NSString.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameVIN ofClass:NSString.class error:nil]; } - (void)setGearStatus:(nullable SDLGearStatus *)gearStatus { @@ -164,8 +160,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLPRNDL)prndl { - NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNamePRNDL error:&error]; + return [self.parameters sdl_enumForName:SDLRPCParameterNamePRNDL error:nil]; } - (void)setTirePressure:(nullable SDLTireStatus *)tirePressure { @@ -173,8 +168,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLTireStatus *)tirePressure { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:SDLTireStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:SDLTireStatus.class error:nil]; } - (void)setOdometer:(nullable NSNumber<SDLInt> *)odometer { @@ -182,8 +176,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLInt> *)odometer { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:NSNumber.class error:nil]; } - (void)setBeltStatus:(nullable SDLBeltStatus *)beltStatus { @@ -191,8 +184,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLBeltStatus *)beltStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:SDLBeltStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:SDLBeltStatus.class error:nil]; } - (void)setBodyInformation:(nullable SDLBodyInformation *)bodyInformation { @@ -200,8 +192,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLBodyInformation *)bodyInformation { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:SDLBodyInformation.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:SDLBodyInformation.class error:nil]; } - (void)setDeviceStatus:(nullable SDLDeviceStatus *)deviceStatus { @@ -209,8 +200,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLDeviceStatus *)deviceStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:SDLDeviceStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:SDLDeviceStatus.class error:nil]; } - (void)setDriverBraking:(nullable SDLVehicleDataEventStatus)driverBraking { @@ -218,8 +208,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataEventStatus)driverBraking { - NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNameDriverBraking error:&error]; + return [self.parameters sdl_enumForName:SDLRPCParameterNameDriverBraking error:nil]; } - (void)setWiperStatus:(nullable SDLWiperStatus)wiperStatus { @@ -227,8 +216,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLWiperStatus)wiperStatus { - NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNameWiperStatus error:&error]; + return [self.parameters sdl_enumForName:SDLRPCParameterNameWiperStatus error:nil]; } - (void)setHeadLampStatus:(nullable SDLHeadLampStatus *)headLampStatus { @@ -236,8 +224,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLHeadLampStatus *)headLampStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:SDLHeadLampStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:SDLHeadLampStatus.class error:nil]; } - (void)setEngineOilLife:(nullable NSNumber<SDLFloat> *)engineOilLife { @@ -245,8 +232,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)engineOilLife { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:NSNumber.class error:nil]; } - (void)setEngineTorque:(nullable NSNumber<SDLFloat> *)engineTorque { @@ -254,8 +240,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)engineTorque { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:NSNumber.class error:nil]; } - (void)setAccPedalPosition:(nullable NSNumber<SDLFloat> *)accPedalPosition { @@ -263,8 +248,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)accPedalPosition { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:NSNumber.class error:nil]; } - (void)setSteeringWheelAngle:(nullable NSNumber<SDLFloat> *)steeringWheelAngle { @@ -272,8 +256,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLFloat> *)steeringWheelAngle { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:NSNumber.class error:nil]; } - (void)setECallInfo:(nullable SDLECallInfo *)eCallInfo { @@ -281,8 +264,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLECallInfo *)eCallInfo { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:SDLECallInfo.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:SDLECallInfo.class error:nil]; } - (void)setAirbagStatus:(nullable SDLAirbagStatus *)airbagStatus { @@ -290,8 +272,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLAirbagStatus *)airbagStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:SDLAirbagStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:SDLAirbagStatus.class error:nil]; } - (void)setEmergencyEvent:(nullable SDLEmergencyEvent *)emergencyEvent { @@ -299,8 +280,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLEmergencyEvent *)emergencyEvent { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:SDLEmergencyEvent.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:SDLEmergencyEvent.class error:nil]; } - (void)setClusterModeStatus:(nullable SDLClusterModeStatus *)clusterModeStatus { @@ -308,8 +288,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLClusterModeStatus *)clusterModeStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModeStatus ofClass:SDLClusterModeStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModeStatus ofClass:SDLClusterModeStatus.class error:nil]; } - (void)setMyKey:(nullable SDLMyKey *)myKey { @@ -317,8 +296,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLMyKey *)myKey { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:SDLMyKey.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:SDLMyKey.class error:nil]; } - (void)setElectronicParkBrakeStatus:(nullable SDLElectronicParkBrakeStatus)electronicParkBrakeStatus { @@ -326,8 +304,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLElectronicParkBrakeStatus)electronicParkBrakeStatus { - NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNameElectronicParkBrakeStatus error:&error]; + return [self.parameters sdl_enumForName:SDLRPCParameterNameElectronicParkBrakeStatus error:nil]; } - (void)setTurnSignal:(nullable SDLTurnSignal)turnSignal { @@ -335,8 +312,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLTurnSignal)turnSignal { - NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNameTurnSignal error:&error]; + return [self.parameters sdl_enumForName:SDLRPCParameterNameTurnSignal error:nil]; } - (void)setCloudAppVehicleID:(nullable NSString *)cloudAppVehicleID { @@ -344,8 +320,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSString *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSString.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSString.class error:nil]; } - (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(NSObject *)vehicleDataState { @@ -353,8 +328,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSObject *)getOEMCustomVehicleData:(NSString *)vehicleDataName { - NSError *error = nil; - return [self.parameters sdl_objectForName:vehicleDataName ofClass:NSObject.class error:&error]; + return [self.parameters sdl_objectForName:vehicleDataName ofClass:NSObject.class error:nil]; } @end diff --git a/SmartDeviceLink/SDLPRNDL.h b/SmartDeviceLink/SDLPRNDL.h index 5b48aa81e..8439f3032 100644 --- a/SmartDeviceLink/SDLPRNDL.h +++ b/SmartDeviceLink/SDLPRNDL.h @@ -1,73 +1,40 @@ -/* - * Copyright (c) 2020, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +// SDLPRNDL.h +// + #import "SDLEnum.h" /** - * The selected gear. + * The selected gear the car is in. Used in retrieving vehicle data. * - * @since SDL 2.0.0 + * @since SDL 2.0 */ typedef SDLEnum SDLPRNDL SDL_SWIFT_ENUM; /** - * @abstract: Drive gear - */ -extern SDLPRNDL const SDLPRNDLDrive; - -/** - * Eighth gear + * Park */ -extern SDLPRNDL const SDLPRNDLEighth; +extern SDLPRNDL const SDLPRNDLPark; /** - * Fault + * Reverse gear */ -extern SDLPRNDL const SDLPRNDLFault; +extern SDLPRNDL const SDLPRNDLReverse; /** - * Fifth gear + * No gear */ -extern SDLPRNDL const SDLPRNDLFifth; +extern SDLPRNDL const SDLPRNDLNeutral; /** - * First gear + * @abstract: Drive gear */ -extern SDLPRNDL const SDLPRNDLFirst; +extern SDLPRNDL const SDLPRNDLDrive; /** - * Fourth gear + * Drive Sport mode */ -extern SDLPRNDL const SDLPRNDLFourth; +extern SDLPRNDL const SDLPRNDLSport; /** * 1st gear hold @@ -75,35 +42,39 @@ extern SDLPRNDL const SDLPRNDLFourth; extern SDLPRNDL const SDLPRNDLLowGear; /** - * No gear + * First gear */ -extern SDLPRNDL const SDLPRNDLNeutral; +extern SDLPRNDL const SDLPRNDLFirst; /** * Ninth gear - * @since SDL 7.0.0 */ extern SDLPRNDL const SDLPRNDLNinth; /** - * Park + * Second gear */ -extern SDLPRNDL const SDLPRNDLPark; +extern SDLPRNDL const SDLPRNDLSecond; /** - * Reverse gear + * Tenth gear */ -extern SDLPRNDL const SDLPRNDLReverse; +extern SDLPRNDL const SDLPRNDLTenth; /** - * Drive Sport mode + * Third gear */ -extern SDLPRNDL const SDLPRNDLSport; +extern SDLPRNDL const SDLPRNDLThird; /** - * Second gear + * Fourth gear */ -extern SDLPRNDL const SDLPRNDLSecond; +extern SDLPRNDL const SDLPRNDLFourth; + +/** + * Fifth gear + */ +extern SDLPRNDL const SDLPRNDLFifth; /** * Sixth gear @@ -116,17 +87,16 @@ extern SDLPRNDL const SDLPRNDLSixth; extern SDLPRNDL const SDLPRNDLSeventh; /** - * Tenth gear - * @since SDL 7.0.0 + * Eighth gear */ -extern SDLPRNDL const SDLPRNDLTenth; +extern SDLPRNDL const SDLPRNDLEighth; /** - * Third gear + * Unknown */ -extern SDLPRNDL const SDLPRNDLThird; +extern SDLPRNDL const SDLPRNDLUnknown; /** - * Unknown + * Fault */ -extern SDLPRNDL const SDLPRNDLUnknown; +extern SDLPRNDL const SDLPRNDLFault; diff --git a/SmartDeviceLink/SDLPRNDL.m b/SmartDeviceLink/SDLPRNDL.m index 3a854109a..b94437065 100644 --- a/SmartDeviceLink/SDLPRNDL.m +++ b/SmartDeviceLink/SDLPRNDL.m @@ -1,52 +1,24 @@ -/* - * Copyright (c) 2020, SmartDeviceLink Consortium, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the SmartDeviceLink Consortium Inc. nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ +// SDLPRNDL.m +// + #import "SDLPRNDL.h" +SDLPRNDL const SDLPRNDLPark = @"PARK"; +SDLPRNDL const SDLPRNDLReverse = @"REVERSE"; +SDLPRNDL const SDLPRNDLNeutral = @"NEUTRAL"; SDLPRNDL const SDLPRNDLDrive = @"DRIVE"; -SDLPRNDL const SDLPRNDLEighth = @"EIGHTH"; -SDLPRNDL const SDLPRNDLFault = @"FAULT"; -SDLPRNDL const SDLPRNDLFifth = @"FIFTH"; -SDLPRNDL const SDLPRNDLFirst = @"FIRST"; -SDLPRNDL const SDLPRNDLFourth = @"FOURTH"; +SDLPRNDL const SDLPRNDLSport = @"SPORT"; SDLPRNDL const SDLPRNDLLowGear = @"LOWGEAR"; -SDLPRNDL const SDLPRNDLNeutral = @"NEUTRAL"; +SDLPRNDL const SDLPRNDLFirst = @"FIRST"; SDLPRNDL const SDLPRNDLNinth = @"NINTH"; -SDLPRNDL const SDLPRNDLPark = @"PARK"; -SDLPRNDL const SDLPRNDLReverse = @"REVERSE"; SDLPRNDL const SDLPRNDLSecond = @"SECOND"; -SDLPRNDL const SDLPRNDLSeventh = @"SEVENTH"; -SDLPRNDL const SDLPRNDLSixth = @"SIXTH"; -SDLPRNDL const SDLPRNDLSport = @"SPORT"; SDLPRNDL const SDLPRNDLTenth = @"TENTH"; SDLPRNDL const SDLPRNDLThird = @"THIRD"; +SDLPRNDL const SDLPRNDLFourth = @"FOURTH"; +SDLPRNDL const SDLPRNDLFifth = @"FIFTH"; +SDLPRNDL const SDLPRNDLSixth = @"SIXTH"; +SDLPRNDL const SDLPRNDLSeventh = @"SEVENTH"; +SDLPRNDL const SDLPRNDLEighth = @"EIGHTH"; SDLPRNDL const SDLPRNDLUnknown = @"UNKNOWN"; +SDLPRNDL const SDLPRNDLFault = @"FAULT"; diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPRNDLSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPRNDLSpec.m index f924deff6..6d370c57b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPRNDLSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLPRNDLSpec.m @@ -2,7 +2,9 @@ // SDLPRNDLSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> + #import <Quick/Quick.h> #import <Nimble/Nimble.h> @@ -10,26 +12,26 @@ QuickSpecBegin(SDLPRNDLSpec) -describe(@"Individual Enum Value Tests", ^ { - it(@"Should match internal values", ^ { +describe(@"individual enum value tests", ^ { + it(@"should match internal values", ^ { + expect(SDLPRNDLPark).to(equal(@"PARK")); + expect(SDLPRNDLReverse).to(equal(@"REVERSE")); + expect(SDLPRNDLNeutral).to(equal(@"NEUTRAL")); expect(SDLPRNDLDrive).to(equal(@"DRIVE")); - expect(SDLPRNDLEighth).to(equal(@"EIGHTH")); - expect(SDLPRNDLFault).to(equal(@"FAULT")); - expect(SDLPRNDLFifth).to(equal(@"FIFTH")); - expect(SDLPRNDLFirst).to(equal(@"FIRST")); - expect(SDLPRNDLFourth).to(equal(@"FOURTH")); + expect(SDLPRNDLSport).to(equal(@"SPORT")); expect(SDLPRNDLLowGear).to(equal(@"LOWGEAR")); - expect(SDLPRNDLNeutral).to(equal(@"NEUTRAL")); + expect(SDLPRNDLFirst).to(equal(@"FIRST")); expect(SDLPRNDLNinth).to(equal(@"NINTH")); - expect(SDLPRNDLPark).to(equal(@"PARK")); - expect(SDLPRNDLReverse).to(equal(@"REVERSE")); expect(SDLPRNDLSecond).to(equal(@"SECOND")); - expect(SDLPRNDLSeventh).to(equal(@"SEVENTH")); - expect(SDLPRNDLSixth).to(equal(@"SIXTH")); - expect(SDLPRNDLSport).to(equal(@"SPORT")); expect(SDLPRNDLTenth).to(equal(@"TENTH")); expect(SDLPRNDLThird).to(equal(@"THIRD")); + expect(SDLPRNDLFourth).to(equal(@"FOURTH")); + expect(SDLPRNDLFifth).to(equal(@"FIFTH")); + expect(SDLPRNDLSixth).to(equal(@"SIXTH")); + expect(SDLPRNDLSeventh).to(equal(@"SEVENTH")); + expect(SDLPRNDLEighth).to(equal(@"EIGHTH")); expect(SDLPRNDLUnknown).to(equal(@"UNKNOWN")); + expect(SDLPRNDLFault).to(equal(@"FAULT")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m index 3a72690eb..9b349134b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m @@ -2,40 +2,41 @@ // SDLGetVehicleDataSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> #import "SDLGetVehicleData.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" QuickSpecBegin(SDLGetVehicleDataSpec) -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^{ + context(@"init and assign", ^{ SDLGetVehicleData* testRequest = [[SDLGetVehicleData alloc] init]; - testRequest.accPedalPosition = @YES; - testRequest.airbagStatus = @NO; - testRequest.beltStatus = @NO; + testRequest.airbagStatus = @YES; + testRequest.beltStatus = @YES; testRequest.bodyInformation = @YES; testRequest.cloudAppVehicleID = @YES; - testRequest.clusterModeStatus = @NO; - testRequest.deviceStatus = @NO; + testRequest.clusterModeStatus = @YES; + testRequest.deviceStatus = @YES; testRequest.driverBraking = @YES; testRequest.eCallInfo = @YES; testRequest.electronicParkBrakeStatus = @YES; testRequest.emergencyEvent = @YES; testRequest.engineOilLife = @YES; - testRequest.engineTorque = @NO; + testRequest.engineTorque = @YES; testRequest.externalTemperature = @YES; - testRequest.fuelLevel = @NO; + testRequest.fuelLevel = @YES; testRequest.fuelLevel_State = @YES; testRequest.fuelRange = @YES; - testRequest.gps = @NO; + testRequest.gps = @YES; testRequest.headLampStatus = @YES; - testRequest.instantFuelConsumption = @NO; + testRequest.instantFuelConsumption = @YES; testRequest.myKey = @YES; testRequest.odometer = @YES; #pragma clang diagnostic push @@ -44,292 +45,340 @@ describe(@"Getter/Setter Tests", ^ { #pragma clang diagnostic pop testRequest.gearStatus = @YES; testRequest.rpm = @YES; - testRequest.speed = @NO; - testRequest.steeringWheelAngle = @NO; - testRequest.tirePressure = @NO; + testRequest.speed = @YES; + testRequest.steeringWheelAngle = @YES; + testRequest.tirePressure = @YES; testRequest.turnSignal = @YES; - testRequest.wiperStatus = @NO; - - expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@NO)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(equal(@YES)); - expect(testRequest.clusterModeStatus).to(equal(@NO)); - expect(testRequest.deviceStatus).to(equal(@NO)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); - expect(testRequest.emergencyEvent).to(equal(@YES)); - expect(testRequest.engineOilLife).to(equal(@YES)); - expect(testRequest.engineTorque).to(equal(@NO)); - expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@NO)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(equal(@YES)); - expect(testRequest.gps).to(equal(@NO)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@NO)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); + testRequest.wiperStatus = @YES; + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(equal(@YES)); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(equal(@YES)); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(equal(@YES)); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@NO)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); - expect(testRequest.tirePressure).to(equal(@NO)); - expect(testRequest.turnSignal).to(equal(@YES)); - expect(testRequest.wiperStatus).to(equal(@NO)); + expect(testRequest.gearStatus).to(equal(@YES)); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); }); - - it(@"Should get correctly when initialized", ^{ + + context(@"initWithDictionary:", ^{ NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameRequest: - @{SDLRPCParameterNameParameters: - @{SDLRPCParameterNameAccelerationPedalPosition:@YES, - SDLRPCParameterNameAirbagStatus:@YES, - SDLRPCParameterNameBeltStatus:@YES, - SDLRPCParameterNameBodyInformation:@YES, - SDLRPCParameterNameCloudAppVehicleID:@YES, - SDLRPCParameterNameClusterModeStatus:@YES, - SDLRPCParameterNameDeviceStatus:@YES, - SDLRPCParameterNameDriverBraking:@YES, - SDLRPCParameterNameECallInfo:@YES, - SDLRPCParameterNameElectronicParkBrakeStatus:@YES, - SDLRPCParameterNameEmergencyEvent:@NO, - SDLRPCParameterNameEngineOilLife:@YES, - SDLRPCParameterNameEngineTorque:@YES, - SDLRPCParameterNameExternalTemperature:@NO, - SDLRPCParameterNameFuelLevel:@YES, - SDLRPCParameterNameFuelLevelState:@YES, - SDLRPCParameterNameFuelRange:@YES, - SDLRPCParameterNameGPS:@YES, - SDLRPCParameterNameHeadLampStatus:@YES, - SDLRPCParameterNameInstantFuelConsumption:@YES, - SDLRPCParameterNameMyKey:@YES, - SDLRPCParameterNameOdometer:@YES, - SDLRPCParameterNamePRNDL:@YES, - SDLRPCParameterNameRPM:@YES, - SDLRPCParameterNameSpeed:@YES, - SDLRPCParameterNameSteeringWheelAngle:@NO, - SDLRPCParameterNameTirePressure:@YES, - SDLRPCParameterNameTurnSignal:@NO, - SDLRPCParameterNameWiperStatus:@YES, - SDLRPCParameterNameGearStatus:@YES - }, - SDLRPCParameterNameOperationName:SDLRPCFunctionNameGetVehicleData}}; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - SDLGetVehicleData* testRequest = [[SDLGetVehicleData alloc] initWithDictionary:dict]; -#pragma clang diagnostic pop - - expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@YES)); - expect(testRequest.beltStatus).to(equal(@YES)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(equal(@YES)); - expect(testRequest.clusterModeStatus).to(equal(@YES)); - expect(testRequest.deviceStatus).to(equal(@YES)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); - expect(testRequest.emergencyEvent).to(equal(@NO)); - expect(testRequest.engineOilLife).to(equal(@YES)); - expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@NO)); - expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(equal(@YES)); - expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@YES)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); + @{SDLRPCParameterNameParameters: + @{SDLRPCParameterNameAccelerationPedalPosition:@YES, + SDLRPCParameterNameAirbagStatus:@YES, + SDLRPCParameterNameBeltStatus:@YES, + SDLRPCParameterNameBodyInformation:@YES, + SDLRPCParameterNameCloudAppVehicleID:@YES, + SDLRPCParameterNameClusterModeStatus:@YES, + SDLRPCParameterNameDeviceStatus:@YES, + SDLRPCParameterNameDriverBraking:@YES, + SDLRPCParameterNameECallInfo:@YES, + SDLRPCParameterNameElectronicParkBrakeStatus:@YES, + SDLRPCParameterNameEmergencyEvent:@YES, + SDLRPCParameterNameEngineOilLife:@YES, + SDLRPCParameterNameEngineTorque:@YES, + SDLRPCParameterNameExternalTemperature:@YES, + SDLRPCParameterNameFuelLevel:@YES, + SDLRPCParameterNameFuelLevelState:@YES, + SDLRPCParameterNameFuelRange:@YES, + SDLRPCParameterNameGPS:@YES, + SDLRPCParameterNameHeadLampStatus:@YES, + SDLRPCParameterNameInstantFuelConsumption:@YES, + SDLRPCParameterNameMyKey:@YES, + SDLRPCParameterNameOdometer:@YES, + SDLRPCParameterNamePRNDL:@YES, + SDLRPCParameterNameRPM:@YES, + SDLRPCParameterNameSpeed:@YES, + SDLRPCParameterNameSteeringWheelAngle:@YES, + SDLRPCParameterNameTirePressure:@YES, + SDLRPCParameterNameTurnSignal:@YES, + SDLRPCParameterNameWiperStatus:@YES, + SDLRPCParameterNameGearStatus:@YES, + }, + SDLRPCParameterNameOperationName:SDLRPCFunctionNameGetVehicleData}}; + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + SDLGetVehicleData* testRequest = [[SDLGetVehicleData alloc] initWithDictionary:dict]; + #pragma clang diagnostic pop + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(equal(@YES)); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(equal(@YES)); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(equal(@YES)); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); - expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@NO)); - expect(testRequest.wiperStatus).to(equal(@YES)); + expect(testRequest.gearStatus).to(equal(@YES)); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); }); }); -describe(@"Test initializers", ^{ - it(@"expect all properties to be nil", ^{ +describe(@"test initializers", ^{ + context(@"init", ^{ SDLGetVehicleData* testRequest = [[SDLGetVehicleData alloc] init]; - - expect(testRequest.accPedalPosition).to(beNil()); - expect(testRequest.airbagStatus).to(beNil()); - expect(testRequest.beltStatus).to(beNil()); - expect(testRequest.bodyInformation).to(beNil()); - expect(testRequest.cloudAppVehicleID).to(beNil()); - expect(testRequest.clusterModeStatus).to(beNil()); - expect(testRequest.deviceStatus).to(beNil()); - expect(testRequest.driverBraking).to(beNil()); - expect(testRequest.eCallInfo).to(beNil()); - expect(testRequest.electronicParkBrakeStatus).to(beNil()); - expect(testRequest.emergencyEvent).to(beNil()); - expect(testRequest.engineOilLife).to(beNil()); - expect(testRequest.engineTorque).to(beNil()); - expect(testRequest.externalTemperature).to(beNil()); - expect(testRequest.fuelLevel).to(beNil()); - expect(testRequest.fuelLevel_State).to(beNil()); - expect(testRequest.fuelRange).to(beNil()); - expect(testRequest.gps).to(beNil()); - expect(testRequest.headLampStatus).to(beNil()); - expect(testRequest.instantFuelConsumption).to(beNil()); - expect(testRequest.myKey).to(beNil()); - expect(testRequest.odometer).to(beNil()); + it(@"expect all properties to be nil", ^{ + expect(testRequest.accPedalPosition).to(beNil()); + expect(testRequest.airbagStatus).to(beNil()); + expect(testRequest.beltStatus).to(beNil()); + expect(testRequest.bodyInformation).to(beNil()); + expect(testRequest.cloudAppVehicleID).to(beNil()); + expect(testRequest.clusterModeStatus).to(beNil()); + expect(testRequest.deviceStatus).to(beNil()); + expect(testRequest.driverBraking).to(beNil()); + expect(testRequest.eCallInfo).to(beNil()); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); + expect(testRequest.emergencyEvent).to(beNil()); + expect(testRequest.engineOilLife).to(beNil()); + expect(testRequest.engineTorque).to(beNil()); + expect(testRequest.externalTemperature).to(beNil()); + expect(testRequest.fuelLevel).to(beNil()); + expect(testRequest.fuelLevel_State).to(beNil()); + expect(testRequest.fuelRange).to(beNil()); + expect(testRequest.gps).to(beNil()); + expect(testRequest.headLampStatus).to(beNil()); + expect(testRequest.instantFuelConsumption).to(beNil()); + expect(testRequest.myKey).to(beNil()); + expect(testRequest.odometer).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(beNil()); + expect(testRequest.prndl).to(beNil()); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(beNil()); - expect(testRequest.rpm).to(beNil()); - expect(testRequest.speed).to(beNil()); - expect(testRequest.steeringWheelAngle).to(beNil()); - expect(testRequest.tirePressure).to(beNil()); - expect(testRequest.turnSignal).to(beNil()); - expect(testRequest.wiperStatus).to(beNil()); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.rpm).to(beNil()); + expect(testRequest.speed).to(beNil()); + expect(testRequest.steeringWheelAngle).to(beNil()); + expect(testRequest.tirePressure).to(beNil()); + expect(testRequest.turnSignal).to(beNil()); + expect(testRequest.wiperStatus).to(beNil()); + }); }); - it(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:NO beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES emergencyEvent:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES vin:YES wiperStatus:YES]; + SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES emergencyEvent:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES vin:YES wiperStatus:YES]; #pragma clang diagnostic pop - - expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@YES)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(equal(@NO)); - expect(testRequest.clusterModeStatus).to(equal(@YES)); - expect(testRequest.deviceStatus).to(equal(@YES)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); - expect(testRequest.emergencyEvent).to(equal(@YES)); - expect(testRequest.engineOilLife).to(equal(@NO)); - expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(equal(@NO)); - expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@YES)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(beNil()); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(beNil()); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(beNil()); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(equal(@NO)); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@YES)); - expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@NO)); - expect(testRequest.wiperStatus).to(equal(@YES)); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(beNil()); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); }); - it(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES vin:YES wiperStatus:YES]; #pragma clang diagnostic pop - - expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@YES)); - expect(testRequest.beltStatus).to(equal(@YES)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(equal(@NO)); - expect(testRequest.clusterModeStatus).to(equal(@YES)); - expect(testRequest.deviceStatus).to(equal(@YES)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); - expect(testRequest.emergencyEvent).to(equal(@YES)); - expect(testRequest.engineOilLife).to(equal(@YES)); - expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(equal(@YES)); - expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@YES)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(beNil()); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(equal(@YES)); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(equal(@NO)); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@YES)); - expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@YES)); - expect(testRequest.wiperStatus).to(equal(@YES)); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); }); - it(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES cloudAppVehicleID:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES vin:YES wiperStatus:YES]; #pragma clang diagnostic pop - expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@YES)); - expect(testRequest.beltStatus).to(equal(@YES)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(equal(@YES)); - expect(testRequest.clusterModeStatus).to(equal(@YES)); - expect(testRequest.deviceStatus).to(equal(@YES)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); - expect(testRequest.emergencyEvent).to(equal(@YES)); - expect(testRequest.engineOilLife).to(equal(@YES)); - expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(equal(@YES)); - expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@YES)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(equal(@YES)); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(equal(@YES)); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(equal(@NO)); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@YES)); - expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@YES)); - expect(testRequest.wiperStatus).to(equal(@YES)); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); }); - it(@"Should set and get OEM Custom Vehicle Data", ^{ + context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:", ^{ + SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithGps:@YES speed:@YES rpm:@YES fuelLevel:@YES fuelLevel_State:@YES instantFuelConsumption:@YES fuelRange:@YES externalTemperature:@YES turnSignal:@YES vin:@YES gearStatus:@YES tirePressure:@YES odometer:@YES beltStatus:@YES bodyInformation:@YES deviceStatus:@YES driverBraking:@YES wiperStatus:@YES headLampStatus:@YES engineTorque:@YES accPedalPosition:@YES steeringWheelAngle:@YES engineOilLife:@YES electronicParkBrakeStatus:@YES cloudAppVehicleID:@YES eCallInfo:@YES airbagStatus:@YES emergencyEvent:@YES clusterModeStatus:@YES myKey:@YES]; + + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(equal(@YES)); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(equal(@YES)); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testRequest.prndl).to(beNil()); + #pragma clang diagnostic pop + expect(testRequest.gearStatus).to(equal(@YES)); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); + }); + + context(@"should set and get OEM Custom Vehicle Data", ^{ SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] init]; [testRequest setOEMCustomVehicleData:@"OEMCustomVehicleData" withVehicleDataState:NO]; [testRequest setOEMCustomVehicleData:@"OEMCustomVehicleData1" withVehicleDataState:YES]; - - expect([testRequest getOEMCustomVehicleData:@"OEMCustomVehicleData"]).to(equal(@NO)); - expect([testRequest getOEMCustomVehicleData:@"OEMCustomVehicleData1"]).to(equal(@YES)); + it(@"expect OEM Custom Vehicle Data to be set properly", ^{ + expect([testRequest getOEMCustomVehicleData:@"OEMCustomVehicleData"]).to(equal(@NO)); + expect([testRequest getOEMCustomVehicleData:@"OEMCustomVehicleData1"]).to(equal(@YES)); + }); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m index ed3ac87e7..52b8b81fa 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m @@ -4,160 +4,161 @@ #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLGearStatus.h" -#import "SDLRPCFunctionNames.h" -#import "SDLRPCParameterNames.h" #import "SmartDeviceLink.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" QuickSpecBegin(SDLGetVehicleDataResponseSpec) -describe(@"Getter/Setter Tests", ^ { - __block SDLGPSData* gps = nil; - __block SDLTireStatus* tires = nil; - __block SDLBeltStatus* belt = nil; - __block SDLBodyInformation* body = nil; - __block SDLDeviceStatus* device = nil; - __block SDLHeadLampStatus* headLamp = nil; - __block SDLECallInfo* eCall = nil; - __block SDLAirbagStatus* airbag = nil; - __block SDLEmergencyEvent* event = nil; - __block SDLClusterModeStatus* clusterMode = nil; - __block SDLMyKey* myKey = nil; - __block SDLFuelRange* fuelRange = nil; - __block NSString* vin = nil; - __block NSString* cloudAppVehicleID = nil; - __block SDLGearStatus* gearStatus = nil; - - beforeEach(^{ - gps = [[SDLGPSData alloc] init]; - tires = [[SDLTireStatus alloc] init]; - belt = [[SDLBeltStatus alloc] init]; - body = [[SDLBodyInformation alloc] init]; - device = [[SDLDeviceStatus alloc] init]; - headLamp = [[SDLHeadLampStatus alloc] init]; - eCall = [[SDLECallInfo alloc] init]; - airbag = [[SDLAirbagStatus alloc] init]; - event = [[SDLEmergencyEvent alloc] init]; - clusterMode = [[SDLClusterModeStatus alloc] init]; - myKey = [[SDLMyKey alloc] init]; - fuelRange = [[SDLFuelRange alloc] init]; - vin = @"6574839201a"; - cloudAppVehicleID = @"cloudAppVehicleID"; - gearStatus = [[SDLGearStatus alloc] init]; - }); +// set up test constants +SDLGPSData* gps = [[SDLGPSData alloc] init]; +SDLTireStatus* tirePressure = [[SDLTireStatus alloc] init]; +SDLBeltStatus* beltStatus = [[SDLBeltStatus alloc] init]; +SDLBodyInformation* bodyInformation = [[SDLBodyInformation alloc] init]; +SDLDeviceStatus* deviceStatus = [[SDLDeviceStatus alloc] init]; +SDLHeadLampStatus* headLampStatus = [[SDLHeadLampStatus alloc] init]; +SDLECallInfo* eCallInfo = [[SDLECallInfo alloc] init]; +SDLAirbagStatus* airbagStatus = [[SDLAirbagStatus alloc] init]; +SDLEmergencyEvent* emergencyEvent = [[SDLEmergencyEvent alloc] init]; +SDLClusterModeStatus* clusterModeStatus = [[SDLClusterModeStatus alloc] init]; +SDLMyKey* myKey = [[SDLMyKey alloc] init]; +SDLFuelRange* fuelRangeItem = [[SDLFuelRange alloc] init]; +NSArray<SDLFuelRange *>* fuelRangeArray = @[fuelRangeItem, fuelRangeItem]; +NSString *const vin = @"6574839201a"; +NSString *const cloudAppVehicleID = @"cloudAppVehicleID"; +SDLGearStatus* gearStatus = [[SDLGearStatus alloc] init]; +const float accPedalPosition = 99.01; +SDLVehicleDataEventStatus driverBraking = SDLVehicleDataEventStatusNoEvent; +const float engineOilLife = 23.34; +const float engineTorque = 34.45; +const float externalTemperature = 45.56; +const float fuelLevel = 56.67; +SDLComponentVolumeStatus fuelLevel_State = SDLComponentVolumeStatusFault; +const float instantFuelConsumption = 67.78; +const NSUInteger odometer = 100500; +SDLPRNDL prndl = SDLPRNDLPark; +const NSInteger rpm = 3501; +const float speed = 120.01; +const float steeringWheelAngle = -180.5; +SDLTurnSignal turnSignal = SDLTurnSignalBoth; +SDLWiperStatus wiperStatus = SDLWiperStatusAutomaticHigh; +SDLElectronicParkBrakeStatus electronicParkBrakeStatus = SDLElectronicParkBrakeStatusTransition; - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^{ + context(@"init and assign", ^{ SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] init]; - - testResponse.accPedalPosition = @0; - testResponse.airbagStatus = airbag; - testResponse.beltStatus = belt; - testResponse.bodyInformation = body; + testResponse.accPedalPosition = @(accPedalPosition); + testResponse.airbagStatus = airbagStatus; + testResponse.beltStatus = beltStatus; + testResponse.bodyInformation = bodyInformation; testResponse.cloudAppVehicleID = cloudAppVehicleID; - testResponse.clusterModeStatus = clusterMode; - testResponse.deviceStatus = device; - testResponse.driverBraking = SDLVehicleDataEventStatusNoEvent; - testResponse.eCallInfo = eCall; - testResponse.electronicParkBrakeStatus = SDLElectronicParkBrakeStatusDriveActive; - testResponse.emergencyEvent = event; - testResponse.engineOilLife = @56.3; - testResponse.engineTorque = @630.4; - testResponse.externalTemperature = @0; - testResponse.fuelLevel = @99.9999; - testResponse.fuelLevel_State = SDLComponentVolumeStatusFault; - testResponse.fuelRange = @[fuelRange, fuelRange]; + testResponse.clusterModeStatus = clusterModeStatus; + testResponse.deviceStatus = deviceStatus; + testResponse.driverBraking = driverBraking; + testResponse.eCallInfo = eCallInfo; + testResponse.electronicParkBrakeStatus = electronicParkBrakeStatus; + testResponse.emergencyEvent = emergencyEvent; + testResponse.engineOilLife = @(engineOilLife); + testResponse.engineTorque = @(engineTorque); + testResponse.externalTemperature = @(externalTemperature); + testResponse.fuelLevel = @(fuelLevel); + testResponse.fuelLevel_State = fuelLevel_State; + testResponse.fuelRange = fuelRangeArray; testResponse.gps = gps; - testResponse.headLampStatus = headLamp; - testResponse.instantFuelConsumption = @40.7; + testResponse.headLampStatus = headLampStatus; + testResponse.instantFuelConsumption = @(instantFuelConsumption); testResponse.myKey = myKey; - testResponse.odometer = @70000; - testResponse.gearStatus = gearStatus; - testResponse.rpm = @3; - testResponse.speed = @100; - testResponse.steeringWheelAngle = @-1500; - testResponse.tirePressure = tires; - testResponse.turnSignal = SDLTurnSignalBoth; - testResponse.vin = vin; - testResponse.wiperStatus = SDLWiperStatusAutomaticHigh; + testResponse.odometer = @(odometer); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - testResponse.prndl = SDLPRNDLPark; + testResponse.prndl = prndl; #pragma clang diagnostic pop + testResponse.gearStatus = gearStatus; + testResponse.rpm = @(rpm); + testResponse.speed = @(speed); + testResponse.steeringWheelAngle = @(steeringWheelAngle); + testResponse.tirePressure = tirePressure; + testResponse.turnSignal = turnSignal; + testResponse.vin = vin; + testResponse.wiperStatus = wiperStatus; - expect(testResponse.accPedalPosition).to(equal(@0)); - expect(testResponse.airbagStatus).to(equal(airbag)); - expect(testResponse.beltStatus).to(equal(belt)); - expect(testResponse.bodyInformation).to(equal(body)); - expect(testResponse.cloudAppVehicleID).to(equal(cloudAppVehicleID)); - expect(testResponse.clusterModeStatus).to(equal(clusterMode)); - expect(testResponse.deviceStatus).to(equal(device)); - expect(testResponse.driverBraking).to(equal(SDLVehicleDataEventStatusNoEvent)); - expect(testResponse.eCallInfo).to(equal(eCall)); - expect(testResponse.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); - expect(testResponse.emergencyEvent).to(equal(event)); - expect(testResponse.engineOilLife).to(equal(@56.3)); - expect(testResponse.engineTorque).to(equal(@630.4)); - expect(testResponse.externalTemperature).to(equal(@0)); - expect(testResponse.fuelLevel).to(equal(@99.9999)); - expect(testResponse.fuelLevel_State).to(equal(SDLComponentVolumeStatusFault)); - expect(testResponse.fuelRange).to(equal(@[fuelRange, fuelRange])); - expect(testResponse.gps).to(equal(gps)); - expect(testResponse.headLampStatus).to(equal(headLamp)); - expect(testResponse.instantFuelConsumption).to(equal(@40.7)); - expect(testResponse.myKey).to(equal(myKey)); - expect(testResponse.odometer).to(equal(@70000)); - expect(testResponse.gearStatus).to(equal(gearStatus)); - expect(testResponse.rpm).to(equal(@3)); - expect(testResponse.speed).to(equal(@100)); - expect(testResponse.steeringWheelAngle).to(equal(@-1500)); - expect(testResponse.tirePressure).to(equal(tires)); - expect(testResponse.turnSignal).to(equal(SDLTurnSignalBoth)); - expect(testResponse.vin).to(equal(vin)); - expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); + it(@"expect all properties to be set properly", ^{ + expect(testResponse.accPedalPosition).to(equal(@(accPedalPosition))); + expect(testResponse.airbagStatus).to(equal(airbagStatus)); + expect(testResponse.beltStatus).to(equal(beltStatus)); + expect(testResponse.bodyInformation).to(equal(bodyInformation)); + expect(testResponse.cloudAppVehicleID).to(equal(cloudAppVehicleID)); + expect(testResponse.clusterModeStatus).to(equal(clusterModeStatus)); + expect(testResponse.deviceStatus).to(equal(deviceStatus)); + expect(testResponse.driverBraking).to(equal(driverBraking)); + expect(testResponse.eCallInfo).to(equal(eCallInfo)); + expect(testResponse.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); + expect(testResponse.emergencyEvent).to(equal(emergencyEvent)); + expect(testResponse.engineOilLife).to(equal(@(engineOilLife))); + expect(testResponse.engineTorque).to(equal(@(engineTorque))); + expect(testResponse.externalTemperature).to(equal(@(externalTemperature))); + expect(testResponse.fuelLevel).to(equal(@(fuelLevel))); + expect(testResponse.fuelLevel_State).to(equal(fuelLevel_State)); + expect(testResponse.fuelRange).to(equal(fuelRangeArray)); + expect(testResponse.gps).to(equal(gps)); + expect(testResponse.headLampStatus).to(equal(headLampStatus)); + expect(testResponse.instantFuelConsumption).to(equal(@(instantFuelConsumption))); + expect(testResponse.myKey).to(equal(myKey)); + expect(testResponse.odometer).to(equal(@(odometer))); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(equal(SDLPRNDLPark)); + expect(testResponse.prndl).to(equal(prndl)); #pragma clang diagnostic pop + expect(testResponse.gearStatus).to(equal(gearStatus)); + expect(testResponse.rpm).to(equal(@(rpm))); + expect(testResponse.speed).to(equal(@(speed))); + expect(testResponse.steeringWheelAngle).to(equal(@(steeringWheelAngle))); + expect(testResponse.tirePressure).to(equal(tirePressure)); + expect(testResponse.turnSignal).to(equal(turnSignal)); + expect(testResponse.vin).to(equal(vin)); + expect(testResponse.wiperStatus).to(equal(wiperStatus)); + }); }); - it(@"Should get correctly when initialized", ^ { + context(@"initWithDictionary:", ^{ NSDictionary* dict = @{SDLRPCParameterNameNotification: @{SDLRPCParameterNameParameters: @{ - SDLRPCParameterNameAccelerationPedalPosition:@0, - SDLRPCParameterNameAirbagStatus:airbag, - SDLRPCParameterNameBeltStatus:belt, - SDLRPCParameterNameBodyInformation:body, + SDLRPCParameterNameAccelerationPedalPosition:@(accPedalPosition), + SDLRPCParameterNameAirbagStatus:airbagStatus, + SDLRPCParameterNameBeltStatus:beltStatus, + SDLRPCParameterNameBodyInformation:bodyInformation, SDLRPCParameterNameCloudAppVehicleID:cloudAppVehicleID, - SDLRPCParameterNameClusterModeStatus:clusterMode, - SDLRPCParameterNameDeviceStatus:device, - SDLRPCParameterNameDriverBraking:SDLVehicleDataEventStatusNoEvent, - SDLRPCParameterNameECallInfo:eCall, - SDLRPCParameterNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, - SDLRPCParameterNameEmergencyEvent:event, - SDLRPCParameterNameEngineOilLife:@23.22, - SDLRPCParameterNameEngineTorque:@630.4, - SDLRPCParameterNameExternalTemperature:@0, - SDLRPCParameterNameFuelLevel:@99.9999, - SDLRPCParameterNameFuelLevelState:SDLComponentVolumeStatusFault, - SDLRPCParameterNameFuelRange:@[fuelRange], + SDLRPCParameterNameClusterModeStatus:clusterModeStatus, + SDLRPCParameterNameDeviceStatus:deviceStatus, + SDLRPCParameterNameDriverBraking:driverBraking, + SDLRPCParameterNameECallInfo:eCallInfo, + SDLRPCParameterNameElectronicParkBrakeStatus:electronicParkBrakeStatus, + SDLRPCParameterNameEmergencyEvent:emergencyEvent, + SDLRPCParameterNameEngineOilLife:@(engineOilLife), + SDLRPCParameterNameEngineTorque:@(engineTorque), + SDLRPCParameterNameExternalTemperature:@(externalTemperature), + SDLRPCParameterNameFuelLevel:@(fuelLevel), + SDLRPCParameterNameFuelLevelState:fuelLevel_State, + SDLRPCParameterNameFuelRange:fuelRangeArray, SDLRPCParameterNameGPS:gps, - SDLRPCParameterNameHeadLampStatus:headLamp, - SDLRPCParameterNameInstantFuelConsumption:@40.7, + SDLRPCParameterNameHeadLampStatus:headLampStatus, + SDLRPCParameterNameInstantFuelConsumption:@(instantFuelConsumption), SDLRPCParameterNameMyKey:myKey, - SDLRPCParameterNameOdometer:@70000, - SDLRPCParameterNamePRNDL:SDLPRNDLPark, - SDLRPCParameterNameRPM:@3, - SDLRPCParameterNameSpeed:@100, - SDLRPCParameterNameSteeringWheelAngle:@-1500, - SDLRPCParameterNameTirePressure:tires, - SDLRPCParameterNameTurnSignal:SDLTurnSignalOff, + SDLRPCParameterNameOdometer:@(odometer), + SDLRPCParameterNamePRNDL:prndl, + SDLRPCParameterNameRPM:@(rpm), + SDLRPCParameterNameSpeed:@(speed), + SDLRPCParameterNameSteeringWheelAngle:@(steeringWheelAngle), + SDLRPCParameterNameTirePressure:tirePressure, + SDLRPCParameterNameTurnSignal:turnSignal, SDLRPCParameterNameVIN:vin, - SDLRPCParameterNameWiperStatus:SDLWiperStatusAutomaticHigh, + SDLRPCParameterNameWiperStatus:wiperStatus, SDLRPCParameterNameGearStatus:gearStatus }, SDLRPCParameterNameOperationName:SDLRPCFunctionNameGetVehicleData}}; @@ -166,87 +167,131 @@ describe(@"Getter/Setter Tests", ^ { SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] initWithDictionary:dict]; #pragma clang diagnostic pop - expect(testResponse.accPedalPosition).to(equal(@0)); - expect(testResponse.airbagStatus).to(equal(airbag)); - expect(testResponse.beltStatus).to(equal(belt)); - expect(testResponse.bodyInformation).to(equal(body)); - expect(testResponse.cloudAppVehicleID).to(equal(cloudAppVehicleID)); - expect(testResponse.clusterModeStatus).to(equal(clusterMode)); - expect(testResponse.deviceStatus).to(equal(device)); - expect(testResponse.driverBraking).to(equal(SDLVehicleDataEventStatusNoEvent)); - expect(testResponse.eCallInfo).to(equal(eCall)); - expect(testResponse.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); - expect(testResponse.emergencyEvent).to(equal(event)); - expect(testResponse.engineOilLife).to(equal(@23.22)); - expect(testResponse.engineTorque).to(equal(@630.4)); - expect(testResponse.externalTemperature).to(equal(@0)); - expect(testResponse.fuelLevel).to(equal(@99.9999)); - expect(testResponse.fuelLevel_State).to(equal(SDLComponentVolumeStatusFault)); - expect(testResponse.fuelRange).to(equal(@[fuelRange])); - expect(testResponse.gps).to(equal(gps)); - expect(testResponse.headLampStatus).to(equal(headLamp)); - expect(testResponse.instantFuelConsumption).to(equal(@40.7)); - expect(testResponse.myKey).to(equal(myKey)); - expect(testResponse.odometer).to(equal(@70000)); - expect(testResponse.gearStatus).to(equal(gearStatus)); - expect(testResponse.rpm).to(equal(@3)); - expect(testResponse.speed).to(equal(@100)); - expect(testResponse.steeringWheelAngle).to(equal(@-1500)); - expect(testResponse.tirePressure).to(equal(tires)); - expect(testResponse.turnSignal).to(equal(SDLTurnSignalOff)); - expect(testResponse.vin).to(equal(vin)); - expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); + it(@"expect all properties to be set properly", ^{ + expect(testResponse.accPedalPosition).to(equal(@(accPedalPosition))); + expect(testResponse.airbagStatus).to(equal(airbagStatus)); + expect(testResponse.beltStatus).to(equal(beltStatus)); + expect(testResponse.bodyInformation).to(equal(bodyInformation)); + expect(testResponse.cloudAppVehicleID).to(equal(cloudAppVehicleID)); + expect(testResponse.clusterModeStatus).to(equal(clusterModeStatus)); + expect(testResponse.deviceStatus).to(equal(deviceStatus)); + expect(testResponse.driverBraking).to(equal(driverBraking)); + expect(testResponse.eCallInfo).to(equal(eCallInfo)); + expect(testResponse.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); + expect(testResponse.emergencyEvent).to(equal(emergencyEvent)); + expect(testResponse.engineOilLife).to(equal(@(engineOilLife))); + expect(testResponse.engineTorque).to(equal(@(engineTorque))); + expect(testResponse.externalTemperature).to(equal(@(externalTemperature))); + expect(testResponse.fuelLevel).to(equal(@(fuelLevel))); + expect(testResponse.fuelLevel_State).to(equal(fuelLevel_State)); + expect(testResponse.fuelRange).to(equal(fuelRangeArray)); + expect(testResponse.gps).to(equal(gps)); + expect(testResponse.headLampStatus).to(equal(headLampStatus)); + expect(testResponse.instantFuelConsumption).to(equal(@(instantFuelConsumption))); + expect(testResponse.myKey).to(equal(myKey)); + expect(testResponse.odometer).to(equal(@(odometer))); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(equal(SDLPRNDLPark)); + expect(testResponse.prndl).to(equal(prndl)); #pragma clang diagnostic pop + expect(testResponse.gearStatus).to(equal(gearStatus)); + expect(testResponse.rpm).to(equal(@(rpm))); + expect(testResponse.speed).to(equal(@(speed))); + expect(testResponse.steeringWheelAngle).to(equal(@(steeringWheelAngle))); + expect(testResponse.tirePressure).to(equal(tirePressure)); + expect(testResponse.turnSignal).to(equal(turnSignal)); + expect(testResponse.vin).to(equal(vin)); + expect(testResponse.wiperStatus).to(equal(wiperStatus)); + }); }); + - it(@"Should return nil if not set", ^ { + context(@"init", ^{ SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] init]; - - expect(testResponse.accPedalPosition).to(beNil()); - expect(testResponse.airbagStatus).to(beNil()); - expect(testResponse.beltStatus).to(beNil()); - expect(testResponse.bodyInformation).to(beNil()); - expect(testResponse.cloudAppVehicleID).to(beNil()); - expect(testResponse.clusterModeStatus).to(beNil()); - expect(testResponse.deviceStatus).to(beNil()); - expect(testResponse.driverBraking).to(beNil()); - expect(testResponse.eCallInfo).to(beNil()); - expect(testResponse.electronicParkBrakeStatus).to(beNil()); - expect(testResponse.emergencyEvent).to(beNil()); - expect(testResponse.engineOilLife).to(beNil()); - expect(testResponse.engineTorque).to(beNil()); - expect(testResponse.externalTemperature).to(beNil()); - expect(testResponse.fuelLevel).to(beNil()); - expect(testResponse.fuelLevel_State).to(beNil()); - expect(testResponse.fuelRange).to(beNil()); - expect(testResponse.gps).to(beNil()); - expect(testResponse.headLampStatus).to(beNil()); - expect(testResponse.instantFuelConsumption).to(beNil()); - expect(testResponse.myKey).to(beNil()); - expect(testResponse.odometer).to(beNil()); - expect(testResponse.gearStatus).to(beNil()); - expect(testResponse.rpm).to(beNil()); - expect(testResponse.speed).to(beNil()); - expect(testResponse.steeringWheelAngle).to(beNil()); - expect(testResponse.tirePressure).to(beNil()); - expect(testResponse.turnSignal).to(beNil()); - expect(testResponse.vin).to(beNil()); - expect(testResponse.wiperStatus).to(beNil()); + it(@"expect all properties to be nil", ^{ + expect(testResponse.accPedalPosition).to(beNil()); + expect(testResponse.airbagStatus).to(beNil()); + expect(testResponse.beltStatus).to(beNil()); + expect(testResponse.bodyInformation).to(beNil()); + expect(testResponse.cloudAppVehicleID).to(beNil()); + expect(testResponse.clusterModeStatus).to(beNil()); + expect(testResponse.deviceStatus).to(beNil()); + expect(testResponse.driverBraking).to(beNil()); + expect(testResponse.eCallInfo).to(beNil()); + expect(testResponse.electronicParkBrakeStatus).to(beNil()); + expect(testResponse.emergencyEvent).to(beNil()); + expect(testResponse.engineOilLife).to(beNil()); + expect(testResponse.engineTorque).to(beNil()); + expect(testResponse.externalTemperature).to(beNil()); + expect(testResponse.fuelLevel).to(beNil()); + expect(testResponse.fuelLevel_State).to(beNil()); + expect(testResponse.fuelRange).to(beNil()); + expect(testResponse.gps).to(beNil()); + expect(testResponse.headLampStatus).to(beNil()); + expect(testResponse.instantFuelConsumption).to(beNil()); + expect(testResponse.myKey).to(beNil()); + expect(testResponse.odometer).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(beNil()); + expect(testResponse.prndl).to(beNil()); #pragma clang diagnostic pop + expect(testResponse.gearStatus).to(beNil()); + expect(testResponse.rpm).to(beNil()); + expect(testResponse.speed).to(beNil()); + expect(testResponse.steeringWheelAngle).to(beNil()); + expect(testResponse.tirePressure).to(beNil()); + expect(testResponse.turnSignal).to(beNil()); + expect(testResponse.vin).to(beNil()); + expect(testResponse.wiperStatus).to(beNil()); + }); }); - it(@"Should set and get Generic Network Signal Data", ^{ - SDLGetVehicleDataResponse *testResponse = [[SDLGetVehicleDataResponse alloc] init]; + context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:", ^{ + SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] initWithGps:gps speed:speed rpm:@(rpm) fuelLevel:fuelLevel fuelLevel_State:fuelLevel_State instantFuelConsumption:instantFuelConsumption fuelRange:fuelRangeArray externalTemperature:externalTemperature turnSignal:turnSignal vin:vin gearStatus:gearStatus tirePressure:tirePressure odometer:@(odometer) beltStatus:beltStatus bodyInformation:bodyInformation deviceStatus:deviceStatus driverBraking:driverBraking wiperStatus:wiperStatus headLampStatus:headLampStatus engineTorque:engineTorque accPedalPosition:accPedalPosition steeringWheelAngle:steeringWheelAngle engineOilLife:engineOilLife electronicParkBrakeStatus:electronicParkBrakeStatus cloudAppVehicleID:cloudAppVehicleID eCallInfo:eCallInfo airbagStatus:airbagStatus emergencyEvent:emergencyEvent clusterModeStatus:clusterModeStatus myKey:myKey]; + it(@"expect all properties to be set properly", ^{ + expect(testResponse.accPedalPosition).to(equal(@(accPedalPosition))); + expect(testResponse.airbagStatus).to(equal(airbagStatus)); + expect(testResponse.beltStatus).to(equal(beltStatus)); + expect(testResponse.bodyInformation).to(equal(bodyInformation)); + expect(testResponse.cloudAppVehicleID).to(equal(cloudAppVehicleID)); + expect(testResponse.clusterModeStatus).to(equal(clusterModeStatus)); + expect(testResponse.deviceStatus).to(equal(deviceStatus)); + expect(testResponse.driverBraking).to(equal(driverBraking)); + expect(testResponse.eCallInfo).to(equal(eCallInfo)); + expect(testResponse.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); + expect(testResponse.emergencyEvent).to(equal(emergencyEvent)); + expect(testResponse.engineOilLife).to(equal(@(engineOilLife))); + expect(testResponse.engineTorque).to(equal(@(engineTorque))); + expect(testResponse.externalTemperature).to(equal(@(externalTemperature))); + expect(testResponse.fuelLevel).to(equal(@(fuelLevel))); + expect(testResponse.fuelLevel_State).to(equal(fuelLevel_State)); + expect(testResponse.fuelRange).to(equal(fuelRangeArray)); + expect(testResponse.gps).to(equal(gps)); + expect(testResponse.headLampStatus).to(equal(headLampStatus)); + expect(testResponse.instantFuelConsumption).to(equal(@(instantFuelConsumption))); + expect(testResponse.myKey).to(equal(myKey)); + expect(testResponse.odometer).to(equal(@(odometer))); + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testResponse.prndl).to(beNil()); + #pragma clang diagnostic pop + expect(testResponse.gearStatus).to(equal(gearStatus)); + expect(testResponse.rpm).to(equal(@(rpm))); + expect(testResponse.speed).to(equal(@(speed))); + expect(testResponse.steeringWheelAngle).to(equal(@(steeringWheelAngle))); + expect(testResponse.tirePressure).to(equal(tirePressure)); + expect(testResponse.turnSignal).to(equal(turnSignal)); + expect(testResponse.vin).to(equal(vin)); + expect(testResponse.wiperStatus).to(equal(wiperStatus)); + }); + }); + context(@"init and set OEM Custom Vehicle Data", ^{ + SDLGetVehicleDataResponse *testResponse = [[SDLGetVehicleDataResponse alloc] init]; [testResponse setOEMCustomVehicleData:@"customVehicleData" withVehicleDataState:@"oemVehicleData"]; - - expect([testResponse getOEMCustomVehicleData:@"customVehicleData"]).to(equal(@"oemVehicleData")); + it(@"expect OEM Custom Vehicle Data to be set properly", ^{ + expect([testResponse getOEMCustomVehicleData:@"customVehicleData"]).to(equal(@"oemVehicleData")); + }); }); }); |