summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuller, Alexander (A.) <amulle19@ford.com>2017-03-15 10:58:25 -0700
committerMuller, Alexander (A.) <amulle19@ford.com>2017-03-15 10:58:25 -0700
commited66dfda70cf413c783d11e104f8873d5425036f (patch)
treed10b2d1dfd7c86abe4a319ee7d6616a6bb3c79cd
parent5f75a92140612abde7f7b7979cfefccd8925cf36 (diff)
parent14adcab8724b7b62908b13c90da35394bb44cf35 (diff)
downloadsdl_ios-ed66dfda70cf413c783d11e104f8873d5425036f.tar.gz
Added in ability for audio pass thru handlerfeature/issue_xxx_audio_pass_thru_handler
-rw-r--r--CHANGELOG.md8
-rw-r--r--LICENSE4
-rw-r--r--README.md3
-rw-r--r--SmartDeviceLink-iOS.podspec2
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/project.pbxproj16
-rw-r--r--SmartDeviceLink/Info.plist2
-rw-r--r--SmartDeviceLink/SDLAddCommand.h15
-rw-r--r--SmartDeviceLink/SDLAddCommand.m8
-rw-r--r--SmartDeviceLink/SDLEnum.h12
-rw-r--r--SmartDeviceLink/SDLEnum.m21
-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/SDLLifecycleConfiguration.m2
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.h4
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m43
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m9
-rw-r--r--SmartDeviceLink/SDLLockScreenStatusManager.m10
-rw-r--r--SmartDeviceLink/SDLManager.h12
-rw-r--r--SmartDeviceLink/SDLManagerDelegate.h19
-rw-r--r--SmartDeviceLink/SDLNotificationConstants.h30
-rw-r--r--SmartDeviceLink/SDLPermissionManager.m12
-rw-r--r--SmartDeviceLink/SDLProxy.m12
-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/SDLRequestHandler.h33
-rw-r--r--SmartDeviceLink/SDLResponseDispatcher.h6
-rw-r--r--SmartDeviceLink/SDLResponseDispatcher.m38
-rw-r--r--SmartDeviceLink/SDLSoftButton.h9
-rw-r--r--SmartDeviceLink/SDLSoftButton.m4
-rw-r--r--SmartDeviceLink/SDLSubscribeButton.h17
-rw-r--r--SmartDeviceLink/SDLSubscribeButton.m4
-rw-r--r--SmartDeviceLink/SDLTouchManager.m6
-rw-r--r--SmartDeviceLink/SmartDeviceLink.h1
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m18
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m60
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLPermissionsManagerSpec.m10
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m107
-rw-r--r--SmartDeviceLink_Example/Classes/ProxyManager.m22
-rw-r--r--SmartDeviceLink_Example/Info.plist2
43 files changed, 438 insertions, 214 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 27a7b1eb9..1331800f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+# 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.
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/README.md b/README.md
index a7f71363a..4fc12a939 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,8 @@
* The [Core](https://github.com/smartdevicelink/sdl_core) component is the software which Vehicle Manufacturers (OEMs) implement in their vehicle head units. Integrating this component into their head unit and HMI based on a set of guidelines and templates enables access to various smartphone applications.
* The optional [SDL Server](https://github.com/smartdevicelink/sdl_server) can be used by Vehicle OEMs to update application policies and gather usage information for connected applications.
* The [iOS](https://github.com/smartdevicelink/sdl_ios) and [Android](https://github.com/smartdevicelink/sdl_android) libraries are implemented by app developers into their applications to enable command and control via the connected head unit.
-* To suggest new features to SDL, including the iOS library, go to the [SDL Evolution](https://github.com/smartdevicelink/sdl_evolution) github project
+* To suggest new features to SDL, including the iOS library, go to the [SDL Evolution](https://github.com/smartdevicelink/sdl_evolution) github project.
+* To understand if a contribution should be entered as an iOS Pull Request or Issue, or an SDL Evolution Proposal, please reference [this document](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals_versus_issues.md).
<a href="http://www.youtube.com/watch?feature=player_embedded&v=AzdQdSCS24M" target="_blank"><img src="http://i.imgur.com/nm8UujD.png?1" alt="SmartDeviceLink" border="10" /></a>
diff --git a/SmartDeviceLink-iOS.podspec b/SmartDeviceLink-iOS.podspec
index da50057bf..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.4"
+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-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
index 566a56bcc..98168d8ad 100644
--- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
+++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
@@ -761,7 +761,6 @@
5D61FE141A84238C00846EE7 /* SDLWiperStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FC271A84238C00846EE7 /* SDLWiperStatus.m */; };
5D6CC8EF1C610E660027F60A /* SDLSecurityType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D6CC8EE1C610E660027F60A /* SDLSecurityType.h */; settings = {ATTRIBUTES = (Public, ); }; };
5D6EB4CC1BF28DC600693731 /* NSMapTable+SubscriptingSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D6EB4CB1BF28DC600693731 /* NSMapTable+SubscriptingSpec.m */; };
- 5D6F7A2B1BC45BF70070BF37 /* SDLRequestHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D6F7A2A1BC45BF70070BF37 /* SDLRequestHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
5D6F7A2E1BC5650B0070BF37 /* SDLLifecycleConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D6F7A2C1BC5650B0070BF37 /* SDLLifecycleConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
5D6F7A2F1BC5650B0070BF37 /* SDLLifecycleConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D6F7A2D1BC5650B0070BF37 /* SDLLifecycleConfiguration.m */; };
5D6F7A351BC5B9B60070BF37 /* SDLLockScreenViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D6F7A331BC5B9B60070BF37 /* SDLLockScreenViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -868,6 +867,7 @@
DA4353E91D2721680099B8C4 /* DispatchTimerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E61D2721680099B8C4 /* DispatchTimerSpec.m */; };
DA4353EA1D2721680099B8C4 /* SDLTouchManagerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E71D2721680099B8C4 /* SDLTouchManagerSpec.m */; };
DA4353EB1D2721680099B8C4 /* SDLTouchSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4353E81D2721680099B8C4 /* SDLTouchSpec.m */; };
+ DA4F47961E771AA100FC809E /* SDLEnum.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4F47951E771AA100FC809E /* SDLEnum.m */; };
DA96C0661D4D4F730022F520 /* SDLAppInfoSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = DA96C0651D4D4F730022F520 /* SDLAppInfoSpec.m */; };
DA9F7E631DCBFAC800ACAE48 /* SDLDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = DA9F7E611DCBFAC800ACAE48 /* SDLDateTime.h */; settings = {ATTRIBUTES = (Public, ); }; };
DA9F7E641DCBFAC800ACAE48 /* SDLDateTime.m in Sources */ = {isa = PBXBuildFile; fileRef = DA9F7E621DCBFAC800ACAE48 /* SDLDateTime.m */; };
@@ -1768,7 +1768,6 @@
5D61FC271A84238C00846EE7 /* SDLWiperStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLWiperStatus.m; sourceTree = "<group>"; };
5D6CC8EE1C610E660027F60A /* SDLSecurityType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSecurityType.h; sourceTree = "<group>"; };
5D6EB4CB1BF28DC600693731 /* NSMapTable+SubscriptingSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMapTable+SubscriptingSpec.m"; path = "DevAPISpecs/NSMapTable+SubscriptingSpec.m"; sourceTree = "<group>"; };
- 5D6F7A2A1BC45BF70070BF37 /* SDLRequestHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLRequestHandler.h; sourceTree = "<group>"; };
5D6F7A2C1BC5650B0070BF37 /* SDLLifecycleConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLifecycleConfiguration.h; sourceTree = "<group>"; };
5D6F7A2D1BC5650B0070BF37 /* SDLLifecycleConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLLifecycleConfiguration.m; sourceTree = "<group>"; };
5D6F7A331BC5B9B60070BF37 /* SDLLockScreenViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLLockScreenViewController.h; sourceTree = "<group>"; };
@@ -1872,6 +1871,7 @@
DA4353E61D2721680099B8C4 /* DispatchTimerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DispatchTimerSpec.m; path = UtilitiesSpecs/Touches/DispatchTimerSpec.m; sourceTree = "<group>"; };
DA4353E71D2721680099B8C4 /* SDLTouchManagerSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLTouchManagerSpec.m; path = UtilitiesSpecs/Touches/SDLTouchManagerSpec.m; sourceTree = "<group>"; };
DA4353E81D2721680099B8C4 /* SDLTouchSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLTouchSpec.m; path = UtilitiesSpecs/Touches/SDLTouchSpec.m; sourceTree = "<group>"; };
+ DA4F47951E771AA100FC809E /* SDLEnum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLEnum.m; sourceTree = "<group>"; };
DA7515981D95FAA000F29323 /* lock_arrow_down_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lock_arrow_down_black.png; sourceTree = "<group>"; };
DA7515991D95FAA000F29323 /* lock_arrow_down_black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_down_black@2x.png"; sourceTree = "<group>"; };
DA75159A1D95FAA000F29323 /* lock_arrow_down_black@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "lock_arrow_down_black@3x.png"; sourceTree = "<group>"; };
@@ -3103,6 +3103,7 @@
isa = PBXGroup;
children = (
5D61FABA1A84238A00846EE7 /* SDLEnum.h */,
+ DA4F47951E771AA100FC809E /* SDLEnum.m */,
5DB92D301AC9C8BA00C15BB0 /* SDLRPCStruct.h */,
5DB92D311AC9C8BA00C15BB0 /* SDLRPCStruct.m */,
5D61FB7C1A84238B00846EE7 /* SDLRPCMessage.h */,
@@ -3419,7 +3420,6 @@
isa = PBXGroup;
children = (
5D6F7A301BC5B7100070BF37 /* Lock Screen UI */,
- 5DA3F3611BC448690026F2D0 /* Handler Additions */,
5DA3F3561BC4480E0026F2D0 /* Utilities */,
5D8204171BCD80A200D0A41B /* Configurations */,
5DBAE0A61D355EF200CE00BF /* Managers */,
@@ -3463,14 +3463,6 @@
name = Notifications;
sourceTree = "<group>";
};
- 5DA3F3611BC448690026F2D0 /* Handler Additions */ = {
- isa = PBXGroup;
- children = (
- 5D6F7A2A1BC45BF70070BF37 /* SDLRequestHandler.h */,
- );
- name = "Handler Additions";
- sourceTree = "<group>";
- };
5DAE06711BDEC68700F9B498 /* Developer API Tests */ = {
isa = PBXGroup;
children = (
@@ -3981,7 +3973,6 @@
5D61FE051A84238C00846EE7 /* SDLVehicleDataResultCode.h in Headers */,
5D61FD2B1A84238C00846EE7 /* SDLPerformInteractionResponse.h in Headers */,
5D61FDA11A84238C00846EE7 /* SDLSoftButtonCapabilities.h in Headers */,
- 5D6F7A2B1BC45BF70070BF37 /* SDLRequestHandler.h in Headers */,
5D61FDB51A84238C00846EE7 /* SDLSyncMsgVersion.h in Headers */,
5DA102A41D4122C700C15826 /* NSMutableDictionary+SafeRemove.h in Headers */,
5D61FE031A84238C00846EE7 /* SDLVehicleDataResult.h in Headers */,
@@ -4458,6 +4449,7 @@
5D1665C51CF8CA2700CC4CA1 /* SDLListFilesOperation.m in Sources */,
5D61FE021A84238C00846EE7 /* SDLVehicleDataNotificationStatus.m in Sources */,
5D61FDD81A84238C00846EE7 /* SDLTouchType.m in Sources */,
+ DA4F47961E771AA100FC809E /* SDLEnum.m in Sources */,
5D61FDD61A84238C00846EE7 /* SDLTouchEventCapabilities.m in Sources */,
5DA102A51D4122C700C15826 /* NSMutableDictionary+SafeRemove.m in Sources */,
5D61FCF11A84238C00846EE7 /* SDLLockScreenStatusManager.m in Sources */,
diff --git a/SmartDeviceLink/Info.plist b/SmartDeviceLink/Info.plist
index 38fffc19a..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.4</string>
+ <string>4.5.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
diff --git a/SmartDeviceLink/SDLAddCommand.h b/SmartDeviceLink/SDLAddCommand.h
index fb7ea7498..509ea80fa 100644
--- a/SmartDeviceLink/SDLAddCommand.h
+++ b/SmartDeviceLink/SDLAddCommand.h
@@ -5,10 +5,9 @@
#import "SDLImageType.h"
#import "SDLNotificationConstants.h"
-#import "SDLRequestHandler.h"
-@class SDLMenuParams;
@class SDLImage;
+@class SDLMenuParams;
/**
* This class will add a command to the application's Command Menu SDLMenuParams
@@ -37,7 +36,7 @@
NS_ASSUME_NONNULL_BEGIN
-@interface SDLAddCommand : SDLRPCRequest <SDLRequestHandler>
+@interface SDLAddCommand : SDLRPCRequest
/**
* Construct a SDLAddCommand with a handler callback when an event occurs.
@@ -46,20 +45,20 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return An SDLAddCommand object
*/
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithHandler:(nullable SDLRPCCommandNotificationHandler)handler;
-- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands handler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands handler:(nullable SDLRPCCommandNotificationHandler)handler;
-- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName handler:(SDLRPCNotificationHandler)handler;
+- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName handler:(SDLRPCCommandNotificationHandler)handler;
-- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(NSString *)iconValue iconType:(SDLImageType)iconType handler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(NSString *)iconValue iconType:(SDLImageType)iconType handler:(nullable SDLRPCCommandNotificationHandler)handler;
/**
* A handler that will let you know when the button you created is subscribed.
*
* @warning This will only work if you use SDLManager.
*/
-@property (nullable, copy, nonatomic) SDLRPCNotificationHandler handler;
+@property (nullable, copy, nonatomic) SDLRPCCommandNotificationHandler handler;
/**
* @abstract A Unique Command ID that identifies the command
diff --git a/SmartDeviceLink/SDLAddCommand.m b/SmartDeviceLink/SDLAddCommand.m
index 8c491359b..bfec12164 100644
--- a/SmartDeviceLink/SDLAddCommand.m
+++ b/SmartDeviceLink/SDLAddCommand.m
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithHandler:(nullable SDLRPCCommandNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands handler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands handler:(nullable SDLRPCCommandNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName handler:(SDLRPCNotificationHandler)handler {
+- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName handler:(SDLRPCCommandNotificationHandler)handler {
self = [self initWithId:commandId vrCommands:vrCommands handler:handler];
if (!self) {
return nil;
@@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(NSString *)iconValue iconType:(SDLImageType)iconType handler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithId:(UInt32)commandId vrCommands:(nullable NSArray<NSString *> *)vrCommands menuName:(NSString *)menuName parentId:(UInt32)parentId position:(UInt16)position iconValue:(NSString *)iconValue iconType:(SDLImageType)iconType handler:(nullable SDLRPCCommandNotificationHandler)handler {
self = [self initWithId:commandId vrCommands:vrCommands menuName:menuName handler:handler];
if (!self) {
return nil;
diff --git a/SmartDeviceLink/SDLEnum.h b/SmartDeviceLink/SDLEnum.h
index 7723ea2fb..f224d8ea3 100644
--- a/SmartDeviceLink/SDLEnum.h
+++ b/SmartDeviceLink/SDLEnum.h
@@ -5,4 +5,14 @@
#import <Foundation/Foundation.h>
#import "SDLMacros.h"
-typedef NSString* SDLEnum SDL_SWIFT_ENUM; \ No newline at end of file
+NS_ASSUME_NONNULL_BEGIN
+
+typedef NSString* SDLEnum SDL_SWIFT_ENUM;
+
+@interface NSString (SDLEnum)
+
+- (BOOL)isEqualToEnum:(SDLEnum)enumObj;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLEnum.m b/SmartDeviceLink/SDLEnum.m
new file mode 100644
index 000000000..dae9c8f06
--- /dev/null
+++ b/SmartDeviceLink/SDLEnum.m
@@ -0,0 +1,21 @@
+//
+// SDLEnum.m
+// SmartDeviceLink-iOS
+//
+// Created by Muller, Alexander (A.) on 3/13/17.
+// Copyright © 2017 smartdevicelink. All rights reserved.
+//
+
+#import "SDLEnum.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@implementation NSString (SDLEnum)
+
+- (BOOL)isEqualToEnum:(SDLEnum)enumObj {
+ return [self isEqualToString:enumObj];
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
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/SDLLifecycleConfiguration.m b/SmartDeviceLink/SDLLifecycleConfiguration.m
index 8f50e3258..e3f0fc90c 100644
--- a/SmartDeviceLink/SDLLifecycleConfiguration.m
+++ b/SmartDeviceLink/SDLLifecycleConfiguration.m
@@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Computed Properties
- (BOOL)isMedia {
- if ([self.appType isEqualToString:SDLAppHMITypeMedia]) {
+ if ([self.appType isEqualToEnum:SDLAppHMITypeMedia]) {
return YES;
}
diff --git a/SmartDeviceLink/SDLLifecycleManager.h b/SmartDeviceLink/SDLLifecycleManager.h
index 7d7c3d2e1..b2666b3b3 100644
--- a/SmartDeviceLink/SDLLifecycleManager.h
+++ b/SmartDeviceLink/SDLLifecycleManager.h
@@ -9,8 +9,10 @@
#import "SDLNotificationConstants.h"
#import <Foundation/Foundation.h>
+#import "SDLAudioStreamingState.h"
#import "SDLHMILevel.h"
#import "SDLLanguage.h"
+#import "SDLSystemContext.h"
@class SDLConfiguration;
@class SDLFileManager;
@@ -73,6 +75,8 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);
@property (assign, nonatomic) UInt16 lastCorrelationId;
@property (copy, nonatomic, readonly) SDLLifecycleState *lifecycleState;
@property (copy, nonatomic, nullable) SDLHMILevel hmiLevel;
+@property (copy, nonatomic, nullable) SDLAudioStreamingState audioStreamingState;
+@property (copy, nonatomic, nullable) SDLSystemContext systemContext;
@property (strong, nonatomic, nullable) SDLRegisterAppInterfaceResponse *registerResponse;
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index dba15fbdd..78acbec93 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -186,7 +186,9 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
self.registerResponse = nil;
self.lastCorrelationId = 0;
self.hmiLevel = nil;
-
+ self.audioStreamingState = nil;
+ self.systemContext = nil;
+
[SDLDebugTool logInfo:@"Stopping Proxy"];
self.proxy = nil;
@@ -281,8 +283,8 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
NSError *startError = nil;
// 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];
+ if (![registerResult isEqualToEnum:SDLResultSuccess]) {
+ startError = [NSError sdl_lifecycle_startedWithWarning:registerResult info:registerInfo];
}
// If we got to this point, we succeeded, send the error if there was a warning.
@@ -401,16 +403,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;
@@ -443,25 +436,41 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready";
}
- (void)hmiStatusDidChange:(SDLRPCNotificationNotification *)notification {
- if (![self.class sdl_checkNotification:notification containsKindOfClass:[SDLOnHMIStatus class]]) {
+ if (![notification isNotificationMemberOfClass:[SDLOnHMIStatus class]]) {
return;
}
SDLOnHMIStatus *hmiStatusNotification = notification.notification;
SDLHMILevel oldHMILevel = self.hmiLevel;
self.hmiLevel = hmiStatusNotification.hmiLevel;
-
+
+ SDLAudioStreamingState oldStreamingState = self.audioStreamingState;
+ self.audioStreamingState = hmiStatusNotification.audioStreamingState;
+
+ SDLSystemContext oldSystemContext = self.systemContext;
+ self.systemContext = hmiStatusNotification.systemContext;
+
if (![self.lifecycleStateMachine isCurrentState:SDLLifecycleStateReady]) {
return;
}
- if (![oldHMILevel isEqualToString:self.hmiLevel]) {
+ if (![oldHMILevel isEqualToEnum:self.hmiLevel]) {
[self.delegate hmiLevel:oldHMILevel didChangeToLevel:self.hmiLevel];
}
+
+ if (![oldStreamingState isEqualToEnum:self.audioStreamingState]
+ && [self.delegate respondsToSelector:@selector(audioStreamingState:didChangeToState:)]) {
+ [self.delegate audioStreamingState:oldStreamingState didChangeToState:self.audioStreamingState];
+ }
+
+ if (![oldSystemContext isEqualToEnum:self.systemContext]
+ && [self.delegate respondsToSelector:@selector(systemContext:didChangeToContext:)]) {
+ [self.delegate systemContext:oldSystemContext didChangeToContext:self.systemContext];
+ }
}
- (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 74bb9010a..3089f6b41 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -93,8 +93,7 @@ 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;
}
@@ -129,17 +128,17 @@ NS_ASSUME_NONNULL_BEGIN
}
// Present the VC depending on the lock screen status
- if ([self.lastLockNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusRequired]) {
+ if ([self.lastLockNotification.lockScreenStatus isEqualToEnum:SDLLockScreenStatusRequired]) {
if (!self.presenter.presented && self.canPresent) {
[self.presenter present];
}
- } else if ([self.lastLockNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusOptional]) {
+ } else if ([self.lastLockNotification.lockScreenStatus isEqualToEnum:SDLLockScreenStatusOptional]) {
if (self.config.showInOptionalState && !self.presenter.presented && self.canPresent) {
[self.presenter present];
} else if (self.presenter.presented) {
[self.presenter dismiss];
}
- } else if ([self.lastLockNotification.lockScreenStatus isEqualToString:SDLLockScreenStatusOff]) {
+ } else if ([self.lastLockNotification.lockScreenStatus isEqualToEnum:SDLLockScreenStatusOff]) {
if (self.presenter.presented) {
[self.presenter dismiss];
}
diff --git a/SmartDeviceLink/SDLLockScreenStatusManager.m b/SmartDeviceLink/SDLLockScreenStatusManager.m
index 6d2deb68e..82724eb6f 100644
--- a/SmartDeviceLink/SDLLockScreenStatusManager.m
+++ b/SmartDeviceLink/SDLLockScreenStatusManager.m
@@ -45,9 +45,9 @@ NS_ASSUME_NONNULL_BEGIN
_hmiLevel = hmiLevel;
}
- if ([hmiLevel isEqualToString:SDLHMILevelFull] || [hmiLevel isEqualToString:SDLHMILevelLimited]) {
+ if ([hmiLevel isEqualToEnum:SDLHMILevelFull] || [hmiLevel isEqualToEnum:SDLHMILevelLimited]) {
self.userSelected = YES;
- } else if ([hmiLevel isEqualToString:SDLHMILevelNone]) {
+ } else if ([hmiLevel isEqualToEnum:SDLHMILevelNone]) {
self.userSelected = NO;
}
}
@@ -66,10 +66,10 @@ NS_ASSUME_NONNULL_BEGIN
}
- (SDLLockScreenStatus)lockScreenStatus {
- if (self.hmiLevel == nil || [self.hmiLevel isEqualToString:SDLHMILevelNone]) {
+ if (self.hmiLevel == nil || [self.hmiLevel isEqualToEnum:SDLHMILevelNone]) {
// App is not active on the car
return SDLLockScreenStatusOff;
- } else if ([self.hmiLevel isEqualToString:SDLHMILevelBackground]) {
+ } else if ([self.hmiLevel isEqualToEnum:SDLHMILevelBackground]) {
// App is in the background on the car
if (self.userSelected) {
// It was user selected
@@ -83,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN
} else {
return SDLLockScreenStatusOff;
}
- } else if ([self.hmiLevel isEqualToString:SDLHMILevelFull] || [self.hmiLevel isEqualToString:SDLHMILevelLimited]) {
+ } else if ([self.hmiLevel isEqualToEnum:SDLHMILevelFull] || [self.hmiLevel isEqualToEnum:SDLHMILevelLimited]) {
// App is in the foreground on the car in some manner
if (self.haveDriverDistractionStatus && !self.driverDistracted) {
// We have the distraction status, and the driver is not distracted
diff --git a/SmartDeviceLink/SDLManager.h b/SmartDeviceLink/SDLManager.h
index e42f1cd19..7e7cb8c54 100644
--- a/SmartDeviceLink/SDLManager.h
+++ b/SmartDeviceLink/SDLManager.h
@@ -2,8 +2,10 @@
#import "SDLNotificationConstants.h"
+#import "SDLAudioStreamingState.h"
#import "SDLHMILevel.h"
#import "SDLLanguage.h"
+#import "SDLSystemContext.h"
@class SDLConfiguration;
@class SDLFileManager;
@@ -39,6 +41,16 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error);
@property (copy, nonatomic, readonly) SDLHMILevel hmiLevel;
/**
+ * The current audio streaming state of the running app.
+ */
+@property (copy, nonatomic, readonly) SDLAudioStreamingState audioStreamingState;
+
+/**
+ * The current system context of the running app.
+ */
+@property (copy, nonatomic, readonly) SDLSystemContext systemContext;
+
+/**
* The file manager to be used by the running app.
*/
@property (strong, nonatomic, readonly) SDLFileManager *fileManager;
diff --git a/SmartDeviceLink/SDLManagerDelegate.h b/SmartDeviceLink/SDLManagerDelegate.h
index 88ac86652..a3762b4e1 100644
--- a/SmartDeviceLink/SDLManagerDelegate.h
+++ b/SmartDeviceLink/SDLManagerDelegate.h
@@ -8,7 +8,9 @@
#import <Foundation/Foundation.h>
+#import "SDLAudioStreamingState.h"
#import "SDLHMILevel.h"
+#import "SDLSystemContext.h"
NS_ASSUME_NONNULL_BEGIN
@@ -28,6 +30,23 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)hmiLevel:(SDLHMILevel)oldLevel didChangeToLevel:(SDLHMILevel)newLevel;
+@optional
+/**
+ * Called when the audio streaming state of this application changes on the remote system. This refers to when streaming audio is audible to the user.
+ *
+ * @param oldState The previous state which has now been left.
+ * @param newState The current state.
+ */
+- (void)audioStreamingState:(nullable SDLAudioStreamingState)oldState didChangeToState:(SDLAudioStreamingState)newState;
+
+/**
+ * Called when the system context of this application changes on the remote system. This refers to whether or not a user-initiated interaction is in progress, and if so, what it is.
+ *
+ * @param oldContext The previous context which has now been left.
+ * @param newContext The current context.
+ */
+- (void)systemContext:(nullable SDLSystemContext)oldContext didChangeToContext:(SDLSystemContext)newContext;
+
@end
diff --git a/SmartDeviceLink/SDLNotificationConstants.h b/SmartDeviceLink/SDLNotificationConstants.h
index 9d20ac74d..40745c6cf 100644
--- a/SmartDeviceLink/SDLNotificationConstants.h
+++ b/SmartDeviceLink/SDLNotificationConstants.h
@@ -7,6 +7,10 @@
//
#import <Foundation/Foundation.h>
+
+@class SDLOnButtonEvent;
+@class SDLOnButtonPress;
+@class SDLOnCommand;
@class SDLRPCNotification;
@class SDLRPCResponse;
@class SDLRPCRequest;
@@ -26,12 +30,6 @@ typedef NOTIFICATION_TYPEDEF SDLNotificationName;
typedef NSString *SDLNotificationUserInfoKey;
#pragma mark - Blocks
-/**
- * A handler used on certain RPCs, primarily buttons or commands, when an event occurs.
- *
- * @param notification The RPC Notification that was fired.
- */
-typedef void (^SDLRPCNotificationHandler)(__kindof SDLRPCNotification *notification);
/**
* A handler used on SDLPerformAudioPassThru.
@@ -49,6 +47,26 @@ typedef void (^SDLAudioPassThruHandler)(NSData *__nullable audioData);
*/
typedef void (^SDLResponseHandler)(__kindof SDLRPCRequest *__nullable request, __kindof SDLRPCResponse *__nullable response, NSError *__nullable error);
+
+/**
+ A handler that may optionally be run when an SDLSubscribeButton or SDLSoftButton has a corresponding notification occur.
+
+ @warning This only works if you send the RPC using SDLManager.
+ @warning Only one of the two parameters will be set for each block call.
+
+ @param buttonPress An SDLOnButtonPress object that corresponds to this particular button.
+ @param buttonEvent An SDLOnButtonEvent object that corresponds to this particular button.
+ */
+typedef void (^SDLRPCButtonNotificationHandler)(SDLOnButtonPress *_Nullable buttonPress, SDLOnButtonEvent *_Nullable buttonEvent);
+/**
+ A handler that may optionally be run when an SDLAddCommand has a corresponding notification occur.
+
+ @warning This only works if you send the RPC using SDLManager.
+
+ @param command An SDLOnCommand object that corresponds to this particular SDLAddCommand.
+ */
+typedef void (^SDLRPCCommandNotificationHandler)(SDLOnCommand *command);
+
/**
* The key used in all SDL NSNotifications to extract the response or notification from the userinfo dictionary.
*/
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 6d5159c72..97105539a 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.4";
+NSString *const SDLProxyVersion = @"4.5.5";
const float startSessionTime = 10.0;
const float notifyProxyClosedDelay = 0.1;
const int POLICIES_CORRELATION_ID = 65535;
@@ -403,13 +403,13 @@ static float DefaultConnectionTimeout = 45.0;
SDLRequestType requestType = systemRequest.requestType;
// Handle the various OnSystemRequest types
- if ([requestType isEqualToString:SDLRequestTypeProprietary]) {
+ if ([requestType isEqualToEnum:SDLRequestTypeProprietary]) {
[self handleSystemRequestProprietary:systemRequest];
- } else if ([requestType isEqualToString:SDLRequestTypeLockScreenIconURL]) {
+ } else if ([requestType isEqualToEnum:SDLRequestTypeLockScreenIconURL]) {
[self handleSystemRequestLockScreenIconURL:systemRequest];
- } else if ([requestType isEqualToString:SDLRequestTypeHTTP]) {
+ } else if ([requestType isEqualToEnum:SDLRequestTypeHTTP]) {
[self sdl_handleSystemRequestHTTP:systemRequest];
- } else if ([requestType isEqualToString:SDLRequestTypeLaunchApp]) {
+ } else if ([requestType isEqualToEnum:SDLRequestTypeLaunchApp]) {
[self sdl_handleSystemRequestLaunchApp:systemRequest];
}
}
@@ -587,7 +587,7 @@ static float DefaultConnectionTimeout = 45.0;
return nil;
}
- if (![fileType isEqualToString:SDLFileTypeJSON]) {
+ if (![fileType isEqualToEnum:SDLFileTypeJSON]) {
[SDLDebugTool logInfo:@"OnSystemRequest (notification) failure: file type is not JSON" withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName];
return nil;
}
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/SDLRequestHandler.h b/SmartDeviceLink/SDLRequestHandler.h
deleted file mode 100644
index 64ee67b48..000000000
--- a/SmartDeviceLink/SDLRequestHandler.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// SDLRequestHandler.h
-// SmartDeviceLink-iOS
-//
-// Created by Joel Fischer on 10/6/15.
-// Copyright © 2015 smartdevicelink. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-#import "SDLNotificationConstants.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@protocol SDLRequestHandler <NSObject>
-
-/**
- * The handler that is added to any RPC implementing this protocol.
- */
-@property (nullable, copy, nonatomic) SDLRPCNotificationHandler handler;
-
-/**
- * A special init function on any RPC implementing this protocol.
- *
- * @param handler The handler to be called at specified times, such as events for buttons.
- *
- * @return An instance of the class implementing this protocol.
- */
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler;
-
-@end
-
-NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLResponseDispatcher.h b/SmartDeviceLink/SDLResponseDispatcher.h
index d80a788f0..3e746a75e 100644
--- a/SmartDeviceLink/SDLResponseDispatcher.h
+++ b/SmartDeviceLink/SDLResponseDispatcher.h
@@ -38,17 +38,17 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Holds a map of command ids and their corresponding blocks.
*/
-@property (strong, nonatomic, readonly) NSMapTable<SDLAddCommandCommandId *, SDLRPCNotificationHandler> *commandHandlerMap;
+@property (strong, nonatomic, readonly) NSMapTable<SDLAddCommandCommandId *, SDLRPCCommandNotificationHandler> *commandHandlerMap;
/**
* Holds a map of button names and their corresponding blocks.
*/
-@property (strong, nonatomic, readonly) NSMapTable<SDLSubscribeButtonName *, SDLRPCNotificationHandler> *buttonHandlerMap;
+@property (strong, nonatomic, readonly) NSMapTable<SDLSubscribeButtonName *, SDLRPCButtonNotificationHandler> *buttonHandlerMap;
/**
* Holds a map of soft button ids and their corresponding blocks.
*/
-@property (strong, nonatomic, readonly) NSMapTable<SDLSoftButtonId *, SDLRPCNotificationHandler> *customButtonHandlerMap;
+@property (strong, nonatomic, readonly) NSMapTable<SDLSoftButtonId *, SDLRPCButtonNotificationHandler> *customButtonHandlerMap;
/**
* Holds an audio pass thru block.
diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m
index aa50f1fb8..c54d601ef 100644
--- a/SmartDeviceLink/SDLResponseDispatcher.m
+++ b/SmartDeviceLink/SDLResponseDispatcher.m
@@ -23,6 +23,8 @@
#import "SDLPerformAudioPassThruResponse.h"
#import "SDLRPCResponse.h"
#import "SDLResult.h"
+#import "SDLRPCNotificationNotification.h"
+#import "SDLRPCResponseNotification.h"
#import "SDLScrollableMessage.h"
#import "SDLShow.h"
#import "SDLSoftButton.h"
@@ -140,13 +142,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]) {
@@ -186,11 +187,10 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Command
-- (void)sdl_runHandlerForCommand:(NSNotification *)notification {
- SDLOnCommand *onCommandNotification = notification.userInfo[SDLNotificationUserInfoObject];
- SDLRPCNotificationHandler 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);
}
@@ -198,36 +198,40 @@ 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;
- SDLRPCNotificationHandler handler = nil;
+ SDLRPCButtonNotificationHandler handler = nil;
SDLButtonName name = nil;
NSNumber *customID = nil;
- if ([rpcNotification isKindOfClass:[SDLOnButtonEvent class]]) {
+ if ([rpcNotification isMemberOfClass:[SDLOnButtonEvent class]]) {
name = ((SDLOnButtonEvent *)rpcNotification).buttonName;
customID = ((SDLOnButtonEvent *)rpcNotification).customButtonID;
- } else if ([rpcNotification isKindOfClass:[SDLOnButtonPress class]]) {
+ } else if ([rpcNotification isMemberOfClass:[SDLOnButtonPress class]]) {
name = ((SDLOnButtonPress *)rpcNotification).buttonName;
customID = ((SDLOnButtonPress *)rpcNotification).customButtonID;
}
- if ([name isEqualToString:SDLButtonNameCustomButton]) {
+ if ([name isEqualToEnum:SDLButtonNameCustomButton]) {
handler = self.customButtonHandlerMap[customID];
} else {
handler = self.buttonHandlerMap[name];
}
if (handler) {
- handler(rpcNotification);
+ if ([rpcNotification isMemberOfClass:[SDLOnButtonEvent class]]) {
+ handler(nil, rpcNotification);
+ } else if ([rpcNotification isMemberOfClass:[SDLOnButtonPress class]]) {
+ handler(rpcNotification, nil);
+ }
}
}
#pragma mark Audio Pass Thru
-- (void)sdl_runHandlerForAudioPassThru:(NSNotification *)notification {
- SDLOnAudioPassThru *onAudioPassThruNotification = notification.userInfo[SDLNotificationUserInfoObject];
+- (void)sdl_runHandlerForAudioPassThru:(SDLRPCNotificationNotification *)notification {
+ SDLOnAudioPassThru *onAudioPassThruNotification = notification.notification;
if (self.audioPassThruHandler) {
self.audioPassThruHandler(onAudioPassThruNotification.bulkData);
diff --git a/SmartDeviceLink/SDLSoftButton.h b/SmartDeviceLink/SDLSoftButton.h
index a5cc9d7a4..398bf8053 100644
--- a/SmartDeviceLink/SDLSoftButton.h
+++ b/SmartDeviceLink/SDLSoftButton.h
@@ -4,7 +4,6 @@
#import "SDLRPCMessage.h"
#import "SDLNotificationConstants.h"
-#import "SDLRequestHandler.h"
#import "SDLSoftButtonType.h"
#import "SDLSystemAction.h"
@@ -12,13 +11,13 @@
NS_ASSUME_NONNULL_BEGIN
-@interface SDLSoftButton : SDLRPCStruct <SDLRequestHandler>
+@interface SDLSoftButton : SDLRPCStruct
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithHandler:(nullable SDLRPCButtonNotificationHandler)handler;
-- (instancetype)initWithType:(SDLSoftButtonType)type text:(nullable NSString *)text image:(nullable SDLImage *)image highlighted:(BOOL)highlighted buttonId:(UInt16)buttonId systemAction:(nullable SDLSystemAction)systemAction handler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithType:(SDLSoftButtonType)type text:(nullable NSString *)text image:(nullable SDLImage *)image highlighted:(BOOL)highlighted buttonId:(UInt16)buttonId systemAction:(nullable SDLSystemAction)systemAction handler:(nullable SDLRPCButtonNotificationHandler)handler;
-@property (copy, nonatomic) SDLRPCNotificationHandler handler;
+@property (copy, nonatomic) SDLRPCButtonNotificationHandler handler;
@property (strong, nonatomic) SDLSoftButtonType type;
@property (strong, nonatomic, nullable) NSString *text;
diff --git a/SmartDeviceLink/SDLSoftButton.m b/SmartDeviceLink/SDLSoftButton.m
index c33880c06..a50bb4bcd 100644
--- a/SmartDeviceLink/SDLSoftButton.m
+++ b/SmartDeviceLink/SDLSoftButton.m
@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation SDLSoftButton
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithHandler:(nullable SDLRPCButtonNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithType:(SDLSoftButtonType)type text:(nullable NSString *)text image:(nullable SDLImage *)image highlighted:(BOOL)highlighted buttonId:(UInt16)buttonId systemAction:(nullable SDLSystemAction)systemAction handler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithType:(SDLSoftButtonType)type text:(nullable NSString *)text image:(nullable SDLImage *)image highlighted:(BOOL)highlighted buttonId:(UInt16)buttonId systemAction:(nullable SDLSystemAction)systemAction handler:(nullable SDLRPCButtonNotificationHandler)handler {
self = [self initWithHandler:handler];
if (!self) {
return nil;
diff --git a/SmartDeviceLink/SDLSubscribeButton.h b/SmartDeviceLink/SDLSubscribeButton.h
index 6b3465636..11f25a8ea 100644
--- a/SmartDeviceLink/SDLSubscribeButton.h
+++ b/SmartDeviceLink/SDLSubscribeButton.h
@@ -1,12 +1,12 @@
// SDLSubscribeButton.h
//
-
+#import "SDLButtonName.h"
+#import "SDLNotificationConstants.h"
#import "SDLRPCRequest.h"
-#import "SDLButtonName.h"
-#import "SDLRequestHandler.h"
+NS_ASSUME_NONNULL_BEGIN
/**
* Establishes a subscription to button notifications for HMI buttons. Buttons
@@ -58,10 +58,7 @@
* Since SmartDeviceLink 1.0<br/>
* See SDLUnsubscribeButton
*/
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface SDLSubscribeButton : SDLRPCRequest <SDLRequestHandler>
+@interface SDLSubscribeButton : SDLRPCRequest
/**
* Construct a SDLSubscribeButton with a handler callback when an event occurs.
@@ -70,16 +67,16 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return An SDLSubscribeButton object
*/
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithHandler:(nullable SDLRPCButtonNotificationHandler)handler;
-- (instancetype)initWithButtonName:(SDLButtonName)buttonName handler:(nullable SDLRPCNotificationHandler)handler;
+- (instancetype)initWithButtonName:(SDLButtonName)buttonName handler:(nullable SDLRPCButtonNotificationHandler)handler;
/**
* A handler that will let you know when the button you subscribed to is selected.
*
* @warning This will only work if you use SDLManager.
*/
-@property (copy, nonatomic) SDLRPCNotificationHandler handler;
+@property (copy, nonatomic) SDLRPCButtonNotificationHandler handler;
/**
* @abstract The name of the button to subscribe to
diff --git a/SmartDeviceLink/SDLSubscribeButton.m b/SmartDeviceLink/SDLSubscribeButton.m
index 07a2fe65c..1a94caa37 100644
--- a/SmartDeviceLink/SDLSubscribeButton.m
+++ b/SmartDeviceLink/SDLSubscribeButton.m
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithHandler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithHandler:(nullable SDLRPCButtonNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithButtonName:(SDLButtonName)buttonName handler:(nullable SDLRPCNotificationHandler)handler {
+- (instancetype)initWithButtonName:(SDLButtonName)buttonName handler:(nullable SDLRPCButtonNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
diff --git a/SmartDeviceLink/SDLTouchManager.m b/SmartDeviceLink/SDLTouchManager.m
index b661f3563..680dabad7 100644
--- a/SmartDeviceLink/SDLTouchManager.m
+++ b/SmartDeviceLink/SDLTouchManager.m
@@ -118,11 +118,11 @@ static NSUInteger const MaximumNumberOfTouches = 2;
return;
}
- if ([notification.type isEqualToString:SDLTouchTypeBegin]) {
+ if ([notification.type isEqualToEnum:SDLTouchTypeBegin]) {
[self sdl_handleTouchBegan:touch];
- } else if ([notification.type isEqualToString:SDLTouchTypeMove]) {
+ } else if ([notification.type isEqualToEnum:SDLTouchTypeMove]) {
[self sdl_handleTouchMoved:touch];
- } else if ([notification.type isEqualToString:SDLTouchTypeEnd]) {
+ } else if ([notification.type isEqualToEnum:SDLTouchTypeEnd]) {
[self sdl_handleTouchEnded:touch];
}
}
diff --git a/SmartDeviceLink/SmartDeviceLink.h b/SmartDeviceLink/SmartDeviceLink.h
index 9ca9975b4..ce6b9d5d4 100644
--- a/SmartDeviceLink/SmartDeviceLink.h
+++ b/SmartDeviceLink/SmartDeviceLink.h
@@ -309,7 +309,6 @@ FOUNDATION_EXPORT const unsigned char SmartDeviceLinkVersionString[];
#import "NSNumber+NumberType.h"
#import "SDLErrorConstants.h"
#import "SDLNotificationConstants.h"
-#import "SDLRequestHandler.h"
// Notifications
#import "SDLRPCNotificationNotification.h"
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m
index 3c678de73..fac25a59f 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleConfigurationSpec.m
@@ -29,10 +29,10 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beFalsy());
expect(testConfig.tcpDebugIPAddress).to(match(@"192.168.0.1"));
expect(@(testConfig.tcpDebugPort)).to(equal(@12345));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeDefault])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeDefault])).to(equal(@YES));
expect(@(testConfig.isMedia)).to(beFalsy());
- expect(@([testConfig.language isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
- expect(@([[testConfig.languagesSupported firstObject] isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([[testConfig.languagesSupported firstObject] isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
expect(testConfig.shortAppName).to(beNil());
expect(testConfig.ttsName).to(beNil());
expect(testConfig.voiceRecognitionCommandNames).to(beNil());
@@ -72,9 +72,9 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beFalsy());
expect(testConfig.tcpDebugIPAddress).to(match(@"192.168.0.1"));
expect(@(testConfig.tcpDebugPort)).to(equal(@12345));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeMedia])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeMedia])).to(equal(@YES));
expect(@(testConfig.isMedia)).to(beTruthy());
- expect(@([testConfig.language isEqualToString:SDLLanguageArSa])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageArSa])).to(equal(@YES));
expect(testConfig.languagesSupported).to(haveCount(@3));
expect(testConfig.shortAppName).to(match(someShortAppName));
expect(testConfig.ttsName).to(contain(someTTSChunk));
@@ -107,8 +107,8 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beTruthy());
expect(testConfig.tcpDebugIPAddress).to(match(someIPAddress));
expect(@(testConfig.tcpDebugPort)).to(equal(@(somePort)));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeDefault])).to(equal(@YES));
- expect(@([testConfig.language isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeDefault])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageEnUs])).to(equal(@YES));
expect(@([[testConfig.languagesSupported firstObject] isEqualToString:SDLLanguageEnUs])).to(equal(@YES));
expect(testConfig.shortAppName).to(beNil());
expect(testConfig.ttsName).to(beNil());
@@ -148,9 +148,9 @@ describe(@"a lifecycle configuration", ^{
expect(@(testConfig.tcpDebugMode)).to(beTruthy());
expect(testConfig.tcpDebugIPAddress).to(match(someIPAddress));
expect(@(testConfig.tcpDebugPort)).to(equal(@(somePort)));
- expect(@([testConfig.appType isEqualToString:SDLAppHMITypeMedia])).to(equal(@YES));
+ expect(@([testConfig.appType isEqualToEnum:SDLAppHMITypeMedia])).to(equal(@YES));
expect(@(testConfig.isMedia)).to(beTruthy());
- expect(@([testConfig.language isEqualToString:SDLLanguageArSa])).to(equal(@YES));
+ expect(@([testConfig.language isEqualToEnum:SDLLanguageArSa])).to(equal(@YES));
expect(testConfig.languagesSupported).to(haveCount(@3));
expect(testConfig.shortAppName).to(match(someShortAppName));
expect(testConfig.ttsName).to(contain(someTTSChunk));
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index 8b0a276d4..e5105fe6f 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));
});
});
@@ -367,7 +367,63 @@ describe(@"a lifecycle manager", ^{
});
});
});
- });
+
+ describe(@"receiving an audio state change", ^{
+ __block SDLOnHMIStatus *testHMIStatus = nil;
+ __block SDLAudioStreamingState testAudioStreamingState = nil;
+ __block SDLAudioStreamingState oldAudioStreamingState = nil;
+
+ beforeEach(^{
+ oldAudioStreamingState = testManager.audioStreamingState;
+ testHMIStatus = [[SDLOnHMIStatus alloc] init];
+ });
+
+ context(@"a not audible audio state", ^{
+ beforeEach(^{
+ testAudioStreamingState = SDLAudioStreamingStateNotAudible;
+ testHMIStatus.audioStreamingState = testAudioStreamingState;
+
+ [testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
+ });
+
+ it(@"should set the audio state", ^{
+ expect(testManager.audioStreamingState).toEventually(equal(testAudioStreamingState));
+ });
+
+ it(@"should call the delegate", ^{
+ OCMVerify([managerDelegateMock audioStreamingState:oldAudioStreamingState didChangeToState:testAudioStreamingState]);
+ });
+ });
+ });
+
+ describe(@"receiving a system context change", ^{
+ __block SDLOnHMIStatus *testHMIStatus = nil;
+ __block SDLSystemContext testSystemContext = nil;
+ __block SDLSystemContext oldSystemContext = nil;
+
+ beforeEach(^{
+ oldSystemContext = testManager.systemContext;
+ testHMIStatus = [[SDLOnHMIStatus alloc] init];
+ });
+
+ context(@"a alert system context state", ^{
+ beforeEach(^{
+ testSystemContext = SDLSystemContextAlert;
+ testHMIStatus.systemContext = testSystemContext;
+
+ [testManager.notificationDispatcher postRPCNotificationNotification:SDLDidChangeHMIStatusNotification notification:testHMIStatus];
+ });
+
+ it(@"should set the system context", ^{
+ expect(testManager.systemContext).toEventually(equal(testSystemContext));
+ });
+
+ it(@"should call the delegate", ^{
+ OCMVerify([managerDelegateMock systemContext:oldSystemContext didChangeToContext:testSystemContext]);
+ });
+ });
+ });
+ });
});
});
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 d8aa2cc7d..49d4eb161 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
@@ -7,6 +7,7 @@
#import "SDLDeleteCommand.h"
#import "SDLDeleteCommandResponse.h"
#import "SDLNotificationConstants.h"
+#import "SDLOnAudioPassThru.h"
#import "SDLOnButtonEvent.h"
#import "SDLOnButtonPress.h"
#import "SDLOnCommand.h"
@@ -15,6 +16,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"
@@ -101,7 +104,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", ^{
@@ -126,7 +130,7 @@ describe(@"a response dispatcher", ^{
beforeEach(^{
numTimesHandlerCalled = 0;
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
testShow.softButtons = [@[testSoftButton1] mutableCopy];
@@ -153,8 +157,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", ^{
@@ -170,8 +177,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", ^{
@@ -193,7 +203,7 @@ describe(@"a response dispatcher", ^{
context(@"with a malformed soft button", ^{
beforeEach(^{
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {}];
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:nil];
});
it(@"should throw an exception if there's no button id", ^{
@@ -264,7 +274,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", ^{
@@ -277,7 +289,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", ^{
@@ -306,7 +320,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", ^{
@@ -343,7 +359,7 @@ describe(@"a response dispatcher", ^{
testSubscribeCorrelationId = @42;
numTimesHandlerCalled = 0;
- testSubscribeButton = [[SDLSubscribeButton alloc] initWithButtonName:testButtonName handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSubscribeButton = [[SDLSubscribeButton alloc] initWithButtonName:testButtonName handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
testSubscribeButton.correlationID = testSubscribeCorrelationId;
@@ -381,8 +397,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", ^{
@@ -398,8 +417,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", ^{
@@ -428,7 +450,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", ^{
@@ -466,7 +489,7 @@ describe(@"a response dispatcher", ^{
beforeEach(^{
numTimesHandlerCalled = 0;
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
@@ -493,8 +516,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", ^{
@@ -509,9 +535,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", ^{
@@ -533,7 +562,7 @@ describe(@"a response dispatcher", ^{
context(@"with a malformed soft button", ^{
beforeEach(^{
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {}];
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:nil];
});
it(@"should throw an exception if there's no button id", ^{
@@ -571,7 +600,7 @@ describe(@"a response dispatcher", ^{
beforeEach(^{
numTimesHandlerCalled = 0;
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
numTimesHandlerCalled++;
}];
@@ -598,8 +627,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", ^{
@@ -615,8 +647,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", ^{
@@ -638,7 +673,7 @@ describe(@"a response dispatcher", ^{
context(@"with a malformed soft button", ^{
beforeEach(^{
- testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:^(__kindof SDLRPCNotification * _Nonnull notification) {}];
+ testSoftButton1 = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:@"test" image:nil highlighted:NO buttonId:1 systemAction:SDLSystemActionDefaultAction handler:nil];
});
it(@"should throw an exception if there's no button id", ^{
@@ -683,7 +718,10 @@ describe(@"a response dispatcher", ^{
describe(@"when an on audio data notification arrives", ^{
beforeEach(^{
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveAudioPassThruNotification object:nil];
+ SDLOnAudioPassThru *testOnAudioPassThru = [[SDLOnAudioPassThru alloc] init];
+
+ SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveAudioPassThruNotification object:nil rpcNotification:testOnAudioPassThru];
+ [[NSNotificationCenter defaultCenter] postNotification:notification];
});
it(@"should run the handler", ^{
@@ -696,7 +734,8 @@ describe(@"a response dispatcher", ^{
SDLPerformAudioPassThruResponse *performAudioPassThruResponse = [[SDLPerformAudioPassThruResponse alloc] init];
performAudioPassThruResponse.success = @YES;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceivePerformAudioPassThruResponse object:nil userInfo:@{SDLNotificationUserInfoObject : performAudioPassThruResponse }];
+ SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceivePerformAudioPassThruResponse object:nil rpcResponse:performAudioPassThruResponse];
+ [[NSNotificationCenter defaultCenter] postNotification:notification];
});
it(@"should clear the handler", ^{
@@ -717,7 +756,10 @@ describe(@"a response dispatcher", ^{
describe(@"when an on audio data notification arrives", ^{
beforeEach(^{
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveAudioPassThruNotification object:nil];
+ SDLOnAudioPassThru *testOnAudioPassThru = [[SDLOnAudioPassThru alloc] init];
+
+ SDLRPCNotificationNotification *notification = [[SDLRPCNotificationNotification alloc] initWithName:SDLDidReceiveAudioPassThruNotification object:nil rpcNotification:testOnAudioPassThru];
+ [[NSNotificationCenter defaultCenter] postNotification:notification];
});
it(@"should not run a handler", ^{
@@ -730,7 +772,8 @@ describe(@"a response dispatcher", ^{
SDLPerformAudioPassThruResponse *performAudioPassThruResponse = [[SDLPerformAudioPassThruResponse alloc] init];
performAudioPassThruResponse.success = @YES;
- [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceivePerformAudioPassThruResponse object:nil userInfo:@{SDLNotificationUserInfoObject : performAudioPassThruResponse }];
+ SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceivePerformAudioPassThruResponse object:nil rpcResponse:performAudioPassThruResponse];
+ [[NSNotificationCenter defaultCenter] postNotification:notification];
});
it(@"should clear the handler", ^{
diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m
index 5139da20e..517f454f3 100644
--- a/SmartDeviceLink_Example/Classes/ProxyManager.m
+++ b/SmartDeviceLink_Example/Classes/ProxyManager.m
@@ -103,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
[weakSelf setupPermissionsCallbacks];
- if ([weakSelf.sdlManager.hmiLevel isEqualToString:SDLHMILevelFull]) {
+ if ([weakSelf.sdlManager.hmiLevel isEqualToEnum:SDLHMILevelFull]) {
[weakSelf showInitialData];
}
}];
@@ -115,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)showInitialData {
- if ((self.initialShowState != SDLHMIInitialShowStateDataAvailable) || ![self.sdlManager.hmiLevel isEqualToString:SDLHMILevelFull]) {
+ if ((self.initialShowState != SDLHMIInitialShowStateDataAvailable) || ![self.sdlManager.hmiLevel isEqualToEnum:SDLHMILevelFull]) {
return;
}
@@ -272,12 +272,14 @@ NS_ASSUME_NONNULL_BEGIN
}
+ (SDLSoftButton *)pointingSoftButtonWithManager:(SDLManager *)manager {
- SDLSoftButton* softButton = [[SDLSoftButton alloc] initWithHandler:^(__kindof SDLRPCNotification *notification) {
- if ([notification isKindOfClass:[SDLOnButtonPress class]]) {
- SDLAlert* alert = [[SDLAlert alloc] init];
- alert.alertText1 = @"You pushed the button!";
- [manager sendRequest:alert];
+ SDLSoftButton* softButton = [[SDLSoftButton alloc] initWithHandler:^(SDLOnButtonPress * _Nullable buttonPressNotification, SDLOnButtonEvent * _Nullable buttonEventNotification) {
+ if (buttonPressNotification == nil) {
+ return;
}
+
+ SDLAlert* alert = [[SDLAlert alloc] init];
+ alert.alertText1 = @"You pushed the button!";
+ [manager sendRequest:alert];
}];
softButton.text = @"Press";
softButton.softButtonID = @100;
@@ -364,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)hmiLevel:(SDLHMILevel)oldLevel didChangeToLevel:(SDLHMILevel)newLevel {
- if (![newLevel isEqualToString:SDLHMILevelNone] && (self.firstTimeState == SDLHMIFirstStateNone)) {
+ if (![newLevel isEqualToEnum:SDLHMILevelNone] && (self.firstTimeState == SDLHMIFirstStateNone)) {
// This is our first time in a non-NONE state
self.firstTimeState = SDLHMIFirstStateNonNone;
@@ -372,12 +374,12 @@ NS_ASSUME_NONNULL_BEGIN
[self prepareRemoteSystem];
}
- if ([newLevel isEqualToString:SDLHMILevelFull] && (self.firstTimeState != SDLHMIFirstStateFull)) {
+ if ([newLevel isEqualToEnum:SDLHMILevelFull] && (self.firstTimeState != SDLHMIFirstStateFull)) {
// This is our first time in a FULL state
self.firstTimeState = SDLHMIFirstStateFull;
}
- if ([newLevel isEqualToString:SDLHMILevelFull]) {
+ if ([newLevel isEqualToEnum:SDLHMILevelFull]) {
// We're always going to try to show the initial state, because if we've already shown it, it won't be shown, and we need to guard against some possible weird states
[self showInitialData];
}
diff --git a/SmartDeviceLink_Example/Info.plist b/SmartDeviceLink_Example/Info.plist
index 6627f9498..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.4</string>
+ <string>4.5.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>