summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-03-09 09:45:02 -0500
committerJoel Fischer <joeljfischer@gmail.com>2017-03-09 09:45:06 -0500
commit48e4429ca4267f003f23b2f5e7b4ef6f649f2811 (patch)
tree4f21ab9f6e4f623cbd5a274dfd200145ad319bc2
parent2705547f1a8423d0b11b4ec0c9cb62428d861c07 (diff)
parent1fca00636bad1dfb222f8ed84028654f09f885dd (diff)
downloadsdl_ios-48e4429ca4267f003f23b2f5e7b4ef6f649f2811.tar.gz
Merge branch 'develop' into feature/issue_537_handler_specificity
# Conflicts: # SmartDeviceLink/SDLResponseDispatcher.m
-rw-r--r--.github/ISSUE_TEMPLATE.md4
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md4
-rw-r--r--CHANGELOG.md16
-rw-r--r--LICENSE4
-rw-r--r--SmartDeviceLink-iOS.podspec2
-rw-r--r--SmartDeviceLink/Info.plist2
-rw-r--r--SmartDeviceLink/SDLError.h1
-rw-r--r--SmartDeviceLink/SDLError.m10
-rw-r--r--SmartDeviceLink/SDLErrorConstants.h4
-rw-r--r--SmartDeviceLink/SDLIAPTransport.m4
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m22
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m53
-rw-r--r--SmartDeviceLink/SDLPermissionManager.m12
-rw-r--r--SmartDeviceLink/SDLProxy.m2
-rw-r--r--SmartDeviceLink/SDLRPCNotificationNotification.h15
-rw-r--r--SmartDeviceLink/SDLRPCNotificationNotification.m10
-rw-r--r--SmartDeviceLink/SDLRPCResponseNotification.h14
-rw-r--r--SmartDeviceLink/SDLRPCResponseNotification.m13
-rw-r--r--SmartDeviceLink/SDLResponseDispatcher.m22
-rw-r--r--SmartDeviceLink/SDLStateMachine.m6
-rw-r--r--SmartDeviceLink/SDLStreamingMediaManager.m6
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m2
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m10
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m76
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m9
-rw-r--r--SmartDeviceLink_Example/Classes/ProxyManager.m2
-rw-r--r--SmartDeviceLink_Example/Info.plist2
27 files changed, 230 insertions, 97 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 9d11929f5..84c2de694 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -5,8 +5,8 @@
##### Reproduction Steps
1. [Step 1]
-1. [Step 2]
-1. [Step 3]
+2. [Step 2]
+3. [Step 3]
##### Expected Behavior
[Some expected behavior]
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 2b3f22d93..9a41515c7 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -19,8 +19,8 @@ This PR makes **[no / minor / major]** API changes.
##### Breaking Changes
* [Breaking change info]
-##### Enchancements
-* [Enchancement info]
+##### Enhancements
+* [Enhancement info]
##### Bug Fixes
* [Bug Fix Info]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b18a45934..1331800f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,19 @@
+# 4.5.5 Release Notes
+### Bug Fixes
+* Added a check for if `SDLManager` is already started and prevent starting it again.
+* Prevent infinite loops in IAP transport.
+
+### Example App
+* Fixed incorrectly setting button state on disconnect.
+
+# 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/LICENSE b/LICENSE
index 7f7887c5d..255251f17 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2016 Ford Motor Company,
+Copyright (c) 2017 SmartDeviceLink Consortium, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -11,7 +11,7 @@ modification, are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-* Neither the name of Ford Motor Company nor the names of its
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec
index d8a5fa14f..29a0d032f 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.5"
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 916f21161..ca833e17c 100644
--- a/SmartDeviceLink/Info.plist
+++ b/SmartDeviceLink/Info.plist
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>4.5.3</string>
+ <string>4.5.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
diff --git a/SmartDeviceLink/SDLError.h b/SmartDeviceLink/SDLError.h
index 71472f30a..09ec20ee8 100644
--- a/SmartDeviceLink/SDLError.h
+++ b/SmartDeviceLink/SDLError.h
@@ -30,6 +30,7 @@ extern SDLErrorDomain *const SDLErrorDomainFileManager;
+ (NSError *)sdl_lifecycle_unknownRemoteErrorWithDescription:(NSString *)description andReason:(NSString *)reason;
+ (NSError *)sdl_lifecycle_managersFailedToStart;
+ (NSError *)sdl_lifecycle_startedWithBadResult:(SDLResult)result info:(NSString *)info;
++ (NSError *)sdl_lifecycle_startedWithWarning:(SDLResult)result info:(NSString *)info;
+ (NSError *)sdl_lifecycle_failedWithBadResult:(SDLResult)result info:(NSString *)info;
#pragma mark SDLFileManager
diff --git a/SmartDeviceLink/SDLError.m b/SmartDeviceLink/SDLError.m
index 5afad3fac..511f91deb 100644
--- a/SmartDeviceLink/SDLError.m
+++ b/SmartDeviceLink/SDLError.m
@@ -81,6 +81,16 @@ SDLErrorDomain *const SDLErrorDomainFileManager = @"com.sdl.filemanager.error";
userInfo:userInfo];
}
++ (NSError *)sdl_lifecycle_startedWithWarning:(SDLResult)result info:(NSString *)info {
+ NSDictionary<NSString *, NSString *> *userInfo = @{
+ NSLocalizedDescriptionKey: NSLocalizedString(result, nil),
+ NSLocalizedFailureReasonErrorKey: NSLocalizedString(info, nil)
+ };
+ return [NSError errorWithDomain:SDLErrorDomainLifecycleManager
+ code:SDLManagerErrorRegistrationSuccessWithWarning
+ userInfo:userInfo];
+}
+
+ (NSError *)sdl_lifecycle_failedWithBadResult:(SDLResult)result info:(NSString *)info {
NSDictionary<NSString *, NSString *> *userInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(result, nil),
diff --git a/SmartDeviceLink/SDLErrorConstants.h b/SmartDeviceLink/SDLErrorConstants.h
index 24d1d58f7..c439d3fd6 100644
--- a/SmartDeviceLink/SDLErrorConstants.h
+++ b/SmartDeviceLink/SDLErrorConstants.h
@@ -36,6 +36,10 @@ typedef NS_ENUM(NSInteger, SDLManagerError) {
* Registering with the remote system failed.
*/
SDLManagerErrorRegistrationFailed = -6,
+ /**
+ * Registering with the remote system was successful, but had a warning.
+ */
+ SDLManagerErrorRegistrationSuccessWithWarning = -7
};
/**
diff --git a/SmartDeviceLink/SDLIAPTransport.m b/SmartDeviceLink/SDLIAPTransport.m
index e2a85bc78..043c8ab5a 100644
--- a/SmartDeviceLink/SDLIAPTransport.m
+++ b/SmartDeviceLink/SDLIAPTransport.m
@@ -272,8 +272,8 @@ int const streamOpenTimeoutSeconds = 2;
NSOutputStream *ostream = self.session.easession.outputStream;
NSMutableData *remainder = data.mutableCopy;
- while (remainder.length != 0) {
- if (ostream.streamStatus == NSStreamStatusOpen && ostream.hasSpaceAvailable) {
+ while (ostream.streamStatus == NSStreamStatusOpen && remainder.length != 0) {
+ if (ostream.hasSpaceAvailable){
NSInteger bytesWritten = [ostream write:remainder.bytes maxLength:remainder.length];
if (bytesWritten == -1) {
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index 6e2979d21..66f1dfe1c 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -111,6 +111,11 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)startWithReadyHandler:(SDLManagerReadyBlock)readyHandler {
+ if (![self.lifecycleStateMachine isCurrentState:SDLLifecycleStateStopped]) {
+ [SDLDebugTool logFormat:@"Warning: SDL has already been started, this attempt will be ignored."];
+ return;
+ }
+
self.readyHandler = [readyHandler copy];
[self.lifecycleStateMachine transitionToState:SDLLifecycleStateStarted];
@@ -277,7 +282,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
// If the resultCode isn't success, we got a warning. Errors were handled in `didEnterStateConnected`.
if (![registerResult isEqualToString:SDLResultSuccess]) {
- startError = [NSError sdl_lifecycle_startedWithBadResult:registerResult info:registerInfo];
+ startError = [NSError sdl_lifecycle_startedWithWarning:registerResult info:registerInfo];
}
// If we got to this point, we succeeded, send the error if there was a warning.
@@ -396,16 +401,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
return @(++self.lastCorrelationId);
}
-+ (BOOL)sdl_checkNotification:(NSNotification *)notification containsKindOfClass:(Class)class {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:class]) {
- return NO;
- }
-
- return YES;
-}
-
-+ (void)sdl_updateLoggingWithFlags : (SDLLogOutput)logFlags {
++ (void)sdl_updateLoggingWithFlags:(SDLLogOutput)logFlags {
if (logFlags == SDLLogOutputNone) {
[SDLDebugTool disable];
return;
@@ -438,7 +434,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)hmiStatusDidChange:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnHMIStatus class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnHMIStatus class]]) {
return;
}
@@ -456,7 +452,7 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)remoteHardwareDidUnregister:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnAppInterfaceUnregistered class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnAppInterfaceUnregistered class]]) {
return;
}
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m
index f38c2df10..b582e5996 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (assign, nonatomic) BOOL canPresent;
@property (strong, nonatomic, readwrite) SDLLockScreenConfiguration *config;
@property (strong, nonatomic) id<SDLViewControllerPresentable> presenter;
+@property (strong, nonatomic, nullable) SDLOnLockScreenStatus *lastLockNotification;
@end
@@ -44,6 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_lockScreenStatusDidChange:) name:SDLDidChangeLockScreenStatusNotification object:dispatcher];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_lockScreenIconReceived:) name:SDLDidReceiveLockScreenIcon object:dispatcher];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sdl_appDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
return self;
}
@@ -91,49 +93,58 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Notification Selectors
- (void)sdl_lockScreenStatusDidChange:(SDLRPCNotificationNotification *)notification {
- NSAssert([notification.notification isKindOfClass:[SDLOnLockScreenStatus class]], @"A notification was sent with an unanticipated object");
- if (![notification.notification isKindOfClass:[SDLOnLockScreenStatus class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnLockScreenStatus class]]) {
return;
}
- if (self.lockScreenViewController == nil) {
+ self.lastLockNotification = notification.notification;
+ [self sdl_checkLockScreen];
+}
+
+- (void)sdl_lockScreenIconReceived:(NSNotification *)notification {
+ NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[UIImage class]], @"A notification was sent with an unanticipated object");
+ if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[UIImage class]]) {
return;
}
- SDLOnLockScreenStatus *onLockScreenNotification = notification.notification;
+ UIImage *icon = notification.userInfo[SDLNotificationUserInfoObject];
+
+ // If the VC is our special type, then add the vehicle icon. If they passed in a custom VC, there's no current way to show the vehicle icon. If they're managing it themselves, they can grab the notification themselves.
+ if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) {
+ ((SDLLockScreenViewController *)self.lockScreenViewController).vehicleIcon = icon;
+ }
+}
+
+- (void)sdl_appDidBecomeActive:(NSNotification *)notification {
+ [self sdl_checkLockScreen];
+}
+
+
+#pragma mark - Private Helpers
+
+- (void)sdl_checkLockScreen {
+ if (self.lockScreenViewController == nil || self.lastLockNotification == nil) {
+ return;
+ }
// Present the VC depending on the lock screen status
- if ([onLockScreenNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusRequired]) {
+ if ([self.lastLockNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusRequired]) {
if (!self.presenter.presented && self.canPresent) {
[self.presenter present];
}
- } else if ([onLockScreenNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusOptional]) {
+ } else if ([self.lastLockNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusOptional]) {
if (self.config.showInOptionalState && !self.presenter.presented && self.canPresent) {
[self.presenter present];
} else if (self.presenter.presented) {
[self.presenter dismiss];
}
- } else if ([onLockScreenNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusOff]) {
+ } else if ([self.lastLockNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusOff]) {
if (self.presenter.presented) {
[self.presenter dismiss];
}
}
}
-- (void)sdl_lockScreenIconReceived:(NSNotification *)notification {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[UIImage class]], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[UIImage class]]) {
- return;
- }
-
- UIImage *icon = notification.userInfo[SDLNotificationUserInfoObject];
-
- // If the VC is our special type, then add the vehicle icon. If they passed in a custom VC, there's no current way to show the vehicle icon. If they're managing it themselves, they can grab the notification themselves.
- if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) {
- ((SDLLockScreenViewController *)self.lockScreenViewController).vehicleIcon = icon;
- }
-}
-
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLPermissionManager.m b/SmartDeviceLink/SDLPermissionManager.m
index 622a5d029..b37ca5b5b 100644
--- a/SmartDeviceLink/SDLPermissionManager.m
+++ b/SmartDeviceLink/SDLPermissionManager.m
@@ -174,13 +174,12 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - SDL Notification Observers
-- (void)sdl_permissionsDidChange:(NSNotification *)notification {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLOnPermissionsChange class]], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLOnPermissionsChange class]]) {
+- (void)sdl_permissionsDidChange:(SDLRPCNotificationNotification *)notification {
+ if (![notification isNotificationMemberOfClass:[SDLOnPermissionsChange class]]) {
return;
}
- SDLOnPermissionsChange *onPermissionChange = notification.userInfo[SDLNotificationUserInfoObject];
+ SDLOnPermissionsChange *onPermissionChange = notification.notification;
NSArray<SDLPermissionItem *> *newPermissionItems = [onPermissionChange.permissionItem copy];
NSArray<SDLPermissionFilter *> *currentFilters = [self.filters copy];
@@ -219,12 +218,11 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)sdl_hmiLevelDidChange:(SDLRPCNotificationNotification *)notification {
- NSAssert([notification.notification isKindOfClass:[SDLOnHMIStatus class]], @"A notification was sent with an unanticipated object");
- if (![notification.notification isKindOfClass:[SDLOnHMIStatus class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnHMIStatus class]]) {
return;
}
- SDLOnHMIStatus *hmiStatus = notification.userInfo[SDLNotificationUserInfoObject];
+ SDLOnHMIStatus *hmiStatus = notification.notification;
SDLHMILevel oldHMILevel = [self.currentHMILevel copy];
self.currentHMILevel = hmiStatus.hmiLevel;
diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m
index a7634cf26..463b8bd71 100644
--- a/SmartDeviceLink/SDLProxy.m
+++ b/SmartDeviceLink/SDLProxy.m
@@ -47,7 +47,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.5";
const float startSessionTime = 10.0;
const float notifyProxyClosedDelay = 0.1;
const int POLICIES_CORRELATION_ID = 65535;
diff --git a/SmartDeviceLink/SDLRPCNotificationNotification.h b/SmartDeviceLink/SDLRPCNotificationNotification.h
index 6c548812a..6b0060a9d 100644
--- a/SmartDeviceLink/SDLRPCNotificationNotification.h
+++ b/SmartDeviceLink/SDLRPCNotificationNotification.h
@@ -19,6 +19,21 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithName:(NSString *)name object:(nullable id)object rpcNotification:(__kindof SDLRPCNotification *)notification;
+/**
+ * Returns whether or not the containing notification is equal to a class, not including subclasses.
+ *
+ * @param aClass the class you are questioning
+ */
+- (BOOL)isNotificationMemberOfClass:(Class)aClass;
+
+/**
+ * Returns whether or not the containing notification is a kind of class, including subclasses.
+ *
+ * @param aClass the class you are questioning
+ */
+- (BOOL)isNotificationKindOfClass:(Class)aClass;
+
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLRPCNotificationNotification.m b/SmartDeviceLink/SDLRPCNotificationNotification.m
index 898580654..78645c695 100644
--- a/SmartDeviceLink/SDLRPCNotificationNotification.m
+++ b/SmartDeviceLink/SDLRPCNotificationNotification.m
@@ -31,6 +31,16 @@ NS_ASSUME_NONNULL_BEGIN
return _userInfo[SDLNotificationUserInfoObject];
}
+- (BOOL)isNotificationMemberOfClass:(Class)aClass {
+ NSAssert([self.notification isMemberOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.notification isMemberOfClass:aClass];
+}
+
+- (BOOL)isNotificationKindOfClass:(Class)aClass {
+ NSAssert([self.notification isKindOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.notification isKindOfClass:aClass];
+}
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLRPCResponseNotification.h b/SmartDeviceLink/SDLRPCResponseNotification.h
index 118d1f532..42647897e 100644
--- a/SmartDeviceLink/SDLRPCResponseNotification.h
+++ b/SmartDeviceLink/SDLRPCResponseNotification.h
@@ -19,6 +19,20 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithName:(NSString *)name object:(nullable id)object rpcResponse:(__kindof SDLRPCResponse *)response;
+/**
+ * Returns whether or not the containing response is equal to a class, not including subclasses.
+ *
+ * @param aClass the class you are questioning
+ */
+- (BOOL)isResponseMemberOfClass:(Class)aClass;
+
+/**
+ * Returns whether or not the containing response is a kind of class, including subclasses.
+ *
+ * @param aClass the class you are questioning
+ */
+- (BOOL)isResponseKindOfClass:(Class)aClass;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLRPCResponseNotification.m b/SmartDeviceLink/SDLRPCResponseNotification.m
index 6d4be548a..60e94cf8b 100644
--- a/SmartDeviceLink/SDLRPCResponseNotification.m
+++ b/SmartDeviceLink/SDLRPCResponseNotification.m
@@ -11,6 +11,7 @@
#import "SDLNotificationConstants.h"
#import "SDLRPCResponse.h"
+NS_ASSUME_NONNULL_BEGIN
@implementation SDLRPCResponseNotification
@@ -30,4 +31,16 @@
return _userInfo[SDLNotificationUserInfoObject];
}
+- (BOOL)isResponseMemberOfClass:(Class)aClass {
+ NSAssert([self.response isMemberOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.response isMemberOfClass:aClass];
+}
+
+- (BOOL)isResponseKindOfClass:(Class)aClass {
+ NSAssert([self.response isKindOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.response isKindOfClass:aClass];
+}
+
@end
+
+NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m
index 3c2928912..98df4a731 100644
--- a/SmartDeviceLink/SDLResponseDispatcher.m
+++ b/SmartDeviceLink/SDLResponseDispatcher.m
@@ -18,8 +18,10 @@
#import "SDLOnButtonEvent.h"
#import "SDLOnButtonPress.h"
#import "SDLOnCommand.h"
-#import "SDLRPCResponse.h"
#import "SDLResult.h"
+#import "SDLRPCResponse.h"
+#import "SDLRPCNotificationNotification.h"
+#import "SDLRPCResponseNotification.h"
#import "SDLScrollableMessage.h"
#import "SDLShow.h"
#import "SDLSoftButton.h"
@@ -130,13 +132,12 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Notification Handler
// Called by notifications
-- (void)sdl_runHandlersForResponse:(NSNotification *)notification {
- NSAssert([notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLRPCResponse class]], @"A notification was sent with an unanticipated object");
- if (![notification.userInfo[SDLNotificationUserInfoObject] isKindOfClass:[SDLRPCResponse class]]) {
+- (void)sdl_runHandlersForResponse:(SDLRPCResponseNotification *)notification {
+ if (![notification isResponseKindOfClass:[SDLRPCResponse class]]) {
return;
}
- __kindof SDLRPCResponse *response = notification.userInfo[SDLNotificationUserInfoObject];
+ __kindof SDLRPCResponse *response = notification.response;
NSError *error = nil;
if (![response.success boolValue]) {
@@ -173,11 +174,10 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Command
-- (void)sdl_runHandlerForCommand:(NSNotification *)notification {
- SDLOnCommand *onCommandNotification = notification.userInfo[SDLNotificationUserInfoObject];
- SDLRPCCommandNotificationHandler handler = nil;
+- (void)sdl_runHandlerForCommand:(SDLRPCNotificationNotification *)notification {
+ SDLOnCommand *onCommandNotification = notification.notification;
+ SDLRPCCommandNotificationHandler handler = self.commandHandlerMap[onCommandNotification.cmdID];
- handler = self.commandHandlerMap[onCommandNotification.cmdID];
if (handler) {
handler(onCommandNotification);
}
@@ -185,8 +185,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Button
-- (void)sdl_runHandlerForButton:(NSNotification *)notification {
- __kindof SDLRPCNotification *rpcNotification = notification.userInfo[SDLNotificationUserInfoObject];
+- (void)sdl_runHandlerForButton:(SDLRPCNotificationNotification *)notification {
+ __kindof SDLRPCNotification *rpcNotification = notification.notification;
SDLRPCButtonNotificationHandler handler = nil;
SDLButtonName name = nil;
diff --git a/SmartDeviceLink/SDLStateMachine.m b/SmartDeviceLink/SDLStateMachine.m
index ab5c54689..2d197344d 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 *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:@"Invalid state machine transition occurred"
- userInfo:@{SDLStateMachineExceptionInfoKeyTargetClass: NSStringFromClass([self.target class]),
+ reason:reasonMessage
+ userInfo:@{SDLStateMachineExceptionInfoKeyTargetClass: targetClassString,
SDLStateMachineExceptionInfoKeyFromState: self.currentState,
SDLStateMachineExceptionInfoKeyToClass: state}];
}
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m
index e39f24a4c..1ed79eb9a 100644
--- a/SmartDeviceLink/SDLStreamingMediaManager.m
+++ b/SmartDeviceLink/SDLStreamingMediaManager.m
@@ -377,13 +377,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];
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index 8b0a276d4..0da7d2727 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -289,7 +289,7 @@ describe(@"a lifecycle manager", ^{
expect(@(readyHandlerSuccess)).to(equal(@YES));
expect(readyHandlerError).toNot(beNil());
- expect(@(readyHandlerError.code)).to(equal(@(SDLManagerErrorRegistrationFailed)));
+ expect(@(readyHandlerError.code)).to(equal(@(SDLManagerErrorRegistrationSuccessWithWarning)));
expect(readyHandlerError.userInfo[NSLocalizedFailureReasonErrorKey]).to(match(response.info));
});
});
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
index eeecebf6c..dbf5e940f 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m
@@ -403,7 +403,7 @@ describe(@"SDLPermissionsManager", ^{
testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated];
// Send the permission update
- NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}];
+ SDLRPCNotificationNotification *updatedNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangePermissionsNotification object:nil rpcNotification:testPermissionChangeUpdate];
[[NSNotificationCenter defaultCenter] postNotification:updatedNotification];
});
@@ -471,7 +471,7 @@ describe(@"SDLPermissionsManager", ^{
testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated];
// Send the permission update
- NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}];
+ SDLRPCNotificationNotification *updatedNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangePermissionsNotification object:nil rpcNotification:testPermissionChangeUpdate];
[[NSNotificationCenter defaultCenter] postNotification:updatedNotification];
});
@@ -514,7 +514,7 @@ describe(@"SDLPermissionsManager", ^{
testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated];
// Send the permission update
- NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}];
+ SDLRPCNotificationNotification *updatedNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangePermissionsNotification object:nil rpcNotification:testPermissionChangeUpdate];
[[NSNotificationCenter defaultCenter] postNotification:updatedNotification];
});
@@ -577,7 +577,7 @@ describe(@"SDLPermissionsManager", ^{
testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated];
// Send the permission update
- NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}];
+ SDLRPCNotificationNotification *updatedNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangePermissionsNotification object:nil rpcNotification:testPermissionChangeUpdate];
[[NSNotificationCenter defaultCenter] postNotification:updatedNotification];
});
@@ -611,7 +611,7 @@ describe(@"SDLPermissionsManager", ^{
testPermissionChangeUpdate.permissionItem = [NSArray arrayWithObject:testPermissionUpdated];
// Send the permission update
- NSNotification *updatedNotification = [NSNotification notificationWithName:SDLDidChangePermissionsNotification object:nil userInfo:@{SDLNotificationUserInfoObject: testPermissionChangeUpdate}];
+ SDLRPCNotificationNotification *updatedNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidChangePermissionsNotification object:nil rpcNotification:testPermissionChangeUpdate];
[[NSNotificationCenter defaultCenter] postNotification:updatedNotification];
});
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
index be5c088dd..bcbc95631 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
@@ -13,6 +13,8 @@
#import "SDLReadDID.h"
#import "SDLReadDIDResponse.h"
#import "SDLResponseDispatcher.h"
+#import "SDLRPCNotificationNotification.h"
+#import "SDLRPCResponseNotification.h"
#import "SDLScrollableMessage.h"
#import "SDLShow.h"
#import "SDLSoftButton.h"
@@ -98,7 +100,8 @@ describe(@"a response dispatcher", ^{
testResponse = [[SDLReadDIDResponse alloc] init];
testResponse.correlationID = testCorrelationId;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveReadDIDResponse object:nil userInfo:@{ SDLNotificationUserInfoObject: testResponse }];
+ SDLRPCResponseNotification *responseNotification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveReadDIDResponse object:nil rpcResponse:testResponse];
+ [[NSNotificationCenter defaultCenter] postNotification:responseNotification];
});
it(@"should run the handler", ^{
@@ -150,8 +153,11 @@ describe(@"a response dispatcher", ^{
testButtonPress.customButtonID = testSoftButton1.softButtonID;
testButtonPress.buttonName = SDLButtonNameCustomButton;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should run the handler for each", ^{
@@ -167,8 +173,11 @@ describe(@"a response dispatcher", ^{
testButtonPress = [[SDLOnButtonPress alloc] init];
testButtonPress.buttonName = SDLButtonNameOk;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should not run the handler", ^{
@@ -261,7 +270,9 @@ describe(@"a response dispatcher", ^{
testOnCommand = [[SDLOnCommand alloc] init];
testOnCommand.cmdID = @(testCommandId);
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveCommandNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testOnCommand }];
+ SDLRPCNotificationNotification *commandNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveCommandNotification object:nil rpcNotification:testOnCommand];
+
+ [[NSNotificationCenter defaultCenter] postNotification:commandNotification];
});
it(@"should run the handler for each", ^{
@@ -274,7 +285,9 @@ describe(@"a response dispatcher", ^{
testOnCommand = [[SDLOnCommand alloc] init];
testOnCommand.cmdID = @999;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveCommandNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testOnCommand }];
+ SDLRPCNotificationNotification *commandNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveCommandNotification object:nil rpcNotification:testOnCommand];
+
+ [[NSNotificationCenter defaultCenter] postNotification:commandNotification];
});
it(@"should not run the handler", ^{
@@ -303,7 +316,9 @@ describe(@"a response dispatcher", ^{
testDeleteResponse.correlationID = testDeleteCommandCorrelationId;
testDeleteResponse.success = @YES;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveDeleteCommandResponse object:nil userInfo:@{ SDLNotificationUserInfoObject: testDeleteResponse }];
+ SDLRPCResponseNotification *deleteCommandNotification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveDeleteCommandResponse object:nil rpcResponse:testDeleteResponse];
+
+ [[NSNotificationCenter defaultCenter] postNotification:deleteCommandNotification];
});
it(@"should have removed all the handlers", ^{
@@ -378,8 +393,11 @@ describe(@"a response dispatcher", ^{
testButtonPress = [[SDLOnButtonPress alloc] init];
testButtonPress.buttonName = testButtonName;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should run the handler for each", ^{
@@ -395,8 +413,11 @@ describe(@"a response dispatcher", ^{
testButtonPress = [[SDLOnButtonPress alloc] init];
testButtonPress.buttonName = SDLButtonNamePreset0;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should not run the handler", ^{
@@ -425,7 +446,8 @@ describe(@"a response dispatcher", ^{
testUnsubscribeResponse.correlationID = testUnsubscribeCorrelationId;
testUnsubscribeResponse.success = @YES;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveUnsubscribeButtonResponse object:nil userInfo:@{ SDLNotificationUserInfoObject: testUnsubscribeResponse }];
+ SDLRPCResponseNotification *unsubscribeNotification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveUnsubscribeButtonResponse object:nil rpcResponse:testUnsubscribeResponse];
+ [[NSNotificationCenter defaultCenter] postNotification:unsubscribeNotification];
});
it(@"should have removed all the handlers", ^{
@@ -490,8 +512,11 @@ describe(@"a response dispatcher", ^{
testButtonPress.buttonName = SDLButtonNameCustomButton;
testButtonPress.customButtonID = testSoftButton1.softButtonID;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should run the handler for each", ^{
@@ -506,9 +531,12 @@ describe(@"a response dispatcher", ^{
testButtonPress = [[SDLOnButtonPress alloc] init];
testButtonPress.buttonName = SDLButtonNameOk;
+
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should not run the handler", ^{
@@ -595,8 +623,11 @@ describe(@"a response dispatcher", ^{
testButtonPress.buttonName = SDLButtonNameCustomButton;
testButtonPress.customButtonID = testSoftButton1.softButtonID;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should run the handler for each", ^{
@@ -612,8 +643,11 @@ describe(@"a response dispatcher", ^{
testButtonPress = [[SDLOnButtonPress alloc] init];
testButtonPress.buttonName = SDLButtonNameOk;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonEventNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonEvent }];
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveButtonPressNotification object:nil userInfo:@{ SDLNotificationUserInfoObject: testButtonPress }];
+ SDLRPCNotificationNotification *buttonEventNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonEventNotification object:nil rpcNotification:testButtonEvent];
+ SDLRPCNotificationNotification *buttonPressNotification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveButtonPressNotification object:nil rpcNotification:testButtonPress];
+
+ [[NSNotificationCenter defaultCenter] postNotification:buttonEventNotification];
+ [[NSNotificationCenter defaultCenter] postNotification:buttonPressNotification];
});
it(@"should not run the handler", ^{
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStateMachineSpec.m
index b60b01c62..efb5a5f64 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
diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m
index 6c728f830..37bac20c1 100644
--- a/SmartDeviceLink_Example/Classes/ProxyManager.m
+++ b/SmartDeviceLink_Example/Classes/ProxyManager.m
@@ -359,7 +359,7 @@ NS_ASSUME_NONNULL_BEGIN
// Reset our state
self.firstTimeState = SDLHMIFirstStateNone;
self.initialShowState = SDLHMIInitialShowStateNone;
- _state = ProxyStateStopped;
+ [self sdlex_updateProxyState:ProxyStateStopped];
if (ShouldRestartOnDisconnect) {
[self startManager];
}
diff --git a/SmartDeviceLink_Example/Info.plist b/SmartDeviceLink_Example/Info.plist
index 224fc7b31..9f4baef19 100644
--- a/SmartDeviceLink_Example/Info.plist
+++ b/SmartDeviceLink_Example/Info.plist
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>4.5.3</string>
+ <string>4.5.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>