diff options
42 files changed, 544 insertions, 186 deletions
diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec index 5b0df4869..b5c47b044 100644 --- a/SmartDeviceLink-iOS.podspec +++ b/SmartDeviceLink-iOS.podspec @@ -313,6 +313,7 @@ ss.public_header_files = [ 'SmartDeviceLink/SDLTriggerSource.h', 'SmartDeviceLink/SDLTTSChunk.h', 'SmartDeviceLink/SDLTurn.h', +'SmartDeviceLink/SDLTurnSignal.h', 'SmartDeviceLink/SDLUnregisterAppInterface.h', 'SmartDeviceLink/SDLUnregisterAppInterfaceResponse.h', 'SmartDeviceLink/SDLUnsubscribeButton.h', diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 6d7fff182..54083d2e2 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -1105,6 +1105,9 @@ 8814AEAA20AB663800466E0F /* PerformInteractionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8814AEA920AB663800466E0F /* PerformInteractionManager.m */; }; 8814AEAC20AB667B00466E0F /* PerformInteractionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8814AEAB20AB667B00466E0F /* PerformInteractionManager.swift */; }; 88166B00207E41E900076236 /* MenuManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88166AFF207E41E900076236 /* MenuManager.swift */; }; + 8818ADD82100FC18007D6F19 /* SDLTurnSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8818ADD62100FC18007D6F19 /* SDLTurnSignal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8818ADD92100FC18007D6F19 /* SDLTurnSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = 8818ADD72100FC18007D6F19 /* SDLTurnSignal.m */; }; + 8818ADDD2100FE0C007D6F19 /* SDLTurnSignalSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8818ADDC2100FE0C007D6F19 /* SDLTurnSignalSpec.m */; }; 8829568B207CF68800EF056C /* SmartDeviceLink.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D61FA1C1A84237100846EE7 /* SmartDeviceLink.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; 88295690207CF68800EF056C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5D4029D31A76F0340006B0C2 /* Images.xcassets */; }; 88295693207CF68800EF056C /* SmartDeviceLink.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5D61FA1C1A84237100846EE7 /* SmartDeviceLink.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -1123,6 +1126,8 @@ 88802FF420853BED00E9EBC6 /* SmartDeviceLinkSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D4346631E6F38E600B639C6 /* SmartDeviceLinkSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; 88802FF520853CD500E9EBC6 /* SmartDeviceLinkSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 88802FEF20853AE600E9EBC6 /* SmartDeviceLinkSwift.framework */; }; 88802FF620853CD500E9EBC6 /* SmartDeviceLinkSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 88802FEF20853AE600E9EBC6 /* SmartDeviceLinkSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 8880B2EF21021E37004721DB /* TextValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8880B2ED21021964004721DB /* TextValidator.swift */; }; + 8880B2F421022896004721DB /* TextValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 8880B2F121022887004721DB /* TextValidator.m */; }; 888D178F207E7F42008E9F8F /* ButtonManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 888D178D207E7F0E008E9F8F /* ButtonManager.swift */; }; 888D1790207E815C008E9F8F /* AppConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 8863B597207D2388002D6459 /* AppConstants.m */; }; 88A0AA56207CFE5D0075132C /* AppUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88A0AA55207CFE5C0075132C /* AppUserDefaults.swift */; }; @@ -2492,7 +2497,10 @@ 8814AEA920AB663800466E0F /* PerformInteractionManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerformInteractionManager.m; sourceTree = "<group>"; }; 8814AEAB20AB667B00466E0F /* PerformInteractionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerformInteractionManager.swift; sourceTree = "<group>"; }; 88166AFF207E41E900076236 /* MenuManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuManager.swift; sourceTree = "<group>"; }; - 88295697207CF68800EF056C /* SDL Example Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SDL Example Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 8818ADD62100FC18007D6F19 /* SDLTurnSignal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDLTurnSignal.h; sourceTree = "<group>"; }; + 8818ADD72100FC18007D6F19 /* SDLTurnSignal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLTurnSignal.m; sourceTree = "<group>"; }; + 8818ADDC2100FE0C007D6F19 /* SDLTurnSignalSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLTurnSignalSpec.m; sourceTree = "<group>"; }; + 88295697207CF68800EF056C /* SDL Example Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SDL Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 88295698207CF68800EF056C /* SmartDeviceLink-Example-Swift-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "SmartDeviceLink-Example-Swift-Info.plist"; path = "/Users/nicolelivioradio.com/sdl_ios/SmartDeviceLink-Example-Swift-Info.plist"; sourceTree = "<absolute>"; }; 8829569C207CFD0D00EF056C /* SmartDeviceLink-Example-Swift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SmartDeviceLink-Example-Swift-Bridging-Header.h"; sourceTree = "<group>"; }; 8829569D207CFD0E00EF056C /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; @@ -2506,6 +2514,9 @@ 8877F5ED1F34A72200DC128A /* SDLSendHapticDataResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendHapticDataResponse.m; sourceTree = "<group>"; }; 8877F5F01F34AA2D00DC128A /* SDLSendHapticDataResponseSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendHapticDataResponseSpec.m; sourceTree = "<group>"; }; 88802FEF20853AE600E9EBC6 /* SmartDeviceLinkSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SmartDeviceLinkSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8880B2ED21021964004721DB /* TextValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextValidator.swift; sourceTree = "<group>"; }; + 8880B2F021022887004721DB /* TextValidator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextValidator.h; sourceTree = "<group>"; }; + 8880B2F121022887004721DB /* TextValidator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextValidator.m; sourceTree = "<group>"; }; 888D178D207E7F0E008E9F8F /* ButtonManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonManager.swift; sourceTree = "<group>"; }; 88A0AA55207CFE5C0075132C /* AppUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppUserDefaults.swift; sourceTree = "<group>"; }; 88A0AA57207CFE650075132C /* ProxyManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxyManager.swift; sourceTree = "<group>"; }; @@ -2781,6 +2792,7 @@ 162E82191A9BDE8A00906325 /* SDLTimerModeSpec.m */, 162E821A1A9BDE8A00906325 /* SDLTouchTypeSpec.m */, 162E821B1A9BDE8A00906325 /* SDLTriggerSource.m */, + 8818ADDC2100FE0C007D6F19 /* SDLTurnSignalSpec.m */, 162E821C1A9BDE8A00906325 /* SDLUpdateModeSpec.m */, 162E821D1A9BDE8A00906325 /* SDLVehicleDataActiveStatusSpec.m */, 162E821E1A9BDE8A00906325 /* SDLVehicleDataEventStatusSpec.m */, @@ -3422,6 +3434,8 @@ children = ( 5D48329B1A8EA33D00252386 /* Preferences.h */, 5D48329C1A8EA33D00252386 /* Preferences.m */, + 8880B2F021022887004721DB /* TextValidator.h */, + 8880B2F121022887004721DB /* TextValidator.m */, ); name = Utilities; sourceTree = "<group>"; @@ -4013,6 +4027,8 @@ 5D3E420920EAAD6500D8C622 /* SDLTPMS.m */, 5D61FBEE1A84238C00846EE7 /* SDLTriggerSource.h */, 5D61FBEF1A84238C00846EE7 /* SDLTriggerSource.m */, + 8818ADD62100FC18007D6F19 /* SDLTurnSignal.h */, + 8818ADD72100FC18007D6F19 /* SDLTurnSignal.m */, 5D61FC021A84238C00846EE7 /* SDLUpdateMode.h */, 5D61FC031A84238C00846EE7 /* SDLUpdateMode.m */, 5D61FC101A84238C00846EE7 /* SDLVehicleDataActiveStatus.h */, @@ -5107,6 +5123,7 @@ children = ( 88A0AA55207CFE5C0075132C /* AppUserDefaults.swift */, 88DFB051207F8DF50079D19D /* Protocol+ProxyManagerDelegate.swift */, + 8880B2ED21021964004721DB /* TextValidator.swift */, ); name = Utilities; sourceTree = "<group>"; @@ -5628,6 +5645,7 @@ EED5CA001F4D18DC00F04000 /* SDLRAWH264Packetizer.h in Headers */, DA8966EB1E56939F00413EAB /* SDLStreamingMediaLifecycleManager.h in Headers */, 5D293AFE1FE078A9000CBD7E /* SDLCarWindowViewController.h in Headers */, + 8818ADD82100FC18007D6F19 /* SDLTurnSignal.h in Headers */, 5D61FDDB1A84238C00846EE7 /* SDLTriggerSource.h in Headers */, 5D61FD8F1A84238C00846EE7 /* SDLShow.h in Headers */, 5D61FDDD1A84238C00846EE7 /* SDLTTSChunk.h in Headers */, @@ -5928,6 +5946,7 @@ buildActionMask = 2147483647; files = ( 5D4832A51A94F90D00252386 /* ConnectionTransitionContext.m in Sources */, + 8880B2F421022896004721DB /* TextValidator.m in Sources */, 8800871E20A6356D008E1EA0 /* ButtonManager.m in Sources */, 5D0218FC1A8E7E1700D1BF62 /* ConnectionContainerViewController.m in Sources */, 88DA6D10209794A400AD8297 /* AlertManager.m in Sources */, @@ -6223,6 +6242,7 @@ 5D61FE061A84238C00846EE7 /* SDLVehicleDataResultCode.m in Sources */, 5D61FCA41A84238C00846EE7 /* SDLEndAudioPassThru.m in Sources */, 5D339CEB207C066E000CC364 /* SDLMenuCell.m in Sources */, + 8818ADD92100FC18007D6F19 /* SDLTurnSignal.m in Sources */, 5D8B17541AC9E11B006A6E1C /* SDLDialNumberResponse.m in Sources */, DA6223BE1E7B088200878689 /* CVPixelBufferRef+SDLUtil.m in Sources */, 1FF7DABC1F75B2BF00B46C30 /* SDLFocusableItemLocator.m in Sources */, @@ -6579,6 +6599,7 @@ 1EE8C4401F348D3200FDC2CF /* SDLClimateControlCapabilitiesSpec.m in Sources */, 5DE35E5420CB1C590034BE5A /* SDLPresentChoiceSetOperationSpec.m in Sources */, 162E838F1A9BDE8B00906325 /* SDLTextFieldSpec.m in Sources */, + 8818ADDD2100FE0C007D6F19 /* SDLTurnSignalSpec.m in Sources */, 162E82CA1A9BDE8A00906325 /* SDLAmbientLightStatusSpec.m in Sources */, 162E83091A9BDE8B00906325 /* SDLVehicleDataStatusSpec.m in Sources */, 5DAD5F8D20508F220025624C /* SDLSoftButtonManagerSpec.m in Sources */, @@ -6731,6 +6752,7 @@ 88DFB053207F8E100079D19D /* Protocol+ProxyManagerDelegate.swift in Sources */, 88B849C820812442002A034D /* VehicleDataManager.swift in Sources */, 8829569E207CFD0E00EF056C /* AppDelegate.swift in Sources */, + 8880B2EF21021E37004721DB /* TextValidator.swift in Sources */, 88A0AA58207CFE650075132C /* ProxyManager.swift in Sources */, 88166B00207E41E900076236 /* MenuManager.swift in Sources */, 8814AEAC20AB667B00466E0F /* PerformInteractionManager.swift in Sources */, diff --git a/SmartDeviceLink.podspec b/SmartDeviceLink.podspec index d7859b39a..99742d20b 100644 --- a/SmartDeviceLink.podspec +++ b/SmartDeviceLink.podspec @@ -313,6 +313,7 @@ ss.public_header_files = [ 'SmartDeviceLink/SDLTriggerSource.h', 'SmartDeviceLink/SDLTTSChunk.h', 'SmartDeviceLink/SDLTurn.h', +'SmartDeviceLink/SDLTurnSignal.h', 'SmartDeviceLink/SDLUnregisterAppInterface.h', 'SmartDeviceLink/SDLUnregisterAppInterfaceResponse.h', 'SmartDeviceLink/SDLUnsubscribeButton.h', diff --git a/SmartDeviceLink/SDLGetVehicleData.h b/SmartDeviceLink/SDLGetVehicleData.h index 190436556..82b3f7ce4 100644 --- a/SmartDeviceLink/SDLGetVehicleData.h +++ b/SmartDeviceLink/SDLGetVehicleData.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN * @param wiperStatus Get wiperStatus data * @return A SDLGetVehicleData object */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo emergencyEvent:(BOOL)emergencyEvent engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus: instead"); +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo emergencyEvent:(BOOL)emergencyEvent engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus: instead"); /** * Convenience init for getting data for all possible vehicle data items. @@ -78,11 +78,12 @@ NS_ASSUME_NONNULL_BEGIN * @param speed Get speed data * @param steeringWheelAngle Get steeringWheelAngle data * @param tirePressure Get tirePressure data + * @param turnSignal Get turnSignal data * @param vin Get vin data * @param wiperStatus Get wiperStatus data * @return A SDLGetVehicleData object */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus; +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus; /** * A boolean value. If true, requests GPS data. @@ -224,6 +225,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nullable, strong, nonatomic) NSNumber<SDLBool> *electronicParkBrakeStatus; +/** + A boolean value. If true, requests Turn Signal data. + */ +@property (nullable, strong, nonatomic) NSNumber<SDLBool> *turnSignal; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLGetVehicleData.m b/SmartDeviceLink/SDLGetVehicleData.m index aff45fc36..6b795b057 100644 --- a/SmartDeviceLink/SDLGetVehicleData.m +++ b/SmartDeviceLink/SDLGetVehicleData.m @@ -18,10 +18,10 @@ 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 vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { - return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure vin:vin wiperStatus:wiperStatus]; + return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure turnSignal:NO vin:vin wiperStatus:wiperStatus]; } -- (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 vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { +- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure turnSignal:(BOOL)turnSignal vin:(BOOL)vin wiperStatus:(BOOL)wiperStatus { self = [self init]; if (!self) { return nil; @@ -53,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN self.speed = @(speed); self.steeringWheelAngle = @(steeringWheelAngle); self.tirePressure = @(tirePressure); + self.turnSignal = @(turnSignal); self.vin = @(vin); self.wiperStatus = @(wiperStatus); @@ -283,6 +284,14 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus]; } +- (void)setTurnSignal:(nullable NSNumber<SDLBool> *)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable NSNumber<SDLBool> *)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLGetVehicleDataResponse.h b/SmartDeviceLink/SDLGetVehicleDataResponse.h index 450712331..689a750f2 100644 --- a/SmartDeviceLink/SDLGetVehicleDataResponse.h +++ b/SmartDeviceLink/SDLGetVehicleDataResponse.h @@ -6,6 +6,7 @@ #import "SDLComponentVolumeStatus.h" #import "SDLElectronicParkBrakeStatus.h" #import "SDLPRNDL.h" +#import "SDLTurnSignal.h" #import "SDLVehicleDataEventStatus.h" #import "SDLWiperStatus.h" @@ -175,6 +176,12 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nullable, strong, nonatomic) SDLElectronicParkBrakeStatus electronicParkBrakeStatus; +/** + The status of the turn signal + */ +@property (nullable, strong, nonatomic) SDLTurnSignal turnSignal; + + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLGetVehicleDataResponse.m b/SmartDeviceLink/SDLGetVehicleDataResponse.m index fa825bc1f..9e8aeff6c 100644 --- a/SmartDeviceLink/SDLGetVehicleDataResponse.m +++ b/SmartDeviceLink/SDLGetVehicleDataResponse.m @@ -253,6 +253,14 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus]; } +- (void)setTurnSignal:(nullable SDLTurnSignal)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable SDLTurnSignal)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h index 7846a218d..c479ce6ce 100644 --- a/SmartDeviceLink/SDLNames.h +++ b/SmartDeviceLink/SDLNames.h @@ -506,6 +506,7 @@ extern SDLName const SDLNameTTSChunks; extern SDLName const SDLNameTTSName; extern SDLName const SDLNameTurnIcon; extern SDLName const SDLNameTurnList; +extern SDLName const SDLNameTurnSignal; extern SDLName const SDLNameType; extern SDLName const SDLNameUnit; extern SDLName const SDLNameUnregisterAppInterface; diff --git a/SmartDeviceLink/SDLNames.m b/SmartDeviceLink/SDLNames.m index a0e86833f..d2eafbf0e 100644 --- a/SmartDeviceLink/SDLNames.m +++ b/SmartDeviceLink/SDLNames.m @@ -501,6 +501,7 @@ SDLName const SDLNameTTSChunks = @"ttsChunks"; SDLName const SDLNameTTSName = @"ttsName"; SDLName const SDLNameTurnIcon = @"turnIcon"; SDLName const SDLNameTurnList = @"turnList"; +SDLName const SDLNameTurnSignal = @"turnSignal"; SDLName const SDLNameType = @"type"; SDLName const SDLNameUnit = @"unit"; SDLName const SDLNameUnregisterAppInterface = @"UnregisterAppInterface"; diff --git a/SmartDeviceLink/SDLOnVehicleData.h b/SmartDeviceLink/SDLOnVehicleData.h index ed80e72a7..f4449c070 100644 --- a/SmartDeviceLink/SDLOnVehicleData.h +++ b/SmartDeviceLink/SDLOnVehicleData.h @@ -6,6 +6,7 @@ #import "SDLComponentVolumeStatus.h" #import "SDLElectronicParkBrakeStatus.h" #import "SDLPRNDL.h" +#import "SDLTurnSignal.h" #import "SDLVehicleDataEventStatus.h" #import "SDLWiperStatus.h" @@ -175,6 +176,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nullable, strong, nonatomic) SDLElectronicParkBrakeStatus electronicParkBrakeStatus; +/** + The status of the turn signal + */ +@property (nullable, strong, nonatomic) SDLTurnSignal turnSignal; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLOnVehicleData.m b/SmartDeviceLink/SDLOnVehicleData.m index a44091c74..8c77db316 100644 --- a/SmartDeviceLink/SDLOnVehicleData.m +++ b/SmartDeviceLink/SDLOnVehicleData.m @@ -253,6 +253,14 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus]; } +- (void)setTurnSignal:(nullable SDLTurnSignal)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable SDLTurnSignal)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSubscribeVehicleData.h b/SmartDeviceLink/SDLSubscribeVehicleData.h index 5d5b6552b..8549e58e3 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleData.h +++ b/SmartDeviceLink/SDLSubscribeVehicleData.h @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN * @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:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus: instead"); +- (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:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus: instead"); /** * Convenience init for subscribing to all possible vehicle data items. @@ -79,10 +79,11 @@ NS_ASSUME_NONNULL_BEGIN * @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 wiperStatus:(BOOL)wiperStatus; +- (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; /** * A boolean value. If true, subscribes GPS data. @@ -215,10 +216,16 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; /** - A boolean value. If true, subscribes to the electronic parking brake status + * A boolean value. If true, subscribes to the electronic parking brake status. */ @property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; +/** + * A boolean value. If true, subscribes to the turn signal status. + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; + + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSubscribeVehicleData.m b/SmartDeviceLink/SDLSubscribeVehicleData.m index 40db7cf52..013496525 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleData.m +++ b/SmartDeviceLink/SDLSubscribeVehicleData.m @@ -18,10 +18,10 @@ 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 { - return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure wiperStatus:wiperStatus]; + return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure turnSignal:NO wiperStatus:wiperStatus]; } -- (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 wiperStatus:(BOOL)wiperStatus { +- (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 init]; if (!self) { return nil; @@ -53,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN self.speed = @(speed); self.steeringWheelAngle = @(steeringWheelAngle); self.tirePressure = @(tirePressure); + self.turnSignal = @(turnSignal); self.wiperStatus = @(wiperStatus); return self; @@ -274,6 +275,13 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus]; } +- (void)setTurnSignal:(nullable NSNumber<SDLBool> *)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable NSNumber<SDLBool> *)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal]; +} @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h index 7366455a9..1cc10c6b3 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h +++ b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.h @@ -205,6 +205,13 @@ NS_ASSUME_NONNULL_BEGIN */ @property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; +/** + The result of requesting to subscribe to the turn signal + + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *turnSignal; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m index acd89aa4b..b39328d7e 100644 --- a/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m +++ b/SmartDeviceLink/SDLSubscribeVehicleDataResponse.m @@ -234,6 +234,14 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus ofClass:[SDLVehicleDataResult class]]; } +- (void)setTurnSignal:(nullable SDLVehicleDataResult *)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable SDLVehicleDataResult *)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal ofClass:[SDLVehicleDataResult class]]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLTurnSignal.h b/SmartDeviceLink/SDLTurnSignal.h new file mode 100644 index 000000000..b8d50c610 --- /dev/null +++ b/SmartDeviceLink/SDLTurnSignal.h @@ -0,0 +1,34 @@ +// +// SDLTurnSignal.h +// SmartDeviceLink +// +// Created by Nicole on 7/19/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import "SDLEnum.h" + +/* + * Enumeration that describes the status of the turn light indicator. + */ +typedef SDLEnum SDLTurnSignal SDL_SWIFT_ENUM; + +/* + * Turn signal is OFF + */ +extern SDLTurnSignal const SDLTurnSignalOff; + +/* + * Left turn signal is on + */ +extern SDLTurnSignal const SDLTurnSignalLeft; + +/* + * Right turn signal is on + */ +extern SDLTurnSignal const SDLTurnSignalRight; + +/* + * Both signals (left and right) are on + */ +extern SDLTurnSignal const SDLTurnSignalBoth; diff --git a/SmartDeviceLink/SDLTurnSignal.m b/SmartDeviceLink/SDLTurnSignal.m new file mode 100644 index 000000000..dedd49e72 --- /dev/null +++ b/SmartDeviceLink/SDLTurnSignal.m @@ -0,0 +1,14 @@ +// +// SDLTurnSignal.m +// SmartDeviceLink +// +// Created by Nicole on 7/19/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import "SDLTurnSignal.h" + +SDLTurnSignal const SDLTurnSignalOff = @"OFF"; +SDLTurnSignal const SDLTurnSignalLeft = @"LEFT"; +SDLTurnSignal const SDLTurnSignalRight = @"RIGHT"; +SDLTurnSignal const SDLTurnSignalBoth = @"BOTH"; diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleData.h b/SmartDeviceLink/SDLUnsubscribeVehicleData.h index ee3b4ab0e..ace3cf584 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleData.h +++ b/SmartDeviceLink/SDLUnsubscribeVehicleData.h @@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN * @param wiperStatus Unsubscribe to wiperStatus * @return A SDLUnsubscribeVehicleData object */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo emergencyEvent:(BOOL)emergencyEvent engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure wiperStatus:(BOOL)wiperStatus __deprecated_msg("Use initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:wiperStatus: instead"); +- (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:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:fuelRange:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus: instead"); /** * Convenience init for unsubscribing to all possible vehicle data items. @@ -81,10 +81,11 @@ NS_ASSUME_NONNULL_BEGIN * @param speed Unsubscribe to speed * @param steeringWheelAngle Unsubscribe to steeringWheelAngle * @param tirePressure Unsubscribe to tirePressure + * @param turnSignal Unsubscribe to turnSignal * @param wiperStatus Unsubscribe to wiperStatus * @return A SDLUnsubscribeVehicleData object */ -- (instancetype)initWithAccelerationPedalPosition:(BOOL)accelerationPedalPosition airbagStatus:(BOOL)airbagStatus beltStatus:(BOOL)beltStatus bodyInformation:(BOOL)bodyInformation clusterModeStatus:(BOOL)clusterModeStatus deviceStatus:(BOOL)deviceStatus driverBraking:(BOOL)driverBraking eCallInfo:(BOOL)eCallInfo electronicParkBrakeStatus:(BOOL)electronicParkBrakeStatus emergencyEvent:(BOOL)emergencyEvent engineOilLife:(BOOL)engineOilLife engineTorque:(BOOL)engineTorque externalTemperature:(BOOL)externalTemperature fuelLevel:(BOOL)fuelLevel fuelLevelState:(BOOL)fuelLevelState fuelRange:(BOOL)fuelRange gps:(BOOL)gps headLampStatus:(BOOL)headLampStatus instantFuelConsumption:(BOOL)instantFuelConsumption myKey:(BOOL)myKey odometer:(BOOL)odometer prndl:(BOOL)prndl rpm:(BOOL)rpm speed:(BOOL)speed steeringWheelAngle:(BOOL)steeringWheelAngle tirePressure:(BOOL)tirePressure wiperStatus:(BOOL)wiperStatus; +- (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; /** * If true, unsubscribes from GPS @@ -217,10 +218,15 @@ NS_ASSUME_NONNULL_BEGIN @property (strong, nonatomic, nullable) NSNumber<SDLBool> *myKey; /** - A boolean value. If true, unsubscribes to the electronic parking brake status + A boolean value. If true, unsubscribes to the Electronic Parking Brake Status */ @property (strong, nonatomic, nullable) NSNumber<SDLBool> *electronicParkBrakeStatus; +/** + A boolean value. If true, unsubscribes to the Turn Signal + */ +@property (strong, nonatomic, nullable) NSNumber<SDLBool> *turnSignal; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleData.m b/SmartDeviceLink/SDLUnsubscribeVehicleData.m index 4d3e82590..3ecf16bfc 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleData.m +++ b/SmartDeviceLink/SDLUnsubscribeVehicleData.m @@ -18,10 +18,10 @@ 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 { - return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure wiperStatus:wiperStatus]; + return [self initWithAccelerationPedalPosition:accelerationPedalPosition airbagStatus:airbagStatus beltStatus:beltStatus bodyInformation:bodyInformation clusterModeStatus:clusterModeStatus deviceStatus:deviceStatus driverBraking:driverBraking eCallInfo:eCallInfo electronicParkBrakeStatus:NO emergencyEvent:emergencyEvent engineOilLife:NO engineTorque:engineTorque externalTemperature:externalTemperature fuelLevel:fuelLevel fuelLevelState:fuelLevelState fuelRange:NO gps:gps headLampStatus:headLampStatus instantFuelConsumption:instantFuelConsumption myKey:myKey odometer:odometer prndl:prndl rpm:rpm speed:speed steeringWheelAngle:steeringWheelAngle tirePressure:tirePressure turnSignal:NO wiperStatus:wiperStatus]; } -- (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 wiperStatus:(BOOL)wiperStatus { +- (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 init]; if (!self) { return nil; @@ -53,6 +53,7 @@ NS_ASSUME_NONNULL_BEGIN self.speed = @(speed); self.steeringWheelAngle = @(steeringWheelAngle); self.tirePressure = @(tirePressure); + self.turnSignal = @(turnSignal); self.wiperStatus = @(wiperStatus); return self; @@ -274,6 +275,14 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus]; } +- (void)setTurnSignal:(nullable NSNumber<SDLBool> *)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable NSNumber<SDLBool> *)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h index 4625f1652..0500a1921 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h +++ b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.h @@ -204,6 +204,13 @@ NS_ASSUME_NONNULL_BEGIN */ @property (strong, nonatomic, nullable) SDLVehicleDataResult *electronicParkBrakeStatus; +/** + The result of requesting to unsubscribe to the turn signal + + Optional + */ +@property (strong, nonatomic, nullable) SDLVehicleDataResult *turnSignal; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m index 7bcdcf9e6..6ad213dee 100644 --- a/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m +++ b/SmartDeviceLink/SDLUnsubscribeVehicleDataResponse.m @@ -234,6 +234,14 @@ NS_ASSUME_NONNULL_BEGIN return [parameters sdl_objectForName:SDLNameElectronicParkBrakeStatus ofClass:[SDLVehicleDataResult class]]; } +- (void)setTurnSignal:(nullable SDLVehicleDataResult *)turnSignal { + [parameters sdl_setObject:turnSignal forName:SDLNameTurnSignal]; +} + +- (nullable SDLVehicleDataResult *)turnSignal { + return [parameters sdl_objectForName:SDLNameTurnSignal ofClass:SDLVehicleDataResult.class]; +} + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLVehicleDataType.h b/SmartDeviceLink/SDLVehicleDataType.h index 1f10714f0..4afe818f8 100644 --- a/SmartDeviceLink/SDLVehicleDataType.h +++ b/SmartDeviceLink/SDLVehicleDataType.h @@ -150,6 +150,11 @@ extern SDLVehicleDataType const SDLVehicleDataTypeAccelerationPedal; extern SDLVehicleDataType const SDLVehicleDataTypeSteeringWheel; /** - Electronic parking brake status + Vehicle electronic parking brake status data */ extern SDLVehicleDataType const SDLVehicleDataTypeElectronicParkBrakeStatus; + +/** + Vehicle turn signal data + */ +extern SDLVehicleDataType const SDLVehicleDataTypeTurnSignal; diff --git a/SmartDeviceLink/SDLVehicleDataType.m b/SmartDeviceLink/SDLVehicleDataType.m index c115b3056..4b37a2456 100644 --- a/SmartDeviceLink/SDLVehicleDataType.m +++ b/SmartDeviceLink/SDLVehicleDataType.m @@ -33,3 +33,5 @@ SDLVehicleDataType const SDLVehicleDataTypeEngineTorque = @"VEHICLEDATA_ENGINETO SDLVehicleDataType const SDLVehicleDataTypeAccelerationPedal = @"VEHICLEDATA_ACCPEDAL"; SDLVehicleDataType const SDLVehicleDataTypeSteeringWheel = @"VEHICLEDATA_STEERINGWHEEL"; SDLVehicleDataType const SDLVehicleDataTypeElectronicParkBrakeStatus = @"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS"; +SDLVehicleDataType const SDLVehicleDataTypeTurnSignal = @"VEHICLEDATA_TURNSIGNAL"; + diff --git a/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink/SmartDeviceLink.h index 840bcdc07..26848436e 100644 --- a/SmartDeviceLink/SmartDeviceLink.h +++ b/SmartDeviceLink/SmartDeviceLink.h @@ -279,6 +279,7 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[]; #import "SDLTouchType.h" #import "SDLTPMS.h" #import "SDLTriggerSource.h" +#import "SDLTurnSignal.h" #import "SDLUpdateMode.h" #import "SDLVehicleDataActiveStatus.h" #import "SDLVehicleDataEventStatus.h" diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLTurnSignalSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLTurnSignalSpec.m new file mode 100644 index 000000000..6be1c9439 --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLTurnSignalSpec.m @@ -0,0 +1,27 @@ +// +// SDLTurnSignalSpec.m +// SmartDeviceLinkTests +// +// Created by Nicole on 7/19/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLTurnSignal.h" + +QuickSpecBegin(SDLTurnSignalSpec) + +describe(@"Individual Enum Value Tests", ^ { + it(@"Should match internal values", ^ { + expect(SDLTurnSignalOff).to(equal(@"OFF")); + expect(SDLTurnSignalLeft).to(equal(@"LEFT")); + expect(SDLTurnSignalRight).to(equal(@"RIGHT")); + expect(SDLTurnSignalBoth).to(equal(@"BOTH")); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m index c589b2b24..2d9812475 100644 --- a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVehicleDataTypeSpec.m @@ -43,6 +43,7 @@ describe(@"Individual Enum Value Tests", ^ { expect(SDLVehicleDataTypeAccelerationPedal).to(equal(@"VEHICLEDATA_ACCPEDAL")); expect(SDLVehicleDataTypeSteeringWheel).to(equal(@"VEHICLEDATA_STEERINGWHEEL")); expect(SDLVehicleDataTypeElectronicParkBrakeStatus).to(equal(@"VEHICLEDATA_ELECTRONICPARKBRAKESTATUS")); + expect(SDLVehicleDataTypeTurnSignal).to(equal(@"VEHICLEDATA_TURNSIGNAL")); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m index c0e77af56..aba995df9 100644 --- a/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/NotificationSpecs/SDLOnVehicleDataSpec.m @@ -57,6 +57,7 @@ describe(@"Getter/Setter Tests", ^ { testNotification.speed = @70.1; testNotification.steeringWheelAngle = @0.000000001; testNotification.tirePressure = tires; + testNotification.turnSignal = SDLTurnSignalRight; testNotification.vin = @"222222222722"; testNotification.wiperStatus = SDLWiperStatusStalled; @@ -86,42 +87,44 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.speed).to(equal(@70.1)); expect(testNotification.steeringWheelAngle).to(equal(@0.000000001)); expect(testNotification.tirePressure).to(equal(tires)); + expect(testNotification.turnSignal).to(equal(SDLTurnSignalRight)); expect(testNotification.vin).to(equal(@"222222222722")); expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled)); }); it(@"Should get correctly when initialized", ^ { NSDictionary* dict = @{SDLNameNotification: - @{SDLNameParameters: - @{SDLNameAccelerationPedalPosition:@99.99999999, - SDLNameAirbagStatus:airbag, - SDLNameBeltStatus:belt, - SDLNameBodyInformation:body, - SDLNameClusterModeStatus:clusterMode, - SDLNameDeviceStatus:device, - SDLNameDriverBraking:SDLVehicleDataEventStatusYes, - SDLNameECallInfo:eCall, - SDLNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, - SDLNameEmergencyEvent:event, - SDLNameEngineOilLife:@45.1, - SDLNameEngineTorque:@-200.124, - SDLNameExternalTemperature:@-10, - SDLNameFuelLevel:@10.3, - SDLNameFuelLevelState:SDLComponentVolumeStatusAlert, - SDLNameFuelRange:@[fuelRange], - SDLNameGPS:gps, - SDLNameHeadLampStatus:headLamp, - SDLNameInstantFuelConsumption:@4000.63, - SDLNameMyKey:myKey, - SDLNameOdometer:@100050, - SDLNamePRNDL:SDLPRNDLDrive, - SDLNameRPM:@4242, - SDLNameSpeed:@70.1, - SDLNameSteeringWheelAngle:@0.000000001, - SDLNameTirePressure:tires, - SDLNameVIN:@"222222222722", - SDLNameWiperStatus:SDLWiperStatusStalled}, - SDLNameOperationName:SDLNameOnVehicleData}}; + @{SDLNameParameters: + @{SDLNameAccelerationPedalPosition:@99.99999999, + SDLNameAirbagStatus:airbag, + SDLNameBeltStatus:belt, + SDLNameBodyInformation:body, + SDLNameClusterModeStatus:clusterMode, + SDLNameDeviceStatus:device, + SDLNameDriverBraking:SDLVehicleDataEventStatusYes, + SDLNameECallInfo:eCall, + SDLNameElectronicParkBrakeStatus:SDLElectronicParkBrakeStatusDriveActive, + SDLNameEmergencyEvent:event, + SDLNameEngineOilLife:@45.1, + SDLNameEngineTorque:@-200.124, + SDLNameExternalTemperature:@-10, + SDLNameFuelLevel:@10.3, + SDLNameFuelLevelState:SDLComponentVolumeStatusAlert, + SDLNameFuelRange:@[fuelRange], + SDLNameGPS:gps, + SDLNameHeadLampStatus:headLamp, + SDLNameInstantFuelConsumption:@4000.63, + SDLNameMyKey:myKey, + SDLNameOdometer:@100050, + SDLNamePRNDL:SDLPRNDLDrive, + SDLNameRPM:@4242, + SDLNameSpeed:@70.1, + SDLNameSteeringWheelAngle:@0.000000001, + SDLNameTirePressure:tires, + SDLNameTurnSignal:SDLTurnSignalOff, + SDLNameVIN:@"222222222722", + SDLNameWiperStatus:SDLWiperStatusStalled}, + SDLNameOperationName:SDLNameOnVehicleData}}; SDLOnVehicleData* testNotification = [[SDLOnVehicleData alloc] initWithDictionary:dict]; expect(testNotification.accPedalPosition).to(equal(@99.99999999)); @@ -150,6 +153,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.speed).to(equal(@70.1)); expect(testNotification.steeringWheelAngle).to(equal(@0.000000001)); expect(testNotification.tirePressure).to(equal(tires)); + expect(testNotification.turnSignal).to(equal(SDLTurnSignalOff)); expect(testNotification.vin).to(equal(@"222222222722")); expect(testNotification.wiperStatus).to(equal(SDLWiperStatusStalled)); }); @@ -183,6 +187,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testNotification.speed).to(beNil()); expect(testNotification.steeringWheelAngle).to(beNil()); expect(testNotification.tirePressure).to(beNil()); + expect(testNotification.turnSignal).to(beNil()); expect(testNotification.vin).to(beNil()); expect(testNotification.wiperStatus).to(beNil()); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m index 4bdaf74d8..d5575fe7b 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLGetVehicleDataSpec.m @@ -43,6 +43,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @NO; testRequest.steeringWheelAngle = @NO; testRequest.tirePressure = @NO; + testRequest.turnSignal = @YES; testRequest.wiperStatus = @NO; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -71,6 +72,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@NO)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@NO)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@NO)); }); @@ -103,6 +105,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameSpeed:@YES, SDLNameSteeringWheelAngle:@NO, SDLNameTirePressure:@YES, + SDLNameTurnSignal:@NO, SDLNameWiperStatus:@YES}, SDLNameOperationName:SDLNameGetVehicleData}}; SDLGetVehicleData* testRequest = [[SDLGetVehicleData alloc] initWithDictionary:dict]; @@ -133,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); @@ -167,6 +171,7 @@ describe(@"initializers", ^{ 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()); }); @@ -199,11 +204,12 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); 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:", ^{ - SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES vin:YES wiperStatus:YES]; + SDLGetVehicleData *testRequest = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES vin:YES wiperStatus:YES]; expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); @@ -231,6 +237,7 @@ describe(@"initializers", ^{ 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)); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m index b15b7d71b..3ec8a0adb 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSubscribeVehicleDataSpec.m @@ -43,6 +43,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @NO; testRequest.steeringWheelAngle = @NO; testRequest.tirePressure = @NO; + testRequest.turnSignal = @YES; testRequest.wiperStatus = @NO; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -71,40 +72,42 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@NO)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@NO)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@NO)); }); it(@"Should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLNameRequest: - @{SDLNameParameters: - @{SDLNameAccelerationPedalPosition:@YES, - SDLNameAirbagStatus:@YES, - SDLNameBeltStatus:@YES, - SDLNameBodyInformation:@YES, - SDLNameClusterModeStatus:@YES, - SDLNameDeviceStatus:@YES, - SDLNameDriverBraking:@YES, - SDLNameECallInfo:@YES, - SDLNameElectronicParkBrakeStatus: @YES, - SDLNameEmergencyEvent:@NO, - SDLNameEngineOilLife:@YES, - SDLNameEngineTorque:@YES, - SDLNameExternalTemperature:@NO, - SDLNameFuelLevel:@YES, - SDLNameFuelLevelState:@YES, - SDLNameFuelRange:@YES, - SDLNameGPS:@YES, - SDLNameHeadLampStatus:@YES, - SDLNameInstantFuelConsumption:@YES, - SDLNameMyKey:@YES, - SDLNameOdometer:@YES, - SDLNamePRNDL:@YES, - SDLNameRPM:@YES, - SDLNameSpeed:@YES, - SDLNameSteeringWheelAngle:@NO, - SDLNameTirePressure:@YES, - SDLNameWiperStatus:@NO}, - SDLNameOperationName:SDLNameSubscribeVehicleData}}; + @{SDLNameParameters: + @{SDLNameAccelerationPedalPosition:@YES, + SDLNameAirbagStatus:@YES, + SDLNameBeltStatus:@YES, + SDLNameBodyInformation:@YES, + SDLNameClusterModeStatus:@YES, + SDLNameDeviceStatus:@YES, + SDLNameDriverBraking:@YES, + SDLNameECallInfo:@YES, + SDLNameElectronicParkBrakeStatus: @YES, + SDLNameEmergencyEvent:@NO, + SDLNameEngineOilLife:@YES, + SDLNameEngineTorque:@YES, + SDLNameExternalTemperature:@NO, + SDLNameFuelLevel:@YES, + SDLNameFuelLevelState:@YES, + SDLNameFuelRange:@YES, + SDLNameGPS:@YES, + SDLNameHeadLampStatus:@YES, + SDLNameInstantFuelConsumption:@YES, + SDLNameMyKey:@YES, + SDLNameOdometer:@YES, + SDLNamePRNDL:@YES, + SDLNameRPM:@YES, + SDLNameSpeed:@YES, + SDLNameSteeringWheelAngle:@NO, + SDLNameTirePressure:@YES, + SDLNameTurnSignal:@NO, + SDLNameWiperStatus:@NO}, + SDLNameOperationName:SDLNameSubscribeVehicleData}}; SDLSubscribeVehicleData* testRequest = [[SDLSubscribeVehicleData alloc] initWithDictionary:dict]; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -133,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@NO)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@NO)); }); }); @@ -167,11 +171,12 @@ describe(@"initializers", ^{ 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()); }); 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:", ^{ - 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 wiperStatus:YES]; + 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]; expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); @@ -199,6 +204,7 @@ describe(@"initializers", ^{ 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)); }); @@ -231,6 +237,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m index eeb4e8870..d571d743e 100644 --- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLUnsubscribeVehicleDataSpec.m @@ -43,6 +43,7 @@ describe(@"Getter/Setter Tests", ^ { testRequest.speed = @YES; testRequest.steeringWheelAngle = @YES; testRequest.tirePressure = @YES; + testRequest.turnSignal = @NO; testRequest.wiperStatus = @YES; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -71,40 +72,42 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); it(@"Should get correctly when initialized", ^ { NSDictionary<NSString *, id> *dict = @{SDLNameRequest: - @{SDLNameParameters: - @{SDLNameAccelerationPedalPosition:@YES, - SDLNameAirbagStatus:@YES, - SDLNameBeltStatus:@YES, - SDLNameBodyInformation:@YES, - SDLNameClusterModeStatus:@YES, - SDLNameDeviceStatus:@YES, - SDLNameDriverBraking:@YES, - SDLNameECallInfo:@YES, - SDLNameElectronicParkBrakeStatus: @YES, - SDLNameEmergencyEvent:@YES, - SDLNameEngineOilLife:@YES, - SDLNameEngineTorque:@YES, - SDLNameExternalTemperature:@YES, - SDLNameFuelLevel:@YES, - SDLNameFuelLevelState:@YES, - SDLNameFuelRange:@YES, - SDLNameGPS:@YES, - SDLNameHeadLampStatus:@YES, - SDLNameInstantFuelConsumption:@YES, - SDLNameMyKey:@YES, - SDLNameOdometer:@YES, - SDLNamePRNDL:@YES, - SDLNameRPM:@YES, - SDLNameSpeed:@YES, - SDLNameSteeringWheelAngle:@YES, - SDLNameTirePressure:@YES, - SDLNameWiperStatus:@YES}, - SDLNameOperationName:SDLNameUnsubscribeVehicleData}}; + @{SDLNameParameters: + @{SDLNameAccelerationPedalPosition:@YES, + SDLNameAirbagStatus:@YES, + SDLNameBeltStatus:@YES, + SDLNameBodyInformation:@YES, + SDLNameClusterModeStatus:@YES, + SDLNameDeviceStatus:@YES, + SDLNameDriverBraking:@YES, + SDLNameECallInfo:@YES, + SDLNameElectronicParkBrakeStatus: @YES, + SDLNameEmergencyEvent:@YES, + SDLNameEngineOilLife:@YES, + SDLNameEngineTorque:@YES, + SDLNameExternalTemperature:@YES, + SDLNameFuelLevel:@YES, + SDLNameFuelLevelState:@YES, + SDLNameFuelRange:@YES, + SDLNameGPS:@YES, + SDLNameHeadLampStatus:@YES, + SDLNameInstantFuelConsumption:@YES, + SDLNameMyKey:@YES, + SDLNameOdometer:@YES, + SDLNamePRNDL:@YES, + SDLNameRPM:@YES, + SDLNameSpeed:@YES, + SDLNameSteeringWheelAngle:@YES, + SDLNameTirePressure:@YES, + SDLNameTurnSignal:@YES, + SDLNameWiperStatus:@YES}, + SDLNameOperationName:SDLNameUnsubscribeVehicleData}}; SDLUnsubscribeVehicleData* testRequest = [[SDLUnsubscribeVehicleData alloc] initWithDictionary:dict]; expect(testRequest.accPedalPosition).to(equal(@YES)); @@ -133,6 +136,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@YES)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); @@ -167,11 +171,12 @@ describe(@"initializers", ^{ 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()); }); - 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:", ^{ - SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData 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 wiperStatus:YES]; + context(@"initWithAccelerationPedalPosition:airbagStatus:beltStatus:bodyInformation:clusterModeStatus:deviceStatus:driverBraking:eCallInfo:electronicParkBrakeStatus:emergencyEvent:engineOilLife:engineTorque:externalTemperature:fuelLevel:fuelLevelState:gps:headLampStatus:instantFuelConsumption:myKey:odometer:prndl:rpm:speed:steeringWheelAngle:tirePressure:turnSignal:wiperStatus:", ^{ + SDLUnsubscribeVehicleData *testRequest = [[SDLUnsubscribeVehicleData 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]; expect(testRequest.accPedalPosition).to(equal(@YES)); expect(testRequest.airbagStatus).to(equal(@YES)); @@ -199,6 +204,7 @@ describe(@"initializers", ^{ 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)); }); @@ -231,6 +237,7 @@ describe(@"initializers", ^{ expect(testRequest.speed).to(equal(@YES)); expect(testRequest.steeringWheelAngle).to(equal(@YES)); expect(testRequest.tirePressure).to(equal(@YES)); + expect(testRequest.turnSignal).to(equal(@NO)); expect(testRequest.wiperStatus).to(equal(@YES)); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m index fa1e436be..9d7a69713 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLGetVehicleDataResponseSpec.m @@ -57,6 +57,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.speed = @100; testResponse.steeringWheelAngle = @-1500; testResponse.tirePressure = tires; + testResponse.turnSignal = SDLTurnSignalBoth; testResponse.vin = @"6574839201"; testResponse.wiperStatus = SDLWiperStatusAutomaticHigh; @@ -86,6 +87,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(equal(@100)); expect(testResponse.steeringWheelAngle).to(equal(@-1500)); expect(testResponse.tirePressure).to(equal(tires)); + expect(testResponse.turnSignal).to(equal(SDLTurnSignalBoth)); expect(testResponse.vin).to(equal(@"6574839201")); expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); }); @@ -120,6 +122,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameSpeed:@100, SDLNameSteeringWheelAngle:@-1500, SDLNameTirePressure:tires, + SDLNameTurnSignal:SDLTurnSignalOff, SDLNameVIN:@"6574839201", SDLNameWiperStatus:SDLWiperStatusAutomaticHigh}, SDLNameOperationName:SDLNameGetVehicleData}} mutableCopy]; @@ -151,6 +154,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(equal(@100)); expect(testResponse.steeringWheelAngle).to(equal(@-1500)); expect(testResponse.tirePressure).to(equal(tires)); + expect(testResponse.turnSignal).to(equal(SDLTurnSignalOff)); expect(testResponse.vin).to(equal(@"6574839201")); expect(testResponse.wiperStatus).to(equal(SDLWiperStatusAutomaticHigh)); }); @@ -184,6 +188,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.speed).to(beNil()); expect(testResponse.steeringWheelAngle).to(beNil()); expect(testResponse.tirePressure).to(beNil()); + expect(testResponse.turnSignal).to(beNil()); expect(testResponse.vin).to(beNil()); expect(testResponse.wiperStatus).to(beNil()); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m index a7e184155..aa8000b14 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSubscribeVehicleDataResponseSpec.m @@ -47,6 +47,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.speed = vehicleDataResult; testResponse.steeringWheelAngle = vehicleDataResult; testResponse.tirePressure = vehicleDataResult; + testResponse.turnSignal = vehicleDataResult; testResponse.wiperStatus = vehicleDataResult; expect(testResponse.accPedalPosition).to(equal(vehicleDataResult)); @@ -75,6 +76,7 @@ describe(@"Getter/Setter Tests", ^ { 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)); }); @@ -107,6 +109,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameSpeed:vehicleDataResult, SDLNameSteeringWheelAngle:vehicleDataResult, SDLNameTirePressure:vehicleDataResult, + SDLNameTurnSignal:vehicleDataResult, SDLNameWiperStatus:vehicleDataResult}, SDLNameOperationName:SDLNameSubscribeVehicleData}}; SDLSubscribeVehicleDataResponse* testResponse = [[SDLSubscribeVehicleDataResponse alloc] initWithDictionary:dict]; @@ -137,6 +140,7 @@ describe(@"Getter/Setter Tests", ^ { 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)); }); @@ -169,6 +173,7 @@ describe(@"Getter/Setter Tests", ^ { 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()); }); }); diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m index c95b7af37..8af7ef673 100644 --- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLUnsubscribeVehicleDataResponseSpec.m @@ -48,6 +48,7 @@ describe(@"Getter/Setter Tests", ^ { testResponse.clusterModes = vehicleDataResult; testResponse.myKey = vehicleDataResult; testResponse.electronicParkBrakeStatus = vehicleDataResult; + testResponse.turnSignal = vehicleDataResult; expect(testResponse.gps).to(equal(vehicleDataResult)); expect(testResponse.speed).to(equal(vehicleDataResult)); @@ -76,6 +77,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.clusterModes).to(equal(vehicleDataResult)); expect(testResponse.myKey).to(equal(vehicleDataResult)); expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); }); it(@"Should get correctly when initialized", ^ { @@ -108,6 +110,7 @@ describe(@"Getter/Setter Tests", ^ { SDLNameClusterModes:vehicleDataResult, SDLNameMyKey:vehicleDataResult, SDLNameElectronicParkBrakeStatus:vehicleDataResult, + SDLNameTurnSignal:vehicleDataResult, }, SDLNameOperationName:SDLNameUnsubscribeVehicleData}} mutableCopy]; SDLUnsubscribeVehicleDataResponse* testResponse = [[SDLUnsubscribeVehicleDataResponse alloc] initWithDictionary:dict]; @@ -139,6 +142,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.clusterModes).to(equal(vehicleDataResult)); expect(testResponse.myKey).to(equal(vehicleDataResult)); expect(testResponse.electronicParkBrakeStatus).to(equal(vehicleDataResult)); + expect(testResponse.turnSignal).to(equal(vehicleDataResult)); }); it(@"Should return nil if not set", ^ { @@ -171,6 +175,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testResponse.clusterModes).to(beNil()); expect(testResponse.myKey).to(beNil()); expect(testResponse.electronicParkBrakeStatus).to(beNil()); + expect(testResponse.turnSignal).to(beNil()); }); }); diff --git a/SmartDeviceLink_Example/AppConstants.h b/SmartDeviceLink_Example/AppConstants.h index 7cfd0bb60..649909d43 100644 --- a/SmartDeviceLink_Example/AppConstants.h +++ b/SmartDeviceLink_Example/AppConstants.h @@ -100,6 +100,7 @@ extern NSString * const ACRPMMenuName; extern NSString * const ACSpeedMenuName; extern NSString * const ACSteeringWheelAngleMenuName; extern NSString * const ACTirePressureMenuName; +extern NSString * const ACTurnSignalMenuName; extern NSString * const ACVINMenuName; extern NSString * const ACWiperStatusMenuName; diff --git a/SmartDeviceLink_Example/AppConstants.m b/SmartDeviceLink_Example/AppConstants.m index f2f3c8bfc..490016105 100644 --- a/SmartDeviceLink_Example/AppConstants.m +++ b/SmartDeviceLink_Example/AppConstants.m @@ -98,6 +98,7 @@ NSString * const ACRPMMenuName = @"RPM"; NSString * const ACSpeedMenuName = @"Speed"; NSString * const ACSteeringWheelAngleMenuName = @"Steering Wheel Angle"; NSString * const ACTirePressureMenuName = @"Tire Pressure"; +NSString * const ACTurnSignalMenuName = @"Turn Signal"; NSString * const ACVINMenuName = @"VIN"; NSString * const ACWiperStatusMenuName = @"Wiper Status"; diff --git a/SmartDeviceLink_Example/MenuManager.m b/SmartDeviceLink_Example/MenuManager.m index a43d5c10f..1a7a86db3 100644 --- a/SmartDeviceLink_Example/MenuManager.m +++ b/SmartDeviceLink_Example/MenuManager.m @@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN } + (NSArray<NSString *> *)sdlex_allVehicleDataTypes { - return @[ACAccelerationPedalPositionMenuName, ACAirbagStatusMenuName, ACBeltStatusMenuName, ACBodyInformationMenuName, ACClusterModeStatusMenuName, ACDeviceStatusMenuName, ACDriverBrakingMenuName, ACECallInfoMenuName, ACElectronicParkBrakeStatus, ACEmergencyEventMenuName, ACEngineOilLifeMenuName, ACEngineTorqueMenuName, ACExternalTemperatureMenuName, ACFuelLevelMenuName, ACFuelLevelStateMenuName, ACFuelRangeMenuName, ACGPSMenuName, ACHeadLampStatusMenuName, ACInstantFuelConsumptionMenuName, ACMyKeyMenuName, ACOdometerMenuName, ACPRNDLMenuName, ACRPMMenuName, ACSpeedMenuName, ACSteeringWheelAngleMenuName, ACTirePressureMenuName, ACVINMenuName, ACWiperStatusMenuName]; + return @[ACAccelerationPedalPositionMenuName, ACAirbagStatusMenuName, ACBeltStatusMenuName, ACBodyInformationMenuName, ACClusterModeStatusMenuName, ACDeviceStatusMenuName, ACDriverBrakingMenuName, ACECallInfoMenuName, ACElectronicParkBrakeStatus, ACEmergencyEventMenuName, ACEngineOilLifeMenuName, ACEngineTorqueMenuName, ACExternalTemperatureMenuName, ACFuelLevelMenuName, ACFuelLevelStateMenuName, ACFuelRangeMenuName, ACGPSMenuName, ACHeadLampStatusMenuName, ACInstantFuelConsumptionMenuName, ACMyKeyMenuName, ACOdometerMenuName, ACPRNDLMenuName, ACRPMMenuName, ACSpeedMenuName, ACSteeringWheelAngleMenuName, ACTirePressureMenuName, ACTurnSignalMenuName, ACVINMenuName, ACWiperStatusMenuName]; } + (SDLMenuCell *)sdlex_menuCellShowPerformInteractionWithManager:(SDLManager *)manager performManager:(PerformInteractionManager *)performManager { diff --git a/SmartDeviceLink_Example/MenuManager.swift b/SmartDeviceLink_Example/MenuManager.swift index cd7ab76bb..959265a74 100644 --- a/SmartDeviceLink_Example/MenuManager.swift +++ b/SmartDeviceLink_Example/MenuManager.swift @@ -69,7 +69,7 @@ private extension MenuManager { /// A list of all possible vehicle data types static var allVehicleDataTypes: [String] { - return [ACAccelerationPedalPositionMenuName, ACAirbagStatusMenuName, ACBeltStatusMenuName, ACBodyInformationMenuName, ACClusterModeStatusMenuName, ACDeviceStatusMenuName, ACDriverBrakingMenuName, ACECallInfoMenuName, ACElectronicParkBrakeStatus, ACEmergencyEventMenuName, ACEngineOilLifeMenuName, ACEngineTorqueMenuName, ACExternalTemperatureMenuName, ACFuelLevelMenuName, ACFuelLevelStateMenuName, ACFuelRangeMenuName, ACGPSMenuName, ACHeadLampStatusMenuName, ACInstantFuelConsumptionMenuName, ACMyKeyMenuName, ACOdometerMenuName, ACPRNDLMenuName, ACRPMMenuName, ACSpeedMenuName, ACSteeringWheelAngleMenuName, ACTirePressureMenuName, ACVINMenuName, ACWiperStatusMenuName] + return [ACAccelerationPedalPositionMenuName, ACAirbagStatusMenuName, ACBeltStatusMenuName, ACBodyInformationMenuName, ACClusterModeStatusMenuName, ACDeviceStatusMenuName, ACDriverBrakingMenuName, ACECallInfoMenuName, ACElectronicParkBrakeStatus, ACEmergencyEventMenuName, ACEngineOilLifeMenuName, ACEngineTorqueMenuName, ACExternalTemperatureMenuName, ACFuelLevelMenuName, ACFuelLevelStateMenuName, ACFuelRangeMenuName, ACGPSMenuName, ACHeadLampStatusMenuName, ACInstantFuelConsumptionMenuName, ACMyKeyMenuName, ACOdometerMenuName, ACPRNDLMenuName, ACRPMMenuName, ACSpeedMenuName, ACSteeringWheelAngleMenuName, ACTirePressureMenuName, ACTurnSignalMenuName, ACVINMenuName, ACWiperStatusMenuName] } /// Menu item that shows a custom menu (i.e. a Perform Interaction Choice Set) when selected diff --git a/SmartDeviceLink_Example/TextValidator.h b/SmartDeviceLink_Example/TextValidator.h new file mode 100644 index 000000000..df8a12321 --- /dev/null +++ b/SmartDeviceLink_Example/TextValidator.h @@ -0,0 +1,19 @@ +// +// TextValidator.h +// SmartDeviceLink +// +// Created by Nicole on 7/20/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface TextValidator : NSObject + ++ (NSString *)validateText:(NSString *)text length:(UInt8)length; + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink_Example/TextValidator.m b/SmartDeviceLink_Example/TextValidator.m new file mode 100644 index 000000000..2e14c4797 --- /dev/null +++ b/SmartDeviceLink_Example/TextValidator.m @@ -0,0 +1,43 @@ +// +// TextValidator.m +// SmartDeviceLink +// +// Created by Nicole on 7/20/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +#import "TextValidator.h" + +@implementation TextValidator + +static NSString *validCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. "; + ++ (NSString *)validateText:(NSString *)text length:(UInt8)length { + if (text.length == 0) { return text; } + NSString *filteredText = [self sdlex_filterUnsupportedCharactersFromText:text]; + NSString *condensedText = [self sdlex_condenseWhitespace:filteredText]; + NSString *truncatedText = [self sdlex_truncateText:condensedText length:length]; + return truncatedText; +} + ++ (NSString *)sdlex_filterUnsupportedCharactersFromText:(NSString *)text { + NSCharacterSet *supportedCharacters = [NSCharacterSet characterSetWithCharactersInString:validCharacters]; + return [[text componentsSeparatedByCharactersInSet:supportedCharacters.invertedSet] componentsJoinedByString:@" "]; +} + ++ (NSString *)sdlex_truncateText:(NSString *)text length:(UInt8)length { + return [text substringToIndex:MIN(length, text.length)]; +} + ++ (NSString *)sdlex_condenseWhitespace:(NSString *)text { + NSArray<NSString *> *components = [text componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + + NSMutableArray<NSString *> *nonEmptyComponents = [NSMutableArray array]; + for (NSString *string in components) { + if (string.length == 0) { continue; } + [nonEmptyComponents addObject:string]; + } + return [nonEmptyComponents componentsJoinedByString:@" "]; +} + +@end diff --git a/SmartDeviceLink_Example/TextValidator.swift b/SmartDeviceLink_Example/TextValidator.swift new file mode 100644 index 000000000..3c0e5645e --- /dev/null +++ b/SmartDeviceLink_Example/TextValidator.swift @@ -0,0 +1,36 @@ +// +// TextValidator.swift +// SmartDeviceLink +// +// Created by Nicole on 7/20/18. +// Copyright © 2018 smartdevicelink. All rights reserved. +// + +import Foundation + +class TextValidator { + private static let validCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. " + + class func validateText(_ text: String, length: Int) -> String { + if text.isEmpty { return text } + let filteredText = filterUnsupportedCharacters(text) + let condensedString = filteredText.condenseWhitespace + let truncatedString = condensedString.truncate(length: length) + return truncatedString + } + + private class func filterUnsupportedCharacters(_ text:String) -> String { + return String(text.filter { validCharacters.contains($0) } ) + } +} + +extension String { + func truncate(length: Int, trailing: String = "…") -> String { + return (self.count > length) ? self.prefix(length) + trailing : self + } + + var condenseWhitespace: String { + let components = self.components(separatedBy: .whitespacesAndNewlines) + return components.filter { !$0.isEmpty }.joined(separator: " ") + } +} diff --git a/SmartDeviceLink_Example/VehicleDataManager.m b/SmartDeviceLink_Example/VehicleDataManager.m index 972375d00..999a22616 100644 --- a/SmartDeviceLink_Example/VehicleDataManager.m +++ b/SmartDeviceLink_Example/VehicleDataManager.m @@ -7,9 +7,10 @@ // #import "AlertManager.h" -#import "VehicleDataManager.h" #import "AppConstants.h" #import "SmartDeviceLink.h" +#import "TextValidator.h" +#import "VehicleDataManager.h" NS_ASSUME_NONNULL_BEGIN @@ -127,12 +128,12 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Get Vehicle Data /** - * Retreives the current vehicle speed + * Retreives the current vehicle data * - * @param manager The SDL manager + * @param manager The SDL Manager + * @param triggerSource Whether the menu item was selected by voice or touch + * @param vehicleDataType The vehicle data to look for */ - - + (void)getAllVehicleDataWithManager:(SDLManager *)manager triggerSource:(SDLTriggerSource)triggerSource vehicleDataType:(NSString *)vehicleDataType { SDLLogD(@"Checking if app has permission to access vehicle data..."); if (![manager.permissionManager isRPCAllowed:@"GetVehicleData"]) { @@ -141,9 +142,9 @@ NS_ASSUME_NONNULL_BEGIN } SDLLogD(@"App has permission to access vehicle data. Requesting vehicle data..."); - SDLGetVehicleData *getVehicleSpeed = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES vin:YES wiperStatus:YES]; + SDLGetVehicleData *getAllVehicleData = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES vin:YES wiperStatus:YES]; - [manager sendRequest:getVehicleSpeed withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { + [manager sendRequest:getAllVehicleData withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { if (error || ![response isKindOfClass:SDLGetVehicleDataResponse.class]) { [manager sendRequest:[AlertManager alertWithMessageAndCloseButton:@"Something went wrong while getting vehicle data" textField2:nil]]; return; @@ -152,30 +153,39 @@ NS_ASSUME_NONNULL_BEGIN SDLGetVehicleDataResponse *getVehicleDataResponse = (SDLGetVehicleDataResponse *)response; SDLResult resultCode = getVehicleDataResponse.resultCode; - NSMutableString *alertMessage = [NSMutableString string]; + NSString *alertTitle = vehicleDataType; + NSString *alertMessage = nil; + if ([resultCode isEqualToEnum:SDLResultRejected]) { SDLLogD(@"The request for vehicle data was rejected"); - [alertMessage appendString:@"Rejected"]; + alertMessage = @"Rejected"; } else if ([resultCode isEqualToEnum:SDLResultDisallowed]) { SDLLogD(@"This app does not have the required permissions to access vehicle data."); - [alertMessage appendString:@"Disallowed"]; + alertMessage = @"Disallowed"; } else if ([resultCode isEqualToEnum:SDLResultSuccess] || [resultCode isEqualToEnum:SDLResultDataNotAvailable]) { SDLLogD(@"Request for vehicle data successful"); if (getVehicleDataResponse) { - NSString *vehicleDataTypeDescription = [self sdlex_vehicleDataDescription:getVehicleDataResponse vehicleDataType:vehicleDataType]; - [alertMessage appendString:vehicleDataTypeDescription]; + alertMessage = [self sdlex_vehicleDataDescription:getVehicleDataResponse vehicleDataType:vehicleDataType]; } else { SDLLogE(@"No vehicle data returned"); - [alertMessage appendString:@"No vehicle data returned"]; + alertMessage = @"No vehicle data returned"; } } - [triggerSource isEqualToEnum:SDLTriggerSourceMenu] ? [manager sendRequest:[AlertManager alertWithMessageAndCloseButton:alertMessage textField2:nil]] : [manager sendRequest:[[SDLSpeak alloc] initWithTTS:alertMessage]]; + alertTitle = [TextValidator validateText:alertTitle length:25]; + alertMessage = [TextValidator validateText:alertMessage length:200]; + + if ([triggerSource isEqualToEnum:SDLTriggerSourceMenu]) { + [manager sendRequest:[AlertManager alertWithMessageAndCloseButton:alertTitle textField2:alertMessage]]; + } else { + NSString *spokenAlert = alertMessage ?: alertTitle; + [manager sendRequest:[[SDLSpeak alloc] initWithTTS:spokenAlert]]; + } }]; } + (NSString *)sdlex_vehicleDataDescription:(SDLGetVehicleDataResponse *)vehicleData vehicleDataType:(NSString *)vehicleDataType { - NSString *vehicleDataDescription = @""; + NSString *vehicleDataDescription = nil; if ([vehicleDataType isEqualToString:ACAccelerationPedalPositionMenuName]) { vehicleDataDescription = vehicleData.accPedalPosition.description; @@ -227,18 +237,13 @@ NS_ASSUME_NONNULL_BEGIN vehicleDataDescription = vehicleData.steeringWheelAngle.description; } else if ([vehicleDataType isEqualToString:ACTirePressureMenuName]) { vehicleDataDescription = vehicleData.tirePressure.description; + } else if ([vehicleDataType isEqualToString:ACTurnSignalMenuName]) { + vehicleDataDescription = vehicleData.turnSignal.description; } else if ([vehicleDataType isEqualToString: ACVINMenuName]) { vehicleDataDescription = vehicleData.vin.description; } - NSString *vehicleDataTypeDescription = [NSString stringWithFormat:@"%@: %@", vehicleDataType, vehicleDataDescription != nil ? vehicleDataDescription : @"Vehicle data not available"]; - - NSString *filteredNewlines = [vehicleDataTypeDescription stringByReplacingOccurrencesOfString:@"\\n" withString:@""]; - NSArray<NSString *> *filteredCharacters = [filteredNewlines componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :."] invertedSet]]; - NSString *filteredString = [filteredCharacters componentsJoinedByString:@" "]; - NSString *truncatedString = [filteredString substringToIndex:MIN(500, [filteredString length])]; - - return truncatedString; + return vehicleDataDescription ?: @"Vehicle data not available"; } #pragma mark - Phone Calls diff --git a/SmartDeviceLink_Example/VehicleDataManager.swift b/SmartDeviceLink_Example/VehicleDataManager.swift index bbd4e50d5..08b2881c3 100644 --- a/SmartDeviceLink_Example/VehicleDataManager.swift +++ b/SmartDeviceLink_Example/VehicleDataManager.swift @@ -111,41 +111,46 @@ extension VehicleDataManager { guard hasPermissionToAccessVehicleData(with: manager) else { return } SDLLog.d("App has permission to access vehicle data. Requesting all vehicle data...") - let getAllVehicleData = SDLGetVehicleData(accelerationPedalPosition: true, airbagStatus: true, beltStatus: true, bodyInformation: true, clusterModeStatus: true, deviceStatus: true, driverBraking: true, eCallInfo: true, electronicParkBrakeStatus: true, emergencyEvent: true, engineOilLife: true, engineTorque: true, externalTemperature: true, fuelLevel: true, fuelLevelState: true, fuelRange: true, gps: true, headLampStatus: true, instantFuelConsumption: true, myKey: true, odometer: true, prndl: true, rpm: true, speed: true, steeringWheelAngle: true, tirePressure: true, vin: true, wiperStatus: true) + let getAllVehicleData = SDLGetVehicleData(accelerationPedalPosition: true, airbagStatus: true, beltStatus: true, bodyInformation: true, clusterModeStatus: true, deviceStatus: true, driverBraking: true, eCallInfo: true, electronicParkBrakeStatus: true, emergencyEvent: true, engineOilLife: true, engineTorque: true, externalTemperature: true, fuelLevel: true, fuelLevelState: true, fuelRange: true, gps: true, headLampStatus: true, instantFuelConsumption: true, myKey: true, odometer: true, prndl: true, rpm: true, speed: true, steeringWheelAngle: true, tirePressure: true, turnSignal: true, vin: true, wiperStatus: true) manager.send(request: getAllVehicleData) { (request, response, error) in guard didAccessVehicleDataSuccessfully(with: manager, response: response, error: error) else { return } - var alertMessage = "" + var alertTitle: String = "" + var alertMessage: String = "" + switch response!.resultCode { case .rejected: SDLLog.d("The request for vehicle data was rejected") - alertMessage = "Rejected" + alertTitle = "Rejected" case .disallowed: SDLLog.d("This app does not have the required permissions to access vehicle data") - alertMessage = "Disallowed" + alertTitle = "Disallowed" case .success, .dataNotAvailable: if let vehicleData = response as? SDLGetVehicleDataResponse { + alertTitle = vehicleDataType alertMessage = vehicleDataDescription(vehicleData, vehicleDataType: vehicleDataType) + SDLLog.d("Request for \(vehicleDataType) vehicle data successful, \(alertMessage)") } else { - SDLLog.e("No vehicle data returned") - alertMessage = "No vehicle data returned" + alertTitle = "No vehicle data returned" + SDLLog.e(alertTitle) } - SDLLog.d("Request for vehicle data successful, \(alertMessage)") default: break } - triggerSource == .menu ? manager.send(AlertManager.alertWithMessageAndCloseButton(alertMessage.isEmpty ? "No data available" : alertMessage)) : manager.send(SDLSpeak(tts: alertMessage)) - } - } + alertTitle = TextValidator.validateText(alertTitle, length: 25) + alertMessage = TextValidator.validateText(alertMessage, length: 200) - class func createVehicleDataAlertMessage(response: SDLRPCResponse?, vehicleDataType: String) -> String { - if let vehicleData = response as? SDLGetVehicleDataResponse { - SDLLog.d("Some vehicle data returned successfully") - return vehicleDataDescription(vehicleData, vehicleDataType: vehicleDataType) - } else { - SDLLog.e("Vehicle data request successful, but no data was returned") - return "Unknown" + if triggerSource == .menu { + let title = !alertTitle.isEmpty ? alertTitle : "No Vehicle Data Available" + let detailMessage = !alertMessage.isEmpty ? alertMessage : nil + let alert = AlertManager.alertWithMessageAndCloseButton(title, + textField2: detailMessage) + manager.send(alert) + } else { + let spokenAlert = !alertMessage.isEmpty ? alertMessage : alertTitle + manager.send(SDLSpeak(tts: spokenAlert)) + } } } @@ -161,64 +166,63 @@ extension VehicleDataManager { var vehicleDataDescription = "" switch vehicleDataType { case ACAccelerationPedalPositionMenuName: - vehicleDataDescription += vehicleData.accPedalPosition?.description ?? notAvailable + vehicleDataDescription = vehicleData.accPedalPosition?.description ?? notAvailable case ACAirbagStatusMenuName: - vehicleDataDescription += vehicleData.airbagStatus?.description ?? notAvailable + vehicleDataDescription = vehicleData.airbagStatus?.description ?? notAvailable case ACBeltStatusMenuName: - vehicleDataDescription += vehicleData.beltStatus?.description ?? notAvailable + vehicleDataDescription = vehicleData.beltStatus?.description ?? notAvailable case ACBodyInformationMenuName: - vehicleDataDescription += vehicleData.bodyInformation?.description ?? notAvailable + vehicleDataDescription = vehicleData.bodyInformation?.description ?? notAvailable case ACClusterModeStatusMenuName: - vehicleDataDescription += vehicleData.clusterModeStatus?.description ?? notAvailable + vehicleDataDescription = vehicleData.clusterModeStatus?.description ?? notAvailable case ACDeviceStatusMenuName: - vehicleDataDescription += vehicleData.deviceStatus?.description ?? notAvailable + vehicleDataDescription = vehicleData.deviceStatus?.description ?? notAvailable case ACDriverBrakingMenuName: - vehicleDataDescription += vehicleData.driverBraking?.rawValue.rawValue ?? notAvailable + vehicleDataDescription = vehicleData.driverBraking?.rawValue.rawValue ?? notAvailable case ACECallInfoMenuName: - vehicleDataDescription += vehicleData.eCallInfo?.description ?? notAvailable + vehicleDataDescription = vehicleData.eCallInfo?.description ?? notAvailable case ACElectronicParkBrakeStatus: - vehicleDataDescription += vehicleData.electronicParkBrakeStatus?.rawValue.rawValue ?? notAvailable + vehicleDataDescription = vehicleData.electronicParkBrakeStatus?.rawValue.rawValue ?? notAvailable case ACEmergencyEventMenuName: - vehicleDataDescription += vehicleData.emergencyEvent?.description ?? notAvailable + vehicleDataDescription = vehicleData.emergencyEvent?.description ?? notAvailable case ACEngineOilLifeMenuName: - vehicleDataDescription += vehicleData.engineOilLife?.description ?? notAvailable + vehicleDataDescription = vehicleData.engineOilLife?.description ?? notAvailable case ACEngineTorqueMenuName: - vehicleDataDescription += vehicleData.engineTorque?.description ?? notAvailable + vehicleDataDescription = vehicleData.engineTorque?.description ?? notAvailable case ACExternalTemperatureMenuName: - vehicleDataDescription += vehicleData.externalTemperature?.description ?? notAvailable + vehicleDataDescription = vehicleData.externalTemperature?.description ?? notAvailable case ACFuelLevelMenuName: - vehicleDataDescription += vehicleData.fuelLevel?.description ?? notAvailable + vehicleDataDescription = vehicleData.fuelLevel?.description ?? notAvailable case ACFuelLevelStateMenuName: - vehicleDataDescription += vehicleData.fuelLevel_State?.rawValue.rawValue ?? notAvailable + vehicleDataDescription = vehicleData.fuelLevel_State?.rawValue.rawValue ?? notAvailable case ACFuelRangeMenuName: - vehicleDataDescription += vehicleData.fuelRange?.description ?? notAvailable + vehicleDataDescription = vehicleData.fuelRange?.description ?? notAvailable case ACGPSMenuName: - vehicleDataDescription += vehicleData.gps?.description ?? notAvailable + vehicleDataDescription = vehicleData.gps?.description ?? notAvailable case ACHeadLampStatusMenuName: - vehicleDataDescription += vehicleData.headLampStatus?.description ?? notAvailable + vehicleDataDescription = vehicleData.headLampStatus?.description ?? notAvailable case ACInstantFuelConsumptionMenuName: - vehicleDataDescription += vehicleData.instantFuelConsumption?.description ?? notAvailable + vehicleDataDescription = vehicleData.instantFuelConsumption?.description ?? notAvailable case ACMyKeyMenuName: - vehicleDataDescription += vehicleData.myKey?.description ?? notAvailable + vehicleDataDescription = vehicleData.myKey?.description ?? notAvailable case ACOdometerMenuName: - vehicleDataDescription += vehicleData.odometer?.description ?? notAvailable + vehicleDataDescription = vehicleData.odometer?.description ?? notAvailable case ACPRNDLMenuName: - vehicleDataDescription += vehicleData.prndl?.rawValue.rawValue ?? notAvailable + vehicleDataDescription = vehicleData.prndl?.rawValue.rawValue ?? notAvailable case ACSpeedMenuName: - vehicleDataDescription += vehicleData.speed?.description ?? notAvailable + vehicleDataDescription = vehicleData.speed?.description ?? notAvailable case ACSteeringWheelAngleMenuName: - vehicleDataDescription += vehicleData.steeringWheelAngle?.description ?? notAvailable + vehicleDataDescription = vehicleData.steeringWheelAngle?.description ?? notAvailable case ACTirePressureMenuName: - vehicleDataDescription += vehicleData.tirePressure?.description ?? notAvailable + vehicleDataDescription = vehicleData.tirePressure?.description ?? notAvailable + case ACTurnSignalMenuName: + vehicleDataDescription = vehicleData.turnSignal?.rawValue.rawValue ?? notAvailable case ACVINMenuName: - vehicleDataDescription += vehicleData.vin?.description ?? notAvailable + vehicleDataDescription = vehicleData.vin?.description ?? notAvailable default: break } - // Trim all non a-Z0-9 characters and truncate description to 500 characters - let alertMessage = "\(vehicleDataType): \(vehicleDataDescription)" - let alertMessageFiltered = String(alertMessage.filter { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :.".contains($0) }) - return alertMessageFiltered.trunc(length: 495, trailing: "") + return vehicleDataDescription } /// Checks if the app has the required permissions to access vehicle data @@ -293,9 +297,3 @@ extension VehicleDataManager { } } } - -extension String { - func trunc(length: Int, trailing: String = "…") -> String { - return (self.count > length) ? self.prefix(length) + trailing : self - } -} |