UI修改读取定时
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@class TimerTypeTableViewCell;
|
||||
@protocol TimerTypeTableViewCellDelegate <NSObject>
|
||||
|
||||
-(void)clickCell:(TimerTypeTableViewCell*)cell button:(UIButton*)button timerType:(NSInteger*)type;
|
||||
-(void)clickCell:(TimerTypeTableViewCell*)cell button:(UIButton*)button timerType:(NSInteger)type;
|
||||
|
||||
@end
|
||||
@interface TimerTypeTableViewCell : UITableViewCell
|
||||
|
||||
+2
-1
@@ -55,11 +55,12 @@
|
||||
xuanduoModel.waterTemperature = [dataString substringWithRange:NSMakeRange(60, 4)];
|
||||
xuanduoModel.heatingTemperature = [dataString substringWithRange:NSMakeRange(64, 4)];
|
||||
xuanduoModel.huliLight = [dataString substringWithRange:NSMakeRange(68, 2)];
|
||||
xuanduoModel.fishFeed = [dataString substringWithRange:NSMakeRange(70, 2)];
|
||||
xuanduoModel.fishFeedOrder = [dataString substringWithRange:NSMakeRange(70, 2)];
|
||||
xuanduoModel.powerRating = [dataString substringWithRange:NSMakeRange(72, 4)];
|
||||
xuanduoModel.alarmSwitch = [dataString substringWithRange:NSMakeRange(76, 2)];
|
||||
xuanduoModel.miniTemp = [dataString substringWithRange:NSMakeRange(78, 4)];
|
||||
xuanduoModel.maxTemp = [dataString substringWithRange:NSMakeRange(82, 4)];
|
||||
xuanduoModel.fishFeedStatus = [dataString substringWithRange:NSMakeRange(86, 2)];
|
||||
|
||||
}
|
||||
else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]&&[model isKindOfClass:[Xuanduo3fModel class]]&&dataString.length>67)
|
||||
|
||||
+7
-2
@@ -67,13 +67,18 @@ bfec crc16校验码
|
||||
/// 最高温
|
||||
@property (nonatomic, strong) NSString *maxTemp;
|
||||
@property (nonatomic, strong) NSString *waterLevel;//水位报警开关
|
||||
/// 一键喂鱼 4 5 f有
|
||||
@property (nonatomic, strong) NSString *fishFeed;
|
||||
/// 一键喂鱼 4 5 f有 一键喂鱼0 关,1开(背光)手机到设备
|
||||
/// 设置值 发送指令 打开或者关闭 注意发送指定和接受状态不是一个字段
|
||||
@property (nonatomic, strong) NSString *fishFeedOrder;
|
||||
/// 4 5 f有 一键喂鱼0 关,1开(湿度)设备到手机
|
||||
/// 接受值 这个值会变化,喂鱼结束则为0 开启1 只接受状态
|
||||
@property (nonatomic, strong) NSString *fishFeedStatus;
|
||||
/// 功率 4 5 f有
|
||||
@property (nonatomic, strong) NSString *powerRating;
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
self.userInteractionEnabled=YES;
|
||||
|
||||
[self.statusBtn setTitle:@"关闭" forState:UIControlStateNormal];
|
||||
[self.statusBtn setTitle:@"打开" forState:UIControlStateNormal];
|
||||
[self.statusBtn setTitle:@"打开" forState:UIControlStateSelected];
|
||||
|
||||
}
|
||||
- (void)configWithImageName:(NSString *)name labelName:(NSString *)labelName {
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AWf-ci-ZDG">
|
||||
<rect key="frame" x="310" y="0.0" width="30" height="30"/>
|
||||
<rect key="frame" x="310" y="5" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="BSn-IJ-pQK"/>
|
||||
<constraint firstAttribute="width" constant="30" id="RtE-QV-28X"/>
|
||||
@@ -51,13 +51,13 @@
|
||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="AWf-ci-ZDG" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="K05-ks-Nmu"/>
|
||||
<constraint firstItem="Y79-yA-YK5" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="Xed-ko-MEG"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="AWf-ci-ZDG" secondAttribute="trailing" constant="35" id="Y5h-qw-cMO"/>
|
||||
<constraint firstItem="Y79-yA-YK5" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" id="gST-eX-J7c"/>
|
||||
<constraint firstItem="15T-Hk-end" firstAttribute="centerY" secondItem="FHB-eh-cwx" secondAttribute="centerY" id="iKL-10-FRc"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="Y79-yA-YK5" secondAttribute="trailing" id="k1b-ga-ZxG"/>
|
||||
<constraint firstItem="FHB-eh-cwx" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="18" id="nac-Pm-Unf"/>
|
||||
<constraint firstItem="AWf-ci-ZDG" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="sAJ-cf-z7L"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="FHB-eh-cwx" secondAttribute="bottom" constant="7" id="uE5-FC-gtB"/>
|
||||
<constraint firstItem="Y79-yA-YK5" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="wNy-g6-uXh"/>
|
||||
<constraint firstItem="15T-Hk-end" firstAttribute="leading" secondItem="FHB-eh-cwx" secondAttribute="trailing" constant="4" id="ytC-rn-ftY"/>
|
||||
|
||||
+1
@@ -397,6 +397,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
return oneHeader;
|
||||
}else if(section > 1){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
|
||||
+9
-39
@@ -172,7 +172,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
[self.tableView registerNib:[UINib nibWithNibName:setTimerflag bundle:nil] forCellReuseIdentifier:setTimerflag];
|
||||
}
|
||||
|
||||
-(void)clickCell:(TimerTypeTableViewCell *)cell button:(UIButton *)button timerType:(NSInteger *)type
|
||||
-(void)clickCell:(TimerTypeTableViewCell *)cell button:(UIButton *)button timerType:(NSInteger)type
|
||||
{
|
||||
XuanduoTimerSettingViewController *_settingVC = [[XuanduoTimerSettingViewController alloc] init];
|
||||
_settingVC.currentdevice = self.currentdevice;
|
||||
@@ -416,7 +416,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
}else if (indexPath.section - 2 <_titieArr.count) {
|
||||
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section-2]];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
if (_selectSection == indexPath.section) {
|
||||
if (_selectSection == indexPath.section&&_timerType) {
|
||||
if (havePlus && indexPath.row == dataArr.count - 1) {
|
||||
return 40;
|
||||
}else{
|
||||
@@ -464,6 +464,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
return oneHeader;
|
||||
}else if(section == 2){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
@@ -473,6 +474,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
return headerView;
|
||||
}else if(section == 3){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
@@ -482,6 +484,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
return headerView;
|
||||
}else if(section == 4){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
@@ -499,6 +502,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
else
|
||||
{
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
@@ -510,6 +514,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
}else if(section == 6){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
@@ -519,6 +524,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
return headerView;
|
||||
}else if(section == 7){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.backImageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
if (_selectSection == section) {
|
||||
headerView.controlBtn.selected = YES;
|
||||
@@ -625,6 +631,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
- (void)foldAction:(UIButton *)btn {
|
||||
if (_selectSection == btn.tag - kBtnTag) {
|
||||
_selectSection = -1;
|
||||
_timerType=nil;
|
||||
[self.tableView reloadData];
|
||||
}else {
|
||||
//读取开关定时
|
||||
@@ -1612,45 +1619,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
|
||||
}
|
||||
else if (0)
|
||||
{
|
||||
if (!_timerModel) {
|
||||
_timerModel = [[Xuanduo2TimerModel alloc] init];
|
||||
_timerModel.groupModelArr = [NSMutableArray array];
|
||||
}else {
|
||||
[_timerModel.groupModelArr removeAllObjects];
|
||||
}
|
||||
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
|
||||
[dataArr removeAllObjects];
|
||||
[dataArr addObject:plusflag];
|
||||
[dataArr addObjectsFromArray:_timerModel.groupModelArr];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
if (havePlus && dataArr.count > 10) {
|
||||
[dataArr removeObjectAtIndex:0];
|
||||
}else if (!havePlus && dataArr.count < 10){
|
||||
[dataArr insertObject:plusflag atIndex:0];
|
||||
}
|
||||
NSLog(@"dataarr.count = %ld",dataArr.count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (_selectSection-2<_titieArr.count && _selectSection-2>=0 && [readTimer isEqualToString:@"0119"]) {
|
||||
|
||||
_cycleModel=[[XuanduoCycleModel alloc]init];
|
||||
[Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
|
||||
[dataArr removeAllObjects];
|
||||
|
||||
[dataArr addObject:_cycleModel];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ([readTimer isEqualToString:@"0108"] || [readTimer isEqualToString:@"0105"]) {
|
||||
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentdevice.type];
|
||||
|
||||
+2
@@ -10,6 +10,8 @@
|
||||
#import "IfishDeviceInfo.h"
|
||||
#include "xuanduo3fModel.h"
|
||||
#import "ReadTimerModel.h"
|
||||
#import "UIView+Frame.h"
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
+162
-30
@@ -348,7 +348,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
CGFloat height=0;
|
||||
height=(section==0?50:40);
|
||||
height=50;
|
||||
return height;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
height=section==0?50:40;
|
||||
UIImageView*imageView=[[UIImageView alloc]init];
|
||||
imageView.frame=CGRectMake(0, 0, self.tableView.frame.size.width, height);
|
||||
imageView.image=[UIImage imageNamed:@"ifishSetCell_back"];
|
||||
imageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.tableView.frame.size.width-20, height)];
|
||||
label.text=_titieArr[section];
|
||||
label.textColor=[UIColor blackColor];
|
||||
@@ -368,11 +368,21 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
}else if(section == 1)
|
||||
{
|
||||
CGFloat height=0;
|
||||
height=section==0?50:40;
|
||||
height=50;
|
||||
UIImageView*imageView=[[UIImageView alloc]init];
|
||||
imageView.frame=CGRectMake(0, 0, self.tableView.frame.size.width, height);
|
||||
imageView.image=[UIImage imageNamed:@"ifishSetCell_back"];
|
||||
|
||||
imageView.image=[UIImage imageNamed:@"set_cellBack"];
|
||||
UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, self.tableView.frame.size.width-20, height)];
|
||||
label.text=@"全天自恢复模式";
|
||||
label.textColor=[UIColor blackColor];
|
||||
[imageView addSubview:label];
|
||||
UIButton*swichBtn=[UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[swichBtn setBackgroundImage:[UIImage imageNamed:@"graybtn_big.png"] forState:UIControlStateNormal];
|
||||
[swichBtn setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateSelected];
|
||||
[swichBtn addTarget:self action:@selector(allDayModesSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
swichBtn.frame=CGRectMake(CGRectGetWidth(imageView.frame)-8-60, (CGRectGetHeight(imageView.frame)-33)/2.0, 60, 33);
|
||||
[imageView addSubview:swichBtn];
|
||||
imageView.userInteractionEnabled=YES;
|
||||
|
||||
return imageView;
|
||||
}
|
||||
@@ -621,6 +631,85 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
|
||||
|
||||
if ([_cycleModel.status isEqualToString:@"01"]) {
|
||||
_cycleModel.status = @"00";
|
||||
}else {
|
||||
_cycleModel.status = @"01";
|
||||
}
|
||||
|
||||
|
||||
NSString*minString=[NSString stringWithFormat:@"%@%@%@%@%@%@",tempModel.description,_cycleModel.lightNumber,_cycleModel.lastTime,_cycleModel.gapTime,_cycleModel.status,@"0000"];
|
||||
|
||||
NSData*tempData=[dataContorl stringToHexData:minString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:tempData];
|
||||
|
||||
|
||||
|
||||
baseModel*readModel=[[baseModel alloc]init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId =self.currentdevice.macAddress;
|
||||
readModel.functionCode=@"19";
|
||||
readModel.massagelegth=@"12";
|
||||
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@%@%@%@",readModel.description,_cycleModel.lightNumber,@"0000"];
|
||||
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
}
|
||||
|
||||
}
|
||||
- (void)allDayModesSwitchAction:(UIButton *)btn {
|
||||
|
||||
btn.selected=!btn.selected;
|
||||
return;
|
||||
NSInteger index = btn.tag - kSwitchBtnTag;
|
||||
|
||||
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
|
||||
timerModel.sendmacId =self.currentdevice.macAddress;
|
||||
timerModel.resavemacId = self.currentdevice.macAddress;
|
||||
timerModel.crc16str=@"0000";
|
||||
XuanduoTimerGroup *group = [dataArr objectAtIndex:(havePlus?index+1:index)];
|
||||
if ([group isKindOfClass: [XuanduoTimerGroup class] ]) {
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:group.startTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:group.endTime];
|
||||
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2];
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];
|
||||
if ([group.status isEqualToString:@"01"]) {
|
||||
timerModel.isOn = @"00";
|
||||
}else {
|
||||
timerModel.isOn = @"01";
|
||||
}
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
readModel.selectorNumber=@"";
|
||||
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str];
|
||||
|
||||
NSData*selctorData=[dataContorl stringToHexData:selectorString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:selctorData];
|
||||
// [_indicatorView startAnimating];
|
||||
|
||||
readModel.selectorNumber = timerModel.selectorNumber;
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSLog(@"read str = %@",readString);
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
;
|
||||
}
|
||||
else if ([group isKindOfClass: [XuanduoCycleModel class] ])
|
||||
{
|
||||
baseModel*tempModel=[[baseModel alloc]init];
|
||||
tempModel.sendmacId =self.currentdevice.macAddress;
|
||||
tempModel.resavemacId =self.currentdevice.macAddress;
|
||||
tempModel.functionCode=@"18";
|
||||
tempModel.massagelegth=@"17";
|
||||
|
||||
|
||||
|
||||
if ([_cycleModel.status isEqualToString:@"01"]) {
|
||||
_cycleModel.status = @"00";
|
||||
}else {
|
||||
@@ -1442,27 +1531,64 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
NSString*string1=[dataContorl dataToHexString:data];
|
||||
NSLog(@"return str == %@",string1);
|
||||
NSString *readTimer = [string1 substringToIndex:4];
|
||||
if ([readTimer isEqualToString:@"0116"]) {
|
||||
if (!_timerModel) {
|
||||
_timerModel = [[Xuanduo2TimerModel alloc] init];
|
||||
_timerModel.groupModelArr = [NSMutableArray array];
|
||||
}else {
|
||||
[_timerModel.groupModelArr removeAllObjects];
|
||||
if ([readTimer isEqualToString:@"0116"])
|
||||
{
|
||||
NSString*lightNumber=[string1 substringWithRange:NSMakeRange(30, 2)];
|
||||
if (self.timerType==1&&[lightNumber containsString:@"0"])//定时
|
||||
{
|
||||
if (!_timerModel) {
|
||||
_timerModel = [[Xuanduo2TimerModel alloc] init];
|
||||
_timerModel.groupModelArr = [NSMutableArray array];
|
||||
}else {
|
||||
[_timerModel.groupModelArr removeAllObjects];
|
||||
}
|
||||
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
|
||||
[dataArr removeAllObjects];
|
||||
[dataArr addObject:plusflag];
|
||||
[dataArr addObjectsFromArray:_timerModel.groupModelArr];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
if (havePlus && dataArr.count > 10) {
|
||||
[dataArr removeObjectAtIndex:0];
|
||||
}else if (!havePlus && dataArr.count < 10){
|
||||
[dataArr insertObject:plusflag atIndex:0];
|
||||
}
|
||||
NSLog(@"dataarr.count = %ld",dataArr.count);
|
||||
|
||||
|
||||
}
|
||||
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
|
||||
[dataArr removeAllObjects];
|
||||
[dataArr addObject:plusflag];
|
||||
[dataArr addObjectsFromArray:_timerModel.groupModelArr];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
if (havePlus && dataArr.count > 10) {
|
||||
[dataArr removeObjectAtIndex:0];
|
||||
}else if (!havePlus && dataArr.count < 10){
|
||||
[dataArr insertObject:plusflag atIndex:0];
|
||||
else if (self.timerType==2&&[lightNumber containsString:@"e"])//循环
|
||||
{
|
||||
_cycleModel=[[XuanduoCycleModel alloc]init];
|
||||
[Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
|
||||
[dataArr removeAllObjects];
|
||||
|
||||
[dataArr addObject:_cycleModel];
|
||||
}
|
||||
else if (self.timerType==3&&[lightNumber containsString:@"d"])//自恢复
|
||||
{
|
||||
if (!_timerModel) {
|
||||
_timerModel = [[Xuanduo2TimerModel alloc] init];
|
||||
_timerModel.groupModelArr = [NSMutableArray array];
|
||||
}else {
|
||||
[_timerModel.groupModelArr removeAllObjects];
|
||||
}
|
||||
[Xuanduo2DataUtility readTimerSocketDataWithBackMsgModel:_timerModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
|
||||
[dataArr removeAllObjects];
|
||||
[dataArr addObject:plusflag];
|
||||
[dataArr addObjectsFromArray:_timerModel.groupModelArr];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
if (havePlus && dataArr.count > 10) {
|
||||
[dataArr removeObjectAtIndex:0];
|
||||
}else if (!havePlus && dataArr.count < 10){
|
||||
[dataArr insertObject:plusflag atIndex:0];
|
||||
}
|
||||
NSLog(@"dataarr.count = %ld",dataArr.count);
|
||||
|
||||
|
||||
}
|
||||
NSLog(@"dataarr.count = %ld",dataArr.count);
|
||||
|
||||
|
||||
}
|
||||
else if (_selectSection<_titieArr.count && _selectSection>=0 && [readTimer isEqualToString:@"0119"]) {
|
||||
|
||||
@@ -1491,19 +1617,25 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
}
|
||||
|
||||
-(void)ifishDeviceLogInSuccees{
|
||||
|
||||
//读取具体开关定时
|
||||
ReadTimerModel*readModel=self.readMode;
|
||||
readModel.functionCode=@"16";
|
||||
if (readModel) {
|
||||
if (self.timerType==1)
|
||||
if (self.timerType==1)//灯编为原始
|
||||
{
|
||||
readModel.functionCode=@"16";
|
||||
|
||||
readModel.selectorNumber=[readModel.selectorNumber stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@"0"];
|
||||
}
|
||||
else if (self.timerType==2)
|
||||
else if (self.timerType==2)//灯编号为e
|
||||
{
|
||||
readModel.functionCode=@"19";
|
||||
|
||||
readModel.selectorNumber=[readModel.selectorNumber stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@"e"];
|
||||
}
|
||||
else if (self.timerType==3)
|
||||
else if (self.timerType==3)//灯编号为d
|
||||
{
|
||||
readModel.functionCode=@"15";
|
||||
|
||||
readModel.selectorNumber=[readModel.selectorNumber stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@"d"];
|
||||
}
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
|
||||
|
||||
+6
-66
@@ -440,7 +440,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
UIView *oneHeader = [[UIView alloc] init];
|
||||
oneHeader.backgroundColor = COLOR_MIAN;
|
||||
return oneHeader;
|
||||
}else if(section == 2){
|
||||
}else if(section > 1){
|
||||
XuanduoSelectHeader *headerView = [XuanduoSelectHeader shareHeaderView];
|
||||
headerView.controlBtn.tag = kBtnTag + section;
|
||||
headerView.statusBtn.tag = kBtnTag + section;
|
||||
@@ -455,61 +455,6 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
[headerView.controlBtn addTarget:self action:@selector(statusChangeAction:) 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;
|
||||
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 == 4){
|
||||
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 == 5){
|
||||
if ([self.currentdevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
UIView *oneHeader = [[UIView alloc] init];
|
||||
oneHeader.backgroundColor = COLOR_MIAN;
|
||||
return oneHeader;
|
||||
}
|
||||
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;
|
||||
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 == 7){
|
||||
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;
|
||||
}
|
||||
|
||||
return nil;
|
||||
@@ -606,11 +551,9 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
}
|
||||
|
||||
#pragma mark - cell的折叠
|
||||
//添加或者去除一键喂鱼的关联
|
||||
- (void)foldAction:(UIButton *)btn {
|
||||
if (_selectSection == btn.tag - kBtnTag) {
|
||||
_selectSection = -1;
|
||||
[self.tableView reloadData];
|
||||
}else {
|
||||
|
||||
_selectSection = btn.tag - kBtnTag;
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
//杀菌不定时
|
||||
@@ -665,15 +608,12 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
self.readMode=readModel;
|
||||
[_indicatorView startAnimating];
|
||||
}
|
||||
|
||||
}
|
||||
//改变一键喂鱼的开关状态
|
||||
-(void)statusChangeAction:(UIButton*)btn
|
||||
{
|
||||
if (_selectSection == btn.tag - kBtnTag) {
|
||||
_selectSection = -1;
|
||||
[self.tableView reloadData];
|
||||
}else {
|
||||
|
||||
_selectSection = btn.tag - kBtnTag;
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
//杀菌不定时
|
||||
@@ -728,7 +668,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
self.readMode=readModel;
|
||||
[_indicatorView startAnimating];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)switchAction:(UIButton *)btn {
|
||||
|
||||
Reference in New Issue
Block a user