From 0043a4bf7a5fcefdafa0dd0f7973933c5bb2cca9 Mon Sep 17 00:00:00 2001 From: "Muller, Alexander (A.)" Date: Tue, 14 Feb 2017 09:24:32 -0800 Subject: Adding in check for nullable properties of video encoder callback --- SmartDeviceLink/SDLStreamingMediaManager.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m index d05daa93e..ab7cde8c5 100644 --- a/SmartDeviceLink/SDLStreamingMediaManager.m +++ b/SmartDeviceLink/SDLStreamingMediaManager.m @@ -384,13 +384,17 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark Callbacks -void sdl_videoEncoderOutputCallback(void *outputCallbackRefCon, void *sourceFrameRefCon, OSStatus status, VTEncodeInfoFlags infoFlags, CMSampleBufferRef sampleBuffer) { +void sdl_videoEncoderOutputCallback(void * CM_NULLABLE outputCallbackRefCon, void * CM_NULLABLE sourceFrameRefCon, OSStatus status, VTEncodeInfoFlags infoFlags, CM_NULLABLE CMSampleBufferRef sampleBuffer) { // If there was an error in the encoding, drop the frame if (status != noErr) { [SDLDebugTool logFormat:@"Error encoding video, err=%lld", (int64_t)status]; return; } + if (outputCallbackRefCon == NULL || sourceFrameRefCon == NULL || sampleBuffer == NULL) { + return; + } + SDLStreamingMediaManager *mediaManager = (__bridge SDLStreamingMediaManager *)sourceFrameRefCon; NSData *elementaryStreamData = [mediaManager.class sdl_encodeElementaryStreamWithSampleBuffer:sampleBuffer]; -- cgit v1.2.1 From a28888f62dd1431a62e0004bda2b5dc074672edd Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Wed, 15 Feb 2017 09:12:10 -0500 Subject: Xcode 8.3 beta 2 fixes * Fixes import file cases not matching actual file cases. * Fix copying some mutable properties that should be referenced. --- SmartDeviceLink/SDLConsoleController.m | 2 +- SmartDeviceLink/SDLFileManager.m | 2 +- SmartDeviceLink/SDLPerformInteraction.m | 2 +- SmartDeviceLink/SDLPermissionManager.m | 4 ++-- SmartDeviceLink/SDLRegisterAppInterfaceResponse.m | 2 +- SmartDeviceLink/SDLSetGlobalProperties.m | 2 +- SmartDeviceLink/SDLVrCapabilities.m | 2 +- SmartDeviceLink/SDLVrHelpItem.m | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SmartDeviceLink/SDLConsoleController.m b/SmartDeviceLink/SDLConsoleController.m index ade1c17df..fcbcd78a7 100644 --- a/SmartDeviceLink/SDLConsoleController.m +++ b/SmartDeviceLink/SDLConsoleController.m @@ -3,7 +3,7 @@ #import "SDLConsoleController.h" -#import "SDLJSONEncoder.h" +#import "SDLJsonEncoder.h" #import "SDLRPCResponse.h" diff --git a/SmartDeviceLink/SDLFileManager.m b/SmartDeviceLink/SDLFileManager.m index 86507224b..0321691ac 100644 --- a/SmartDeviceLink/SDLFileManager.m +++ b/SmartDeviceLink/SDLFileManager.m @@ -40,7 +40,7 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError"; @property (weak, nonatomic) id connectionManager; // Remote state -@property (copy, nonatomic, readwrite) NSMutableSet *mutableRemoteFileNames; +@property (strong, nonatomic, readwrite) NSMutableSet *mutableRemoteFileNames; @property (assign, nonatomic, readwrite) NSUInteger bytesAvailable; // Local state diff --git a/SmartDeviceLink/SDLPerformInteraction.m b/SmartDeviceLink/SDLPerformInteraction.m index 9496aa7a2..f769e835e 100644 --- a/SmartDeviceLink/SDLPerformInteraction.m +++ b/SmartDeviceLink/SDLPerformInteraction.m @@ -9,7 +9,7 @@ #import "SDLNames.h" #import "SDLTTSChunk.h" #import "SDLTTSChunkFactory.h" -#import "SDLVRHelpItem.h" +#import "SDLVrHelpItem.h" static UInt16 const SDLDefaultTimeout = 10000; diff --git a/SmartDeviceLink/SDLPermissionManager.m b/SmartDeviceLink/SDLPermissionManager.m index a6898ee55..af8df0ce9 100644 --- a/SmartDeviceLink/SDLPermissionManager.m +++ b/SmartDeviceLink/SDLPermissionManager.m @@ -23,8 +23,8 @@ NS_ASSUME_NONNULL_BEGIN @interface SDLPermissionManager () -@property (copy, nonatomic) NSMutableDictionary *permissions; -@property (copy, nonatomic) NSMutableArray *filters; +@property (strong, nonatomic) NSMutableDictionary *permissions; +@property (strong, nonatomic) NSMutableArray *filters; @property (copy, nonatomic, nullable) SDLHMILevel *currentHMILevel; @end diff --git a/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m b/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m index 18356c34f..0dcab3498 100644 --- a/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m +++ b/SmartDeviceLink/SDLRegisterAppInterfaceResponse.m @@ -16,7 +16,7 @@ #import "SDLSoftButtonCapabilities.h" #import "SDLSpeechCapabilities.h" #import "SDLSyncMsgVersion.h" -#import "SDLVRCapabilities.h" +#import "SDLVrCapabilities.h" #import "SDLVehicleType.h" diff --git a/SmartDeviceLink/SDLSetGlobalProperties.m b/SmartDeviceLink/SDLSetGlobalProperties.m index 490c1fc34..9c7a500e5 100644 --- a/SmartDeviceLink/SDLSetGlobalProperties.m +++ b/SmartDeviceLink/SDLSetGlobalProperties.m @@ -9,7 +9,7 @@ #import "SDLNames.h" #import "SDLTTSChunk.h" #import "SDLTTSChunkFactory.h" -#import "SDLVRHelpItem.h" +#import "SDLVrHelpItem.h" @implementation SDLSetGlobalProperties diff --git a/SmartDeviceLink/SDLVrCapabilities.m b/SmartDeviceLink/SDLVrCapabilities.m index 72c8c39d2..985d33726 100644 --- a/SmartDeviceLink/SDLVrCapabilities.m +++ b/SmartDeviceLink/SDLVrCapabilities.m @@ -2,7 +2,7 @@ // -#import "SDLVRCapabilities.h" +#import "SDLVrCapabilities.h" SDLVRCapabilities *SDLVRCapabilities_TEXT = nil; diff --git a/SmartDeviceLink/SDLVrHelpItem.m b/SmartDeviceLink/SDLVrHelpItem.m index 97dc86df4..b24bc9504 100644 --- a/SmartDeviceLink/SDLVrHelpItem.m +++ b/SmartDeviceLink/SDLVrHelpItem.m @@ -2,7 +2,7 @@ // -#import "SDLVRHelpItem.h" +#import "SDLVrHelpItem.h" #import "SDLImage.h" #import "SDLNames.h" -- cgit v1.2.1 From 74f9a4316da627d6cea6b843250e1870214dc43a Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Mon, 20 Feb 2017 11:31:29 -0500 Subject: Fixes #539 * Update `SDLLockScreenStatusManager` to use OPTIONAL status in the background when appropriate. --- SmartDeviceLink/SDLLockScreenStatusManager.m | 11 +++++++-- .../ProxySpecs/SDLLockScreenStatusManagerSpec.m | 28 +++++++++++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/SmartDeviceLink/SDLLockScreenStatusManager.m b/SmartDeviceLink/SDLLockScreenStatusManager.m index 86350b0d0..956da2dcf 100644 --- a/SmartDeviceLink/SDLLockScreenStatusManager.m +++ b/SmartDeviceLink/SDLLockScreenStatusManager.m @@ -71,10 +71,17 @@ return [SDLLockScreenStatus OFF]; } else if ([self.hmiLevel isEqualToEnum:[SDLHMILevel BACKGROUND]]) { // App is in the background on the car - // The lockscreen depends entirely on if the user selected the app if (self.userSelected) { - return [SDLLockScreenStatus REQUIRED]; + // It was user selected + if (self.haveDriverDistractionStatus && !self.driverDistracted) { + // We have the distraction status, and the driver is not distracted + return [SDLLockScreenStatus OPTIONAL]; + } else { + // We don't have the distraction status, and/or the driver is distracted + return [SDLLockScreenStatus REQUIRED]; + } } else { + // It wasn't user selected return [SDLLockScreenStatus OFF]; } } else if ([self.hmiLevel isEqualToEnum:[SDLHMILevel FULL]] || [self.hmiLevel isEqualToEnum:[SDLHMILevel LIMITED]]) { diff --git a/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m b/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m index 546380367..8a61980fe 100644 --- a/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m +++ b/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m @@ -122,9 +122,31 @@ describe(@"the lockscreen status manager", ^{ beforeEach(^{ lockScreenManager.userSelected = YES; }); - - it(@"should return lock screen required", ^{ - expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus REQUIRED])); + + context(@"if we do not set the driver distraction state", ^{ + it(@"should return lock screen required", ^{ + expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus REQUIRED])); + }); + }); + + context(@"if we set the driver distraction state to false", ^{ + beforeEach(^{ + lockScreenManager.driverDistracted = NO; + }); + + it(@"should return lock screen optional", ^{ + expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus OPTIONAL])); + }); + }); + + context(@"if we set the driver distraction state to true", ^{ + beforeEach(^{ + lockScreenManager.driverDistracted = YES; + }); + + it(@"should return lock screen required", ^{ + expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus REQUIRED])); + }); }); }); -- cgit v1.2.1 From f731341d23037f288dd69d7582ec597099d20be7 Mon Sep 17 00:00:00 2001 From: "Muller, Alexander (A.)" Date: Wed, 22 Feb 2017 13:16:14 +0100 Subject: Added in more descriptive exception throw for debugging. --- SmartDeviceLink/SDLStateMachine.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SmartDeviceLink/SDLStateMachine.m b/SmartDeviceLink/SDLStateMachine.m index ab5c54689..2bd14a853 100644 --- a/SmartDeviceLink/SDLStateMachine.m +++ b/SmartDeviceLink/SDLStateMachine.m @@ -62,9 +62,11 @@ SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidEnter = } if (![self sdl_canState:self.currentState transitionToState:state]) { + NSString *classString = NSStringFromClass([self.target class]); + NSString *reasonMessage = [NSString stringWithFormat:@"Invalid state machine transition of %@ occurred from %@ to %@", classString, self.currentState, state]; @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:@"Invalid state machine transition occurred" - userInfo:@{SDLStateMachineExceptionInfoKeyTargetClass: NSStringFromClass([self.target class]), + reason:reasonMessage + userInfo:@{SDLStateMachineExceptionInfoKeyTargetClass: classString, SDLStateMachineExceptionInfoKeyFromState: self.currentState, SDLStateMachineExceptionInfoKeyToClass: state}]; } -- cgit v1.2.1 From 77c1a96a29d9322c599572335149e3e11231788e Mon Sep 17 00:00:00 2001 From: "Muller, Alexander (A.)" Date: Thu, 23 Feb 2017 13:27:01 +0100 Subject: Improved state machine throw. Also added in more specific spec to handle this. --- SmartDeviceLink/SDLStateMachine.m | 6 +++--- SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/SmartDeviceLink/SDLStateMachine.m b/SmartDeviceLink/SDLStateMachine.m index 2bd14a853..2d197344d 100644 --- a/SmartDeviceLink/SDLStateMachine.m +++ b/SmartDeviceLink/SDLStateMachine.m @@ -62,11 +62,11 @@ SDLStateMachineTransitionFormat const SDLStateMachineTransitionFormatDidEnter = } if (![self sdl_canState:self.currentState transitionToState:state]) { - NSString *classString = NSStringFromClass([self.target class]); - NSString *reasonMessage = [NSString stringWithFormat:@"Invalid state machine transition of %@ occurred from %@ to %@", classString, self.currentState, state]; + NSString *targetClassString = NSStringFromClass([self.target class]); + NSString *reasonMessage = [NSString stringWithFormat:@"Invalid state machine %@ transition of target %@ occurred from %@ to %@", NSStringFromClass(self.class), targetClassString, self.currentState, state]; @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:reasonMessage - userInfo:@{SDLStateMachineExceptionInfoKeyTargetClass: classString, + userInfo:@{SDLStateMachineExceptionInfoKeyTargetClass: targetClassString, SDLStateMachineExceptionInfoKeyFromState: self.currentState, SDLStateMachineExceptionInfoKeyToClass: state}]; } diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m index d657586e5..af851d09b 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m @@ -121,11 +121,14 @@ describe(@"A state machine", ^{ }); it(@"should throw an exception trying to transition incorrectly and nothing should be called", ^{ + NSString *stateMachineClassString = NSStringFromClass(testStateMachine.class); + NSString *targetClassString = NSStringFromClass(testTarget.class); + // Side effects, but I can't think of any other way around it. expectAction(^{ [testStateMachine transitionToState:thirdState]; - }).to(raiseException().named(NSInternalInconsistencyException)); - + }).to(raiseException().named(NSInternalInconsistencyException).reason([NSString stringWithFormat:@"Invalid state machine %@ transition of target %@ occurred from %@ to %@", stateMachineClassString, targetClassString, initialState, thirdState]).userInfo(@{@"fromState": initialState, @"toState": thirdState, @"targetClass": targetClassString})); + expect(@([testStateMachine isCurrentState:initialState])).to(equal(@YES)); expect(@([testStateMachine isCurrentState:thirdState])).to(equal(@NO)); expect(@(willLeaveNotificationCalled)).to(equal(@NO)); @@ -141,4 +144,6 @@ describe(@"A state machine", ^{ }); }); +// Invalid state machine transition of TestStateMachineTarget occurred from Initial to Third + QuickSpecEnd -- cgit v1.2.1 From 1109f73e492a593c1d1c53ed6d19999c5e5f16f3 Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Fri, 24 Feb 2017 11:10:48 -0500 Subject: Update to v4.5.4 --- CHANGELOG.md | 8 ++++++++ SmartDeviceLink-iOS.podspec | 2 +- SmartDeviceLink/Info.plist | 2 +- SmartDeviceLink/SDLProxy.m | 2 +- SmartDeviceLink_Example/Info.plist | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b18a45934..27a7b1eb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 4.5.4 Release Notes +### Bug Fixes +* Streaming video will not crash if data is unexpectedly NULL. +* SDL now compiles on Xcode 8.3. +* Lockscreen will now appear appropriately when it's remote HMI is in the background. +* Internal state machines now throw more descriptive exceptions. + + # 4.5.3 Release Notes ### Bug Fixes * `SDLManager`'s `delegate` method `hmiLevel:didChangeToLevel:` now only triggers when the HMI level changes, instead of whenever an `onHMIStatus` is received. diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec index 23cc8bac9..3d9e0d0d4 100644 --- a/SmartDeviceLink-iOS.podspec +++ b/SmartDeviceLink-iOS.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "SmartDeviceLink-iOS" -s.version = "4.5.3" +s.version = "4.5.4" s.summary = "Connect your app with cars!" s.homepage = "https://github.com/smartdevicelink/SmartDeviceLink-iOS" s.license = { :type => "New BSD", :file => "LICENSE" } diff --git a/SmartDeviceLink/Info.plist b/SmartDeviceLink/Info.plist index d5d82ded6..4d3548d19 100644 --- a/SmartDeviceLink/Info.plist +++ b/SmartDeviceLink/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.5.3 + 4.5.4 CFBundleSignature ???? CFBundleVersion diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m index 4ead56361..e35df95ec 100644 --- a/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink/SDLProxy.m @@ -49,7 +49,7 @@ typedef NSString SDLVehicleMake; typedef void (^URLSessionTaskCompletionHandler)(NSData *data, NSURLResponse *response, NSError *error); typedef void (^URLSessionDownloadTaskCompletionHandler)(NSURL *location, NSURLResponse *response, NSError *error); -NSString *const SDLProxyVersion = @"4.5.3"; +NSString *const SDLProxyVersion = @"4.5.4"; const float startSessionTime = 10.0; const float notifyProxyClosedDelay = 0.1; const int POLICIES_CORRELATION_ID = 65535; diff --git a/SmartDeviceLink_Example/Info.plist b/SmartDeviceLink_Example/Info.plist index 0c4b3f0a3..ff523f6b7 100644 --- a/SmartDeviceLink_Example/Info.plist +++ b/SmartDeviceLink_Example/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 4.5.3 + 4.5.4 CFBundleSignature ???? CFBundleVersion -- cgit v1.2.1