The permission manager monitoring RPC permissions.
Flag indicating if the app requires an encryption service to be active.
@property (nonatomic, readonly) BOOL requiresEncryption;
var requiresEncryption: Bool { get }
Start the manager with a completion block that will be called when startup completes. This is used internally. To use an SDLPermissionManager, you should use the manager found on SDLManager
.
- (void)startWithCompletionHandler:
(nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;
func start() async throws -> Bool
The block to be called when the manager’s setup is complete.
Stop the manager. This method is used internally.
- (void)stop;
func stop()
Determine if an individual RPC is allowed for the current HMI level
- (BOOL)isRPCNameAllowed:(nonnull SDLRPCFunctionName)rpcName;
func isRPCNameAllowed(_ rpcName: SDLRPCFunctionName) -> Bool
The name of the RPC to be tested, for example, SDLRPCFunctionNameShow
YES if the RPC is allowed at the current HMI level, NO if not
Determine if all RPCs are allowed for the current HMI level
- (SDLPermissionGroupStatus)groupStatusOfRPCPermissions:
(nonnull NSArray<SDLPermissionElement *> *)rpcNames;
func groupStatus(ofRPCPermissions rpcNames: [SDLPermissionElement]) -> SDLPermissionGroupStatus
The RPCs to check
AllAllowed if all of the permissions are allowed, AllDisallowed if all the permissions are disallowed, Any if some are allowed, and some are disallowed
Retrieve a dictionary with keys that are the passed in RPC names, and objects of an NSNumber
- (nonnull NSDictionary<SDLRPCFunctionName, SDLRPCPermissionStatus *> *)
statusesOfRPCPermissions:
(nonnull NSArray<SDLPermissionElement *> *)rpcNames;
func statuses(ofRPCPermissions rpcNames: [SDLPermissionElement]) -> [SDLRPCFunctionName : SDLRPCPermissionStatus]
An array of permission elements to check
A dictionary with specific RPC info contained in a SDLRPCPermissionStatus
Subscribe to specified RPC names, with a callback that will be called whenever the value changes. The callback will only return immediately if the groupType is set to SDLPermissionGroupTypeAny or if the groupType is set to SDLPermissionGroupTypeAllAllowed and all RPCs in the rpcNames parameter are allowed.
Warning
The observer may be called before this method returns. Do not attempt to remove the observer from within the observer.
- (nonnull SDLPermissionObserverIdentifier)
subscribeToRPCPermissions:
(nonnull NSArray<SDLPermissionElement *> *)permissionElements
groupType:(SDLPermissionGroupType)groupType
withHandler:
(nonnull SDLRPCPermissionStatusChangedHandler)handler;
func subscribe(toRPCPermissions permissionElements: [SDLPermissionElement], groupType: SDLPermissionGroupType, withHandler handler: @escaping SDLRPCPermissionStatusChangedHandler) -> UUID
The permission elements to be observed
Affects the times that the observer block will be called. If Any, any change to any RPC in rpcNames will cause the observer block to be called. If AllAllowed, the block will be called when: 1. Every RPC in rpcNames becomes allowed 2. The group of rpcNames goes from all being allowed to some or all being disallowed.
The block that will be called whenever permissions change.
An identifier that can be passed to removeObserverForIdentifer: to remove the observer
Remove every current observer
- (void)removeAllObservers;
func removeAllObservers()
Remove block observers for the specified RPC
- (void)removeObserverForIdentifier:
(nonnull SDLPermissionObserverIdentifier)identifier;
func removeObserver(forIdentifier identifier: UUID)
The identifier specifying which observer to remove
Check whether or not an RPC needs encryption.
- (BOOL)rpcNameRequiresEncryption:(nonnull SDLRPCFunctionName)rpcName;
func rpcNameRequiresEncryption(_ rpcName: SDLRPCFunctionName) -> Bool
Check whether a parameter of an RPC is allowed
- (BOOL)isPermissionParameterAllowed:(nonnull SDLRPCFunctionName)rpcName
parameter:(nonnull NSString *)parameter;
func isPermissionParameterAllowed(_ rpcName: SDLRPCFunctionName, parameter: String) -> Bool
The name of the RPC to be tested, for example, SDLRPCFunctionNameGetVehicleData
The name of the parameter to be tested, for example, rpm
True if the parameter is allowed, false if it is not