Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align System Capability Manager Behavior with Java Suite #1543

Merged
merged 41 commits into from Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b635c0a
Working on isCapabilitySupported
joeljfischer Jan 29, 2020
320c941
Implement isCapabilitySupported
joeljfischer Jan 30, 2020
e19f5e0
Continued work on subscriptions
joeljfischer Jan 31, 2020
95df999
Rejiggering to return errors
joeljfischer Jan 31, 2020
eb9e9db
Remove unused code
joeljfischer Jan 31, 2020
f51add1
Send subscription status in handlers
joeljfischer Jan 31, 2020
3c957f0
Numerous updates for subscriptions
joeljfischer Feb 4, 2020
7962c0b
Working on tests
joeljfischer Feb 4, 2020
5ec80f8
Fix the proper observer / selector not being called
joeljfischer Feb 4, 2020
0017893
Documentation and test fixes
joeljfischer Feb 4, 2020
d2b7127
Fixing tests
joeljfischer Feb 5, 2020
281a711
Add tests for isCapabilitySupported
joeljfischer Feb 5, 2020
ede3886
Fixing documentation
joeljfischer Feb 5, 2020
22ac57a
Fix GetSystemCapability should not be sent for DISPLAYS
joeljfischer Feb 5, 2020
a1b0b5d
Remove test code
joeljfischer Feb 5, 2020
d8f54a6
Don't allow unsubscribing from DISPLAYS
joeljfischer Feb 5, 2020
39efb43
Don't call observers twice with the same data
joeljfischer Feb 5, 2020
64c09d5
Invoke observers if the initial GetSystemCapability fails with the error
joeljfischer Feb 5, 2020
1763b37
Clarify the error message
joeljfischer Feb 5, 2020
9cf81e1
Fix misnamed error
joeljfischer Feb 10, 2020
91e5d7c
Apply suggestions from code review
joeljfischer Feb 11, 2020
7e4614e
Fixes
joeljfischer Feb 11, 2020
f642279
Merge branch 'bugfix/issue-1535-align-systemcapabilitymanager' of htt…
joeljfischer Feb 11, 2020
c0593d4
Numerous fixes
joeljfischer Feb 12, 2020
9773a0d
Test fixes
joeljfischer Feb 12, 2020
22b4186
Update error language
joeljfischer Feb 12, 2020
c9eefb2
Fixes to SystemCapabilityManager
joeljfischer Feb 12, 2020
3d71e7f
Fixes for SystemCapabilityManager
joeljfischer Feb 12, 2020
cb3bd61
Fix SystemCapabilityManager tests
joeljfischer Feb 12, 2020
da1af9c
Add additional SystemCapabilityManager tests
joeljfischer Feb 12, 2020
12e08d3
Apply suggestions from code review
joeljfischer Feb 18, 2020
61bf46e
Fixed based on review
joeljfischer Feb 18, 2020
ef726f7
Merge branch 'bugfix/issue-1535-align-systemcapabilitymanager' of htt…
joeljfischer Feb 18, 2020
464fb83
Fix tests
joeljfischer Feb 18, 2020
5fa9bb4
Remove "outside" GetSystemCapability response caching
joeljfischer Feb 18, 2020
1b5da0a
Fix tests after removing GSCR auto-caching
joeljfischer Feb 18, 2020
0867095
SCM fixes
joeljfischer Feb 19, 2020
b406d15
Update subscriptions to not return a cached value if a GSC will be sent
joeljfischer Feb 20, 2020
dbc5d4f
Remove untrue documentation
joeljfischer Feb 20, 2020
6dbcb42
Fix incorrect documentation
joeljfischer Feb 20, 2020
bf96806
Last documentation fixes
joeljfischer Feb 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
NicoleYarroch marked this conversation as resolved.
Show resolved Hide resolved
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D4019AE1A76EC350006B0C2"
BuildableName = "SDL Example.app"
BlueprintName = "SmartDeviceLink-Example-ObjC"
ReferencedContainer = "container:SmartDeviceLink-iOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D4019AE1A76EC350006B0C2"
BuildableName = "SDL Example.app"
BlueprintName = "SmartDeviceLink-Example-ObjC"
ReferencedContainer = "container:SmartDeviceLink-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D4019AE1A76EC350006B0C2"
BuildableName = "SDL Example.app"
BlueprintName = "SmartDeviceLink-Example-ObjC"
ReferencedContainer = "container:SmartDeviceLink-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
8 changes: 8 additions & 0 deletions SmartDeviceLink/SDLError.h
Expand Up @@ -23,6 +23,7 @@ extern SDLErrorDomain *const SDLErrorDomainTextAndGraphicManager;
extern SDLErrorDomain *const SDLErrorDomainSoftButtonManager;
extern SDLErrorDomain *const SDLErrorDomainMenuManager;
extern SDLErrorDomain *const SDLErrorDomainChoiceSetManager;
extern SDLErrorDomain *const SDLErrorDomainSystemCapabilityManager;
extern SDLErrorDomain *const SDLErrorDomainTransport;
extern SDLErrorDomain *const SDLErrorDomainRPCStore;

Expand Down Expand Up @@ -75,6 +76,13 @@ extern SDLErrorDomain *const SDLErrorDomainRPCStore;
+ (NSError *)sdl_choiceSetManager_failedToCreateMenuItems;
+ (NSError *)sdl_choiceSetManager_incorrectState:(NSString *)state;


#pragma mark System Capability Manager

+ (NSError *)sdl_systemCapabilityManager_moduleDoesNotSupportSystemCapabilities;
+ (NSError *)sdl_systemCapabilityManager_cannotUpdateInHMINONE;
+ (NSError *)sdl_systemCapabilityManager_cannotUpdateTypeDISPLAYS;

#pragma mark Transport

+ (NSError *)sdl_transport_unknownError;
Expand Down
32 changes: 31 additions & 1 deletion SmartDeviceLink/SDLError.m
Expand Up @@ -21,6 +21,7 @@
SDLErrorDomain *const SDLErrorDomainSoftButtonManager = @"com.sdl.softbuttonmanager.error";
SDLErrorDomain *const SDLErrorDomainMenuManager = @"com.sdl.menumanager.error";
SDLErrorDomain *const SDLErrorDomainChoiceSetManager = @"com.sdl.choicesetmanager.error";
SDLErrorDomain *const SDLErrorDomainSystemCapabilityManager = @"com.sdl.systemcapabilitymanager.error";
SDLErrorDomain *const SDLErrorDomainTransport = @"com.sdl.transport.error";
SDLErrorDomain *const SDLErrorDomainRPCStore = @"com.sdl.rpcStore.error";

Expand Down Expand Up @@ -288,6 +289,35 @@ + (NSError *)sdl_choiceSetManager_incorrectState:(SDLChoiceManagerState *)state
return [NSError errorWithDomain:SDLErrorDomainChoiceSetManager code:SDLChoiceSetManagerErrorInvalidState userInfo:userInfo];
}

#pragma mark System Capability Manager

+ (NSError *)sdl_systemCapabilityManager_moduleDoesNotSupportSystemCapabilities {
NSDictionary<NSString *, NSString *> *userInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"Module does not understand system capabilities", nil),
NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"The connected module does not support system capabilities", nil),
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Use isCapabilitySupported to find out if the feature is supported on the head unit, but no more information about the feature is available on this module", nil)
};
return [NSError errorWithDomain:SDLErrorDomainSystemCapabilityManager code:SDLSystemCapabilityManagerErrorModuleDoesNotSupportSystemCapabilities userInfo:userInfo];
}

+ (NSError *)sdl_systemCapabilityManager_cannotUpdateInHMINONE {
NSDictionary<NSString *, NSString *> *userInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"System capabilities cannot be updated in HMI NONE.", nil),
NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"The system capability manager attempted to subscribe or update a system capability in HMI NONE, which is not allowed.", nil),
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Wait until you are in HMI BACKGROUND, LIMITED, OR FULL before subscribing or updating a capability.", nil)
};
return [NSError errorWithDomain:SDLErrorDomainSystemCapabilityManager code:SDLSystemCapabilityManagerErrorHMINone userInfo:userInfo];
}

+ (NSError *)sdl_systemCapabilityManager_cannotUpdateTypeDISPLAYS {
NSDictionary<NSString *, NSString *> *userInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"System capability type DISPLAYS cannot be updated.", nil),
NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"The system capability manager attempted to update system capability type DISPLAYS, which is not allowed.", nil),
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Subscribe to DISPLAYS to automatically receive updates or retrieve a cached display capability value directly from the SystemCapabilityManager.", nil)
};
return [NSError errorWithDomain:SDLErrorDomainSystemCapabilityManager code:SDLSystemCapabilityManagerErrorCannotUpdateTypeDisplays userInfo:userInfo];
}

#pragma mark Transport

+ (NSError *)sdl_transport_unknownError {
Expand Down Expand Up @@ -381,7 +411,7 @@ + (NSException *)sdl_invalidLockscreenSetupException {

+ (NSException *)sdl_invalidSelectorExceptionWithSelector:(SEL)selector {
return [NSException exceptionWithName:@"com.sdl.systemCapabilityManager.selectorException"
reason:[NSString stringWithFormat:@"Capability observation selector: %@ does not match possible selectors, which must have either 0 or 1 parameters", NSStringFromSelector(selector)]
reason:[NSString stringWithFormat:@"Capability observation selector: %@ does not match possible selectors, which must have between 0 and 3 parameters, or is not a selector on the observer object. Check that your selector is formatted correctly, and that your observer is not nil. You should unsubscribe an observer before it goes to nil.", NSStringFromSelector(selector)]
userInfo:nil];
}

Expand Down
6 changes: 6 additions & 0 deletions SmartDeviceLink/SDLErrorConstants.h
Expand Up @@ -152,6 +152,12 @@ typedef NS_ENUM(NSInteger, SDLChoiceSetManagerError) {
SDLChoiceSetManagerErrorInvalidState = -5
};

typedef NS_ENUM(NSInteger, SDLSystemCapabilityManagerError) {
SDLSystemCapabilityManagerErrorModuleDoesNotSupportSystemCapabilities = -1,
SDLSystemCapabilityManagerErrorHMINone = -2,
SDLSystemCapabilityManagerErrorCannotUpdateTypeDisplays = -3
};

/**
* Errors associated with transport.
*/
Expand Down