杀菌倒计时和摄像头分享

This commit is contained in:
kai60
2020-06-06 17:47:11 +08:00
parent 22e170a66f
commit ee657760c4
7 changed files with 79 additions and 21 deletions
@@ -132,6 +132,10 @@
//float TPlabel=mac/10+(mac%10)*0.1;
NSString *lasttime = [NSString stringWithFormat:@"%lld",mac1];
if (mac1==0)
{
lasttime=@"";
}
UIImage*uvNomal=[UIImage imageNamed:@"杀菌关"];
uvNomal=[uvNomal imageWaterMarkWithString:lasttime rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:25]}];
[light1Btn setImage:uvNomal forState:UIControlStateNormal];
@@ -1319,8 +1319,8 @@ static NSString *setTimerflag = @"SetTimerCell";
int intString = [str intValue];
NSString*temp =[dataContorl tpIntStringToFourHex:intString];
NSString*hex=[dataContorl ToHex:intString];
NSString*temp =[dataContorl leftAddZero:4 andStr:hex];
_cycleModel.lastTime=temp;
NSString*minString=[NSString stringWithFormat:@"%@%@%@%@%@%@",tempModel.description,_cycleModel.lightNumber,_cycleModel.lastTime,_cycleModel.gapTime,_cycleModel.status,@"0000"];
NSLog(@"minstring = %@",minString);
@@ -67,6 +67,9 @@
@property (weak, nonatomic) IBOutlet UIView *contentView;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property(nonatomic,strong) XuanduoCycleModel *cycleModel;
@property(nonatomic,assign) NSInteger heartCount;
@end
@@ -77,6 +80,14 @@
[super viewWillAppear:animated];
[Socketsingleton sharedInstance].communiteDelegate = self;
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName :[UIColor blackColor]};
if ([[Socketsingleton sharedInstance].clientSocket isConnected]&&[self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
[self readCycleWithNumber:@"03"];
self.heartCount=0;
}
}
- (void)viewDidLoad {
@@ -158,7 +169,8 @@
self.huliLabel.hidden=YES;
self.heatLight.hidden=YES;
self.jiareLabel.hidden=YES;
self.heartCount=0;
}
}
@@ -294,24 +306,52 @@
[Xuanduo2DataUtility readCycleSocketDataWithBackMsgModel:_cycleModel addWithBackStr:string1 type:self.currentDevice.type];
if (_cycleModel.lastTime.length)
{
// UInt64 mac1=[dataContorl hexToTen:_cycleModel.lastTime];
//
// //float TPlabel=mac/10+(mac%10)*0.1;
// float temp1 = mac1;
// NSString *stringTemp = [NSString stringWithFormat:@"%f℃",temp1];
// UIImage*uvNomal=[UIImage imageNamed:@"杀菌关"];
// uvNomal=[uvNomal imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
// [self.light1 setImage:uvNomal forState:UIControlStateNormal];
//
// UIImage*uvsel=[UIImage imageNamed:@"杀菌开"];
// uvsel=[uvsel imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
// [self.light1 setImage:uvsel forState:UIControlStateSelected];
UInt64 mac1=[dataContorl hexToTen:_cycleModel.lastTime];
//float TPlabel=mac/10+(mac%10)*0.1;
float temp1 = mac1;
NSString *stringTemp = [NSString stringWithFormat:@"%f℃",temp1];
UIImage*uvNomal=[UIImage imageNamed:@"杀菌关"];
uvNomal=[uvNomal imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
[self.light1 setImage:uvNomal forState:UIControlStateNormal];
UIImage*uvsel=[UIImage imageNamed:@"杀菌开"];
uvsel=[uvsel imageWaterMarkWithString:stringTemp rect:CGRectMake(140, 60, 60, 60) attribute:@{NSForegroundColorAttributeName:[UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];
[self.light1 setImage:uvsel forState:UIControlStateSelected];
}
}
else
{
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:self.dataModel addWithBackData:data type:self.currentDevice.type];
[self setTemperature];
if (self.dataModel)
{
self.heartCount++;
}
//
if (self.dataModel&&[self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
Xuanduo3fModel*model=(Xuanduo3fModel*)_dataModel;
NSString *stateString1 = [model.uvLamp substringWithRange:NSMakeRange(2, 2)];
//
if ([stateString1 isEqualToString:@"00"]||self.heartCount<2)
{
if (_cycleModel.lastTime.length)
{
model.vuPHstatus=_cycleModel.lastTime;
}
else //
{
model.vuPHstatus=@"0000";
}
}
}
}
@@ -349,7 +389,12 @@
-(void)ifishDeviceLogInSuccees{
[self readCycleWithNumber:@"03"];
if ([self.currentDevice.type isEqualToString:DECICE_TYPE_XUANDUO3F])
{
[self readCycleWithNumber:@"03"];
self.heartCount=0;
}
}
-(void)ifishSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket{