diff options
Diffstat (limited to 'SmartDeviceLink/SDLTouchEvent.m')
-rw-r--r-- | SmartDeviceLink/SDLTouchEvent.m | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLTouchEvent.m b/SmartDeviceLink/SDLTouchEvent.m new file mode 100644 index 000000000..e54e8b79e --- /dev/null +++ b/SmartDeviceLink/SDLTouchEvent.m @@ -0,0 +1,69 @@ +// SDLTouchEvent.m +// + + +#import "SDLTouchEvent.h" + +#import "SDLNames.h" +#import "SDLTouchCoord.h" + +@implementation SDLTouchEvent + +- (instancetype)init { + if (self = [super init]) { + } + return self; +} + +- (instancetype)initWithDictionary:(NSMutableDictionary *)dict { + if (self = [super initWithDictionary:dict]) { + } + return self; +} + +- (void)setTouchEventId:(NSNumber *)touchEventId { + if (touchEventId != nil) { + [store setObject:touchEventId forKey:NAMES_id]; + } else { + [store removeObjectForKey:NAMES_id]; + } +} + +- (NSNumber *)touchEventId { + return [store objectForKey:NAMES_id]; +} + +- (void)setTimeStamp:(NSMutableArray *)timeStamp { + if (timeStamp != nil) { + [store setObject:timeStamp forKey:NAMES_ts]; + } else { + [store removeObjectForKey:NAMES_ts]; + } +} + +- (NSMutableArray *)timeStamp { + return [store objectForKey:NAMES_ts]; +} + +- (void)setCoord:(NSMutableArray *)coord { + if (coord != nil) { + [store setObject:coord forKey:NAMES_c]; + } else { + [store removeObjectForKey:NAMES_c]; + } +} + +- (NSMutableArray *)coord { + NSMutableArray *array = [store objectForKey:NAMES_c]; + if ([array count] < 1 || [[array objectAtIndex:0] isKindOfClass:SDLTouchCoord.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary *dict in array) { + [newList addObject:[[SDLTouchCoord alloc] initWithDictionary:(NSMutableDictionary *)dict]]; + } + return newList; + } +} + +@end |