diff options
Diffstat (limited to 'SmartDeviceLink/SDLUpdateTurnList.m')
-rw-r--r-- | SmartDeviceLink/SDLUpdateTurnList.m | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLUpdateTurnList.m b/SmartDeviceLink/SDLUpdateTurnList.m new file mode 100644 index 000000000..7063c9c29 --- /dev/null +++ b/SmartDeviceLink/SDLUpdateTurnList.m @@ -0,0 +1,67 @@ +// SDLUpdateTurnList.m +// + + +#import "SDLUpdateTurnList.h" + +#import "SDLNames.h" +#import "SDLSoftButton.h" +#import "SDLTurn.h" + +@implementation SDLUpdateTurnList + +- (instancetype)init { + if (self = [super initWithName:NAMES_UpdateTurnList]) { + } + return self; +} + +- (instancetype)initWithDictionary:(NSMutableDictionary *)dict { + if (self = [super initWithDictionary:dict]) { + } + return self; +} + +- (void)setTurnList:(NSMutableArray *)turnList { + if (turnList != nil) { + [parameters setObject:turnList forKey:NAMES_turnList]; + } else { + [parameters removeObjectForKey:NAMES_turnList]; + } +} + +- (NSMutableArray *)turnList { + NSMutableArray *array = [parameters objectForKey:NAMES_turnList]; + if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLTurn.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary *dict in array) { + [newList addObject:[[SDLTurn alloc] initWithDictionary:(NSMutableDictionary *)dict]]; + } + return newList; + } +} + +- (void)setSoftButtons:(NSMutableArray *)softButtons { + if (softButtons != nil) { + [parameters setObject:softButtons forKey:NAMES_softButtons]; + } else { + [parameters removeObjectForKey:NAMES_softButtons]; + } +} + +- (NSMutableArray *)softButtons { + NSMutableArray *array = [parameters objectForKey:NAMES_softButtons]; + if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLSoftButton.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary *dict in array) { + [newList addObject:[[SDLSoftButton alloc] initWithDictionary:(NSMutableDictionary *)dict]]; + } + return newList; + } +} + +@end |