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

SDLFile Class Reference

Section Contents

Overview

Undocumented

persistent

Whether or not the file should persist on disk between car ignition cycles.

Objective-C

@property (readonly, getter=isPersistent, assign, nonatomic) BOOL persistent;

Swift

var isPersistent: Bool { get }

overwrite

Whether or not the file should overwrite an existing file on the remote disk with the same name.

Objective-C

@property (assign, readwrite, nonatomic) BOOL overwrite;

Swift

var overwrite: Bool { get set }

name

The name the file should be stored under on the remote disk. This is how the file will be referenced in all later calls.

Objective-C

@property (readonly, copy, nonatomic) NSString *_Nonnull name;

Swift

var name: String { get }

fileURL

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.

Objective-C

@property (readonly, copy, nonatomic, nullable) NSURL *fileURL;

Swift

var fileURL: URL? { get }

data

The binary data of the SDLFile. If initialized with data, this will be a relatively quick call, but if initialized with a file URL, this is a rather expensive call the first time. The data will be cached in RAM after the first call.

Objective-C

@property (readonly, copy, nonatomic) NSData *_Nonnull data;

Swift

var data: Data { get }

fileSize

The size of the binary data of the SDLFile.

Objective-C

@property (readonly, nonatomic) unsigned long long fileSize;

Swift

var fileSize: UInt64 { get }

fileType

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.

Objective-C

@property (readonly, strong, nonatomic) SDLFileType _Nonnull fileType;

Swift

var fileType: SDLFileType { get }

inputStream

A stream to pull binary data from a SDLFile. The stream only pulls required data from the file on disk or in memory. This reduces memory usage while uploading a large file to the remote system as each chunk of data can be released immediately after it is uploaded.

Objective-C

@property (readonly, nonatomic) NSInputStream *_Nonnull inputStream;

Swift

var inputStream: InputStream { get }

-init

Undocumented

Objective-C

- (instancetype)init NS_UNAVAILABLE;

-initWithFileURL:name:persistent:

The designated initializer for an SDL File. The only major property that is not set using this is overwrite, which defaults to NO.

Objective-C

- (nonnull instancetype)initWithFileURL:(nonnull NSURL *)url
                                   name:(nonnull NSString *)name
                             persistent:(BOOL)persistent;

Swift

init(fileURL url: URL, name: String, persistent: Bool)

Parameters

url

The file URL pointing to the local data that will be pushed to the remote system.

name

The name that the file will be stored under on the remote system and how it will be referenced from the local system. The max file name length may vary based on remote filesystem limitations.

persistent

Whether or not the file will persist between ignition cycles.

Return Value

An SDLFile object.

+persistentFileAtFileURL:name:

Create an SDL file using a local file URL.

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.

Ephemeral files should be created using ephemeralFileAtURL:name:

Warning

If this is not a readable file, this will return nil

Objective-C

+ (nonnull instancetype)persistentFileAtFileURL:(nonnull NSURL *)url
                                           name:(nonnull NSString *)name;

Parameters

url

The url to the file that should be uploaded.

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote filesystem limitations.

Return Value

An instance of this class, or nil if a readable file at the path could not be found.

+fileAtFileURL:name:

Create an SDL file using a local file URL.

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

Persistent files should be created using persistentFileAtURL:name:

Warning

If this is not a readable file, this will return nil

Objective-C

+ (nonnull instancetype)fileAtFileURL:(nonnull NSURL *)url
                                 name:(nonnull NSString *)name;

Swift

convenience init(atFileURL url: URL, name: String)

Parameters

url

The url to the file on disk that will be uploaded

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

Return Value

An instance of this class, or nil if a readable file at the url could not be found.

-initWithData:name:fileExtension:persistent:

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.

Objective-C

- (nonnull instancetype)initWithData:(nonnull NSData *)data
                                name:(nonnull NSString *)name
                       fileExtension:(nonnull NSString *)extension
                          persistent:(BOOL)persistent;

Swift

init(data: Data, name: String, fileExtension extension: String, persistent: Bool)

Parameters

data

The raw data to be used for the file

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

extension

The file extension. For example png. Currently supported file extensions are: bmp, jpg, jpeg, png, wav, mp3, aac, json. All others will be sent as binary files.

persistent

Whether or not the remote file with this data should be persistent

Return Value

An instance of this class

+persistentFileWithData:name:fileExtension:

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.

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.

Objective-C

+ (nonnull instancetype)persistentFileWithData:(nonnull NSData *)data
                                          name:(nonnull NSString *)name
                                 fileExtension:(nonnull NSString *)extension;

Parameters

data

The raw data to be used for the file

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

extension

The file extension. For example png. Currently supported file extensions are: bmp, jpg, jpeg, png, wav, mp3, aac, json. All others will be sent as binary files.

Return Value

An instance of this class

+fileWithData:name:fileExtension:

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.

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

Objective-C

+ (nonnull instancetype)fileWithData:(nonnull NSData *)data
                                name:(nonnull NSString *)name
                       fileExtension:(nonnull NSString *)extension;

Swift

convenience init(data: Data, name: String, fileExtension extension: String)

Parameters

data

The raw data to be used for the file

name

The name of the file that will be used to reference the file in the future (for example on the remote file system). The max file name length may vary based on remote file system limitations.

extension

The file extension. For example png. Currently supported file extensions are: bmp, jpg, jpeg, png, wav, mp3, aac, json. All others will be sent as binary files.

Return Value

An instance of this class

View on GitHub.com
Previous Section Next Section