diff options
author | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-08-11 00:13:31 +0300 |
---|---|---|
committer | leonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com> | 2020-08-11 12:27:19 +0300 |
commit | 67611b289f314f2f6e063aaa924caa376d9f4387 (patch) | |
tree | 3b2a8ec082dbbd92987b7d30c4907d9e377323fd | |
parent | ab621b063a969ba36f84d556a45bd265ed69c033 (diff) | |
download | sdl_ios-67611b289f314f2f6e063aaa924caa376d9f4387.tar.gz |
0266 "New vehicle data GearStatus": code review 4, fix Subscribe Vehicle Data and connected test
6 files changed, 550 insertions, 807 deletions
diff --git a/SmartDeviceLink/SDLSubscribeVehicleData.h b/SmartDeviceLink/SDLSubscribeVehicleData.h index 8392d2c79..e835b07e3 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleData.h +++ b/SmartDeviceLink/SDLSubscribeVehicleData.h @@ -1,149 +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. - */ +// 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 - */ -- (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 initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gearStatus:gps:headLampStatus:instantFuelConsumption:myKey:odometer:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus: instead"); + * @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:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey: 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 - */ -- (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 initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gearStatus:gps:headLampStatus:instantFuelConsumption:myKey:odometer:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus: instead"); + * @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:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey: 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 - */ -- (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 initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:cloudAppVehicleID:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gearStatus:gps:headLampStatus:instantFuelConsumption:myKey:odometer:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus: instead"); + * @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:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey: instead"); /** * Convenience init for subscribing to all possible vehicle data items. @@ -182,239 +158,176 @@ 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 gearStatus:(nullable NSNumber<SDLBool> *)gearStatus tirePressure:(nullable NSNumber<SDLBool> *)tirePressure odometer:(nullable NSNumber<SDLBool> *)odometer beltStatus:(nullable NSNumber<SDLBool> *)beltStatus bodyInformation:(nullable NSNumber<SDLBool> *)bodyInformation deviceStatus:(nullable NSNumber<SDLBool> *)deviceStatus driverBraking:(nullable NSNumber<SDLBool> *)driverBraking wiperStatus:(nullable NSNumber<SDLBool> *)wiperStatus headLampStatus:(nullable NSNumber<SDLBool> *)headLampStatus engineTorque:(nullable NSNumber<SDLBool> *)engineTorque accPedalPosition:(nullable NSNumber<SDLBool> *)accPedalPosition steeringWheelAngle:(nullable NSNumber<SDLBool> *)steeringWheelAngle engineOilLife:(nullable NSNumber<SDLBool> *)engineOilLife electronicParkBrakeStatus:(nullable NSNumber<SDLBool> *)electronicParkBrakeStatus cloudAppVehicleID:(nullable NSNumber<SDLBool> *)cloudAppVehicleID eCallInfo:(nullable NSNumber<SDLBool> *)eCallInfo airbagStatus:(nullable NSNumber<SDLBool> *)airbagStatus emergencyEvent:(nullable NSNumber<SDLBool> *)emergencyEvent clusterModeStatus:(nullable NSNumber<SDLBool> *)clusterModeStatus myKey:(nullable NSNumber<SDLBool> *)myKey; /** - * A boolean value. If true, subscribes Acc Pedal Position data. - * - * Optional. - */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; + * A boolean value. If true, subscribes for GearStatus data. +*/ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gearStatus; /** - * A boolean value. If true, subscribes Airbag Status data. - * - * Optional. + * A boolean value. If true, subscribes GPS data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; /** - * A boolean value. If true, subscribes Belt Status data. - * - * Optional. + * A boolean value. If true, subscribes Speed data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; /** - * A boolean value. If true, subscribes Body Information data. - * - * Optional. + * A boolean value. If true, subscribes RPM data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; /** - * A boolean value. If true, subscribes to the cloud app vehicle ID. - * - * Optional. + * A boolean value. If true, subscribes Fuel Level data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *cloudAppVehicleID; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; /** - * A boolean value. If true, subscribes Cluster Mode Status data. - * - * Optional. + * A boolean value. If true, subscribes Fuel Level State data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; /** - * A boolean value. If true, subscribes Device Status data. - * - * Optional. + * A boolean value. If true, subscribes Fuel Range data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; /** - * A boolean value. If true, subscribes Driver Braking data. - * - * Optional. + * A boolean value. If true, subscribes Instant Fuel Consumption data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; /** - * A boolean value. If true, subscribes eCall Info data. - * - * Optional. + * A boolean value. If true, subscribes External Temperature data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; /** - * A boolean value. If true, subscribes to the electronic parking brake status. - * - * Optional. + * A boolean value. If true, subscribes PRNDL data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl __deprecated_msg("use gearStatus instead on 7.0+ RPC version connections"); /** - * A boolean value. If true, subscribes Emergency Event data. - * - * Optional. + * A boolean value. If true, subscribes Tire Pressure status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; /** - * A boolean value. If true, subscribes to Engine Oil Life data. - * - * Optional. + * A boolean value. If true, subscribes Odometer data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; /** - * A boolean value. If true, subscribes Engine Torque data. - * - * Optional. + * A boolean value. If true, subscribes Belt Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *beltStatus; /** - * A boolean value. If true, subscribes External Temperature data. - * - * Optional. + * A boolean value. If true, subscribes Body Information data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *externalTemperature; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *bodyInformation; /** - * A boolean value. If true, subscribes Fuel Level data. - * - * Optional. + * A boolean value. If true, subscribes Device Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *deviceStatus; /** - * A boolean value. If true, subscribes Fuel Level State data. - * - * Optional. + * A boolean value. If true, subscribes Driver Braking data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelLevel_State; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *driverBraking; /** - * A boolean value. If true, subscribes Fuel Range data. - * - * Optional. + * A boolean value. If true, subscribes Wiper Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *fuelRange; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; /** - * See GearStatus - * - * Optional. - * - * @since SDL 7.0.0 + * A boolean value. If true, subscribes Head Lamp Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gearStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *headLampStatus; /** - * A boolean value. If true, subscribes GPS data. - * - * Optional. + * A boolean value. If true, subscribes to Engine Oil Life data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *gps; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineOilLife; /** - * A boolean value. If true, subscribes Head Lamp Status data. - * - * Optional. + * A boolean value. If true, subscribes Engine Torque data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *headLampStatus; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *engineTorque; /** - * A boolean value. If true, subscribes Instant Fuel Consumption data. - * - * Optional. + * A boolean value. If true, subscribes Acc Pedal Position data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *instantFuelConsumption; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *accPedalPosition; /** - * A boolean value. If true, subscribes PRNDL data. - * - * Optional. - * - * @deprecated - * @since SDL 7.0.0 + * A boolean value. If true, subscribes Steering Wheel Angle data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *prndl __deprecated_msg("use gearStatus instead"); +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; /** - * A boolean value. If true, subscribes myKey data. - * - * Optional. + * A boolean value. If true, subscribes eCall Info data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *eCallInfo; /** - * A boolean value. If true, subscribes Odometer data. - * - * Optional. + * A boolean value. If true, subscribes Airbag Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *odometer; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *airbagStatus; /** - * A boolean value. If true, subscribes RPM data. - * - * Optional. + * A boolean value. If true, subscribes Emergency Event data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *rpm; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *emergencyEvent; /** - * A boolean value. If true, subscribes Speed data. - * - * Optional. + * A boolean value. If true, subscribes Cluster Mode Status data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *speed; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *clusterModeStatus; /** - * A boolean value. If true, subscribes Steering Wheel Angle data. - * - * Optional. + * A boolean value. If true, subscribes myKey data. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *steeringWheelAngle; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; /** - * A boolean value. If true, subscribes Tire Pressure status data. - * - * Optional. + * A boolean value. If true, subscribes to the electronic parking brake status. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *tirePressure; +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; /** * 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 Wiper Status data. - * - * Optional. + * A boolean value. If true, subscribes to the cloud app vehicle ID. */ -@property (strong, nonatomic, nullable) NSNumber<SDLBool> *wiperStatus; +@property (strong, nonatomic, nullable) 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/SDLSubscribeVehicleData.m b/SmartDeviceLink/SDLSubscribeVehicleData.m index 73cff7a82..9e4cc4000 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 @@ -42,9 +15,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - (instancetype)init { - self = [super initWithName:SDLRPCFunctionNameSubscribeVehicleData]; - if (!self) { - return nil; + if (self = [super initWithName:SDLRPCFunctionNameSubscribeVehicleData]) { } return self; } @@ -52,37 +23,34 @@ NS_ASSUME_NONNULL_BEGIN - (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 { self = [self initWithGps:@(gps) speed:@(speed) rpm:@(rpm) fuelLevel:@(fuelLevel) fuelLevel_State:@(fuelLevelState) instantFuelConsumption:@(instantFuelConsumption) fuelRange:nil externalTemperature:@(externalTemperature) turnSignal:nil gearStatus:nil tirePressure:@(tirePressure) odometer:@(odometer) beltStatus:@(beltStatus) bodyInformation:@(bodyInformation) deviceStatus:@(deviceStatus) driverBraking:@(driverBraking) wiperStatus:@(wiperStatus) headLampStatus:@(headLampStatus) engineTorque:@(engineTorque) accPedalPosition:@(accelerationPedalPosition) steeringWheelAngle:@(steeringWheelAngle) engineOilLife:nil electronicParkBrakeStatus:nil cloudAppVehicleID:nil eCallInfo:@(eCallInfo) airbagStatus:@(airbagStatus) emergencyEvent:@(emergencyEvent) clusterModeStatus:@(clusterModeStatus) myKey:@(myKey)]; - if (!self) { - return nil; - } + if (self) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - self.prndl = @(prndl); -#pragma clang diagnostic pop + self.prndl = @(prndl); +#pragma clang diagnostic push + } return self; } - (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal wiperStatus:(BOOL)wiperStatus { self = [self initWithGps:@(gps) speed:@(speed) rpm:@(rpm) fuelLevel:@(fuelLevel) fuelLevel_State:@(fuelLevelState) instantFuelConsumption:@(instantFuelConsumption) fuelRange:@(fuelRange) externalTemperature:@(externalTemperature) turnSignal:@(turnSignal) gearStatus:nil tirePressure:@(tirePressure) odometer:@(odometer) beltStatus:@(beltStatus) bodyInformation:@(bodyInformation) deviceStatus:@(deviceStatus) driverBraking:@(driverBraking) wiperStatus:@(wiperStatus) headLampStatus:@(headLampStatus) engineTorque:@(engineTorque) accPedalPosition:@(accelerationPedalPosition) steeringWheelAngle:@(steeringWheelAngle) engineOilLife:@(engineOilLife) electronicParkBrakeStatus:@(electronicParkBrakeStatus) cloudAppVehicleID:nil eCallInfo:@(eCallInfo) airbagStatus:@(airbagStatus) emergencyEvent:@(emergencyEvent) clusterModeStatus:@(clusterModeStatus) myKey:@(myKey)]; - if (!self) { - return nil; - } + if (self) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - self.prndl = @(prndl); -#pragma clang diagnostic pop + self.prndl = @(prndl); +#pragma clang diagnostic push + } return self; } - (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation cloudAppVehicleID:(BOOL)cloudAppVehicleID clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange 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 { self = [self initWithGps:@(gps) speed:@(speed) rpm:@(rpm) fuelLevel:@(fuelLevel) fuelLevel_State:@(fuelLevelState) instantFuelConsumption:@(instantFuelConsumption) fuelRange:@(fuelRange) externalTemperature:@(externalTemperature) turnSignal:@(turnSignal) gearStatus:nil tirePressure:@(tirePressure) odometer:@(odometer) beltStatus:@(beltStatus) bodyInformation:@(bodyInformation) deviceStatus:@(deviceStatus) driverBraking:@(driverBraking) wiperStatus:@(wiperStatus) headLampStatus:@(headLampStatus) engineTorque:@(engineTorque) accPedalPosition:@(accelerationPedalPosition) steeringWheelAngle:@(steeringWheelAngle) engineOilLife:@(engineOilLife) electronicParkBrakeStatus:@(electronicParkBrakeStatus) cloudAppVehicleID:@(cloudAppVehicleID) eCallInfo:@(eCallInfo) airbagStatus:@(airbagStatus) emergencyEvent:@(emergencyEvent) clusterModeStatus:@(clusterModeStatus) myKey:@(myKey)]; - if (!self) { - return nil; - } + if (self) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - self.prndl = @(prndl); -#pragma clang diagnostic pop + self.prndl = @(prndl); +#pragma clang diagnostic push + } return self; } @@ -123,13 +91,20 @@ NS_ASSUME_NONNULL_BEGIN return self; } +- (void)setGearStatus:(nullable NSNumber<SDLBool> *)gearStatus { + [self.parameters sdl_setObject:gearStatus forName:SDLRPCParameterNameGearStatus]; +} + +- (nullable NSNumber<SDLBool> *)gearStatus { + return [self.parameters sdl_objectForName:SDLRPCParameterNameGearStatus ofClass:NSNumber.class error:nil]; +} + - (void)setGps:(nullable NSNumber<SDLBool> *)gps { [self.parameters sdl_setObject:gps forName:SDLRPCParameterNameGPS]; } - (nullable NSNumber<SDLBool> *)gps { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameGPS ofClass:NSNumber.class error:nil]; } - (void)setSpeed:(nullable NSNumber<SDLBool> *)speed { @@ -137,8 +112,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 { @@ -146,8 +120,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 { @@ -155,8 +128,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 { @@ -164,8 +136,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 { @@ -173,8 +144,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 { @@ -182,8 +152,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 { @@ -191,17 +160,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable NSNumber<SDLBool> *)externalTemperature { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:NSNumber.class error:&error]; -} - -- (void)setGearStatus:(nullable NSNumber<SDLBool> *)gearStatus { - [self.parameters sdl_setObject:gearStatus forName:SDLRPCParameterNameGearStatus]; -} - -- (nullable NSNumber<SDLBool> *)gearStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGearStatus ofClass:NSNumber.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:NSNumber.class error:nil]; } - (void)setPrndl:(nullable NSNumber<SDLBool> *)prndl { @@ -209,8 +168,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 { @@ -218,8 +176,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 { @@ -227,8 +184,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 { @@ -236,8 +192,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 { @@ -245,8 +200,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 { @@ -254,8 +208,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 { @@ -263,8 +216,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 { @@ -272,8 +224,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 { @@ -281,8 +232,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 { @@ -290,8 +240,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 { @@ -299,8 +248,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 { @@ -308,8 +256,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 { @@ -317,8 +264,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 { @@ -326,8 +272,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 { @@ -335,8 +280,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 { @@ -344,8 +288,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 { @@ -353,8 +296,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 { @@ -362,8 +304,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 { @@ -371,8 +312,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 { @@ -380,8 +320,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 { @@ -389,8 +328,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 { @@ -398,8 +336,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/SDLSubscribeVehicleDataResponse.h b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h index 6641adc37..cb969d589 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 /** @@ -78,202 +53,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 gearStatus:(nullable SDLVehicleDataResult *)gearStatus 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; /** - The result of requesting to subscribe to the accelerator pedal position (percentage depressed) - - Optional + The result of requesting to subscribe to the GearStatus. */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *accPedalPosition; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *gearStatus; /** - The result of requesting to subscribe to the airbag status + The result of requesting to subscribe to the GPSData. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *airbagStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *gps; /** - The result of requesting to subscribe to the status of the seat belts. + The result of requesting to subscribe to the vehicle speed in kilometers per hour. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *beltStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *speed; /** - The result of requesting to subscribe to the body information including power modes. + The result of requesting to subscribe to the number of revolutions per minute of the engine. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *bodyInformation; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *rpm; /** - The result of requesting to subscribe to the cloud app vehicle ID + The result of requesting to subscribe to the fuel level in the tank (percentage) Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *cloudAppVehicleID; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel; /** - The result of requesting to subscribe to the cluster modes + The result of requesting to subscribe to the fuel level state. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *clusterModes; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel_State; /** - The result of requesting to subscribe to the device status including signal and battery strength. + The result of requesting to subscribe to the fuel range. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *deviceStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelRange; /** - The result of requesting to subscribe to the status of the brake pedal. + The result of requesting to subscribe to the instantaneous fuel consumption in microlitres. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *driverBraking; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *instantFuelConsumption; /** - The result of requesting to subscribe to the emergency call info + The result of requesting to subscribe to the external temperature in degrees celsius. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *eCallInfo; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *externalTemperature; /** - The result of requesting to subscribe to the electronic parking brake status + The result of requesting to subscribe to the PRNDL status. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *prndl __deprecated_msg("use gearStatus instead on 7.0+ RPC version connections"); /** - The result of requesting to subscribe to the emergency event + The result of requesting to subscribe to the tireStatus. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *emergencyEvent; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *tirePressure; /** - 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 odometer in km. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineOilLife; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *odometer; /** - 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 status of the seat belts. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *engineTorque; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *beltStatus; /** - The result of requesting to subscribe to the external temperature in degrees celsius. + The result of requesting to subscribe to the body information including power modes. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *externalTemperature; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *bodyInformation; /** - The result of requesting to subscribe to the fuel level in the tank (percentage) + The result of requesting to subscribe to the device status including signal and battery strength. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *deviceStatus; /** - The result of requesting to subscribe to the fuel level state. + The result of requesting to subscribe to the status of the brake pedal. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelLevel_State; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *driverBraking; /** - The result of requesting to subscribe to the fuel range. + The result of requesting to subscribe to the status of the wipers. Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *fuelRange; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *wiperStatus; /** - * See GearStatus - * - * @since SDL 7.0.0 + The result of requesting to subscribe to the status of the head lamps. + + Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *gearStatus; +@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; /** - * See PRNDL - * Optional - * - * @deprecated - * @since SDL 7.0.0 + The result of requesting to subscribe to the current angle of the steering wheel (in deg) + + Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *prndl __deprecated_msg("use gearStatus instead"); +@property (strong, nonatomic, nullable) SDLVehicleDataResult *steeringWheelAngle; /** - The result of requesting to subscribe to the myKey status + The result of requesting to subscribe to the emergency call info Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *myKey; +@property (strong, nonatomic, nullable) SDLVehicleDataResult *eCallInfo; /** - The result of requesting to subscribe to the odometer in km. + The result of requesting to subscribe to the airbag status Optional */ -@property (strong, nonatomic, nullable) SDLVehicleDataResult *odometer; +@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 @@ -283,31 +254,31 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, nullable) SDLVehicleDataResult *turnSignal; /** - 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; /** - Gets the OEM custom vehicle data state 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 SDLVehicleDataResult An object containing custom data type and result code information. + @param vehicleDataState SDLVehicleDataResult object containing custom data type and result code information. Added SmartDeviceLink 6.0 */ -- (nullable SDLVehicleDataResult *)getOEMCustomVehicleData:(NSString *)vehicleDataName; +- (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(SDLVehicleDataResult *)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 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. + @return SDLVehicleDataResult An object containing custom data type and result code information. Added SmartDeviceLink 6.0 */ -- (void)setOEMCustomVehicleData:(NSString *)vehicleDataName withVehicleDataState:(SDLVehicleDataResult *)vehicleDataState NS_SWIFT_NAME(setOEMCustomVehicleData(name:state:)); +- (nullable SDLVehicleDataResult *)getOEMCustomVehicleData:(NSString *)vehicleDataName; @end diff --git a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m index ec688d96e..15b890db3 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 @@ -88,13 +61,20 @@ NS_ASSUME_NONNULL_BEGIN return self; } +- (void)setGearStatus:(nullable SDLVehicleDataResult *)gearStatus { + [self.parameters sdl_setObject:gearStatus forName:SDLRPCParameterNameGearStatus]; +} + +- (nullable SDLVehicleDataResult *)gearStatus { + return [self.parameters sdl_objectForName:SDLRPCParameterNameGearStatus ofClass:SDLVehicleDataResult.class error:nil]; +} + - (void)setGps:(nullable SDLVehicleDataResult *)gps { [self.parameters sdl_setObject:gps forName:SDLRPCParameterNameGPS]; } - (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 { @@ -102,8 +82,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 { @@ -111,8 +90,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 { @@ -120,8 +98,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 { @@ -129,8 +106,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 { @@ -138,8 +114,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 { @@ -147,8 +122,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 { @@ -156,17 +130,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)externalTemperature { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:SDLVehicleDataResult.class error:&error]; -} - -- (void)setGearStatus:(nullable SDLVehicleDataResult *)gearStatus { - [self.parameters sdl_setObject:gearStatus forName:SDLRPCParameterNameGearStatus]; -} - -- (nullable SDLVehicleDataResult *)gearStatus { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameGearStatus ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameExternalTemperature ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setPrndl:(nullable SDLVehicleDataResult *)prndl { @@ -174,8 +138,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 { @@ -183,8 +146,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 { @@ -192,8 +154,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 { @@ -201,8 +162,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 { @@ -210,8 +170,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 { @@ -219,8 +178,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 { @@ -228,8 +186,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)driverBraking { - NSError *error = nil; - return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:SDLRPCParameterNameDriverBraking ofClass:SDLVehicleDataResult.class error:nil]; } - (void)setWiperStatus:(nullable SDLVehicleDataResult *)wiperStatus { @@ -237,8 +194,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 { @@ -246,8 +202,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 { @@ -255,8 +210,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 { @@ -264,8 +218,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 { @@ -273,8 +226,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 { @@ -282,8 +234,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 { @@ -291,8 +242,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 { @@ -300,8 +250,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 { @@ -309,8 +258,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 { @@ -318,8 +266,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 { @@ -327,8 +274,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 { @@ -336,8 +282,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 { @@ -345,8 +290,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 { @@ -354,8 +298,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 { @@ -363,8 +306,7 @@ NS_ASSUME_NONNULL_BEGIN } - (nullable SDLVehicleDataResult *)getOEMCustomVehicleData:(NSString *)vehicleDataName { - NSError *error = nil; - return [self.parameters sdl_objectForName:vehicleDataName ofClass:SDLVehicleDataResult.class error:&error]; + return [self.parameters sdl_objectForName:vehicleDataName ofClass:SDLVehicleDataResult.class error:nil]; } @end diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m index dcc463210..7bd03c261 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m @@ -2,18 +2,20 @@ // 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; @@ -30,9 +32,10 @@ describe(@"Getter/Setter Tests", ^ { testRequest.engineOilLife = @YES; testRequest.engineTorque = @NO; testRequest.externalTemperature = @YES; - testRequest.fuelLevel = @NO; + testRequest.fuelLevel = @YES; testRequest.fuelLevel_State = @YES; testRequest.fuelRange = @YES; + testRequest.gearStatus = @YES; testRequest.gps = @YES; testRequest.headLampStatus = @YES; testRequest.instantFuelConsumption = @NO; @@ -64,9 +67,10 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.engineOilLife).to(equal(@YES)); expect(testRequest.engineTorque).to(equal(@NO)); expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@NO)); + expect(testRequest.fuelLevel).to(equal(@YES)); expect(testRequest.fuelLevel_State).to(equal(@YES)); expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gearStatus).to(equal(@YES)); expect(testRequest.gps).to(equal(@YES)); expect(testRequest.headLampStatus).to(equal(@YES)); expect(testRequest.instantFuelConsumption).to(equal(@NO)); @@ -85,7 +89,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.wiperStatus).to(equal(@NO)); }); - 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, @@ -105,26 +109,29 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNameFuelLevel:@YES, SDLRPCParameterNameFuelLevelState:@YES, SDLRPCParameterNameFuelRange:@YES, + SDLRPCParameterNameGearStatus:@YES, SDLRPCParameterNameGPS:@YES, SDLRPCParameterNameHeadLampStatus:@YES, SDLRPCParameterNameInstantFuelConsumption:@YES, SDLRPCParameterNameMyKey:@YES, SDLRPCParameterNameOdometer:@YES, +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLRPCParameterNamePRNDL:@YES, +#pragma clang diagnostic pop SDLRPCParameterNameRPM:@YES, SDLRPCParameterNameSpeed:@YES, SDLRPCParameterNameSteeringWheelAngle:@NO, SDLRPCParameterNameTirePressure:@YES, SDLRPCParameterNameTurnSignal:@NO, SDLRPCParameterNameWiperStatus:@NO, - SDLRPCParameterNameGearStatus:@YES }, SDLRPCParameterNameOperationName:SDLRPCFunctionNameSubscribeVehicleData}}; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithDictionary:dict]; #pragma clang diagnostic pop - + expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); expect(testRequest.beltStatus).to(equal(@YES)); @@ -142,6 +149,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.fuelLevel).to(equal(@YES)); expect(testRequest.fuelLevel_State).to(equal(@YES)); expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gearStatus).to(equal(@YES)); expect(testRequest.gps).to(equal(@YES)); expect(testRequest.headLampStatus).to(equal(@YES)); expect(testRequest.instantFuelConsumption).to(equal(@YES)); @@ -151,7 +159,6 @@ describe(@"Getter/Setter Tests", ^ { #pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(equal(@YES)); expect(testRequest.rpm).to(equal(@YES)); expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); @@ -162,130 +169,136 @@ describe(@"Getter/Setter Tests", ^ { }); describe(@"initializers", ^{ - it(@"init", ^{ + context(@"init", ^{ SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] init]; - expect(testRequest.accPedalPosition).to(beNil()); - expect(testRequest.airbagStatus).to(beNil()); - expect(testRequest.beltStatus).to(beNil()); - expect(testRequest.bodyInformation).to(beNil()); - expect(testRequest.cloudAppVehicleID).to(beNil()); - expect(testRequest.clusterModeStatus).to(beNil()); - expect(testRequest.deviceStatus).to(beNil()); - expect(testRequest.driverBraking).to(beNil()); - expect(testRequest.eCallInfo).to(beNil()); - expect(testRequest.electronicParkBrakeStatus).to(beNil()); - expect(testRequest.emergencyEvent).to(beNil()); - expect(testRequest.engineOilLife).to(beNil()); - expect(testRequest.engineTorque).to(beNil()); - expect(testRequest.externalTemperature).to(beNil()); - expect(testRequest.fuelLevel).to(beNil()); - expect(testRequest.fuelLevel_State).to(beNil()); - expect(testRequest.fuelRange).to(beNil()); - expect(testRequest.gps).to(beNil()); - expect(testRequest.headLampStatus).to(beNil()); - expect(testRequest.instantFuelConsumption).to(beNil()); - expect(testRequest.myKey).to(beNil()); - expect(testRequest.odometer).to(beNil()); + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(beNil()); + expect(testRequest.airbagStatus).to(beNil()); + expect(testRequest.beltStatus).to(beNil()); + expect(testRequest.bodyInformation).to(beNil()); + expect(testRequest.cloudAppVehicleID).to(beNil()); + expect(testRequest.clusterModeStatus).to(beNil()); + expect(testRequest.deviceStatus).to(beNil()); + expect(testRequest.driverBraking).to(beNil()); + expect(testRequest.eCallInfo).to(beNil()); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); + expect(testRequest.emergencyEvent).to(beNil()); + expect(testRequest.engineOilLife).to(beNil()); + expect(testRequest.engineTorque).to(beNil()); + expect(testRequest.externalTemperature).to(beNil()); + expect(testRequest.fuelLevel).to(beNil()); + expect(testRequest.fuelLevel_State).to(beNil()); + expect(testRequest.fuelRange).to(beNil()); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.gps).to(beNil()); + expect(testRequest.headLampStatus).to(beNil()); + expect(testRequest.instantFuelConsumption).to(beNil()); + expect(testRequest.myKey).to(beNil()); + expect(testRequest.odometer).to(beNil()); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(beNil()); + expect(testRequest.prndl).to(beNil()); #pragma clang diagnostic pop - expect(testRequest.gearStatus).to(beNil()); - expect(testRequest.rpm).to(beNil()); - expect(testRequest.speed).to(beNil()); - expect(testRequest.steeringWheelAngle).to(beNil()); - expect(testRequest.tirePressure).to(beNil()); - expect(testRequest.turnSignal).to(beNil()); - expect(testRequest.wiperStatus).to(beNil()); + expect(testRequest.rpm).to(beNil()); + expect(testRequest.speed).to(beNil()); + expect(testRequest.steeringWheelAngle).to(beNil()); + expect(testRequest.tirePressure).to(beNil()); + expect(testRequest.turnSignal).to(beNil()); + expect(testRequest.wiperStatus).to(beNil()); + }); }); - it(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES wiperStatus:YES]; #pragma clang diagnostic pop - expect(testRequest.accPedalPosition).to(equal(@YES)); - expect(testRequest.airbagStatus).to(equal(@YES)); - expect(testRequest.beltStatus).to(equal(@YES)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(beNil()); - expect(testRequest.clusterModeStatus).to(equal(@YES)); - expect(testRequest.deviceStatus).to(equal(@YES)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); - expect(testRequest.emergencyEvent).to(equal(@YES)); - expect(testRequest.engineOilLife).to(equal(@YES)); - expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(equal(@YES)); - expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@YES)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); - expect(testRequest.gearStatus).to(beNil()); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@YES)); - expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(equal(@YES)); - expect(testRequest.wiperStatus).to(equal(@YES)); + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(beNil()); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(equal(@YES)); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(equal(@YES)); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop - }); + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); + expect(testRequest.wiperStatus).to(equal(@YES)); - it(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ + }); + }); + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus:", ^{ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" 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)); - expect(testRequest.airbagStatus).to(equal(@YES)); - expect(testRequest.beltStatus).to(equal(@YES)); - expect(testRequest.bodyInformation).to(equal(@YES)); - expect(testRequest.cloudAppVehicleID).to(beNil()); - expect(testRequest.clusterModeStatus).to(equal(@YES)); - expect(testRequest.deviceStatus).to(equal(@YES)); - expect(testRequest.driverBraking).to(equal(@YES)); - expect(testRequest.eCallInfo).to(equal(@YES)); - expect(testRequest.electronicParkBrakeStatus).to(beNil()); - expect(testRequest.emergencyEvent).to(equal(@YES)); - expect(testRequest.engineOilLife).to(beNil()); - expect(testRequest.engineTorque).to(equal(@YES)); - expect(testRequest.externalTemperature).to(equal(@YES)); - expect(testRequest.fuelLevel).to(equal(@YES)); - expect(testRequest.fuelLevel_State).to(equal(@YES)); - expect(testRequest.fuelRange).to(beNil()); - expect(testRequest.gps).to(equal(@YES)); - expect(testRequest.headLampStatus).to(equal(@YES)); - expect(testRequest.instantFuelConsumption).to(equal(@YES)); - expect(testRequest.myKey).to(equal(@YES)); - expect(testRequest.odometer).to(equal(@YES)); - expect(testRequest.gearStatus).to(beNil()); - expect(testRequest.rpm).to(equal(@YES)); - expect(testRequest.speed).to(equal(@YES)); - expect(testRequest.steeringWheelAngle).to(equal(@YES)); - expect(testRequest.tirePressure).to(equal(@YES)); - expect(testRequest.turnSignal).to(beNil()); - expect(testRequest.wiperStatus).to(equal(@YES)); + it(@"expect all properties to be set properly", ^{ + expect(testRequest.accPedalPosition).to(equal(@YES)); + expect(testRequest.airbagStatus).to(equal(@YES)); + expect(testRequest.beltStatus).to(equal(@YES)); + expect(testRequest.bodyInformation).to(equal(@YES)); + expect(testRequest.cloudAppVehicleID).to(beNil()); + expect(testRequest.clusterModeStatus).to(equal(@YES)); + expect(testRequest.deviceStatus).to(equal(@YES)); + expect(testRequest.driverBraking).to(equal(@YES)); + expect(testRequest.eCallInfo).to(equal(@YES)); + expect(testRequest.electronicParkBrakeStatus).to(beNil()); + expect(testRequest.emergencyEvent).to(equal(@YES)); + expect(testRequest.engineOilLife).to(beNil()); + expect(testRequest.engineTorque).to(equal(@YES)); + expect(testRequest.externalTemperature).to(equal(@YES)); + expect(testRequest.fuelLevel).to(equal(@YES)); + expect(testRequest.fuelLevel_State).to(equal(@YES)); + expect(testRequest.fuelRange).to(beNil()); + expect(testRequest.gearStatus).to(beNil()); + expect(testRequest.gps).to(equal(@YES)); + expect(testRequest.headLampStatus).to(equal(@YES)); + expect(testRequest.instantFuelConsumption).to(equal(@YES)); + expect(testRequest.myKey).to(equal(@YES)); + expect(testRequest.odometer).to(equal(@YES)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(equal(@YES)); + expect(testRequest.prndl).to(equal(@YES)); #pragma clang diagnostic pop + expect(testRequest.rpm).to(equal(@YES)); + expect(testRequest.speed).to(equal(@YES)); + expect(testRequest.steeringWheelAngle).to(equal(@YES)); + expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(beNil()); + expect(testRequest.wiperStatus).to(equal(@YES)); + }); }); context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:", ^{ - SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithGps:@YES speed:@YES rpm:@YES fuelLevel:@YES fuelLevel_State:@YES instantFuelConsumption:@YES fuelRange:@YES externalTemperature:@YES turnSignal:@YES gearStatus:@YES tirePressure:@YES odometer:@YES beltStatus:@YES bodyInformation:@YES deviceStatus:@YES driverBraking:@YES wiperStatus:@YES headLampStatus:@YES engineTorque:@YES accPedalPosition:@YES steeringWheelAngle:@YES engineOilLife:@YES electronicParkBrakeStatus:@YES cloudAppVehicleID:@YES eCallInfo:@YES airbagStatus:@YES emergencyEvent:@YES clusterModeStatus:@YES myKey:@YES]; + SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithGps:@YES speed:@YES rpm:@YES fuelLevel:@YES fuelLevel_State:@YES instantFuelConsumption:@YES fuelRange:@YES externalTemperature:@YES turnSignal:@YES gearStatus:@YES tirePressure:@YES odometer:@YES beltStatus:@YES bodyInformation:@YES deviceStatus:@YES driverBraking:@YES wiperStatus:@YES headLampStatus:@YES engineTorque:@YES accPedalPosition:@YES steeringWheelAngle:@YES engineOilLife:@YES electronicParkBrakeStatus:@YES cloudAppVehicleID:@YES eCallInfo:@YES airbagStatus:@YES emergencyEvent:@YES clusterModeStatus:@YES myKey:@YES]; - it(@"Expect all properties are set to YES", ^{ + it(@"should set all the parameters properly", ^{ expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); expect(testRequest.beltStatus).to(equal(@YES)); @@ -303,70 +316,31 @@ describe(@"initializers", ^{ expect(testRequest.fuelLevel).to(equal(@YES)); expect(testRequest.fuelLevel_State).to(equal(@YES)); expect(testRequest.fuelRange).to(equal(@YES)); + expect(testRequest.gearStatus).to(equal(@YES)); expect(testRequest.gps).to(equal(@YES)); expect(testRequest.headLampStatus).to(equal(@YES)); expect(testRequest.instantFuelConsumption).to(equal(@YES)); expect(testRequest.myKey).to(equal(@YES)); expect(testRequest.odometer).to(equal(@YES)); - expect(testRequest.gearStatus).to(equal(@YES)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testRequest.prndl).to(beNil()); +#pragma clang diagnostic pop expect(testRequest.rpm).to(equal(@YES)); expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(beNil()); -#pragma clang diagnostic pop }); }); - context(@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModeStatus:myKey:", ^{ - SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithGps:@NO speed:@NO rpm:@NO fuelLevel:@NO fuelLevel_State:@NO instantFuelConsumption:@NO fuelRange:@NO externalTemperature:@NO turnSignal:@NO gearStatus:@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]; - - it(@"Expect all properties are 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.gearStatus).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)); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testRequest.prndl).to(beNil()); -#pragma clang diagnostic pop - }); - }); - - context(@"init", ^{ + context(@"should set and get OEM Custom Vehicle Data", ^{ SDLSubscribeVehicleData *testRequest = [[SDLSubscribeVehicleData alloc] init]; [testRequest setOEMCustomVehicleData:@"customVehicleData" withVehicleDataState:NO]; [testRequest setOEMCustomVehicleData:@"customVehicleData1" withVehicleDataState:YES]; - it(@"Should set and get OEM Custom Vehicle Data", ^{ + + it(@"expect OEM Custom Vehicle Data to be set properly", ^{ expect([testRequest getOEMCustomVehicleData:@"customVehicleData"]).to(equal(@NO)); expect([testRequest getOEMCustomVehicleData:@"customVehicleData1"]).to(equal(@YES)); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m index 84d4d7dde..2a8ab154a 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; @@ -38,22 +41,22 @@ describe(@"Getter/Setter Tests", ^ { testResponse.fuelLevel = vehicleDataResult; testResponse.fuelLevel_State = vehicleDataResult; testResponse.fuelRange = vehicleDataResult; + testResponse.gearStatus = vehicleDataResult; testResponse.gps = vehicleDataResult; testResponse.headLampStatus = vehicleDataResult; testResponse.instantFuelConsumption = vehicleDataResult; testResponse.myKey = vehicleDataResult; testResponse.odometer = vehicleDataResult; - testResponse.gearStatus = vehicleDataResult; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + testResponse.prndl = vehicleDataResult; +#pragma clang diagnostic pop testResponse.rpm = vehicleDataResult; testResponse.speed = vehicleDataResult; testResponse.steeringWheelAngle = vehicleDataResult; testResponse.tirePressure = vehicleDataResult; testResponse.turnSignal = vehicleDataResult; testResponse.wiperStatus = vehicleDataResult; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - testResponse.prndl = vehicleDataResult; -#pragma clang diagnostic pop expect(testResponse.accPedalPosition).to(equal(vehicleDataResult)); expect(testResponse.airbagStatus).to(equal(vehicleDataResult)); @@ -72,25 +75,25 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.fuelLevel).to(equal(vehicleDataResult)); expect(testResponse.fuelLevel_State).to(equal(vehicleDataResult)); expect(testResponse.fuelRange).to(equal(vehicleDataResult)); + expect(testResponse.gearStatus).to(equal(vehicleDataResult)); expect(testResponse.gps).to(equal(vehicleDataResult)); expect(testResponse.headLampStatus).to(equal(vehicleDataResult)); expect(testResponse.instantFuelConsumption).to(equal(vehicleDataResult)); expect(testResponse.myKey).to(equal(vehicleDataResult)); expect(testResponse.odometer).to(equal(vehicleDataResult)); - expect(testResponse.gearStatus).to(equal(vehicleDataResult)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testResponse.prndl).to(equal(vehicleDataResult)); +#pragma clang diagnostic pop expect(testResponse.rpm).to(equal(vehicleDataResult)); expect(testResponse.speed).to(equal(vehicleDataResult)); expect(testResponse.steeringWheelAngle).to(equal(vehicleDataResult)); expect(testResponse.tirePressure).to(equal(vehicleDataResult)); expect(testResponse.turnSignal).to(equal(vehicleDataResult)); expect(testResponse.wiperStatus).to(equal(vehicleDataResult)); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(equal(vehicleDataResult)); -#pragma clang diagnostic pop }); - it(@"Should get correctly when initialized", ^ { + it(@"should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLRPCParameterNameResponse: @{SDLRPCParameterNameParameters: @{SDLRPCParameterNameAccelerationPedalPosition:vehicleDataResult, @@ -110,19 +113,22 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNameFuelLevel:vehicleDataResult, SDLRPCParameterNameFuelLevelState:vehicleDataResult, SDLRPCParameterNameFuelRange:vehicleDataResult, + SDLRPCParameterNameGearStatus:vehicleDataResult, SDLRPCParameterNameGPS:vehicleDataResult, SDLRPCParameterNameHeadLampStatus:vehicleDataResult, SDLRPCParameterNameInstantFuelConsumption:vehicleDataResult, SDLRPCParameterNameMyKey:vehicleDataResult, SDLRPCParameterNameOdometer:vehicleDataResult, +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLRPCParameterNamePRNDL:vehicleDataResult, +#pragma clang diagnostic pop SDLRPCParameterNameRPM:vehicleDataResult, SDLRPCParameterNameSpeed:vehicleDataResult, SDLRPCParameterNameSteeringWheelAngle:vehicleDataResult, SDLRPCParameterNameTirePressure:vehicleDataResult, SDLRPCParameterNameTurnSignal:vehicleDataResult, SDLRPCParameterNameWiperStatus:vehicleDataResult, - SDLRPCParameterNameGearStatus:vehicleDataResult }, SDLRPCParameterNameOperationName:SDLRPCFunctionNameSubscribeVehicleData}}; #pragma clang diagnostic push @@ -147,25 +153,25 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.fuelLevel).to(equal(vehicleDataResult)); expect(testResponse.fuelLevel_State).to(equal(vehicleDataResult)); expect(testResponse.fuelRange).to(equal(vehicleDataResult)); + expect(testResponse.gearStatus).to(equal(vehicleDataResult)); expect(testResponse.gps).to(equal(vehicleDataResult)); expect(testResponse.headLampStatus).to(equal(vehicleDataResult)); expect(testResponse.instantFuelConsumption).to(equal(vehicleDataResult)); expect(testResponse.myKey).to(equal(vehicleDataResult)); expect(testResponse.odometer).to(equal(vehicleDataResult)); - expect(testResponse.gearStatus).to(equal(vehicleDataResult)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testResponse.prndl).to(equal(vehicleDataResult)); +#pragma clang diagnostic pop expect(testResponse.rpm).to(equal(vehicleDataResult)); expect(testResponse.speed).to(equal(vehicleDataResult)); expect(testResponse.steeringWheelAngle).to(equal(vehicleDataResult)); expect(testResponse.tirePressure).to(equal(vehicleDataResult)); expect(testResponse.turnSignal).to(equal(vehicleDataResult)); expect(testResponse.wiperStatus).to(equal(vehicleDataResult)); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(equal(vehicleDataResult)); -#pragma clang diagnostic pop }); - it(@"Should return nil if not set", ^ { + it(@"should return nil if not set", ^ { SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] init]; expect(testResponse.accPedalPosition).to(beNil()); @@ -185,70 +191,70 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.fuelLevel).to(beNil()); expect(testResponse.fuelLevel_State).to(beNil()); expect(testResponse.fuelRange).to(beNil()); + expect(testResponse.gearStatus).to(beNil()); expect(testResponse.gps).to(beNil()); expect(testResponse.headLampStatus).to(beNil()); expect(testResponse.instantFuelConsumption).to(beNil()); expect(testResponse.myKey).to(beNil()); expect(testResponse.odometer).to(beNil()); - expect(testResponse.gearStatus).to(beNil()); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testResponse.prndl).to(beNil()); +#pragma clang diagnostic pop expect(testResponse.rpm).to(beNil()); expect(testResponse.speed).to(beNil()); expect(testResponse.steeringWheelAngle).to(beNil()); expect(testResponse.tirePressure).to(beNil()); expect(testResponse.turnSignal).to(beNil()); expect(testResponse.wiperStatus).to(beNil()); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(beNil()); -#pragma clang diagnostic pop }); - context (@"initWithGps:speed:rpm:fuelLevel:fuelLevel_State:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:gearStatus:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModes:myKey:", ^{ - SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] initWithGps:vehicleDataResult speed:vehicleDataResult rpm:vehicleDataResult fuelLevel:vehicleDataResult fuelLevel_State:vehicleDataResult instantFuelConsumption:vehicleDataResult fuelRange:vehicleDataResult externalTemperature:vehicleDataResult turnSignal:vehicleDataResult gearStatus:vehicleDataResult tirePressure:vehicleDataResult odometer:vehicleDataResult beltStatus:vehicleDataResult bodyInformation:vehicleDataResult deviceStatus:vehicleDataResult driverBraking:vehicleDataResult wiperStatus:vehicleDataResult headLampStatus:vehicleDataResult engineTorque:vehicleDataResult accPedalPosition:vehicleDataResult steeringWheelAngle:vehicleDataResult engineOilLife:vehicleDataResult electronicParkBrakeStatus:vehicleDataResult cloudAppVehicleID:vehicleDataResult eCallInfo:vehicleDataResult airbagStatus:vehicleDataResult emergencyEvent:vehicleDataResult clusterModes:vehicleDataResult myKey:vehicleDataResult]; + context(@"initWithGps:speed:rpm:instantFuelConsumption:fuelRange:externalTemperature:turnSignal:prndl:tirePressure:odometer:beltStatus:bodyInformation:deviceStatus:driverBraking:wiperStatus:headLampStatus:engineTorque:accPedalPosition:steeringWheelAngle:engineOilLife:electronicParkBrakeStatus:cloudAppVehicleID:eCallInfo:airbagStatus:emergencyEvent:clusterModes:myKey:gearStatus:", ^{ + SDLSubscribeVehicleDataResponse *testResponse = [[SDLSubscribeVehicleDataResponse alloc] initWithGps:vehicleDataResult speed:vehicleDataResult rpm:vehicleDataResult fuelLevel:vehicleDataResult fuelLevel_State:vehicleDataResult instantFuelConsumption:vehicleDataResult fuelRange:vehicleDataResult externalTemperature:vehicleDataResult turnSignal:vehicleDataResult gearStatus:vehicleDataResult tirePressure:vehicleDataResult odometer:vehicleDataResult beltStatus:vehicleDataResult bodyInformation:vehicleDataResult deviceStatus:vehicleDataResult driverBraking:vehicleDataResult wiperStatus:vehicleDataResult headLampStatus:vehicleDataResult engineTorque:vehicleDataResult accPedalPosition:vehicleDataResult steeringWheelAngle:vehicleDataResult engineOilLife:vehicleDataResult electronicParkBrakeStatus:vehicleDataResult cloudAppVehicleID:vehicleDataResult eCallInfo:vehicleDataResult airbagStatus:vehicleDataResult emergencyEvent:vehicleDataResult clusterModes:vehicleDataResult myKey:vehicleDataResult]; - it(@"Expect all properties to be set properly", ^{ - expect(testResponse.gps).to(equal(vehicleDataResult)); - expect(testResponse.speed).to(equal(vehicleDataResult)); - expect(testResponse.rpm).to(equal(vehicleDataResult)); - expect(testResponse.fuelLevel).to(equal(vehicleDataResult)); - expect(testResponse.fuelLevel_State).to(equal(vehicleDataResult)); - expect(testResponse.fuelRange).to(equal(vehicleDataResult)); - expect(testResponse.instantFuelConsumption).to(equal(vehicleDataResult)); - expect(testResponse.externalTemperature).to(equal(vehicleDataResult)); - expect(testResponse.gearStatus).to(equal(vehicleDataResult)); - expect(testResponse.tirePressure).to(equal(vehicleDataResult)); - expect(testResponse.odometer).to(equal(vehicleDataResult)); - expect(testResponse.beltStatus).to(equal(vehicleDataResult)); - expect(testResponse.bodyInformation).to(equal(vehicleDataResult)); - expect(testResponse.deviceStatus).to(equal(vehicleDataResult)); - expect(testResponse.driverBraking).to(equal(vehicleDataResult)); - expect(testResponse.wiperStatus).to(equal(vehicleDataResult)); - expect(testResponse.headLampStatus).to(equal(vehicleDataResult)); - expect(testResponse.engineOilLife).to(equal(vehicleDataResult)); - expect(testResponse.engineTorque).to(equal(vehicleDataResult)); - expect(testResponse.accPedalPosition).to(equal(vehicleDataResult)); - expect(testResponse.steeringWheelAngle).to(equal(vehicleDataResult)); - expect(testResponse.eCallInfo).to(equal(vehicleDataResult)); - expect(testResponse.airbagStatus).to(equal(vehicleDataResult)); - expect(testResponse.emergencyEvent).to(equal(vehicleDataResult)); - expect(testResponse.clusterModes).to(equal(vehicleDataResult)); - expect(testResponse.myKey).to(equal(vehicleDataResult)); - expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); - expect(testResponse.turnSignal).to(equal(vehicleDataResult)); - expect(testResponse.cloudAppVehicleID).to(equal(vehicleDataResult)); - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testResponse.prndl).to(beNil()); - #pragma clang diagnostic pop + it(@"expect all properties to be set properly", ^{ + expect(testResponse.accPedalPosition).to(equal(vehicleDataResult)); + expect(testResponse.airbagStatus).to(equal(vehicleDataResult)); + expect(testResponse.beltStatus).to(equal(vehicleDataResult)); + expect(testResponse.bodyInformation).to(equal(vehicleDataResult)); + expect(testResponse.cloudAppVehicleID).to(equal(vehicleDataResult)); + expect(testResponse.clusterModes).to(equal(vehicleDataResult)); + expect(testResponse.deviceStatus).to(equal(vehicleDataResult)); + expect(testResponse.driverBraking).to(equal(vehicleDataResult)); + expect(testResponse.eCallInfo).to(equal(vehicleDataResult)); + expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); + expect(testResponse.emergencyEvent).to(equal(vehicleDataResult)); + expect(testResponse.engineOilLife).to(equal(vehicleDataResult)); + expect(testResponse.engineTorque).to(equal(vehicleDataResult)); + expect(testResponse.externalTemperature).to(equal(vehicleDataResult)); + expect(testResponse.fuelLevel).to(equal(vehicleDataResult)); + expect(testResponse.fuelLevel_State).to(equal(vehicleDataResult)); + expect(testResponse.fuelRange).to(equal(vehicleDataResult)); + expect(testResponse.gearStatus).to(equal(vehicleDataResult)); + expect(testResponse.gps).to(equal(vehicleDataResult)); + expect(testResponse.headLampStatus).to(equal(vehicleDataResult)); + expect(testResponse.instantFuelConsumption).to(equal(vehicleDataResult)); + expect(testResponse.myKey).to(equal(vehicleDataResult)); + expect(testResponse.odometer).to(equal(vehicleDataResult)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testResponse.prndl).to(beNil()); +#pragma clang diagnostic push + expect(testResponse.rpm).to(equal(vehicleDataResult)); + expect(testResponse.speed).to(equal(vehicleDataResult)); + expect(testResponse.steeringWheelAngle).to(equal(vehicleDataResult)); + expect(testResponse.tirePressure).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); + expect(testResponse.wiperStatus).to(equal(vehicleDataResult)); }); }); - it(@"Should set and get Generic Network Signal Data", ^{ + context(@"init and assign OEM Custom Vehicle Data", ^{ SDLSubscribeVehicleDataResponse *testRequest = [[SDLSubscribeVehicleDataResponse alloc] init]; - [testRequest setOEMCustomVehicleData:@"customOEMVehicleData" withVehicleDataState:customOEMvehicleDataResult]; - - expect([testRequest getOEMCustomVehicleData:@"customOEMVehicleData"]).to(equal(customOEMvehicleDataResult)); + it(@"expect OEM Custom Vehicle Data to be set properly", ^{ + expect([testRequest getOEMCustomVehicleData:@"customOEMVehicleData"]).to(equal(customOEMvehicleDataResult)); + }); }); }); |