|
|
@@ -176,6 +176,15 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
+-(NSString *)getDeviceDetailUrl
|
|
|
+{
|
|
|
+ NSMutableArray *arr = [NSMutableArray array];
|
|
|
+ arr[0] = _refDevice.deviceId;
|
|
|
+ arr[1] = _refDevice.nodeId;
|
|
|
+
|
|
|
+ return [[JDFacade facade] getUrlWithCustAndGroupIDWithArr:API_GET_NODE_DETAIL arguments:arr];
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - Main Logic
|
|
|
- (void)requestDeviceDetail:(id)arg {
|
|
|
|
|
|
@@ -184,7 +193,7 @@
|
|
|
showLoadingView = [arg isKindOfClass:[NSTimer class]] ? [((NSTimer *)arg).userInfo boolValue] : [arg boolValue];
|
|
|
}
|
|
|
|
|
|
- NSString *path = [NSString stringWithFormat:API_GET_DEVICE_DETAIL, _refDevice.deviceId];
|
|
|
+ NSString *path = [NSString stringWithFormat:[self getDeviceDetailUrl], _refDevice.deviceId];
|
|
|
|
|
|
[[RequestHandler handler] sendAsyncRequestAPIPath:path method:ksHTTPRequestGET parameters:nil
|
|
|
modelClass:[DeviceDetailModel class] showLoadingView:showLoadingView completion:^(id responseObject) {
|
|
|
@@ -193,7 +202,7 @@
|
|
|
}
|
|
|
|
|
|
_deviceDetail = (DeviceDetailModel *)responseObject;
|
|
|
-
|
|
|
+ NSLog(@"Device Detail : %@", _deviceDetail);
|
|
|
if (_deviceDetail) {//API 성공 ,
|
|
|
[self setDeviceContents];
|
|
|
[self requestPollingDeviceStatusInBackground];
|
|
|
@@ -216,16 +225,16 @@
|
|
|
- (void)requestPollingDeviceStatusInBackground {
|
|
|
|
|
|
//schedul timer.
|
|
|
- if (!_deviceBackgroundTimer) {
|
|
|
- _deviceBackgroundTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(requestDeviceDetail:) userInfo:@NO repeats:YES];
|
|
|
- }
|
|
|
+// if (!_deviceBackgroundTimer) {
|
|
|
+// _deviceBackgroundTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(requestDeviceDetail:) userInfo:@NO repeats:YES];
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
- (void)setDeviceContents {
|
|
|
[self updateTitle];
|
|
|
|
|
|
- _mandatoryNodes = (NSArray<NodeModel> *)[_deviceDetail.nodes filteredArrayUsingPredicateFormat:@"cmdclsMandatoryYn == %@", @"Y"];
|
|
|
- _optionalNodes = (NSArray<NodeModel> *)[_deviceDetail.nodes filteredArrayUsingPredicateFormat:@"cmdclsMandatoryYn == %@", @"N"];
|
|
|
+ _mandatoryNodes = (NSArray<NodeModel> *)[_deviceDetail.cmdclsList filteredArrayUsingPredicateFormat:@"cmdclsMandatoryYn == %@", @"Y"];
|
|
|
+ _optionalNodes = (NSArray<NodeModel> *)[_deviceDetail.cmdclsList filteredArrayUsingPredicateFormat:@"cmdclsMandatoryYn == %@", @"N"];
|
|
|
|
|
|
[_tableView reloadData];
|
|
|
}
|
|
|
@@ -287,7 +296,7 @@
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
NSInteger count = 1;
|
|
|
if (section == 1) {
|
|
|
- count = _deviceDetail && _deviceDetail.nodes && _deviceDetail.nodes.count > 0;
|
|
|
+ count = _deviceDetail && _deviceDetail.cmdclsList && _deviceDetail.cmdclsList.count > 0;
|
|
|
} else if (section == 2) {//optional nodes
|
|
|
count = _optionalNodes.count; //두번째 이후부터 옵셔널 노드임.
|
|
|
}
|
|
|
@@ -297,7 +306,7 @@
|
|
|
|
|
|
- (CGFloat)heightForMandatoryNode {
|
|
|
CGFloat height = 0;
|
|
|
- NodeModel *node = _deviceDetail.nodes.firstObject;
|
|
|
+ NodeModel *node = _deviceDetail.cmdclsList.firstObject;
|
|
|
if (node.cmdclsType == CmdClsTypeSwitchBinary || node.cmdclsType == CmdClsTypeValve) {
|
|
|
height = 347.0f; //275 || 347
|
|
|
} else {
|
|
|
@@ -400,7 +409,7 @@
|
|
|
} else if (section == 2) {//option control
|
|
|
ThingsDetailOptionTableViewCell *tcell = (ThingsDetailOptionTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"OptionCellIdentifier"];
|
|
|
|
|
|
- NodeModel *node = _deviceDetail.nodes[indexPath.row + _mandatoryNodes.count];
|
|
|
+ NodeModel *node = _deviceDetail.cmdclsList[indexPath.row + _mandatoryNodes.count];
|
|
|
tcell.lblNodeName.text = node.nodeName;
|
|
|
tcell.lblNodeValue.text = node.contentValueMsg;
|
|
|
|