宠物店修改

This commit is contained in:
kai60
2020-05-02 14:56:49 +08:00
parent 8fca79324a
commit 53f06fcf43
100 changed files with 2672 additions and 198 deletions
@@ -10,5 +10,6 @@
@interface RuSunChangeNameTitleViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UITextField *deviceName;
@property (weak, nonatomic) IBOutlet UILabel *cNTitle;
@end
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -27,7 +26,7 @@
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="水族箱" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dae-FO-MMJ">
<rect key="frame" x="58" y="14" width="54" height="21"/>
<rect key="frame" x="58" y="14.5" width="54" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="avD-IG-wRe"/>
<constraint firstAttribute="width" constant="54" id="ex7-wD-xWL"/>
@@ -37,7 +36,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="我的水族箱" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="cgK-Ks-2s1">
<rect key="frame" x="173" y="0.0" width="122" height="50"/>
<rect key="frame" x="173" y="-0.5" width="122" height="50.5"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="2zD-xY-XTZ"/>
</constraints>
@@ -57,6 +56,7 @@
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="cNTitle" destination="Dae-FO-MMJ" id="U2e-nu-70l"/>
<outlet property="deviceName" destination="cgK-Ks-2s1" id="n3G-VN-O4U"/>
</connections>
</tableViewCell>
@@ -559,8 +559,12 @@ typedef NS_ENUM(NSInteger,ThreeControBackMsgTape){
[DeviceCommunicateDataUnity resetThreeControlButtonState:_light1Button addlight2:_light2Button addpump:_pumpButton withBackModel:_backmodel];
// 实时刷新设置界面 时间设置
_SetTimeVC.timeArr=[DeviceCommunicateDataUnity refreshThreeControlTimerAddTemperatureWithBackMassageModel:_backmodel];
[_SetTimeVC.tableView reloadData];
if (_SetTimeVC)
{
_SetTimeVC.timeArr=[DeviceCommunicateDataUnity refreshThreeControlTimerAddTemperatureWithBackMassageModel:_backmodel];
[_SetTimeVC.tableView reloadData];
}
}
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
@interface XuToControlName : NSObject
@interface XuToControlName : NSObject<NSCoding>
@property(nonatomic,copy) NSString *airPump;
@property(nonatomic,copy) NSString *light1;
@property(nonatomic,copy) NSString *light2;
@@ -21,6 +21,8 @@
@property(nonatomic,copy) NSString *zengyangPump;
@property(nonatomic,copy) NSString *zaolangPump;
@property(nonatomic,copy) NSString *xunhuanPump;
@property(nonatomic,copy) NSString *type;
@@ -24,6 +24,7 @@
[aCoder encodeObject:_zengyangPump forKey:@"zengyangPump"];
[aCoder encodeObject:_zaolangPump forKey:@"zaolangPump"];
[aCoder encodeObject:_xunhuanPump forKey:@"xunhuanPump"];
[aCoder encodeObject:_type forKey:@"type"];
}
@@ -43,6 +44,7 @@
self.zengyangPump = [aDecoder decodeObjectForKey:@"zengyangPump"];
self.zaolangPump = [aDecoder decodeObjectForKey:@"zaolangPump"];
self.xunhuanPump = [aDecoder decodeObjectForKey:@"xunhuanPump"];
self.type = [aDecoder decodeObjectForKey:@"type"];
}
return self;
@@ -7,9 +7,12 @@
//
#import "IfishDeviceControlNameBaseController.h"
#import "IfishDeviceInfo.h"
#import "DeviceModel.h"
@interface XuToControlNameViewController : IfishDeviceControlNameBaseController
@property (nonatomic,assign) BOOL isNewdevice;
@end
@@ -10,6 +10,7 @@
#import "XuToControlName.h"
#import "UserExtendataArchaver.h"
#import "RuSunChangeNameTextViewCell.h"
#import "RuSunChangeNameTitleViewCell.h"
#define XUTOCHCELL_AIR 50000
#define XUTOCHCELL_LIANGHT1 50001
#define XUTOCHCELL_LIANGHT2 50002
@@ -36,14 +37,28 @@
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
NSInteger count=0;
if (section==0) {
return 1;
count=1;
}else{
return _isNewdevice?8:6;
if (self.isNewdevice)
{
count=8;
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
count=4;
}
}
else
{
count=6;
}
}
return count;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
@@ -55,7 +70,11 @@
if (indexPath.section==0) {
return [super baseViewLoadDeviceNameCell:indexPath intable:tableView];
RuSunChangeNameTitleViewCell*cell= (RuSunChangeNameTitleViewCell*)[super baseViewLoadDeviceNameCell:indexPath intable:tableView];
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
cell.cNTitle.text=@"宠物笼";
}
return cell;
}
RuSunChangeNameTextViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"RuSunChangeNameTextViewCell"];
@@ -72,6 +91,9 @@
NSArray *titles;
if (_isNewdevice) {
titles = @[@"杀菌灯",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"护理灯",@"循环泵",@"加热棒"];
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
titles = @[@"照明",@"换气",@"杀菌",@"恒温"];
}
}else {
titles = @[@"气泵",@"灯1",@"灯2",@"护理灯",@"水泵",@"加热棒"];
}
@@ -83,6 +105,9 @@
XuToControlName *name;
if (_isNewdevice) {
name = [UserExtendataArchaver currentNewXuToControlName:self.device.macAddress];
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
name = [UserExtendataArchaver currentPetsXuToControlName:self.device.macAddress];
}
}else {
name = [UserExtendataArchaver currentXuToControlName:self.device.macAddress];
}
@@ -92,6 +117,9 @@
if ((cell.chName.text.length>0) & ![cell.chName.text isEqualToString:@"控制名"] & ![cell.chName.text isEqualToString:name.shajunLight]) {
}else {
cell.chName.text = name.shajunLight;
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
cell.chName.text = name.xunhuanPump;
}
}
}else {
cell.chName.text = name.airPump;
@@ -157,6 +185,95 @@
//RunSunCHNameCustom 本地处理 保存按钮名称 不与服务器交互
XuToControlName *name = [[XuToControlName alloc] init];
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
name=[UserExtendataArchaver currentXuToControlName:self.device.macAddress];
for (RuSunChangeNameTextViewCell*cell in [self.tableView visibleCells]) {
if (![cell isKindOfClass:[RuSunChangeNameTextViewCell class]]) {
continue;
}
if ([cell.chTitle.text isEqualToString:@"照明"]) {
if (cell.chName.text.length>3)
{
[self.view makeToast:@"照明不能超过3个字"];
return;
}
else if (cell.chName.text.length==0)
{
[self.view makeToast:@"照明不能为空"];
return;
}
else
{
name.xunhuanPump=cell.chName.text;
}
}
else if ([cell.chTitle.text isEqualToString:@"换气"]) {
if (cell.chName.text.length>3)
{
[self.view makeToast:@"换气不能超过3个字"];
return;
}
else if (cell.chName.text.length==0)
{
[self.view makeToast:@"换气不能为空"];
return;
}
else
{
name.zengyangPump=cell.chName.text;
}
}
else if ([cell.chTitle.text isEqualToString:@"杀菌"]) {
if (cell.chName.text.length>3)
{
[self.view makeToast:@"杀菌不能超过3个字"];
return;
}
else if (cell.chName.text.length==0)
{
[self.view makeToast:@"杀菌不能为空"];
return;
}
else
{
name.light1=cell.chName.text;
}
}
else if ([cell.chTitle.text isEqualToString:@"恒温"]) {
if (cell.chName.text.length>3)
{
[self.view makeToast:@"恒温不能超过3个字"];
return;
}
else if (cell.chName.text.length==0)
{
[self.view makeToast:@"恒温不能为空"];
return;
}
else
{
name.light2=cell.chName.text;
}
}
}
[UserExtendataArchaver saveNewXuToControlName:name];
[self upLoadDeviceName];
return;
}
RuSunChangeNameTextViewCell*cell1 = [self.view viewWithTag:XUTOCHCELL_AIR];
if (cell1.chName.text.length>3) {
if (_isNewdevice) {
@@ -849,7 +849,8 @@ Strong XuToControlName *xutoName;//水族箱内各种名字
NSLog(@"ni hua dong tai kuai");
str=[NSString stringWithFormat:@"%ld",(long)self.waterInfmodel.remindcycle];
[_remindPic makeToast:@"请设置换水天数"];
NSString*title=@"请设置换水天数";
[_remindPic makeToast:title];
return;
}
@@ -9,16 +9,18 @@
#import <Foundation/Foundation.h>
#import "Xuanduo2Model.h"
#import "Xuanduo2TimerModel.h"
#import "IfishDeviceInfo.h"
#import "xuanduo3fModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface Xuanduo2DataUtility : NSObject
+(void)readSocketDataWithBackMsgModel:(Xuanduo2Model*)xuanduoModel addWithBackData:(NSData*)data;
+(void)readSocketDataWithBackMsgModel:(id)xuanduoModel addWithBackData:(NSData*)data type:(NSString*)type;
+(void)readTimerSocketDataWithBackMsgModel:(Xuanduo2TimerModel*)xuanduoTimerModel addWithBackStr:(NSString*)dataStr;
+(void)readTimerSocketDataWithBackMsgModel:(Xuanduo2TimerModel*)xuanduoTimerModel addWithBackStr:(NSString*)dataStr type:(NSString*)type;
+(void)resetNewXuanduoButtonState:(UIButton*)uvLightBtn gasPumpLight:(UIButton*)gasLightBtn light1:(UIButton*)light1Btn light2:(UIButton*)light2Btn waveLight:(UIButton*)waveLightBtn huliLight:(UIButton*)huliLightBtn waterLight:(UIButton*)waterLightBtn heatLight:(UIButton*)heatLightBtn withModel:(Xuanduo2Model*)backModel;
+(void)resetNewXuanduoButtonState:(UIButton*)uvLightBtn gasPumpLight:(UIButton*)gasLightBtn light1:(UIButton*)light1Btn light2:(UIButton*)light2Btn waveLight:(UIButton*)waveLightBtn huliLight:(UIButton*)huliLightBtn waterLight:(UIButton*)waterLightBtn heatLight:(UIButton*)heatLightBtn withModel:(id)backModel type:(NSString*)type;
@end
NS_ASSUME_NONNULL_END
@@ -8,11 +8,17 @@
#import "Xuanduo2DataUtility.h"
@implementation Xuanduo2DataUtility
+(void)readSocketDataWithBackMsgModel:(Xuanduo2Model*)xuanduoModel addWithBackData:(NSData*)data{
+(void)readSocketDataWithBackMsgModel:(id)model addWithBackData:(NSData*)data type:(nonnull NSString *)type{
NSString *dataString = [dataContorl dataToHexString:data];// 转十六进制
@try {
if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]&&[model isKindOfClass:[Xuanduo2Model class]])
{
Xuanduo2Model*xuanduoModel=model;
xuanduoModel.gasPump = [dataString substringWithRange:NSMakeRange(30, 4)];
xuanduoModel.light1 = [dataString substringWithRange:NSMakeRange(34, 4)];
xuanduoModel.light2 = [dataString substringWithRange:NSMakeRange(38, 4)];
@@ -28,6 +34,23 @@
xuanduoModel.alarmSwitch = [dataString substringWithRange:NSMakeRange(74, 2)];
xuanduoModel.miniTemp = [dataString substringWithRange:NSMakeRange(76, 4)];
xuanduoModel.maxTemp = [dataString substringWithRange:NSMakeRange(80, 4)];
}
else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]&&[model isKindOfClass:[Xuanduo3fModel class]])
{
Xuanduo3fModel*xuanduoModel=model;
xuanduoModel.light = [dataString substringWithRange:NSMakeRange(30, 4)];
xuanduoModel.gasPump = [dataString substringWithRange:NSMakeRange(34, 4)];
xuanduoModel.uvLamp = [dataString substringWithRange:NSMakeRange(38, 4)];
xuanduoModel.constTmep = [dataString substringWithRange:NSMakeRange(42, 4)];
xuanduoModel.temperature = [dataString substringWithRange:NSMakeRange(46, 4)];
xuanduoModel.heatingTemperature = [dataString substringWithRange:NSMakeRange(50, 4)];
xuanduoModel.vuPHstatus = [dataString substringWithRange:NSMakeRange(54, 4)];
xuanduoModel.alarmSwitch = [dataString substringWithRange:NSMakeRange(58, 2)];
xuanduoModel.miniTemp = [dataString substringWithRange:NSMakeRange(60, 4)];
xuanduoModel.maxTemp = [dataString substringWithRange:NSMakeRange(64, 4)];
}
} @catch (NSException *exception) {
} @finally {
@@ -36,7 +59,12 @@
}
+(void)resetNewXuanduoButtonState:(UIButton*)uvLightBtn gasPumpLight:(UIButton*)gasLightBtn light1:(UIButton*)light1Btn light2:(UIButton*)light2Btn waveLight:(UIButton*)waveLightBtn huliLight:(UIButton*)huliLightBtn waterLight:(UIButton*)waterLightBtn heatLight:(UIButton*)heatLightBtn withModel:(Xuanduo2Model*)backModel{
+(void)resetNewXuanduoButtonState:(UIButton*)uvLightBtn gasPumpLight:(UIButton*)gasLightBtn light1:(UIButton*)light1Btn light2:(UIButton*)light2Btn waveLight:(UIButton*)waveLightBtn huliLight:(UIButton*)huliLightBtn waterLight:(UIButton*)waterLightBtn heatLight:(UIButton*)heatLightBtn withModel:(Xuanduo2Model*)model type:(nonnull NSString *)type{
if ([type isEqualToString:DECICE_TYPE_XUANDUO2F])
{
Xuanduo2Model*backModel=model;
// 杀菌灯
NSString *stateString1 = [backModel.uvLamp substringWithRange:NSMakeRange(2, 2)];
if ([stateString1 isEqualToString:@"01"]) {
@@ -91,9 +119,46 @@
}else{
heatLightBtn.selected = NO;
}
}
else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
// 杀菌
Xuanduo3fModel*backModel=model;
NSString *stateString1 = [backModel.uvLamp substringWithRange:NSMakeRange(2, 2)];
if ([stateString1 isEqualToString:@"01"]) {
light1Btn.selected = YES;
}else{
light1Btn.selected = NO;
}
// 换气
NSString *stateString2 = [backModel.gasPump substringWithRange:NSMakeRange(2, 2)];
if ([stateString2 isEqualToString:@"01"]) {
gasLightBtn.selected = YES;
}else{
gasLightBtn.selected = NO;
}
// 灯
NSString *stateString3 = [backModel.light substringWithRange:NSMakeRange(2, 2)];
if ([stateString3 isEqualToString:@"01"]) {
waterLightBtn.selected = YES;
}else{
waterLightBtn.selected = NO;
}
// 恒温
NSString *stateString4 = [backModel.constTmep substringWithRange:NSMakeRange(2, 2)];
if ([stateString4 isEqualToString:@"01"]) {
light2Btn.selected = YES;
}else{
light2Btn.selected = NO;
}
}
}
+(void)readTimerSocketDataWithBackMsgModel:(Xuanduo2TimerModel*)xuanduoTimerModel addWithBackStr:(NSString*)dataStr {
+(void)readTimerSocketDataWithBackMsgModel:(Xuanduo2TimerModel*)xuanduoTimerModel addWithBackStr:(NSString*)dataStr type:(nonnull NSString *)type{
xuanduoTimerModel.lightNumber = [dataStr substringWithRange:NSMakeRange(30, 2)];
xuanduoTimerModel.groupSum = [dataStr substringWithRange:NSMakeRange(32, 2)];
UInt64 sum = [dataContorl hexToTen:xuanduoTimerModel.groupSum];
@@ -7,6 +7,8 @@
//
#import "FatherController.h"
#import "IfishDeviceInfo.h"
#include "xuanduo3fModel.h"
NS_ASSUME_NONNULL_BEGIN
@@ -15,10 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
@interface Xuanduo2SettingController : FatherController
@property (nonatomic,strong) UIActivityIndicatorView*indicatorView;
@property (nonatomic ,strong) Xuanduo2Model *dataModel;
@property (nonatomic ,strong) id dataModel;
@property(nonatomic,strong) DeviceModel* currentdevice;
- (void)refreshWithData:(Xuanduo2Model *)model;
- (void)refreshWithData:(id)model;
@end
@@ -24,6 +24,8 @@
#import "ReadTimerModel.h"
#import "Xuanduo2DataUtility.h"
#import "Xuanduo2TimerModel.h"
#import "IfishDeviceInfo.h"
#import "NSString+Add.h"
#define kBtnTag 500
#define kSwitchBtnTag 600
@@ -54,6 +56,7 @@ static NSString *setTimerflag = @"SetTimerCell";
BOOL _huanShuiSwitchIsOn;
NSInteger _selectSection;
MydatePickerView*_mydatepicView;
}
- (void)viewWillAppear:(BOOL)animated {
@@ -86,14 +89,25 @@ static NSString *setTimerflag = @"SetTimerCell";
- (void)setup {
[self.navigationController.navigationBar resetBackgroundImage];
[self addTitleViewWithTitle:@"水族箱设置"];
NSString*title=@"水族箱设置";
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
title = @"水族箱设置";
}
else if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
title = @"宠物笼设置";
}
[self addTitleViewWithTitle:title];
[self refreshWithData:self.dataModel];
[self setupTable];
[self creatIndicatorView];
[Socketsingleton sharedInstance].communiteDelegate = self;
}
- (void)refreshWithData:(Xuanduo2Model *)model {
- (void)refreshWithData:(Xuanduo3fModel*)model {
NSString*low = model.miniTemp;
NSString*heigh = model.maxTemp;
UInt64 lowten = [dataContorl hexToTen:low];
@@ -106,6 +120,14 @@ static NSString *setTimerflag = @"SetTimerCell";
- (void)setupTable {
_titieArr = @[@"循环泵",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"杀菌灯"];
_imgArr = @[@"xunhuan_big",@"gas_big",@"light_big",@"light_big",@"wave_big",@"shajun_big"];
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
_titieArr = @[@"照明",@"换气",@"杀菌"];
_imgArr = @[@"照明开",@"换气开",@"杀菌开"];
}
_selectSection = -1;
for (int i = 0; i<_titieArr.count; i++) {
NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0];
@@ -123,7 +145,7 @@ static NSString *setTimerflag = @"SetTimerCell";
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2 + self.timeDic.allKeys.count;
return 2 + self.timeDic.allKeys.count+([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]?1:0);
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -136,6 +158,13 @@ static NSString *setTimerflag = @"SetTimerCell";
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[section-2]];
return dataArr.count;
}
else
{
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
return 1;
}
}
return 0;
}
@@ -150,7 +179,8 @@ static NSString *setTimerflag = @"SetTimerCell";
cell.temperaturelabel.text = model.temperatureLabel;
[cell.temPSwitch addTarget:self action:@selector(xuTotempSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
if (self.dataModel) {
if ([self.dataModel.alarmSwitch isEqualToString:@"01"]) {
Xuanduo2Model*model=self.dataModel;
if ([model.alarmSwitch isEqualToString:@"01"]) {
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateNormal];
cell.temPSwitch.selected = NO;
@@ -185,6 +215,11 @@ static NSString *setTimerflag = @"SetTimerCell";
if (self.waterInfmodel.remindcycle == 0) {
//在未获取换水信息时暂时显示
cell.huanshuiDaylabel.text=@"换水时间";
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
cell.huanshuiDaylabel.text=@"杀菌时间";
cell.titleLabel.text=@"杀菌提醒";
}
}else{
cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%ld天",(long)self.waterInfmodel.remindcycle];
@@ -210,19 +245,55 @@ static NSString *setTimerflag = @"SetTimerCell";
if (!self.waterInfmodel.remindDate) {
cell.textLabel.text=[NSString stringWithFormat:@"下次换水时间:%@",self.nextChangeDateLabel];
}
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
cell.textLabel.text=[NSString stringWithFormat:@"下次杀菌时间:%@",self.waterInfmodel.remindDate];
if (!self.waterInfmodel.remindDate) {
cell.textLabel.text=[NSString stringWithFormat:@"下次杀菌时间:%@",self.nextChangeDateLabel];
}
}
cell.textLabel.font=[UIFont systemFontOfSize:15];
[cell.textLabel sizeToFit];
cell.textLabel.textColor =[UIColor colorWithRed:146.0/256.0 green:146.0/256.0 blue:146.0/256.0 alpha:1];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"secondSetCell"]];
}else{
}
else{
cell.textLabel.text=@"";
}
cell.userInteractionEnabled = NO;
return cell;
}else {
}else if(indexPath.section -2== _titieArr.count && indexPath.row == 0&&[self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
TemperatureSetCell *cell = [tableView dequeueReusableCellWithIdentifier:temperatureCellid];
TemperatureSetModel *model=[[TemperatureSetModel alloc]init];
model.title = @"恒温设置";
cell.titleLabel.text = model.title;
NSLog(@"wendu str = %@",_wenduString);
model.temperatureLabel = _wenduString;
cell.temPSwitch.hidden=YES;
cell.temperaturelabel.frame=cell.temPSwitch.frame;
Xuanduo3fModel*model3=self.dataModel;
int mac=[dataContorl hexToTen:model3.temperature];
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp];
cell.temperaturelabel.textAlignment=NSTextAlignmentRight;
[cell.temperaturelabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@""]]];
return cell;
}
else {
if (indexPath.section - 2 < _titieArr.count && _selectSection == indexPath.section) {
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section-2]];
BOOL havePlus = [dataArr containsObject:plusflag];
@@ -272,6 +343,10 @@ static NSString *setTimerflag = @"SetTimerCell";
return 0;
}
}
else if(indexPath.section - 2 ==_titieArr.count&&[self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
return 50;
}
return 0;
}
@@ -281,13 +356,14 @@ static NSString *setTimerflag = @"SetTimerCell";
if (section == 0) {
return 5;
}else if (section == 2){
return 80;
return 40;
}else if (section == 3){
return 40;
}else if (section == 4){
return 40;
}else if (section == 5){
return 40;
return [self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]?0:40;
}else if (section == 6){
return 40;
}else if (section == 7){
@@ -304,14 +380,14 @@ static NSString *setTimerflag = @"SetTimerCell";
oneHeader.backgroundColor = COLOR_MIAN;
return oneHeader;
}else if(section == 2){
XuanduoSectionHeaderView *section1HeaderView = [XuanduoSectionHeaderView shareHeaderView];
section1HeaderView.arrowBtn.tag = kBtnTag + section;
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
section1HeaderView.arrowBtn.selected = YES;
headerView.controlBtn.selected = YES;
}
section1HeaderView.titleLabel.text = _titieArr[section-2];
[section1HeaderView.arrowBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
return section1HeaderView;
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}else if(section == 3){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
@@ -331,14 +407,24 @@ static NSString *setTimerflag = @"SetTimerCell";
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}else if(section == 5){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
UIView *oneHeader = [[UIView alloc] init];
oneHeader.backgroundColor = COLOR_MIAN;
return oneHeader;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
else
{
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
if (_selectSection == section) {
headerView.controlBtn.selected = YES;
}
[headerView.controlBtn addTarget:self action:@selector(foldAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView configWithImageName:_imgArr[section-2] labelName:_titieArr[section-2]];
return headerView;
}
}else if(section == 6){
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
headerView.controlBtn.tag = kBtnTag + section;
@@ -378,6 +464,16 @@ static NSString *setTimerflag = @"SetTimerCell";
//换水提醒日期选择
_remindPic=[[remindCyclePic alloc]init];
_remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
_remindPic.type=self.currentdevice.type;
[self.view.window addSubview:_remindPic];
[_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside];
[self huanShuiMainQueue];
}else if(indexPath.section-2==_titieArr.count){
//恒温设置
_remindPic=[[remindCyclePic alloc]initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height) type:@"temp"];
_remindPic.type=@"temp";
_remindPic.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
[self.view.window addSubview:_remindPic];
[_remindPic.sureBtn addTarget:self action:@selector(xuToremindCyclePicDone) forControlEvents:UIControlEventTouchUpInside];
@@ -438,14 +534,26 @@ static NSString *setTimerflag = @"SetTimerCell";
readModel.resavemacId = self.currentdevice.macAddress;
readModel.crc16str=@"0000";
switch (_selectSection - 2) {
case 0: //循环泵
case 0: //循环泵 或 照明
readModel.selectorNumber = @"04";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
readModel.selectorNumber=@"01";
}
break;
case 1: //增氧
readModel.selectorNumber = @"01";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
readModel.selectorNumber=@"02";
}
break;
case 2: //灯光1
readModel.selectorNumber = @"02";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
readModel.selectorNumber=@"03";
}
break;
case 3: //灯光2
readModel.selectorNumber = @"03";
@@ -494,16 +602,32 @@ static NSString *setTimerflag = @"SetTimerCell";
case 0: //循环泵
{
timerModel.selectorNumber = @"04";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"01";
}
}
break;
case 1: //增氧
{
timerModel.selectorNumber = @"01";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"02";
}
}
break;
case 2: //灯光1
{
timerModel.selectorNumber = @"02";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"03";
}
}
break;
case 3: //灯光2
@@ -648,16 +772,32 @@ static NSString *setTimerflag = @"SetTimerCell";
case 0: //循环泵
{
timerModel.selectorNumber = @"04";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"01";
}
}
break;
case 1: //增氧
{
timerModel.selectorNumber = @"01";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"02";
}
}
break;
case 2: //灯光1
{
timerModel.selectorNumber = @"02";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"03";
}
}
break;
case 3: //灯光2
@@ -724,16 +864,28 @@ static NSString *setTimerflag = @"SetTimerCell";
case 0: //循环泵
{
timerModel.selectorNumber = @"04";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"01";
}
}
break;
case 1: //增氧
{
timerModel.selectorNumber = @"01";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"02";
}
}
break;
case 2: //灯光1
{
timerModel.selectorNumber = @"02";
if([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
timerModel.selectorNumber=@"03";
}
}
break;
case 3: //灯光2
@@ -901,7 +1053,23 @@ static NSString *setTimerflag = @"SetTimerCell";
#pragma mark 默认换水时间
-(void)huanShuiMainQueue{
if (_remindPic.picViewResultString !=nil || (_remindPic.picViewResultString ==nil && self.waterInfmodel.remindcycle !=0 )) {
if (_indexPath.section-2==_titieArr.count)
{
Xuanduo3fModel*model3=self.dataModel;
int mac=[dataContorl hexToTen:model3.temperature];
//float TPlabel=mac/10+(mac%10)*0.1;
NSInteger temp = mac/10.0;
if (temp<1)
{
temp=1;
}
[_remindPic.pic selectRow:temp-1 inComponent:0 animated:NO];
return;
}
else if (_remindPic.picViewResultString !=nil || (_remindPic.picViewResultString ==nil && self.waterInfmodel.remindcycle !=0 )) {
NSArray*shijianArr=[_remindPic.picArr objectAtIndex:0];
NSLog(@"a");
for (NSInteger k=0; k<shijianArr.count; k++) {
@@ -944,14 +1112,19 @@ static NSString *setTimerflag = @"SetTimerCell";
NSLog(@"ni hua dong tai kuai");
str=[NSString stringWithFormat:@"%ld",(long)self.waterInfmodel.remindcycle];
[_remindPic makeToast:@"请设置换水天数"];
NSString*title=@"请设置换水天数";
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
title=@"请设置杀菌天数";
}
[_remindPic makeToast:title];
return;
}
cell.huanshuiDaylabel.text=[NSString stringWithFormat:@"%@天",str];
//设置换水日期
[IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId
[IFISHHTTPTOOL setRemindWaterInfWith:[NSString stringWithFormat:@"%@_%@",self.currentdevice.deviceId,self.currentdevice.type]
waterRemind:@"1" remindCycle:str
huishuiShiJian:^(setRemindWaterModel *remindModel) {
@@ -967,6 +1140,49 @@ static NSString *setTimerflag = @"SetTimerCell";
[_remindPic removeFromSuperview];
}
else if (_indexPath.section-2==_titieArr.count)
{
TemperatureSetCell*cell=[self.tableView cellForRowAtIndexPath:_indexPath];
NSString *str=_remindPic.picViewResultString;
if (str==nil) {
//str=@"1";
NSLog(@"ni hua dong tai kuai");
str=[NSString stringWithFormat:@"%ld",(long)self.waterInfmodel.remindcycle];
NSString*title=@"请设置换水天数";
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
title=@"请设置杀菌天数";
}
[_remindPic makeToast:title];
return;
}
cell.temperaturelabel.text=[NSString stringWithFormat:@"%.1f℃",str.floatValue];
//设置换水日期
;
[_remindPic removeFromSuperview];
baseModel*tempModel=[[baseModel alloc]init];
tempModel.sendmacId =self.currentdevice.macAddress;
tempModel.resavemacId =self.currentdevice.macAddress;
tempModel.functionCode=@"0E";
tempModel.massagelegth=@"13";
int intString = [str intValue];
int newIntString=intString*10;
NSString*temp =[dataContorl tpIntStringToFourHex:newIntString];
NSString*minString=[NSString stringWithFormat:@"%@%@%%@",tempModel.description,temp,@"0000"];
NSLog(@"minstring = %@",minString);
NSData*tempData=[dataContorl stringToHexData:minString];
[[Socketsingleton sharedInstance] soketWriteData:tempData];
}
}
@@ -1028,7 +1244,7 @@ static NSString *setTimerflag = @"SetTimerCell";
if (huanShuiSwitch.selected ==YES) {
//开
huanShuiSwitch.selected =NO;
[IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId
[IFISHHTTPTOOL setRemindWaterInfWith:[NSString stringWithFormat:@"%@_%@",self.currentdevice.deviceId,self.currentdevice.type]
waterRemind:@"1" remindCycle:picResult
huishuiShiJian:^(setRemindWaterModel *remindModel) {
self.nextChangeDateLabel=remindModel.remindDate;
@@ -1042,7 +1258,7 @@ static NSString *setTimerflag = @"SetTimerCell";
}else{
//关
huanShuiSwitch.selected =YES;
[IFISHHTTPTOOL setRemindWaterInfWith:self.currentdevice.deviceId
[IFISHHTTPTOOL setRemindWaterInfWith:[NSString stringWithFormat:@"%@_%@",self.currentdevice.deviceId,self.currentdevice.type]
waterRemind:@"0" remindCycle:picResult
huishuiShiJian:^(setRemindWaterModel *remindModel) {
@@ -1159,7 +1375,7 @@ static NSString *setTimerflag = @"SetTimerCell";
}else {
[_timerModel.groupModelArr removeAllObjects];
}
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1];
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type];
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
[dataArr removeAllObjects];
[dataArr addObject:plusflag];
@@ -1177,7 +1393,7 @@ static NSString *setTimerflag = @"SetTimerCell";
[self.tableView reloadData];
}
if ([readTimer isEqualToString:@"0108"] || [readTimer isEqualToString:@"0105"]) {
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data];
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentdevice.type];
[self refreshWithData:self.dataModel];
[self.XuTohud hidmyHud];
[self.indicatorView stopAnimating];
@@ -7,11 +7,15 @@
//
#import "WhiteNavBaseViewController.h"
#import "IfishP2PMonitorController.h"
NS_ASSUME_NONNULL_BEGIN
@interface Xuanduo2fController : WhiteNavBaseViewController
@property(nonatomic,strong) DeviceModel* currentDevice;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *waterLightTop;
@property (weak, nonatomic) IBOutlet UIButton *controlBtn;
@property (weak, nonatomic) IBOutlet UIButton *cameraBtn;
@end
@@ -26,6 +26,7 @@
#import "JHRefreshAmazingAniView.h"
#import "JHRefresh.h"
#import "searchDeviceModel.h"
#import "PetStoresViewController.h"
#define kBtnTag 100
@@ -42,7 +43,7 @@
@property (weak, nonatomic) IBOutlet UILabel *jiareLabel;
@property (weak, nonatomic) IBOutlet UIButton *brandBtn;
@property (weak, nonatomic) IBOutlet UILabel *brandName;
@property (nonatomic ,strong) Xuanduo2Model *dataModel;
@property (nonatomic ,strong) Xuanduo2Model* dataModel;
@property (weak, nonatomic) IBOutlet UILabel *tempLabel;
@property (weak, nonatomic) IBOutlet UILabel *tipLabel;
@property (nonatomic, strong) NSTimer *switchTimer;
@@ -79,6 +80,7 @@
[super viewDidLoad];
[self setup];
[self connect];
// Do any additional setup after loading the view from its nib.
}
@@ -96,11 +98,52 @@
//
[_brandBtn sd_setBackgroundImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,self.currentDevice.logo]] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"brandLogo_hold"]];
_brandName.text = self.currentDevice.brandName;
self.dataModel=nil;
[self initCHNames];
[Socketsingleton sharedInstance].communiteDelegate = self;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tempSwitch)];
// [self.tempLabel addGestureRecognizer:tap];
[self creatRefreshView];
//
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
self.imageView.image=[UIImage imageNamed:@"pet"];
self.waterLightTop.constant=55;
//
[self.waterLight setBackgroundImage:[UIImage imageNamed:@"照明关"] forState:UIControlStateNormal];
[self.waterLight setBackgroundImage:[UIImage imageNamed:@"照明开"] forState:UIControlStateSelected];
// self.xunhuanLabel.text=@"照明";
//
[self.gasPumpLight setBackgroundImage:[UIImage imageNamed:@"换气关"] forState:UIControlStateNormal];
[self.gasPumpLight setBackgroundImage:[UIImage imageNamed:@"换气开"] forState:UIControlStateSelected];
// self.zengyangLabel.text=@"换气";
//
[self.light1 setBackgroundImage:[UIImage imageNamed:@"杀菌关"] forState:UIControlStateNormal];
[self.light1 setBackgroundImage:[UIImage imageNamed:@"杀菌开"] forState:UIControlStateSelected];
// self.light1Label.text=@"杀菌";
//
[self.light2 setBackgroundImage:[UIImage imageNamed:@"恒温关"] forState:UIControlStateNormal];
[self.light2 setBackgroundImage:[UIImage imageNamed:@"恒温开"] forState:UIControlStateSelected];
// self.light2Label.text=@"恒温";
self.tipLabel.text=@"宠物笼温度";
self.controlBtn.hidden=NO;
self.cameraBtn.hidden=NO;
self.waveLight.hidden=YES;
self.zaolangLabel.hidden=YES;
self.uvLight.hidden=YES;
self.shajunLight.hidden=YES;
self.huliLight.hidden=YES;
self.huliLabel.hidden=YES;
self.heatLight.hidden=YES;
self.jiareLabel.hidden=YES;
}
}
- (void)connect {
@@ -159,8 +202,9 @@
//[[Socketsingleton sharedInstance];
}
//
[[Socketsingleton sharedInstance] socketConnectHost];
[Socketsingleton sharedInstance].macAddress = self.currentDevice.macAddress;
[[Socketsingleton sharedInstance] socketConnectHost];
}
#pragma mark 通信监听communiteDelegate
@@ -211,16 +255,19 @@
[self.XuTohud hidmyHud];
[self endRefreshing];
NSLog(@"123124124");
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data];
if ([self.tipLabel.text isEqualToString:@"鱼缸温度"]) {
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentDevice.type];
[self setTemperature];
}
if (self.dataModel.gasPump) {
if (self.dataModel) {
_offLineLabel.hidden = YES;
}else {
_offLineLabel.hidden = NO;
}
[Xuanduo2DataUtility resetNewXuanduoButtonState:self.uvLight gasPumpLight:self.gasPumpLight light1:self.light1 light2:self.light2 waveLight:self.waveLight huliLight:self.huliLight waterLight:self.waterLight heatLight:self.heatLight withModel:self.dataModel];
[Xuanduo2DataUtility resetNewXuanduoButtonState:self.uvLight gasPumpLight:self.gasPumpLight light1:self.light1 light2:self.light2 waveLight:self.waveLight huliLight:self.huliLight waterLight:self.waterLight heatLight:self.heatLight withModel:self.dataModel type:self.currentDevice.type];
}
-(void)ifishDeviceLogInFail{
@@ -237,6 +284,70 @@
#pragma mark -- actions --
- (IBAction)cameraBtnClick:(id)sender {
NSMutableArray *guanxiiArr= [[DataCenter defaultDtacenter] valueForKey:@"devicamerArr"];
NSString*cameraId=nil;
for (DeviceCameraModel *model in guanxiiArr) {
if (model.deviceId == self.currentDevice.deviceId ) {
cameraId=model.cameraId;
break;
}
}
if (cameraId)
{
IfishCameraModel *camera;
NSArray*array=[[DataCenter defaultDtacenter]valueForKey:@"cameraArr"];
for (IfishCameraModel*model in array) {
if ([model.cameraId isEqualToString:cameraId])
{
camera=model;
break;
}
}
if (camera)
{
[[Socketsingleton sharedInstance] cutOffSocket];
//
IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init];
p2pVC.contact = camera;
[self.navigationController pushViewController:p2pVC animated:YES];
}
else
{
[self.view makeToast:@"暂无关联的摄像头"];
}
}
else
{
[self.view makeToast:@"暂无关联的摄像头"];
}
}
- (IBAction)controlBtnClick:(id)sender {
FormatTankAddCamera*model=[[DataCenter defaultDtacenter] valueForKey:@"currentStore"];
if (model)
{
PetStoresViewController*store=[[PetStoresViewController alloc]init];
store.store=model;
;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:store animated:YES];
}
}
- (IBAction)btnActions:(UIButton *)btn {
if (self.dataModel.gasPump) {
@@ -256,33 +367,56 @@
switch (btn.tag) {
case kBtnTag: //
{
if (btn.selected) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self changLightStatus:lightModel withLightNumber:@"04" dataStr:switchString1];
}];
[alertController addAction:cancelAction];
[alertController addAction:sureAction];
[self.navigationController presentViewController:alertController animated:YES completion:nil];
}else {
[self changLightStatus:lightModel withLightNumber:@"04" dataStr:switchString1];
if([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
[self changLightStatus:lightModel withLightNumber:@"01" dataStr:switchString1];
}
else{
if (btn.selected) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self changLightStatus:lightModel withLightNumber:@"04" dataStr:switchString1];
}];
[alertController addAction:cancelAction];
[alertController addAction:sureAction];
[self.navigationController presentViewController:alertController animated:YES completion:nil];
}else {
[self changLightStatus:lightModel withLightNumber:@"04" dataStr:switchString1];
}
}
}
break;
case kBtnTag + 1: //
{
[self changLightStatus:lightModel withLightNumber:@"01" dataStr:switchString1];
NSString*light=@"01";
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
light=@"02";
}
[self changLightStatus:lightModel withLightNumber:light dataStr:switchString1];
}
break;
case kBtnTag + 2: //1
{
[self changLightStatus:lightModel withLightNumber:@"02" dataStr:switchString1];
NSString*light=@"02";
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
light=@"03";
}
[self changLightStatus:lightModel withLightNumber:light dataStr:switchString1];
}
break;
case kBtnTag + 3: //2
{
[self changLightStatus:lightModel withLightNumber:@"03" dataStr:switchString1];
NSString*light=@"03";
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
light=@"04";
}
[self changLightStatus:lightModel withLightNumber:light dataStr:switchString1];
}
break;
case kBtnTag + 4: //
@@ -327,10 +461,21 @@
[self.view.window addSubview:_wenduPicview];
_wenduPicview.wenDuPicviewDelegate = self;
NSString *stateStr =nil;
if ([self.dataModel.status isKindOfClass:[NSNull class]]||!self.dataModel.status ) {
self.dataModel.status = @"0000";
NSString*status;
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F])
{
status=((Xuanduo2Model*)self.dataModel).status;
}
stateStr = [self.dataModel.status substringWithRange:NSMakeRange(2, 2)];
else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
status=((Xuanduo3fModel*)self.dataModel).constTmep;
}
if ([status isKindOfClass:[NSNull class]]||status ) {
status = @"0000";
}
stateStr = [status substringWithRange:NSMakeRange(2, 2)];
[_wenduPicview initCateBtnSate:stateStr];
[self heatAction];
@@ -378,7 +523,17 @@
- (void)heatAction
{
UInt64 mac=[dataContorl hexToTen:self.dataModel.heatingTemperature];
UInt64 mac=0;
NSLog(@"%llu",mac);
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
Xuanduo2Model*model=(Xuanduo2Model*)self.dataModel;
mac=[dataContorl hexToTen:model.heatingTemperature];
}
else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
Xuanduo3fModel*model=(Xuanduo3fModel*)self.dataModel;
mac=[dataContorl hexToTen:model.heatingTemperature];
}
NSLog(@"%llu",mac);
float TPlabel=mac/10;
int temp= (int)(TPlabel+0.5);
@@ -444,7 +599,15 @@
}else {
self.tipLabel.text = @"当月电量";
UInt64 mac = [dataContorl hexToTen:self.dataModel.electricity];
UInt64 mac = 0;
NSLog(@"%llu",mac);
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
Xuanduo2Model*model=(Xuanduo2Model*)self.dataModel;
mac=[dataContorl hexToTen:model.electricity];
}
else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
}
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0];
[self.tempLabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
if (!_switchTimer) {
@@ -455,7 +618,15 @@
}
- (void)changeTemp {
self.tipLabel.text = @"鱼缸温度";
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
self.tipLabel.text = @"鱼缸温度";
}
else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
self.tipLabel.text = @"宠物笼温度";
}
[self setTemperature];
[_switchTimer invalidate];
_switchTimer = nil;
@@ -478,6 +649,13 @@
titleImgs = @[@"ifishdropview_edite_device",@"ifishdropview_delect_device",@"Ifish_share_device",@"ifishdropview_set_device"];
titles=@[@"修改名称",@"删除设备",@"分享设备",@"鱼缸设置"];
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
titles=@[@"修改名称",@"删除设备",@"分享设备",@"宠物笼设置"];
}
pop.delegate = self;
pop.backgroundImage =image
@@ -538,8 +716,18 @@
#pragma mark - 修改设备名
- (void)setTemperature {
UInt64 mac = [dataContorl hexToTen:self.dataModel.waterTemperature];
UInt64 mac = 0;
NSLog(@"%llu",mac);
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
Xuanduo2Model*model=(Xuanduo2Model*)self.dataModel;
mac=[dataContorl hexToTen:model.waterTemperature];
}
else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
Xuanduo3fModel*model=(Xuanduo3fModel*)self.dataModel;
mac=[dataContorl hexToTen:model.temperature];
}
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp];
@@ -563,6 +751,10 @@
-(void)initCHNames{
XuToControlName *name = [UserExtendataArchaver currentNewXuToControlName:self.currentDevice.macAddress];
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
name=[UserExtendataArchaver currentPetsXuToControlName:self.currentDevice.macAddress];
}
self.shajunLight.text = name.shajunLight;
self.zengyangLabel.text = name.zengyangPump;
self.light1Label.text = name.light1;
@@ -719,9 +911,17 @@
}
- (Xuanduo2Model *)dataModel {
- (id)dataModel {
if (!_dataModel) {
_dataModel = [Xuanduo2Model new];
_dataModel = nil;
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
_dataModel=[[Xuanduo2Model alloc]init];
}
else if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
_dataModel=[[Xuanduo3fModel alloc]init];
}
}
return _dataModel;
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_0" orientation="portrait">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
@@ -14,7 +14,9 @@
<connections>
<outlet property="brandBtn" destination="KcF-jg-Mz2" id="90Z-SG-zCz"/>
<outlet property="brandName" destination="pjU-4c-KIu" id="7o4-eb-hHX"/>
<outlet property="cameraBtn" destination="iCh-CK-V5y" id="guD-Hq-sdu"/>
<outlet property="contentView" destination="aik-7S-q8v" id="uIf-SZ-FJV"/>
<outlet property="controlBtn" destination="ASo-hi-5ge" id="qfX-CB-Urm"/>
<outlet property="gasPumpLight" destination="ZVe-ED-kl7" id="mbB-kR-vdN"/>
<outlet property="heatLight" destination="fFJ-1w-2f5" id="SYo-Yn-tUf"/>
<outlet property="huliLabel" destination="7KA-Hc-54C" id="jOn-NM-fyy"/>
@@ -34,6 +36,7 @@
<outlet property="uvLight" destination="ucP-6q-kgn" id="h0M-05-ZQd"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outlet property="waterLight" destination="94R-4Q-SUx" id="sLi-lF-GPC"/>
<outlet property="waterLightTop" destination="kES-AW-PEh" id="AEG-4b-dSg"/>
<outlet property="waveLight" destination="83l-yl-ndR" id="Ppq-0b-uJB"/>
<outlet property="xunhuanLabel" destination="zRG-Xz-MbP" id="jCW-ap-zLb"/>
<outlet property="zaolangLabel" destination="BWx-iu-nY0" id="rxl-X0-mne"/>
@@ -42,29 +45,50 @@
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H1f-gs-HPh">
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aik-7S-q8v" userLabel="Content View">
<rect key="frame" x="0.0" y="0.0" width="320" height="775"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="802.5"/>
<subviews>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ASo-hi-5ge">
<rect key="frame" x="20" y="280" width="80" height="20"/>
<color key="backgroundColor" red="0.96078431372549022" green="0.66666666666666663" blue="0.73725490196078436" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="JOT-JM-Hx8"/>
<constraint firstAttribute="height" constant="20" id="XQI-fM-m1M"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="切换控制器">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="controlBtnClick:" destination="-1" eventType="touchUpInside" id="3SB-mH-S1M"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="xuanduo_bg" translatesAutoresizingMaskIntoConstraints="NO" id="EVp-Sm-Feq">
<rect key="frame" x="0.0" y="0.0" width="320" height="300"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="V9N-xo-Uzm"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="鱼缸温度" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vcu-MT-d6F">
<rect key="frame" x="129" y="314" width="62" height="18"/>
<rect key="frame" x="156.5" y="314" width="62" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="100" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="94R-4Q-SUx">
<rect key="frame" x="30" y="372" width="35" height="35"/>
<rect key="frame" x="30" y="372" width="49" height="49"/>
<constraints>
<constraint firstAttribute="width" secondItem="94R-4Q-SUx" secondAttribute="height" multiplier="1:1" id="zkk-3F-Fut"/>
</constraints>
@@ -75,7 +99,7 @@
</connections>
</button>
<button opaque="NO" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZVe-ED-kl7">
<rect key="frame" x="105" y="372" width="35" height="35"/>
<rect key="frame" x="119" y="372" width="48.5" height="49"/>
<constraints>
<constraint firstAttribute="width" secondItem="ZVe-ED-kl7" secondAttribute="height" multiplier="1:1" id="Nyb-kW-maB"/>
</constraints>
@@ -86,7 +110,7 @@
</connections>
</button>
<button opaque="NO" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WFc-cF-80l">
<rect key="frame" x="180" y="372" width="35" height="35"/>
<rect key="frame" x="207.5" y="372" width="49" height="49"/>
<constraints>
<constraint firstAttribute="width" secondItem="WFc-cF-80l" secondAttribute="height" multiplier="1:1" id="KNO-vi-GYn"/>
</constraints>
@@ -97,7 +121,7 @@
</connections>
</button>
<button opaque="NO" tag="103" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RHd-Xx-AyG">
<rect key="frame" x="255" y="372" width="35" height="35"/>
<rect key="frame" x="296.5" y="372" width="48.5" height="49"/>
<constraints>
<constraint firstAttribute="width" secondItem="RHd-Xx-AyG" secondAttribute="height" multiplier="1:1" id="npW-2w-QHd"/>
</constraints>
@@ -108,31 +132,31 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="循环泵" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zRG-Xz-MbP">
<rect key="frame" x="29" y="411" width="37" height="15"/>
<rect key="frame" x="36" y="425" width="37" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="增氧泵" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dse-Ih-U5R">
<rect key="frame" x="104" y="411" width="37" height="15"/>
<rect key="frame" x="124.5" y="425" width="37" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="灯光1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="w1W-F8-kDG">
<rect key="frame" x="182" y="411" width="31" height="15"/>
<rect key="frame" x="216.5" y="425" width="31" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="灯光2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k4O-MJ-aZd">
<rect key="frame" x="256.5" y="411" width="32" height="15"/>
<rect key="frame" x="304.5" y="425" width="32" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="104" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="83l-yl-ndR">
<rect key="frame" x="30" y="451" width="35" height="35"/>
<rect key="frame" x="30" y="465" width="49" height="48.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="83l-yl-ndR" secondAttribute="height" multiplier="1:1" id="w6a-qu-5EK"/>
</constraints>
@@ -143,7 +167,7 @@
</connections>
</button>
<button opaque="NO" tag="105" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ucP-6q-kgn">
<rect key="frame" x="105" y="451" width="35" height="35"/>
<rect key="frame" x="119" y="465" width="48.5" height="48.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="ucP-6q-kgn" secondAttribute="height" multiplier="1:1" id="Vkv-7O-YZz"/>
</constraints>
@@ -154,7 +178,7 @@
</connections>
</button>
<button opaque="NO" tag="106" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wZH-6A-6dN">
<rect key="frame" x="180" y="451" width="35" height="35"/>
<rect key="frame" x="207.5" y="465" width="49" height="48.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="wZH-6A-6dN" secondAttribute="height" multiplier="1:1" id="526-Hn-VeS"/>
</constraints>
@@ -165,7 +189,7 @@
</connections>
</button>
<button opaque="NO" tag="107" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fFJ-1w-2f5">
<rect key="frame" x="255" y="451" width="35" height="35"/>
<rect key="frame" x="296.5" y="465" width="48.5" height="48.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="fFJ-1w-2f5" secondAttribute="height" multiplier="1:1" id="4jg-CV-sDI"/>
</constraints>
@@ -176,31 +200,31 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="造浪泵" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BWx-iu-nY0">
<rect key="frame" x="29" y="490" width="37" height="15"/>
<rect key="frame" x="36" y="517.5" width="37" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="杀菌灯" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OLb-WT-tQ0">
<rect key="frame" x="104" y="490" width="37" height="15"/>
<rect key="frame" x="124.5" y="517.5" width="37" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="护理灯" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7KA-Hc-54C">
<rect key="frame" x="179" y="490" width="37" height="15"/>
<rect key="frame" x="213.5" y="517.5" width="37" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="加热棒" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r24-bR-0zZ">
<rect key="frame" x="254" y="490" width="37" height="15"/>
<rect key="frame" x="302" y="517.5" width="37" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="G1c-II-WK8">
<rect key="frame" x="220" y="0.0" width="100" height="44"/>
<rect key="frame" x="275" y="0.0" width="100" height="44"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="cOL-94-UdY"/>
@@ -208,7 +232,7 @@
</constraints>
</view>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0 ℃" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="brS-3x-RcE">
<rect key="frame" x="115" y="209" width="90" height="90"/>
<rect key="frame" x="142.5" y="209" width="90" height="90"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="90" id="GQu-NL-cde"/>
@@ -240,7 +264,7 @@
<nil key="highlightedColor"/>
</label>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="设备已离线" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jp2-HW-vcX">
<rect key="frame" x="120" y="338" width="80" height="25"/>
<rect key="frame" x="147.5" y="338" width="80" height="25"/>
<color key="backgroundColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="gtN-UH-BAO"/>
@@ -254,15 +278,35 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
</label>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iCh-CK-V5y" userLabel="切换摄像头">
<rect key="frame" x="275" y="280" width="80" height="20"/>
<color key="backgroundColor" red="0.96078431369999995" green="0.66666666669999997" blue="0.73725490199999999" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="切换摄像头">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="cameraBtnClick:" destination="-1" eventType="touchUpInside" id="xg3-9Y-gT8"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="WFc-cF-80l" firstAttribute="top" secondItem="ZVe-ED-kl7" secondAttribute="top" id="0BY-oG-gcd"/>
<constraint firstItem="ASo-hi-5ge" firstAttribute="top" secondItem="EVp-Sm-Feq" secondAttribute="bottom" constant="-20" id="0bJ-eb-80r"/>
<constraint firstItem="ZVe-ED-kl7" firstAttribute="width" secondItem="94R-4Q-SUx" secondAttribute="width" id="3se-2R-nR8"/>
<constraint firstItem="vcu-MT-d6F" firstAttribute="top" secondItem="brS-3x-RcE" secondAttribute="bottom" constant="15" id="4B2-Mr-ob3"/>
<constraint firstItem="OLb-WT-tQ0" firstAttribute="top" secondItem="ucP-6q-kgn" secondAttribute="bottom" constant="4" id="4Bf-gm-YTx"/>
<constraint firstItem="pjU-4c-KIu" firstAttribute="top" secondItem="KcF-jg-Mz2" secondAttribute="bottom" constant="8" id="4U0-5n-ux5"/>
<constraint firstItem="iCh-CK-V5y" firstAttribute="width" secondItem="ASo-hi-5ge" secondAttribute="width" id="4yK-Q4-cCT"/>
<constraint firstItem="k4O-MJ-aZd" firstAttribute="top" secondItem="RHd-Xx-AyG" secondAttribute="bottom" constant="4" id="6Bg-et-4ju"/>
<constraint firstItem="iCh-CK-V5y" firstAttribute="top" secondItem="ASo-hi-5ge" secondAttribute="top" id="7mh-MV-e13"/>
<constraint firstItem="G1c-II-WK8" firstAttribute="top" secondItem="aik-7S-q8v" secondAttribute="top" id="83E-pJ-8Fg"/>
<constraint firstItem="ucP-6q-kgn" firstAttribute="top" secondItem="83l-yl-ndR" secondAttribute="top" id="9Cs-Lk-q7I"/>
<constraint firstItem="RHd-Xx-AyG" firstAttribute="width" secondItem="94R-4Q-SUx" secondAttribute="width" id="A2B-qb-Kn1"/>
@@ -277,6 +321,7 @@
<constraint firstAttribute="bottom" secondItem="BWx-iu-nY0" secondAttribute="bottom" constant="270" id="Gmu-GA-a15"/>
<constraint firstItem="fFJ-1w-2f5" firstAttribute="centerY" secondItem="wZH-6A-6dN" secondAttribute="centerY" id="HUF-tX-xdo"/>
<constraint firstItem="94R-4Q-SUx" firstAttribute="leading" secondItem="aik-7S-q8v" secondAttribute="leading" constant="30" id="Hif-9z-wed"/>
<constraint firstAttribute="trailing" secondItem="iCh-CK-V5y" secondAttribute="trailing" constant="20" id="Ijl-Sy-Qe7"/>
<constraint firstItem="OLb-WT-tQ0" firstAttribute="centerX" secondItem="ucP-6q-kgn" secondAttribute="centerX" id="LF8-uL-oh2"/>
<constraint firstItem="BWx-iu-nY0" firstAttribute="centerX" secondItem="83l-yl-ndR" secondAttribute="centerX" id="LSK-ci-U11"/>
<constraint firstItem="WFc-cF-80l" firstAttribute="width" secondItem="94R-4Q-SUx" secondAttribute="width" id="LyZ-Sb-suz"/>
@@ -312,11 +357,13 @@
<constraint firstItem="fFJ-1w-2f5" firstAttribute="width" secondItem="fFJ-1w-2f5" secondAttribute="height" multiplier="1:1" id="ns1-lf-YQG"/>
<constraint firstItem="Jp2-HW-vcX" firstAttribute="top" secondItem="vcu-MT-d6F" secondAttribute="bottom" constant="6" id="pYZ-Gz-Cgr"/>
<constraint firstItem="ucP-6q-kgn" firstAttribute="width" secondItem="ucP-6q-kgn" secondAttribute="height" multiplier="1:1" id="q0b-Ok-bD1"/>
<constraint firstItem="iCh-CK-V5y" firstAttribute="height" secondItem="ASo-hi-5ge" secondAttribute="height" id="qYH-W0-hlN"/>
<constraint firstAttribute="trailing" secondItem="fFJ-1w-2f5" secondAttribute="trailing" constant="30" id="s7v-x0-Wl5"/>
<constraint firstItem="KcF-jg-Mz2" firstAttribute="top" secondItem="aik-7S-q8v" secondAttribute="top" constant="18" id="tdu-Q3-j07"/>
<constraint firstAttribute="trailing" secondItem="G1c-II-WK8" secondAttribute="trailing" id="teN-7B-Npa"/>
<constraint firstItem="RHd-Xx-AyG" firstAttribute="centerY" secondItem="WFc-cF-80l" secondAttribute="centerY" id="tpr-qz-KT0"/>
<constraint firstItem="vcu-MT-d6F" firstAttribute="centerX" secondItem="aik-7S-q8v" secondAttribute="centerX" id="uKM-H9-GFY"/>
<constraint firstItem="ASo-hi-5ge" firstAttribute="leading" secondItem="aik-7S-q8v" secondAttribute="leading" constant="20" id="vtm-ny-RWe"/>
<constraint firstItem="ucP-6q-kgn" firstAttribute="width" secondItem="83l-yl-ndR" secondAttribute="width" id="wEN-Jf-FpP"/>
<constraint firstItem="brS-3x-RcE" firstAttribute="top" secondItem="EVp-Sm-Feq" secondAttribute="bottom" constant="-91" id="wy8-b5-lgU"/>
<constraint firstItem="wZH-6A-6dN" firstAttribute="width" secondItem="83l-yl-ndR" secondAttribute="width" id="x5W-Jy-Jg5"/>
@@ -0,0 +1,55 @@
//
// xuanduo3fModel.h
// Ifish
//
// Created by 祝发冬 on 2020/4/6.
// Copyright © 2020 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
#if 0
01
08
bcddc2450947
bcddc2450947
24 36
0101
0201
0301
0401
024e
0140
007d
01
00c8
012c
2244 crc16校验码
#endif
@interface Xuanduo3fModel : NSObject
/// 换气 -- 气泵
@property (nonatomic, strong) NSString *gasPump;
/// 灯1
@property (nonatomic, strong) NSString *light;
/// 杀菌灯
@property (nonatomic, strong) NSString *uvLamp;
/// 杀菌倒计时PH
@property (nonatomic, strong) NSString *vuPHstatus;
/// 恒温
@property (nonatomic, strong) NSString *constTmep;
///温度
@property (nonatomic, strong) NSString *temperature;
/// 加热温度
@property (nonatomic, strong) NSString *heatingTemperature;
/// 报警开关
@property (nonatomic, strong) NSString *alarmSwitch;
/// 最低温
@property (nonatomic, strong) NSString *miniTemp;
/// 最高温
@property (nonatomic, strong) NSString *maxTemp;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,13 @@
//
// xuanduo3fModel.m
// Ifish
//
// Created by on 2020/4/6.
// Copyright © 2020 lianlian. All rights reserved.
//
#import "xuanduo3fModel.h"
@implementation Xuanduo3fModel
@end
@@ -7,6 +7,7 @@
//
#import "BaseViewController.h"
#import "IfishDeviceInfo.h"
//修改设备名 及控制名 子类实现DataSource即可
typedef void (^deviceNameBlock)(NSString *);
@@ -160,7 +160,12 @@
[para setValue: cell.deviceName.text forKey:@"showName"];
if (cell.deviceName.text.length <= 6) {
[mannager POST:kUpdateDeviceUser parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString*url=kUpdateDeviceUser;
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
url=[NSString stringWithFormat:@"%@/api/user/updatePetDeviceUser.do",JIEKOUPORT];
}
[mannager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
if (responseObject) {
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
NSLog(@"result:%@",resultDic[@"result"]);
@@ -168,7 +173,7 @@
if ([resultDic[@"result"] isEqualToString:@"100"]) {
[self.view makeToast:@"修改成功"];
[[NSNotificationCenter defaultCenter]postNotificationName:@"updateUserInfobyValidation" object:nil];
NSString *strName =[NSString stringWithFormat:@"%@",cell.deviceName.text];