summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLAudioControlData.m
blob: 67296c9aed42b8eea098c7dddd49917e6fd7a355 (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
//  SDLAudioControlData.m
//

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

NS_ASSUME_NONNULL_BEGIN

@implementation SDLAudioControlData

- (instancetype)initWithSource:(nullable SDLPrimaryAudioSource)source keepContext:(nullable NSNumber<SDLBool> *)keepContext volume:(nullable NSNumber<SDLInt> *)volume equalizerSettings:(nullable NSArray<SDLEqualizerSettings *> *)equalizerSettings {
    self = [self init];
    if (!self) {
        return nil;
    }

    self.source = source;
    self.keepContext = keepContext;
    self.volume = volume;
    self.equalizerSettings = equalizerSettings;

    return self;
}

- (void)setSource:(nullable SDLPrimaryAudioSource)source {
    [self.store sdl_setObject:source forName:SDLRPCParameterNameSource];

}

- (nullable SDLPrimaryAudioSource)source {
    return [self.store sdl_enumForName:SDLRPCParameterNameSource error:nil];
}

- (void)setKeepContext:(nullable NSNumber<SDLBool> *)keepContext {
    [self.store sdl_setObject:keepContext forName:SDLRPCParameterNameKeepContext];
}

- (nullable NSNumber<SDLBool> *)keepContext {
    return [self.store sdl_objectForName:SDLRPCParameterNameKeepContext ofClass:NSNumber.class error:nil];
}

- (void)setVolume:(nullable NSNumber<SDLInt> *)volume {
    [self.store sdl_setObject:volume forName:SDLRPCParameterNameVolume];
}

- (nullable NSNumber<SDLInt> *)volume {
    return [self.store sdl_objectForName:SDLRPCParameterNameVolume ofClass:NSNumber.class error:nil];
}

- (void)setEqualizerSettings:(nullable NSArray<SDLEqualizerSettings *> *)equalizerSettings {
    [self.store sdl_setObject:equalizerSettings forName:SDLRPCParameterNameEqualizerSettings];
}

- (nullable NSArray<SDLEqualizerSettings *> *)equalizerSettings {
    return [self.store sdl_objectsForName:SDLRPCParameterNameEqualizerSettings ofClass:SDLEqualizerSettings.class error:nil];
}

@end

NS_ASSUME_NONNULL_END