循环定时器
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// CycleTimerCell.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by 祝发冬 on 2022/5/15.
|
||||
// Copyright © 2022 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CycleTimerCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *openTilmeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *closeTimeLabel;
|
||||
@property (nonatomic,weak) id model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// CycleTimerCell.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by 祝发冬 on 2022/5/15.
|
||||
// Copyright © 2022 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "CycleTimerCell.h"
|
||||
|
||||
@implementation CycleTimerCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<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>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="CycleTimerCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="开启00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V4x-oE-ip3">
|
||||
<rect key="frame" x="5" y="12" width="120" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="GHD-eN-JDA"/>
|
||||
<constraint firstAttribute="width" constant="120" id="ej1-m4-KJE"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.34901960780000002" green="0.34901960780000002" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="关闭00:00:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xa5-yA-Py3">
|
||||
<rect key="frame" x="195" y="12" width="120" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="120" id="baf-Mm-MPz"/>
|
||||
<constraint firstAttribute="height" constant="20" id="jHz-du-9rA"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.34901960780000002" green="0.34901960780000002" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="V4x-oE-ip3" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="1Qt-gz-Pid"/>
|
||||
<constraint firstItem="V4x-oE-ip3" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="5" id="b8c-bF-gws"/>
|
||||
<constraint firstAttribute="trailing" secondItem="xa5-yA-Py3" secondAttribute="trailing" constant="5" id="hSU-AU-WOF"/>
|
||||
<constraint firstItem="xa5-yA-Py3" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="uTU-0b-0nR"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="closeTimeLabel" destination="xa5-yA-Py3" id="ZmC-St-v4q"/>
|
||||
<outlet property="openTilmeLabel" destination="V4x-oE-ip3" id="Lul-LQ-8N8"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="64"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+13
-4
@@ -245,11 +245,20 @@
|
||||
|
||||
{
|
||||
xuanduocycleModel.lightNumber = [dataStr substringWithRange:NSMakeRange(30, 2)];
|
||||
xuanduocycleModel.lastTime = [dataStr substringWithRange:NSMakeRange(32, 4)];
|
||||
xuanduocycleModel.gapTime = [dataStr substringWithRange:NSMakeRange(36, 4)];
|
||||
xuanduocycleModel.status = [dataStr substringWithRange:NSMakeRange(40, 2)];
|
||||
if([type isEqualToString:DECICE_TYPE_XUANDUO5F]||[type isEqualToString:DECICE_TYPE_XUANDUO4F])
|
||||
{
|
||||
//时分秒打开关闭 各6字节
|
||||
xuanduocycleModel.openTime = [dataStr substringWithRange:NSMakeRange(32, 6)];
|
||||
xuanduocycleModel.closeTime = [dataStr substringWithRange:NSMakeRange(38, 6)];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
xuanduocycleModel.lastTime = [dataStr substringWithRange:NSMakeRange(32, 4)];
|
||||
xuanduocycleModel.gapTime = [dataStr substringWithRange:NSMakeRange(36, 4)];
|
||||
xuanduocycleModel.status = [dataStr substringWithRange:NSMakeRange(40, 2)];
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
+1
-1
@@ -768,7 +768,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
|
||||
- (void)addTimer:(UIButton *)btn {
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
_mydatepicView.isNewXuanduo = YES;
|
||||
_mydatepicView.pickerType = @"xuanduo";;
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
+7
@@ -52,6 +52,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, strong) NSString *lastTime;
|
||||
@property (nonatomic, strong) NSString *gapTime;
|
||||
@property (nonatomic, strong) NSString *status;
|
||||
//设备类型新增
|
||||
@property (nonatomic, strong) NSString *deviceType;
|
||||
//打开持续时间 时分秒 6字节
|
||||
@property (nonatomic, strong) NSString *openTime;
|
||||
//关闭持续时间 时分秒 6字节
|
||||
@property (nonatomic, strong) NSString *closeTime;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+16
-1
@@ -29,6 +29,7 @@
|
||||
#import "NSString+Add.h"
|
||||
#import "XuToControlName.h"
|
||||
#import "UserExtendataArchaver.h"
|
||||
#import "XuanduoTempratueCorrectViewController.h"
|
||||
#import "XuanduoTimerListViewController.h"
|
||||
|
||||
#define kBtnTag 500
|
||||
@@ -540,6 +541,20 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
_settingVC.dataModel = self.dataModel;
|
||||
[self.navigationController pushViewController:_settingVC animated:YES];
|
||||
}
|
||||
else if (current==2)
|
||||
{
|
||||
XuanduoTempratueCorrectViewController *_settingVC = [[XuanduoTempratueCorrectViewController alloc] init];
|
||||
_settingVC.currentdevice = self.currentdevice;
|
||||
_settingVC.dataModel = self.dataModel;
|
||||
[self.navigationController pushViewController:_settingVC animated:YES];
|
||||
}
|
||||
else if (current==3)
|
||||
{
|
||||
XuanduofishFeedViewController *_settingVC = [[XuanduofishFeedViewController alloc] init];
|
||||
_settingVC.currentdevice = self.currentdevice;
|
||||
_settingVC.dataModel = self.dataModel;
|
||||
[self.navigationController pushViewController:_settingVC animated:YES];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -672,7 +687,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||
|
||||
- (void)addTimer:(UIButton *)btn {
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
_mydatepicView.isNewXuanduo = YES;
|
||||
_mydatepicView.pickerType = @"xuanduo";
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Xuanduo2SettingController.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by Alex on 2019/4/28.
|
||||
// Copyright © 2019 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FatherController.h"
|
||||
#import "IfishDeviceInfo.h"
|
||||
#import "xuanduo3fModel.h"
|
||||
#import "ReadTimerModel.h"
|
||||
#import "XuanduoTimerSettingViewController.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class Xuanduo2Model;
|
||||
|
||||
@interface XuanduoTempratueCorrectViewController : FatherController
|
||||
|
||||
@property (nonatomic,strong) UIActivityIndicatorView*indicatorView;
|
||||
@property (nonatomic ,strong) id dataModel;
|
||||
@property(nonatomic,strong) DeviceModel* currentdevice;
|
||||
@property (nonatomic, strong) ReadTimerModel *readMode;
|
||||
- (void)refreshWithData:(id)model;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+1626
File diff suppressed because it is too large
Load Diff
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// XuanduoTempratureCorrectView.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by 祝发冬 on 2022/5/14.
|
||||
// Copyright © 2022 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XuanduoTempratureCorrectView : UIView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// XuanduoTempratureCorrectView.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by 祝发冬 on 2022/5/14.
|
||||
// Copyright © 2022 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XuanduoTempratureCorrectView.h"
|
||||
|
||||
@implementation XuanduoTempratureCorrectView
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="2c8-dl-t76" customClass="XuanduoTempratureCorrectView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<viewLayoutGuide key="safeArea" id="DJa-9i-S0t"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="-1291" y="-88"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
+1
-1
@@ -806,7 +806,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
- (void)addTimer:(UIButton *)btn {
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
_mydatepicView.isNewXuanduo = YES;
|
||||
_mydatepicView.pickerType = @"xuanduo";;
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
+378
-189
@@ -29,6 +29,7 @@
|
||||
#import "XuToControlName.h"
|
||||
#import "UserExtendataArchaver.h"
|
||||
#import "TimerTypeTableViewCell.h"
|
||||
#import "CycleTimerCell.h"
|
||||
|
||||
#define kBtnTag 500
|
||||
#define kSwitchBtnTag 600
|
||||
@@ -38,6 +39,7 @@ static NSString *addCellid = @"PlusTableViewCell";
|
||||
static NSString *plusflag = @"plusCell";
|
||||
static NSString *setTimerflag = @"SetTimerCell";
|
||||
static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
static NSString *cycleTimerflag = @"CycleTimerCell";
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +141,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
|
||||
_selectSection = 0;
|
||||
if (self.timerType==1||self.timerType==3)
|
||||
if (self.timerType==1||self.timerType==3||self.timerType==2)
|
||||
{
|
||||
for (int i = 0; i<_titieArr.count; i++) {
|
||||
NSMutableArray *dataArr = [NSMutableArray arrayWithCapacity:0];
|
||||
@@ -155,11 +157,11 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
[self.tableView registerNib:[UINib nibWithNibName:temperatureCellid bundle:nil] forCellReuseIdentifier:temperatureCellid];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:changeWaterCellid bundle:nil] forCellReuseIdentifier:changeWaterCellid];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:addCellid bundle:nil] forCellReuseIdentifier:addCellid];
|
||||
//[self.tableView registerNib:[UINib nibWithNibName:timerTypeFlag bundle:nil] forCellReuseIdentifier:timerTypeFlag];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:cycleTimerflag bundle:nil] forCellReuseIdentifier:cycleTimerflag];
|
||||
[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
|
||||
{
|
||||
|
||||
}
|
||||
@@ -242,41 +244,24 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
else if (self.timerType==2) {//循环开关
|
||||
NSArray *dataArr = [self.timeDic objectForKey:_titieArr[indexPath.section]];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
if (havePlus && (indexPath.row == dataArr.count-1)) {
|
||||
PlusTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:addCellid forIndexPath:indexPath];
|
||||
cell.addTimerBtn.tag = kBtnTag + indexPath.section;
|
||||
[cell.addTimerBtn addTarget:self action:@selector(addTimer:) forControlEvents:UIControlEventTouchUpInside];
|
||||
return cell;
|
||||
|
||||
}else {
|
||||
SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath];
|
||||
cell.switchBtn.tag = kSwitchBtnTag + indexPath.row;
|
||||
[cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row];
|
||||
cell.model=group;
|
||||
if ([group isKindOfClass:[XuanduoTimerGroup class]])
|
||||
{
|
||||
CycleTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath];
|
||||
|
||||
|
||||
cell.model=_cycleModel;
|
||||
if([_cycleModel isKindOfClass:[XuanduoCycleModel class]])
|
||||
{
|
||||
BOOL isOn = NO;
|
||||
if ([group.status isEqualToString:@"01"]) {
|
||||
isOn = YES;
|
||||
}
|
||||
[cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn];
|
||||
|
||||
cell.openTilmeLabel.text=[dataContorl hexStringToDateString:_cycleModel.openTime];
|
||||
cell.closeTimeLabel.text=[dataContorl hexStringToDateString:_cycleModel.closeTime];
|
||||
|
||||
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
}
|
||||
else if([group isKindOfClass:[XuanduoCycleModel class]])
|
||||
else
|
||||
{
|
||||
XuanduoCycleModel*model=group;
|
||||
BOOL isOn = NO;
|
||||
if ([model.status isEqualToString:@"00"]) {
|
||||
isOn = YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
@@ -291,35 +276,19 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
return cell;
|
||||
|
||||
}else {
|
||||
SetTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:setTimerflag forIndexPath:indexPath];
|
||||
cell.switchBtn.tag = kSwitchBtnTag + indexPath.row;
|
||||
[cell.switchBtn addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
XuanduoTimerGroup *group = [dataArr objectAtIndex:havePlus?indexPath.row+1:indexPath.row];
|
||||
cell.model=group;
|
||||
if ([group isKindOfClass:[XuanduoTimerGroup class]])
|
||||
CycleTimerCell *cell = [tableView dequeueReusableCellWithIdentifier:cycleTimerflag forIndexPath:indexPath];
|
||||
|
||||
|
||||
cell.model=_cycleModel;
|
||||
if (_cycleModel)
|
||||
{
|
||||
BOOL isOn = NO;
|
||||
if ([group.status isEqualToString:@"01"]) {
|
||||
isOn = YES;
|
||||
}
|
||||
[cell configTitleLabel:[NSString stringWithFormat:@"时段%@",group.groupNumber] timer:group.time switchStatus:isOn];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
}
|
||||
else if([group isKindOfClass:[XuanduoCycleModel class]])
|
||||
{
|
||||
XuanduoCycleModel*model=group;
|
||||
BOOL isOn = NO;
|
||||
if ([model.status isEqualToString:@"00"]) {
|
||||
isOn = YES;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长%d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn];
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:_cycleModel.openTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:_cycleModel.closeTime];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
@@ -410,7 +379,8 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
_indexPath = indexPath;
|
||||
{
|
||||
if(self.timerType==1||self.timerType==3)
|
||||
{
|
||||
SetTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
if ([cell isKindOfClass:[PlusTableViewCell class]]) {
|
||||
return;
|
||||
@@ -433,6 +403,22 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
}
|
||||
}
|
||||
else if(self.timerType==2)
|
||||
{
|
||||
CycleTimerCell *cell = [self.tableView cellForRowAtIndexPath:_indexPath];
|
||||
if ([cell isKindOfClass:[PlusTableViewCell class]]) {
|
||||
return;
|
||||
}
|
||||
else if([cell isKindOfClass:[CycleTimerCell class]]&&[cell.model isKindOfClass:[XuanduoCycleModel class]])
|
||||
{
|
||||
[self addCycleTimer:nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)temperatureMainQueue{
|
||||
@@ -740,7 +726,21 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
- (void)addTimer:(UIButton *)btn {
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
_mydatepicView.isNewXuanduo = YES;
|
||||
_mydatepicView.pickerType = @"xuanduo";
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
if (!btn) {
|
||||
_mydatepicView.haveDelected = YES;
|
||||
[self resetPickerView];
|
||||
}
|
||||
// 设置pickerView 默认选择行
|
||||
|
||||
[self.view.window addSubview:_mydatepicView];
|
||||
}
|
||||
- (void)addCycleTimer:(UIButton *)btn {
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
_mydatepicView.pickerType = @"cycleType";
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
@@ -753,18 +753,29 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
[self.view.window addSubview:_mydatepicView];
|
||||
}
|
||||
|
||||
|
||||
- (void)resetPickerView {
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
|
||||
BOOL havePlus = [dataArr containsObject:plusflag];
|
||||
NSArray *startArr ;
|
||||
NSArray *endArr;
|
||||
XuanduoTimerGroup *model = nil;
|
||||
if (havePlus) {
|
||||
model = dataArr[_indexPath.row + 1];
|
||||
}else {
|
||||
model = dataArr[_indexPath.row];
|
||||
if ([_mydatepicView.pickerType isEqualToString:@"cycleType"])
|
||||
{
|
||||
|
||||
}
|
||||
NSArray *startArr = [model.startTime componentsSeparatedByString:@":"];
|
||||
NSArray *endArr = [model.endTime componentsSeparatedByString:@":"];
|
||||
NSLog(@"stat %@ end %@",startArr,endArr);
|
||||
else
|
||||
{
|
||||
if (havePlus) {
|
||||
model = dataArr[_indexPath.row + 1];
|
||||
}else {
|
||||
model = dataArr[_indexPath.row];
|
||||
}
|
||||
startArr = [model.startTime componentsSeparatedByString:@":"];
|
||||
endArr = [model.endTime componentsSeparatedByString:@":"];
|
||||
NSLog(@"stat %@ end %@",startArr,endArr);
|
||||
}
|
||||
|
||||
if (startArr.count == 2 && endArr.count == 2) {
|
||||
NSInteger row1 = [[_mydatepicView.dataArr objectAtIndex:0] indexOfObject:startArr[0]];
|
||||
if (row1==NSNotFound)
|
||||
@@ -800,133 +811,311 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
_mydatepicView.endString1 = endArr[1];
|
||||
|
||||
}
|
||||
else if (startArr.count == 3 && endArr.count == 3) {
|
||||
NSInteger row1 = [[_mydatepicView.dataArr objectAtIndex:0] indexOfObject:startArr[0]];
|
||||
if (row1==NSNotFound)
|
||||
{
|
||||
row1=0;
|
||||
}
|
||||
[_mydatepicView.picView selectRow:row1 inComponent:0 animated:NO];
|
||||
NSInteger row2 = [[_mydatepicView.dataArr objectAtIndex:1] indexOfObject:startArr[1]];
|
||||
if (row2==NSNotFound)
|
||||
{
|
||||
row2=0;
|
||||
}
|
||||
|
||||
[_mydatepicView.picView selectRow:row2 inComponent:1 animated:NO];
|
||||
NSInteger row3 = [[_mydatepicView.dataArr objectAtIndex:2] indexOfObject:startArr[2]];
|
||||
if (row3==NSNotFound)
|
||||
{
|
||||
row3=0;
|
||||
}
|
||||
|
||||
[_mydatepicView.picView selectRow:row3 inComponent:2 animated:NO];
|
||||
NSInteger row4 = [[_mydatepicView.dataArr objectAtIndex:3] indexOfObject:endArr[0]];
|
||||
if (row4==NSNotFound)
|
||||
{
|
||||
row4=0;
|
||||
}
|
||||
[_mydatepicView.picView selectRow:row4 inComponent:3 animated:NO];
|
||||
NSInteger row5 = [[_mydatepicView.dataArr objectAtIndex:3] indexOfObject:endArr[1]];
|
||||
if (row5==NSNotFound)
|
||||
{
|
||||
row5=0;
|
||||
}
|
||||
[_mydatepicView.picView selectRow:row5 inComponent:4 animated:NO];
|
||||
NSInteger row6 = [[_mydatepicView.dataArr objectAtIndex:3] indexOfObject:endArr[2]];
|
||||
if (row6==NSNotFound)
|
||||
{
|
||||
row6=0;
|
||||
}
|
||||
[_mydatepicView.picView selectRow:row6 inComponent:5 animated:NO];
|
||||
|
||||
|
||||
_mydatepicView.startString = startArr[0];
|
||||
_mydatepicView.endString = startArr[1];
|
||||
_mydatepicView.startSecondString = startArr[2];
|
||||
_mydatepicView.startString1 = endArr[0];
|
||||
_mydatepicView.endString1 = endArr[1];
|
||||
_mydatepicView.endSecondString = endArr[2];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -- 设置时间段 --
|
||||
-(void)doneButtonClick{
|
||||
NSLog(@"点击了加号");
|
||||
// 需要判断之前的时间段是否重叠
|
||||
NSString *startTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString,_mydatepicView.endString];
|
||||
NSString *endTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString1,_mydatepicView.endString1];
|
||||
_mydatepicView.resultString=nil;
|
||||
if([startTime isEqualToString:endTime]){
|
||||
[self showTitle:@"" messsage:@"开始时间不能等于结束时间"];
|
||||
return;
|
||||
}else if (![self isValidTimer:startTime withEndTime:endTime] && !_mydatepicView.haveDelected){
|
||||
[self showTitle:@"" messsage:@"添加的时间段与之前的重叠"];
|
||||
return;
|
||||
}else{
|
||||
_mydatepicView.resultString=[NSString stringWithFormat:@"%@~%@",startTime,endTime];
|
||||
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:startTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:endTime];
|
||||
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
|
||||
timerModel.sendmacId =self.currentdevice.macAddress;
|
||||
timerModel.resavemacId = self.currentdevice.macAddress;
|
||||
timerModel.crc16str=@"0000";
|
||||
timerModel.isOn = @"01";
|
||||
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2];
|
||||
[_mydatepicView removeFromSuperview];
|
||||
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
NSInteger index = _selectSection ;
|
||||
if (index < _titieArr.count) {
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]];
|
||||
NSInteger groupNumber = 1;
|
||||
for (int i = 0 ; i < dataArr.count; i++) {
|
||||
if ([dataArr[i] isKindOfClass:[XuanduoTimerGroup class]] &&
|
||||
((XuanduoTimerGroup *)dataArr[i]).groupNumber.integerValue == groupNumber) {
|
||||
groupNumber++;
|
||||
}
|
||||
}
|
||||
NSLog(@"indexgroup = %d",groupNumber);
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:groupNumber];
|
||||
XuanduoTimerGroup *group;
|
||||
BOOL havePlus = NO;
|
||||
if (_mydatepicView.haveDelected) {
|
||||
havePlus = [dataArr containsObject:plusflag];
|
||||
group = [dataArr objectAtIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];;
|
||||
NSLog(@"realgroup = %ld",group.groupNumber.integerValue);
|
||||
timerModel.isOn = group.status;
|
||||
[dataArr removeObject:group];
|
||||
if (![self isValidTimer:startTime withEndTime:endTime]) {
|
||||
[self showTitle:@"" messsage:@"添加的时间段与之前的重叠"];
|
||||
[dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
return;
|
||||
}else {
|
||||
[dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
}
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
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
|
||||
{
|
||||
timerModel.selectorNumber = @"03";
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
timerModel.selectorNumber = @"06";
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
timerModel.selectorNumber = @"05";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
NSString*selectorString=[NSString stringWithFormat:@"%@%@%@%@%@%@",timerModel.description,timerModel.selectorNumber,timerModel.groupNumber,timerModel.isOn,timerModel.selectorTime,timerModel.crc16str];
|
||||
-(void)doneButtonClick
|
||||
{
|
||||
if ([_mydatepicView.pickerType isEqualToString:@"xuanduo"])
|
||||
{
|
||||
NSLog(@"点击了加号");
|
||||
// 需要判断之前的时间段是否重叠
|
||||
NSString *startTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString,_mydatepicView.endString];
|
||||
NSString *endTime = [NSString stringWithFormat:@"%@:%@",_mydatepicView.startString1,_mydatepicView.endString1];
|
||||
_mydatepicView.resultString=nil;
|
||||
if([startTime isEqualToString:endTime]){
|
||||
[self showTitle:@"" messsage:@"开始时间不能等于结束时间"];
|
||||
return;
|
||||
}else if (![self isValidTimer:startTime withEndTime:endTime] && !_mydatepicView.haveDelected){
|
||||
[self showTitle:@"" messsage:@"添加的时间段与之前的重叠"];
|
||||
return;
|
||||
}else{
|
||||
_mydatepicView.resultString=[NSString stringWithFormat:@"%@~%@",startTime,endTime];
|
||||
|
||||
NSData*selctorData=[dataContorl stringToHexData:selectorString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:selctorData];
|
||||
[_indicatorView startAnimating];
|
||||
NSLog(@"hexString%@",selectorString);
|
||||
NSLog(@"result%@",_mydatepicView.resultString);
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:startTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:endTime];
|
||||
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
|
||||
timerModel.sendmacId =self.currentdevice.macAddress;
|
||||
timerModel.resavemacId = self.currentdevice.macAddress;
|
||||
timerModel.crc16str=@"0000";
|
||||
timerModel.isOn = @"01";
|
||||
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2];
|
||||
[_mydatepicView removeFromSuperview];
|
||||
|
||||
readModel.selectorNumber = timerModel.selectorNumber;
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
[_indicatorView startAnimating];
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
NSInteger index = _selectSection ;
|
||||
if (index < _titieArr.count) {
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]];
|
||||
NSInteger groupNumber = 1;
|
||||
for (int i = 0 ; i < dataArr.count; i++) {
|
||||
if ([dataArr[i] isKindOfClass:[XuanduoTimerGroup class]] &&
|
||||
((XuanduoTimerGroup *)dataArr[i]).groupNumber.integerValue == groupNumber) {
|
||||
groupNumber++;
|
||||
}
|
||||
}
|
||||
NSLog(@"indexgroup = %d",groupNumber);
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:groupNumber];
|
||||
XuanduoTimerGroup *group;
|
||||
BOOL havePlus = NO;
|
||||
if (_mydatepicView.haveDelected) {
|
||||
havePlus = [dataArr containsObject:plusflag];
|
||||
group = [dataArr objectAtIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];;
|
||||
NSLog(@"realgroup = %ld",group.groupNumber.integerValue);
|
||||
timerModel.isOn = group.status;
|
||||
[dataArr removeObject:group];
|
||||
if (![self isValidTimer:startTime withEndTime:endTime]) {
|
||||
[self showTitle:@"" messsage:@"添加的时间段与之前的重叠"];
|
||||
[dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
return;
|
||||
}else {
|
||||
[dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
}
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
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
|
||||
{
|
||||
timerModel.selectorNumber = @"03";
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
timerModel.selectorNumber = @"06";
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
timerModel.selectorNumber = @"05";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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];
|
||||
NSLog(@"hexString%@",selectorString);
|
||||
NSLog(@"result%@",_mydatepicView.resultString);
|
||||
|
||||
readModel.selectorNumber = timerModel.selectorNumber;
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
[_indicatorView startAnimating];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([_mydatepicView.pickerType isEqualToString:@"cyccleType"])
|
||||
{
|
||||
NSLog(@"点击了加号");
|
||||
// 需要判断之前的时间段是否重叠
|
||||
NSString *startTime = [NSString stringWithFormat:@"%@:%@:%@",_mydatepicView.startString,_mydatepicView.endString,_mydatepicView.startSecondString];
|
||||
NSString *endTime = [NSString stringWithFormat:@"%@:%@:%@",_mydatepicView.startString1,_mydatepicView.endString1,_mydatepicView.endSecondString];
|
||||
_mydatepicView.resultString=nil;
|
||||
if([startTime isEqualToString:endTime]){
|
||||
[self showTitle:@"" messsage:@"开始时间不能等于结束时间"];
|
||||
return;
|
||||
}else{
|
||||
_mydatepicView.resultString=[NSString stringWithFormat:@"%@~%@",startTime,endTime];
|
||||
|
||||
NSString*hexDateString1=[dataContorl dateStringToHexString:startTime];
|
||||
NSString*hexDateString2=[dataContorl dateStringToHexString:endTime];
|
||||
SetTimerModel *timerModel = [[SetTimerModel alloc] init];
|
||||
timerModel.sendmacId =self.currentdevice.macAddress;
|
||||
timerModel.resavemacId = self.currentdevice.macAddress;
|
||||
timerModel.crc16str=@"0000";
|
||||
timerModel.isOn = @"01";
|
||||
timerModel.selectorTime=[NSString stringWithFormat:@"%@%@",hexDateString1,hexDateString2];
|
||||
[_mydatepicView removeFromSuperview];
|
||||
|
||||
|
||||
ReadTimerModel *readModel = [[ReadTimerModel alloc] init];
|
||||
readModel.sendmacId =self.currentdevice.macAddress;
|
||||
readModel.resavemacId = self.currentdevice.macAddress;
|
||||
readModel.crc16str=@"0000";
|
||||
NSInteger index = _selectSection ;
|
||||
if (index < _titieArr.count) {
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[index]];
|
||||
NSInteger groupNumber = 1;
|
||||
for (int i = 0 ; i < dataArr.count; i++) {
|
||||
if ([dataArr[i] isKindOfClass:[XuanduoTimerGroup class]] &&
|
||||
((XuanduoTimerGroup *)dataArr[i]).groupNumber.integerValue == groupNumber) {
|
||||
groupNumber++;
|
||||
}
|
||||
}
|
||||
NSLog(@"indexgroup = %d",groupNumber);
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:groupNumber];
|
||||
XuanduoTimerGroup *group;
|
||||
BOOL havePlus = NO;
|
||||
if (_mydatepicView.haveDelected) {
|
||||
havePlus = [dataArr containsObject:plusflag];
|
||||
group = [dataArr objectAtIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
timerModel.groupNumber = [dataContorl groupNumberTohex:group.groupNumber.integerValue];;
|
||||
NSLog(@"realgroup = %ld",group.groupNumber.integerValue);
|
||||
timerModel.isOn = group.status;
|
||||
[dataArr removeObject:group];
|
||||
if (![self isValidTimer:startTime withEndTime:endTime]) {
|
||||
[self showTitle:@"" messsage:@"添加的时间段与之前的重叠"];
|
||||
[dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
return;
|
||||
}else {
|
||||
[dataArr insertObject:group atIndex:havePlus?(_indexPath.row+1):_indexPath.row];
|
||||
}
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
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
|
||||
{
|
||||
timerModel.selectorNumber = @"03";
|
||||
}
|
||||
break;
|
||||
case 4: //造浪泵
|
||||
{
|
||||
timerModel.selectorNumber = @"06";
|
||||
}
|
||||
break;
|
||||
case 5: //杀菌灯
|
||||
{
|
||||
timerModel.selectorNumber = @"05";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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];
|
||||
NSLog(@"hexString%@",selectorString);
|
||||
NSLog(@"result%@",_mydatepicView.resultString);
|
||||
|
||||
readModel.selectorNumber = timerModel.selectorNumber;
|
||||
NSString*readString=[NSString stringWithFormat:@"%@%@%@",readModel.description,readModel.selectorNumber,readModel.crc16str];
|
||||
NSData*readData=[dataContorl stringToHexData:readString];
|
||||
[[Socketsingleton sharedInstance] soketWriteData:readData];
|
||||
[_indicatorView startAnimating];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1561,7 +1750,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
{
|
||||
_cycleModel=[[XuanduoCycleModel alloc]init];
|
||||
[Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentdevice.type];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection-2]];
|
||||
NSMutableArray *dataArr = [self.timeDic objectForKey:_titieArr[_selectSection]];
|
||||
[dataArr removeAllObjects];
|
||||
|
||||
[dataArr addObject:_cycleModel];
|
||||
|
||||
+1
-1
@@ -799,7 +799,7 @@ static NSString *timerTypeFlag = @"TimerTypeTableViewCell";
|
||||
|
||||
- (void)addTimer:(UIButton *)btn {
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
_mydatepicView.isNewXuanduo = YES;
|
||||
_mydatepicView.pickerType = @"xuanduo";
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(deleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ static const CGFloat ToastFade = 0.2;
|
||||
_mydatepicView=[[MydatePickerView alloc]init];
|
||||
|
||||
_mydatepicView.frame=CGRectMake(0,0,kScreenSize.width,kScreenSize.height);
|
||||
[_mydatepicView setIsNewXuanduo:YES];
|
||||
_mydatepicView.pickerType = @"xuanduo";;
|
||||
[_mydatepicView.picView reloadAllComponents];
|
||||
[_mydatepicView.cancleButton addTarget:self action:@selector(cancleButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_mydatepicView.sureButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
Reference in New Issue
Block a user