summaryrefslogtreecommitdiff
path: root/docs/Classes/SDLFile.html
blob: 941ffdd802e5b46e9c145e16fa74df4a7b2a4a5b (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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<h1>SDLFile Class Reference</h1>

<h3>Section Contents</h3>

<ul>
  <li><a href="#section-persistent">persistent</a></li>
  <li><a href="#section-overwrite">overwrite</a></li>
  <li><a href="#section-name">name</a></li>
  <li><a href="#section-fileURL">fileURL</a></li>
  <li><a href="#section-data">data</a></li>
  <li><a href="#section-fileType">fileType</a></li>
  <li><a href="#section--init">-init</a></li>
  <li><a href="#section--initWithFileURL:name:persistent:">-initWithFileURL:name:persistent:</a></li>
  <li><a href="#section-+persistentFileAtFileURL:name:">+persistentFileAtFileURL:name:</a></li>
  <li><a href="#section-+ephemeralFileAtFileURL:name:">+ephemeralFileAtFileURL:name:</a></li>
  <li><a href="#section--initWithData:name:fileExtension:persistent:">-initWithData:name:fileExtension:persistent:</a></li>
  <li><a href="#section-+persistentFileWithData:name:fileExtension:">+persistentFileWithData:name:fileExtension:</a></li>
  <li><a href="#section-+ephemeralFileWithData:name:fileExtension:">+ephemeralFileWithData:name:fileExtension:</a></li>
</ul>

<h3>Overview</h3>

<p>Undocumented</p>


<section class="section task-group-section">
  <h3 id="section-persistent">
      persistent
  </h3>
  
  <p>Whether or not the file should persist on disk between car ignition cycles.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">getter</span><span class="o">=</span><span class="n">isPersistent</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">persistent</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="k">var</span> <span class="nv">persistent</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-overwrite">
      overwrite
  </h3>
  
  <p>Whether or not the file should overwrite an existing file on the remote disk with the same name.</p>

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

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

  
  
  
  <h3 id="section-name">
      name
  </h3>
  
  <p>The name the file should be stored under on the remote disk. This is how the file will be referenced in all later calls.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">copy</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n">NSString</span> <span class="o">*</span><span class="n">_Nonnull</span> <span class="n">name</span><span class="p">;</span></code></pre>

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

  
  
  
  <h3 id="section-fileURL">
      fileURL
  </h3>
  
  <p>The url the local file is stored at while waiting to push it to the remote system. If the data has not been passed to the file URL, this will be nil.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">copy</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">,</span> <span class="n">nullable</span><span class="p">)</span> <span class="n">NSURL</span> <span class="o">*</span><span class="n">fileURL</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="kd">@NSCopying</span> <span class="k">var</span> <span class="nv">fileURL</span><span class="p">:</span> <span class="kt">NSURL</span><span class="p">?</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

  
  
  
  <h3 id="section-data">
      data
  </h3>
  
  <p>The binary data of the local file.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">copy</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n">NSData</span> <span class="o">*</span><span class="n">_Nonnull</span> <span class="n">data</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="kd">@NSCopying</span> <span class="k">var</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">NSData</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

  
  
  
  <h3 id="section-fileType">
      fileType
  </h3>
  
  <p>Unless set manually, the system will attempt to determine the type of file that you have passed in. It will default to BINARY if it does not recognize the file type or the file type is not supported by SDL.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">strong</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n"><a href="../Classes/SDLFileType.html">SDLFileType</a></span> <span class="o">*</span><span class="n">_Nonnull</span> <span class="n">fileType</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="k">var</span> <span class="nv">fileType</span><span class="p">:</span> <span class="kt"><a href="../Classes/SDLFileType.html">SDLFileType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

  
  
  
  <h3 id="section--init">
      -init
  </h3>
  
  <p>Undocumented</p>

  
  
  
  
  
  <h3 id="section--initWithFileURL:name:persistent:">
      -initWithFileURL:name:persistent:
  </h3>
  
  <p>The designated initializer for an SDL File. The only major property that is not set using this is <q>overwrite</q>, which defaults to NO.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithFileURL</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSURL</span> <span class="o">*</span><span class="p">)</span><span class="nv">url</span>
                                   <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                             <span class="nf">persistent</span><span class="p">:(</span><span class="n">BOOL</span><span class="p">)</span><span class="nv">persistent</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="nf">init</span><span class="p">(</span><span class="n"><a href="../Classes/SDLFile.html#/c:objc(cs)SDLFile(py)fileURL">fileURL</a></span> <span class="nv">url</span><span class="p">:</span> <span class="kt">NSURL</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">persistent</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>url</dt>
      <dd><p>The file URL pointing to the local data that will be pushed to the remote system.</p>
</dd>
      <dt>name</dt>
      <dd><p>The name that the file will be stored under on the remote system and how it will be referenced from the local system.</p>
</dd>
      <dt>persistent</dt>
      <dd><p>Whether or not the file will persist between ignition cycles.</p>
</dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An SDLFile object.</p>

  </div>
  
  <h3 id="section-+persistentFileAtFileURL:name:">
      +persistentFileAtFileURL:name:
  </h3>
  
  <p>Create an SDL file using a local file URL.</p>

<p>This is a persistent file, it will be persisted through sessions / ignition cycles. You will only have a limited space for all files, so be sure to only persist files that are required for all or most sessions. For example, menu artwork should be persistent.</p>

<p>Ephemeral files should be created using ephemeralFileAtURL:name:</p>

<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>If this is not a readable file, this will return nil</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">persistentFileAtFileURL</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSURL</span> <span class="o">*</span><span class="p">)</span><span class="nv">url</span>
                                           <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">persistentFileAtFileURL</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="kt">NSURL</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>url</dt>
      <dd><p>The url to the file that should be uploaded.</p>
</dd>
      <dt>name</dt>
      <dd><p>The name of the file that will be used to reference the file in the future (for example on the remote file system).</p>
</dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class, or nil if a readable file at the path could not be found.</p>

  </div>
  
  <h3 id="section-+ephemeralFileAtFileURL:name:">
      +ephemeralFileAtFileURL:name:
  </h3>
  
  <p>Create an SDL file using a local file URL.</p>

<p>This is an ephemeral file, it will not be persisted through sessions / ignition cycles. Any files that you do not <em>know</em> you will use in future sessions should be created through this method. For example, album / artist artwork should be ephemeral.</p>

<p>Persistent files should be created using persistentFileAtURL:name:</p>

<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>If this is not a readable file, this will return nil</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">ephemeralFileAtFileURL</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSURL</span> <span class="o">*</span><span class="p">)</span><span class="nv">url</span>
                                          <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">ephemeralFileAtFileURL</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="kt">NSURL</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>url</dt>
      <dd><p>The url to the file that will be uploaded</p>
</dd>
      <dt>name</dt>
      <dd><p>The name of the file that will be used to reference the file in the future (for example on the remote file system).</p>
</dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class, or nil if a readable file at the url could not be found.</p>

  </div>
  
  <h3 id="section--initWithData:name:fileExtension:persistent:">
      -initWithData:name:fileExtension:persistent:
  </h3>
  
  <p>Create an SDL file using raw data. It is strongly preferred to pass a file URL instead of data, as it is currently held in memory until the file is sent.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">initWithData</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSData</span> <span class="o">*</span><span class="p">)</span><span class="nv">data</span>
                                <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                       <span class="nf">fileExtension</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">extension</span>
                          <span class="nf">persistent</span><span class="p">:(</span><span class="n">BOOL</span><span class="p">)</span><span class="nv">persistent</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="n">convenience</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">NSData</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">fileExtension</span> <span class="nv">extension</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">persistent</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>data</dt>
      <dd><p>The raw data to be used for the file</p>
</dd>
      <dt>name</dt>
      <dd><p>The name of the file that will be used to reference the file in the future (for example on the remote file system).</p>
</dd>
      <dt>extension</dt>
      <dd><p>The file extension. For example <q>png</q>. Currently supported file extensions are: <q>bmp</q>, <q>jpg</q>, <q>jpeg</q>, <q>png</q>, <q>wav</q>, <q>mp3</q>, <q>aac</q>, <q>json</q>. All others will be sent as binary files.</p>
</dd>
      <dt>persistent</dt>
      <dd><p>Whether or not the remote file with this data should be persistent</p>
</dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class</p>

  </div>
  
  <h3 id="section-+persistentFileWithData:name:fileExtension:">
      +persistentFileWithData:name:fileExtension:
  </h3>
  
  <p>Create an SDL file using raw data. It is strongly preferred to pass a file URL instead of data, as it is currently held in memory until the file is sent.</p>

<p>This is a persistent file, it will be persisted through sessions / ignition cycles. You will only have a limited space for all files, so be sure to only persist files that are required for all or most sessions. For example, menu artwork should be persistent.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">persistentFileWithData</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSData</span> <span class="o">*</span><span class="p">)</span><span class="nv">data</span>
                                          <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                                 <span class="nf">fileExtension</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">extension</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">persistentFileWithData</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">NSData</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">fileExtension</span> <span class="nv">extension</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>data</dt>
      <dd><p>The raw data to be used for the file</p>
</dd>
      <dt>name</dt>
      <dd><p>The name of the file that will be used to reference the file in the future (for example on the remote file system).</p>
</dd>
      <dt>extension</dt>
      <dd><p>The file extension. For example <q>png</q>. Currently supported file extensions are: <q>bmp</q>, <q>jpg</q>, <q>jpeg</q>, <q>png</q>, <q>wav</q>, <q>mp3</q>, <q>aac</q>, <q>json</q>. All others will be sent as binary files.</p>
</dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class</p>

  </div>
  
  <h3 id="section-+ephemeralFileWithData:name:fileExtension:">
      +ephemeralFileWithData:name:fileExtension:
  </h3>
  
  <p>Create an SDL file using raw data. It is strongly preferred to pass a file URL instead of data, as it is currently held in memory until the file is sent.</p>

<p>This is an ephemeral file, it will not be persisted through sessions / ignition cycles. Any files that you do not <em>know</em> you will use in future sessions should be created through this method. For example, album / artist artwork should be ephemeral.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight"><code><span class="k">+</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">instancetype</span><span class="p">)</span><span class="nf">ephemeralFileWithData</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSData</span> <span class="o">*</span><span class="p">)</span><span class="nv">data</span>
                                         <span class="nf">name</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">name</span>
                                <span class="nf">fileExtension</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">extension</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight"><code><span class="kd">class</span> <span class="kd">func</span> <span class="nf">ephemeralFileWithData</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">NSData</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">fileExtension</span> <span class="nv">extension</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="k">Self</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>data</dt>
      <dd><p>The raw data to be used for the file</p>
</dd>
      <dt>name</dt>
      <dd><p>The name of the file that will be used to reference the file in the future (for example on the remote file system).</p>
</dd>
      <dt>extension</dt>
      <dd><p>The file extension. For example <q>png</q>. Currently supported file extensions are: <q>bmp</q>, <q>jpg</q>, <q>jpeg</q>, <q>png</q>, <q>wav</q>, <q>mp3</q>, <q>aac</q>, <q>json</q>. All others will be sent as binary files.</p>
</dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An instance of this class</p>

  </div>
  
</section>