| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- //
- // CommandClassControlView.h
- // kneet
- //
- // Created by Jason Lee on 3/16/15.
- // Copyright (c) 2015 ntels. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #define kfSwitchLabelPadding 20.0f
- #define kfCommandClassSwitchLeftPadding 30.0f
- #define kfCommandClassSwitchRightPadding 40.0f
- #define kfCommandClassLockRightPadding 20.0f
- #define kfControlDefaultWidth 120.0f
- #define kfControlMaxWidth IPHONE_WIDTH - 120.0f
- #define kfControlDefaultHeight 32.0f
- #import "DeviceModel.h"
- @class RACDisposable;
- typedef void(^NodeCommandCompletionBlock)(id result);
- typedef void(^NodeCommandFailureBlock)(id error);
- @interface CommandClassControlView : UIView {
- @protected
- BOOL _enable, _isConditionMode, _isConditionTypeMode, _isMandatoryNode;
- DeviceModel *_device;
- NodeModel *_node;
- }
- @property (strong, nonatomic) DeviceModel *device;
- @property (strong, nonatomic) NodeModel *node;
- @property (assign, nonatomic) BOOL enable;
- @property (assign, nonatomic) BOOL isConditionMode;
- @property (assign, nonatomic) BOOL isConditionTypeMode;
- @property (assign, nonatomic) BOOL isMandatoryNode;
- + (CommandClassControlView *)viewForCommandClass:(CmdClsType)cmdClsType;
- - (void)requestNodeCommand:(NSDictionary *)parameters requestValue:(NSString *)requestValue completionHandler:(NodeCommandCompletionBlock)completion failureHandler:(NodeCommandFailureBlock)failure;
- - (NSDictionary *)parameterForNodeCommand;
- - (CGSize)sizeForIntrinsic;
- - (CGSize)sizeForIntrinsicForItemCount:(NSInteger)count;
- - (void)setLayoutUI;
- - (void)updateLayout;
- - (void)updateThingsViewContoller;
- + (NSString *)cmdclsValueForType:(NSString *)dataTypeCode value:(CGFloat)value;
- @end
- @class CustomSwitch;
- @class CustomButton;
- @interface CommandClassSwitchView : CommandClassControlView {
- @protected
- BOOL _isON;
- __weak CustomLabel *_lblContentValueMsg;
- NSString *_requestValueForOn, *_requestValueForOff;
- __weak NSLayoutConstraint *_constraintBtnSwitchWidth;
- }
- @property (assign, nonatomic) BOOL isON;
- @property (weak, nonatomic) IBOutlet CustomButton *btnSwitch;
- @property (weak, nonatomic) IBOutlet CustomLabel *lblContentValueMsg;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintBtnSwitchWidth;
- - (IBAction)btnSwitchTouched:(id)sender;
- @end
- @interface CommandClassSwitchMultiLevelView : CommandClassControlView {
- NSTimer *_pressTimer;
- @protected
- CGFloat _minValue, _maxValue, _currentValue, _step;
- }
- @property (weak, nonatomic) IBOutlet CustomButton *btnLabel;
- @property (weak, nonatomic) IBOutlet CustomButton *btnPlus;
- @property (weak, nonatomic) IBOutlet CustomButton *btnMinus;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintBtnLabelWidth;
- - (IBAction)btnPlusTouchDown:(id)sender;
- - (IBAction)btnPlusTouchUp:(id)sender;
- - (IBAction)btnMinusTouchDown:(id)sender;
- - (IBAction)btnMinusTouchUp:(id)sender;
- @end
- @interface CommandClassValveView : CommandClassControlView {
- @protected
- BOOL _isOpened;
- __weak CustomLabel *_lblContentValueMsg;
- NSString *_requestValueForOpen, *_requestValueForClose;
- __weak NSLayoutConstraint *_constraintBtnWidth;
- }
- @property (assign, nonatomic) BOOL isOpened;
- @property (weak, nonatomic) IBOutlet CustomButton *btnOpen;
- @property (weak, nonatomic) IBOutlet CustomLabel *lblContentValueMsg;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *constraintBtnWidth;
- - (IBAction)btnOpenTouched:(id)sender;
- @end
- #pragma mark - Sensors
- @class CustomLabel;
- @interface CommandClassSensorBinaryView : CommandClassControlView {
- @protected
- __weak CustomLabel *_lblControl;
- }
- @property (weak, nonatomic) IBOutlet CustomLabel *lblControl;
- @end
- @interface CommandClassSensorMultiLevelView : CommandClassSensorBinaryView
- @end
- @interface CommandClassMeterCurrentView : CommandClassControlView
- @property (weak, nonatomic) IBOutlet CustomLabel *lblMeter;
- @end
- @interface CommandClassMeterTotalView : CommandClassMeterCurrentView
- @end
|