DeviceModel.m 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. // Generated by json_to_model
  2. #import "JDObject.h"
  3. #import "DeviceModel.h"
  4. #import "CustomRadioGroup.h"
  5. #import "CustomCheckBox.h"
  6. @implementation DeviceModel
  7. //FIRMWARE_VERSION
  8. //SWITCH_BINARY
  9. //SWITCH_MULTILEVEL
  10. //SWITCH_COLOR
  11. //SENSOR_BINARY
  12. //SENSOR_MULTILEVEL
  13. //THERMOSTAT_MODE
  14. //THERMOSTAT_FAN_MODE
  15. //THERMOSTAT_SETPOINT
  16. //LOCK
  17. //METER
  18. //AV_CONTROL_PLAYBACK
  19. //HOME_MODE
  20. #define ksCmdClassTypeFirmwareVersion @"FIRMWARE_VERSION"
  21. #define ksCmdClassTypeSwitchBinary @"SWITCH_BINARY"
  22. #define ksCmdClassTypeSwitchMultiLevel @"SWITCH_MULTILEVEL"
  23. #define ksCmdClassTypeSwitchColor @"SWITCH_COLOR"
  24. #define ksCmdClassTypeSensorBinary @"SENSOR_BINARY"
  25. #define ksCmdClassTypeSensorMultiLevel @"SENSOR_MULTILEVEL"
  26. #define ksCmdClassTypeThermostatMode @"THERMOSTAT_MODE"
  27. #define ksCmdClassTypeThermostatFanMode @"THERMOSTAT_FAN_MODE"
  28. #define ksCmdClassTypeThermostatSetPoint @"THERMOSTAT_SETPOINT"
  29. #define ksCmdClassTypeLock @"LOCK"
  30. #define ksCmdClassTypeMeterCurrent @"METER_CURRENT"
  31. #define ksCmdClassTypeMeterTotal @"METER_TOTAL"
  32. #define ksCmdClassTypeAVControlPlayback @"AV_CONTROL_PLAYBACK"
  33. #define ksCmdClassTypeHomeMode @"HOME_MODE"
  34. #define ksCmdClassTypeSpeedControl @"SPEED_CONTROL"
  35. //+ (JSONKeyMapper *)keyMapper {
  36. //
  37. // NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
  38. //
  39. // //self
  40. // [dictionary setValue:@"cmdclsTypeSystemName" forKey:@"cmdcls_type_system_name"];
  41. // [dictionary setValue:@"cmdclsTypeId" forKey:@"cmdcls_type_id"];
  42. // [dictionary setValue:@"cmdclsCode" forKey:@"cmdcls_code"];
  43. // [dictionary setValue:@"deviceProfileId" forKey:@"device_profile_id"];
  44. // [dictionary setValue:@"createDatetime" forKey:@"create_datetime"];
  45. // [dictionary setValue:@"cmdclsTypeName" forKey:@"cmdcls_type_name"];
  46. // [dictionary setValue:@"deviceName" forKey:@"device_name"];
  47. // [dictionary setValue:@"profileName" forKey:@"profile_name"];
  48. // [dictionary setValue:@"imageFileName" forKey:@"image_file_name"];
  49. // [dictionary setValue:@"contentValue" forKey:@"content_value"];
  50. // [dictionary setValue:@"nodeName" forKey:@"node_name"];
  51. // [dictionary setValue:@"cmdclsCount" forKey:@"cmdcls_count"];
  52. // [dictionary setValue:@"nodeId" forKey:@"node_id"];
  53. // [dictionary setValue:@"deviceId" forKey:@"device_id"];
  54. //
  55. // return [[JSONKeyMapper alloc] initWithDictionary:dictionary];
  56. //}
  57. + (CmdClsType)cmdclsTypeForCode:(NSString *)code {
  58. CmdClsType type = -1;
  59. if ([code isEqualToString:ksCmdClassTypeFirmwareVersion]) {
  60. type = CmdClsTypeFirmwareVersion;
  61. } else if ([code isEqualToString:ksCmdClassTypeSwitchBinary]) {
  62. type = CmdClsTypeSwitchBinary;
  63. } else if ([code isEqualToString:ksCmdClassTypeSwitchMultiLevel]) {
  64. type = CmdClsTypeSwitchMultiLevel;
  65. } else if ([code isEqualToString:ksCmdClassTypeSwitchColor]) {
  66. type = CmdClsTypeSwitchColor;
  67. } else if ([code isEqualToString:ksCmdClassTypeSensorBinary]) {
  68. type = CmdClsTypeSensorBinary;
  69. } else if ([code isEqualToString:ksCmdClassTypeSensorMultiLevel]) {
  70. type = CmdClsTypeSensorMultiLevel;
  71. } else if ([code isEqualToString:ksCmdClassTypeThermostatMode]) {
  72. type = CmdClsTypeThermostatMode;
  73. } else if ([code isEqualToString:ksCmdClassTypeThermostatFanMode]) {
  74. type = CmdClsTypeThermostatFanMode;
  75. } else if ([code isEqualToString:ksCmdClassTypeThermostatSetPoint]) {
  76. type = CmdClsTypeThermostatSetPoint;
  77. } else if ([code isEqualToString:ksCmdClassTypeLock]) {
  78. type = CmdClsTypeLock;
  79. } else if ([code isEqualToString:ksCmdClassTypeMeterCurrent]) {
  80. type = CmdClsTypeMeterCurrent;
  81. } else if ([code isEqualToString:ksCmdClassTypeMeterTotal]) {
  82. type = CmdClsTypeMeterTotal;
  83. } else if ([code isEqualToString:ksCmdClassTypeAVControlPlayback]) {
  84. type = CmdClsTypeAVControlPlayback;
  85. } else if ([code isEqualToString:ksCmdClassTypeHomeMode]) {
  86. type = CmdClsTypeHomeMode;
  87. } else if ([code isEqualToString:ksCmdClassTypeSpeedControl]) {
  88. type = CmdClsTypeSpeedControl;
  89. }
  90. return type;
  91. }
  92. - (CmdClsType)cmdclsType {
  93. return [DeviceModel cmdclsTypeForCode:_cmdclsCode];
  94. }
  95. - (NSInteger)cmdclsValueMsgLength {
  96. NSInteger length = 0;
  97. NSArray<CmdClsValueModel> *array = nil;
  98. switch ([self cmdclsType]) {
  99. case CmdClsTypeLock:
  100. array = [self cmdclsValueListOfLock];
  101. break;
  102. default:
  103. break;
  104. }
  105. for (CmdClsValueModel *tmpCmdclsValue in array) {
  106. if (tmpCmdclsValue.cmdclsValueMsg.length > length) {
  107. length = tmpCmdclsValue.cmdclsValueMsg.length;
  108. }
  109. }
  110. return length;
  111. }
  112. - (NSString *)cmdclsValueMsgLongest {
  113. NSString *hstring = nil;
  114. NSArray<CmdClsValueModel> *array = nil;
  115. switch ([self cmdclsType]) {
  116. case CmdClsTypeSwitchBinary:
  117. array = [self cmdclsValueListOfSwitchBinary];
  118. break;
  119. case CmdClsTypeLock:
  120. array = [self cmdclsValueListOfLock];
  121. break;
  122. default:
  123. break;
  124. }
  125. NSUInteger highest = 0;
  126. for (CmdClsValueModel *tmpCmdclsValue in array) {
  127. if (tmpCmdclsValue.cmdclsValueMsg.length > highest) {
  128. highest = tmpCmdclsValue.cmdclsValueMsg.length;
  129. hstring = tmpCmdclsValue.cmdclsValueMsg;
  130. }
  131. }
  132. return hstring;
  133. }
  134. - (NSString *)cmdclsValueMsg {
  135. switch ([self cmdclsType]) {
  136. case CmdClsTypeSensorBinary:
  137. _cmdclsValueMsg = [self cmdclsValueMsgOfSensorBinary];
  138. break;
  139. case CmdClsTypeThermostatMode:
  140. _cmdclsValueMsg = [self cmdclsValueMsgOfThermostatMode];
  141. break;
  142. case CmdClsTypeLock:
  143. _cmdclsValueMsg = [self cmdclsValueMsgOfLock];
  144. break;
  145. case CmdClsTypeSwitchBinary:
  146. _cmdclsValueMsg = [self cmdclsValueMsgOfSwitchBinary];
  147. break;
  148. case CmdClsTypeSpeedControl:
  149. _cmdclsValueMsg = [self cmdclsValueMsgOfSpeedControl];
  150. break;
  151. case CmdClsTypeAVControlPlayback:
  152. _cmdclsValueMsg = [self cmdclsValueMsgOfAVPlayback];
  153. break;
  154. default:
  155. break;
  156. }
  157. return _cmdclsValueMsg;
  158. }
  159. - (NSArray<CmdClsValueModel> *)cmdclsValueList {
  160. switch ([self cmdclsType]) {
  161. case CmdClsTypeThermostatMode:
  162. _cmdclsValueList = [self cmdclsValueListOfThermostatMode];
  163. break;
  164. case CmdClsTypeLock:
  165. _cmdclsValueList = [self cmdclsValueListOfLock];
  166. break;
  167. case CmdClsTypeSpeedControl:
  168. _cmdclsValueList = [self cmdclsValueListOfSpeedControl];
  169. break;
  170. default:
  171. break;
  172. }
  173. return _cmdclsValueList;
  174. }
  175. - (NSArray<CmdClsValueModel> *)cmdclsValueListOfThermostatMode {
  176. NSMutableArray<CmdClsValueModel> *array = [(NSMutableArray<CmdClsValueModel> *)[NSMutableArray alloc] init];
  177. NSInteger typeId = [_cmdclsTypeId integerValue];
  178. switch (typeId) {
  179. case 13001: {
  180. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF",
  181. @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]];
  182. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"COOL",
  183. @"cmdcls_value_msg": NSLocalizedString(@"냉방", @"냉방")} error:nil]];
  184. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HEAT",
  185. @"cmdcls_value_msg": NSLocalizedString(@"난방", @"난방")} error:nil]];
  186. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AUTO",
  187. @"cmdcls_value_msg": NSLocalizedString(@"자동", @"자동")} error:nil]];
  188. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"FAN_ONLY",
  189. @"cmdcls_value_msg": NSLocalizedString(@"환기", @"환기")} error:nil]];
  190. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"DRY_AIR",
  191. @"cmdcls_value_msg": NSLocalizedString(@"제습", @"제습")} error:nil]];
  192. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AWAY",
  193. @"cmdcls_value_msg": NSLocalizedString(@"외출", @"외출")} error:nil]];
  194. }
  195. break;
  196. case 13002: {
  197. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF",
  198. @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]];
  199. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"COOL",
  200. @"cmdcls_value_msg": NSLocalizedString(@"냉방", @"냉방")} error:nil]];
  201. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HEAT",
  202. @"cmdcls_value_msg": NSLocalizedString(@"난방", @"난방")} error:nil]];
  203. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AUTO",
  204. @"cmdcls_value_msg": NSLocalizedString(@"자동", @"자동")} error:nil]];
  205. }
  206. break;
  207. case 13003: {
  208. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF",
  209. @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]];
  210. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HEAT",
  211. @"cmdcls_value_msg": NSLocalizedString(@"난방", @"난방")} error:nil]];
  212. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"AWAY",
  213. @"cmdcls_value_msg": NSLocalizedString(@"외출", @"외출")} error:nil]];
  214. }
  215. break;
  216. case 13004: {
  217. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF",
  218. @"cmdcls_value_msg": NSLocalizedString(@"꺼짐", @"꺼짐")} error:nil]];
  219. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"COOL",
  220. @"cmdcls_value_msg": NSLocalizedString(@"냉방", @"냉방")} error:nil]];
  221. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"FAN_ONLY",
  222. @"cmdcls_value_msg": NSLocalizedString(@"환기", @"환기")} error:nil]];
  223. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"DRY_AIR",
  224. @"cmdcls_value_msg": NSLocalizedString(@"제습", @"제습")} error:nil]];
  225. }
  226. break;
  227. }
  228. return array;
  229. }
  230. - (NSArray<CmdClsValueModel> *)cmdclsValueListOfSwitchBinary {
  231. NSMutableArray<CmdClsValueModel> *array = [(NSMutableArray<CmdClsValueModel> *)[NSMutableArray alloc] init];
  232. NSInteger typeId = [_cmdclsTypeId integerValue];
  233. switch (typeId) {
  234. case 17001: {
  235. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"ON",
  236. @"cmdcls_value_msg": @"켜짐"} error:nil]];
  237. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF",
  238. @"cmdcls_value_msg": @"꺼짐"} error:nil]];
  239. break;
  240. }
  241. }
  242. return array;
  243. }
  244. - (NSArray<CmdClsValueModel> *)cmdclsValueListOfLock {
  245. NSMutableArray<CmdClsValueModel> *array = [(NSMutableArray<CmdClsValueModel> *)[NSMutableArray alloc] init];
  246. NSInteger typeId = [_cmdclsTypeId integerValue];
  247. switch (typeId) {
  248. case 14001: {
  249. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"LOCKED",
  250. @"cmdcls_value_msg": @"잠김"} error:nil]];
  251. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"UNCLOCKED",
  252. @"cmdcls_value_msg": @"열림"} error:nil]];
  253. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"JAMMED",
  254. @"cmdcls_value_msg": @"걸림"} error:nil]];
  255. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"FORCED_OPEN",
  256. @"cmdcls_value_msg": @"수동"} error:nil]];
  257. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"UNSPECIFIED",
  258. @"cmdcls_value_msg": @"오류"} error:nil]];
  259. }
  260. break;
  261. case 14002:
  262. case 14003:
  263. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"LOCKED",
  264. @"cmdcls_value_msg": @"잠김"} error:nil]];
  265. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"UNCLOCKED",
  266. @"cmdcls_value_msg": @"열림"} error:nil]];
  267. break;
  268. }
  269. return array;
  270. }
  271. - (NSArray<CmdClsValueModel> *)cmdclsValueListOfSpeedControl {
  272. NSMutableArray<CmdClsValueModel> *array = [(NSMutableArray<CmdClsValueModel> *)[NSMutableArray alloc] init];
  273. NSInteger typeId = [_cmdclsTypeId integerValue];
  274. switch (typeId) {
  275. case 20001: {
  276. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"OFF",
  277. @"cmdcls_value_msg": @"꺼짐"} error:nil]];
  278. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"LOW",
  279. @"cmdcls_value_msg": @"약"} error:nil]];
  280. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"MEDIUM",
  281. @"cmdcls_value_msg": @"중"} error:nil]];
  282. [array addObject:[[CmdClsValueModel alloc] initWithDictionary:@{@"cmdcls_value":@"HIGH",
  283. @"cmdcls_value_msg": @"강"} error:nil]];
  284. }
  285. break;
  286. }
  287. return array;
  288. }
  289. - (NSString *)cmdclsValueMsgOfSensorBinary {
  290. NSInteger typeId = [_cmdclsTypeId integerValue];
  291. NSString *msg = ksEmptyString;
  292. switch (typeId) {
  293. case 11001:
  294. case 11002:
  295. case 11003:
  296. case 11004:
  297. case 11005:
  298. case 11006:
  299. case 11007:
  300. case 11008:
  301. case 11009:
  302. case 11010:
  303. case 11012:
  304. case 11013:
  305. case 11014:
  306. case 11016:
  307. if ([self.contentValue isEqualToString:@"TRUE"]) {
  308. msg = NSLocalizedString(@"감지됨", @"감지됨");
  309. } else if ([self.contentValue isEqualToString:@"FALSE"]) {
  310. msg = NSLocalizedString(@"정상", @"정상");
  311. } else {
  312. msg = @"-";
  313. }
  314. break;
  315. case 11011:
  316. if ([self.contentValue isEqualToString:@"TRUE"]) {
  317. msg = NSLocalizedString(@"열림", @"열림");
  318. } else if ([self.contentValue isEqualToString:@"FALSE"]) {
  319. msg = NSLocalizedString(@"닫힘", @"닫힘");
  320. } else {
  321. msg = @"-";
  322. }
  323. case 11015:
  324. if ([self.contentValue isEqualToString:@"TRUE"]) {
  325. msg = NSLocalizedString(@"들어옴", @"들어옴");
  326. } else if ([self.contentValue isEqualToString:@"FALSE"]) {
  327. msg = NSLocalizedString(@"나감", @"나감");
  328. } else {
  329. msg = @"-";
  330. }
  331. break;
  332. }
  333. return msg;
  334. }
  335. - (NSString *)cmdclsValueMsgOfThermostatMode {
  336. NSInteger typeId = [_cmdclsTypeId integerValue];
  337. NSString *msg = ksEmptyString;
  338. switch (typeId) {
  339. case 13001:
  340. case 13002:
  341. case 13003:
  342. case 13004:
  343. if ([self.contentValue isEqualToString:@"OFF"]) {
  344. msg = NSLocalizedString(@"꺼짐", @"꺼짐");
  345. } else if ([self.contentValue isEqualToString:@"COOL"]) {
  346. msg = NSLocalizedString(@"냉방", @"냉방");
  347. } else if ([self.contentValue isEqualToString:@"HEAT"]) {
  348. msg = NSLocalizedString(@"난방", @"난방");
  349. } else if ([self.contentValue isEqualToString:@"AUTO"]) {
  350. msg = NSLocalizedString(@"자동", @"자동");
  351. } else if ([self.contentValue isEqualToString:@"FAN_ONLY"]) {
  352. msg = NSLocalizedString(@"환기", @"환기");
  353. } else if ([self.contentValue isEqualToString:@"DRY_AIR"]) {
  354. msg = NSLocalizedString(@"제습", @"제습");
  355. } else if ([self.contentValue isEqualToString:@"AWAY"]) {
  356. msg = NSLocalizedString(@"외출", @"외출");
  357. } else {
  358. msg = @"-";
  359. }
  360. break;
  361. }
  362. return msg;
  363. }
  364. - (NSString *)cmdclsValueMsgOfLock {
  365. NSInteger typeId = [_cmdclsTypeId integerValue];
  366. NSString *msg = ksEmptyString;
  367. switch (typeId) {
  368. case 14001:
  369. if ([self.contentValue isEqualToString:@"LOCKED"]) {
  370. msg = NSLocalizedString(@"잠김", @"잠김");
  371. } else if ([self.contentValue isEqualToString:@"UNLOCKED"]) {
  372. msg = NSLocalizedString(@"열림", @"열림");
  373. } else if ([self.contentValue isEqualToString:@"JAMMED"]) {
  374. msg = NSLocalizedString(@"걸림", @"걸림");
  375. } else if ([self.contentValue isEqualToString:@"FORCED_OPEN"]) {
  376. msg = NSLocalizedString(@"수동", @"수동");
  377. } else if ([self.contentValue isEqualToString:@"UNSPECIFIED"]) {
  378. msg = NSLocalizedString(@"오류", @"오류");
  379. } else {
  380. msg = @"-";
  381. }
  382. break;
  383. case 14002:
  384. case 14003:
  385. if ([self.contentValue isEqualToString:@"LOCKED"]) {
  386. msg = @"잠김";
  387. } else if ([self.contentValue isEqualToString:@"UNLOCKED"]) {
  388. msg = @"열림";
  389. } else {
  390. msg = @"-";
  391. }
  392. break;
  393. }
  394. return msg;
  395. }
  396. - (NSString *)cmdclsValueMsgOfSwitchBinary {
  397. NSInteger typeId = [_cmdclsTypeId integerValue];
  398. NSString *msg = ksEmptyString;
  399. switch (typeId) {
  400. case 17001:
  401. if ([self.contentValue isEqualToString:@"ON"]) {
  402. msg = NSLocalizedString(@"켜짐", @"켜짐");
  403. } else if ([self.contentValue isEqualToString:@"OFF"]) {
  404. msg = NSLocalizedString(@"꺼짐", @"꺼짐");
  405. } else {
  406. msg = @"-";
  407. }
  408. break;
  409. }
  410. return msg;
  411. }
  412. - (NSString *)cmdclsValueMsgOfSpeedControl {
  413. NSInteger typeId = [_cmdclsTypeId integerValue];
  414. NSString *msg = ksEmptyString;
  415. switch (typeId) {
  416. case 20001:
  417. if ([self.contentValue isEqualToString:@"OFF"]) {
  418. msg = NSLocalizedString(@"꺼짐", @"꺼짐");
  419. } else if ([self.contentValue isEqualToString:@"LOW"]) {
  420. msg = NSLocalizedString(@"약", @"약");
  421. } else if ([self.contentValue isEqualToString:@"MEDIUM"]) {
  422. msg = NSLocalizedString(@"중", @"중");
  423. } else if ([self.contentValue isEqualToString:@"HIGH"]) {
  424. msg = NSLocalizedString(@"강", @"강");
  425. } else {
  426. msg = @"-";
  427. }
  428. break;
  429. }
  430. return msg;
  431. }
  432. - (NSString *)cmdclsValueMsgOfAVPlayback {
  433. NSInteger typeId = [_cmdclsTypeId integerValue];
  434. NSString *msg = ksEmptyString;
  435. switch (typeId) {
  436. case 21001:
  437. if ([self.contentValue isEqualToString:@"PLAYING"]) {
  438. msg = NSLocalizedString(@"재생 중", @"재생 중");
  439. } else if ([self.contentValue isEqualToString:@"PAUSED"]) {
  440. msg = NSLocalizedString(@"정지 됨", @"정지 됨");
  441. } else {
  442. msg = @"-";
  443. }
  444. break;
  445. }
  446. return msg;
  447. }
  448. - (instancetype)initWithSubItem:(ItemSubModel *)subItem {//mobile devices.
  449. if (self = [super init]) {
  450. self.deviceId = subItem.sourceId;
  451. self.deviceName = subItem.sourceName;
  452. self.nodeId = subItem.sourceSubId;
  453. self.nodeName = subItem.sourceSubName;
  454. self.conditionTypeCode = subItem.conditionTypeCode;
  455. self.dataTypeCode = subItem.dataTypeCode;
  456. self.cmdclsValue = subItem.cmdclsValue;
  457. self.nickname = subItem.nickname;
  458. self.deleteYn = subItem.deleteYn;
  459. // objc_setAssociatedObject(self, @"CHECK_STATUS", @YES, OBJC_ASSOCIATION_COPY_NONATOMIC); //for checkbox
  460. [[JDFacade facade] setRadioButtonStatus:@YES object:self]; //for radio box
  461. }
  462. return self;
  463. }
  464. - (NSString *)unit {
  465. if ([_unit isEqualToString:@"\\"]) {
  466. _unit = @"₩";
  467. }
  468. return _unit;
  469. }
  470. @end
  471. @implementation DeviceListModel
  472. @end
  473. @implementation NodeModel
  474. //- (CmdClsType)cmdclsType {
  475. // return [DeviceModel cmdclsTypeForCode:_cmdclsCode];
  476. //}
  477. @end
  478. @implementation DeviceDetailModel
  479. @end
  480. @implementation PredefinedDeviceModel
  481. //+ (JSONKeyMapper *)keyMapper {
  482. //
  483. // NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
  484. //
  485. // //self
  486. // [dictionary setValue:@"cmdclsTypeSystemName" forKey:@"cmdcls_type_system_name"];
  487. // [dictionary setValue:@"cmdclsTypeId" forKey:@"cmdcls_type_id"];
  488. // [dictionary setValue:@"cmdclsCode" forKey:@"cmdcls_code"];
  489. // [dictionary setValue:@"deviceProfileId" forKey:@"device_profile_id"];
  490. // [dictionary setValue:@"createDatetime" forKey:@"create_datetime"];
  491. // [dictionary setValue:@"cmdclsTypeName" forKey:@"cmdcls_type_name"];
  492. // [dictionary setValue:@"deviceName" forKey:@"device_name"];
  493. // [dictionary setValue:@"profileName" forKey:@"profile_name"];
  494. // [dictionary setValue:@"imageFileName" forKey:@"image_file_name"];
  495. // [dictionary setValue:@"contentValue" forKey:@"content_value"];
  496. // [dictionary setValue:@"nodeName" forKey:@"node_name"];
  497. // [dictionary setValue:@"cmdclsCount" forKey:@"cmdcls_count"];
  498. // [dictionary setValue:@"nodeId" forKey:@"node_id"];
  499. // [dictionary setValue:@"deviceId" forKey:@"device_id"];
  500. // [dictionary setValue:@"cmdclsValue" forKey:@"cmdcls_value"];
  501. // [dictionary setValue:@"conditionTypeCode" forKey:@"condition_type_code"];
  502. // [dictionary setValue:@"dataTypeCode" forKey:@"data_type_code"];
  503. //
  504. // return [[JSONKeyMapper alloc] initWithDictionary:dictionary];
  505. //}
  506. - (instancetype)initWithSubItem:(ItemSubModel *)subItem {
  507. if (self = [super init]) {
  508. self.deviceId = subItem.sourceId;
  509. self.deviceName = subItem.sourceName;
  510. self.nodeId = subItem.sourceSubId;
  511. self.nodeName = subItem.sourceSubName;
  512. self.conditionTypeCode = subItem.conditionTypeCode;
  513. self.dataTypeCode = subItem.dataTypeCode;
  514. self.cmdclsValue = subItem.cmdclsValue;
  515. self.predCmdclsValue = subItem.predCmdclsValue;
  516. self.deleteYn = subItem.deleteYn;
  517. [[JDFacade facade] setCheckBoxStatus:@YES object:self]; //for check box
  518. [[JDFacade facade] setRadioButtonStatus:@YES object:self]; //for radio box
  519. }
  520. return self;
  521. }
  522. @end
  523. @implementation PredefinedDeviceListModel
  524. @end
  525. @implementation CmdClsValueModel
  526. @end
  527. @implementation DeviceIconModel
  528. @end
  529. @implementation DeviceIconListModel
  530. @end