Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Documentation
Sidebar

SDLPermissionManager Class Reference

Section Contents

Overview

Undocumented

-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(completionHandler: @escaping (Bool, Error?) -> Void)

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()

-isRPCAllowed:

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

Objective-C

- (BOOL)isRPCAllowed:(nonnull SDLPermissionRPCName)rpcName;

Swift

func isRPCAllowed(_ rpcName: String) -> Bool

Parameters

rpcName

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

Return Value

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

-groupStatusOfRPCs:

Determine if all RPCs are allowed for the current HMI level

Objective-C

- (SDLPermissionGroupStatus)groupStatusOfRPCs:
    (nonnull NSArray<SDLPermissionRPCName> *)rpcNames;

Swift

func groupStatus(ofRPCs rpcNames: [String]) -> 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

-statusOfRPCs:

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<SDLPermissionRPCName, NSNumber<SDLBool> *> *)
statusOfRPCs:(nonnull NSArray<SDLPermissionRPCName> *)rpcNames;

Swift

func status(ofRPCs rpcNames: [String]) -> [String : NSNumber & SDLBool]

Parameters

rpcNames

An array of RPC names to check

Return Value

A dictionary specifying if the passed in RPC names are currently allowed or not

-addObserverForRPCs:groupType:withHandler:

Add an observer for specified RPC names, with a callback that will be called whenever the value changes, as well as immediately with the current status.

Warning

This block will be captured by the SDLPermissionsManager, be sure to use weakself/strongself if you are referencing self within your observer block.

Warning

The observer may be called before this method returns, do not attempt to remove the observer from within the observer. That could send nil to removeObserverForIdentifier:. If you want functionality like that, call groupStatusOfRPCs: instead.

Objective-C

- (nonnull SDLPermissionObserverIdentifier)
addObserverForRPCs:(nonnull NSArray<SDLPermissionRPCName> *)rpcNames
         groupType:(SDLPermissionGroupType)groupType
       withHandler:(nonnull SDLPermissionsChangedHandler)handler;

Swift

func addObserver(forRPCs rpcNames: [String], groupType: SDLPermissionGroupType, withHandler handler: @escaping SDLPermissionsChangedHandler) -> UUID

Parameters

rpcNames

The RPCs 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

View on GitHub.com
Previous Section Next Section