DeviceModel.m 25 KB

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