diff options
author | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-08-09 23:49:15 +0300 |
---|---|---|
committer | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-08-10 00:56:21 +0300 |
commit | 018bdcecb58a3d9f27d73e914f85198602075881 (patch) | |
tree | b7cd32d79f1b4af535aefd35a81a67e1866f6a99 | |
parent | b8d66926f13d44f4482b57ece2af3f95b469dcd5 (diff) | |
download | sdl_ios-018bdcecb58a3d9f27d73e914f85198602075881.tar.gz |
0261 'New vehicle data WindowStatus': code review 4, put vehicle data structs in order, revert extra changes, etc
26 files changed, 1452 insertions, 2436 deletions
diff --git a/SmartDeviceLink/SDLGetVehicleData.h b/SmartDeviceLink/SDLGetVehicleData.h index a07f9d34c..41742d607 100644 --- a/SmartDeviceLink/SDLGetVehicleData.h +++ b/SmartDeviceLink/SDLGetVehicleData.h @@ -1,148 +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 */ + +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 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 + * @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:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus: 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 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 + * @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:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus: 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 + * @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:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus: instead"); @@ -184,243 +160,179 @@ NS_ASSUME_NONNULL_BEGIN - (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 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 windowStatus:(nullable NSNumber<SDLBool> *)windowStatus; /** - * A boolean value. If true, requests Acc Pedal Position data. - * - * Optional. + * A boolean value. If true, requests GPS data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *gps; /** - * A boolean value. If true, requests Air Bag Status data. - * - * Optional. + * A boolean value. If true, requests Speed data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *speed; /** - * A boolean value. If true, requests Belt Status data. - * - * Optional. + * A boolean value. If true, requests RPM data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *rpm; /** - * A boolean value. If true, requests Body Information data. - * - * Optional. + * A boolean value. If true, requests Fuel Level data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *fuelLevel; /** - * A boolean value. If true, requests the Cloud App Vehicle ID. - * - * Optional. + * A boolean value. If true, requests Fuel Level State data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *fuelLevel_State; /** - * A boolean value. If true, requests Cluster Mode Status data. - * - * Optional. + * A boolean value. If true, requests Fuel Range data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *fuelRange; /** - * A boolean value. If true, requests Device Status data. - * - * Optional. + * A boolean value. If true, requests Instant Fuel Consumption data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *instantFuelConsumption; /** - * A boolean value. If true, requests Driver Braking data. - * - * Optional. + * A boolean value. If true, requests External Temperature data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *externalTemperature; /** - * A boolean value. If true, requests Emergency Call Info data. - * - * Optional. + * A boolean value. If true, requests the Vehicle Identification Number. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *vin; /** - * A boolean value. If true, requests Electronic Parking Brake status data. - * - * Optional. + * A boolean value. If true, requests PRNDL data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *prndl; /** - * A boolean value. If true, requests Emergency Event (if it occurred) data. - * - * Optional. + * A boolean value. If true, requests Tire Pressure data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *tirePressure; /** - * A boolean value. If true, requests Engine Oil Life data. - * - * Optional. + * A boolean value. If true, requests Odometer data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *odometer; /** - * A boolean value. If true, requests Engine Torque data. - * - * Optional. + * A boolean value. If true, requests Belt Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *beltStatus; /** - * A boolean value. If true, requests External Temperature data. - * - * Optional. + * A boolean value. If true, requests Body Information data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *bodyInformation; /** - * A boolean value. If true, requests Fuel Level data. - * - * Optional. + * A boolean value. If true, requests Device Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *deviceStatus; /** - * A boolean value. If true, requests Fuel Level State data. - * - * Optional. + * A boolean value. If true, requests Driver Braking data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *driverBraking; /** - * A boolean value. If true, requests Fuel Range data. - * - * Optional. + * A boolean value. If true, requests Window Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *windowStatus; /** - * A boolean value. If true, requests GPS data. - * - * Optional. + * A boolean value. If true, requests Wiper Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *wiperStatus; /** * A boolean value. If true, requests Head Lamp Status data. - * - * Optional. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *headLampStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *headLampStatus; /** - * A boolean value. If true, requests Instant Fuel Consumption data. - * - * Optional. + * A boolean value. If true, requests Engine Oil Life data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; /** - * A boolean value. If true, requests MyKey data. - * - * Optional. + * A boolean value. If true, requests Engine Torque data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *engineTorque; /** - * A boolean value. If true, requests Odometer data. - * - * Optional. + * A boolean value. If true, requests Acc Pedal Position data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *accPedalPosition; /** - * A boolean value. If true, requests PRNDL data. - * - * Optional. + * A boolean value. If true, requests Steering Wheel Angle data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *steeringWheelAngle; /** - * A boolean value. If true, requests RPM data. - * - * Optional. + * A boolean value. If true, requests Emergency Call Info data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *eCallInfo; /** - * A boolean value. If true, requests Speed data. - * - * Optional. + * A boolean value. If true, requests Air Bag Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *airbagStatus; /** - * A boolean value. If true, requests Steering Wheel Angle data. - * - * Optional. + * A boolean value. If true, requests Emergency Event (if it occurred) data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *emergencyEvent; /** - * A boolean value. If true, requests Tire Pressure data. - * - * Optional. + * A boolean value. If true, requests Cluster Mode Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *clusterModeStatus; /** - * A boolean value. If true, requests Turn Signal data. - * - * Optional. + * A boolean value. If true, requests MyKey data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *myKey; /** - * A boolean value. If true, requests the Vehicle Identification Number. - * - * Optional. + A boolean value. If true, requests Electronic Parking Brake status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *vin; +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *electronicParkBrakeStatus; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 + A boolean value. If true, requests Turn Signal data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *windowStatus; +@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 diff --git a/SmartDeviceLink/SDLGetVehicleData.m b/SmartDeviceLink/SDLGetVehicleData.m index e4bedde3f..62bd7a4af 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 @@ -106,8 +79,7 @@ NS_ASSUME_NONNULL_BEGIN } - (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 { @@ -115,8 +87,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 { @@ -124,8 +95,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 { @@ -133,8 +103,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 { @@ -142,8 +111,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 { @@ -151,8 +119,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 { @@ -160,8 +127,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 { @@ -169,8 +135,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 { @@ -178,8 +143,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)vin { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameVIN ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameVIN ofClass:NSNumber.class error:nil]; } - (void)setPrndl:(nullable NSNumber<SDLBool> *)prndl { @@ -187,8 +151,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 { @@ -196,8 +159,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 { @@ -205,8 +167,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 { @@ -214,8 +175,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 { @@ -223,8 +183,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 { @@ -232,8 +191,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 { @@ -241,8 +199,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 { @@ -250,8 +207,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 { @@ -259,8 +215,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 { @@ -268,8 +223,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 { @@ -277,8 +231,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 { @@ -286,8 +239,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 { @@ -295,8 +247,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 { @@ -304,8 +255,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 { @@ -313,8 +263,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 { @@ -322,8 +271,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 { @@ -331,8 +279,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 { @@ -340,8 +287,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 { @@ -349,8 +295,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 { @@ -358,8 +303,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 { @@ -367,8 +311,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:nil]; } - (void)setWindowStatus:(nullable NSNumber<SDLBool> *)windowStatus { @@ -385,8 +328,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 04bea237b..c964a0eb3 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" @@ -52,11 +24,15 @@ @class SDLTireStatus; @class SDLWindowStatus; -NS_ASSUME_NONNULL_BEGIN /** - * @since SDL 2.0.0 + * Response to SDLGetVehicleData + * + * Since SmartDeviceLink 2.0 */ + +NS_ASSUME_NONNULL_BEGIN + @interface SDLGetVehicleDataResponse : SDLRPCResponse /** @@ -97,243 +73,181 @@ NS_ASSUME_NONNULL_BEGIN - (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 prndl:(nullable SDLPRNDL)prndl 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 windowStatus:(nullable NSArray<SDLWindowStatus *> *)windowStatus; /** - Accelerator pedal position (percentage depressed) - - Optional. + The car current GPS coordinates */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *accPedalPosition; +@property (nullable, strong, nonatomic) SDLGPSData *gps; /** - The status of the air bags - - Optional. + The vehicle speed in kilometers per hour */ -@property (strong, nonatomic, nullable) SDLAirbagStatus *airbagStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *speed; /** - The status of the seat belts - - Optional. + The number of revolutions per minute of the engine. */ -@property (strong, nonatomic, nullable) SDLBeltStatus *beltStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *rpm; /** - The body information including power modes - - Optional. + The fuel level in the tank (percentage) */ -@property (strong, nonatomic, nullable) SDLBodyInformation *bodyInformation; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *fuelLevel; /** - The cloud app vehicle ID - - Optional. + The fuel level state */ -@property (strong, nonatomic, nullable) NSString *cloudAppVehicleID; +@property (nullable, strong, nonatomic) SDLComponentVolumeStatus fuelLevel_State; /** - The status modes of the cluster + 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) SDLClusterModeStatus *clusterModeStatus; +@property (nullable, strong, nonatomic) NSArray<SDLFuelRange *> *fuelRange; /** - The IVI system status including signal and battery strength - - Optional. + The instantaneous fuel consumption in microlitres */ -@property (strong, nonatomic, nullable) SDLDeviceStatus *deviceStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *instantFuelConsumption; /** - The status of the brake pedal - - Optional. + The external temperature in degrees celsius. */ -@property (strong, nonatomic, nullable) SDLVehicleDataEventStatus driverBraking; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *externalTemperature; /** - Emergency Call notification and confirmation data - - Optional. + The Vehicle Identification Number */ -@property (strong, nonatomic, nullable) SDLECallInfo *eCallInfo; +@property (nullable, strong, nonatomic) NSString *vin; /** - The status of the electronic parking brake - - Optional. + The current gear shift state of the user's vehicle */ -@property (strong, nonatomic, nullable) SDLElectronicParkBrakeStatus electronicParkBrakeStatus; +@property (nullable, strong, nonatomic) SDLPRNDL prndl; /** - Information related to an emergency event (and if it occurred) - - Optional. + The current pressure warnings for the user's vehicle */ -@property (strong, nonatomic, nullable) SDLEmergencyEvent *emergencyEvent; +@property (nullable, strong, nonatomic) SDLTireStatus *tirePressure; /** - The estimated percentage (0% - 100%) of remaining oil life of the engine - - Optional. + Odometer reading in km */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineOilLife; +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *odometer; /** - Torque value for engine (in Nm) on non-diesel variants - - Optional. + The status of the seat belts */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineTorque; +@property (nullable, strong, nonatomic) SDLBeltStatus *beltStatus; /** - The external temperature in degrees celsius. - - Optional. + The body information including power modes */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *externalTemperature; +@property (nullable, strong, nonatomic) SDLBodyInformation *bodyInformation; /** - The fuel level in the tank (percentage) - - Optional. + The IVI system status including signal and battery strength */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *fuelLevel; +@property (nullable, strong, nonatomic) SDLDeviceStatus *deviceStatus; /** - The fuel level state - - Optional. + The status of the brake pedal */ -@property (strong, nonatomic, nullable) SDLComponentVolumeStatus fuelLevel_State; +@property (nullable, strong, nonatomic) SDLVehicleDataEventStatus driverBraking; /** - The estimate range in KM the vehicle can travel based on fuel level and consumption - - Optional, Array of length 0 - 100, of SDLFuelRange + * See WindowStatus */ -@property (strong, nonatomic, nullable) NSArray<SDLFuelRange *> *fuelRange; +@property (strong, nonatomic, nullable) NSArray<SDLWindowStatus *> *windowStatus; /** - 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; /** - Information related to the MyKey feature - - Optional. + Torque value for engine (in Nm) on non-diesel variants */ -@property (strong, nonatomic, nullable) SDLMyKey *myKey; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *engineTorque; /** - Odometer reading in km - - Optional. + Accelerator pedal position (percentage depressed) */ -@property (strong, nonatomic, nullable) NSNumber<SDLInt> *odometer; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *accPedalPosition; /** - The current gear shift state of the user's vehicle - - Optional. + Current angle of the steering wheel (in deg) */ -@property (strong, nonatomic, nullable) SDLPRNDL prndl; +@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; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 + The status of the turn signal */ -@property (strong, nonatomic, nullable) NSArray<SDLWindowStatus *> *windowStatus; +@property (nullable, strong, nonatomic) SDLTurnSignal turnSignal; /** - The status of the wipers - - 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 afd362a65..048ee99cf 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 "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 "SDLGPSData.h" -#import "SDLGetVehicleDataResponse.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 "SDLWindowStatus.h" -#import "SDLWiperStatus.h" NS_ASSUME_NONNULL_BEGIN @@ -113,8 +80,7 @@ NS_ASSUME_NONNULL_BEGIN } - (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 { @@ -122,8 +88,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 { @@ -131,8 +96,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 { @@ -140,8 +104,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 { @@ -149,8 +112,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 { @@ -162,13 +124,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 { @@ -176,8 +136,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 { @@ -185,8 +144,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)setPrndl:(nullable SDLPRNDL)prndl { @@ -194,8 +152,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 { @@ -203,8 +160,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 { @@ -212,8 +168,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 { @@ -221,8 +176,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 { @@ -230,8 +184,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 { @@ -239,8 +192,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 { @@ -248,8 +200,16 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataEventStatus)driverBraking { + return [self.parameters sdl_enumForName:SDLRPCParameterNameDriverBraking error:nil]; +} + +- (void)setWindowStatus:(nullable NSArray<SDLWindowStatus *> *)windowStatus { + [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; +} + +- (nullable NSArray<SDLWindowStatus *> *)windowStatus { NSError *error = nil; - return [self.parameters sdl_enumForName:SDLRPCParameterNameDriverBraking error:&error]; + return [self.parameters sdl_objectsForName:SDLRPCParameterNameWindowStatus ofClass:SDLWindowStatus.class error:&error]; } - (void)setWiperStatus:(nullable SDLWiperStatus)wiperStatus { @@ -257,8 +217,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 { @@ -266,8 +225,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 { @@ -275,8 +233,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 { @@ -284,8 +241,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 { @@ -293,8 +249,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 { @@ -302,8 +257,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 { @@ -311,8 +265,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 { @@ -320,8 +273,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 { @@ -329,8 +281,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 { @@ -338,8 +289,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 { @@ -347,8 +297,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 { @@ -356,8 +305,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 { @@ -365,8 +313,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 { @@ -374,17 +321,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSString *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSString.class error:&error]; -} - -- (void)setWindowStatus:(nullable NSArray<SDLWindowStatus *> *)windowStatus { - [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; -} - -- (nullable NSArray<SDLWindowStatus *> *)windowStatus { - NSError *error = nil; - return [self.parameters sdl_objectsForName:SDLRPCParameterNameWindowStatus ofClass:SDLWindowStatus.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSString.class error:nil]; } - (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(NSObject *)vehicleDataState { @@ -392,8 +329,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/SDLOnVehicleData.h b/SmartDeviceLink/SDLOnVehicleData.h index e6047e3b9..87b6aa00f 100644 --- a/SmartDeviceLink/SDLOnVehicleData.h +++ b/SmartDeviceLink/SDLOnVehicleData.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. - */ +// SDLOnVehicleData.h +// + +#import "SDLRPCNotification.h" #import "SDLComponentVolumeStatus.h" #import "SDLElectronicParkBrakeStatus.h" #import "SDLPRNDL.h" -#import "SDLRPCNotification.h" #import "SDLTurnSignal.h" #import "SDLVehicleDataEventStatus.h" #import "SDLWiperStatus.h" @@ -52,13 +24,15 @@ @class SDLTireStatus; @class SDLWindowStatus; -NS_ASSUME_NONNULL_BEGIN /** - * Callback for the periodic and non periodic vehicle data read function. - * - * @since SDL 2.0.0 + Callback for the periodic and non periodic vehicle data read function. + + Since SmartDeviceLink 2.0 */ + +NS_ASSUME_NONNULL_BEGIN + @interface SDLOnVehicleData : SDLRPCNotification /** @@ -99,243 +73,181 @@ NS_ASSUME_NONNULL_BEGIN - (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 prndl:(nullable SDLPRNDL)prndl 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 windowStatus:(nullable NSArray<SDLWindowStatus *> *)windowStatus; /** - Accelerator pedal position (percentage depressed) - - Optional. + The car current GPS coordinates */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *accPedalPosition; +@property (nullable, strong, nonatomic) SDLGPSData *gps; /** - The status of the air bags - - Optional. + The vehicle speed in kilometers per hour */ -@property (strong, nonatomic, nullable) SDLAirbagStatus *airbagStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *speed; /** - The status of the seat belts - - Optional. + The number of revolutions per minute of the engine. */ -@property (strong, nonatomic, nullable) SDLBeltStatus *beltStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *rpm; /** - The body information including power modes - - Optional. + The fuel level in the tank (percentage) */ -@property (strong, nonatomic, nullable) SDLBodyInformation *bodyInformation; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *fuelLevel; /** - The cloud app vehicle ID - - Optional. + The fuel level state */ -@property (strong, nonatomic, nullable) NSString *cloudAppVehicleID; +@property (nullable, strong, nonatomic) SDLComponentVolumeStatus fuelLevel_State; /** - The status modes of the cluster + 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) SDLClusterModeStatus *clusterModeStatus; +@property (nullable, strong, nonatomic) NSArray<SDLFuelRange *> *fuelRange; /** - The IVI system status including signal and battery strength - - Optional. + The instantaneous fuel consumption in microlitres */ -@property (strong, nonatomic, nullable) SDLDeviceStatus *deviceStatus; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *instantFuelConsumption; /** - The status of the brake pedal - - Optional. + The external temperature in degrees celsius. */ -@property (strong, nonatomic, nullable) SDLVehicleDataEventStatus driverBraking; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *externalTemperature; /** - Emergency Call notification and confirmation data - - Optional. + The Vehicle Identification Number */ -@property (strong, nonatomic, nullable) SDLECallInfo *eCallInfo; +@property (nullable, strong, nonatomic) NSString *vin; /** - The status of the electronic parking brake - - Optional. + The current gear shift state of the user's vehicle */ -@property (strong, nonatomic, nullable) SDLElectronicParkBrakeStatus electronicParkBrakeStatus; +@property (nullable, strong, nonatomic) SDLPRNDL prndl; /** - Information related to an emergency event (and if it occurred) - - Optional. + The current pressure warnings for the user's vehicle */ -@property (strong, nonatomic, nullable) SDLEmergencyEvent *emergencyEvent; +@property (nullable, strong, nonatomic) SDLTireStatus *tirePressure; /** - The estimated percentage (0% - 100%) of remaining oil life of the engine - - Optional. + Odometer reading in km */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineOilLife; +@property (nullable, strong, nonatomic) NSNumber<SDLInt> *odometer; /** - Torque value for engine (in Nm) on non-diesel variants - - Optional. + The status of the seat belts */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *engineTorque; +@property (nullable, strong, nonatomic) SDLBeltStatus *beltStatus; /** - The external temperature in degrees celsius. - - Optional. + The body information including power modes */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *externalTemperature; +@property (nullable, strong, nonatomic) SDLBodyInformation *bodyInformation; /** - The fuel level in the tank (percentage) - - Optional. + The IVI system status including signal and battery strength */ -@property (strong, nonatomic, nullable) NSNumber<SDLFloat> *fuelLevel; +@property (nullable, strong, nonatomic) SDLDeviceStatus *deviceStatus; /** - The fuel level state - - Optional. + The status of the brake pedal */ -@property (strong, nonatomic, nullable) SDLComponentVolumeStatus fuelLevel_State; +@property (nullable, strong, nonatomic) SDLVehicleDataEventStatus driverBraking; /** - The estimate range in KM the vehicle can travel based on fuel level and consumption - - Optional, Array of length 0 - 100, of SDLFuelRange + The status of the window */ -@property (strong, nonatomic, nullable) NSArray<SDLFuelRange *> *fuelRange; +@property (strong, nonatomic, nullable) NSArray<SDLWindowStatus *> *windowStatus; /** - 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 (nullable, strong, nonatomic) NSNumber<SDLFloat> *engineOilLife; /** - Information related to the MyKey feature - - Optional. + Torque value for engine (in Nm) on non-diesel variants */ -@property (strong, nonatomic, nullable) SDLMyKey *myKey; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *engineTorque; /** - Odometer reading in km - - Optional. + Accelerator pedal position (percentage depressed) */ -@property (strong, nonatomic, nullable) NSNumber<SDLInt> *odometer; +@property (nullable, strong, nonatomic) NSNumber<SDLFloat> *accPedalPosition; /** - The current gear shift state of the user's vehicle - - Optional. + Current angle of the steering wheel (in deg) */ -@property (strong, nonatomic, nullable) SDLPRNDL prndl; +@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; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 + The status of the turn signal */ -@property (strong, nonatomic, nullable) NSArray<SDLWindowStatus *> *windowStatus; +@property (nullable, strong, nonatomic) SDLTurnSignal turnSignal; /** - The status of the wipers - - 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/SDLOnVehicleData.m b/SmartDeviceLink/SDLOnVehicleData.m index 65289d9ee..ef0874c79 100644 --- a/SmartDeviceLink/SDLOnVehicleData.m +++ b/SmartDeviceLink/SDLOnVehicleData.m @@ -1,58 +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. - */ +// SDLOnVehicleData.m +// + +#import "SDLOnVehicleData.h" #import "NSMutableDictionary+Store.h" #import "SDLAirbagStatus.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 "SDLGPSData.h" #import "SDLHeadLampStatus.h" #import "SDLMyKey.h" -#import "SDLOnVehicleData.h" -#import "SDLPRNDL.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" #import "SDLTireStatus.h" -#import "SDLTurnSignal.h" -#import "SDLVehicleDataEventStatus.h" #import "SDLWindowStatus.h" -#import "SDLWiperStatus.h" NS_ASSUME_NONNULL_BEGIN diff --git a/SmartDeviceLink/SDLSubscribeVehicleData.h b/SmartDeviceLink/SDLSubscribeVehicleData.h index 64476cc47..fb6421c5c 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleData.h +++ b/SmartDeviceLink/SDLSubscribeVehicleData.h @@ -1,147 +1,123 @@ -/* - * 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. - */ +// SDLSubscribeVehicleData.h +// -#import "SDLRPCRequest.h" -NS_ASSUME_NONNULL_BEGIN +#import "SDLRPCRequest.h" /** - * Subscribes for specific published data items. The data will be only sent if it has changed. The application will - * be notified by the onVehicleData notification whenever new data is available. To unsubscribe the notifications, - * use unsubscribe with the same subscriptionType. + * Subscribes to specific published vehicle data items. The data will be only sent if it has changed. The application will be notified by the `onVehicleData` notification whenever new data is available. The update rate is dependent on sensors, vehicle architecture and vehicle type. * - * @since SDL 2.0.0 + * @warning A vehicle may only support a subset of the vehicle data items. Be prepared for the situation where a signal is not available on a vehicle. + * + * Function Group: Location, VehicleInfo and DrivingChara + * HMILevel needs to be FULL, LIMITED or BACKGROUND + * Since SmartDeviceLink 2.0 + * See SDLUnsubscribeVehicleData, SDLGetVehicleData */ + +NS_ASSUME_NONNULL_BEGIN + @interface SDLSubscribeVehicleData : SDLRPCRequest /** * Convenience init for subscribing to all possible vehicle data items. * - * @param accelerationPedalPosition Subscribe to accelerationPedalPosition - * @param airbagStatus Subscribe to airbagStatus - * @param beltStatus Subscribe to beltStatus - * @param bodyInformation Subscribe to bodyInformation - * @param clusterModeStatus Subscribe to clusterModeStatus - * @param deviceStatus Subscribe to deviceStatus - * @param driverBraking Subscribe to driverBraking - * @param eCallInfo Subscribe to eCallInfo - * @param emergencyEvent Subscribe to emergencyEvent - * @param engineTorque Subscribe to engineTorque - * @param externalTemperature Subscribe to externalTemperature - * @param fuelLevel Subscribe to fuelLevel - * @param fuelLevelState Subscribe to fuelLevelState - * @param gps Subscribe to gps - * @param headLampStatus Subscribe to headLampStatus - * @param instantFuelConsumption Subscribe to instantFuelConsumption - * @param myKey Subscribe to myKey - * @param odometer Subscribe to odometer - * @param prndl Subscribe to prndl - * @param rpm Subscribe to rpm - * @param speed Subscribe to speed - * @param steeringWheelAngle Subscribe to steeringWheelAngle - * @param tirePressure Subscribe to tirePressure - * @param wiperStatus Subscribe to wiperStatus - * @return A SDLSubscribeVehicleData object + * @param accelerationPedalPosition Subscribe to accelerationPedalPosition + * @param airbagStatus Subscribe to airbagStatus + * @param beltStatus Subscribe to beltStatus + * @param bodyInformation Subscribe to bodyInformation + * @param clusterModeStatus Subscribe to clusterModeStatus + * @param deviceStatus Subscribe to deviceStatus + * @param driverBraking Subscribe to driverBraking + * @param eCallInfo Subscribe to eCallInfo + * @param emergencyEvent Subscribe to emergencyEvent + * @param engineTorque Subscribe to engineTorque + * @param externalTemperature Subscribe to externalTemperature + * @param fuelLevel Subscribe to fuelLevel + * @param fuelLevelState Subscribe to fuelLevelState + * @param gps Subscribe to gps + * @param headLampStatus Subscribe to headLampStatus + * @param instantFuelConsumption Subscribe to instantFuelConsumption + * @param myKey Subscribe to myKey + * @param odometer Subscribe to odometer + * @param prndl Subscribe to prndl + * @param rpm Subscribe to rpm + * @param speed Subscribe to speed + * @param steeringWheelAngle Subscribe to steeringWheelAngle + * @param tirePressure Subscribe to tirePressure + * @param wiperStatus Subscribe to wiperStatus + * @return A SDLSubscribeVehicleData 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 wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus: instead"); /** * Convenience init for subscribing to all possible vehicle data items. * - * @param accelerationPedalPosition Subscribe to accelerationPedalPosition - * @param airbagStatus Subscribe to airbagStatus - * @param beltStatus Subscribe to beltStatus - * @param bodyInformation Subscribe to bodyInformation - * @param clusterModeStatus Subscribe to clusterModeStatus - * @param deviceStatus Subscribe to deviceStatus - * @param driverBraking Subscribe to driverBraking - * @param eCallInfo Subscribe to eCallInfo - * @param electronicParkBrakeStatus Subscribe to electronicParkBrakeStatus - * @param emergencyEvent Subscribe to emergencyEvent - * @param engineOilLife Subscribe to engineOilLife - * @param engineTorque Subscribe to engineTorque - * @param externalTemperature Subscribe to externalTemperature - * @param fuelLevel Subscribe to fuelLevel - * @param fuelLevelState Subscribe to fuelLevelState - * @param fuelRange Subscribe to fuelRange - * @param gps Subscribe to gps - * @param headLampStatus Subscribe to headLampStatus - * @param instantFuelConsumption Subscribe to instantFuelConsumption - * @param myKey Subscribe to myKey - * @param odometer Subscribe to odometer - * @param prndl Subscribe to prndl - * @param rpm Subscribe to rpm - * @param speed Subscribe to speed - * @param steeringWheelAngle Subscribe to steeringWheelAngle - * @param tirePressure Subscribe to tirePressure - * @param turnSignal Subscribe to turnSignal - * @param wiperStatus Subscribe to wiperStatus - * @return A SDLSubscribeVehicleData object + * @param accelerationPedalPosition Subscribe to accelerationPedalPosition + * @param airbagStatus Subscribe to airbagStatus + * @param beltStatus Subscribe to beltStatus + * @param bodyInformation Subscribe to bodyInformation + * @param clusterModeStatus Subscribe to clusterModeStatus + * @param deviceStatus Subscribe to deviceStatus + * @param driverBraking Subscribe to driverBraking + * @param eCallInfo Subscribe to eCallInfo + * @param electronicParkBrakeStatus Subscribe to electronicParkBrakeStatus + * @param emergencyEvent Subscribe to emergencyEvent + * @param engineOilLife Subscribe to engineOilLife + * @param engineTorque Subscribe to engineTorque + * @param externalTemperature Subscribe to externalTemperature + * @param fuelLevel Subscribe to fuelLevel + * @param fuelLevelState Subscribe to fuelLevelState + * @param fuelRange Subscribe to fuelRange + * @param gps Subscribe to gps + * @param headLampStatus Subscribe to headLampStatus + * @param instantFuelConsumption Subscribe to instantFuelConsumption + * @param myKey Subscribe to myKey + * @param odometer Subscribe to odometer + * @param prndl Subscribe to prndl + * @param rpm Subscribe to rpm + * @param speed Subscribe to speed + * @param steeringWheelAngle Subscribe to steeringWheelAngle + * @param tirePressure Subscribe to tirePressure + * @param turnSignal Subscribe to turnSignal + * @param wiperStatus Subscribe to wiperStatus + * @return A SDLSubscribeVehicleData 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 wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus: instead"); /** * Convenience init for subscribing to all possible vehicle data items. * - * @param accelerationPedalPosition Subscribe to accelerationPedalPosition - * @param airbagStatus Subscribe to airbagStatus - * @param beltStatus Subscribe to beltStatus - * @param bodyInformation Subscribe to bodyInformation - * @param cloudAppVehicleID Subscribe to cloudAppVehicleID - * @param clusterModeStatus Subscribe to clusterModeStatus - * @param deviceStatus Subscribe to deviceStatus - * @param driverBraking Subscribe to driverBraking - * @param eCallInfo Subscribe to eCallInfo - * @param electronicParkBrakeStatus Subscribe to electronicParkBrakeStatus - * @param emergencyEvent Subscribe to emergencyEvent - * @param engineOilLife Subscribe to engineOilLife - * @param engineTorque Subscribe to engineTorque - * @param externalTemperature Subscribe to externalTemperature - * @param fuelLevel Subscribe to fuelLevel - * @param fuelLevelState Subscribe to fuelLevelState - * @param fuelRange Subscribe to fuelRange - * @param gps Subscribe to gps - * @param headLampStatus Subscribe to headLampStatus - * @param instantFuelConsumption Subscribe to instantFuelConsumption - * @param myKey Subscribe to myKey - * @param odometer Subscribe to odometer - * @param prndl Subscribe to prndl - * @param rpm Subscribe to rpm - * @param speed Subscribe to speed - * @param steeringWheelAngle Subscribe to steeringWheelAngle - * @param tirePressure Subscribe to tirePressure - * @param turnSignal Subscribe to turnSignal - * @param wiperStatus Subscribe to wiperStatus - * @return A SDLSubscribeVehicleData object + * @param accelerationPedalPosition Subscribe to accelerationPedalPosition + * @param airbagStatus Subscribe to airbagStatus + * @param beltStatus Subscribe to beltStatus + * @param bodyInformation Subscribe to bodyInformation + * @param cloudAppVehicleID Subscribe to cloudAppVehicleID + * @param clusterModeStatus Subscribe to clusterModeStatus + * @param deviceStatus Subscribe to deviceStatus + * @param driverBraking Subscribe to driverBraking + * @param eCallInfo Subscribe to eCallInfo + * @param electronicParkBrakeStatus Subscribe to electronicParkBrakeStatus + * @param emergencyEvent Subscribe to emergencyEvent + * @param engineOilLife Subscribe to engineOilLife + * @param engineTorque Subscribe to engineTorque + * @param externalTemperature Subscribe to externalTemperature + * @param fuelLevel Subscribe to fuelLevel + * @param fuelLevelState Subscribe to fuelLevelState + * @param fuelRange Subscribe to fuelRange + * @param gps Subscribe to gps + * @param headLampStatus Subscribe to headLampStatus + * @param instantFuelConsumption Subscribe to instantFuelConsumption + * @param myKey Subscribe to myKey + * @param odometer Subscribe to odometer + * @param prndl Subscribe to prndl + * @param rpm Subscribe to rpm + * @param speed Subscribe to speed + * @param steeringWheelAngle Subscribe to steeringWheelAngle + * @param tirePressure Subscribe to tirePressure + * @param turnSignal Subscribe to turnSignal + * @param wiperStatus Subscribe to wiperStatus + * @return A SDLSubscribeVehicleData 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 wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus: instead"); @@ -183,216 +159,154 @@ NS_ASSUME_NONNULL_BEGIN - (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 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 windowStatus:(nullable NSNumber<SDLBool> *)windowStatus; /** - * A boolean value. If true, subscribes Acc Pedal Position data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; - -/** - * A boolean value. If true, subscribes Airbag Status data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; + * A boolean value. If true, subscribes GPS data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; /** - * A boolean value. If true, subscribes Belt Status data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; + * A boolean value. If true, subscribes Speed data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; /** - * A boolean value. If true, subscribes Body Information data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; + * A boolean value. If true, subscribes RPM data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; /** - * A boolean value. If true, subscribes to the cloud app vehicle ID. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; + * A boolean value. If true, subscribes Fuel Level data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; /** - * A boolean value. If true, subscribes Cluster Mode Status data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; + * A boolean value. If true, subscribes Fuel Level State data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; /** - * A boolean value. If true, subscribes Device Status data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; + * A boolean value. If true, subscribes Fuel Range data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; /** - * A boolean value. If true, subscribes Driver Braking data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; + * A boolean value. If true, subscribes Instant Fuel Consumption data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; /** - * A boolean value. If true, subscribes eCall Info data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; + * A boolean value. If true, subscribes External Temperature data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; /** - * A boolean value. If true, subscribes to the electronic parking brake status. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; + * A boolean value. If true, subscribes PRNDL data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl; /** - * A boolean value. If true, subscribes Emergency Event data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; + * A boolean value. If true, subscribes Tire Pressure status data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; /** - * A boolean value. If true, subscribes to Engine Oil Life data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; + * A boolean value. If true, subscribes Odometer data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; /** - * A boolean value. If true, subscribes Engine Torque data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; + * A boolean value. If true, subscribes Belt Status data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; /** - * A boolean value. If true, subscribes External Temperature data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; + * A boolean value. If true, subscribes Body Information data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; /** - * A boolean value. If true, subscribes Fuel Level data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; + * A boolean value. If true, subscribes Device Status data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; /** - * A boolean value. If true, subscribes Fuel Level State data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; + * A boolean value. If true, subscribes Driver Braking data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; /** - * A boolean value. If true, subscribes Fuel Range data. - * - * Optional. + * A boolean value. If true, subscribes Window Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *windowStatus; /** - * A boolean value. If true, subscribes GPS data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; + * A boolean value. If true, subscribes Wiper Status data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; /** * A boolean value. If true, subscribes Head Lamp Status data. - * - * Optional. -*/ + */ @property (strong, nonatomic, nullable) NSNumber<SDLBool> *headLampStatus; /** - * A boolean value. If true, subscribes Instant Fuel Consumption data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; + * A boolean value. If true, subscribes to Engine Oil Life data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; /** - * A boolean value. If true, subscribes myKey data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; + * A boolean value. If true, subscribes Engine Torque data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; /** - * A boolean value. If true, subscribes Odometer data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; + * A boolean value. If true, subscribes Acc Pedal Position data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; /** - * A boolean value. If true, subscribes PRNDL data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl; + * A boolean value. If true, subscribes Steering Wheel Angle data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; /** - * A boolean value. If true, subscribes RPM data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; + * A boolean value. If true, subscribes eCall Info data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; /** - * A boolean value. If true, subscribes Speed data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; + * A boolean value. If true, subscribes Airbag Status data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; /** - * A boolean value. If true, subscribes Steering Wheel Angle data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; + * A boolean value. If true, subscribes Emergency Event data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; /** - * A boolean value. If true, subscribes Tire Pressure status data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; + * A boolean value. If true, subscribes Cluster Mode Status data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; /** - * A boolean value. If true, subscribes to the turn signal status. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; + * A boolean value. If true, subscribes myKey data. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *windowStatus; + * A boolean value. If true, subscribes to the electronic parking brake status. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; /** - * A boolean value. If true, subscribes Wiper Status data. - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; + * A boolean value. If true, subscribes to the turn signal status. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; + +/** + * A boolean value. If true, subscribes to the cloud app vehicle ID. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; /** Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. @@ -414,6 +328,8 @@ NS_ASSUME_NONNULL_BEGIN */ - (nullable NSNumber<SDLBool> *)getOEMCustomVehicleData:(NSString *)vehicleDataName; + + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSubscribeVehicleData.m b/SmartDeviceLink/SDLSubscribeVehicleData.m index 2c7570b1e..2b81f85b4 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleData.m +++ b/SmartDeviceLink/SDLSubscribeVehicleData.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. - */ +// SDLSubscribeVehicleData.m +// + + +#import "SDLSubscribeVehicleData.h" #import "NSMutableDictionary+Store.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" -#import "SDLSubscribeVehicleData.h" +#import "SDLRPCFunctionNames.h" NS_ASSUME_NONNULL_BEGIN @@ -105,8 +78,7 @@ NS_ASSUME_NONNULL_BEGIN } - (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 { @@ -114,8 +86,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 { @@ -123,8 +94,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 { @@ -132,8 +102,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 { @@ -141,8 +110,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 { @@ -150,8 +118,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 { @@ -159,8 +126,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 { @@ -168,8 +134,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)setPrndl:(nullable NSNumber<SDLBool> *)prndl { @@ -177,8 +142,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 { @@ -186,8 +150,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 { @@ -195,8 +158,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 { @@ -204,8 +166,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 { @@ -213,8 +174,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 { @@ -222,8 +182,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 { @@ -231,8 +190,16 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)driverBraking { + return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:NSNumber.class error:nil]; +} + +- (void)setWindowStatus:(nullable NSNumber<SDLBool> *)windowStatus { + [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; +} + +- (nullable NSNumber<SDLBool> *)windowStatus { NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameWindowStatus ofClass:NSNumber.class error:&error]; } - (void)setWiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus { @@ -240,8 +207,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 { @@ -249,8 +215,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 { @@ -258,8 +223,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 { @@ -267,8 +231,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 { @@ -276,8 +239,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 { @@ -285,8 +247,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 { @@ -294,8 +255,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 { @@ -303,8 +263,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 { @@ -312,8 +271,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 { @@ -321,8 +279,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 { @@ -330,8 +287,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 { @@ -339,8 +295,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 { @@ -348,8 +303,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 { @@ -357,8 +311,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:nil]; } - (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(BOOL)vehicleDataState { @@ -366,17 +319,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]; -} - -- (void)setWindowStatus:(nullable NSNumber<SDLBool> *)windowStatus { - [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; -} - -- (nullable NSNumber<SDLBool> *)windowStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameWindowStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:vehicleDataName ofClass:NSNumber.class error:nil]; } @end diff --git a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h index cd9765221..c889f16d2 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h +++ b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h @@ -1,44 +1,19 @@ -/* - * 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. - */ +// SDLSubscribeVehicleDataResponse.h +// #import "SDLRPCResponse.h" @class SDLVehicleDataResult; -NS_ASSUME_NONNULL_BEGIN /** - * @since SDL 2.0.0 + Response to SDLSubscribeVehicleData + + Since SmartDeviceLink 2.0 */ + +NS_ASSUME_NONNULL_BEGIN + @interface SDLSubscribeVehicleDataResponse : SDLRPCResponse /** @@ -79,193 +54,198 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithGps:(nullable SDLVehicleDataResult *)gps speed:(nullable SDLVehicleDataResult *)speed rpm:(nullable SDLVehicleDataResult *)rpm fuelLevel:(nullable SDLVehicleDataResult *)fuelLevel fuelLevel_State:(nullable SDLVehicleDataResult *)fuelLevel_State instantFuelConsumption:(nullable SDLVehicleDataResult *)instantFuelConsumption fuelRange:(nullable SDLVehicleDataResult *)fuelRange externalTemperature:(nullable SDLVehicleDataResult *)externalTemperature turnSignal:(nullable SDLVehicleDataResult *)turnSignal prndl:(nullable SDLVehicleDataResult *)prndl tirePressure:(nullable SDLVehicleDataResult *)tirePressure odometer:(nullable SDLVehicleDataResult *)odometer beltStatus:(nullable SDLVehicleDataResult *)beltStatus bodyInformation:(nullable SDLVehicleDataResult *)bodyInformation deviceStatus:(nullable SDLVehicleDataResult *)deviceStatus driverBraking:(nullable SDLVehicleDataResult *)driverBraking wiperStatus:(nullable SDLVehicleDataResult *)wiperStatus headLampStatus:(nullable SDLVehicleDataResult *)headLampStatus engineTorque:(nullable SDLVehicleDataResult *)engineTorque accPedalPosition:(nullable SDLVehicleDataResult *)accPedalPosition steeringWheelAngle:(nullable SDLVehicleDataResult *)steeringWheelAngle engineOilLife:(nullable SDLVehicleDataResult *)engineOilLife electronicParkBrakeStatus:(nullable SDLVehicleDataResult *)electronicParkBrakeStatus cloudAppVehicleID:(nullable SDLVehicleDataResult *)cloudAppVehicleID eCallInfo:(nullable SDLVehicleDataResult *)eCallInfo airbagStatus:(nullable SDLVehicleDataResult *)airbagStatus emergencyEvent:(nullable SDLVehicleDataResult *)emergencyEvent clusterModes:(nullable SDLVehicleDataResult *)clusterModes myKey:(nullable SDLVehicleDataResult *)myKey windowStatus:(nullable SDLVehicleDataResult *)windowStatus; /** - The result of requesting to subscribe to the accelerator pedal position (percentage depressed) + The result of requesting to subscribe to the GPSData. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *accPedalPosition; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *gps; /** - The result of requesting to subscribe to the airbag status + The result of requesting to subscribe to the vehicle speed in kilometers per hour. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *airbagStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *speed; /** - The result of requesting to subscribe to the status of the seat belts. + The result of requesting to subscribe to the number of revolutions per minute of the engine. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *beltStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *rpm; /** - The result of requesting to subscribe to the body information including power modes. + The result of requesting to subscribe to the fuel level in the tank (percentage) Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *bodyInformation; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel; /** - The result of requesting to subscribe to the cloud app vehicle ID + The result of requesting to subscribe to the fuel level state. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *cloudAppVehicleID; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel_State; /** - The result of requesting to subscribe to the cluster modes + The result of requesting to subscribe to the fuel range. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *clusterModes; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelRange; /** - The result of requesting to subscribe to the device status including signal and battery strength. + The result of requesting to subscribe to the instantaneous fuel consumption in microlitres. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *deviceStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *instantFuelConsumption; /** - The result of requesting to subscribe to the status of the brake pedal. + The result of requesting to subscribe to the external temperature in degrees celsius. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *driverBraking; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *externalTemperature; /** - The result of requesting to subscribe to the emergency call info + The result of requesting to subscribe to the PRNDL status. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *eCallInfo; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *prndl; /** - The result of requesting to subscribe to the electronic parking brake status + The result of requesting to subscribe to the tireStatus. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *tirePressure; /** - The result of requesting to subscribe to the emergency event + The result of requesting to subscribe to the odometer in km. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *emergencyEvent; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *odometer; /** - The result of requesting to subscribe to the estimated percentage of remaining oil life of the engine. + The result of requesting to subscribe to the status of the seat belts. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineOilLife; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *beltStatus; /** - The result of requesting to subscribe to the torque value for engine (in Nm) on non-diesel variants. + The result of requesting to subscribe to the body information including power modes. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineTorque; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *bodyInformation; /** - The result of requesting to subscribe to the external temperature in degrees celsius. + The result of requesting to subscribe to the device status including signal and battery strength. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *externalTemperature; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *deviceStatus; /** - The result of requesting to subscribe to the fuel level in the tank (percentage) + The result of requesting to subscribe to the status of the brake pedal. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *driverBraking; /** - The result of requesting to subscribe to the fuel level state. + The result of requesting to subscribe to the status of the window. + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *windowStatus; + +/** + The result of requesting to subscribe to the status of the wipers. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel_State; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *wiperStatus; /** - The result of requesting to subscribe to the fuel range. + The result of requesting to subscribe to the status of the head lamps. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelRange; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *headLampStatus; /** - The result of requesting to subscribe to the GPSData. + The result of requesting to subscribe to the estimated percentage of remaining oil life of the engine. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *gps; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineOilLife; /** - The result of requesting to subscribe to the status of the head lamps. + The result of requesting to subscribe to the torque value for engine (in Nm) on non-diesel variants. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *headLampStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineTorque; /** - The result of requesting to subscribe to the instantaneous fuel consumption in microlitres. + The result of requesting to subscribe to the accelerator pedal position (percentage depressed) Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *instantFuelConsumption; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *accPedalPosition; /** - The result of requesting to subscribe to the myKey status + The result of requesting to subscribe to the current angle of the steering wheel (in deg) Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *myKey; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *steeringWheelAngle; /** - The result of requesting to subscribe to the odometer in km. + The result of requesting to subscribe to the emergency call info Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *odometer; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *eCallInfo; /** - The result of requesting to subscribe to the PRNDL status. + The result of requesting to subscribe to the airbag status Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *prndl; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *airbagStatus; /** - The result of requesting to subscribe to the number of revolutions per minute of the engine. + The result of requesting to subscribe to the emergency event Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *rpm; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *emergencyEvent; /** - The result of requesting to subscribe to the vehicle speed in kilometers per hour. + The result of requesting to subscribe to the cluster modes Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *speed; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *clusterModes; /** - The result of requesting to subscribe to the current angle of the steering wheel (in deg) + The result of requesting to subscribe to the myKey status Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *steeringWheelAngle; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *myKey; /** - The result of requesting to subscribe to the tireStatus. + The result of requesting to subscribe to the electronic parking brake status Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *tirePressure; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; /** The result of requesting to subscribe to the turn signal @@ -275,24 +255,15 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, nullable) SDLVehicleDataResult *turnSignal; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 - */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *windowStatus; - -/** - The result of requesting to subscribe to the status of the wipers. + The result of requesting to subscribe to the cloud app vehicle ID Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *wiperStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *cloudAppVehicleID; /** 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. @param vehicleDataState SDLVehicleDataResult object containing custom data type and result code information. @@ -302,7 +273,7 @@ NS_ASSUME_NONNULL_BEGIN /** Gets 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 SDLVehicleDataResult An object containing custom data type and result code information. diff --git a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m index 2fd142953..3b99eaa46 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m +++ b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.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. - */ +// SDLSubscribeVehicleDataResponse.m +// + + +#import "SDLSubscribeVehicleDataResponse.h" #import "NSMutableDictionary+Store.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" -#import "SDLSubscribeVehicleDataResponse.h" +#import "SDLRPCFunctionNames.h" #import "SDLVehicleDataResult.h" NS_ASSUME_NONNULL_BEGIN @@ -94,8 +67,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)gps { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setSpeed:(nullable SDLVehicleDataResult *)speed { @@ -103,8 +75,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)speed { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setRpm:(nullable SDLVehicleDataResult *)rpm { @@ -112,8 +83,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)rpm { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setFuelLevel:(nullable SDLVehicleDataResult *)fuelLevel { @@ -121,8 +91,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)fuelLevel { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setFuelLevel_State:(nullable SDLVehicleDataResult *)fuelLevel_State { @@ -130,8 +99,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)fuelLevel_State { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevelState ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevelState ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setFuelRange:(nullable SDLVehicleDataResult *)fuelRange { @@ -139,8 +107,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)fuelRange { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelRange ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelRange ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setInstantFuelConsumption:(nullable SDLVehicleDataResult *)instantFuelConsumption { @@ -148,8 +115,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)instantFuelConsumption { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setExternalTemperature:(nullable SDLVehicleDataResult *)externalTemperature { @@ -157,8 +123,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)externalTemperature { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setPrndl:(nullable SDLVehicleDataResult *)prndl { @@ -166,8 +131,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)prndl { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNamePRNDL ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNamePRNDL ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setTirePressure:(nullable SDLVehicleDataResult *)tirePressure { @@ -175,8 +139,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)tirePressure { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setOdometer:(nullable SDLVehicleDataResult *)odometer { @@ -184,8 +147,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)odometer { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setBeltStatus:(nullable SDLVehicleDataResult *)beltStatus { @@ -193,8 +155,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)beltStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setBodyInformation:(nullable SDLVehicleDataResult *)bodyInformation { @@ -202,8 +163,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)bodyInformation { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setDeviceStatus:(nullable SDLVehicleDataResult *)deviceStatus { @@ -211,8 +171,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)deviceStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setDriverBraking:(nullable SDLVehicleDataResult *)driverBraking { @@ -220,8 +179,16 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)driverBraking { + return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:SDLVehicleDataResult.class error:nil]; +} + +- (void)setWindowStatus:(nullable SDLVehicleDataResult *)windowStatus { + [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; +} + +- (nullable SDLVehicleDataResult *)windowStatus { NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameWindowStatus ofClass:SDLVehicleDataResult.class error:&error]; } - (void)setWiperStatus:(nullable SDLVehicleDataResult *)wiperStatus { @@ -229,8 +196,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)wiperStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameWiperStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameWiperStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setHeadLampStatus:(nullable SDLVehicleDataResult *)headLampStatus { @@ -238,8 +204,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)headLampStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setEngineOilLife:(nullable SDLVehicleDataResult *)engineOilLife { @@ -247,8 +212,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)engineOilLife { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setEngineTorque:(nullable SDLVehicleDataResult *)engineTorque { @@ -256,8 +220,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)engineTorque { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setAccPedalPosition:(nullable SDLVehicleDataResult *)accPedalPosition { @@ -265,8 +228,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)accPedalPosition { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setSteeringWheelAngle:(nullable SDLVehicleDataResult *)steeringWheelAngle { @@ -274,8 +236,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)steeringWheelAngle { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setECallInfo:(nullable SDLVehicleDataResult *)eCallInfo { @@ -283,8 +244,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)eCallInfo { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setAirbagStatus:(nullable SDLVehicleDataResult *)airbagStatus { @@ -292,8 +252,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)airbagStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setEmergencyEvent:(nullable SDLVehicleDataResult *)emergencyEvent { @@ -301,8 +260,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)emergencyEvent { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setClusterModes:(nullable SDLVehicleDataResult *)clusterModes { @@ -310,8 +268,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)clusterModes { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModes ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModes ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setMyKey:(nullable SDLVehicleDataResult *)myKey { @@ -319,8 +276,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)myKey { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setElectronicParkBrakeStatus:(nullable SDLVehicleDataResult *)electronicParkBrakeStatus { @@ -328,8 +284,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)electronicParkBrakeStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameElectronicParkBrakeStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameElectronicParkBrakeStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setTurnSignal:(nullable SDLVehicleDataResult *)turnSignal { @@ -337,8 +292,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)turnSignal { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTurnSignal ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTurnSignal ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setCloudAppVehicleID:(nullable SDLVehicleDataResult *)cloudAppVehicleID { @@ -346,8 +300,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(SDLVehicleDataResult *)vehicleDataState { @@ -355,17 +308,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)getOEMCustomVehicleData:(NSString *)vehicleDataName { - NSError *error = nil; - return [self.parameters sdl_objectForName:vehicleDataName ofClass:SDLVehicleDataResult.class error:&error]; -} - -- (void)setWindowStatus:(nullable SDLVehicleDataResult *)windowStatus { - [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; -} - -- (nullable SDLVehicleDataResult *)windowStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameWindowStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:vehicleDataName ofClass:SDLVehicleDataResult.class error:nil]; } @end diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleData.h b/SmartDeviceLink/SDLUnsubscribeVehicleData.h index bb4e9a9cf..267738201 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleData.h +++ b/SmartDeviceLink/SDLUnsubscribeVehicleData.h @@ -1,145 +1,125 @@ -/* - * 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. - */ +// SDLUnsubscribeVehicleData.h +// -#import "SDLRPCRequest.h" -NS_ASSUME_NONNULL_BEGIN +#import "SDLRPCRequest.h" /** - * This function is used to unsubscribe the notifications from the subscribeVehicleData function. + * This function is used to unsubscribe the notifications from the + * subscribeVehicleData function + * <p> + * Function Group: Location, VehicleInfo and DrivingChara + * <p> + * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b> + * </p> * - * @since SDL 2.0.0 + * @since SmartDeviceLink 2.0<br/> + * See SDLSubscribeVehicleData SDLGetVehicleData */ + +NS_ASSUME_NONNULL_BEGIN + @interface SDLUnsubscribeVehicleData : SDLRPCRequest /** * Convenience init for unsubscribing to all possible vehicle data items. * - * @param accelerationPedalPosition Unsubscribe to accelerationPedalPosition - * @param airbagStatus Unsubscribe to airbagStatus - * @param beltStatus Unsubscribe to beltStatus - * @param bodyInformation Unsubscribe to bodyInformation - * @param clusterModeStatus Unsubscribe to clusterModeStatus - * @param deviceStatus Unsubscribe to deviceStatus - * @param driverBraking Unsubscribe to driverBraking - * @param eCallInfo Unsubscribe to eCallInfo - * @param emergencyEvent Unsubscribe to emergencyEvent - * @param engineTorque Unsubscribe to engineTorque - * @param externalTemperature Unsubscribe to externalTemperature - * @param fuelLevel Unsubscribe to fuelLevel - * @param fuelLevelState Unsubscribe to fuelLevelState - * @param gps Unsubscribe to gps - * @param headLampStatus Unsubscribe to headLampStatus - * @param instantFuelConsumption Unsubscribe to instantFuelConsumption - * @param myKey Unsubscribe to myKey - * @param odometer Unsubscribe to odometer - * @param prndl Unsubscribe to prndl - * @param rpm Unsubscribe to rpm - * @param speed Unsubscribe to speed - * @param steeringWheelAngle Unsubscribe to steeringWheelAngle - * @param tirePressure Unsubscribe to tirePressure - * @param wiperStatus Unsubscribe to wiperStatus - * @return A SDLUnsubscribeVehicleData object + * @param accelerationPedalPosition Unsubscribe to accelerationPedalPosition + * @param airbagStatus Unsubscribe to airbagStatus + * @param beltStatus Unsubscribe to beltStatus + * @param bodyInformation Unsubscribe to bodyInformation + * @param clusterModeStatus Unsubscribe to clusterModeStatus + * @param deviceStatus Unsubscribe to deviceStatus + * @param driverBraking Unsubscribe to driverBraking + * @param eCallInfo Unsubscribe to eCallInfo + * @param emergencyEvent Unsubscribe to emergencyEvent + * @param engineTorque Unsubscribe to engineTorque + * @param externalTemperature Unsubscribe to externalTemperature + * @param fuelLevel Unsubscribe to fuelLevel + * @param fuelLevelState Unsubscribe to fuelLevelState + * @param gps Unsubscribe to gps + * @param headLampStatus Unsubscribe to headLampStatus + * @param instantFuelConsumption Unsubscribe to instantFuelConsumption + * @param myKey Unsubscribe to myKey + * @param odometer Unsubscribe to odometer + * @param prndl Unsubscribe to prndl + * @param rpm Unsubscribe to rpm + * @param speed Unsubscribe to speed + * @param steeringWheelAngle Unsubscribe to steeringWheelAngle + * @param tirePressure Unsubscribe to tirePressure + * @param wiperStatus Unsubscribe to wiperStatus + * @return A SDLUnsubscribeVehicleData 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 wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:instead"); /** * Convenience init for unsubscribing to all possible vehicle data items. * - * @param accelerationPedalPosition Unsubscribe to accelerationPedalPosition - * @param airbagStatus Unsubscribe to airbagStatus - * @param beltStatus Unsubscribe to beltStatus - * @param bodyInformation Unsubscribe to bodyInformation - * @param clusterModeStatus Unsubscribe to clusterModeStatus - * @param deviceStatus Unsubscribe to deviceStatus - * @param driverBraking Unsubscribe to driverBraking - * @param eCallInfo Unsubscribe to eCallInfo - * @param electronicParkBrakeStatus Unsubscribe to electronicParkBrakeStatus - * @param emergencyEvent Unsubscribe to emergencyEvent - * @param engineOilLife Unsubscribe to engineOilLife - * @param engineTorque Unsubscribe to engineTorque - * @param externalTemperature Unsubscribe to externalTemperature - * @param fuelLevel Unsubscribe to fuelLevel - * @param fuelLevelState Unsubscribe to fuelLevelState - * @param fuelRange Unsubscribe to fuelRange - * @param gps Unsubscribe to gps - * @param headLampStatus Unsubscribe to headLampStatus - * @param instantFuelConsumption Unsubscribe to instantFuelConsumption - * @param myKey Unsubscribe to myKey - * @param odometer Unsubscribe to odometer - * @param prndl Unsubscribe to prndl - * @param rpm Unsubscribe to rpm - * @param speed Unsubscribe to speed - * @param steeringWheelAngle Unsubscribe to steeringWheelAngle - * @param tirePressure Unsubscribe to tirePressure - * @param turnSignal Unsubscribe to turnSignal - * @param wiperStatus Unsubscribe to wiperStatus - * @return A SDLUnsubscribeVehicleData object + * @param accelerationPedalPosition Unsubscribe to accelerationPedalPosition + * @param airbagStatus Unsubscribe to airbagStatus + * @param beltStatus Unsubscribe to beltStatus + * @param bodyInformation Unsubscribe to bodyInformation + * @param clusterModeStatus Unsubscribe to clusterModeStatus + * @param deviceStatus Unsubscribe to deviceStatus + * @param driverBraking Unsubscribe to driverBraking + * @param eCallInfo Unsubscribe to eCallInfo + * @param electronicParkBrakeStatus Unsubscribe to electronicParkBrakeStatus + * @param emergencyEvent Unsubscribe to emergencyEvent + * @param engineOilLife Unsubscribe to engineOilLife + * @param engineTorque Unsubscribe to engineTorque + * @param externalTemperature Unsubscribe to externalTemperature + * @param fuelLevel Unsubscribe to fuelLevel + * @param fuelLevelState Unsubscribe to fuelLevelState + * @param fuelRange Unsubscribe to fuelRange + * @param gps Unsubscribe to gps + * @param headLampStatus Unsubscribe to headLampStatus + * @param instantFuelConsumption Unsubscribe to instantFuelConsumption + * @param myKey Unsubscribe to myKey + * @param odometer Unsubscribe to odometer + * @param prndl Unsubscribe to prndl + * @param rpm Unsubscribe to rpm + * @param speed Unsubscribe to speed + * @param steeringWheelAngle Unsubscribe to steeringWheelAngle + * @param tirePressure Unsubscribe to tirePressure + * @param turnSignal Unsubscribe to turnSignal + * @param wiperStatus Unsubscribe to wiperStatus + * @return A SDLUnsubscribeVehicleData 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 wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:instead"); /** * Convenience init for unsubscribing to all possible vehicle data items. * - * @param accelerationPedalPosition Unsubscribe to accelerationPedalPosition - * @param airbagStatus Unsubscribe to airbagStatus - * @param beltStatus Unsubscribe to beltStatus - * @param bodyInformation Unsubscribe to bodyInformation - * @param cloudAppVehicleID Unsubscribe to cloudAppVehicleID - * @param clusterModeStatus Unsubscribe to clusterModeStatus - * @param deviceStatus Unsubscribe to deviceStatus - * @param driverBraking Unsubscribe to driverBraking - * @param eCallInfo Unsubscribe to eCallInfo - * @param electronicParkBrakeStatus Unsubscribe to electronicParkBrakeStatus - * @param emergencyEvent Unsubscribe to emergencyEvent - * @param engineOilLife Unsubscribe to engineOilLife - * @param engineTorque Unsubscribe to engineTorque - * @param externalTemperature Unsubscribe to externalTemperature - * @param fuelLevel Unsubscribe to fuelLevel - * @param fuelLevelState Unsubscribe to fuelLevelState - * @param fuelRange Unsubscribe to fuelRange - * @param gps Unsubscribe to gps - * @param headLampStatus Unsubscribe to headLampStatus - * @param instantFuelConsumption Unsubscribe to instantFuelConsumption - * @param myKey Unsubscribe to myKey - * @param odometer Unsubscribe to odometer - * @param prndl Unsubscribe to prndl - * @param rpm Unsubscribe to rpm - * @param speed Unsubscribe to speed - * @param steeringWheelAngle Unsubscribe to steeringWheelAngle - * @param tirePressure Unsubscribe to tirePressure - * @param turnSignal Unsubscribe to turnSignal - * @param wiperStatus Unsubscribe to wiperStatus - * @return A SDLUnsubscribeVehicleData object + * @param accelerationPedalPosition Unsubscribe to accelerationPedalPosition + * @param airbagStatus Unsubscribe to airbagStatus + * @param beltStatus Unsubscribe to beltStatus + * @param bodyInformation Unsubscribe to bodyInformation + * @param cloudAppVehicleID Unsubscribe to cloudAppVehicleID + * @param clusterModeStatus Unsubscribe to clusterModeStatus + * @param deviceStatus Unsubscribe to deviceStatus + * @param driverBraking Unsubscribe to driverBraking + * @param eCallInfo Unsubscribe to eCallInfo + * @param electronicParkBrakeStatus Unsubscribe to electronicParkBrakeStatus + * @param emergencyEvent Unsubscribe to emergencyEvent + * @param engineOilLife Unsubscribe to engineOilLife + * @param engineTorque Unsubscribe to engineTorque + * @param externalTemperature Unsubscribe to externalTemperature + * @param fuelLevel Unsubscribe to fuelLevel + * @param fuelLevelState Unsubscribe to fuelLevelState + * @param fuelRange Unsubscribe to fuelRange + * @param gps Unsubscribe to gps + * @param headLampStatus Unsubscribe to headLampStatus + * @param instantFuelConsumption Unsubscribe to instantFuelConsumption + * @param myKey Unsubscribe to myKey + * @param odometer Unsubscribe to odometer + * @param prndl Unsubscribe to prndl + * @param rpm Unsubscribe to rpm + * @param speed Unsubscribe to speed + * @param steeringWheelAngle Unsubscribe to steeringWheelAngle + * @param tirePressure Unsubscribe to tirePressure + * @param turnSignal Unsubscribe to turnSignal + * @param wiperStatus Unsubscribe to wiperStatus + * @return A SDLUnsubscribeVehicleData 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 wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:instead"); @@ -181,216 +161,154 @@ NS_ASSUME_NONNULL_BEGIN - (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 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 windowStatus:(nullable NSNumber<SDLBool> *)windowStatus; /** - * If true, unsubscribes from Acc Pedal Position - * - * Optional. -*/ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; - -/** - * If true, unsubscribes from Airbag Status - * - * Optional. + * If true, unsubscribes from GPS */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; /** - * If true, unsubscribes from Belt Status - * - * Optional. + * If true, unsubscribes from Speed */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; /** - * If true, unsubscribes from Body Information - * - * Optional. + * If true, unsubscribes from RPM */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; /** - A boolean value. If true, unsubscribes to the Cloud App Vehicle ID - - Optional. + * If true, unsubscribes from Fuel Level */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; /** - * If true, unsubscribes from Cluster Mode Status - * - * Optional. + * If true, unsubscribes from Fuel Level State */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; /** - * If true, unsubscribes from Device Status - * - * Optional. + * If true, unsubscribes from Fuel Range */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; /** - * If true, unsubscribes from Driver Braking - * - * Optional. + * If true, unsubscribes from Instant Fuel Consumption */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; /** - * If true, unsubscribes from eCallInfo - * - * Optional. + * If true, unsubscribes from External Temperature */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; /** - A boolean value. If true, unsubscribes to the Electronic Parking Brake Status - - Optional. + * If true, unsubscribes from PRNDL */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl; /** - * If true, unsubscribes from Emergency Event - * - * Optional. + * If true, unsubscribes from Tire Pressure */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; /** - * If true, unsubscribes from Engine Oil Life - * - * Optional. + * If true, unsubscribes from Odometer */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; /** - * If true, unsubscribes from Engine Torque - * - * Optional. + * If true, unsubscribes from Belt Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; /** - * If true, unsubscribes from External Temperature - * - * Optional. + * If true, unsubscribes from Body Information */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; /** - * If true, unsubscribes from Fuel Level - * - * Optional. + * If true, unsubscribes from Device Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; /** - * If true, unsubscribes from Fuel Level State - * - * Optional. + * If true, unsubscribes from Driver Braking */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; /** - * If true, unsubscribes from Fuel Range - * - * Optional. + * If true, unsubscribes from Window Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *windowStatus; /** - * If true, unsubscribes from GPS - * - * Optional. + * If true, unsubscribes from Wiper Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; /** * If true, unsubscribes from Head Lamp Status - * - * Optional. */ @property (strong, nonatomic, nullable) NSNumber<SDLBool> *headLampStatus; /** - * If true, unsubscribes from Instant Fuel Consumption - * - * Optional. + * If true, unsubscribes from Engine Oil Life */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; /** - * If true, unsubscribes from My Key - * - * Optional. + * If true, unsubscribes from Engine Torque */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; /** - * If true, unsubscribes from Odometer - * - * Optional. + * If true, unsubscribes from Acc Pedal Position */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; /** - * If true, unsubscribes from PRNDL - * - * Optional. + * If true, unsubscribes from Steering Wheel Angle data */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; /** - * If true, unsubscribes from RPM - * - * Optional. + * If true, unsubscribes from eCallInfo */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; /** - * If true, unsubscribes from Speed - * - * Optional. + * If true, unsubscribes from Airbag Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; /** - * If true, unsubscribes from Steering Wheel Angle data - * - * Optional. + * If true, unsubscribes from Emergency Event */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; /** - * If true, unsubscribes from Tire Pressure - * - * Optional. + * If true, unsubscribes from Cluster Mode Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; /** - A boolean value. If true, unsubscribes to the Turn Signal + * If true, unsubscribes from My Key + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; - Optional. +/** + A boolean value. If true, unsubscribes to the Electronic Parking Brake Status */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 + A boolean value. If true, unsubscribes to the Turn Signal */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *windowStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; /** - * If true, unsubscribes from Wiper Status - * - * Optional. + A boolean value. If true, unsubscribes to the Cloud App Vehicle ID */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; /** Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleData.m b/SmartDeviceLink/SDLUnsubscribeVehicleData.m index 6baca3a93..1f5ce9f92 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleData.m +++ b/SmartDeviceLink/SDLUnsubscribeVehicleData.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. - */ +// SDLUnsubscribeVehicleData.m +// + + +#import "SDLUnsubscribeVehicleData.h" #import "NSMutableDictionary+Store.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" -#import "SDLUnsubscribeVehicleData.h" +#import "SDLRPCFunctionNames.h" NS_ASSUME_NONNULL_BEGIN @@ -105,8 +78,7 @@ NS_ASSUME_NONNULL_BEGIN } - (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 { @@ -114,8 +86,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 { @@ -123,8 +94,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 { @@ -132,8 +102,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 { @@ -141,8 +110,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 { @@ -150,8 +118,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 { @@ -159,8 +126,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 { @@ -168,8 +134,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)setPrndl:(nullable NSNumber<SDLBool> *)prndl { @@ -177,8 +142,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 { @@ -186,8 +150,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 { @@ -195,8 +158,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 { @@ -204,8 +166,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 { @@ -213,8 +174,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 { @@ -222,8 +182,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 { @@ -231,8 +190,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 { @@ -240,8 +198,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 { @@ -249,8 +206,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 { @@ -258,8 +214,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 { @@ -267,8 +222,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 { @@ -276,8 +230,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 { @@ -285,8 +238,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 { @@ -294,8 +246,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 { @@ -303,8 +254,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 { @@ -312,8 +262,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 { @@ -321,8 +270,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 { @@ -330,8 +278,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 { @@ -339,8 +286,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 { @@ -348,8 +294,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 { @@ -357,8 +302,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:NSNumber.class error:nil]; } - (void)setWindowStatus:(nullable NSNumber<SDLBool> *)windowStatus { @@ -375,8 +319,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/SDLUnsubscribeVehicleDataResponse.h b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h index 01d06f34d..9f5d7b3a5 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h +++ b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h @@ -1,43 +1,17 @@ -/* - * 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. - */ +// SDLUnsubscribeVehicleDataResponse.h +// #import "SDLRPCResponse.h" @class SDLVehicleDataResult; + NS_ASSUME_NONNULL_BEGIN /** - * @since SDL 2.0.0 + Response to UnsubscribeVehicleData + + since SmartDeviceLink 2.0 */ @interface SDLUnsubscribeVehicleDataResponse : SDLRPCResponse @@ -79,216 +53,212 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithGps:(nullable SDLVehicleDataResult *)gps speed:(nullable SDLVehicleDataResult *)speed rpm:(nullable SDLVehicleDataResult *)rpm fuelLevel:(nullable SDLVehicleDataResult *)fuelLevel fuelLevel_State:(nullable SDLVehicleDataResult *)fuelLevel_State instantFuelConsumption:(nullable SDLVehicleDataResult *)instantFuelConsumption fuelRange:(nullable SDLVehicleDataResult *)fuelRange externalTemperature:(nullable SDLVehicleDataResult *)externalTemperature turnSignal:(nullable SDLVehicleDataResult *)turnSignal prndl:(nullable SDLVehicleDataResult *)prndl tirePressure:(nullable SDLVehicleDataResult *)tirePressure odometer:(nullable SDLVehicleDataResult *)odometer beltStatus:(nullable SDLVehicleDataResult *)beltStatus bodyInformation:(nullable SDLVehicleDataResult *)bodyInformation deviceStatus:(nullable SDLVehicleDataResult *)deviceStatus driverBraking:(nullable SDLVehicleDataResult *)driverBraking wiperStatus:(nullable SDLVehicleDataResult *)wiperStatus headLampStatus:(nullable SDLVehicleDataResult *)headLampStatus engineTorque:(nullable SDLVehicleDataResult *)engineTorque accPedalPosition:(nullable SDLVehicleDataResult *)accPedalPosition steeringWheelAngle:(nullable SDLVehicleDataResult *)steeringWheelAngle engineOilLife:(nullable SDLVehicleDataResult *)engineOilLife electronicParkBrakeStatus:(nullable SDLVehicleDataResult *)electronicParkBrakeStatus cloudAppVehicleID:(nullable SDLVehicleDataResult *)cloudAppVehicleID eCallInfo:(nullable SDLVehicleDataResult *)eCallInfo airbagStatus:(nullable SDLVehicleDataResult *)airbagStatus emergencyEvent:(nullable SDLVehicleDataResult *)emergencyEvent clusterModes:(nullable SDLVehicleDataResult *)clusterModes myKey:(nullable SDLVehicleDataResult *)myKey windowStatus:(nullable SDLVehicleDataResult *)windowStatus; /** -The result of requesting to unsubscribe to the accelerator pedal position (percentage depressed) + The result of requesting to unsubscribe to the GPSData. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *accPedalPosition; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *gps; /** -The result of requesting to unsubscribe to the airbag status + The result of requesting to unsubscribe to the vehicle speed in kilometers per hour. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *airbagStatus; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *speed; /** -The result of requesting to unsubscribe to the status of the seat belts. + The result of requesting to unsubscribe to the number of revolutions per minute of the engine. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *beltStatus; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *rpm; /** -The result of requesting to unsubscribe to the body information including power modes. + The result of requesting to unsubscribe to the fuel level in the tank (percentage) -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *bodyInformation; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel; /** -The result of requesting to unsubscribe to the cloud app vehicle id + The result of requesting to unsubscribe to the fuel level state. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *cloudAppVehicleID; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel_State; /** -The result of requesting to unsubscribe to the cluster modes + The result of requesting to unsubscribe to the fuel range. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *clusterModes; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelRange; /** -The result of requesting to unsubscribe to the device status including signal and battery strength. + The result of requesting to unsubscribe to the instantaneous fuel consumption in microlitres. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *deviceStatus; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *instantFuelConsumption; /** -The result of requesting to unsubscribe to the status of the brake pedal. + The result of requesting to unsubscribe to the external temperature in degrees celsius. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *driverBraking; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *externalTemperature; /** -The result of requesting to unsubscribe to the emergency call info + The result of requesting to unsubscribe to the PRNDL status. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *eCallInfo; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *prndl; /** -The result of requesting to unsubscribe to the electronic parking brake status + The result of requesting to unsubscribe to the tireStatus. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *tirePressure; /** -The result of requesting to unsubscribe to the emergency event + The result of requesting to unsubscribe to the odometer in km. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *emergencyEvent; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *odometer; /** -The result of requesting to unsubscribe to the estimated percentage of remaining oil life of the engine. + The result of requesting to unsubscribe to the status of the seat belts. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineOilLife; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *beltStatus; /** -The result of requesting to unsubscribe to the torque value for engine (in Nm) on non-diesel variants. + The result of requesting to unsubscribe to the body information including power modes. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineTorque; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *bodyInformation; /** -The result of requesting to unsubscribe to the external temperature in degrees celsius. + The result of requesting to unsubscribe to the device status including signal and battery strength. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *externalTemperature; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *deviceStatus; /** -The result of requesting to unsubscribe to the fuel level in the tank (percentage) + The result of requesting to unsubscribe to the status of the brake pedal. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *driverBraking; /** -The result of requesting to unsubscribe to the fuel level state. - -Optional + The result of requesting to unsubscribe to the status of the window. */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel_State; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *windowStatus; /** -The result of requesting to unsubscribe to the fuel range. + The result of requesting to unsubscribe to the status of the wipers. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelRange; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *wiperStatus; /** -The result of requesting to unsubscribe to the GPSData. + The result of requesting to unsubscribe to the status of the head lamps. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *gps; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *headLampStatus; /** -The result of requesting to unsubscribe to the status of the head lamps. + The result of requesting to unsubscribe to the estimated percentage of remaining oil life of the engine. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *headLampStatus; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineOilLife; /** -The result of requesting to unsubscribe to the instantaneous fuel consumption in microlitres. + The result of requesting to unsubscribe to the torque value for engine (in Nm) on non-diesel variants. -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *instantFuelConsumption; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineTorque; /** -The result of requesting to unsubscribe to the myKey status + The result of requesting to unsubscribe to the accelerator pedal position (percentage depressed) -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *myKey; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *accPedalPosition; /** -The result of requesting to unsubscribe to the odometer in km. + The result of requesting to unsubscribe to the current angle of the steering wheel (in deg) -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *odometer; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *steeringWheelAngle; /** -The result of requesting to unsubscribe to the PRNDL status. + The result of requesting to unsubscribe to the emergency call info -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *prndl; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *eCallInfo; /** -The result of requesting to unsubscribe to the number of revolutions per minute of the engine. + The result of requesting to unsubscribe to the airbag status -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *rpm; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *airbagStatus; /** -The result of requesting to unsubscribe to the vehicle speed in kilometers per hour. + The result of requesting to unsubscribe to the emergency event -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *speed; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *emergencyEvent; /** -The result of requesting to unsubscribe to the current angle of the steering wheel (in deg) + The result of requesting to unsubscribe to the cluster modes -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *steeringWheelAngle; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *clusterModes; /** -The result of requesting to unsubscribe to the tireStatus. + The result of requesting to unsubscribe to the myKey status -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *tirePressure; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *myKey; /** -The result of requesting to unsubscribe to the turn signal + The result of requesting to unsubscribe to the electronic parking brake status -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *turnSignal; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; /** - * See WindowStatus - * - * Optional. - * - * @since SDL 7.0.0 -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *windowStatus; + The result of requesting to unsubscribe to the turn signal + + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *turnSignal; /** -The result of requesting to unsubscribe to the status of the wipers. + The result of requesting to unsubscribe to the cloud app vehicle id -Optional -*/ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *wiperStatus; + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *cloudAppVehicleID; /** Sets the OEM custom vehicle data state for any given OEM custom vehicle data name. diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m index 8a0313910..c35c9b406 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m +++ b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.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. - */ +// SDLUnsubscribeVehicleDataResponse.m +// + + +#import "SDLUnsubscribeVehicleDataResponse.h" #import "NSMutableDictionary+Store.h" -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" -#import "SDLUnsubscribeVehicleDataResponse.h" +#import "SDLRPCFunctionNames.h" #import "SDLVehicleDataResult.h" NS_ASSUME_NONNULL_BEGIN @@ -94,8 +67,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)gps { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setSpeed:(nullable SDLVehicleDataResult *)speed { @@ -103,8 +75,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)speed { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSpeed ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setRpm:(nullable SDLVehicleDataResult *)rpm { @@ -112,8 +83,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)rpm { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameRPM ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setFuelLevel:(nullable SDLVehicleDataResult *)fuelLevel { @@ -121,8 +91,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)fuelLevel { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevel ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setFuelLevel_State:(nullable SDLVehicleDataResult *)fuelLevel_State { @@ -130,8 +99,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)fuelLevel_State { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevelState ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelLevelState ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setFuelRange:(nullable SDLVehicleDataResult *)fuelRange { @@ -139,8 +107,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)fuelRange { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelRange ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameFuelRange ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setInstantFuelConsumption:(nullable SDLVehicleDataResult *)instantFuelConsumption { @@ -148,8 +115,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)instantFuelConsumption { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameInstantFuelConsumption ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setExternalTemperature:(nullable SDLVehicleDataResult *)externalTemperature { @@ -157,8 +123,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)externalTemperature { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setPrndl:(nullable SDLVehicleDataResult *)prndl { @@ -166,8 +131,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)prndl { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNamePRNDL ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNamePRNDL ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setTirePressure:(nullable SDLVehicleDataResult *)tirePressure { @@ -175,8 +139,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)tirePressure { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTirePressure ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setOdometer:(nullable SDLVehicleDataResult *)odometer { @@ -184,8 +147,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)odometer { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameOdometer ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setBeltStatus:(nullable SDLVehicleDataResult *)beltStatus { @@ -193,8 +155,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)beltStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBeltStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setBodyInformation:(nullable SDLVehicleDataResult *)bodyInformation { @@ -202,8 +163,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)bodyInformation { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameBodyInformation ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setDeviceStatus:(nullable SDLVehicleDataResult *)deviceStatus { @@ -211,8 +171,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)deviceStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameDeviceStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setDriverBraking:(nullable SDLVehicleDataResult *)driverBraking { @@ -220,8 +179,16 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)driverBraking { + return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:SDLVehicleDataResult.class error:nil]; +} + +- (void)setWindowStatus:(nullable SDLVehicleDataResult *)windowStatus { + [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; +} + +- (nullable SDLVehicleDataResult *)windowStatus { NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameWindowStatus ofClass:SDLVehicleDataResult.class error:&error]; } - (void)setWiperStatus:(nullable SDLVehicleDataResult *)wiperStatus { @@ -229,8 +196,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)wiperStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameWiperStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameWiperStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setHeadLampStatus:(nullable SDLVehicleDataResult *)headLampStatus { @@ -238,8 +204,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)headLampStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameHeadLampStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setEngineOilLife:(nullable SDLVehicleDataResult *)engineOilLife { @@ -247,8 +212,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)engineOilLife { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineOilLife ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setEngineTorque:(nullable SDLVehicleDataResult *)engineTorque { @@ -256,8 +220,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)engineTorque { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEngineTorque ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setAccPedalPosition:(nullable SDLVehicleDataResult *)accPedalPosition { @@ -265,8 +228,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)accPedalPosition { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAccelerationPedalPosition ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setSteeringWheelAngle:(nullable SDLVehicleDataResult *)steeringWheelAngle { @@ -274,8 +236,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)steeringWheelAngle { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameSteeringWheelAngle ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setECallInfo:(nullable SDLVehicleDataResult *)eCallInfo { @@ -283,8 +244,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)eCallInfo { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameECallInfo ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setAirbagStatus:(nullable SDLVehicleDataResult *)airbagStatus { @@ -292,8 +252,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)airbagStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameAirbagStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setEmergencyEvent:(nullable SDLVehicleDataResult *)emergencyEvent { @@ -301,8 +260,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)emergencyEvent { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameEmergencyEvent ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setClusterModes:(nullable SDLVehicleDataResult *)clusterModes { @@ -310,8 +268,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)clusterModes { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModes ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameClusterModes ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setMyKey:(nullable SDLVehicleDataResult *)myKey { @@ -319,8 +276,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)myKey { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameMyKey ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setElectronicParkBrakeStatus:(nullable SDLVehicleDataResult *)electronicParkBrakeStatus { @@ -328,8 +284,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)electronicParkBrakeStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameElectronicParkBrakeStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameElectronicParkBrakeStatus ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setTurnSignal:(nullable SDLVehicleDataResult *)turnSignal { @@ -337,8 +292,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)turnSignal { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameTurnSignal ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameTurnSignal ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setCloudAppVehicleID:(nullable SDLVehicleDataResult *)cloudAppVehicleID { @@ -346,8 +300,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)cloudAppVehicleID { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameCloudAppVehicleID ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(SDLVehicleDataResult *)vehicleDataState { @@ -355,17 +308,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)getOEMCustomVehicleData:(NSString *)vehicleDataName { - NSError *error = nil; - return [self.parameters sdl_objectForName:vehicleDataName ofClass:SDLVehicleDataResult.class error:&error]; -} - -- (void)setWindowStatus:(nullable SDLVehicleDataResult *)windowStatus { - [self.parameters sdl_setObject:windowStatus forName:SDLRPCParameterNameWindowStatus]; -} - -- (nullable SDLVehicleDataResult *)windowStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameWindowStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:vehicleDataName ofClass:SDLVehicleDataResult.class error:nil]; } @end diff --git a/SmartDeviceLink/SDLVehicleDataType.h b/SmartDeviceLink/SDLVehicleDataType.h index 5ee118bf1..4573c9409 100644 --- a/SmartDeviceLink/SDLVehicleDataType.h +++ b/SmartDeviceLink/SDLVehicleDataType.h @@ -173,6 +173,5 @@ extern SDLVehicleDataType const SDLVehicleDataTypeOEMVehicleDataType; /** * Describes the status of a window of a door/liftgate etc. - * @since SDL 7.0.0 */ extern SDLVehicleDataType const SDLVehicleDataTypeWindowStatus; diff --git a/SmartDeviceLink/SDLVehicleDataType.m b/SmartDeviceLink/SDLVehicleDataType.m index aceeaf102..212e096ba 100644 --- a/SmartDeviceLink/SDLVehicleDataType.m +++ b/SmartDeviceLink/SDLVehicleDataType.m @@ -1,67 +1,39 @@ -/* - * 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. - */ +// SDLVehicleDataType.m +// + #import "SDLVehicleDataType.h" -SDLVehicleDataType const SDLVehicleDataTypeAccelerationPedal = @"VEHICLEDATA_ACCPEDAL"; -SDLVehicleDataType const SDLVehicleDataTypeAirbagStatus = @"VEHICLEDATA_AIRBAGSTATUS"; -SDLVehicleDataType const SDLVehicleDataTypeBatteryVoltage = @"VEHICLEDATA_BATTVOLTAGE"; +SDLVehicleDataType const SDLVehicleDataTypeGPS = @"VEHICLEDATA_GPS"; +SDLVehicleDataType const SDLVehicleDataTypeSpeed = @"VEHICLEDATA_SPEED"; +SDLVehicleDataType const SDLVehicleDataTypeRPM = @"VEHICLEDATA_RPM"; +SDLVehicleDataType const SDLVehicleDataTypeFuelLevel = @"VEHICLEDATA_FUELLEVEL"; +SDLVehicleDataType const SDLVehicleDataTypeFuelLevelState = @"VEHICLEDATA_FUELLEVEL_STATE"; +SDLVehicleDataType const SDLVehicleDataTypeFuelConsumption = @"VEHICLEDATA_FUELCONSUMPTION"; +SDLVehicleDataType const SDLVehicleDataTypeFuelRange = @"VEHICLEDATA_FUELRANGE"; +SDLVehicleDataType const SDLVehicleDataTypeExternalTemperature = @"VEHICLEDATA_EXTERNTEMP"; +SDLVehicleDataType const SDLVehicleDataTypeVIN = @"VEHICLEDATA_VIN"; +SDLVehicleDataType const SDLVehicleDataTypePRNDL = @"VEHICLEDATA_PRNDL"; +SDLVehicleDataType const SDLVehicleDataTypeTirePressure = @"VEHICLEDATA_TIREPRESSURE"; +SDLVehicleDataType const SDLVehicleDataTypeOdometer = @"VEHICLEDATA_ODOMETER"; SDLVehicleDataType const SDLVehicleDataTypeBeltStatus = @"VEHICLEDATA_BELTSTATUS"; SDLVehicleDataType const SDLVehicleDataTypeBodyInfo = @"VEHICLEDATA_BODYINFO"; -SDLVehicleDataType const SDLVehicleDataTypeBraking = @"VEHICLEDATA_BRAKING"; -SDLVehicleDataType const SDLVehicleDataTypeCloudAppVehicleID = @"VEHICLEDATA_CLOUDAPPVEHICLEID"; -SDLVehicleDataType const SDLVehicleDataTypeClusterModeStatus = @"VEHICLEDATA_CLUSTERMODESTATUS"; SDLVehicleDataType const SDLVehicleDataTypeDeviceStatus = @"VEHICLEDATA_DEVICESTATUS"; SDLVehicleDataType const SDLVehicleDataTypeECallInfo = @"VEHICLEDATA_ECALLINFO"; -SDLVehicleDataType const SDLVehicleDataTypeElectronicParkBrakeStatus = @"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS"; +SDLVehicleDataType const SDLVehicleDataTypeAirbagStatus = @"VEHICLEDATA_AIRBAGSTATUS"; SDLVehicleDataType const SDLVehicleDataTypeEmergencyEvent = @"VEHICLEDATA_EMERGENCYEVENT"; +SDLVehicleDataType const SDLVehicleDataTypeClusterModeStatus = @"VEHICLEDATA_CLUSTERMODESTATUS"; +SDLVehicleDataType const SDLVehicleDataTypeMyKey = @"VEHICLEDATA_MYKEY"; +SDLVehicleDataType const SDLVehicleDataTypeBraking = @"VEHICLEDATA_BRAKING"; +SDLVehicleDataType const SDLVehicleDataTypeWiperStatus = @"VEHICLEDATA_WIPERSTATUS"; +SDLVehicleDataType const SDLVehicleDataTypeHeadlampStatus = @"VEHICLEDATA_HEADLAMPSTATUS"; +SDLVehicleDataType const SDLVehicleDataTypeBatteryVoltage = @"VEHICLEDATA_BATTVOLTAGE"; SDLVehicleDataType const SDLVehicleDataTypeEngineOilLife = @"VEHICLEDATA_ENGINEOILLIFE"; SDLVehicleDataType const SDLVehicleDataTypeEngineTorque = @"VEHICLEDATA_ENGINETORQUE"; -SDLVehicleDataType const SDLVehicleDataTypeExternalTemperature = @"VEHICLEDATA_EXTERNTEMP"; -SDLVehicleDataType const SDLVehicleDataTypeFuelConsumption = @"VEHICLEDATA_FUELCONSUMPTION"; -SDLVehicleDataType const SDLVehicleDataTypeFuelLevel = @"VEHICLEDATA_FUELLEVEL"; -SDLVehicleDataType const SDLVehicleDataTypeFuelLevelState = @"VEHICLEDATA_FUELLEVEL_STATE"; -SDLVehicleDataType const SDLVehicleDataTypeFuelRange = @"VEHICLEDATA_FUELRANGE"; -SDLVehicleDataType const SDLVehicleDataTypeGPS = @"VEHICLEDATA_GPS"; -SDLVehicleDataType const SDLVehicleDataTypeHeadlampStatus = @"VEHICLEDATA_HEADLAMPSTATUS"; -SDLVehicleDataType const SDLVehicleDataTypeMyKey = @"VEHICLEDATA_MYKEY"; -SDLVehicleDataType const SDLVehicleDataTypeOEMVehicleDataType = @"VEHICLEDATA_OEM_CUSTOM_DATA"; -SDLVehicleDataType const SDLVehicleDataTypeOdometer = @"VEHICLEDATA_ODOMETER"; -SDLVehicleDataType const SDLVehicleDataTypePRNDL = @"VEHICLEDATA_PRNDL"; -SDLVehicleDataType const SDLVehicleDataTypeRPM = @"VEHICLEDATA_RPM"; -SDLVehicleDataType const SDLVehicleDataTypeSpeed = @"VEHICLEDATA_SPEED"; +SDLVehicleDataType const SDLVehicleDataTypeAccelerationPedal = @"VEHICLEDATA_ACCPEDAL"; SDLVehicleDataType const SDLVehicleDataTypeSteeringWheel = @"VEHICLEDATA_STEERINGWHEEL"; -SDLVehicleDataType const SDLVehicleDataTypeTirePressure = @"VEHICLEDATA_TIREPRESSURE"; +SDLVehicleDataType const SDLVehicleDataTypeElectronicParkBrakeStatus = @"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS"; SDLVehicleDataType const SDLVehicleDataTypeTurnSignal = @"VEHICLEDATA_TURNSIGNAL"; -SDLVehicleDataType const SDLVehicleDataTypeVIN = @"VEHICLEDATA_VIN"; +SDLVehicleDataType const SDLVehicleDataTypeCloudAppVehicleID = @"VEHICLEDATA_CLOUDAPPVEHICLEID"; +SDLVehicleDataType const SDLVehicleDataTypeOEMVehicleDataType = @"VEHICLEDATA_OEM_CUSTOM_DATA"; SDLVehicleDataType const SDLVehicleDataTypeWindowStatus = @"VEHICLEDATA_WINDOWSTATUS"; -SDLVehicleDataType const SDLVehicleDataTypeWiperStatus = @"VEHICLEDATA_WIPERSTATUS"; diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m index 9a09ff2c0..c1766d604 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m @@ -4,8 +4,9 @@ #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> #import "SDLVehicleDataType.h" diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m index 03113fc1c..31f091727 100644 --- a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m @@ -2,14 +2,16 @@ // SDLOnVehicleDataSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLRPCFunctionNames.h" -#import "SDLRPCParameterNames.h" -#import "SDLWindowStatus.h" #import "SmartDeviceLink.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" + QuickSpecBegin(SDLOnVehicleDataSpec) @@ -26,8 +28,9 @@ SDLEmergencyEvent* event = [[SDLEmergencyEvent alloc] init]; SDLClusterModeStatus* clusterMode = [[SDLClusterModeStatus alloc] init]; SDLMyKey* myKey = [[SDLMyKey alloc] init]; SDLFuelRange* fuelRange = [[SDLFuelRange alloc] init]; -NSString* vin = @"6574839201a"; -NSString* cloudAppVehicleID = @"cloud-6f56054e-d633-11ea-999a-14109fcf4b5b"; +NSArray<SDLFuelRange *> *fuelRangeArray = @[fuelRange, fuelRange]; +NSString *const vin = @"6574839201a"; +NSString *const cloudAppVehicleID = @"cloud-6f56054e-d633-11ea-999a-14109fcf4b5b"; const float speed = 123.45; const NSUInteger rpm = 3599; const float fuelLevel = 34.45; @@ -47,108 +50,108 @@ const float engineOilLife = 98.76; SDLElectronicParkBrakeStatus electronicParkBrakeStatus = SDLElectronicParkBrakeStatusTransition; NSArray<SDLWindowStatus *> *windowStatus = @[[[SDLWindowStatus alloc] init], [[SDLWindowStatus alloc] init]]; -describe(@"Getter/Setter Tests", ^ { +describe(@"getter/setter tests", ^ { it(@"should correctly initialize with init", ^ { SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] init]; - testNotification.accPedalPosition = @99.99999999; + testNotification.accPedalPosition = @(accPedalPosition); testNotification.airbagStatus = airbag; testNotification.beltStatus = belt; testNotification.bodyInformation = body; testNotification.cloudAppVehicleID = cloudAppVehicleID; testNotification.clusterModeStatus = clusterMode; testNotification.deviceStatus = device; - testNotification.driverBraking = SDLVehicleDataEventStatusYes; + testNotification.driverBraking = driverBraking; testNotification.eCallInfo = eCall; - testNotification.electronicParkBrakeStatus = SDLElectronicParkBrakeStatusDriveActive; + testNotification.electronicParkBrakeStatus = electronicParkBrakeStatus; testNotification.emergencyEvent = event; - testNotification.engineOilLife = @34.45; - testNotification.engineTorque = @-200.124; - testNotification.externalTemperature = @-10; - testNotification.fuelLevel = @10.3; - testNotification.fuelLevel_State = SDLComponentVolumeStatusAlert; - testNotification.fuelRange = @[fuelRange, fuelRange]; + testNotification.engineOilLife = @(engineOilLife); + testNotification.engineTorque = @(engineTorque); + testNotification.externalTemperature = @(externalTemperature); + testNotification.fuelLevel = @(fuelLevel); + testNotification.fuelLevel_State = fuelLevel_State; + testNotification.fuelRange = fuelRangeArray; testNotification.gps = gps; testNotification.headLampStatus = headLamp; - testNotification.instantFuelConsumption = @4000.63; + testNotification.instantFuelConsumption = @(instantFuelConsumption); testNotification.myKey = myKey; - testNotification.odometer = @100050; - testNotification.prndl = SDLPRNDLDrive; - testNotification.rpm = @4242; - testNotification.speed = @70.1; - testNotification.steeringWheelAngle = @0.000000001; + testNotification.odometer = @(odometer); + testNotification.prndl = prndl; + testNotification.rpm = @(rpm); + testNotification.speed = @(speed); + testNotification.steeringWheelAngle = @(steeringWheelAngle); testNotification.tirePressure = tires; - testNotification.turnSignal = SDLTurnSignalRight; - testNotification.vin = @"222222222722"; - testNotification.wiperStatus = SDLWiperStatusStalled; + testNotification.turnSignal = turnSignal; + testNotification.vin = vin; + testNotification.wiperStatus = wiperStatus; testNotification.windowStatus = windowStatus; - expect(testNotification.accPedalPosition).to(equal(@99.99999999)); + expect(testNotification.accPedalPosition).to(equal(@(accPedalPosition))); expect(testNotification.airbagStatus).to(equal(airbag)); expect(testNotification.beltStatus).to(equal(belt)); expect(testNotification.bodyInformation).to(equal(body)); expect(testNotification.cloudAppVehicleID).to(equal(cloudAppVehicleID)); expect(testNotification.clusterModeStatus).to(equal(clusterMode)); expect(testNotification.deviceStatus).to(equal(device)); - expect(testNotification.driverBraking).to(equal(SDLVehicleDataEventStatusYes)); + expect(testNotification.driverBraking).to(equal(driverBraking)); expect(testNotification.eCallInfo).to(equal(eCall)); - expect(testNotification.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); + expect(testNotification.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); expect(testNotification.emergencyEvent).to(equal(event)); - expect(testNotification.engineOilLife).to(equal(@34.45)); - expect(testNotification.engineTorque).to(equal(@-200.124)); - expect(testNotification.externalTemperature).to(equal(@-10)); - expect(testNotification.fuelLevel).to(equal(@10.3)); - expect(testNotification.fuelLevel_State).to(equal(SDLComponentVolumeStatusAlert)); - expect(testNotification.fuelRange).to(equal(@[fuelRange, fuelRange])); + expect(testNotification.engineOilLife).to(equal(@(engineOilLife))); + expect(testNotification.engineTorque).to(equal(@(engineTorque))); + expect(testNotification.externalTemperature).to(equal(@(externalTemperature))); + expect(testNotification.fuelLevel).to(equal(@(fuelLevel))); + expect(testNotification.fuelLevel_State).to(equal(fuelLevel_State)); + expect(testNotification.fuelRange).to(equal(fuelRangeArray)); expect(testNotification.gps).to(equal(gps)); expect(testNotification.headLampStatus).to(equal(headLamp)); - expect(testNotification.instantFuelConsumption).to(equal(@4000.63)); + expect(testNotification.instantFuelConsumption).to(equal(@(instantFuelConsumption))); expect(testNotification.myKey).to(equal(myKey)); - expect(testNotification.odometer).to(equal(@100050)); - expect(testNotification.prndl).to(equal(SDLPRNDLDrive)); - expect(testNotification.rpm).to(equal(@4242)); - expect(testNotification.speed).to(equal(@70.1)); - expect(testNotification.steeringWheelAngle).to(equal(@0.000000001)); + expect(testNotification.odometer).to(equal(@(odometer))); + expect(testNotification.prndl).to(equal(prndl)); + expect(testNotification.rpm).to(equal(@(rpm))); + expect(testNotification.speed).to(equal(@(speed))); + expect(testNotification.steeringWheelAngle).to(equal(@(steeringWheelAngle))); expect(testNotification.tirePressure).to(equal(tires)); - expect(testNotification.turnSignal).to(equal(SDLTurnSignalRight)); - expect(testNotification.vin).to(equal(@"222222222722")); - expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled)); + expect(testNotification.turnSignal).to(equal(turnSignal)); + expect(testNotification.vin).to(equal(vin)); + expect(testNotification.wiperStatus).to(equal(wiperStatus)); expect(testNotification.windowStatus).to(equal(windowStatus)); }); - it(@"Should get correctly when initialized", ^ { + it(@"should get correctly when initialized", ^ { NSDictionary* dict = @{SDLRPCParameterNameNotification: @{SDLRPCParameterNameParameters: - @{SDLRPCParameterNameAccelerationPedalPosition:@99.99999999, + @{SDLRPCParameterNameAccelerationPedalPosition:@(accPedalPosition), SDLRPCParameterNameAirbagStatus:airbag, SDLRPCParameterNameBeltStatus:belt, SDLRPCParameterNameBodyInformation:body, SDLRPCParameterNameCloudAppVehicleID:cloudAppVehicleID, SDLRPCParameterNameClusterModeStatus:clusterMode, SDLRPCParameterNameDeviceStatus:device, - SDLRPCParameterNameDriverBraking:SDLVehicleDataEventStatusYes, + SDLRPCParameterNameDriverBraking:driverBraking, SDLRPCParameterNameECallInfo:eCall, - SDLRPCParameterNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, + SDLRPCParameterNameElectronicParkBrakeStatus:electronicParkBrakeStatus, SDLRPCParameterNameEmergencyEvent:event, - SDLRPCParameterNameEngineOilLife:@45.1, - SDLRPCParameterNameEngineTorque:@-200.124, - SDLRPCParameterNameExternalTemperature:@-10, - SDLRPCParameterNameFuelLevel:@10.3, - SDLRPCParameterNameFuelLevelState:SDLComponentVolumeStatusAlert, - SDLRPCParameterNameFuelRange:@[fuelRange], + SDLRPCParameterNameEngineOilLife:@(engineOilLife), + SDLRPCParameterNameEngineTorque:@(engineTorque), + SDLRPCParameterNameExternalTemperature:@(externalTemperature), + SDLRPCParameterNameFuelLevel:@(fuelLevel), + SDLRPCParameterNameFuelLevelState:fuelLevel_State, + SDLRPCParameterNameFuelRange:fuelRangeArray, SDLRPCParameterNameGPS:gps, SDLRPCParameterNameHeadLampStatus:headLamp, - SDLRPCParameterNameInstantFuelConsumption:@4000.63, + SDLRPCParameterNameInstantFuelConsumption:@(instantFuelConsumption), SDLRPCParameterNameMyKey:myKey, - SDLRPCParameterNameOdometer:@100050, - SDLRPCParameterNamePRNDL:SDLPRNDLDrive, - SDLRPCParameterNameRPM:@4242, - SDLRPCParameterNameSpeed:@70.1, - SDLRPCParameterNameSteeringWheelAngle:@0.000000001, + SDLRPCParameterNameOdometer:@(odometer), + SDLRPCParameterNamePRNDL:prndl, + SDLRPCParameterNameRPM:@(rpm), + SDLRPCParameterNameSpeed:@(speed), + SDLRPCParameterNameSteeringWheelAngle:@(steeringWheelAngle), SDLRPCParameterNameTirePressure:tires, - SDLRPCParameterNameTurnSignal:SDLTurnSignalOff, - SDLRPCParameterNameVIN:@"222222222722", - SDLRPCParameterNameWiperStatus:SDLWiperStatusStalled, + SDLRPCParameterNameTurnSignal:turnSignal, + SDLRPCParameterNameVIN:vin, + SDLRPCParameterNameWiperStatus:wiperStatus, SDLRPCParameterNameWindowStatus:windowStatus }, SDLRPCParameterNameOperationName:SDLRPCFunctionNameOnVehicleData}}; @@ -157,40 +160,40 @@ describe(@"Getter/Setter Tests", ^ { SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] initWithDictionary:dict]; #pragma clang diagnostic pop - expect(testNotification.accPedalPosition).to(equal(@99.99999999)); + expect(testNotification.accPedalPosition).to(equal(@(accPedalPosition))); expect(testNotification.airbagStatus).to(equal(airbag)); expect(testNotification.beltStatus).to(equal(belt)); expect(testNotification.bodyInformation).to(equal(body)); expect(testNotification.cloudAppVehicleID).to(equal(cloudAppVehicleID)); expect(testNotification.clusterModeStatus).to(equal(clusterMode)); expect(testNotification.deviceStatus).to(equal(device)); - expect(testNotification.driverBraking).to(equal(SDLVehicleDataEventStatusYes)); + expect(testNotification.driverBraking).to(equal(driverBraking)); expect(testNotification.eCallInfo).to(equal(eCall)); - expect(testNotification.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); + expect(testNotification.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); expect(testNotification.emergencyEvent).to(equal(event)); - expect(testNotification.engineOilLife).to(equal(@45.1)); - expect(testNotification.engineTorque).to(equal(@-200.124)); - expect(testNotification.externalTemperature).to(equal(@-10)); - expect(testNotification.fuelLevel).to(equal(@10.3)); - expect(testNotification.fuelLevel_State).to(equal(SDLComponentVolumeStatusAlert)); - expect(testNotification.fuelRange).to(equal(@[fuelRange])); + expect(testNotification.engineOilLife).to(equal(@(engineOilLife))); + expect(testNotification.engineTorque).to(equal(@(engineTorque))); + expect(testNotification.externalTemperature).to(equal(@(externalTemperature))); + expect(testNotification.fuelLevel).to(equal(@(fuelLevel))); + expect(testNotification.fuelLevel_State).to(equal(fuelLevel_State)); + expect(testNotification.fuelRange).to(equal(fuelRangeArray)); expect(testNotification.gps).to(equal(gps)); expect(testNotification.headLampStatus).to(equal(headLamp)); - expect(testNotification.instantFuelConsumption).to(equal(@4000.63)); + expect(testNotification.instantFuelConsumption).to(equal(@(instantFuelConsumption))); expect(testNotification.myKey).to(equal(myKey)); - expect(testNotification.odometer).to(equal(@100050)); - expect(testNotification.prndl).to(equal(SDLPRNDLDrive)); - expect(testNotification.rpm).to(equal(@4242)); - expect(testNotification.speed).to(equal(@70.1)); - expect(testNotification.steeringWheelAngle).to(equal(@0.000000001)); + expect(testNotification.odometer).to(equal(@(odometer))); + expect(testNotification.prndl).to(equal(prndl)); + expect(testNotification.rpm).to(equal(@(rpm))); + expect(testNotification.speed).to(equal(@(speed))); + expect(testNotification.steeringWheelAngle).to(equal(@(steeringWheelAngle))); expect(testNotification.tirePressure).to(equal(tires)); - expect(testNotification.turnSignal).to(equal(SDLTurnSignalOff)); - expect(testNotification.vin).to(equal(@"222222222722")); - expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled)); + expect(testNotification.turnSignal).to(equal(turnSignal)); + expect(testNotification.vin).to(equal(vin)); + expect(testNotification.wiperStatus).to(equal(wiperStatus)); expect(testNotification.windowStatus).to(equal(windowStatus)); }); - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] init]; expect(testNotification.accPedalPosition).to(beNil()); @@ -227,9 +230,9 @@ describe(@"Getter/Setter Tests", ^ { }); context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:", ^{ - SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] initWithGps:gps speed:speed rpm:@(rpm) fuelLevel:fuelLevel fuelLevel_State:fuelLevel_State instantFuelConsumption:instantFuelConsumption fuelRange:@[fuelRange, fuelRange] externalTemperature:externalTemperature turnSignal:turnSignal vin:vin prndl:prndl tirePressure:tirePressure odometer:@(odometer) beltStatus:belt bodyInformation:body deviceStatus:device driverBraking:driverBraking wiperStatus:wiperStatus headLampStatus:headLamp engineTorque:engineTorque accPedalPosition:accPedalPosition steeringWheelAngle:steeringWheelAngle engineOilLife:engineOilLife electronicParkBrakeStatus:electronicParkBrakeStatus cloudAppVehicleID:cloudAppVehicleID eCallInfo:eCall airbagStatus:airbag emergencyEvent:event clusterModeStatus:clusterMode myKey:myKey windowStatus:windowStatus]; + SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] initWithGps:gps speed:speed rpm:@(rpm) fuelLevel:fuelLevel fuelLevel_State:fuelLevel_State instantFuelConsumption:instantFuelConsumption fuelRange:fuelRangeArray externalTemperature:externalTemperature turnSignal:turnSignal vin:vin prndl:prndl tirePressure:tirePressure odometer:@(odometer) beltStatus:belt bodyInformation:body deviceStatus:device driverBraking:driverBraking wiperStatus:wiperStatus headLampStatus:headLamp engineTorque:engineTorque accPedalPosition:accPedalPosition steeringWheelAngle:steeringWheelAngle engineOilLife:engineOilLife electronicParkBrakeStatus:electronicParkBrakeStatus cloudAppVehicleID:cloudAppVehicleID eCallInfo:eCall airbagStatus:airbag emergencyEvent:event clusterModeStatus:clusterMode myKey:myKey windowStatus:windowStatus]; - it(@"Expect all properties to be set properly", ^{ + it(@"expect all properties to be set properly", ^{ expect(testNotification.accPedalPosition).to(equal(accPedalPosition)); expect(testNotification.airbagStatus).to(equal(airbag)); expect(testNotification.beltStatus).to(equal(belt)); @@ -246,7 +249,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.externalTemperature).to(equal(@(externalTemperature))); expect(testNotification.fuelLevel).to(equal(@(fuelLevel))); expect(testNotification.fuelLevel_State).to(equal(fuelLevel_State)); - expect(testNotification.fuelRange).to(equal(@[fuelRange, fuelRange])); + expect(testNotification.fuelRange).to(equal(fuelRangeArray)); expect(testNotification.gps).to(equal(gps)); expect(testNotification.headLampStatus).to(equal(headLamp)); expect(testNotification.instantFuelConsumption).to(equal(@(instantFuelConsumption))); @@ -264,7 +267,7 @@ describe(@"Getter/Setter Tests", ^ { }); }); - it(@"Should set and get OEM Custom Vehicle Data", ^{ + it(@"should set and get OEM Custom Vehicle Data", ^{ SDLOnVehicleData *testRequest = [[SDLOnVehicleData alloc] init]; [testRequest setOEMCustomVehicleData:@"customVehicleData" withVehicleDataState:@"oemVehicleData"]; diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m index 02a8034f6..9e5710750 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m @@ -2,84 +2,86 @@ // 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", ^ { + it(@"should set and get correctly", ^ { 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; testRequest.prndl = @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; + testRequest.wiperStatus = @YES; testRequest.windowStatus = @YES; expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@NO)); + 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(@NO)); - expect(testRequest.deviceStatus).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(@NO)); + expect(testRequest.engineTorque).to(equal(@YES)); expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).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(@NO)); + expect(testRequest.gps).to(equal(@YES)); expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@NO)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); expect(testRequest.myKey).to(equal(@YES)); expect(testRequest.odometer).to(equal(@YES)); expect(testRequest.prndl).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.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(@NO)); + expect(testRequest.wiperStatus).to(equal(@YES)); expect(testRequest.windowStatus).to(equal(@YES)); }); - it(@"Should get correctly when initialized", ^ { + it(@"should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameRequest: @{SDLRPCParameterNameParameters: @{SDLRPCParameterNameAccelerationPedalPosition:@YES, @@ -92,10 +94,10 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNameDriverBraking:@YES, SDLRPCParameterNameECallInfo:@YES, SDLRPCParameterNameElectronicParkBrakeStatus:@YES, - SDLRPCParameterNameEmergencyEvent:@NO, + SDLRPCParameterNameEmergencyEvent:@YES, SDLRPCParameterNameEngineOilLife:@YES, SDLRPCParameterNameEngineTorque:@YES, - SDLRPCParameterNameExternalTemperature:@NO, + SDLRPCParameterNameExternalTemperature:@YES, SDLRPCParameterNameFuelLevel:@YES, SDLRPCParameterNameFuelLevelState:@YES, SDLRPCParameterNameFuelRange:@YES, @@ -107,9 +109,9 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNamePRNDL:@YES, SDLRPCParameterNameRPM:@YES, SDLRPCParameterNameSpeed:@YES, - SDLRPCParameterNameSteeringWheelAngle:@NO, + SDLRPCParameterNameSteeringWheelAngle:@YES, SDLRPCParameterNameTirePressure:@YES, - SDLRPCParameterNameTurnSignal:@NO, + SDLRPCParameterNameTurnSignal:@YES, SDLRPCParameterNameWiperStatus:@YES, SDLRPCParameterNameWindowStatus:@YES }, @@ -129,10 +131,10 @@ describe(@"Getter/Setter Tests", ^ { 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.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@NO)); + 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)); @@ -144,9 +146,9 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.prndl).to(equal(@YES)); expect(testRequest.rpm).to(equal(@YES)); expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@NO)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); expect(testRequest.windowStatus).to(equal(@YES)); }); @@ -341,43 +343,8 @@ describe(@"Test initializers", ^{ }); }); - context(@"Test initializer: initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:", ^{ - SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithGps:@NO speed:@NO rpm:@NO fuelLevel:@NO fuelLevel_State:@NO instantFuelConsumption:@NO fuelRange:@NO externalTemperature:@NO turnSignal:@NO vin:@NO prndl:@NO tirePressure:@NO odometer:@NO beltStatus:@NO bodyInformation:@NO deviceStatus:@NO driverBraking:@NO wiperStatus:@NO headLampStatus:@NO engineTorque:@NO accPedalPosition:@NO steeringWheelAngle:@NO engineOilLife:@NO electronicParkBrakeStatus:@NO cloudAppVehicleID:@NO eCallInfo:@NO airbagStatus:@NO emergencyEvent:@NO clusterModeStatus:@NO myKey:@NO windowStatus:@NO]; - it(@"expect all properties to be set to NO", ^{ - expect(testRequest.accPedalPosition).to(equal(@NO)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@NO)); - expect(testRequest.bodyInformation).to(equal(@NO)); - expect(testRequest.cloudAppVehicleID).to(equal(@NO)); - expect(testRequest.clusterModeStatus).to(equal(@NO)); - expect(testRequest.deviceStatus).to(equal(@NO)); - expect(testRequest.driverBraking).to(equal(@NO)); - expect(testRequest.eCallInfo).to(equal(@NO)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); - expect(testRequest.emergencyEvent).to(equal(@NO)); - expect(testRequest.engineOilLife).to(equal(@NO)); - expect(testRequest.engineTorque).to(equal(@NO)); - expect(testRequest.externalTemperature).to(equal(@NO)); - expect(testRequest.fuelLevel).to(equal(@NO)); - expect(testRequest.fuelLevel_State).to(equal(@NO)); - expect(testRequest.fuelRange).to(equal(@NO)); - expect(testRequest.gps).to(equal(@NO)); - expect(testRequest.headLampStatus).to(equal(@NO)); - expect(testRequest.instantFuelConsumption).to(equal(@NO)); - expect(testRequest.myKey).to(equal(@NO)); - expect(testRequest.odometer).to(equal(@NO)); - expect(testRequest.prndl).to(equal(@NO)); - expect(testRequest.rpm).to(equal(@NO)); - expect(testRequest.speed).to(equal(@NO)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); - expect(testRequest.tirePressure).to(equal(@NO)); - expect(testRequest.turnSignal).to(equal(@NO)); - expect(testRequest.wiperStatus).to(equal(@NO)); - expect(testRequest.windowStatus).to(equal(@NO)); - }); - }); - context(@"Should set and get OEM Custom Vehicle Data", ^{ + context(@"should set and get OEM Custom Vehicle Data", ^{ SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] init]; [testRequest setOEMCustomVehicleData:@"OEMCustomVehicleData" withVehicleDataState:NO]; [testRequest setOEMCustomVehicleData:@"OEMCustomVehicleData1" withVehicleDataState:YES]; diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m index dc1deaa3c..5bbae0c5d 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m @@ -2,84 +2,86 @@ // SDLSubscribeVehicleDataSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLRPCFunctionNames.h" -#import "SDLRPCParameterNames.h" #import "SDLSubscribeVehicleData.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" QuickSpecBegin(SDLSubscribeVehicleDataSpec) -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^ { + it(@"should set and get correctly", ^ { SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData 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 = @YES; testRequest.headLampStatus = @YES; - testRequest.instantFuelConsumption = @NO; + testRequest.instantFuelConsumption = @YES; testRequest.myKey = @YES; testRequest.odometer = @YES; testRequest.prndl = @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; + testRequest.wiperStatus = @YES; testRequest.windowStatus = @YES; expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@NO)); + 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(@NO)); - expect(testRequest.deviceStatus).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(@NO)); + expect(testRequest.engineTorque).to(equal(@YES)); expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).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(@NO)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); expect(testRequest.myKey).to(equal(@YES)); expect(testRequest.odometer).to(equal(@YES)); expect(testRequest.prndl).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.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(@NO)); + expect(testRequest.wiperStatus).to(equal(@YES)); expect(testRequest.windowStatus).to(equal(@YES)); }); - it(@"Should get correctly when initialized with a dictionary", ^ { + it(@"should get correctly when initialized with a dictionary", ^ { NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameRequest: @{SDLRPCParameterNameParameters: @{SDLRPCParameterNameAccelerationPedalPosition:@YES, @@ -92,10 +94,10 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNameDriverBraking:@YES, SDLRPCParameterNameECallInfo:@YES, SDLRPCParameterNameElectronicParkBrakeStatus: @YES, - SDLRPCParameterNameEmergencyEvent:@NO, + SDLRPCParameterNameEmergencyEvent:@YES, SDLRPCParameterNameEngineOilLife:@YES, SDLRPCParameterNameEngineTorque:@YES, - SDLRPCParameterNameExternalTemperature:@NO, + SDLRPCParameterNameExternalTemperature:@YES, SDLRPCParameterNameFuelLevel:@YES, SDLRPCParameterNameFuelLevelState:@YES, SDLRPCParameterNameFuelRange:@YES, @@ -107,10 +109,10 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNamePRNDL:@YES, SDLRPCParameterNameRPM:@YES, SDLRPCParameterNameSpeed:@YES, - SDLRPCParameterNameSteeringWheelAngle:@NO, + SDLRPCParameterNameSteeringWheelAngle:@YES, SDLRPCParameterNameTirePressure:@YES, - SDLRPCParameterNameTurnSignal:@NO, - SDLRPCParameterNameWiperStatus:@NO, + SDLRPCParameterNameTurnSignal:@YES, + SDLRPCParameterNameWiperStatus:@YES, SDLRPCParameterNameWindowStatus:@YES }, SDLRPCParameterNameOperationName:SDLRPCFunctionNameSubscribeVehicleData}}; @@ -129,10 +131,10 @@ describe(@"Getter/Setter Tests", ^ { 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.emergencyEvent).to(equal(@YES)); expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@NO)); + 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)); @@ -144,10 +146,10 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.prndl).to(equal(@YES)); expect(testRequest.rpm).to(equal(@YES)); expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@NO)); - expect(testRequest.wiperStatus).to(equal(@NO)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); expect(testRequest.windowStatus).to(equal(@YES)); }); }); @@ -229,7 +231,7 @@ describe(@"test initializers", ^{ it( @"expect all properties to be set properly 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" - SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData 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:NO gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES wiperStatus:YES]; + SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData 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 wiperStatus:YES]; #pragma clang diagnostic pop expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -247,7 +249,7 @@ describe(@"test initializers", ^{ expect(testRequest.engineTorque).to(equal(@YES)); expect(testRequest.externalTemperature).to(equal(@YES)); expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@NO)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); expect(testRequest.fuelRange).to(beNil()); expect(testRequest.gps).to(equal(@YES)); expect(testRequest.headLampStatus).to(equal(@YES)); @@ -300,43 +302,7 @@ describe(@"test initializers", ^{ }); }); - context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:", ^{ - SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithGps:@NO speed:@NO rpm:@NO fuelLevel:@NO fuelLevel_State:@NO instantFuelConsumption:@NO fuelRange:@NO externalTemperature:@NO turnSignal:@NO prndl:@NO tirePressure:@NO odometer:@NO beltStatus:@NO bodyInformation:@NO deviceStatus:@NO driverBraking:@NO wiperStatus:@NO headLampStatus:@NO engineTorque:@NO accPedalPosition:@NO steeringWheelAngle:@NO engineOilLife:@NO electronicParkBrakeStatus:@NO cloudAppVehicleID:@NO eCallInfo:@NO airbagStatus:@NO emergencyEvent:@NO clusterModeStatus:@NO myKey:@NO windowStatus:@NO]; - it(@"Expect all properties to be NO", ^{ - expect(testRequest.accPedalPosition).to(equal(@NO)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@NO)); - expect(testRequest.bodyInformation).to(equal(@NO)); - expect(testRequest.cloudAppVehicleID).to(equal(@NO)); - expect(testRequest.clusterModeStatus).to(equal(@NO)); - expect(testRequest.deviceStatus).to(equal(@NO)); - expect(testRequest.driverBraking).to(equal(@NO)); - expect(testRequest.eCallInfo).to(equal(@NO)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); - expect(testRequest.emergencyEvent).to(equal(@NO)); - expect(testRequest.engineOilLife).to(equal(@NO)); - expect(testRequest.engineTorque).to(equal(@NO)); - expect(testRequest.externalTemperature).to(equal(@NO)); - expect(testRequest.fuelLevel).to(equal(@NO)); - expect(testRequest.fuelLevel_State).to(equal(@NO)); - expect(testRequest.fuelRange).to(equal(@NO)); - expect(testRequest.gps).to(equal(@NO)); - expect(testRequest.headLampStatus).to(equal(@NO)); - expect(testRequest.instantFuelConsumption).to(equal(@NO)); - expect(testRequest.myKey).to(equal(@NO)); - expect(testRequest.odometer).to(equal(@NO)); - expect(testRequest.prndl).to(equal(@NO)); - expect(testRequest.rpm).to(equal(@NO)); - expect(testRequest.speed).to(equal(@NO)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); - expect(testRequest.tirePressure).to(equal(@NO)); - expect(testRequest.turnSignal).to(equal(@NO)); - expect(testRequest.wiperStatus).to(equal(@NO)); - expect(testRequest.windowStatus).to(equal(@NO)); - }); - }); - - context(@"Should set and get OEM Custom Vehicle Data", ^{ + context(@"should set and get OEM Custom Vehicle Data", ^{ SDLSubscribeVehicleData *testRequest = [[SDLSubscribeVehicleData alloc] init]; [testRequest setOEMCustomVehicleData:@"customVehicleData" withVehicleDataState:NO]; [testRequest setOEMCustomVehicleData:@"customVehicleData1" withVehicleDataState:YES]; diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m index ca82252e4..15d896e70 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m @@ -2,18 +2,20 @@ // SDLUnsubscribeVehicleDataSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLRPCFunctionNames.h" -#import "SDLRPCParameterNames.h" #import "SDLUnsubscribeVehicleData.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" QuickSpecBegin(SDLUnsubscribeVehicleDataSpec) -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^ { + it(@"should set and get correctly", ^ { SDLUnsubscribeVehicleData* testRequest = [[SDLUnsubscribeVehicleData alloc] init]; testRequest.accPedalPosition = @YES; @@ -43,7 +45,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @YES; testRequest.steeringWheelAngle = @YES; testRequest.tirePressure = @YES; - testRequest.turnSignal = @NO; + testRequest.turnSignal = @YES; testRequest.wiperStatus = @YES; testRequest.windowStatus = @YES; @@ -74,12 +76,12 @@ describe(@"Getter/Setter Tests", ^ { 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.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); expect(testRequest.windowStatus).to(equal(@YES)); }); - it(@"Should get correctly when initialized with a dictionary", ^ { + it(@"should get correctly when initialized with a dictionary", ^ { NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameRequest: @{SDLRPCParameterNameParameters: @{SDLRPCParameterNameAccelerationPedalPosition:@YES, @@ -229,7 +231,7 @@ describe(@"Test initializers", ^{ 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" - SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData 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:NO instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES wiperStatus:YES]; + SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData 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 wiperStatus:YES]; #pragma clang diagnostic pop it(@"expect all properties to be set to YES", ^{ @@ -250,7 +252,7 @@ describe(@"Test initializers", ^{ expect(testRequest.fuelLevel_State).to(equal(@YES)); expect(testRequest.fuelRange).to(beNil()); expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@NO)); + expect(testRequest.headLampStatus).to(equal(@YES)); expect(testRequest.instantFuelConsumption).to(equal(@YES)); expect(testRequest.myKey).to(equal(@YES)); expect(testRequest.odometer).to(equal(@YES)); @@ -267,7 +269,7 @@ describe(@"Test initializers", ^{ context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:", ^{ SDLUnsubscribeVehicleData* testRequest = [[SDLUnsubscribeVehicleData alloc] initWithGps:@YES speed:@YES rpm:@YES fuelLevel:@YES fuelLevel_State:@YES instantFuelConsumption:@YES fuelRange:@YES externalTemperature:@YES turnSignal:@YES prndl:@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 windowStatus:@YES]; - it(@"Expect all properties to be YES", ^{ + it(@"expect all properties to be YES", ^{ expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); expect(testRequest.beltStatus).to(equal(@YES)); @@ -301,43 +303,8 @@ describe(@"Test initializers", ^{ }); }); - context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:", ^{ - SDLUnsubscribeVehicleData* testRequest = [[SDLUnsubscribeVehicleData alloc] initWithGps:@NO speed:@NO rpm:@NO fuelLevel:@NO fuelLevel_State:@NO instantFuelConsumption:@NO fuelRange:@NO externalTemperature:@NO turnSignal:@NO prndl:@NO tirePressure:@NO odometer:@NO beltStatus:@NO bodyInformation:@NO deviceStatus:@NO driverBraking:@NO wiperStatus:@NO headLampStatus:@NO engineTorque:@NO accPedalPosition:@NO steeringWheelAngle:@NO engineOilLife:@NO electronicParkBrakeStatus:@NO cloudAppVehicleID:@NO eCallInfo:@NO airbagStatus:@NO emergencyEvent:@NO clusterModeStatus:@NO myKey:@NO windowStatus:@NO]; - it(@"Expect all properties to be NO", ^{ - expect(testRequest.accPedalPosition).to(equal(@NO)); - expect(testRequest.airbagStatus).to(equal(@NO)); - expect(testRequest.beltStatus).to(equal(@NO)); - expect(testRequest.bodyInformation).to(equal(@NO)); - expect(testRequest.cloudAppVehicleID).to(equal(@NO)); - expect(testRequest.clusterModeStatus).to(equal(@NO)); - expect(testRequest.deviceStatus).to(equal(@NO)); - expect(testRequest.driverBraking).to(equal(@NO)); - expect(testRequest.eCallInfo).to(equal(@NO)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@NO)); - expect(testRequest.emergencyEvent).to(equal(@NO)); - expect(testRequest.engineOilLife).to(equal(@NO)); - expect(testRequest.engineTorque).to(equal(@NO)); - expect(testRequest.externalTemperature).to(equal(@NO)); - expect(testRequest.fuelLevel).to(equal(@NO)); - expect(testRequest.fuelLevel_State).to(equal(@NO)); - expect(testRequest.fuelRange).to(equal(@NO)); - expect(testRequest.gps).to(equal(@NO)); - expect(testRequest.headLampStatus).to(equal(@NO)); - expect(testRequest.instantFuelConsumption).to(equal(@NO)); - expect(testRequest.myKey).to(equal(@NO)); - expect(testRequest.odometer).to(equal(@NO)); - expect(testRequest.prndl).to(equal(@NO)); - expect(testRequest.rpm).to(equal(@NO)); - expect(testRequest.speed).to(equal(@NO)); - expect(testRequest.steeringWheelAngle).to(equal(@NO)); - expect(testRequest.tirePressure).to(equal(@NO)); - expect(testRequest.turnSignal).to(equal(@NO)); - expect(testRequest.wiperStatus).to(equal(@NO)); - expect(testRequest.windowStatus).to(equal(@NO)); - }); - }); - context(@"Should set and get OEM Custom Vehicle Data", ^{ + context(@"should set and get OEM Custom Vehicle Data", ^{ SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData alloc] init]; [testRequest setOEMCustomVehicleData:@"customVehicleData" withVehicleDataState:NO]; [testRequest setOEMCustomVehicleData:@"customVehicleData1" withVehicleDataState:YES]; diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m index ed710f06e..4086765f2 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m @@ -2,13 +2,16 @@ // SDLGetVehicleDataResponseSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLRPCFunctionNames.h" -#import "SDLRPCParameterNames.h" #import "SmartDeviceLink.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" + QuickSpecBegin(SDLGetVehicleDataResponseSpec) @@ -25,6 +28,7 @@ SDLEmergencyEvent* event = [[SDLEmergencyEvent alloc] init]; SDLClusterModeStatus* clusterMode = [[SDLClusterModeStatus alloc] init]; SDLMyKey* myKey = [[SDLMyKey alloc] init]; SDLFuelRange* fuelRange = [[SDLFuelRange alloc] init]; +NSArray<SDLFuelRange*> *fuelRangeArray = @[fuelRange, fuelRange]; NSString* vin = @"6574839201a"; NSString* cloudAppVehicleID = @"cloud-6f56054e-d633-11ea-999a-14109fcf4b5b"; const float speed = 123.45; @@ -46,146 +50,149 @@ const float engineOilLife = 98.76; SDLElectronicParkBrakeStatus electronicParkBrakeStatus = SDLElectronicParkBrakeStatusTransition; NSArray<SDLWindowStatus *> *windowStatus = @[[[SDLWindowStatus alloc] init], [[SDLWindowStatus alloc] init]]; -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^ { + it(@"should set and get correctly", ^ { SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] init]; - testResponse.accPedalPosition = @0; + testResponse.accPedalPosition = @(accPedalPosition); testResponse.airbagStatus = airbag; testResponse.beltStatus = belt; testResponse.bodyInformation = body; testResponse.cloudAppVehicleID = cloudAppVehicleID; testResponse.clusterModeStatus = clusterMode; testResponse.deviceStatus = device; - testResponse.driverBraking = SDLVehicleDataEventStatusNoEvent; + testResponse.driverBraking = driverBraking; testResponse.eCallInfo = eCall; - testResponse.electronicParkBrakeStatus = SDLElectronicParkBrakeStatusDriveActive; + testResponse.electronicParkBrakeStatus = electronicParkBrakeStatus; 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.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.instantFuelConsumption = @(instantFuelConsumption); testResponse.myKey = myKey; - testResponse.odometer = @70000; - testResponse.prndl = SDLPRNDLPark; - testResponse.rpm = @3; - testResponse.speed = @100; - testResponse.steeringWheelAngle = @-1500; + testResponse.odometer = @(odometer); + testResponse.prndl = prndl; + testResponse.rpm = @(rpm); + testResponse.speed = @(speed); + testResponse.steeringWheelAngle = @(steeringWheelAngle); testResponse.tirePressure = tires; - testResponse.turnSignal = SDLTurnSignalBoth; + testResponse.turnSignal = turnSignal; testResponse.vin = vin; - testResponse.wiperStatus = SDLWiperStatusAutomaticHigh; + testResponse.wiperStatus = wiperStatus; - expect(testResponse.accPedalPosition).to(equal(@0)); + expect(testResponse.accPedalPosition).to(equal(@(accPedalPosition))); 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.driverBraking).to(equal(driverBraking)); expect(testResponse.eCallInfo).to(equal(eCall)); - expect(testResponse.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); + expect(testResponse.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); 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.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(headLamp)); - expect(testResponse.instantFuelConsumption).to(equal(@40.7)); + expect(testResponse.instantFuelConsumption).to(equal(@(instantFuelConsumption))); expect(testResponse.myKey).to(equal(myKey)); - expect(testResponse.odometer).to(equal(@70000)); - expect(testResponse.prndl).to(equal(SDLPRNDLPark)); - expect(testResponse.rpm).to(equal(@3)); - expect(testResponse.speed).to(equal(@100)); - expect(testResponse.steeringWheelAngle).to(equal(@-1500)); + expect(testResponse.odometer).to(equal(@(odometer))); + expect(testResponse.prndl).to(equal(prndl)); + expect(testResponse.rpm).to(equal(@(rpm))); + expect(testResponse.speed).to(equal(@(speed))); + expect(testResponse.steeringWheelAngle).to(equal(@(steeringWheelAngle))); expect(testResponse.tirePressure).to(equal(tires)); - expect(testResponse.turnSignal).to(equal(SDLTurnSignalBoth)); + expect(testResponse.turnSignal).to(equal(turnSignal)); expect(testResponse.vin).to(equal(vin)); - expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); + expect(testResponse.wiperStatus).to(equal(wiperStatus)); }); - it(@"Should get correctly when initialized", ^ { - NSMutableDictionary* dict = [@{SDLRPCParameterNameNotification: + it(@"should get correctly when initialized", ^ { + NSDictionary* dict = @{SDLRPCParameterNameNotification: @{SDLRPCParameterNameParameters: @{ - SDLRPCParameterNameAccelerationPedalPosition:@0, + SDLRPCParameterNameAccelerationPedalPosition:@(accPedalPosition), SDLRPCParameterNameAirbagStatus:airbag, SDLRPCParameterNameBeltStatus:belt, SDLRPCParameterNameBodyInformation:body, SDLRPCParameterNameCloudAppVehicleID:cloudAppVehicleID, SDLRPCParameterNameClusterModeStatus:clusterMode, SDLRPCParameterNameDeviceStatus:device, - SDLRPCParameterNameDriverBraking:SDLVehicleDataEventStatusNoEvent, + SDLRPCParameterNameDriverBraking:driverBraking, SDLRPCParameterNameECallInfo:eCall, - SDLRPCParameterNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, + SDLRPCParameterNameElectronicParkBrakeStatus:electronicParkBrakeStatus, SDLRPCParameterNameEmergencyEvent:event, - SDLRPCParameterNameEngineOilLife:@23.22, - SDLRPCParameterNameEngineTorque:@630.4, - SDLRPCParameterNameExternalTemperature:@0, - SDLRPCParameterNameFuelLevel:@99.9999, - SDLRPCParameterNameFuelLevelState:SDLComponentVolumeStatusFault, - SDLRPCParameterNameFuelRange:@[fuelRange], + SDLRPCParameterNameEngineOilLife:@(engineOilLife), + SDLRPCParameterNameEngineTorque:@(engineTorque), + SDLRPCParameterNameExternalTemperature:@(externalTemperature), + SDLRPCParameterNameFuelLevel:@(fuelLevel), + SDLRPCParameterNameFuelLevelState:fuelLevel_State, + SDLRPCParameterNameFuelRange:fuelRangeArray, SDLRPCParameterNameGPS:gps, SDLRPCParameterNameHeadLampStatus:headLamp, - SDLRPCParameterNameInstantFuelConsumption:@40.7, + SDLRPCParameterNameInstantFuelConsumption:@(instantFuelConsumption), SDLRPCParameterNameMyKey:myKey, - SDLRPCParameterNameOdometer:@70000, - SDLRPCParameterNamePRNDL:SDLPRNDLPark, - SDLRPCParameterNameRPM:@3, - SDLRPCParameterNameSpeed:@100, - SDLRPCParameterNameSteeringWheelAngle:@-1500, + SDLRPCParameterNameOdometer:@(odometer), + SDLRPCParameterNamePRNDL:prndl, + SDLRPCParameterNameRPM:@(rpm), + SDLRPCParameterNameSpeed:@(speed), + SDLRPCParameterNameSteeringWheelAngle:@(steeringWheelAngle), SDLRPCParameterNameTirePressure:tires, - SDLRPCParameterNameTurnSignal:SDLTurnSignalOff, + SDLRPCParameterNameTurnSignal:turnSignal, SDLRPCParameterNameVIN:vin, - SDLRPCParameterNameWiperStatus:SDLWiperStatusAutomaticHigh}, - SDLRPCParameterNameOperationName:SDLRPCFunctionNameGetVehicleData}} mutableCopy]; + SDLRPCParameterNameWiperStatus:wiperStatus, + SDLRPCParameterNameWindowStatus:windowStatus + }, + SDLRPCParameterNameOperationName:SDLRPCFunctionNameGetVehicleData}}; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] initWithDictionary:dict]; #pragma clang diagnostic pop - expect(testResponse.accPedalPosition).to(equal(@0)); + expect(testResponse.accPedalPosition).to(equal(@(accPedalPosition))); 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.driverBraking).to(equal(driverBraking)); expect(testResponse.eCallInfo).to(equal(eCall)); - expect(testResponse.electronicParkBrakeStatus).to(equal(SDLElectronicParkBrakeStatusDriveActive)); + expect(testResponse.electronicParkBrakeStatus).to(equal(electronicParkBrakeStatus)); 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.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(headLamp)); - expect(testResponse.instantFuelConsumption).to(equal(@40.7)); + expect(testResponse.instantFuelConsumption).to(equal(@(instantFuelConsumption))); expect(testResponse.myKey).to(equal(myKey)); - expect(testResponse.odometer).to(equal(@70000)); - expect(testResponse.prndl).to(equal(SDLPRNDLPark)); - expect(testResponse.rpm).to(equal(@3)); - expect(testResponse.speed).to(equal(@100)); - expect(testResponse.steeringWheelAngle).to(equal(@-1500)); + expect(testResponse.odometer).to(equal(@(odometer))); + expect(testResponse.prndl).to(equal(prndl)); + expect(testResponse.rpm).to(equal(@(rpm))); + expect(testResponse.speed).to(equal(@(speed))); + expect(testResponse.steeringWheelAngle).to(equal(@(steeringWheelAngle))); expect(testResponse.tirePressure).to(equal(tires)); - expect(testResponse.turnSignal).to(equal(SDLTurnSignalOff)); + expect(testResponse.turnSignal).to(equal(turnSignal)); expect(testResponse.vin).to(equal(vin)); - expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); + expect(testResponse.wiperStatus).to(equal(wiperStatus)); + expect(testResponse.windowStatus).to(equal(windowStatus)); }); - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { SDLGetVehicleDataResponse* testResponse = [[SDLGetVehicleDataResponse alloc] init]; expect(testResponse.accPedalPosition).to(beNil()); @@ -218,11 +225,11 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.turnSignal).to(beNil()); expect(testResponse.vin).to(beNil()); expect(testResponse.wiperStatus).to(beNil()); + expect(testResponse.windowStatus).to(beNil()); }); context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:vin:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:windowStatus:", ^{ - - SDLGetVehicleDataResponse *testResponse = [[SDLGetVehicleDataResponse alloc] initWithGps:gps speed:speed rpm:@(rpm) fuelLevel:fuelLevel fuelLevel_State:fuelLevel_State instantFuelConsumption:instantFuelConsumption fuelRange:@[fuelRange, fuelRange] externalTemperature:externalTemperature turnSignal:turnSignal vin:vin prndl:prndl tirePressure:tirePressure odometer:@(odometer) beltStatus:belt bodyInformation:body deviceStatus:device driverBraking:driverBraking wiperStatus:wiperStatus headLampStatus:headLamp engineTorque:engineTorque accPedalPosition:accPedalPosition steeringWheelAngle:steeringWheelAngle engineOilLife:engineOilLife electronicParkBrakeStatus:electronicParkBrakeStatus cloudAppVehicleID:cloudAppVehicleID eCallInfo:eCall airbagStatus:airbag emergencyEvent:event clusterModeStatus:clusterMode myKey:myKey windowStatus:windowStatus]; + 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 prndl:prndl tirePressure:tirePressure odometer:@(odometer) beltStatus:belt bodyInformation:body deviceStatus:device driverBraking:driverBraking wiperStatus:wiperStatus headLampStatus:headLamp engineTorque:engineTorque accPedalPosition:accPedalPosition steeringWheelAngle:steeringWheelAngle engineOilLife:engineOilLife electronicParkBrakeStatus:electronicParkBrakeStatus cloudAppVehicleID:cloudAppVehicleID eCallInfo:eCall airbagStatus:airbag emergencyEvent:event clusterModeStatus:clusterMode myKey:myKey windowStatus:windowStatus]; it(@"Expect all properties to be set properly", ^{ expect(testResponse.accPedalPosition).to(equal(accPedalPosition)); @@ -241,7 +248,7 @@ describe(@"Getter/Setter Tests", ^ { 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(@[fuelRange, fuelRange])); + expect(testResponse.fuelRange).to(equal(fuelRangeArray)); expect(testResponse.gps).to(equal(gps)); expect(testResponse.headLampStatus).to(equal(headLamp)); expect(testResponse.instantFuelConsumption).to(equal(@(instantFuelConsumption))); @@ -259,7 +266,7 @@ describe(@"Getter/Setter Tests", ^ { }); }); - it(@"Should set and get OEM Custom Vehicle Data", ^{ + it(@"should set and get OEM Custom Vehicle Data", ^{ SDLGetVehicleDataResponse *testRequest = [[SDLGetVehicleDataResponse alloc] init]; [testRequest setOEMCustomVehicleData:@"customVehicleData" withVehicleDataState:@"oemVehicleData"]; diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m index 87d21f34e..4b8fe3f8e 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m @@ -2,23 +2,26 @@ // SDLSubscribeVehicleDataResponseSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLRPCFunctionNames.h" #import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" #import "SDLSubscribeVehicleDataResponse.h" #import "SDLVehicleDataResult.h" #import "SDLVehicleDataResultCode.h" + QuickSpecBegin(SDLSubscribeVehicleDataResponseSpec) SDLVehicleDataResult* vehicleDataResult = [[SDLVehicleDataResult alloc] init]; SDLVehicleDataResult* customOEMvehicleDataResult = [[SDLVehicleDataResult alloc] initWithCustomOEMDataType:@"customOEMVehicleData" resultCode:SDLVehicleDataResultCodeSuccess]; -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^ { + it(@"should set and get correctly", ^ { SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] init]; testResponse.accPedalPosition = vehicleDataResult; @@ -84,7 +87,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.windowStatus).to(equal(vehicleDataResult)); }); - it(@"Should get correctly when initialized", ^ { + it(@"should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameResponse: @{SDLRPCParameterNameParameters: @{SDLRPCParameterNameAccelerationPedalPosition:vehicleDataResult, @@ -156,7 +159,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.windowStatus).to(equal(vehicleDataResult)); }); - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] init]; expect(testResponse.accPedalPosition).to(beNil()); @@ -227,7 +230,7 @@ describe(@"Getter/Setter Tests", ^ { }); }); - it(@"Should set and get OEM Custom Vehicle Data", ^{ + it(@"should set and get OEM Custom Vehicle Data", ^{ SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] init]; [testResponse setOEMCustomVehicleData:@"customOEMVehicleData" withVehicleDataState:customOEMvehicleDataResult]; diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m index b8273096d..b51e922e1 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m @@ -2,13 +2,15 @@ // SDLUnsubscribeVehicleDataResponseSpec.m // SmartDeviceLink + #import <Foundation/Foundation.h> -#import <Nimble/Nimble.h> + #import <Quick/Quick.h> +#import <Nimble/Nimble.h> -#import "SDLRPCFunctionNames.h" -#import "SDLRPCParameterNames.h" #import "SDLUnsubscribeVehicleDataResponse.h" +#import "SDLRPCParameterNames.h" +#import "SDLRPCFunctionNames.h" #import "SDLVehicleDataResult.h" #import "SDLVehicleDataResultCode.h" @@ -17,8 +19,8 @@ QuickSpecBegin(SDLUnsubscribeVehicleDataResponseSpec) SDLVehicleDataResult* vehicleDataResult = [[SDLVehicleDataResult alloc] init]; SDLVehicleDataResult* customOEMvehicleDataResult = [[SDLVehicleDataResult alloc] initWithCustomOEMDataType:@"customOEMVehicleData" resultCode:SDLVehicleDataResultCodeSuccess]; -describe(@"Getter/Setter Tests", ^ { - it(@"Should set and get correctly", ^ { +describe(@"getter/setter tests", ^ { + it(@"should set and get correctly", ^ { SDLUnsubscribeVehicleDataResponse* testResponse = [[SDLUnsubscribeVehicleDataResponse alloc] init]; testResponse.gps = vehicleDataResult; @@ -84,7 +86,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.windowStatus).to(equal(vehicleDataResult)); }); - it(@"Should get correctly when initialized", ^ { + it(@"should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameResponse: @{SDLRPCParameterNameParameters: @{SDLRPCParameterNameGPS:vehicleDataResult, @@ -156,7 +158,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.windowStatus).to(equal(vehicleDataResult)); }); - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { SDLUnsubscribeVehicleDataResponse* testResponse = [[SDLUnsubscribeVehicleDataResponse alloc] init]; expect(testResponse.gps).to(beNil()); @@ -227,7 +229,7 @@ describe(@"Getter/Setter Tests", ^ { }); }); - it(@"Should set and get OEM Vehicle Data", ^{ + it(@"should set and get OEM Vehicle Data", ^{ SDLUnsubscribeVehicleDataResponse* testResponse = [[SDLUnsubscribeVehicleDataResponse alloc] init]; [testResponse setOEMCustomVehicleData:@"customOEMVehicleData" withVehicleDataState:customOEMvehicleDataResult]; diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStateSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStateSpec.m index daac097e9..9c152bf01 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStateSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStateSpec.m @@ -14,10 +14,10 @@ QuickSpecBegin(SDLWindowStateSpec) const UInt8 approximatePosition = 13; const UInt8 deviation = 42; -describe(@"Getter/Setter Tests", ^ { +describe(@"getter/setter tests", ^ { context(@"initWithApproximatePosition:deviation:", ^{ SDLWindowState *testStruct = [[SDLWindowState alloc] initWithApproximatePosition:approximatePosition deviation:deviation]; - it(@"Expect all properties to be set properly", ^ { + it(@"expect all properties to be set properly", ^ { expect(testStruct.approximatePosition).to(equal(approximatePosition)); expect(testStruct.deviation).to(equal(deviation)); }); @@ -29,7 +29,7 @@ describe(@"Getter/Setter Tests", ^ { #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLWindowState *testStruct = [[SDLWindowState alloc] initWithDictionary:dict]; #pragma clang diagnostic pop - it(@"Expect all properties to be set properly", ^ { + it(@"expect all properties to be set properly", ^ { expect(testStruct.approximatePosition).to(equal(approximatePosition)); expect(testStruct.deviation).to(equal(deviation)); }); @@ -38,7 +38,7 @@ describe(@"Getter/Setter Tests", ^ { context(@"init", ^{ SDLWindowState *testStruct = [[SDLWindowState alloc] init]; - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { expect(testStruct.approximatePosition).to(beNil()); expect(testStruct.deviation).to(beNil()); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStatusSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStatusSpec.m index 477ed3e83..fc3ef69de 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStatusSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLWindowStatusSpec.m @@ -16,13 +16,13 @@ const UInt8 deviation = 42; QuickSpecBegin(SDLWindowStatusSpec) -describe(@"Getter/Setter Tests", ^ { +describe(@"getter/setter tests", ^ { context(@"initWithLocation:state", ^{ SDLWindowState *state = [[SDLWindowState alloc] initWithApproximatePosition:approximatePosition deviation:deviation]; SDLGrid *location = [[SDLGrid alloc] init]; SDLWindowStatus *testStruct = [[SDLWindowStatus alloc] initWithLocation:location state:state]; - it(@"Expect all properties to be set properly", ^ { + it(@"expect all properties to be set properly", ^ { expect(testStruct.location).to(equal(location)); expect(testStruct.state).to(equal(state)); }); @@ -36,7 +36,7 @@ describe(@"Getter/Setter Tests", ^ { #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLWindowStatus *testStruct = [[SDLWindowStatus alloc] initWithDictionary:dict]; #pragma clang diagnostic pop - it(@"Expect all properties to be set properly", ^ { + it(@"expect all properties to be set properly", ^ { expect(testStruct.location).to(equal(location)); expect(testStruct.state).to(equal(state)); }); @@ -44,7 +44,7 @@ describe(@"Getter/Setter Tests", ^ { context(@"init", ^{ SDLWindowStatus *testStruct = [[SDLWindowStatus alloc] init]; - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { expect(testStruct.location).to(beNil()); expect(testStruct.state).to(beNil()); }); |