| | |
| | | #import "Constants.h" |
| | | #import "UIView+Toast.h" |
| | | #import "CBMoralManager.h" |
| | | #import "SearchDevicePage.h" |
| | | #import "BaseNaviController.h" |
| | | #import "HistoryRecordPage.h" |
| | | #import "NetworkSingleton.h" |
| | | #import "UploadModel.h" |
| | | #import "NetworkSingleton.h" |
| | | #import "SearchDevicePage.h" |
| | | |
| | | #import <BaiduMapAPI_Map/BMKMapComponent.h> |
| | | #import <BaiduMapAPI_Location/BMKLocationComponent.h> |
| | | #import<BaiduMapAPI_Search/BMKPoiSearchType.h> |
| | | #import "DataModel.h" |
| | | |
| | | #import "UIImage+animatedGIF.h" |
| | | @interface RadiaDetectionPage ()<ASValueTrackingSliderDelegate,ASValueTrackingSliderDataSource,cbCharacteristicManagerDelegate,BMKMapViewDelegate,BMKLocationServiceDelegate> |
| | | { |
| | | ZZCircleProgress *circle3; |
| | |
| | | CLLocationDegrees longitude; |
| | | |
| | | NSMutableArray * dataModelArr; |
| | | NSTimer * myTimer; |
| | | NSTimer * myTimer; // 上传数据定时器 |
| | | NSString * myTimeInterval; |
| | | NSString * is_open_upload; // 1 可以 0 禁止 |
| | | |
| | | NSTimer * myScanTimer; // 蓝牙重连定时器 |
| | | |
| | | GloriaLabel* _AnquanStatustLabel; |
| | | UIImageView * icon_anquan; |
| | | UIImageView * ic_zhishu_bk; |
| | | UIImageView * ic_weixin_tips; |
| | | UIImageView * ic_dianyuan; |
| | | } |
| | | @end |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | -(void)peripheral:(CBPeripheral *)peripheral didUpdateValueForDescriptor:(CBDescriptor *)descriptor error:(NSError *)error |
| | | { |
| | | if (error) |
| | | { |
| | | [Utilities logDataWithService:[ResourceHandler getServiceNameForUUID:descriptor.characteristic.service.UUID] characteristic:[ResourceHandler getCharacteristicNameForUUID:descriptor.characteristic.UUID] descriptor:[Utilities getDiscriptorNameForUUID:descriptor.UUID] operation:[NSString stringWithFormat:@"%@- %@%@",READ_RESPONSE,READ_ERROR,[error.userInfo objectForKey:NSLocalizedDescriptionKey]]]; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /*! |
| | | *@Method Notify Read Indicate options result return |
| | | * 蓝牙消息监听回调 |
| | |
| | | |
| | | if( receiveHexValue.length == 40 ) |
| | | { |
| | | //16进制转10进制 |
| | | NSString * shishiStr = [receiveHexValue substringWithRange:NSMakeRange(24,4)]; |
| | | NSString * leijiStr = [receiveHexValue substringWithRange:NSMakeRange(28,8)]; |
| | | |
| | | NSString * shishiValue = [NSString stringWithFormat:@"%lu",strtoul([shishiStr UTF8String],0,16)]; |
| | | NSString * leijiValue = [NSString stringWithFormat:@"%lu",strtoul([leijiStr UTF8String],0,16)]; |
| | | |
| | | if( leijiValue.length >= 6) |
| | | { |
| | | _JiliangNumLabel.text = [NSString stringWithFormat:@"%.1f",[leijiValue floatValue]*0.10]; |
| | | } |
| | | else |
| | | _JiliangNumLabel.text = [NSString stringWithFormat:@"%.3f",[leijiValue floatValue]*0.10]; |
| | | |
| | | _BiaozhunJiliangNumLabel.text = [NSString stringWithFormat:@"%.3f",([shishiValue floatValue]-45)/10.0*0.10]; |
| | | |
| | | |
| | | //dataModelArr |
| | | DataModel * model = [[DataModel alloc]init]; |
| | | model.value = _BiaozhunJiliangNumLabel.text; |
| | | model.time = [DateUtil stringFromDateYMD:[NSDate date]]; |
| | | [dataModelArr addObject:model]; |
| | | |
| | | circle3.progress = ([leijiValue floatValue]/FUSHE_MAX_VALUE)*100; |
| | | [_trackingSlider setValue:circle3.progress]; |
| | | [self setGaugeValue:circle3.progress animation:NO]; |
| | | |
| | | // 获取包头信息 |
| | | NSString * baoTouStr = [receiveHexValue substringWithRange:NSMakeRange(0,2)]; |
| | | if( [baoTouStr isEqualToString: @"5A"]) |
| | | { |
| | | //获取充电状态 0 没有充电 1 在充电 2充满 |
| | | NSString * chargeStatusStr = [receiveHexValue substringWithRange:NSMakeRange(6,2)]; |
| | | //获取电量 4为4格电 3为3格电 2为2格电 1为1格电 0为馈电状态 |
| | | NSString * dianLiangStr = [receiveHexValue substringWithRange:NSMakeRange(12,2)]; |
| | | // 16进制转10进制 |
| | | NSString * chargeStatusValue = [NSString stringWithFormat:@"%lu",strtoul([chargeStatusStr UTF8String],0,16)]; |
| | | NSString * dianLiangValue = [NSString stringWithFormat:@"%lu",strtoul([dianLiangStr UTF8String],0,16)]; |
| | | |
| | | // 设置电量标志 |
| | | [ic_dianyuan setHidden:NO]; |
| | | switch ([chargeStatusValue intValue]) { |
| | | case 0: |
| | | { |
| | | NSString * imageName = [NSString stringWithFormat:@"icon_b0%d",[dianLiangValue intValue] ]; |
| | | ic_dianyuan.image = [UIImage imageNamed:imageName]; |
| | | } |
| | | break; |
| | | case 1: |
| | | [ic_dianyuan setImage:[UIImage animatedImageWithAnimatedGIFURL:[[NSBundle mainBundle] URLForResource:@"icon_chong" withExtension:@"gif"]]]; |
| | | break; |
| | | case 2: |
| | | ic_dianyuan.image = [UIImage imageNamed:@"icon_full"]; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | //16进制转10进制 |
| | | NSString * shishiStr = [receiveHexValue substringWithRange:NSMakeRange(24,4)]; |
| | | NSString * leijiStr = [receiveHexValue substringWithRange:NSMakeRange(28,8)]; |
| | | |
| | | |
| | | NSString * shishiValue = [NSString stringWithFormat:@"%lu",strtoul([shishiStr UTF8String],0,16)]; |
| | | NSString * leijiValue = [NSString stringWithFormat:@"%lu",strtoul([leijiStr UTF8String],0,16)]; |
| | | |
| | | if( leijiValue.length >= 6) |
| | | { |
| | | _JiliangNumLabel.text = [NSString stringWithFormat:@"%.1f",[leijiValue floatValue]*0.001]; |
| | | } |
| | | else |
| | | _JiliangNumLabel.text = [NSString stringWithFormat:@"%.3f",[leijiValue floatValue]*0.001]; |
| | | |
| | | _BiaozhunJiliangNumLabel.text = [NSString stringWithFormat:@"%.3f",[shishiValue floatValue]*0.001]; |
| | | |
| | | |
| | | //dataModelArr |
| | | DataModel * model = [[DataModel alloc]init]; |
| | | model.value = [_BiaozhunJiliangNumLabel.text floatValue]; |
| | | model.time = [DateUtil stringFromDateYMDHMS:[NSDate date]]; |
| | | model.type = 0; |
| | | model.is_warn = 0; |
| | | |
| | | if(model.value < 0.16) |
| | | { |
| | | // 100 |
| | | circle3.progress = model.value*100; |
| | | _currentShuziTipsLabel.text = @"当前位置安全"; |
| | | _currentTipsLabel.textColor = RgbColor(64, 159, 252); |
| | | _currentTipsLabel.text = @"您所处位置辐射安全,\n 您处于安全区域,可以长时间逗留!"; |
| | | |
| | | // _AnquanStatustLabel.text = @"安全"; |
| | | // _AnquanStatustLabel.textColor = kUIColorFromRGB(0x07cb5a); |
| | | // icon_anquan.image = [UIImage imageNamed:@"icon_anquan"]; |
| | | // ic_anquan_status.image = [UIImage imageNamed:@"ic_anquan_bk"]; |
| | | // ic_weixin_tips.image = [UIImage imageNamed:@"ic_anquan_tips"]; |
| | | // ic_zhishu_bk.image = [UIImage imageNamed:@"bt_green"]; |
| | | // _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | |
| | | if( [shishiValue intValue] < FUSHE_SAFE_VALUE ) |
| | | { |
| | | _currentShuziTipsLabel.text = @"当前位置安全"; |
| | | _currentTipsLabel.textColor = RgbColor(64, 159, 252); |
| | | _currentTipsLabel.text = @"您所处位置辐射安全,\n 您处于安全区域,可以长时间逗留!"; |
| | | } |
| | | else if(model.value >= 0.16 && model.value < 0.8) |
| | | { |
| | | // 100 |
| | | float tempValue = model.value; |
| | | if(tempValue > 0.50) |
| | | tempValue = 0.50; |
| | | |
| | | circle3.progress = tempValue*100; |
| | | _currentShuziTipsLabel.text = @"当前位置有轻微辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(64, 159, 252); |
| | | _currentTipsLabel.text = @"您所处位置辐射轻微,\n 不利于您的健康,请远离到安全区域!"; |
| | | model.is_warn = 1; |
| | | |
| | | _AnquanStatustLabel.text = @"轻微"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0x0d95fe); |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_head_qingwei"]; |
| | | ic_anquan_status.image = [UIImage imageNamed:@"bg_corner_blue"]; |
| | | ic_weixin_tips.image = [UIImage imageNamed:@"icon_qingwei"]; |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"ic_zhishu_bk"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | } |
| | | else if(model.value >= 0.8 && model.value < 2) |
| | | { |
| | | // 264 |
| | | float tempValue = (model.value*100)/266; |
| | | if(tempValue <= 0.50) |
| | | tempValue = 0.51; |
| | | |
| | | circle3.progress = tempValue*100; |
| | | _currentShuziTipsLabel.text = @"当前位置有较高辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射偏高,\n 不利于您的健康,请远离到安全区域!"; |
| | | model.is_warn = 1; |
| | | |
| | | _AnquanStatustLabel.text = @"中度"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0xc240ff); |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_head_zhongfu"]; |
| | | ic_anquan_status.image = [UIImage imageNamed:@"bg_corner_zise"]; |
| | | ic_weixin_tips.image = [UIImage imageNamed:@"icon_zhongdu"]; |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"bt_zise"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | } |
| | | else if(model.value >2) |
| | | { |
| | | // 400 |
| | | |
| | | float tempValue = (model.value*100)/400; |
| | | if(tempValue <= 0.75) |
| | | tempValue = 0.76; |
| | | |
| | | circle3.progress = tempValue*100; |
| | | |
| | | _currentShuziTipsLabel.text = @"当前位置有很严重辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射辐射,\n 不利于您的健康,请远离到安全区域!"; |
| | | model.is_warn = 1; |
| | | |
| | | _AnquanStatustLabel.text = @"危险"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0xff4e63); |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_weixian"]; |
| | | ic_anquan_status.image = [UIImage imageNamed:@"ic_weixian_bk"]; |
| | | ic_weixin_tips.image = [UIImage imageNamed:@"icon_yanzhong"]; |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"ic_yanzhong_tips"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | } |
| | | |
| | | [_trackingSlider setValue:circle3.progress]; |
| | | [self setGaugeValue:circle3.progress animation:NO]; |
| | | |
| | | [dataModelArr addObject:model]; |
| | | } |
| | | else if ( [shishiValue intValue] < FUSHE_GOOD_VALUE) |
| | | } |
| | | else if(receiveHexValue.length == 16 ) |
| | | { |
| | | // 获取包头信息 |
| | | NSString * baoTouStr = [receiveHexValue substringWithRange:NSMakeRange(0,2)]; |
| | | if( [baoTouStr isEqualToString: @"7A"]) |
| | | { |
| | | _currentShuziTipsLabel.text = @"当前位置有轻微辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(64, 159, 252); |
| | | _currentTipsLabel.text = @"您所处位置辐射轻微,\n 不利于您的健康,请远离到安全区域!"; |
| | | 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; |
| | | |
| | | [dataModelArr addObject:model]; |
| | | } |
| | | else if ( [shishiValue intValue] < FUSHE_CHA_VALUE) |
| | | { |
| | | _currentShuziTipsLabel.text = @"当前位置辐射超标"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射超标,\n 不利于您的健康,请远离到安全区域!"; |
| | | } |
| | | else if ( [shishiValue intValue] < FUSHE_DANGER_VALUE) |
| | | { |
| | | _currentShuziTipsLabel.text = @"当前位置有较高辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射偏高,\n 不利于您的健康,请远离到安全区域!"; |
| | | } |
| | | else if ( [shishiValue intValue] < FUSHE_MAX_VALUE) |
| | | { |
| | | _currentShuziTipsLabel.text = @"当前位置有很高辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射偏高,\n 不利于您的健康,请远离到安全区域!"; |
| | | } |
| | | else |
| | | { |
| | | _currentShuziTipsLabel.text = @"当前位置有很高辐射"; |
| | | _currentTipsLabel.textColor = RgbColor(252, 80, 84); |
| | | _currentTipsLabel.text = @"您所处位置辐射很高,\n 不利于您的健康,请远离到安全区域!"; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | //NSString * shishiStr = [receiveHexValue substringWithRange:NSMakeRange(0,4)]; |
| | | } |
| | | |
| | | //NSString *ASCIIValue = [[NSString alloc]initWithData:characteristic.value encoding:NSASCIIStringEncoding]; |
| | |
| | | //关闭定时器 |
| | | if(myTimer) |
| | | [myTimer setFireDate:[NSDate distantFuture]]; |
| | | |
| | | //关闭定时器 |
| | | if(myScanTimer) |
| | | [myScanTimer setFireDate:[NSDate distantFuture]]; |
| | | } |
| | | |
| | | -(void)viewWillAppear:(BOOL)animated |
| | |
| | | //[[CBMoralManager sharedManager] disconnectPeripheral:[[CBMoralManager sharedManager] myPeripheral]]; |
| | | [[CBMoralManager sharedManager] setCbDiscoveryDelegate:self]; |
| | | [[CBMoralManager sharedManager] startScanning]; |
| | | [self performSelector:@selector(stopScanning) withObject:nil afterDelay:3.0f]; |
| | | [self performSelector:@selector(stopScanning2) withObject:nil afterDelay:3.0f]; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | -(void)stopScanning2 |
| | | { |
| | | [[CBMoralManager sharedManager]stopScanning]; |
| | | |
| | | // 判断是否开启重连定时 |
| | | if(_bConnectSuccess == NO) |
| | | { |
| | | if (myScanTimer == nil) |
| | | myScanTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(continueScanning) userInfo:nil repeats:YES]; |
| | | else |
| | | //开启定时器 |
| | | [myScanTimer setFireDate:[NSDate distantPast]]; |
| | | } |
| | | } |
| | | |
| | | |
| | | -(void)stopScanning |
| | | { |
| | | [[CBMoralManager sharedManager]stopScanning]; |
| | | } |
| | | |
| | | -(void)continueScanning |
| | | { |
| | | [[CBMoralManager sharedManager] startScanning]; |
| | | [self performSelector:@selector(stopScanning) withObject:nil afterDelay:3.0f]; |
| | | } |
| | | |
| | | #pragma mark - BlueTooth Turned Off Delegate |
| | |
| | | isBluetoothON = state; |
| | | |
| | | // 提示打开蓝牙设备 |
| | | |
| | | if(isBluetoothON == NO) |
| | | { |
| | | [Global alertMessageEx:@"蓝牙功能未开启,请开启蓝牙功能!" title:@"温馨提示" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | // 判断是否开启重连定时 |
| | | if(_bConnectSuccess == YES) |
| | | { |
| | | //关闭上传数据定时器 |
| | | if(myTimer) |
| | | [myTimer setFireDate:[NSDate distantFuture]]; |
| | | |
| | | [self offLineSet]; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | // 判断是否开启重连定时 |
| | | if(_bConnectSuccess == NO) |
| | | { |
| | | if (myScanTimer == nil) |
| | | myScanTimer = [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(continueScanning) userInfo:nil repeats:YES]; |
| | | else |
| | | //开启定时器 |
| | | [myScanTimer setFireDate:[NSDate distantPast]]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | *This method invoke after a new peripheral found. |
| | | *This method invoke after a new peripheral found. 蓝牙检索成功 开始连接 |
| | | */ |
| | | -(void)discoveryDidRefresh |
| | | { |
| | |
| | | { |
| | | if(success) |
| | | { |
| | | //关闭定时器 连接成功 |
| | | if(myScanTimer) |
| | | [myScanTimer setFireDate:[NSDate distantFuture]]; |
| | | |
| | | [self onLineSet]; |
| | | |
| | | deviceStstaus = 1; |
| | | deviceStatusLabel.text = @"已连接"; |
| | | |
| | |
| | | ic_anquan_status.image = [UIImage imageNamed:@"ic_anquan_bk"]; |
| | | [ic_head_bg addSubview:ic_anquan_status]; |
| | | |
| | | ic_dianyuan = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-40-ic_anquan_status.frame.size.width/2, 44*scale + 40, 40, 40)]; |
| | | //ic_dianyuan.image = [UIImage imageNamed:@"icon_b04"]; |
| | | [ic_dianyuan setImage:[UIImage animatedImageWithAnimatedGIFURL:[[NSBundle mainBundle] URLForResource:@"icon_chong" withExtension:@"gif"]]]; |
| | | [ic_dianyuan setHidden:YES]; |
| | | [self.view addSubview:ic_dianyuan]; |
| | | |
| | | UIImageView * ic_line = [[UIImageView alloc] initWithFrame:CGRectMake(ic_head_bg.frame.size.width/2, 13*scale, 1, 40*scale)]; |
| | | ic_line.image = [UIImage imageNamed:@"ic_line"]; |
| | | [ic_head_bg addSubview:ic_line]; |
| | |
| | | [ic_head_bg addSubview:_BiaozhunJiliangNumLabel]; |
| | | |
| | | |
| | | UIImageView * icon_anquan = [[UIImageView alloc] initWithFrame:CGRectMake(19*scale, 10*scale, 22*scale, 22*scale)]; |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_anquan"]; |
| | | icon_anquan = [[UIImageView alloc] initWithFrame:CGRectMake(19*scale, 10*scale, 22*scale, 22*scale)]; |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_head_offline"]; |
| | | [ic_anquan_status addSubview:icon_anquan]; |
| | | |
| | | |
| | | GloriaLabel* _AnquanStatustLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, 35*scale,60*scale, 20*scale)]; |
| | | _AnquanStatustLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(0, 35*scale,60*scale, 20*scale)]; |
| | | _AnquanStatustLabel.font = [UIFont systemFontOfSize:unitFontSize]; |
| | | _AnquanStatustLabel.textAlignment = UITextAlignmentCenter; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0x07cb5a); |
| | |
| | | [ic_anquan_status addSubview:_AnquanStatustLabel]; |
| | | |
| | | |
| | | UIImageView * ic_zhishu_bk = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-245*scale)/2, (66+20+292+20)*scale, 245*scale, 48*scale)]; |
| | | ic_zhishu_bk = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-245*scale)/2, (66+20+292+20)*scale, 245*scale, 48*scale)]; |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"ic_zhishu_bk"]; |
| | | [self.view addSubview:ic_zhishu_bk]; |
| | | |
| | |
| | | _currentTipsLabel.text = @"未开始检测"; |
| | | [ic_bottom_bg addSubview:_currentTipsLabel]; |
| | | |
| | | UIImageView * ic_weixin_tips = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-34*scale)/2, -17*scale, 34*scale, 34*scale)]; |
| | | ic_weixin_tips = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-34*scale)/2, -17*scale, 34*scale, 34*scale)]; |
| | | ic_weixin_tips.image = [UIImage imageNamed:@"ic_weixin_tips"]; |
| | | [ic_bottom_bg addSubview:ic_weixin_tips]; |
| | | |
| | |
| | | circle3.reduceValue = 72; |
| | | circle3.increaseFromLast = YES; |
| | | circle3.pointImage = [UIImage imageNamed:@"test_point"]; |
| | | circle3.progress = ((float)850/FUSHE_MAX_VALUE); |
| | | //circle3.progress = 0; |
| | | //circle3.progress = ((float)850/FUSHE_MAX_VALUE); |
| | | circle3.progress = 0; |
| | | circle3.showProgressText = NO; |
| | | circle3.userInteractionEnabled = NO; |
| | | [ic_zhuanpan_bkBtn addSubview:circle3]; |
| | |
| | | { |
| | | self.navigationController.navigationBar.translucent = NO; |
| | | } |
| | | _locService = [[BMKLocationService alloc]init]; |
| | | |
| | | _locService.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; |
| | | |
| | | [self startLocation]; |
| | | //_locService = [[BMKLocationService alloc]init]; |
| | | //_locService.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; |
| | | //[self startLocation]; |
| | | |
| | | dataModelArr = [[NSMutableArray alloc] init]; |
| | | |
| | | myTimeInterval = [UserDefault stringForKey:@"refresh_frequency"]; |
| | | is_open_upload = [UserDefault stringForKey:@"is_open_upload"]; |
| | | |
| | | [self offLineSet]; |
| | | //myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(function:) userInfo:nil repeats:YES]; |
| | | //每1秒运行一次function方法。 |
| | | |
| | | } |
| | | |
| | | -(void)offLineSet |
| | | { |
| | | _AnquanStatustLabel.text = @"离线"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0x848787); |
| | | deviceStatusLabel.text = @"未连接"; |
| | | deviceStatusLabel.textColor = kUIColorFromRGB(0x848787); |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_head_offline"]; |
| | | ic_anquan_status.image = [UIImage imageNamed:@"bg_corner_gray"]; |
| | | ic_weixin_tips.image = [UIImage imageNamed:@"icon_offline"]; |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"bt_offline"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | } |
| | | |
| | | -(void)onLineSet |
| | | { |
| | | deviceStatusLabel.textColor = RgbColor(64, 159, 252); |
| | | _AnquanStatustLabel.text = @"安全"; |
| | | _AnquanStatustLabel.textColor = kUIColorFromRGB(0x07cb5a); |
| | | icon_anquan.image = [UIImage imageNamed:@"icon_anquan"]; |
| | | ic_anquan_status.image = [UIImage imageNamed:@"ic_anquan_bk"]; |
| | | ic_weixin_tips.image = [UIImage imageNamed:@"ic_anquan_tips"]; |
| | | ic_zhishu_bk.image = [UIImage imageNamed:@"bt_green"]; |
| | | _currentTipsLabel.textColor = kUIColorFromRGB(0x848787); |
| | | |
| | | } |
| | | |
| | | -(void)connectAction |
| | | { |
| | | SearchDevicePage* page = [[SearchDevicePage alloc] initIsFirstPage:NO]; |
| | | |
| | | |
| | | BaseNaviController *baseNav = [[BaseNaviController alloc] initWithRootViewController:page]; |
| | | [self presentViewController:baseNav animated:YES completion:nil]; |
| | | } |
| | |
| | | |
| | | //['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 = [[NSMutableArray alloc] init]; |
| | | [model.data addObjectsFromArray:dataModelArr]; |
| | | |
| | | MPWeakSelf(self); |
| | | [NetworkSingleton networkingGetMethod:model.toDic urlName:path success:^(id responseBody) |
| | |
| | | failure:^(NSString *error) |
| | | { |
| | | |
| | | [Global alertMessageEx:error title:@"获取失败" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | [Global alertMessageEx:error title:@"提示信息" okTtitle:nil cancelTitle:@"OK" delegate:self]; |
| | | }]; |
| | | } |
| | | |