Initial commit
This commit is contained in:
BIN
Binary file not shown.
+16
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// JiaReWenDuModel.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/5/6.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "baseModel.h"
|
||||
|
||||
@interface JiaReWenDuModel : baseModel
|
||||
|
||||
@property(nonatomic,copy) NSString *JiaReWenDu;
|
||||
@property(nonatomic,copy) NSString *crc16Code;
|
||||
|
||||
@end
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// JiaReWenDuModel.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/5/6.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "JiaReWenDuModel.h"
|
||||
|
||||
@implementation JiaReWenDuModel
|
||||
|
||||
-(NSString *)description{
|
||||
|
||||
self.messagetype=@"00";
|
||||
self.massagelegth=@"13";
|
||||
self.functionCode=@"0e";
|
||||
|
||||
return [NSString stringWithFormat:@"%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth];
|
||||
|
||||
}
|
||||
@end
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// XuToCenterViewController.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/21.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CenterViewController.h"
|
||||
#import "MBProgressHUD.h"
|
||||
/*
|
||||
*绚多 五控六定时器
|
||||
*/
|
||||
|
||||
@interface XuToCenterViewController : CenterViewController
|
||||
|
||||
@property(nonatomic,strong) UIButton *XuToAirPump;
|
||||
|
||||
@property(nonatomic,strong) UIButton *XuToLight1;
|
||||
|
||||
@property(nonatomic,strong) UIButton *XuToLight2;
|
||||
|
||||
@property(nonatomic,strong) UIButton *XuToHuli;
|
||||
|
||||
@property(nonatomic,strong) UIButton *XuToWaterPump;
|
||||
|
||||
@property(nonatomic,strong) UIButton *XuTOJiaRe;
|
||||
|
||||
@property(nonatomic,strong) UIButton *btnControl;
|
||||
|
||||
@property(nonatomic,strong) UILabel *temLabel;
|
||||
|
||||
@property(nonatomic,strong) UIImageView *temperImage;
|
||||
|
||||
//@property(nonatomic,strong)MBProgressHUD *HUD;
|
||||
@property(nonatomic,strong) UILabel *airName;
|
||||
@property(nonatomic,strong) UILabel *light1Name;
|
||||
@property(nonatomic,strong) UILabel *light2Name;
|
||||
@property(nonatomic,strong) UILabel *huLiName;
|
||||
@property(nonatomic,strong) UILabel *waterName;
|
||||
@property(nonatomic,strong) UILabel *jiaReName;
|
||||
|
||||
|
||||
@end
|
||||
+730
@@ -0,0 +1,730 @@
|
||||
//
|
||||
// XuToCenterViewController.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/21.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuToCenterViewController.h"
|
||||
#import "XuToSetViewController.h"
|
||||
#import "XuToSoketBackMsgDataUnity.h"
|
||||
#import "XutoBackMsgModel.h"
|
||||
#define XUTOLIGHT1_TAG 9001
|
||||
#define XUTOLIGHT2_TAG 9002
|
||||
#define XUTOGASPUMP_TAG 9000
|
||||
#define XUTOHULI_TAG 9003
|
||||
#define XUTOWATERPUMP_TAG 9004
|
||||
#define XUTOJIAREBANG_TAG 9005
|
||||
#import "XuToLightModel.h"
|
||||
#import "MyHud.h"
|
||||
#define kPlace ([UIScreen mainScreen].bounds.size.width - btnWith*2) /4
|
||||
#define btnWith 100
|
||||
|
||||
#import "XuToWenDuPicview.h"
|
||||
#import "JiaReWenDuModel.h"
|
||||
#import "XuToControlName.h"
|
||||
#import "UserExtendataArchaver.h"
|
||||
#import "XuToControlNameViewController.h"
|
||||
@interface XuToCenterViewController ()<UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate,MBProgressHUDDelegate>
|
||||
{
|
||||
|
||||
dispatch_queue_t _xutoMainQueue;
|
||||
|
||||
}
|
||||
|
||||
@property(nonatomic,strong) XuToSetViewController *xuToSetVC;
|
||||
|
||||
@property(nonatomic,strong) XutoBackMsgModel *backMsgModel;
|
||||
@property(nonatomic,strong) XuToWenDuPicview *wenduPicview;
|
||||
|
||||
@property(nonatomic,strong) MyHud *XuTohud;
|
||||
@property(nonatomic,strong) XuToControlNameViewController *changeNameVC;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XuToCenterViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[Socketsingleton sharedInstance].communiteDelegate=self;
|
||||
_backMsgModel = [[XutoBackMsgModel alloc] init];
|
||||
[self creatFishAnimation];
|
||||
[self creatUI];
|
||||
|
||||
_xutoMainQueue = dispatch_get_main_queue();
|
||||
|
||||
// [self.SetTimeButton addTarget:self action:@selector(XuToControlSetBtnAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
//self.SetTimeButton.backgroundColor=[UIColor redColor];
|
||||
[self.setbackBtn addTarget:self action:@selector(XuToSetBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(XuToControlSetBtnAction:)];
|
||||
[self.setImag addGestureRecognizer:tapgestureRecognizer];
|
||||
|
||||
}
|
||||
|
||||
-(void)creatFishAnimation{
|
||||
NSLog(@"*******");
|
||||
|
||||
}
|
||||
|
||||
-(void)creatUI{
|
||||
|
||||
|
||||
self.dulabel.hidden = YES;
|
||||
|
||||
self.waringLabel.hidden =YES;
|
||||
self.bubble.hidden = YES;
|
||||
|
||||
|
||||
UIImageView *backImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"xutobgm"]];
|
||||
[self.tableView setBackgroundView:backImage];
|
||||
|
||||
self.temperImage = [[UIImageView alloc] initWithFrame:CGRectMake(kPlace, 2 *kPlace + 90, 70, 70)];
|
||||
self.temperImage.image = [UIImage imageNamed:@"xutowatertemp1"];
|
||||
self.temperImage.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.tableView addSubview:self.temperImage];
|
||||
|
||||
self.temLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 60, 60)];
|
||||
self.temLabel.text = @"";
|
||||
|
||||
self.temLabel.textColor = [UIColor colorWithRed:215/255.0f green:245/255.0f blue:246/254.0f alpha:1];
|
||||
//self.temLabel.backgroundColor = [UIColor grayColor];
|
||||
self.temLabel.font = [UIFont systemFontOfSize:30];
|
||||
|
||||
[self.temperImage addSubview:self.temLabel];
|
||||
|
||||
CGFloat btnControlWith = 70;
|
||||
CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith )/4;
|
||||
|
||||
// NSLog(@"%f %f %f %f %f",btnControlPlace,kScreenSize.height,kScreenSize.width,self.view.frame.size.height,self.view.frame.size.width);
|
||||
|
||||
for (int i = 0; i < 3; i ++) {
|
||||
|
||||
self.btnControl = [[UIButton alloc] init] ;
|
||||
self.btnControl.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -10 , btnControlWith, btnControlWith);
|
||||
// [btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"btn%d_off",i + 1]] forState:UIControlStateNormal];
|
||||
[self.btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"xutobtn%d_off",i + 1]] forState:UIControlStateNormal];
|
||||
|
||||
self.btnControl.tag=9000+i;
|
||||
[self.btnControl addTarget:self action:@selector(xuToBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
|
||||
UILabel *textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),kScreenSize.height - 3*btnControlPlace - 2 *btnControlWith -20 + btnControlWith , btnControlWith, btnControlPlace - 5)];
|
||||
//textLbl.backgroundColor = [UIColor blackColor];
|
||||
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
|
||||
textLbl.textAlignment = NSTextAlignmentCenter;
|
||||
NSArray *arr = @[@"气泵",@"灯1",@"灯2"];
|
||||
textLbl.text = arr[i];
|
||||
|
||||
textLbl.font = [UIFont boldSystemFontOfSize:14];
|
||||
|
||||
[self.tableView addSubview:textLbl];
|
||||
[self.tableView addSubview:self.btnControl];
|
||||
|
||||
if (i==0) {
|
||||
|
||||
self.XuToAirPump = self.btnControl;
|
||||
self.airName = textLbl;
|
||||
}else if (i==1){
|
||||
self.XuToLight1 = self.btnControl;
|
||||
self.light1Name = textLbl;
|
||||
|
||||
}else if (i==2){
|
||||
self.XuToLight2 = self.btnControl;
|
||||
self.light2Name = textLbl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i ++) {
|
||||
self.btnControl = [[UIButton alloc] init] ;
|
||||
self.btnControl.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -25 , btnControlWith, btnControlWith);
|
||||
// [btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"btn%d_off",i + 4]] forState:UIControlStateNormal];
|
||||
if (i==0) {
|
||||
[self.btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"xutobtn%d_on",i + 4]] forState:UIControlStateNormal];
|
||||
}else{
|
||||
[self.btnControl setImage:[UIImage imageNamed:[NSString stringWithFormat:@"xutobtn%d_off",i + 4]] forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
|
||||
self.btnControl.tag= 9003+i;
|
||||
[self.btnControl addTarget:self action:@selector(xuToBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
UILabel *textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith), kScreenSize.height - 2*btnControlPlace - btnControlWith -35 + btnControlWith, btnControlWith, btnControlPlace - 5)];
|
||||
//textLbl.backgroundColor = [UIColor blackColor];
|
||||
textLbl.textAlignment = NSTextAlignmentCenter;
|
||||
textLbl.textColor = [UIColor colorWithRed:250/255.0f green:255/255.0f blue:255/254.0f alpha:1];
|
||||
NSArray *arr = @[@"护理灯",@"水泵",@"加热棒"];
|
||||
textLbl.font = [UIFont boldSystemFontOfSize:14];
|
||||
textLbl.text = arr[i];
|
||||
|
||||
|
||||
|
||||
[self.tableView addSubview:textLbl];
|
||||
[self.tableView addSubview:self.btnControl];
|
||||
|
||||
if (i==0) {
|
||||
|
||||
self.XuToHuli = self.btnControl;
|
||||
self.huLiName = textLbl;
|
||||
|
||||
}else if (i==1){
|
||||
|
||||
self.XuToWaterPump = self.btnControl;
|
||||
self.waterName = textLbl;
|
||||
|
||||
}else if (i==2){
|
||||
//加热棒 不可点
|
||||
self.XuTOJiaRe = self.btnControl;
|
||||
self.jiaReName = textLbl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[self initCHNames];
|
||||
}
|
||||
|
||||
#pragma mark - 按钮点击事件
|
||||
|
||||
-(void)xuToBtnClick:(UIButton*)btn{
|
||||
|
||||
XutoBackMsgModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:@"xutoBackInfo"];
|
||||
if (backmodel) {
|
||||
|
||||
}else{
|
||||
[self showLableAction:@"设备已离线"];
|
||||
}
|
||||
|
||||
|
||||
XuToLightModel * lightModel=[[XuToLightModel alloc] init];
|
||||
lightModel.sendmacId = self.currentDevice.macAddress;
|
||||
lightModel.resavemacId = self.currentDevice.macAddress;
|
||||
|
||||
NSString*switchString1=lightModel.description;
|
||||
|
||||
if (btn.selected) {//开
|
||||
lightModel.switchBtn=@"00";
|
||||
btn.selected=NO;
|
||||
|
||||
}else {// 关
|
||||
lightModel.switchBtn=@"01";
|
||||
btn.selected=YES;
|
||||
}
|
||||
lightModel.crc16Str=@"0000";// CRC16验证码
|
||||
switch (btn.tag) {
|
||||
|
||||
case XUTOGASPUMP_TAG:
|
||||
{
|
||||
|
||||
btn.userInteractionEnabled=YES;
|
||||
[btn setImage:[UIImage imageNamed:@"xutobtn1_on.png"] forState:UIControlStateSelected];
|
||||
lightModel.lightNumber =@"01";
|
||||
|
||||
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
|
||||
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
||||
|
||||
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
|
||||
//soket 未断开时显示
|
||||
[self creatXuToindicaterView];
|
||||
[self.XuTohud myhudstart];
|
||||
|
||||
}
|
||||
|
||||
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
||||
btn.selected=YES;
|
||||
}else{
|
||||
btn.selected=NO;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case XUTOLIGHT1_TAG:
|
||||
{
|
||||
|
||||
btn.userInteractionEnabled=YES;
|
||||
[btn setImage:[UIImage imageNamed:@"xutobtn2_on.png"] forState:UIControlStateSelected];
|
||||
lightModel.lightNumber =@"02";// 01 --灯1
|
||||
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
|
||||
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
||||
[ [Socketsingleton sharedInstance] soketWriteData:manulData];
|
||||
|
||||
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
|
||||
//soket 未断开时显示
|
||||
[self creatXuToindicaterView];
|
||||
[self.XuTohud myhudstart];
|
||||
|
||||
}
|
||||
|
||||
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
||||
btn.selected=YES;
|
||||
}else{
|
||||
btn.selected=NO;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case XUTOLIGHT2_TAG:
|
||||
|
||||
{
|
||||
|
||||
btn.userInteractionEnabled=YES;
|
||||
[btn setImage:[UIImage imageNamed:@"xutobtn3_on.png"] forState:UIControlStateSelected];
|
||||
lightModel.lightNumber=@"03";//
|
||||
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
|
||||
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
||||
[ [Socketsingleton sharedInstance] soketWriteData:manulData];
|
||||
|
||||
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
|
||||
//soket 未断开时显示
|
||||
[self creatXuToindicaterView];
|
||||
[self.XuTohud myhudstart];
|
||||
|
||||
}
|
||||
|
||||
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
||||
btn.selected=YES;
|
||||
}else{
|
||||
btn.selected=NO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case XUTOHULI_TAG:
|
||||
{
|
||||
|
||||
btn.userInteractionEnabled=YES;
|
||||
[btn setImage:[UIImage imageNamed:@"xutobtn4_off.png"] forState:UIControlStateNormal];
|
||||
lightModel.lightNumber=@"04";//
|
||||
|
||||
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
|
||||
|
||||
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
||||
[ [Socketsingleton sharedInstance] soketWriteData:manulData];
|
||||
|
||||
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
|
||||
//soket 未断开时显示
|
||||
[self creatXuToindicaterView];
|
||||
[self.XuTohud myhudstart];
|
||||
|
||||
}
|
||||
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
||||
btn.selected=YES;
|
||||
}else{
|
||||
btn.selected=NO;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case XUTOWATERPUMP_TAG:
|
||||
{
|
||||
|
||||
|
||||
NSString*stateString=[backmodel.waterpump substringWithRange:NSMakeRange(2, 2)];
|
||||
//开
|
||||
if ([stateString isEqualToString:@"01"]) {
|
||||
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"确认关闭水泵?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
|
||||
|
||||
[alert show];
|
||||
|
||||
}else{
|
||||
|
||||
btn.userInteractionEnabled=YES;
|
||||
[btn setImage:[UIImage imageNamed:@"xutobtn5_on.png"] forState:UIControlStateSelected];
|
||||
lightModel.lightNumber=@"05";//
|
||||
|
||||
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
|
||||
|
||||
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
||||
[ [Socketsingleton sharedInstance] soketWriteData:manulData];
|
||||
|
||||
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
|
||||
//soket 未断开时显示
|
||||
[self creatXuToindicaterView];
|
||||
[self.XuTohud myhudstart];
|
||||
|
||||
}
|
||||
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
||||
btn.selected=YES;
|
||||
}else{
|
||||
btn.selected=NO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case XUTOJIAREBANG_TAG:
|
||||
|
||||
{
|
||||
|
||||
if (backmodel) {
|
||||
_wenduPicview=[[XuToWenDuPicview alloc] init];
|
||||
_wenduPicview.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
|
||||
[_wenduPicview.sureBtn addTarget:self action:@selector(sureBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view.window addSubview:_wenduPicview];
|
||||
|
||||
[self jiaReMianQue];
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
[self showLableAction:@"设备已离线"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - 确定加热棒温度
|
||||
|
||||
-(void)sureBtnClick:(UIButton *)btn{
|
||||
|
||||
NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString);
|
||||
if (_wenduPicview.picViewResultString ==nil) {
|
||||
|
||||
[_wenduPicview removeFromSuperview];
|
||||
|
||||
}else{
|
||||
|
||||
JiaReWenDuModel *model=[[JiaReWenDuModel alloc] init];
|
||||
model.resavemacId = self.currentDevice.macAddress;
|
||||
model.sendmacId = self.currentDevice.macAddress;
|
||||
|
||||
int intlowString = [_wenduPicview.picViewResultString intValue];
|
||||
|
||||
int newIntlowString=intlowString*10;
|
||||
|
||||
NSLog(@"%d******** newIntlowString",newIntlowString);
|
||||
// 转四位16进制
|
||||
model.JiaReWenDu=[dataContorl tpIntStringToFourHex:newIntlowString];
|
||||
|
||||
model.crc16Code =@"0000";
|
||||
|
||||
|
||||
NSString * hexstring=[NSString stringWithFormat:@"%@%@%@",model.description,model.JiaReWenDu,model.crc16Code];
|
||||
NSData*data=[dataContorl stringToHexData:hexstring];
|
||||
|
||||
[ [Socketsingleton sharedInstance] soketWriteData:data];
|
||||
|
||||
}
|
||||
|
||||
[_wenduPicview removeFromSuperview];
|
||||
|
||||
}
|
||||
|
||||
-(void)jiaReMianQue{
|
||||
|
||||
XutoBackMsgModel*backmodel=[[DataCenter defaultDtacenter]valueForKey:@"xutoBackInfo"];
|
||||
UInt64 mac=[dataContorl hexToTen:backmodel.heatTemperature];
|
||||
NSLog(@"%llu",mac);
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
float TPlabel=mac/10;
|
||||
int temp= (int)(TPlabel+0.5);
|
||||
|
||||
NSString *stringFloat = [NSString stringWithFormat:@"%d",temp];
|
||||
NSLog(@"%@",stringFloat);
|
||||
|
||||
|
||||
NSArray*wenDuArr=[_wenduPicview.picArr objectAtIndex:0];
|
||||
|
||||
dispatch_async(_xutoMainQueue, ^{
|
||||
for (NSInteger i=0; i<wenDuArr.count; i++) {
|
||||
|
||||
|
||||
NSString*picString=wenDuArr[i];
|
||||
|
||||
if ([picString isEqualToString:stringFloat ] ) {
|
||||
|
||||
[_wenduPicview.pic selectRow:i inComponent:0 animated:NO];
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - 关闭水泵弹窗
|
||||
|
||||
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
|
||||
|
||||
if (buttonIndex==1) {
|
||||
|
||||
XuToLightModel * lightModel=[[XuToLightModel alloc] init];
|
||||
lightModel.sendmacId =self.currentDevice.macAddress;
|
||||
lightModel.resavemacId =self.currentDevice.macAddress;
|
||||
|
||||
NSString*switchString1=lightModel.description;
|
||||
self.XuToWaterPump.userInteractionEnabled=YES;
|
||||
[ self.XuToWaterPump setImage:[UIImage imageNamed:@"xutobtn5_off.png"] forState:UIControlStateSelected];
|
||||
lightModel.lightNumber= @"05";//
|
||||
lightModel.switchBtn = @"00";
|
||||
lightModel.crc16Str = @"0000";
|
||||
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
|
||||
|
||||
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
||||
|
||||
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
||||
|
||||
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
|
||||
//soket 未断开时显示
|
||||
[self creatXuToindicaterView];
|
||||
[self.XuTohud myhudstart];
|
||||
|
||||
}
|
||||
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
||||
self.XuToWaterPump.selected=YES;
|
||||
}else{
|
||||
self.XuToWaterPump.selected=NO;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Dispose of any resources that can be recreated.
|
||||
|
||||
}
|
||||
|
||||
-(void)XuToControlSetBtnAction:(UIGestureRecognizer *)sender{
|
||||
XutoBackMsgModel *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"xutoBackInfo"];
|
||||
if (self.binddeviceArr.count ==0) {
|
||||
|
||||
[self.view makeToast:@"暂未绑定设备"];
|
||||
|
||||
}else{
|
||||
|
||||
if (backmodel) {
|
||||
|
||||
[self pushSetTimeVC];
|
||||
|
||||
}else{
|
||||
[self.indicatorView stopAnimating];
|
||||
[self showLableAction:@"设备已离线"];
|
||||
|
||||
[self.XuTohud hidmyHud];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
NSLog(@"点击绚多的设置按钮");
|
||||
}
|
||||
|
||||
-(void)XuToSetBtnAction{
|
||||
|
||||
XutoBackMsgModel *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"xutoBackInfo"];
|
||||
if (self.binddeviceArr.count ==0) {
|
||||
|
||||
[self.view makeToast:@"暂未绑定设备"];;
|
||||
|
||||
}else{
|
||||
|
||||
if (backmodel) {
|
||||
|
||||
[self pushSetTimeVC];
|
||||
|
||||
}else{
|
||||
[self.indicatorView stopAnimating];
|
||||
[self showLableAction:@"设备已离线"];
|
||||
|
||||
[self.XuTohud hidmyHud];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
NSLog(@"点击绚多的设置的大响应按钮");
|
||||
|
||||
}
|
||||
|
||||
-(void)pushSetTimeVC{
|
||||
_xuToSetVC=[[XuToSetViewController alloc] init];
|
||||
|
||||
_xuToSetVC.currentdevice=self.currentDevice;
|
||||
[self.navigationController pushViewController:_xuToSetVC animated:YES];
|
||||
//self.navigationBarHidden=NO;
|
||||
}
|
||||
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
|
||||
static NSString *CELL =@"cell";
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CELL];
|
||||
if (cell == nil) {
|
||||
|
||||
cell = [[UITableViewCell alloc ]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL];
|
||||
|
||||
}
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark 登陆成功后收到服务端的回执之后,调用的代理方法
|
||||
-(void)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock{
|
||||
|
||||
|
||||
|
||||
NSString*string1=[dataContorl dataToHexString:data];
|
||||
|
||||
//设备在线显示与设备离线相对应 收到返回数据改变显示状态
|
||||
|
||||
[self.indicatorView stopAnimating];
|
||||
//[_HUD hide:YES];
|
||||
[self.XuTohud hidmyHud];
|
||||
|
||||
if (_xuToSetVC.indicatorView) {
|
||||
[_xuToSetVC.indicatorView stopAnimating];
|
||||
}
|
||||
|
||||
|
||||
NSLog(@"收到服务器的回执2--->%@",data);
|
||||
|
||||
|
||||
self.dataLength=string1.length;
|
||||
//存储
|
||||
if (string1.length == IFISH_BACKMASGTYAP73) {
|
||||
|
||||
[XuToSoketBackMsgDataUnity readSoketDataWithBaackMassgModel:_backMsgModel addWithBackData:data];
|
||||
|
||||
}
|
||||
// 温度
|
||||
[XuToSoketBackMsgDataUnity setTemperaturelabel:self.temLabel addTemperaturebackImg:self.temperImage WithBackData:data addWithBackMassageModel:_backMsgModel addWithTableview:self.tableView];
|
||||
|
||||
//灯的状态
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
[XuToSoketBackMsgDataUnity resetXutoButtonState:self.XuToLight1 addlight2:self.XuToLight2 addGasPump:self.XuToAirPump addWaterPump:self.XuToWaterPump addHuliLight:self.XuToHuli addJiaRe:self.XuTOJiaRe withBackModel:_backMsgModel];
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 刷新设置界面
|
||||
//
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
_xuToSetVC.timeArr= [XuToSoketBackMsgDataUnity refreshXuToTimerAddTemperatureWithBackMassageModel:_backMsgModel];
|
||||
[_xuToSetVC.tableView reloadData];
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)creatXuToindicaterView{
|
||||
// _HUD=[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
// _HUD.delegate=self;
|
||||
|
||||
// //
|
||||
// _HUD.dimBackground=YES;
|
||||
// _HUD.backgroundColor=[UIColor clearColor];
|
||||
// [_HUD hide:YES afterDelay:10.0];
|
||||
|
||||
self.XuTohud=[[MyHud alloc]init];
|
||||
|
||||
self.XuTohud.frame=CGRectMake(0, kScreenSize.height/3, kScreenSize.width,kScreenSize.height*2/3 );
|
||||
|
||||
[self.XuTohud myhudtimeOut];
|
||||
//self.XuTohud.backgroundColor=[UIColor redColor];
|
||||
|
||||
[self.view addSubview:self.XuTohud];
|
||||
|
||||
NSLog(@"**********绚多加载***********");
|
||||
|
||||
}
|
||||
|
||||
-(void)ifishDeviceLogInSuccees{
|
||||
self.isconnect=YES;
|
||||
NSLog(@"app登录成功");
|
||||
|
||||
}
|
||||
-(void)ifishDeviceLogInFail{
|
||||
|
||||
[self endRefreshing];
|
||||
[self.indicatorView stopAnimating];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self deviceNotOnlineState];//设备离线
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -父类方法
|
||||
-(void)shezhiMingCheng
|
||||
{
|
||||
|
||||
_changeNameVC = [[XuToControlNameViewController alloc] init];
|
||||
_changeNameVC.name = self.name.text;
|
||||
_changeNameVC.device = self.currentDevice;
|
||||
__weak typeof (self)wself = self;
|
||||
_changeNameVC.NameWithBlock = ^(NSString *nameStr){
|
||||
wself.name.text = nameStr;
|
||||
[wself initCHNames];
|
||||
};
|
||||
[ wself.navigationController pushViewController: _changeNameVC animated:YES];
|
||||
|
||||
}
|
||||
|
||||
-(void)initCHNames{
|
||||
|
||||
XuToControlName *name = [UserExtendataArchaver currentXuToControlName:self.currentDevice.macAddress];
|
||||
self.airName.text = name.airPump;
|
||||
self.light1Name.text = name.light1;
|
||||
self.light2Name.text = name.light2;
|
||||
self.huLiName.text = name.huLiDeng;
|
||||
self.waterName.text = name.waterPump;
|
||||
self.jiaReName.text = name.jiaRe;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// XuToControlName.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/6/15.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface XuToControlName : NSObject
|
||||
@property(nonatomic,copy) NSString *airPump;
|
||||
@property(nonatomic,copy) NSString *light1;
|
||||
@property(nonatomic,copy) NSString *light2;
|
||||
@property(nonatomic,copy) NSString *huLiDeng;
|
||||
@property(nonatomic,copy) NSString *waterPump;
|
||||
@property(nonatomic,copy) NSString *jiaRe;
|
||||
@property(nonatomic,copy) NSString *macAddress;
|
||||
|
||||
@end
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// XuToControlName.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/6/15.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuToControlName.h"
|
||||
|
||||
@implementation XuToControlName
|
||||
-(void)encodeWithCoder:(NSCoder*)aCoder{
|
||||
|
||||
[aCoder encodeObject:_airPump forKey:@"airPump"];
|
||||
[aCoder encodeObject:_light1 forKey:@"light1"];
|
||||
[aCoder encodeObject:_light2 forKey:@"light2"];
|
||||
[aCoder encodeObject:_huLiDeng forKey:@"huLiDeng"];
|
||||
[aCoder encodeObject:_waterPump forKey:@"waterPump"];
|
||||
[aCoder encodeObject:_jiaRe forKey:@"jiaRe"];
|
||||
[aCoder encodeObject:_macAddress forKey:@"macAddress"];
|
||||
}
|
||||
|
||||
-(id)initWithCoder:(NSCoder*)aDecoder{
|
||||
|
||||
if (self=[super init]) {
|
||||
|
||||
self.airPump = [aDecoder decodeObjectForKey:@"airPump"];
|
||||
self.light1 = [aDecoder decodeObjectForKey:@"light1"];
|
||||
self.light2 = [aDecoder decodeObjectForKey:@"light2"];
|
||||
self.huLiDeng = [aDecoder decodeObjectForKey:@"huLiDeng"];
|
||||
self.waterPump = [aDecoder decodeObjectForKey:@"waterPump"];
|
||||
self.jiaRe=[aDecoder decodeObjectForKey:@"jiaRe"];
|
||||
self.macAddress = [aDecoder decodeObjectForKey:@"macAddress"];
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// XuToControlNameViewController.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/6/15.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IfishDeviceControlNameBaseController.h"
|
||||
|
||||
@interface XuToControlNameViewController : IfishDeviceControlNameBaseController
|
||||
|
||||
@end
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
//
|
||||
// XuToControlNameViewController.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/6/15.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuToControlNameViewController.h"
|
||||
#import "XuToControlName.h"
|
||||
#import "UserExtendataArchaver.h"
|
||||
#import "RuSunChangeNameTextViewCell.h"
|
||||
#define XUTOCHCELL_AIR 50000
|
||||
#define XUTOCHCELL_LIANGHT1 50001
|
||||
#define XUTOCHCELL_LIANGHT2 50002
|
||||
#define XUTOCHCELL_HULI 50003
|
||||
#define XUTOCHCELL_WATER 50004
|
||||
#define XUTOCHCELL_JIARE 50005
|
||||
|
||||
@interface XuToControlNameViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation XuToControlNameViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.tableView.dataSource = self;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
|
||||
if (section==0) {
|
||||
|
||||
return 1;
|
||||
|
||||
}else{
|
||||
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
if (indexPath.section==0) {
|
||||
|
||||
return [super baseViewLoadDeviceNameCell:indexPath intable:tableView];
|
||||
}
|
||||
|
||||
RuSunChangeNameTextViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"RuSunChangeNameTextViewCell"];
|
||||
if (cell==nil) {
|
||||
cell= [[[NSBundle mainBundle]loadNibNamed:@"RuSunChangeNameTextViewCell" owner:self options:nil]lastObject];
|
||||
|
||||
}
|
||||
|
||||
//控制原名
|
||||
if (indexPath.row==5&&indexPath.section==1) {
|
||||
cell.lineImgView.image = [UIImage imageNamed:@"redact_line_last"];
|
||||
|
||||
}
|
||||
NSArray *titles= @[@"气泵",@"灯1",@"灯2",@"护理灯",@"水泵",@"加热棒"];
|
||||
if (indexPath.section==1) {
|
||||
cell.chTitle.text = titles[indexPath.row];
|
||||
}
|
||||
|
||||
//自定义名字
|
||||
XuToControlName *name = [UserExtendataArchaver currentXuToControlName:self.device.macAddress];
|
||||
if (indexPath.section==1&&indexPath.row==0) {
|
||||
cell.chName.text = name.airPump;
|
||||
|
||||
}else if (indexPath.section==1&&indexPath.row==1){
|
||||
cell.chName.text = name.light1;
|
||||
}else if (indexPath.section==1&&indexPath.row==2){
|
||||
cell.chName.text = name.light2;
|
||||
}else if (indexPath.section==1&&indexPath.row==3){
|
||||
cell.chName.text = name.huLiDeng;
|
||||
}else if (indexPath.section==1&&indexPath.row==4){
|
||||
cell.chName.text = name.waterPump;
|
||||
}else if (indexPath.section==1&&indexPath.row==5){
|
||||
cell.chName.text = name.jiaRe;
|
||||
}
|
||||
cell.chName.delegate = self;
|
||||
cell.tag = 50000 + indexPath.row;
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)sureAction
|
||||
{
|
||||
|
||||
|
||||
//RunSunCHNameCustom 本地处理 保存按钮名称 不与服务器交互
|
||||
XuToControlName *name = [[XuToControlName alloc] init];
|
||||
RuSunChangeNameTextViewCell*cell1 = [self.view viewWithTag:XUTOCHCELL_AIR];
|
||||
if (cell1.chName.text.length>3) {
|
||||
[self.view makeToast:@"气泵不能超过3个字"];
|
||||
return;
|
||||
}
|
||||
if (cell1.chName.text.length==0) {
|
||||
[self.view makeToast:@"气泵不能为空"];
|
||||
return;
|
||||
}
|
||||
name.airPump = cell1.chName.text;
|
||||
|
||||
RuSunChangeNameTextViewCell*cell2 = [self.view viewWithTag:XUTOCHCELL_LIANGHT1];
|
||||
if (cell2.chName.text.length>3) {
|
||||
[self.view makeToast:@"灯1不能超过3个字"];
|
||||
return;
|
||||
}
|
||||
if (cell2.chName.text.length==0) {
|
||||
[self.view makeToast:@"灯1不能为空"];
|
||||
return;
|
||||
}
|
||||
name.light1 = cell2.chName.text;
|
||||
|
||||
RuSunChangeNameTextViewCell*cell3 = [self.view viewWithTag:XUTOCHCELL_LIANGHT2];
|
||||
if (cell3.chName.text.length>3) {
|
||||
[self.view makeToast:@"灯2不能超过3个字"];
|
||||
return;
|
||||
}
|
||||
if (cell3.chName.text.length==0) {
|
||||
[self.view makeToast:@"灯2不能为空"];
|
||||
return;
|
||||
}
|
||||
name.light2 = cell3.chName.text;
|
||||
|
||||
RuSunChangeNameTextViewCell*cell4 = [self.view viewWithTag:XUTOCHCELL_HULI];
|
||||
if (cell4.chName.text.length>3) {
|
||||
[self.view makeToast:@"护理灯不能超过3个字"];
|
||||
return;
|
||||
}
|
||||
if (cell4.chName.text.length==0) {
|
||||
[self.view makeToast:@"护理灯不能为空"];
|
||||
return;
|
||||
}
|
||||
name.huLiDeng = cell4.chName.text;
|
||||
|
||||
RuSunChangeNameTextViewCell*cell5 = [self.view viewWithTag:XUTOCHCELL_WATER];
|
||||
if (cell5.chName.text.length>3) {
|
||||
[self.view makeToast:@"水泵不能超过3个字"];
|
||||
return;
|
||||
}
|
||||
if (cell5.chName.text.length==0) {
|
||||
[self.view makeToast:@"水泵不能为空"];
|
||||
return;
|
||||
}
|
||||
name.waterPump = cell5.chName.text;
|
||||
|
||||
RuSunChangeNameTextViewCell*cell6 = [self.view viewWithTag:XUTOCHCELL_JIARE];
|
||||
if (cell6.chName.text.length>3) {
|
||||
[self.view makeToast:@"加热棒不能超过3个字"];
|
||||
return;
|
||||
}
|
||||
if (cell6.chName.text.length==0) {
|
||||
[self.view makeToast:@"加热棒不能为空"];
|
||||
return;
|
||||
}
|
||||
name.jiaRe = cell6.chName.text;
|
||||
|
||||
name.macAddress = self.device.macAddress;
|
||||
[UserExtendataArchaver saveXuToControlName:name];
|
||||
|
||||
[self upLoadDeviceName];
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// XuToLightModel.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/5/6.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "baseModel.h"
|
||||
|
||||
@interface XuToLightModel : baseModel
|
||||
|
||||
@property(nonatomic,copy)NSString*lightNumber;
|
||||
@property(nonatomic,copy)NSString*switchBtn;
|
||||
@property(nonatomic,copy)NSString*crc16Str;
|
||||
|
||||
@end
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// XuToLightModel.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/5/6.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuToLightModel.h"
|
||||
//绚多 开关指令
|
||||
@implementation XuToLightModel
|
||||
- (NSString *)description
|
||||
{
|
||||
self.messagetype=@"00";
|
||||
self.massagelegth=@"13";
|
||||
self.functionCode=@"03";
|
||||
|
||||
return [NSString stringWithFormat:@"%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// XuToSetViewController.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/22.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FatherController.h"
|
||||
#import "Socketsingleton.h"
|
||||
@interface XuToSetViewController : FatherController
|
||||
|
||||
{
|
||||
BOOL _isHidden;
|
||||
BOOL mySwitchIsOn;
|
||||
|
||||
}
|
||||
|
||||
@property(nonatomic,strong)NSArray*timeArr;
|
||||
@property(nonatomic,strong)NSArray*titleArr;
|
||||
@property(nonatomic)BOOL isAuto;// 自动模式
|
||||
@property(nonatomic)UIActivityIndicatorView*indicatorView;
|
||||
|
||||
-(void)addAlertView;
|
||||
|
||||
@property(nonatomic)int percent;
|
||||
@property(nonatomic,strong) DeviceModel* currentdevice;
|
||||
|
||||
|
||||
@end
|
||||
+1221
File diff suppressed because it is too large
Load Diff
+41
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// XuToSoketBackMsgDataUnity.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/22.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XutoBackMsgModel.h"
|
||||
/**
|
||||
* Xuto soket massage control
|
||||
*/
|
||||
|
||||
@interface XuToSoketBackMsgDataUnity : NSObject
|
||||
/**
|
||||
* save soket massage control
|
||||
*/
|
||||
+(void)readSoketDataWithBaackMassgModel:(XutoBackMsgModel*)Xutomodel addWithBackData:(NSData*)data;
|
||||
|
||||
/**
|
||||
* refrash Temperature
|
||||
*/
|
||||
|
||||
+(void)setTemperaturelabel:(UILabel*)temperaturelabel addTemperaturebackImg:(UIImageView*)temperaturebackImg WithBackData:(NSData*)data addWithBackMassageModel:(XutoBackMsgModel*)backModel addWithTableview:(UITableView*)tableview;
|
||||
/**
|
||||
* light state
|
||||
*/
|
||||
|
||||
|
||||
+(void)resetXutoButtonState:(UIButton*)light1 addlight2:(UIButton*)light2 addGasPump:(UIButton*)gaspump addWaterPump:(UIButton*)waterPump addHuliLight:(UIButton*)huLiLight addJiaRe:(UIButton*)jiaReBang withBackModel:(XutoBackMsgModel*)backModel;
|
||||
|
||||
/**
|
||||
* XuTo setView
|
||||
*/
|
||||
|
||||
+(NSArray*)refreshXuToTimerAddTemperatureWithBackMassageModel:(XutoBackMsgModel*)backModel;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// XuToSoketBackMsgDataUnity.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/22.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuToSoketBackMsgDataUnity.h"
|
||||
|
||||
@implementation XuToSoketBackMsgDataUnity
|
||||
//数据
|
||||
|
||||
+(void)readSoketDataWithBaackMassgModel:(XutoBackMsgModel*)xutomodel addWithBackData:(NSData*)data
|
||||
|
||||
{
|
||||
|
||||
NSString*totalString=[dataContorl dataToHexString:data];// 转十六进制
|
||||
xutomodel.gaspump=[totalString substringWithRange:NSMakeRange(30, 4)];
|
||||
xutomodel.light1=[totalString substringWithRange:NSMakeRange(34, 4)];
|
||||
xutomodel.light2=[totalString substringWithRange:NSMakeRange(38, 4)];
|
||||
|
||||
xutomodel.hulilight=[totalString substringWithRange:NSMakeRange(42, 4)];
|
||||
xutomodel.waterpump=[totalString substringWithRange:NSMakeRange(46, 4)];
|
||||
xutomodel.timer1=[totalString substringWithRange:NSMakeRange(50,12)];
|
||||
xutomodel.timer2=[totalString substringWithRange:NSMakeRange(62, 12)];
|
||||
xutomodel.timer3=[totalString substringWithRange:NSMakeRange(74, 12)];
|
||||
xutomodel.timer4=[totalString substringWithRange:NSMakeRange(86, 12)];
|
||||
xutomodel.timer5=[totalString substringWithRange:NSMakeRange(98, 12)];
|
||||
xutomodel.timer6=[totalString substringWithRange:NSMakeRange(110, 12)];
|
||||
xutomodel.heatStickState=[totalString substringWithRange:NSMakeRange(122, 2)];//16进制型
|
||||
xutomodel.wendu=[totalString substringWithRange:NSMakeRange(124, 4)];
|
||||
xutomodel.heatTemperature=[totalString substringWithRange:NSMakeRange(128, 4)];
|
||||
xutomodel.baojingSwitch=[totalString substringWithRange:NSMakeRange(132, 2)];
|
||||
xutomodel.miniTp=[totalString substringWithRange:NSMakeRange(134, 4)];
|
||||
xutomodel.maxTp=[totalString substringWithRange:NSMakeRange(138, 4)];
|
||||
xutomodel.funcCode= [totalString substringWithRange:NSMakeRange(142, 4)];
|
||||
// //实施更新数据 保存
|
||||
|
||||
[[DataCenter defaultDtacenter] setValue:xutomodel forKey:@"xutoBackInfo"];
|
||||
|
||||
}
|
||||
|
||||
//温度
|
||||
+(void)setTemperaturelabel:(UILabel*)temperaturelabel addTemperaturebackImg:(UIImageView*)temperaturebackImg WithBackData:(NSData*)data addWithBackMassageModel:(XutoBackMsgModel*)backModel addWithTableview:(UITableView*)tableview{
|
||||
|
||||
NSString*str=[dataContorl dataToHexString:data];
|
||||
|
||||
str=[str substringWithRange:NSMakeRange(124,4)];
|
||||
UInt64 mac=[dataContorl hexToTen:str];
|
||||
NSLog(@"%llu",mac);
|
||||
|
||||
//float TPlabel=mac/10+(mac%10)*0.1;
|
||||
float TPlabel=mac/10;
|
||||
int temp= (int)(TPlabel+0.5);
|
||||
|
||||
NSString *stringFloat = [NSString stringWithFormat:@"%d",temp];
|
||||
NSLog(@"%@",stringFloat);
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (mac==0) {
|
||||
|
||||
temperaturelabel.text=@"0";
|
||||
// [temperaturebackImg addSubview:temperaturelabel];
|
||||
|
||||
}else{
|
||||
|
||||
temperaturelabel.text=stringFloat;
|
||||
|
||||
//temperaturelabel.textAlignment=NSTextAlignmentCenter;
|
||||
|
||||
//[temperaturebackImg addSubview:temperaturelabel];
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//灯状态
|
||||
|
||||
+(void)resetXutoButtonState:(UIButton*)light1 addlight2:(UIButton*)light2 addGasPump:(UIButton*)gaspump addWaterPump:(UIButton*)waterPump addHuliLight:(UIButton*)huLiLight addJiaRe:(UIButton*)jiaReBang withBackModel:(XutoBackMsgModel*)backModel{
|
||||
// 灯1
|
||||
|
||||
NSString*stateString1=[backModel.light1 substringWithRange:NSMakeRange(2, 2)];
|
||||
|
||||
if ([stateString1 isEqualToString:@"01"]) {
|
||||
[light1 setImage:[UIImage imageNamed:@"xutobtn2_on.png"] forState:UIControlStateNormal];
|
||||
light1.selected=YES;
|
||||
}else{
|
||||
[light1 setImage:[UIImage imageNamed:@"xutobtn2_off.png"] forState:UIControlStateNormal];
|
||||
light1.selected=NO;
|
||||
|
||||
}
|
||||
// 灯2
|
||||
|
||||
NSString*stateString2=[backModel.light2 substringWithRange:NSMakeRange(2, 2)];
|
||||
|
||||
if ([stateString2 isEqualToString:@"01"]) {
|
||||
[light2 setImage:[UIImage imageNamed:@"xutobtn3_on.png"] forState:UIControlStateNormal];
|
||||
light2.selected=YES;
|
||||
}else{
|
||||
[light2 setImage:[UIImage imageNamed:@"xutobtn3_off.png"] forState:UIControlStateNormal];
|
||||
light2.selected=NO;
|
||||
}
|
||||
|
||||
// 气泵
|
||||
|
||||
NSString*stateString3=[backModel.gaspump substringWithRange:NSMakeRange(2, 2)];
|
||||
|
||||
if ([stateString3 isEqualToString:@"01"]) {
|
||||
[gaspump setImage:[UIImage imageNamed:@"xutobtn1_on.png"] forState:UIControlStateNormal];
|
||||
gaspump.selected=YES;
|
||||
}else{
|
||||
[gaspump setImage:[UIImage imageNamed:@"xutobtn1_off.png"] forState:UIControlStateNormal];
|
||||
gaspump.selected=NO;
|
||||
}
|
||||
|
||||
//护理灯
|
||||
|
||||
NSString*stateString4=[backModel.hulilight substringWithRange:NSMakeRange(2, 2)];
|
||||
|
||||
if ([stateString4 isEqualToString:@"01"]) {
|
||||
[huLiLight setImage:[UIImage imageNamed:@"xutobtn4_on.png"] forState:UIControlStateNormal];
|
||||
huLiLight.selected=YES;
|
||||
}else{
|
||||
[huLiLight setImage:[UIImage imageNamed:@"xutobtn4_off.png"] forState:UIControlStateNormal];
|
||||
huLiLight.selected=NO;
|
||||
}
|
||||
|
||||
//水泵
|
||||
|
||||
NSString*stateString5=[backModel.waterpump substringWithRange:NSMakeRange(2, 2)];
|
||||
|
||||
if ([stateString5 isEqualToString:@"01"]) {
|
||||
[waterPump setImage:[UIImage imageNamed:@"xutobtn5_on.png"] forState:UIControlStateNormal];
|
||||
waterPump.selected=YES;
|
||||
}else{
|
||||
[waterPump setImage:[UIImage imageNamed:@"xutobtn5_off.png"] forState:UIControlStateNormal];
|
||||
waterPump.selected=NO;
|
||||
}
|
||||
|
||||
//加热棒
|
||||
|
||||
NSString*stateString6=backModel.heatStickState ;
|
||||
|
||||
if ([stateString6 isEqualToString:@"01"]) {
|
||||
[jiaReBang setImage:[UIImage imageNamed:@"xutobtn6_on.png"] forState:UIControlStateNormal];
|
||||
jiaReBang.selected=YES;
|
||||
}else{
|
||||
[jiaReBang setImage:[UIImage imageNamed:@"xutobtn6_off.png"] forState:UIControlStateNormal];
|
||||
jiaReBang.selected=NO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
//设置界面数据
|
||||
+(NSArray*)refreshXuToTimerAddTemperatureWithBackMassageModel:(XutoBackMsgModel*)backModel{
|
||||
|
||||
NSArray*timerArr=[[NSArray alloc]init];
|
||||
NSString*low=backModel.miniTp;
|
||||
NSString*heigh=backModel.maxTp;
|
||||
UInt64 lowten=[dataContorl hexToTen:low];
|
||||
UInt64 heighten=[dataContorl hexToTen:heigh];
|
||||
float formatlow=lowten/10;
|
||||
float formatheigh=heighten/10;
|
||||
|
||||
NSString*wenduString=[NSString stringWithFormat:@"%.0f~%.0f°C",formatlow,formatheigh];
|
||||
|
||||
// 十六进制
|
||||
NSString*startTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(4, 4)];
|
||||
NSString*endTimeHex1=[backModel.timer1 substringWithRange:NSMakeRange(8, 4)];
|
||||
|
||||
|
||||
// 十进制
|
||||
NSString*startTimeTen1=[dataContorl hexStringToDateString:startTimeHex1];
|
||||
NSString*endTimeTen1=[dataContorl hexStringToDateString:endTimeHex1];
|
||||
NSString*setTim1=[NSString stringWithFormat:@"%@~%@",startTimeTen1,endTimeTen1];
|
||||
// 十六进制
|
||||
NSString*startTimeHex2=[backModel.timer2 substringWithRange:NSMakeRange(4, 4)];
|
||||
NSString*endTimeHex2=[backModel.timer2 substringWithRange:NSMakeRange(8, 4)];
|
||||
// 十进制
|
||||
NSString*startTimeTen2=[dataContorl hexStringToDateString:startTimeHex2];
|
||||
NSString*endTimeTen2=[dataContorl hexStringToDateString:endTimeHex2];
|
||||
NSString*setTim2=[NSString stringWithFormat:@"%@~%@",startTimeTen2,endTimeTen2];
|
||||
|
||||
// 十六进制
|
||||
NSString*startTimeHex3=[backModel.timer3 substringWithRange:NSMakeRange(4, 4)];
|
||||
NSString*endTimeHex3=[backModel.timer3 substringWithRange:NSMakeRange(8, 4)];
|
||||
// 十进制
|
||||
NSString*startTimeTen3=[dataContorl hexStringToDateString:startTimeHex3];
|
||||
NSString*endTimeTen3=[dataContorl hexStringToDateString:endTimeHex3];
|
||||
NSString*setTim3=[NSString stringWithFormat:@"%@~%@",startTimeTen3,endTimeTen3];
|
||||
|
||||
// 十六进制
|
||||
NSString*startTimeHex4=[backModel.timer4 substringWithRange:NSMakeRange(4, 4)];
|
||||
NSString*endTimeHex4=[backModel.timer4 substringWithRange:NSMakeRange(8, 4)];
|
||||
// 十进制
|
||||
NSString*startTimeTen4=[dataContorl hexStringToDateString:startTimeHex4];
|
||||
NSString*endTimeTen4=[dataContorl hexStringToDateString:endTimeHex4];
|
||||
NSString*setTim4=[NSString stringWithFormat:@"%@~%@",startTimeTen4,endTimeTen4];
|
||||
|
||||
// 十六进制
|
||||
NSString*startTimeHex5=[backModel.timer5 substringWithRange:NSMakeRange(4, 4)];
|
||||
NSString*endTimeHex5=[backModel.timer5 substringWithRange:NSMakeRange(8, 4)];
|
||||
// 十进制
|
||||
NSString*startTimeTen5=[dataContorl hexStringToDateString:startTimeHex5];
|
||||
NSString*endTimeTen5=[dataContorl hexStringToDateString:endTimeHex5];
|
||||
NSString*setTim5=[NSString stringWithFormat:@"%@~%@",startTimeTen5,endTimeTen5];
|
||||
|
||||
// 十六进制
|
||||
NSString*startTimeHex6=[backModel.timer6 substringWithRange:NSMakeRange(4, 4)];
|
||||
NSString*endTimeHex6=[backModel.timer6 substringWithRange:NSMakeRange(8, 4)];
|
||||
// 十进制
|
||||
NSString*startTimeTen6=[dataContorl hexStringToDateString:startTimeHex6];
|
||||
NSString*endTimeTen6=[dataContorl hexStringToDateString:endTimeHex6];
|
||||
NSString*setTim6=[NSString stringWithFormat:@"%@~%@",startTimeTen6,endTimeTen6];
|
||||
|
||||
|
||||
timerArr=@[@[wenduString,@"设置时段"],@[setTim1,setTim2],@[setTim3,setTim4],@[setTim5,setTim6]];
|
||||
|
||||
return timerArr;
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// XuToWenDuPicview.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/5/6.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
//炫多 加热棒温度选择器
|
||||
@interface XuToWenDuPicview : UIView
|
||||
|
||||
@property(nonatomic,copy)UIButton*sureBtn
|
||||
;
|
||||
@property(nonatomic,copy)UIPickerView*pic;
|
||||
@property(nonatomic,strong)UIImageView*picBackImg;
|
||||
@property(nonatomic,strong)NSMutableArray*componentArray;
|
||||
@property(nonatomic,strong)NSArray*picArr;
|
||||
|
||||
@property(nonatomic)NSInteger component;
|
||||
@property(nonatomic)NSString* rowTitle;
|
||||
@property(nonatomic)NSInteger row;
|
||||
@property(nonatomic,copy)NSString*picViewResultString;
|
||||
|
||||
@property(nonatomic,copy)NSString*picString;
|
||||
|
||||
|
||||
@end
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// XuToWenDuPicview.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/5/6.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuToWenDuPicview.h"
|
||||
|
||||
@interface XuToWenDuPicview()<UIPickerViewDataSource,UIPickerViewDelegate>
|
||||
|
||||
@end
|
||||
@implementation XuToWenDuPicview
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self=[super initWithFrame:frame];
|
||||
if (self) {
|
||||
|
||||
[self initPicview];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initPicview{
|
||||
|
||||
|
||||
CGFloat imgWid= kScreenSize.width - 40*2;
|
||||
CGFloat imHeight= kScreenSize.width - 60;
|
||||
self.backgroundColor=[UIColor colorWithWhite:0 alpha:0.5];
|
||||
_picBackImg
|
||||
=[[UIImageView alloc]initWithFrame:CGRectMake(40,kScreenSize.height/2-(kScreenSize.width -30)/2, imgWid, imHeight)];
|
||||
_picBackImg.image=[UIImage imageNamed:@"Box"];
|
||||
[self addSubview:_picBackImg];
|
||||
_picBackImg.userInteractionEnabled=YES;
|
||||
UILabel*title=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, _picBackImg.frame.size.width-10*2, 20)];
|
||||
title.text=@"设置加热温度";
|
||||
title.font=[UIFont systemFontOfSize:24];
|
||||
title.textAlignment=NSTextAlignmentCenter;
|
||||
[_picBackImg addSubview:title];
|
||||
|
||||
_pic=[[UIPickerView alloc]initWithFrame:CGRectMake(10,title.frame.origin.y + 20,imgWid - 20,imHeight -30 - 40- 20)];
|
||||
_pic.dataSource=self;
|
||||
_pic.delegate=self;
|
||||
[_picBackImg addSubview:_pic];
|
||||
|
||||
_sureBtn
|
||||
=[UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_sureBtn.frame=CGRectMake(0, _picBackImg.frame.size.height - 44 + 3, _picBackImg.frame.size.width, 44);
|
||||
|
||||
_sureBtn.backgroundColor=COLOR_LABEL_TITLE;
|
||||
[_sureBtn setTitle:@"确定" forState:UIControlStateNormal];
|
||||
_sureBtn.layer.masksToBounds=YES;
|
||||
_sureBtn.layer.cornerRadius=8;
|
||||
_sureBtn.userInteractionEnabled=YES;
|
||||
[_picBackImg addSubview:_sureBtn];
|
||||
|
||||
[self dataSource];
|
||||
|
||||
_componentArray=[[NSMutableArray alloc] init];
|
||||
UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(XuToPicDismissAction:)];
|
||||
[self addGestureRecognizer:tapgestureRecognizer];
|
||||
|
||||
|
||||
}
|
||||
-(void)XuToPicDismissAction:(UITapGestureRecognizer *)tapgestrue{
|
||||
|
||||
[self removeFromSuperview];
|
||||
|
||||
}
|
||||
|
||||
-(void)dataSource{
|
||||
_picArr=@[@[@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23",@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34",@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45",@"46",@"47",@"48",@"49",@"50"]];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark picView数据源
|
||||
|
||||
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
|
||||
NSInteger component;
|
||||
component=_picArr.count;
|
||||
return component;
|
||||
}
|
||||
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
|
||||
|
||||
NSArray *rowArray=[[NSArray alloc] init];
|
||||
rowArray=_picArr[component];
|
||||
return rowArray.count;
|
||||
|
||||
}
|
||||
|
||||
#pragma mark picView代理
|
||||
-(NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
|
||||
|
||||
NSString *rowTitle=nil;
|
||||
|
||||
rowTitle=_picArr[component][row];
|
||||
|
||||
|
||||
_rowTitle=rowTitle;
|
||||
return rowTitle;
|
||||
|
||||
}
|
||||
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
|
||||
|
||||
NSLog(@"**********4");
|
||||
_component=component;
|
||||
_row=row;
|
||||
_picViewResultString=_picArr[0][row];
|
||||
|
||||
NSLog(@"_picViewResultString%@",_picViewResultString);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component{
|
||||
|
||||
return pickerView.frame.size.height/5;;
|
||||
}
|
||||
|
||||
-(CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component{
|
||||
return pickerView.frame.size.width;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// XutoBackMsgModel.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/22.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface XutoBackMsgModel : NSObject
|
||||
//气泵
|
||||
@property(nonatomic,copy) NSString *gaspump;
|
||||
//灯1
|
||||
@property(nonatomic,copy) NSString *light1;
|
||||
|
||||
//灯2
|
||||
@property(nonatomic,copy) NSString *light2;
|
||||
|
||||
//水泵
|
||||
@property(nonatomic,copy) NSString *waterpump;
|
||||
|
||||
//护理灯
|
||||
@property(nonatomic,copy) NSString *hulilight;
|
||||
|
||||
@property(nonatomic,copy)NSString*timer1;
|
||||
@property(nonatomic,copy)NSString*timer2;
|
||||
@property(nonatomic,copy)NSString*timer3;
|
||||
@property(nonatomic,copy)NSString*timer4;
|
||||
@property(nonatomic,copy)NSString*timer5;
|
||||
@property(nonatomic,copy)NSString*timer6;
|
||||
|
||||
//加热棒状态
|
||||
@property(nonatomic,copy) NSString *heatStickState;
|
||||
// 水温度
|
||||
@property(nonatomic,copy) NSString *wendu;
|
||||
// 加热温度
|
||||
@property(nonatomic,copy) NSString *heatTemperature;
|
||||
|
||||
@property(nonatomic,copy) NSString *baojingSwitch;
|
||||
|
||||
@property(nonatomic,copy) NSString *miniTp;
|
||||
|
||||
@property(nonatomic,copy) NSString *maxTp;
|
||||
|
||||
@property(nonatomic,copy) NSString *funcCode;
|
||||
|
||||
@end
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// XutoBackMsgModel.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 16/4/22.
|
||||
// Copyright © 2016年 imac. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XutoBackMsgModel.h"
|
||||
|
||||
@implementation XutoBackMsgModel
|
||||
// 归档时调用 三控
|
||||
-(void)encodeWithCoder:(NSCoder*)aCoder{
|
||||
|
||||
[aCoder encodeObject:self forKey:@"gaspump"];
|
||||
[aCoder encodeObject:self forKey:@"light1"];
|
||||
[aCoder encodeObject:self forKey:@"light2"];
|
||||
[aCoder encodeObject:self forKey:@"waterpump"];
|
||||
[aCoder encodeObject:self forKey:@"hulilight"];
|
||||
[aCoder encodeObject:self forKey:@"timer1"];
|
||||
[aCoder encodeObject:self forKey:@"timer2"];
|
||||
[aCoder encodeObject:self forKey:@"timer3"];
|
||||
[aCoder encodeObject:self forKey:@"timer4"];
|
||||
[aCoder encodeObject:self forKey:@"timer5"];
|
||||
[aCoder encodeObject:self forKey:@"timer6"];
|
||||
[aCoder encodeObject:self forKey:@"wendu"];
|
||||
[aCoder encodeObject:self forKey:@"heatStickState"];
|
||||
[aCoder encodeObject:self forKey:@"baojingSwitch"];
|
||||
[aCoder encodeObject:self forKey:@"miniTp"];
|
||||
[aCoder encodeObject:self forKey:@"maxTp"];
|
||||
}
|
||||
//解挡时调用
|
||||
-(id)initWithCoder:(NSCoder*)aDecoder{
|
||||
if (self=[super init]) {
|
||||
self.gaspump =[aDecoder decodeObjectForKey:@"gaspump"];
|
||||
self.light1 =[aDecoder decodeObjectForKey:@"light1"];
|
||||
self.light2 =[aDecoder decodeObjectForKey:@"light2"];
|
||||
self.waterpump=[aDecoder decodeObjectForKey:@"waterpump"];;
|
||||
self.hulilight=[aDecoder decodeObjectForKey:@"hulilight"];;
|
||||
self.timer1 = [aDecoder decodeObjectForKey:@"timer1"];
|
||||
self.timer2 = [aDecoder decodeObjectForKey:@"timer2"];
|
||||
self.timer3 = [aDecoder decodeObjectForKey:@"timer3"];
|
||||
self.timer4 = [aDecoder decodeObjectForKey:@"timer4"];
|
||||
self.timer5 = [aDecoder decodeObjectForKey:@"timer5"];
|
||||
self.timer6 = [aDecoder decodeObjectForKey:@"timer6"];
|
||||
self.wendu = [aDecoder decodeObjectForKey:@"wendu"];
|
||||
self.heatStickState =[aDecoder decodeObjectForKey:@"heatStickState"];
|
||||
self.baojingSwitch=[aDecoder decodeObjectForKey:@"baojingSwitch"];
|
||||
self.miniTp=[aDecoder decodeObjectForKey:@"miniTp"];
|
||||
self.maxTp=[aDecoder decodeObjectForKey:@"maxTp"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user