// Generated by json_to_model #import "JDObject.h" #import "DeviceModel.h" #import "CustomRadioGroup.h" #import "CustomCheckBox.h" @implementation DeviceModel //+ (JSONKeyMapper *)keyMapper { // // NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; // // //self // [dictionary setValue:@"cmdclsTypeSystemName" forKey:@"cmdcls_type_system_name"]; // [dictionary setValue:@"cmdclsTypeId" forKey:@"cmdcls_type_id"]; // [dictionary setValue:@"cmdclsCode" forKey:@"cmdcls_code"]; // [dictionary setValue:@"deviceProfileId" forKey:@"device_profile_id"]; // [dictionary setValue:@"createDatetime" forKey:@"create_datetime"]; // [dictionary setValue:@"cmdclsTypeName" forKey:@"cmdcls_type_name"]; // [dictionary setValue:@"deviceName" forKey:@"device_name"]; // [dictionary setValue:@"profileName" forKey:@"profile_name"]; // [dictionary setValue:@"imageFileName" forKey:@"image_file_name"]; // [dictionary setValue:@"contentValue" forKey:@"content_value"]; // [dictionary setValue:@"nodeName" forKey:@"node_name"]; // [dictionary setValue:@"cmdclsCount" forKey:@"cmdcls_count"]; // [dictionary setValue:@"nodeId" forKey:@"node_id"]; // [dictionary setValue:@"deviceId" forKey:@"device_id"]; // // return [[JSONKeyMapper alloc] initWithDictionary:dictionary]; //} - (NSString *)contentValueMsgOfSensorBinary { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 11001: case 11002: case 11003: case 11004: case 11005: case 11006: case 11007: case 11008: case 11009: case 11010: case 11012: case 11013: case 11014: case 11016: case 11018: if ([self.contentValue isEqualToString:@"TRUE"]) { msg = NSLocalizedString(@"감지됨", @"감지됨"); } else if ([self.contentValue isEqualToString:@"FALSE"]) { msg = NSLocalizedString(@"정상", @"정상"); } else { msg = @"-"; } break; case 11011: if ([self.contentValue isEqualToString:@"TRUE"]) { msg = NSLocalizedString(@"열림", @"열림"); } else if ([self.contentValue isEqualToString:@"FALSE"]) { msg = NSLocalizedString(@"닫힘", @"닫힘"); } else { msg = @"-"; } case 11015: case 11017: if ([self.contentValue isEqualToString:@"TRUE"]) { msg = NSLocalizedString(@"들어옴", @"들어옴"); } else if ([self.contentValue isEqualToString:@"FALSE"]) { msg = NSLocalizedString(@"나감", @"나감"); } else { msg = @"-"; } break; } return msg; } - (NSString *)contentValueMsgOfThermostatMode { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 13001: case 13002: case 13003: case 13004: if ([self.contentValue isEqualToString:@"OFF"]) { msg = NSLocalizedString(@"꺼짐", @"꺼짐"); } else if ([self.contentValue isEqualToString:@"COOL"]) { msg = NSLocalizedString(@"냉방", @"냉방"); } else if ([self.contentValue isEqualToString:@"HEAT"]) { msg = NSLocalizedString(@"난방", @"난방"); } else if ([self.contentValue isEqualToString:@"AUTO"]) { msg = NSLocalizedString(@"자동", @"자동"); } else if ([self.contentValue isEqualToString:@"FAN_ONLY"]) { msg = NSLocalizedString(@"환기", @"환기"); } else if ([self.contentValue isEqualToString:@"DRY_AIR"]) { msg = NSLocalizedString(@"제습", @"제습"); } else if ([self.contentValue isEqualToString:@"AWAY"]) { msg = NSLocalizedString(@"외출", @"외출"); } else { msg = @"-"; } break; } return msg; } - (NSString *)contentValueMsgOfLock { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 14001: if ([self.contentValue isEqualToString:@"LOCKED"]) { msg = NSLocalizedString(@"잠김", @"잠김"); } else if ([self.contentValue isEqualToString:@"UNLOCKED"]) { msg = NSLocalizedString(@"열림", @"열림"); } else if ([self.contentValue isEqualToString:@"JAMMED"]) { msg = NSLocalizedString(@"걸림", @"걸림"); } else if ([self.contentValue isEqualToString:@"FORCED_OPEN"]) { msg = NSLocalizedString(@"수동", @"수동"); } else if ([self.contentValue isEqualToString:@"UNSPECIFIED"]) { msg = NSLocalizedString(@"오류", @"오류"); } else { msg = @"-"; } break; case 14002: case 14003: if ([self.contentValue isEqualToString:@"LOCKED"]) { msg = @"잠김"; } else if ([self.contentValue isEqualToString:@"UNLOCKED"]) { msg = @"열림"; } else { msg = @"-"; } break; } return msg; } - (NSString *)contentValueMsgOfSwitchBinary { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 17001: case 17002: if ([self.contentValue isEqualToString:@"ON"]) { msg = NSLocalizedString(@"켜짐", @"켜짐"); } else if ([self.contentValue isEqualToString:@"OFF"]) { msg = NSLocalizedString(@"꺼짐", @"꺼짐"); } else { msg = @"-"; } break; } return msg; } - (NSString *)contentValueMsgOfValve { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 36001: case 36002: case 36003: if ([self.contentValue isEqualToString:@"OPEN"]) { msg = NSLocalizedString(@"열림", @"열림"); } else if ([self.contentValue isEqualToString:@"CLOSE"]) { msg = NSLocalizedString(@"잠김", @"잠김"); } else { msg = @"-"; } break; } return msg; } - (NSString *)contentValueMsg { switch ([self cmdclsType]) { case CmdClsTypeSensorBinary: _contentValueMsg = [self contentValueMsgOfSensorBinary]; break; case CmdClsTypeThermostatMode: _contentValueMsg = [self contentValueMsgOfThermostatMode]; break; case CmdClsTypeLock: _contentValueMsg = [self contentValueMsgOfLock]; break; case CmdClsTypeSwitchBinary: _contentValueMsg = [self contentValueMsgOfSwitchBinary]; break; case CmdClsTypeSpeedControl: _contentValueMsg = [self contentValueMsgOfSpeedControl]; break; case CmdClsTypeAVControlPlayback: _contentValueMsg = [self contentValueMsgOfAVPlayback]; break; case CmdClsTypeValve: _contentValueMsg = [self contentValueMsgOfValve]; default: break; } return _contentValueMsg; } - (NSString *)contentValueMsgOfSpeedControl { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 20001: if ([self.contentValue isEqualToString:@"OFF"]) { msg = NSLocalizedString(@"꺼짐", @"꺼짐"); } else if ([self.contentValue isEqualToString:@"LOW"]) { msg = NSLocalizedString(@"약", @"약"); } else if ([self.contentValue isEqualToString:@"MEDIUM"]) { msg = NSLocalizedString(@"중", @"중"); } else if ([self.contentValue isEqualToString:@"HIGH"]) { msg = NSLocalizedString(@"강", @"강"); } else { msg = @"-"; } break; } return msg; } - (NSString *)contentValueMsgOfAVPlayback { NSInteger typeId = [_cmdclsTypeId integerValue]; NSString *msg = ksEmptyString; switch (typeId) { case 21001: if ([self.contentValue isEqualToString:@"PLAYING"]) { msg = NSLocalizedString(@"재생 중", @"재생 중"); } else if ([self.contentValue isEqualToString:@"PAUSED"]) { msg = NSLocalizedString(@"정지 됨", @"정지 됨"); } else { msg = @"-"; } break; } return msg; } - (instancetype)initWithSubItem:(ItemSubModel *)subItem {//mobile devices. if (self = [super init]) { self.deviceId = subItem.sourceId; self.deviceName = subItem.sourceName; self.nodeId = subItem.sourceSubId; self.nodeName = subItem.sourceSubName; self.conditionTypeCode = subItem.conditionTypeCode; self.dataTypeCode = subItem.dataTypeCode; self.cmdclsValue = subItem.cmdclsValue; self.nickname = subItem.nickname; self.deleteYn = subItem.deleteYn; // objc_setAssociatedObject(self, @"CHECK_STATUS", @YES, OBJC_ASSOCIATION_COPY_NONATOMIC); //for checkbox [[JDFacade facade] setRadioButtonStatus:@YES object:self]; //for radio box } return self; } + (NSString *)contentValueMsgByCmdClsCode:(NSString *)cmdclsCode cmdclsTypeId:(NSString *)cmdclsTypeId contentValue:(NSString *)contentValue { DeviceModel *tmpDevice = [[DeviceModel alloc] init]; tmpDevice.cmdclsCode = cmdclsCode; tmpDevice.cmdclsTypeId = cmdclsTypeId; tmpDevice.contentValue = contentValue; return tmpDevice.contentValueMsg; } @end @implementation DeviceListModel @end @implementation NodeModel //- (CmdClsType)cmdclsType { // return [DeviceModel cmdclsTypeForCode:_cmdclsCode]; //} @end @implementation DeviceDetailModel @end @implementation PredefinedDeviceModel //+ (JSONKeyMapper *)keyMapper { // // NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; // // //self // [dictionary setValue:@"cmdclsTypeSystemName" forKey:@"cmdcls_type_system_name"]; // [dictionary setValue:@"cmdclsTypeId" forKey:@"cmdcls_type_id"]; // [dictionary setValue:@"cmdclsCode" forKey:@"cmdcls_code"]; // [dictionary setValue:@"deviceProfileId" forKey:@"device_profile_id"]; // [dictionary setValue:@"createDatetime" forKey:@"create_datetime"]; // [dictionary setValue:@"cmdclsTypeName" forKey:@"cmdcls_type_name"]; // [dictionary setValue:@"deviceName" forKey:@"device_name"]; // [dictionary setValue:@"profileName" forKey:@"profile_name"]; // [dictionary setValue:@"imageFileName" forKey:@"image_file_name"]; // [dictionary setValue:@"contentValue" forKey:@"content_value"]; // [dictionary setValue:@"nodeName" forKey:@"node_name"]; // [dictionary setValue:@"cmdclsCount" forKey:@"cmdcls_count"]; // [dictionary setValue:@"nodeId" forKey:@"node_id"]; // [dictionary setValue:@"deviceId" forKey:@"device_id"]; // [dictionary setValue:@"cmdclsValue" forKey:@"cmdcls_value"]; // [dictionary setValue:@"conditionTypeCode" forKey:@"condition_type_code"]; // [dictionary setValue:@"dataTypeCode" forKey:@"data_type_code"]; // // return [[JSONKeyMapper alloc] initWithDictionary:dictionary]; //} - (instancetype)initWithSubItem:(ItemSubModel *)subItem { if (self = [super init]) { self.deviceId = subItem.sourceId; self.deviceName = subItem.sourceName; self.nodeId = subItem.sourceSubId; self.nodeName = subItem.sourceSubName; self.conditionTypeCode = subItem.conditionTypeCode; self.dataTypeCode = subItem.dataTypeCode; self.cmdclsValue = subItem.cmdclsValue; self.predCmdclsValue = subItem.predCmdclsValue; self.deleteYn = subItem.deleteYn; [[JDFacade facade] setCheckBoxStatus:@YES object:self]; //for check box [[JDFacade facade] setRadioButtonStatus:@YES object:self]; //for radio box } return self; } @end @implementation PredefinedDeviceListModel @end @implementation DeviceIconModel @end @implementation DeviceIconListModel @end