// // CommandClassControlDetailView.m // kneet // // Created by Jason Lee on 3/16/15. // Copyright (c) 2015 ntels. All rights reserved. // #import "JDObject.h" #import "RequestHandler.h" #import "JDJSONModel.h" #import "DeviceModel.h" #import "CustomLabel.h" #import "CommonUtil.h" #import "CustomButton.h" #import "CustomRadioGroup.h" #import "UIImageView+WebCache.h" #import "CommandClassControlDetailView.h" #import "CommandClassControlView.h" #import "CustomImageView.h" #define GRAPH_ANI_DUR 0.5f #define DEGREES(radians)((radians) * 180 / M_PI) #define RADIANS(degree)((degree) * M_PI / 180) #define kfControlDetailDefaultWidth 320.0f; #define kfControlDetailDefaultHeight 340.0f; typedef void(^NodeCommandCompletionBlock)(id result); typedef void(^NodeCommandFailureBlock)(id error); @implementation CommandClassControlDetailView + (CommandClassControlView *)viewForCommandClass:(CmdClsType)cmdClsType { CommandClassControlView *controlView = nil; for (UIView *view in [CommonUtil nibViews:@"CommandClassControlDetailView"]) { if (view.tag == cmdClsType) { controlView = (CommandClassControlView *)view; controlView.width = IPHONE_WIDTH; controlView.height = kfControlDetailDefaultHeight; break; } } if (!controlView) {//상위 부모에서 가져옴. controlView = [CommandClassControlView viewForCommandClass:cmdClsType]; } return controlView; } @end @implementation CommandClassSwitchDetailView - (void)setLayoutUI { [super setLayoutUI]; [self updateLayout]; } - (IBAction)btnOnTouched:(id)sender { [self requestNodeCommand:self.parameterForNodeCommand requestValue:_requestValueForOn completionHandler:nil failureHandler:nil]; } - (IBAction)btnOffTouched:(id)sender { [self requestNodeCommand:self.parameterForNodeCommand requestValue:_requestValueForOff completionHandler:nil failureHandler:nil]; } - (void)updateLayout { [super updateLayout]; _btnOn.selected = _isON; _btnOff.selected = !_btnOn.selected; } @end @implementation CommandClassValveDetailView @end #pragma mark - Sensors View @implementation CommandClassSensorBinaryDetailView @end @implementation CommandClassSensorMultiLevelDetailView @end