summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLMediaServiceData.m
blob: ffdc4b9199cb72c2e8e0866dbc1005d752c0a2bf (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
//
//  SDLMediaServiceData.m
//  SmartDeviceLink
//
//  Created by Nicole on 2/8/19.
//  Copyright © 2019 smartdevicelink. All rights reserved.
//

#import "SDLMediaServiceData.h"

#import "NSMutableDictionary+Store.h"
#import "SDLRPCParameterNames.h"

NS_ASSUME_NONNULL_BEGIN

@implementation SDLMediaServiceData

- (instancetype)initWithMediaType:(nullable SDLMediaType)mediaType mediaTitle:(nullable NSString *)mediaTitle mediaArtist:(nullable NSString *)mediaArtist mediaAlbum:(nullable NSString *)mediaAlbum playlistName:(nullable NSString *)playlistName isExplicit:(BOOL)isExplicit trackPlaybackProgress:(UInt32)trackPlaybackProgress trackPlaybackDuration:(UInt32)trackPlaybackDuration queuePlaybackProgress:(UInt32)queuePlaybackProgress queuePlaybackDuration:(UInt32)queuePlaybackDuration queueCurrentTrackNumber:(UInt32)queueCurrentTrackNumber queueTotalTrackCount:(UInt32)queueTotalTrackCount {
    self = [self init];
    if (!self) {
        return nil;
    }

    self.mediaType = mediaType;
    self.mediaTitle = mediaTitle;
    self.mediaArtist = mediaArtist;
    self.mediaAlbum = mediaAlbum;
    self.playlistName = playlistName;
    self.isExplicit = @(isExplicit);
    self.trackPlaybackProgress = @(trackPlaybackProgress);
    self.trackPlaybackDuration = @(trackPlaybackDuration);
    self.queuePlaybackProgress = @(queuePlaybackProgress);
    self.queuePlaybackDuration = @(queuePlaybackDuration);
    self.queueCurrentTrackNumber = @(queueCurrentTrackNumber);
    self.queueTotalTrackCount = @(queueTotalTrackCount);
    
    return self;
}

- (void)setMediaType:(nullable SDLMediaType)mediaType {
    [store sdl_setObject:mediaType forName:SDLRPCParameterNameMediaType];
}

- (nullable SDLMediaType)mediaType {
    return [store sdl_enumForName:SDLRPCParameterNameMediaType error:nil];
}

- (void)setMediaTitle:(nullable NSString *)mediaTitle {
    [store sdl_setObject:mediaTitle forName:SDLRPCParameterNameMediaTitle];
}

- (nullable NSString *)mediaTitle {
    return [store sdl_objectForName:SDLRPCParameterNameMediaTitle ofClass:NSString.class];
}

- (void)setMediaArtist:(nullable NSString *)mediaArtist {
    [store sdl_setObject:mediaArtist forName:SDLRPCParameterNameMediaArtist];
}

- (nullable NSString *)mediaArtist {
    return [store sdl_objectForName:SDLRPCParameterNameMediaArtist ofClass:NSString.class];
}

- (void)setMediaAlbum:(nullable NSString *)mediaAlbum {
    [store sdl_setObject:mediaAlbum forName:SDLRPCParameterNameMediaAlbum];
}

- (nullable NSString *)mediaAlbum {
    return [store sdl_objectForName:SDLRPCParameterNameMediaAlbum ofClass:NSString.class];
}

- (void)setPlaylistName:(nullable NSString *)playlistName {
    [store sdl_setObject:playlistName forName:SDLRPCParameterNamePlaylistName];
}

- (nullable NSString *)playlistName {
    return [store sdl_objectForName:SDLRPCParameterNamePlaylistName ofClass:NSString.class];
}

- (void)setIsExplicit:(nullable NSNumber<SDLBool> *)isExplicit {
    [store sdl_setObject:isExplicit forName:SDLRPCParameterNameIsExplicit];
}

- (nullable NSNumber<SDLBool> *)isExplicit {
    return [store sdl_objectForName:SDLRPCParameterNameIsExplicit ofClass:NSNumber.class];
}

- (void)setTrackPlaybackProgress:(nullable NSNumber<SDLInt> *)trackPlaybackProgress {
    [store sdl_setObject:trackPlaybackProgress forName:SDLRPCParameterNameTrackPlaybackProgress];
}

- (nullable NSNumber<SDLInt> *)trackPlaybackProgress {
    return [store sdl_objectForName:SDLRPCParameterNameTrackPlaybackProgress ofClass:NSNumber.class];
}

- (void)setTrackPlaybackDuration:(nullable NSNumber<SDLInt> *)trackPlaybackDuration {
    [store sdl_setObject:trackPlaybackDuration forName:SDLRPCParameterNameTrackPlaybackDuration];
}

- (nullable NSNumber<SDLInt> *)trackPlaybackDuration {
    return [store sdl_objectForName:SDLRPCParameterNameTrackPlaybackDuration ofClass:NSNumber.class];
}

- (void)setQueuePlaybackProgress:(nullable NSNumber<SDLInt> *)queuePlaybackProgress {
    [store sdl_setObject:queuePlaybackProgress forName:SDLRPCParameterNameQueuePlaybackProgress];
}

- (nullable NSNumber<SDLInt> *)queuePlaybackProgress {
    return [store sdl_objectForName:SDLRPCParameterNameQueuePlaybackProgress ofClass:NSNumber.class];
}

- (void)setQueuePlaybackDuration:(nullable NSNumber<SDLInt> *)queuePlaybackDuration {
    [store sdl_setObject:queuePlaybackDuration forName:SDLRPCParameterNameQueuePlaybackDuration];
}

- (nullable NSNumber<SDLInt> *)queuePlaybackDuration {
    return [store sdl_objectForName:SDLRPCParameterNameQueuePlaybackDuration ofClass:NSNumber.class];
}

- (void)setQueueCurrentTrackNumber:(nullable NSNumber<SDLInt> *)queueCurrentTrackNumber {
    [store sdl_setObject:queueCurrentTrackNumber forName:SDLRPCParameterNameQueueCurrentTrackNumber];
}

- (nullable NSNumber<SDLInt> *)queueCurrentTrackNumber {
    return [store sdl_objectForName:SDLRPCParameterNameQueueCurrentTrackNumber ofClass:NSNumber.class];
}

- (void)setQueueTotalTrackCount:(nullable NSNumber<SDLInt> *)queueTotalTrackCount {
    [store sdl_setObject:queueTotalTrackCount forName:SDLRPCParameterNameQueueTotalTrackCount];
}

- (nullable NSNumber<SDLInt> *)queueTotalTrackCount {
    return [store sdl_objectForName:SDLRPCParameterNameQueueTotalTrackCount ofClass:NSNumber.class];
}

@end

NS_ASSUME_NONNULL_END