features:新绚多设备灯的控制

This commit is contained in:
一只会编程的狮子 2019-04-25 00:35:53 +08:00
parent 083bbf164a
commit 4b74588759
7 changed files with 186 additions and 17 deletions

View File

@ -2714,6 +2714,8 @@
FA0892EE226C15000084A609 /* Xuanduo2DataUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = FA0892EC226C15000084A609 /* Xuanduo2DataUtility.m */; };
FA0892F1226CA3920084A609 /* NSString+Add.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0892EF226CA3920084A609 /* NSString+Add.h */; };
FA0892F2226CA3920084A609 /* NSString+Add.m in Sources */ = {isa = PBXBuildFile; fileRef = FA0892F0226CA3920084A609 /* NSString+Add.m */; };
FA0892F52270BED00084A609 /* XuanduoHuliModel.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0892F32270BED00084A609 /* XuanduoHuliModel.h */; };
FA0892F62270BED00084A609 /* XuanduoHuliModel.m in Sources */ = {isa = PBXBuildFile; fileRef = FA0892F42270BED00084A609 /* XuanduoHuliModel.m */; };
FAB3721122619DB70051E107 /* Xuanduo2fController.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB3720E22619DB70051E107 /* Xuanduo2fController.h */; };
FAB3721222619DB70051E107 /* Xuanduo2fController.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB3720F22619DB70051E107 /* Xuanduo2fController.m */; };
FAB3721322619DB70051E107 /* Xuanduo2fController.xib in Resources */ = {isa = PBXBuildFile; fileRef = FAB3721022619DB70051E107 /* Xuanduo2fController.xib */; };
@ -6652,6 +6654,8 @@
FA0892EC226C15000084A609 /* Xuanduo2DataUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Xuanduo2DataUtility.m; sourceTree = "<group>"; };
FA0892EF226CA3920084A609 /* NSString+Add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Add.h"; sourceTree = "<group>"; };
FA0892F0226CA3920084A609 /* NSString+Add.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Add.m"; sourceTree = "<group>"; };
FA0892F32270BED00084A609 /* XuanduoHuliModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XuanduoHuliModel.h; sourceTree = "<group>"; };
FA0892F42270BED00084A609 /* XuanduoHuliModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XuanduoHuliModel.m; sourceTree = "<group>"; };
FAB3720E22619DB70051E107 /* Xuanduo2fController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Xuanduo2fController.h; sourceTree = "<group>"; };
FAB3720F22619DB70051E107 /* Xuanduo2fController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Xuanduo2fController.m; sourceTree = "<group>"; };
FAB3721022619DB70051E107 /* Xuanduo2fController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Xuanduo2fController.xib; sourceTree = "<group>"; };
@ -10328,6 +10332,8 @@
883E76A51D48A5E50030E075 /* XuToCenterViewController.m */,
883E76A61D48A5E50030E075 /* XuToLightModel.h */,
883E76A71D48A5E50030E075 /* XuToLightModel.m */,
FA0892F32270BED00084A609 /* XuanduoHuliModel.h */,
FA0892F42270BED00084A609 /* XuanduoHuliModel.m */,
883E76A81D48A5E50030E075 /* XuToSetViewController.h */,
883E76A91D48A5E50030E075 /* XuToSetViewController.m */,
883E76AA1D48A5E50030E075 /* XuToSoketBackMsgDataUnity.h */,
@ -14546,6 +14552,7 @@
3D1C513F221A9EE10096AE43 /* FishControlThreedViewCell.h in Headers */,
3D1C5062221A9EDF0096AE43 /* bprint.h in Headers */,
3D1C505C221A9EDF0096AE43 /* cpu.h in Headers */,
FA0892F52270BED00084A609 /* XuanduoHuliModel.h in Headers */,
3D1C5051221A9EDF0096AE43 /* timecode.h in Headers */,
3D1C50C7221A9EE00096AE43 /* LocalDevice.h in Headers */,
3D1C50A0221A9EDF0096AE43 /* TouchButton.h in Headers */,
@ -17166,6 +17173,7 @@
3D1C50C8221A9EE00096AE43 /* Alarm.m in Sources */,
886028711E10BB1100F3DB5D /* NSNumberFormatter+CTAssetsPickerController.m in Sources */,
881671A61EA5DE2B00BEBF23 /* UMComLocationListDataController.m in Sources */,
FA0892F62270BED00084A609 /* XuanduoHuliModel.m in Sources */,
3D1C5106221A9EE00096AE43 /* CameraNoParyBackVideoView.m in Sources */,
881671AD1EA5DE2B00BEBF23 /* UMComUserListDataController.m in Sources */,
88653CA21E7671F900FF973E /* MineHeaderNewItemsCell.m in Sources */,

View File

@ -74,9 +74,9 @@
}
NSString *stateString7 = [backModel.waterPump substringWithRange:NSMakeRange(2, 2)];
if ([stateString7 isEqualToString:@"01"]) {
waveLightBtn.selected = YES;
waterLightBtn.selected = YES;
}else{
waveLightBtn.selected = NO;
waterLightBtn.selected = NO;
}
NSString *stateString8 = backModel.heatStatus;
if ([stateString8 isEqualToString:@"01"]) {

View File

@ -19,6 +19,7 @@
#import "UserExtendataArchaver.h"
#import "UIButton+WebCache.h"
#import "NSString+Add.h"
#import "XuanduoHuliModel.h"
#import "Xuanduo2DataUtility.h"
#define kBtnTag 100
@ -48,6 +49,8 @@
@property (weak, nonatomic) IBOutlet UIButton *huliLight;
@property (weak, nonatomic) IBOutlet UIButton *waterLight;
@property (weak, nonatomic) IBOutlet UIButton *heatLight;
@property(nonatomic,copy) UIActivityIndicatorView *indicatorView;
@property(nonatomic,strong) MyHud *XuTohud;
@end
@ -147,6 +150,8 @@
//communiteDelegate
-(void)socketDidGetBackmsgData:(NSData *)data onsoket:(AsyncSocket *)sock{
//[_HUD hide:YES];
[self.XuTohud hidmyHud];
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data];
if ([self.tipLabel.text isEqualToString:@"鱼缸温度"]) {
[self setTemperature];
@ -168,18 +173,97 @@
#pragma mark -- actions --
- (IBAction)btnActions:(UIButton *)sender {
sender.selected = !sender.selected;
switch (sender.tag) {
- (IBAction)btnActions:(UIButton *)btn {
if (self.dataModel) {
}else{
[self showLableAction:@"设备已离线"];
}
XuToLightModel * lightModel= [[XuToLightModel alloc] init];
lightModel.sendmacId = self.currentDevice.macAddress;
lightModel.resavemacId = self.currentDevice.macAddress;
NSString*switchString1=lightModel.description;
if (btn.selected) {//
lightModel.switchBtn = @"00";
}else {//
lightModel.switchBtn = @"01";
}
lightModel.crc16Str=@"0000";// CRC16
switch (btn.tag) {
case kBtnTag: //
{
[self changLightStatus:lightModel withLightNumber:@"05" dataStr:switchString1];
}
break;
case kBtnTag + 1:
case kBtnTag + 1: //
{
[self changLightStatus:lightModel withLightNumber:@"01" dataStr:switchString1];
}
break;
case kBtnTag + 2: //1
{
[self changLightStatus:lightModel withLightNumber:@"02" dataStr:switchString1];
}
break;
case kBtnTag + 3: //2
{
[self changLightStatus:lightModel withLightNumber:@"03" dataStr:switchString1];
}
break;
case kBtnTag + 4: //
{
[self changLightStatus:lightModel withLightNumber:@"06" dataStr:switchString1];
}
break;
case kBtnTag + 5: //
{
XuanduoHuliModel *huliModel = [[XuanduoHuliModel alloc] init];
huliModel.sendmacId = self.currentDevice.macAddress;
huliModel.resavemacId = self.currentDevice.macAddress;
NSString *switchString = huliModel.description;
if (btn.selected) {//
huliModel.switchBtn = @"00";
}else {//
huliModel.switchBtn = @"01";
}
huliModel.crc16Str=@"0000";// CRC16
NSString *switchString2 = [NSString stringWithFormat:@"%@%@%@",switchString,huliModel.switchBtn,huliModel.crc16Str];
NSData *manulData=[dataContorl stringToHexData:switchString2];
[[Socketsingleton sharedInstance] soketWriteData:manulData];
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
//soket
[self creatXuToindicaterView];
[self.XuTohud myhudstart];
}
}
break;
case kBtnTag + 6: //
{
[self changLightStatus:lightModel withLightNumber:@"04" dataStr:switchString1];
}
break;
case kBtnTag + 7: //
{
[self changLightStatus:lightModel withLightNumber:@"" dataStr:switchString1];
}
break;
default:
break;
}
}
- (void)changLightStatus:(XuToLightModel *)lightModel withLightNumber:(NSString *)number dataStr:(NSString *)switchString1 {
lightModel.lightNumber = number;
NSString *switchString2 = [NSString stringWithFormat:@"%@%@%@%@",switchString1,lightModel.lightNumber,lightModel.switchBtn,lightModel.crc16Str];
NSData *manulData=[dataContorl stringToHexData:switchString2];
[[Socketsingleton sharedInstance] soketWriteData:manulData];
if ([Socketsingleton sharedInstance].clientSocket.isConnected) {
//soket
[self creatXuToindicaterView];
[self.XuTohud myhudstart];
}
}
- (IBAction)brandClick:(id)sender {
SongBaoViewController *brand = [[SongBaoViewController alloc]init];
brand.brandIntroduce = self.currentDevice.brandIntroduce;
@ -245,6 +329,20 @@
}
-(void)creatXuToindicaterView{
self.XuTohud = [[MyHud alloc]init];
self.XuTohud.frame=CGRectMake(0, kScreenSize.height/3, kScreenSize.width,kScreenSize.height*2/3 );
[self.XuTohud myhudtimeOut];
//self.XuTohud.backgroundColor=[UIColor redColor];
[self.view addSubview:self.XuTohud];
NSLog(@"**********绚多加载***********");
}
#pragma mark - PopViewDelagate
-(void)disSelectedPopViewIndex:(NSIndexPath *)Index{
@ -276,7 +374,7 @@
UInt64 mac = [dataContorl hexToTen:self.dataModel.waterTemperature];
NSLog(@"%llu",mac);
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10;
float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f℃",temp];
[self.tempLabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"℃"]]];
}
@ -455,6 +553,26 @@
return _dataModel;
}
- (void)showLableAction:(NSString *)str{
UILabel *laberAction =[[UILabel alloc]init];
laberAction.frame =CGRectMake((kScreenSize.width/2) - 50, kScreenSize.height/2 , 100, 50);
laberAction.clipsToBounds =YES;
laberAction.layer.cornerRadius =5;
laberAction.alpha =1;
laberAction.text =str;
laberAction.textAlignment =NSTextAlignmentCenter;
laberAction.backgroundColor =IndicatorBack_COLOR;
laberAction.font=[UIFont systemFontOfSize:12];
laberAction.textColor=[UIColor whiteColor];
[UIView animateWithDuration:2.0 animations:^{
laberAction.alpha =0;
}completion:^(BOOL finished) {
[laberAction removeFromSuperview];
}];
[self.view addSubview:laberAction];
}
- (void)dealloc {
}

View File

@ -30,7 +30,7 @@
<outlet property="uvLight" destination="94R-4Q-SUx" id="Lja-bT-2GS"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outlet property="waterLight" destination="wZH-6A-6dN" id="kyb-Lh-sdc"/>
<outlet property="waveLight" destination="83l-yl-ndR" id="F0p-IN-WSs"/>
<outlet property="waveLight" destination="83l-yl-ndR" id="Ppq-0b-uJB"/>
<outlet property="xunhuanLabel" destination="7KA-Hc-54C" id="QRq-jP-IC4"/>
<outlet property="zaolangLabel" destination="BWx-iu-nY0" id="rxl-X0-mne"/>
<outlet property="zengyangLabel" destination="Dse-Ih-U5R" id="sjC-JB-eMQ"/>
@ -81,7 +81,7 @@
<action selector="btnActions:" destination="-1" eventType="touchUpInside" id="jcG-z7-mUY"/>
</connections>
</button>
<button opaque="NO" tag="103" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WFc-cF-80l">
<button opaque="NO" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WFc-cF-80l">
<rect key="frame" x="209.5" y="383" width="46" height="46"/>
<constraints>
<constraint firstAttribute="width" secondItem="WFc-cF-80l" secondAttribute="height" multiplier="1:1" id="KNO-vi-GYn"/>
@ -92,7 +92,7 @@
<action selector="btnActions:" destination="-1" eventType="touchUpInside" id="QiP-2l-6Gh"/>
</connections>
</button>
<button opaque="NO" tag="104" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RHd-Xx-AyG">
<button opaque="NO" tag="103" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RHd-Xx-AyG">
<rect key="frame" x="299.5" y="383" width="45.5" height="46"/>
<constraints>
<constraint firstAttribute="width" secondItem="RHd-Xx-AyG" secondAttribute="height" multiplier="1:1" id="npW-2w-QHd"/>
@ -127,7 +127,7 @@
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="105" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="83l-yl-ndR">
<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="491" width="46" height="45.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="83l-yl-ndR" secondAttribute="height" multiplier="1:1" id="w6a-qu-5EK"/>
@ -138,7 +138,7 @@
<action selector="btnActions:" destination="-1" eventType="touchUpInside" id="JYg-AF-0fV"/>
</connections>
</button>
<button opaque="NO" tag="106" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ucP-6q-kgn">
<button opaque="NO" tag="105" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ucP-6q-kgn">
<rect key="frame" x="120" y="491" width="45.5" height="45.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="ucP-6q-kgn" secondAttribute="height" multiplier="1:1" id="Vkv-7O-YZz"/>
@ -149,7 +149,7 @@
<action selector="btnActions:" destination="-1" eventType="touchUpInside" id="jNj-Lu-4Vh"/>
</connections>
</button>
<button opaque="NO" tag="107" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wZH-6A-6dN">
<button opaque="NO" tag="106" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wZH-6A-6dN">
<rect key="frame" x="209.5" y="491" width="46" height="45.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="wZH-6A-6dN" secondAttribute="height" multiplier="1:1" id="526-Hn-VeS"/>
@ -160,7 +160,7 @@
<action selector="btnActions:" destination="-1" eventType="touchUpInside" id="zCg-7a-yCn"/>
</connections>
</button>
<button opaque="NO" tag="108" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fFJ-1w-2f5">
<button opaque="NO" tag="107" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fFJ-1w-2f5">
<rect key="frame" x="299.5" y="491" width="45.5" height="45.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="fFJ-1w-2f5" secondAttribute="height" multiplier="1:1" id="4jg-CV-sDI"/>

View File

@ -0,0 +1,20 @@
//
// XuanduoHuliModel.h
// Ifish
//
// Created by Alex on 2019/4/24.
// Copyright © 2019 lianlian. All rights reserved.
//
#import "baseModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface XuanduoHuliModel : baseModel
@property(nonatomic,copy)NSString*switchBtn;
@property(nonatomic,copy)NSString*crc16Str;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,23 @@
//
// XuanduoHuliModel.m
// Ifish
//
// Created by Alex on 2019/4/24.
// Copyright © 2019 lianlian. All rights reserved.
//
#import "XuanduoHuliModel.h"
@implementation XuanduoHuliModel
- (NSString *)description
{
self.messagetype=@"00";
self.massagelegth=@"12";
self.functionCode=@"13";
return [NSString stringWithFormat:@"%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth];
}
@end

View File

@ -40,13 +40,13 @@
}
-(void)myhudtimeOut{
_myHudTimer=[NSTimer scheduledTimerWithTimeInterval:12.0 target:self selector:@selector(hudTimeout) userInfo:nil repeats:NO];
_myHudTimer=[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(hudTimeout) userInfo:nil repeats:NO];
}
-(void)hudTimeout{
if (_hudActivityView.isAnimating) {
[_hudActivityView stopAnimating];
[self showTitle:@"" messsage:@"请下拉刷新重试"];
[self showTitle:@"" messsage:@"请重试"];
[self removeFromSuperview];
}else{
return;