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


#import "SDLReadDIDResponse.h"

#import "SDLDIDResult.h"


@implementation SDLReadDIDResponse

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

- (instancetype)initWithDictionary:(NSMutableDictionary *)dict {
    if (self = [super initWithDictionary:dict]) {
    }
    return self;
}

- (void)setDidResult:(NSMutableArray *)didResult {
    if (didResult != nil) {
        [parameters setObject:didResult forKey:SDLNameDidResult];
    } else {
        [parameters removeObjectForKey:SDLNameDidResult];
    }
}

- (NSMutableArray *)didResult {
    NSMutableArray *array = [parameters objectForKey:SDLNameDidResult];
    if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLDIDResult.class]) {
        return array;
    } else {
        NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]];
        for (NSDictionary *dict in array) {
            [newList addObject:[[SDLDIDResult alloc] initWithDictionary:(NSMutableDictionary *)dict]];
        }
        return newList;
    }
}

@end