summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLHapticRect.m
blob: b7d74c3a3f2a8b3df26204369fd44ffc689bb445 (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
//
//  SDLHapticRect.m
//  SmartDeviceLink-iOS
//
//  Created by Nicole on 8/3/17.
//  Copyright © 2017 smartdevicelink. All rights reserved.
//

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

NS_ASSUME_NONNULL_BEGIN

@implementation SDLHapticRect

- (instancetype)initWithId:(UInt32)id rect:(nonnull SDLRectangle *)rect {
    self = [self init];
    if (!self) {
        return nil;
    }

    self.id = @(id);
    self.rect = rect;

    return self;
}

- (void)setId:(NSNumber<SDLInt> *)id {
    [store sdl_setObject:id forName:SDLRPCParameterNameId];
}

- (NSNumber<SDLInt> *)id {
    NSError *error = nil;
    return [store sdl_objectForName:SDLRPCParameterNameId ofClass:NSNumber.class error:&error];
}

- (void)setRect:(SDLRectangle *)rect {
    [store sdl_setObject:rect forName:SDLRPCParameterNameRect];
}

- (SDLRectangle *)rect {
    return [store sdl_objectForName:SDLRPCParameterNameRect ofClass:SDLRectangle.class error:nil];
}

@end

NS_ASSUME_NONNULL_END