summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLDiagnosticMessage.m
blob: dff509a4d7ae824148f58c5940620e4dedb467a5 (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
//  SDLDiagnosticMessage.m
//


#import "SDLDiagnosticMessage.h"

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

NS_ASSUME_NONNULL_BEGIN

@implementation SDLDiagnosticMessage

- (instancetype)init {
    if (self = [super initWithName:SDLNameDiagnosticMessage]) {
    }
    return self;
}

- (instancetype)initWithTargetId:(UInt16)targetId length:(UInt16)length data:(NSArray<NSData *> *)data {
    self = [self init];
    if (!self) {
        return nil;
    }

    self.targetID = @(targetId);
    self.messageLength = @(length);
    self.messageData = [data mutableCopy];

    return self;
}

- (void)setTargetID:(NSNumber<SDLInt> *)targetID {
    [parameters sdl_setObject:targetID forName:SDLNameTargetId];
}

- (NSNumber<SDLInt> *)targetID {
    return [parameters sdl_objectForName:SDLNameTargetId];
}

- (void)setMessageLength:(NSNumber<SDLInt> *)messageLength {
    [parameters sdl_setObject:messageLength forName:SDLNameMessageLength];
}

- (NSNumber<SDLInt> *)messageLength {
    return [parameters sdl_objectForName:SDLNameMessageLength];
}

- (void)setMessageData:(NSArray<NSNumber<SDLInt> *> *)messageData {
    [parameters sdl_setObject:messageData forName:SDLNameMessageData];
}

- (NSArray<NSNumber<SDLInt> *> *)messageData {
    return [parameters sdl_objectForName:SDLNameMessageData];
}

@end

NS_ASSUME_NONNULL_END