| | |
| | | #import<BaiduMapAPI_Search/BMKPoiSearchType.h> |
| | | #import "DataModel.h" |
| | | #import "UIImage+animatedGIF.h" |
| | | #import "UploadData.h" |
| | | |
| | | @interface RadiaDetectionPage ()<ASValueTrackingSliderDelegate,ASValueTrackingSliderDataSource,cbCharacteristicManagerDelegate,BMKMapViewDelegate,BMKLocationServiceDelegate> |
| | | { |
| | | ZZCircleProgress *circle3; |
| | |
| | | |
| | | //dataModelArr |
| | | DataModel * model = [[DataModel alloc]init]; |
| | | model.value = [_BiaozhunJiliangNumLabel.text floatValue]; |
| | | model.time = [DateUtil stringFromDateYMD:[NSDate date]]; |
| | | model.type = 0; |
| | | model.is_warn = 0; |
| | | model.value = _BiaozhunJiliangNumLabel.text; |
| | | model.time = [DateUtil stringFromDateYMDHMS:[NSDate date]]; |
| | | model.type = @"0"; |
| | | model.is_warn = @"0"; |
| | | |
| | | if(model.value < 0.16) |
| | | if([model.value floatValue] < 0.16) |
| | | { |
| | | // 100 |
| | | circle3.progress = model.value*100; |
| | | circle3.progress = [model.value floatValue]*100; |
| | | _currentShuziTipsLabel.text = @"当前位置安全"; |
| | | _currentTipsLabel.textColor = RgbColor(64, 159, 252); |
| | | _currentTipsLabel.text = @"您所处位置辐射安全,\n 您处于安全区域,可以长时间逗留!"; |
| | |
| | | // _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | |
| | | } |
| | | else if(model.value >= 0.16 && model.value < 0.8) |
| | | else if([model.value floatValue] >= 0.16 && [model.value floatValue] < 0.8) |
| | | { |
| | | // 100 |
| | | float tempValue = model.value; |
| | | float tempValue = [model.value floatValue]; |
| | | if(tempValue > 0.50) |
| | | tempValue = 0.50; |
| | | |
| | |
| | | _currentShuziTipsLabel.text = @"当前位置有轻微辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(64, 159, 252); |
| | | _currentTipsLabel.text = @"您所处位置辐射轻微,\n 不利于您的健康,请远离到安全区域!"; |
| | | model.is_warn = 1; |
| | | model.is_warn = @"1"; |
| | | |
| | | _AnquanStatustLabel.text = @"轻微"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0x0d95fe); |
| | |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"ic_zhishu_bk"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | } |
| | | else if(model.value >= 0.8 && model.value < 2) |
| | | else if([model.value floatValue] >= 0.8 && [model.value floatValue] < 2) |
| | | { |
| | | // 264 |
| | | float tempValue = (model.value*100)/266; |
| | | float tempValue = ([model.value floatValue]*100)/266; |
| | | if(tempValue <= 0.50) |
| | | tempValue = 0.51; |
| | | |
| | |
| | | _currentShuziTipsLabel.text = @"当前位置有较高辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射偏高,\n 不利于您的健康,请远离到安全区域!"; |
| | | model.is_warn = 1; |
| | | model.is_warn = @"1"; |
| | | |
| | | _AnquanStatustLabel.text = @"中度"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0xc240ff); |
| | |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"bt_zise"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | } |
| | | else if(model.value >2) |
| | | else if([model.value floatValue] >2) |
| | | { |
| | | // 400 |
| | | |
| | | float tempValue = (model.value*100)/400; |
| | | float tempValue = ([model.value floatValue]*100)/400; |
| | | if(tempValue <= 0.75) |
| | | tempValue = 0.76; |
| | | |
| | |
| | | _currentShuziTipsLabel.text = @"当前位置有很严重辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射辐射,\n 不利于您的健康,请远离到安全区域!"; |
| | | model.is_warn = 1; |
| | | model.is_warn = @"1"; |
| | | |
| | | _AnquanStatustLabel.text = @"危险"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0xff4e63); |
| | |
| | | NSString * timeValueStr = [receiveHexValue substringWithRange:NSMakeRange(2,8)]; |
| | | //dataModelArr |
| | | DataModel * model = [[DataModel alloc]init]; |
| | | model.value = [timeValueStr floatValue]; |
| | | model.time = [DateUtil stringFromDateYMD:[NSDate date]]; |
| | | model.type = 1; |
| | | model.is_warn = 0; |
| | | model.value = timeValueStr; |
| | | model.time = [DateUtil stringFromDateYMDHMS:[NSDate date]]; |
| | | model.type = @"1"; |
| | | model.is_warn = @"0"; |
| | | |
| | | [dataModelArr addObject:model]; |
| | | } |
| | |
| | | { |
| | | deviceStstaus = 1; |
| | | deviceStatusLabel.text = @"已连接"; |
| | | |
| | | //关闭定时器 连接成功 |
| | | if(myScanTimer) |
| | | [myScanTimer setFireDate:[NSDate distantFuture]]; |
| | | |
| | | [self onLineSet]; |
| | | |
| | | // 连接成功设置服务 |
| | | NSArray *allService = [self UUIDArray:[[[CBMoralManager sharedManager] serviceUUIDDict] allKeys]]; |
| | |
| | | |
| | | dataModelArr = [[NSMutableArray alloc] init]; |
| | | |
| | | // for (int i = 0; i < 10; i++) { |
| | | // DataModel * model = [[DataModel alloc] init]; |
| | | // model.time = [DateUtil stringFromDateYMDHMS:[NSDate date]]; |
| | | // model.type = @"1"; |
| | | // model.is_warn = @"0"; |
| | | // model.value = @"0.012"; |
| | | // [dataModelArr addObject:[model mj_JSONString]]; |
| | | // } |
| | | // |
| | | // |
| | | // NSDictionary * tempDic = [dataModelArr mj_keyValues]; |
| | | // |
| | | // NSString * tempStr = [Global convertToJsonData:tempDic]; |
| | | myTimeInterval = [UserDefault stringForKey:@"refresh_frequency"]; |
| | | is_open_upload = [UserDefault stringForKey:@"is_open_upload"]; |
| | | |
| | |
| | | |
| | | -(void)data_upload |
| | | { |
| | | // 没有接收到数据不上传 |
| | | if ([dataModelArr count] == 0 ) |
| | | return; |
| | | |
| | | //[UserDefault stringForKey:@"user_id"] |
| | | NSString *path = [[NSString alloc] initWithFormat:DATA_UPLOAD]; |
| | | |
| | | UploadModel *model = [[UploadModel alloc] init]; |
| | | |
| | | model.data = [[UploadData alloc] init]; |
| | | //['refresh_frequency', 'video', 'is_open_upload'] |
| | | //[param setValue:[UserDefault stringForKey:@"user_id"] forKey:@"user_id"]; |
| | | address = @"测试地址"; |
| | | |
| | | model.lat = [NSString stringWithFormat:@"%lf",latitude]; |
| | | model.lon = [NSString stringWithFormat:@"%lf",longitude]; |
| | | model.userid = [UserDefault stringForKey:@"user_id"]; |
| | | model.address = address; |
| | | model.modelArray = [[NSMutableArray alloc] init]; |
| | | [model.modelArray addObjectsFromArray:dataModelArr]; |
| | | model.data.lat = [NSString stringWithFormat:@"%lf",latitude]; |
| | | model.data.lon = [NSString stringWithFormat:@"%lf",longitude]; |
| | | model.data.userid = [UserDefault stringForKey:@"user_id"]; |
| | | model.data.address = address; |
| | | |
| | | model.data.data = [[NSMutableArray alloc] init]; |
| | | [model.data.data addObjectsFromArray:dataModelArr]; |
| | | |
| | | //NSString * tempString = [Global convertToJsonData:model.toDic]; |
| | | MPWeakSelf(self); |
| | | [NetworkSingleton networkingGetMethod:model.toDic urlName:path success:^(id responseBody) |
| | | [NetworkSingleton networkingPostMethod:model.toDic urlName:path success:^(id responseBody) |
| | | { |
| | | MPStrongSelf(self); |
| | | BaseResModel * resModel = [Global toBaseModel:responseBody]; |
| | |
| | | failure:^(NSString *error) |
| | | { |
| | | |
| | | [Global alertMessageEx:error title:@"获取失败" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | [Global alertMessageEx:error title:@"提示信息" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | }]; |
| | | } |
| | | |