测试修改

This commit is contained in:
kai60
2020-05-03 21:05:25 +08:00
parent 53f06fcf43
commit 8d0003b9cd
34 changed files with 862 additions and 170 deletions
@@ -10,6 +10,7 @@
#import "IfishDeviceInfo.h"
#import "RuSunGuiDeng.h"
#import "XuanduoHuliModel.h"
#import "xuanduo3fModel.h"
@implementation BootomViewSoketBackMasgConreol
@@ -92,6 +93,9 @@
}else if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]){
str=[str substringWithRange:NSMakeRange(60,IFISH_TEMPERATURE_BYTE2)];
}
else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]){
str=[str substringWithRange:NSMakeRange(46,IFISH_TEMPERATURE_BYTE2)];
}
UInt64 mac=[dataContorl hexToTen:str];
NSLog(@"%llu",mac);
@@ -927,7 +931,17 @@ indexPath {
if (index == 0) { //循环
manulModel.lightNumber = @"04";
if([[model.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
NSString*state;
if ([model isKindOfClass:[Xuanduo3fModel class]])
{
state=model.gasPump;
manulModel.lightNumber=@"01";
}
else{
state= model.waterPump;
}
if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
@@ -939,6 +953,11 @@ indexPath {
}else if (index == 1){ //增氧
manulModel.lightNumber = @"01";
if ([model isKindOfClass:[Xuanduo3fModel class]])
{
manulModel.lightNumber=@"02";
}
if([[model.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
@@ -953,7 +972,16 @@ indexPath {
manulModel.lightNumber = @"02";
if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
NSString*state;
if ([model isKindOfClass:[Xuanduo3fModel class]])
{
state=model.uvLamp;
manulModel.lightNumber=@"03";
}
else{
state= model.light1;
}
if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
@@ -967,7 +995,17 @@ indexPath {
manulModel.lightNumber = @"03";
if([[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
NSString*state;
if ([model isKindOfClass:[Xuanduo3fModel class]])
{
state=((Xuanduo3fModel*)model).constTmep;
manulModel.lightNumber=@"04";
}
else{
state= model.light2;
}
if([[state substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
@@ -154,7 +154,7 @@
@property(nonatomic,strong) RunSun84Protocol *ruSun84Back;
@property (nonatomic, strong) RuiMeiProtocolModel *ruiMeiBack;
@property(nonatomic,strong) SongNuoBDProtocol *songNuoBDBack;
@property(nonatomic,strong) Xuanduo2Model *xuanduoBack;
@property(nonatomic,strong) id xuanduoBack;
-(void)setTabViewWithFrame:(CGRect)frame;
@@ -237,14 +237,14 @@
UIButton *notbindBtn=[UIButton buttonWithType:UIButtonTypeCustom];
NSString *title=@"您暂无可用的水族箱,前往绑定。";
NSString *title=@"您暂无可用的水族箱或宠物笼,前往绑定。";
[notbindBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:title];
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setLineSpacing:8];
[paragraphStyle setLineSpacing:12];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(9,5)];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(13,5)];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,10)];
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)];
[notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal];
@@ -307,7 +307,7 @@
//[headerView setBackgroundColor:XBGAlpha];
[headerView setBackgroundColor:RGB(242, 242, 242)];
UILabel *readLabel=[[UILabel alloc] init ];
readLabel.text = @"请选择一个水族箱,和摄像头建立关系";
readLabel.text = @"请选择一个水族箱或宠物笼,和摄像头建立关系";
NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:readLabel.text ];
@@ -618,7 +618,11 @@
return 3 + 5;
} else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
return 3 + self.device.controlAmount.integerValue + 1;
}else {
}
else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
return 3 + self.device.controlAmount.integerValue + 1;
}
else {
if (self.device.controlAmount.integerValue ==5) {
@@ -708,7 +712,32 @@
if (!cell || [cell.templabel.text containsString:@"kwh"]) {
return;
}
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity];
Xuanduo2Model*model=_xuanduoBack;
UInt64 mac = [dataContorl hexToTen:model.electricity];
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0];
cell.templabel.font = [UIFont systemFontOfSize:37];
cell.templabel.textColor = RGB(253, 188, 63);
[cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
if (!_switchTimer) {
_switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_switchTimer forMode:NSRunLoopCommonModes];
}
}else if(indexPath.row == 2) {
[self.MonitorBottomDelegate didselectXuanduo2SetttngWithData:self.device andBackModel:_xuanduoBack];
}
}
else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
if (!_xuanduoBack) {
[self makeToast:@"暂未连接"];
return;
}
if (indexPath.row == 1) {
FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag];
if (!cell || [cell.templabel.text containsString:@"kwh"]) {
return;
}
Xuanduo3fModel*model=_xuanduoBack;
UInt64 mac = [dataContorl hexToTen:model.temperature];
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0];
cell.templabel.font = [UIFont systemFontOfSize:37];
cell.templabel.textColor = RGB(253, 188, 63);
@@ -925,7 +954,7 @@
}
[self makeToastActivity:CSToastPositionCenter];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
// 新绚多
if (!_xuanduoBack) {
[self makeToast:@"暂未连接"];
@@ -1118,10 +1147,17 @@
if (!cell) {
return;
}
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.waterTemperature];
NSLog(@"%llu",mac);
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10.0;
UInt64 mac = 0;
NSLog(@"%llu",mac);
if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]) {
Xuanduo2Model*model=(Xuanduo2Model*)_xuanduoBack;
mac=[dataContorl hexToTen:model.waterTemperature];
}
else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
Xuanduo3fModel*model=(Xuanduo3fModel*)_xuanduoBack;
mac=[dataContorl hexToTen:model.temperature];
} float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f",temp];
[cell setTemWith:stringTemp];
}
@@ -1243,7 +1279,7 @@
[cell setSongNuoBDControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_songNuoBDBack];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]||[self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
if (!_xuanduoBack) {
cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3];
[self makeToast:@"连接设备中..."];
@@ -1487,7 +1523,21 @@
[UIImage imageNamed:@"shajun_selected"],
[UIImage imageNamed:@"huli_selected"],
[UIImage imageNamed:@"jiare_selected"]];
}else{
}
else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
self.btnNameArr = @[@"照明",@"换气",@"杀菌",@"恒温"];
self.btnImgArr = @[[UIImage imageNamed:@"照明关"],
[UIImage imageNamed:@"换气关"],
[UIImage imageNamed:@"杀菌关"],
[UIImage imageNamed:@"恒温关"]];
self.btnOnImgArr = @[[UIImage imageNamed:@"照明开"],
[UIImage imageNamed:@"换气开"],
[UIImage imageNamed:@"杀菌开"],
[UIImage imageNamed:@"恒温开"]];
}
else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1802,7 +1852,16 @@
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data type:DECICE_TYPE_XUANDUO2F];
self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO2F];
[self.collectionView reloadData];
}else{
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]){
// 新绚多
if (!_xuanduoBack) {
_xuanduoBack = [[Xuanduo3fModel alloc] init];
}
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data type:self.device.type];
self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO3F];
[self.collectionView reloadData];
}
else{
int controlAmount=[devicemoel.controlAmount intValue];
@@ -29,6 +29,8 @@
UIView *hengLine=[[UIView alloc] initWithFrame:CGRectMake(0,self.frame.size.height -1,self.frame.size.width, 1)];
hengLine.backgroundColor = shuLine.backgroundColor = JWUIColorFromRGB(0xdddddd);
[self addSubview:hengLine];
[self bringSubviewToFront:self.factoryIcon];
self.factoryIcon.hidden=NO;
}
@@ -38,12 +40,18 @@
-(void)intiFactoryImgWith:(DeviceModel *)devicemodel{
[self.factoryIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,devicemodel.logo]] placeholderImage:[UIImage imageNamed:@""]];
if (!self.factoryIcon.image) {
self.factoryIcon.image = [UIImage imageNamed:@"brandLogo_hold"];
}
[self.factoryIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kGetLogUrl,devicemodel.logo]] placeholderImage:[UIImage imageNamed:@"brandLogo_hold"]];
if (!self.factoryIcon) {
self.factoryIcon.image = [UIImage imageNamed:@"greenbtn_big"];
}
[self bringSubviewToFront:self.factoryIcon];
self.factoryIcon.hidden=NO;
}
@end
@@ -7,6 +7,7 @@
//
#import "FishControlFourthCell.h"
#import "xuanduo3fModel.h"
@implementation FishControlFourthCell
- (instancetype)initWithFrame:(CGRect)frame{
@@ -258,6 +259,10 @@
atIndex:(NSIndexPath *)indexPath
addBackModel:(Xuanduo2Model*)model {
if ([model isKindOfClass:[Xuanduo2Model class]])
{
NSInteger index = indexPath.row - 3;
if (index == 0) {
@@ -307,7 +312,40 @@
addOffArr:imgOffArr];
}
}
else if ([model isKindOfClass:[Xuanduo3fModel class]])
{
Xuanduo3fModel*xuan3fmodel=model;
NSInteger index = indexPath.row - 3;
if (index == 0) {
NSString*stateString=[xuan3fmodel.light substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 1){
NSString*stateString=[xuan3fmodel.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 2){
NSString*stateString=[xuan3fmodel.uvLamp substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 3){
NSString*stateString=[xuan3fmodel.constTmep substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else
{
NSLog(@"index=%ld",indexPath.row);
}
}
}
@@ -72,7 +72,7 @@
withdeviceName:(NSString *)nameStr{
self.deviceNameLabel.text = [NSString stringWithFormat:@"水族箱:%@",nameStr];
self.deviceNameLabel.text = nameStr;
self.deviceNameLabel.textColor = [UIColor blackColor];