From 1d39caf7235522ae121db7a188ba41a706217407 Mon Sep 17 00:00:00 2001
From: 单军华 <WindShan@danjunhuas-MacBook-Pro.local>
Date: Sat, 28 Apr 2018 09:39:49 +0800
Subject: [PATCH] 清理多余代码,优化
---
pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m | 409 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 323 insertions(+), 86 deletions(-)
diff --git a/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m b/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m
index 5522fb7..6f3aebc 100644
--- a/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m
+++ b/pregnancy_guard/BaseProject/Controller/Home/RadiaDetectionPage.m
@@ -16,17 +16,19 @@
#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"
+#import "UploadData.h"
@interface RadiaDetectionPage ()<ASValueTrackingSliderDelegate,ASValueTrackingSliderDataSource,cbCharacteristicManagerDelegate,BMKMapViewDelegate,BMKLocationServiceDelegate>
{
@@ -72,9 +74,17 @@
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
@@ -192,6 +202,17 @@
}
}
+
+-(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
* ������������������������
@@ -203,71 +224,171 @@
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;
+ model.time = [DateUtil stringFromDateYMDHMS:[NSDate date]];
+ model.type = @"0";
+ model.is_warn = @"0";
+
+ if([model.value floatValue] < 0.16)
+ {
+ // 100
+ circle3.progress = [model.value floatValue]*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 floatValue] >= 0.16 && [model.value floatValue] < 0.8)
+ {
+ // 100
+ float tempValue = [model.value floatValue];
+ 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 floatValue] >= 0.8 && [model.value floatValue] < 2)
+ {
+ // 264
+ float tempValue = ([model.value floatValue]*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 floatValue] >2)
+ {
+ // 400
+
+ float tempValue = ([model.value floatValue]*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;
+ model.time = [DateUtil stringFromDateYMDHMS:[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];
@@ -429,6 +550,10 @@
//���������������
if(myTimer)
[myTimer setFireDate:[NSDate distantFuture]];
+
+ //���������������
+ if(myScanTimer)
+ [myScanTimer setFireDate:[NSDate distantFuture]];
}
-(void)viewWillAppear:(BOOL)animated
@@ -446,6 +571,12 @@
{
deviceStstaus = 1;
deviceStatusLabel.text = @"���������";
+
+ //��������������� ������������
+ if(myScanTimer)
+ [myScanTimer setFireDate:[NSDate distantFuture]];
+
+ [self onLineSet];
// ������������������������
NSArray *allService = [self UUIDArray:[[[CBMoralManager sharedManager] serviceUUIDDict] allKeys]];
@@ -480,15 +611,37 @@
//[[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
@@ -505,12 +658,37 @@
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
{
@@ -532,6 +710,12 @@
{
if(success)
{
+ //��������������� ������������
+ if(myScanTimer)
+ [myScanTimer setFireDate:[NSDate distantFuture]];
+
+ [self onLineSet];
+
deviceStstaus = 1;
deviceStatusLabel.text = @"���������";
@@ -697,6 +881,12 @@
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];
@@ -740,12 +930,12 @@
[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);
@@ -753,7 +943,7 @@
[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];
@@ -777,7 +967,7 @@
_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];
@@ -793,8 +983,8 @@
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];
@@ -825,26 +1015,65 @@
{
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];
+// 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"];
+ [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];
}
@@ -946,23 +1175,31 @@
-(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];
@@ -985,7 +1222,7 @@
failure:^(NSString *error)
{
- [Global alertMessageEx:error title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
+ [Global alertMessageEx:error title:@"������������" okTtitle:nil cancelTitle:@"OK" delegate:self];
}];
}
--
Gitblit v1.8.0