summaryrefslogtreecommitdiff
path: root/docs/Classes/SDLPermissionManager.html
blob: 6fed857a5f71a0b2db30e10a9233294dbaf8983a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<h1>SDLPermissionManager Class Reference</h1>

<h3>Section Contents</h3>

<ul>
  <li><a href="#section-requiresEncryption">requiresEncryption</a></li>
  <li><a href="#section--startWithCompletionHandler:">-startWithCompletionHandler:</a></li>
  <li><a href="#section--stop">-stop</a></li>
  <li><a href="#section--isRPCAllowed:">-isRPCAllowed:</a></li>
  <li><a href="#section--groupStatusOfRPCs:">-groupStatusOfRPCs:</a></li>
  <li><a href="#section--statusOfRPCs:">-statusOfRPCs:</a></li>
  <li><a href="#section--addObserverForRPCs:groupType:withHandler:">-addObserverForRPCs:groupType:withHandler:</a></li>
  <li><a href="#section--removeAllObservers">-removeAllObservers</a></li>
  <li><a href="#section--removeObserverForIdentifier:">-removeObserverForIdentifier:</a></li>
  <li><a href="#section--rpcRequiresEncryption:">-rpcRequiresEncryption:</a></li>
</ul>

<h3>Overview</h3>

<p>Undocumented</p>


<section class="section task-group-section">
  <h3 id="section-requiresEncryption">
      requiresEncryption
  </h3>
  
  <p>Flag indicating if the app requires an encryption service to be active.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">assign</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n">BOOL</span> <span class="n">requiresEncryption</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="k">var</span> <span class="nv">requiresEncryption</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

  
  
  
  <h3 id="section--startWithCompletionHandler:">
      -startWithCompletionHandler:
  </h3>
  
  <p>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 <code><a href="../Classes/SDLManager.html">SDLManager</a></code>.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">startWithCompletionHandler</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="kt">void</span> <span class="p">(</span><span class="o">^</span><span class="p">)(</span><span class="n">BOOL</span><span class="p">,</span> <span class="n">NSError</span> <span class="o">*</span><span class="n">_Nullable</span><span class="p">))</span><span class="nv">completionHandler</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">start</span><span class="p">(</span><span class="nv">completionHandler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Bool</span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>completionHandler</dt>
      <dd><p>The block to be called when the manager&rsquo;s setup is complete.</p></dd>
  </dl>
  
  <h3 id="section--stop">
      -stop
  </h3>
  
  <p>Stop the manager. This method is used internally.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">stop</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">stop</span><span class="p">()</span></code></pre>

  
  
  
  <h3 id="section--isRPCAllowed:">
      -isRPCAllowed:
  </h3>
  
  <p>Determine if an individual RPC is allowed for the current HMI level</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">BOOL</span><span class="p">)</span><span class="nf">isRPCAllowed</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionRPCName">SDLPermissionRPCName</a></span><span class="p">)</span><span class="nv">rpcName</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isRPCAllowed</span><span class="p">(</span><span class="n">_</span> <span class="nv">rpcName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcName</dt>
      <dd><p>The name of the RPC to be tested, for example, SDLShow</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>YES if the RPC is allowed at the current HMI level, NO if not</p>
  </div>
  
  <h3 id="section--groupStatusOfRPCs:">
      -groupStatusOfRPCs:
  </h3>
  
  <p>Determine if all RPCs are allowed for the current HMI level</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Enums/SDLPermissionGroupStatus.html">SDLPermissionGroupStatus</a></span><span class="p">)</span><span class="nf">groupStatusOfRPCs</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionRPCName">SDLPermissionRPCName</a></span><span class="o">&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">rpcNames</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">groupStatus</span><span class="p">(</span><span class="n">ofRPCs</span> <span class="nv">rpcNames</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Enums/SDLPermissionGroupStatus.html">SDLPermissionGroupStatus</a></span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcNames</dt>
      <dd><p>The RPCs to check</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>AllAllowed if all of the permissions are allowed, AllDisallowed if all the permissions are disallowed, Any if some are allowed, and some are disallowed</p>
  </div>
  
  <h3 id="section--statusOfRPCs:">
      -statusOfRPCs:
  </h3>
  
  <p>Retrieve a dictionary with keys that are the passed in RPC names, and objects of an NSNumber<BOOL> specifying if that RPC is currently allowed</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSDictionary</span><span class="o">&lt;</span><span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionRPCName">SDLPermissionRPCName</a></span><span class="p">,</span> <span class="n">NSNumber</span> <span class="o">*&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nf">statusOfRPCs</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionRPCName">SDLPermissionRPCName</a></span><span class="o">&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">rpcNames</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">status</span><span class="p">(</span><span class="n">ofRPCs</span> <span class="nv">rpcNames</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">NSNumber</span><span class="p">]</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcNames</dt>
      <dd><p>An array of RPC names to check</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>A dictionary specifying if the passed in RPC names are currently allowed or not</p>
  </div>
  
  <h3 id="section--addObserverForRPCs:groupType:withHandler:">
      -addObserverForRPCs:groupType:withHandler:
  </h3>
  
  <p>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.</p>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>This block will be captured by the SDLPermissionsManager, be sure to use <a href="http://www.logicsector.com/ios/avoiding-objc-retain-cycles-with-weakself-and-strongself-the-easy-way/">weakself/strongself</a> if you are referencing self within your observer block.</p>

</div>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>The observer may be called before this method returns, do not attempt to remove the observer from within the observer. That could send <code>nil</code> to removeObserverForIdentifier:. If you want functionality like that, call groupStatusOfRPCs: instead.</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionObserverIdentifier">SDLPermissionObserverIdentifier</a></span><span class="p">)</span>
    <span class="nf">addObserverForRPCs</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionRPCName">SDLPermissionRPCName</a></span><span class="o">&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">rpcNames</span>
             <span class="nf">groupType</span><span class="p">:(</span><span class="n"><a href="../Enums/SDLPermissionGroupType.html">SDLPermissionGroupType</a></span><span class="p">)</span><span class="nv">groupType</span>
           <span class="nf">withHandler</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionsChangedHandler">SDLPermissionsChangedHandler</a></span><span class="p">)</span><span class="nv">handler</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">addObserver</span><span class="p">(</span><span class="n">forRPCs</span> <span class="nv">rpcNames</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">],</span> <span class="nv">groupType</span><span class="p">:</span> <span class="kt"><a href="../Enums/SDLPermissionGroupType.html">SDLPermissionGroupType</a></span><span class="p">,</span> <span class="n">withHandler</span> <span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="kt"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionsChangedHandler">SDLPermissionsChangedHandler</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UUID</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcNames</dt>
      <dd><p>The RPCs to be observed</p></dd>
      <dt>groupType</dt>
      <dd><p>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.</p></dd>
      <dt>handler</dt>
      <dd><p>The block that will be called whenever permissions change.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An identifier that can be passed to removeObserverForIdentifer: to remove the observer</p>
  </div>
  
  <h3 id="section--removeAllObservers">
      -removeAllObservers
  </h3>
  
  <p>Remove every current observer</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">removeAllObservers</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">removeAllObservers</span><span class="p">()</span></code></pre>

  
  
  
  <h3 id="section--removeObserverForIdentifier:">
      -removeObserverForIdentifier:
  </h3>
  
  <p>Remove block observers for the specified RPC</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">removeObserverForIdentifier</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionObserverIdentifier">SDLPermissionObserverIdentifier</a></span><span class="p">)</span><span class="nv">identifier</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">removeObserver</span><span class="p">(</span><span class="n">forIdentifier</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">UUID</span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>identifier</dt>
      <dd><p>The identifier specifying which observer to remove</p></dd>
  </dl>
  
  <h3 id="section--rpcRequiresEncryption:">
      -rpcRequiresEncryption:
  </h3>
  
  <p>Check whether or not an RPC needs encryption.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">BOOL</span><span class="p">)</span><span class="nf">rpcRequiresEncryption</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionRPCName">SDLPermissionRPCName</a></span><span class="p">)</span><span class="nv">rpcName</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">rpcRequiresEncryption</span><span class="p">(</span><span class="n">_</span> <span class="nv">rpcName</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

  
  
  
</section>