643 lines
22 KiB
Objective-C
643 lines
22 KiB
Objective-C
//
|
|
// SongNuoDBCenterViewController.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 17/1/6.
|
|
// Copyright © 2017年 lianxiang. All rights reserved.
|
|
//
|
|
|
|
#import "SongNuoDBCenterViewController.h"
|
|
#import "SongNuoBDProtocol.h"
|
|
#import "SongNuoDBSetViewController.h"
|
|
|
|
#define SONGNUO_LIGHT1 600000
|
|
#define SONGNUO_LIGHT2 600001
|
|
#define SONGNUO_WATERPUMP 600002
|
|
#define SONGNUO_AIRPUMP 600003
|
|
#define SONGNUO_GUIDENG 600004
|
|
#define SONGNUO_JIARE 600005
|
|
|
|
#define kPlace ([UIScreen mainScreen].bounds.size.width - btnWid*2) /4
|
|
#define btnWid 100
|
|
#import "XuToWenDuPicview.h"
|
|
#import "JiaReWenDuModel.h"
|
|
#import "SongNuoBackMsgDataUnity.h"
|
|
#import "SongNuo86NameViewController.h"
|
|
#import "SongNuo86Name.h"
|
|
#import "UserExtendataArchaver.h"
|
|
|
|
@interface SongNuoDBCenterViewController ()<UITableViewDelegate>
|
|
{
|
|
dispatch_queue_t _songNuoMainQueue;
|
|
CGFloat _tableviewSizeHeight;
|
|
}
|
|
|
|
@property(nonatomic,strong) SongNuoDBSetViewController *songNuoSetVC;
|
|
@property(nonatomic,strong) SongNuoBDProtocol * songNuoBackModel;
|
|
|
|
@property(nonatomic,strong) MyHud *SongNuoHud;
|
|
|
|
@property(nonatomic,strong) XuToWenDuPicview *wenduPicview;
|
|
@property(nonatomic,strong) SongNuo86NameViewController *changeNameVC;
|
|
|
|
@end
|
|
|
|
@implementation SongNuoDBCenterViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
_songNuoBackModel=[[SongNuoBDProtocol alloc] init];
|
|
[Socketsingleton sharedInstance].communiteDelegate=self;
|
|
// Do any additional setup after loading the view.
|
|
_songNuoMainQueue = dispatch_get_main_queue();
|
|
|
|
[self initSongNuoBDUI];
|
|
[self creatFishAnimation];
|
|
|
|
|
|
[self.setbackBtn addTarget:self action:@selector(songNuoBDSetBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
|
UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(songNuoBDSetBtnAction:)];
|
|
[self.setImag addGestureRecognizer:tapgestureRecognizer];
|
|
|
|
[self.tableView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil];
|
|
|
|
}
|
|
|
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
|
|
if ([keyPath isEqualToString:@"contentSize"]) {
|
|
NSValue *new = [change valueForKey:NSKeyValueChangeNewKey];
|
|
CGSize size = [new CGSizeValue];
|
|
if (size.height == 0) {
|
|
self.tableView.contentSize = CGSizeMake(size.width, _tableviewSizeHeight);
|
|
}
|
|
} else {
|
|
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
|
}
|
|
}
|
|
|
|
- (void)dealloc {
|
|
[self.tableView removeObserver:self forKeyPath:@"contentSize"];
|
|
}
|
|
#pragma mark- 设置
|
|
|
|
-(void)songNuoBDSetBtnAction{
|
|
|
|
SongNuoBackMassage *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"SongNuoDBProto"];
|
|
if (self.binddeviceArr.count ==0) {
|
|
//老方案已去
|
|
[self.view makeToast:@"暂未绑定设备"];
|
|
|
|
}else{
|
|
|
|
if (backmodel) {
|
|
|
|
[self pushSetTimeVC];
|
|
|
|
}else{
|
|
[self.indicatorView stopAnimating];
|
|
[self showLableAction:@"设备已离线"];
|
|
|
|
//[self.XuTohud hidmyHud];
|
|
}
|
|
|
|
|
|
}
|
|
|
|
NSLog(@"点击绚多的设置按钮");
|
|
}
|
|
|
|
-(void)songNuoBDSetBtnAction:(UIGestureRecognizer *)sender{
|
|
|
|
SongNuoBackMassage *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"SongNuoDBProto"];
|
|
if (self.binddeviceArr.count ==0) {
|
|
|
|
[self.view makeToast:@"暂未绑定设备"];
|
|
|
|
}else{
|
|
|
|
if (backmodel) {
|
|
|
|
[self pushSetTimeVC];
|
|
|
|
}else{
|
|
[self.indicatorView stopAnimating];
|
|
[self showLableAction:@"设备已离线"];
|
|
|
|
}
|
|
}
|
|
|
|
NSLog(@"松诺的设置按钮");
|
|
}
|
|
|
|
-(void)pushSetTimeVC{
|
|
_songNuoSetVC=[[SongNuoDBSetViewController alloc] init];
|
|
_songNuoSetVC.currentdevice=self.currentDevice;
|
|
[self.navigationController pushViewController:_songNuoSetVC animated:YES];
|
|
|
|
}
|
|
|
|
-(void)creatFishAnimation{
|
|
|
|
NSLog(@"SongNuoBDUI");
|
|
}
|
|
|
|
-(void)initSongNuoBDUI
|
|
{
|
|
//重置 self.bubble 的 frame
|
|
CGFloat animViewHeight= kScreenSize.width/4;
|
|
if (kScreenSize.height==480) {
|
|
|
|
self.bubble.frame = CGRectMake((kScreenSize.width -(kScreenSize.width - 2 * kPlace)*2/3)/2, kPlace + 60 , (kScreenSize.width - 2 * kPlace)*2/3, (kScreenSize.width - 2 * kPlace)*2/3);
|
|
|
|
|
|
self.temperature.frame = CGRectMake(30, 70, (kScreenSize.width - 2 * kPlace - 100)*2/3, (kScreenSize.width - 2 * kPlace - 200)*2/3);
|
|
self.temperature.font = [UIFont fontWithName:@"Avenir Next Condensed" size:46];
|
|
|
|
self.dulabel.frame = CGRectMake( (kScreenSize.width - 2 * kPlace - 100)*2/3,74,50, kScreenSize.width - 2 * kPlace - 210);
|
|
|
|
|
|
self.dulabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:20];
|
|
|
|
self.animView.frame= CGRectMake(0, kPlace + 80 + (kScreenSize.width - 2 * kPlace) -animViewHeight/2 - 15-80, kScreenSize.width, animViewHeight);
|
|
|
|
self.notOnLineLabel.frame = CGRectMake(40, 60, kScreenSize.width - 2 * kPlace - 100, kScreenSize.width - 2 * kPlace - 200);
|
|
self.notOnLineLabel .font = [UIFont fontWithName:@"Avenir Next Condensed" size:15];
|
|
|
|
|
|
}else{
|
|
|
|
self.temperature.frame = CGRectMake(10, 80, kScreenSize.width - 2 * kPlace - 100, kScreenSize.width - 2 * kPlace - 200);
|
|
self.temperature.font = [UIFont fontWithName:@"Avenir Next Condensed" size:70];
|
|
|
|
|
|
self.bubble.frame = CGRectMake((kScreenSize.width -(kScreenSize.width - 3 * kPlace ))/2, kPlace + 80 , kScreenSize.width - 3 * kPlace, kScreenSize.width - 3 * kPlace);
|
|
|
|
|
|
self.dulabel.frame = CGRectMake((kScreenSize.width - 2 * kPlace)/3*2 -30 , 90 ,50, kScreenSize.width - 2 * kPlace - 210);
|
|
self.dulabel.font = [UIFont fontWithName:@"Avenir Next Condensed" size:40];
|
|
self.animView.frame= CGRectMake(0, kPlace + 40 + (kScreenSize.width - 2 * kPlace) -animViewHeight/2 - 15, kScreenSize.width, animViewHeight);
|
|
|
|
CGFloat bubH=kScreenSize.width - 3 * kPlace;
|
|
|
|
self.notOnLineLabel.frame = CGRectMake(0,bubH/2-15, bubH, 30);
|
|
self.notOnLineLabel .font = [UIFont fontWithName:@"Avenir Next Condensed" size:20];
|
|
|
|
}
|
|
|
|
NSArray *nameArr=@[@"PFLight1_off",@"PFLight1_off",@"ChongLang_off",@"O2_off",@"",@"PFkilLlight_off",@"JiaReBang_off"];
|
|
|
|
CGFloat btnControlWith = 70;
|
|
CGFloat btnControlPlace = (kScreenSize.width - 3*btnControlWith )/4;
|
|
|
|
CGFloat currentY = CGRectGetMaxY(self.bubble.frame);
|
|
|
|
for (int i = 0; i < 3; i ++) {
|
|
|
|
self.button = [[UIButton alloc] init] ;
|
|
self.button.frame = CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY , btnControlWith, btnControlWith +11);
|
|
|
|
[self.button setImage:[UIImage imageNamed:nameArr[i]] forState:UIControlStateNormal];
|
|
//self.button.backgroundColor = [UIColor redColor];
|
|
self.button.tag=600000+i;
|
|
[self.button addTarget:self action:@selector(songNuoBDBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY + btnControlWith +11 - 6, btnControlWith, 14)];
|
|
//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.button];
|
|
|
|
if (i==0) {
|
|
|
|
self.nuoLight1Btn = self.button;
|
|
self.light1Name = textLbl;
|
|
}else if (i==1){
|
|
|
|
self.nuoLight2Btn = self.button;
|
|
self.light2Name = textLbl;
|
|
}else if (i==2){
|
|
self.nuoWaterPumpBtn = self.button;
|
|
self.waterPumpName = textLbl;
|
|
}
|
|
|
|
if (i == 2) {
|
|
currentY = CGRectGetMaxY(textLbl.frame);
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < 3; i ++) {
|
|
self.button = [[UIButton alloc] init] ;
|
|
self.button.frame =CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY + 6, btnControlWith, btnControlWith +11);
|
|
|
|
[self.button setImage:[UIImage imageNamed:nameArr[i+3]]forState:UIControlStateNormal];
|
|
|
|
self.button.tag= 600003+i;
|
|
[self.button addTarget:self action:@selector(songNuoBDBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
UILabel* textLbl = [[UILabel alloc] initWithFrame:CGRectMake(btnControlPlace +i*(btnControlPlace + btnControlWith),currentY + btnControlWith +11, btnControlWith, 14)];
|
|
//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.button];
|
|
|
|
if (i==0) {
|
|
|
|
self.nuoAirPumpBtn = self.button;
|
|
self.airPumpName = textLbl;
|
|
}else if (i==1){
|
|
|
|
self.nuoGuiDengBtn = self.button;
|
|
self.guiDengName = textLbl;
|
|
}else if (i==2){
|
|
|
|
self.nuoJiaReBtn = self.button;
|
|
self.jiaReName = textLbl;
|
|
}
|
|
|
|
_tableviewSizeHeight = 64 + CGRectGetMaxY(textLbl.frame);
|
|
|
|
}
|
|
[self initCHNames];
|
|
}
|
|
|
|
-(void)songNuoBDBtnClick:(UIButton*)btn{
|
|
|
|
SongNuoBDProtocol*backmodel=[[DataCenter defaultDtacenter]valueForKey:@"SongNuoDBProto"];
|
|
if (backmodel) {
|
|
|
|
}else{
|
|
[self deviceNotOnlineState];
|
|
[self showLableAction:@"设备已离线"];
|
|
return;
|
|
}
|
|
|
|
|
|
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 SONGNUO_LIGHT1:
|
|
{
|
|
|
|
btn.userInteractionEnabled=YES;
|
|
[btn setImage:[UIImage imageNamed:@"PFLight1_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 creatSongNuoIndicator];
|
|
[self.SongNuoHud myhudstart];
|
|
|
|
}
|
|
|
|
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
|
btn.selected=YES;
|
|
}else{
|
|
btn.selected=NO;
|
|
}
|
|
|
|
}
|
|
break;
|
|
case SONGNUO_LIGHT2:
|
|
{
|
|
|
|
btn.userInteractionEnabled=YES;
|
|
[btn setImage:[UIImage imageNamed:@"PFLight1_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 creatSongNuoIndicator];
|
|
[self.SongNuoHud myhudstart];
|
|
|
|
}
|
|
|
|
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
|
btn.selected=YES;
|
|
}else{
|
|
btn.selected=NO;
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case SONGNUO_WATERPUMP:
|
|
|
|
{
|
|
|
|
btn.userInteractionEnabled=YES;
|
|
[btn setImage:[UIImage imageNamed:@"ChongLang_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 creatSongNuoIndicator];
|
|
[self.SongNuoHud myhudstart];
|
|
|
|
}
|
|
|
|
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
|
btn.selected=YES;
|
|
}else{
|
|
btn.selected=NO;
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case SONGNUO_AIRPUMP:
|
|
{
|
|
|
|
btn.userInteractionEnabled=YES;
|
|
[btn setImage:[UIImage imageNamed:@"O2_on.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 creatSongNuoIndicator];
|
|
[self.SongNuoHud myhudstart];
|
|
|
|
}
|
|
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
|
btn.selected=YES;
|
|
}else{
|
|
btn.selected=NO;
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case SONGNUO_GUIDENG:
|
|
{
|
|
|
|
btn.userInteractionEnabled=YES;
|
|
[btn setImage:[UIImage imageNamed:@"PFkilLlight_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 creatSongNuoIndicator];
|
|
[self.SongNuoHud myhudstart];
|
|
}
|
|
if ([lightModel.switchBtn isEqualToString:@"00"]) {
|
|
btn.selected=YES;
|
|
}else{
|
|
btn.selected=NO;
|
|
}
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
case SONGNUO_JIARE:
|
|
|
|
{
|
|
|
|
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 songNuoJiaReMianQue];
|
|
|
|
}else{
|
|
|
|
[self showLableAction:@"设备已离线"];
|
|
}
|
|
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
|
|
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)creatSongNuoIndicator{
|
|
|
|
self.SongNuoHud=[[MyHud alloc]init];
|
|
|
|
self.SongNuoHud.frame=CGRectMake(0, kScreenSize.height*2/3 - 50 , kScreenSize.width,kScreenSize.height/3);
|
|
|
|
[self.SongNuoHud myhudtimeOut];
|
|
|
|
[self.view addSubview:self.SongNuoHud];
|
|
|
|
|
|
}
|
|
|
|
-(void)songNuoJiaReMianQue{
|
|
|
|
SongNuoBackMassage *backmodel=[[DataCenter defaultDtacenter]valueForKey:@"SongNuoDBProto"];
|
|
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(_songNuoMainQueue, ^{
|
|
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)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock{
|
|
|
|
NSString*string1=[dataContorl dataToHexString:data];
|
|
|
|
//设备在线显示与设备离线相对应 收到返回数据改变显示状态
|
|
|
|
[self.indicatorView stopAnimating];
|
|
//[_HUD hide:YES];
|
|
[self.SongNuoHud hidmyHud];
|
|
self.notOnLineLabel.hidden = YES;
|
|
self.dulabel.hidden=NO;
|
|
self.temperature.hidden=NO;
|
|
|
|
if (_songNuoSetVC.indicatorView) {
|
|
[_songNuoSetVC.indicatorView stopAnimating];
|
|
}
|
|
|
|
NSLog(@"收到服务器的回执2--->%@",data);
|
|
|
|
self.dataLength=string1.length;
|
|
|
|
//存储
|
|
|
|
[SongNuoBackMsgDataUnity readSoketBDProtocolMassgModel:_songNuoBackModel addWithBackData:data];
|
|
|
|
// 温度
|
|
|
|
[SongNuoBackMsgDataUnity setBD86Templabel:self.temperature addbubleImge:self.bubble WithBackData:data addWithProtocol:_songNuoBackModel addWithTableview:self.tableView];
|
|
|
|
|
|
//灯的状态
|
|
[SongNuoBackMsgDataUnity resetSongNuoBD86ButtonState:self.nuoLight1Btn addlight2:self.nuoLight2Btn addWaterPump:self.nuoWaterPumpBtn addAir:self.nuoAirPumpBtn guiDeng:self.nuoGuiDengBtn addJiaRe:self.nuoJiaReBtn withProtocol:_songNuoBackModel];
|
|
|
|
// 刷新设置界面
|
|
|
|
_songNuoSetVC.timeArr = [SongNuoBackMsgDataUnity refreshSongNuoBD86TimerAddTempWithBackMassageModel:_songNuoBackModel];
|
|
[_songNuoSetVC.tableView reloadData];
|
|
|
|
|
|
}
|
|
|
|
-(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 = [[SongNuo86NameViewController 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{
|
|
|
|
SongNuo86Name* songNuo = [UserExtendataArchaver currentSongNuo86:self.currentDevice.macAddress];
|
|
self.light1Name.text = songNuo.light1;
|
|
self.light2Name.text = songNuo.light2;
|
|
self.waterPumpName.text = songNuo.waterPump;
|
|
self.airPumpName.text = songNuo.airPump;
|
|
self.guiDengName.text = songNuo.guideng;
|
|
self.jiaReName.text = songNuo.jiaRe;
|
|
|
|
}
|
|
|
|
- (void)didReceiveMemoryWarning {
|
|
[super didReceiveMemoryWarning];
|
|
// Dispose of any resources that can be recreated.
|
|
}
|
|
|
|
@end
|