Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
iOS Documentation
SDLPermissionManager

SDLPermissionManager Class Reference

Section Contents

Overview

The permission manager monitoring RPC permissions.

requiresEncryption

Flag indicating if the app requires an encryption service to be active.

Objective-C

@property (nonatomic, readonly) BOOL requiresEncryption;

Swift

var requiresEncryption: Bool { get }

-startWithCompletionHandler:

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.

Objective-C

- (void)startWithCompletionHandler:
    (nonnull void (^)(BOOL, NSError *_Nullable))completionHandler;

Swift

func start() async throws -> Bool

Parameters

completionHandler

The block to be called when the manager’s setup is complete.

-stop

Stop the manager. This method is used internally.

Objective-C

- (void)stop;

Swift

func stop()

-isRPCNameAllowed:

Determine if an individual RPC is allowed for the current HMI level

Objective-C

- (BOOL)isRPCNameAllowed:(nonnull SDLRPCFunctionName)rpcName;

Swift

func isRPCNameAllowed(_ rpcName: SDLRPCFunctionName) -> Bool

Parameters

rpcName

The name of the RPC to be tested, for example, SDLRPCFunctionNameShow

Return Value

YES if the RPC is allowed at the current HMI level, NO if not

-groupStatusOfRPCPermissions:

Determine if all RPCs are allowed for the current HMI level

Objective-C

- (SDLPermissionGroupStatus)groupStatusOfRPCPermissions:
    (nonnull NSArray<SDLPermissionElement *> *)rpcNames;

Swift

func groupStatus(ofRPCPermissions rpcNames: [SDLPermissionElement]) -> SDLPermissionGroupStatus

Parameters

rpcNames

The RPCs to check

Return Value

AllAllowed if all of the permissions are allowed, AllDisallowed if all the permissions are disallowed, Any if some are allowed, and some are disallowed

-statusesOfRPCPermissions:

Retrieve a dictionary with keys that are the passed in RPC names, and objects of an NSNumber specifying if that RPC is currently allowed

Objective-C

- (nonnull NSDictionary<SDLRPCFunctionName, SDLRPCPermissionStatus *> *)
    statusesOfRPCPermissions:
        (nonnull NSArray<SDLPermissionElement *> *)rpcNames;

Swift

func statuses(ofRPCPermissions rpcNames: [SDLPermissionElement]) -> [SDLRPCFunctionName : SDLRPCPermissionStatus]

Parameters

rpcNames

An array of permission elements to check

Return Value

A dictionary with specific RPC info contained in a SDLRPCPermissionStatus

-subscribeToRPCPermissions:groupType:withHandler:

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.

Objective-C

- (nonnull SDLPermissionObserverIdentifier)
    subscribeToRPCPermissions:
        (nonnull NSArray<SDLPermissionElement *> *)permissionElements
                    groupType:(SDLPermissionGroupType)groupType
                  withHandler:
                      (nonnull SDLRPCPermissionStatusChangedHandler)handler;

Swift

func subscribe(toRPCPermissions permissionElements: [SDLPermissionElement], groupType: SDLPermissionGroupType, withHandler handler: @escaping SDLRPCPermissionStatusChangedHandler) -> UUID

Parameters

permissionElements

The permission elements to be observed

groupType

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.

handler

The block that will be called whenever permissions change.

Return Value

An identifier that can be passed to removeObserverForIdentifer: to remove the observer

-removeAllObservers

Remove every current observer

Objective-C

- (void)removeAllObservers;

Swift

func removeAllObservers()

-removeObserverForIdentifier:

Remove block observers for the specified RPC

Objective-C

- (void)removeObserverForIdentifier:
    (nonnull SDLPermissionObserverIdentifier)identifier;

Swift

func removeObserver(forIdentifier identifier: UUID)

Parameters

identifier

The identifier specifying which observer to remove

-rpcNameRequiresEncryption:

Check whether or not an RPC needs encryption.

Objective-C

- (BOOL)rpcNameRequiresEncryption:(nonnull SDLRPCFunctionName)rpcName;

Swift

func rpcNameRequiresEncryption(_ rpcName: SDLRPCFunctionName) -> Bool

-isPermissionParameterAllowed:parameter:

Check whether a parameter of an RPC is allowed

Objective-C

- (BOOL)isPermissionParameterAllowed:(nonnull SDLRPCFunctionName)rpcName
                           parameter:(nonnull NSString *)parameter;

Swift

func isPermissionParameterAllowed(_ rpcName: SDLRPCFunctionName, parameter: String) -> Bool

Parameters

rpcName

The name of the RPC to be tested, for example, SDLRPCFunctionNameGetVehicleData

parameter

The name of the parameter to be tested, for example, rpm

Return Value

True if the parameter is allowed, false if it is not

View on GitHub.com
Previous Section Next Section