|
|
@@ -10,6 +10,8 @@
|
|
|
#import <ImageIO/ImageIO.h>
|
|
|
#import "MySetViewController.h"
|
|
|
#import "RSATool.h"
|
|
|
+#import "connectDeviceManager.h"
|
|
|
+
|
|
|
@interface QRCodeScanForChangeDeviceViewController ()<AVCaptureMetadataOutputObjectsDelegate,AVCaptureVideoDataOutputSampleBufferDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>
|
|
|
|
|
|
@property(nonatomic,strong)AVCaptureVideoPreviewLayer *layer;
|
|
|
@@ -238,13 +240,26 @@ bool isDownType22 = YES;
|
|
|
|| resStr.length == @"0333933700223250017273".length
|
|
|
){
|
|
|
|
|
|
- [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)] show];
|
|
|
- [_scanLineTimer invalidate];
|
|
|
-
|
|
|
NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
|
|
|
- NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
|
|
|
- [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
|
|
|
- [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
|
|
|
+ if (!deviceDict || [[deviceDict allKeys] containsObject:Const_Have_Add_Device_SN]){
|
|
|
+ NSString *oldStr = deviceDict[Const_Have_Add_Device_SN];
|
|
|
+ if([oldStr isEqualToString:resStr]){
|
|
|
+ [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_change_same",nil)] show];
|
|
|
+
|
|
|
+ //停止扫描
|
|
|
+ [self.session stopRunning];
|
|
|
+
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ [self.session startRunning];
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //[[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)] show];
|
|
|
+ [_scanLineTimer invalidate];
|
|
|
|
|
|
//停止扫描
|
|
|
[self.session stopRunning];
|
|
|
@@ -252,15 +267,32 @@ bool isDownType22 = YES;
|
|
|
//移除扫描层layer
|
|
|
[self.layer removeFromSuperlayer];
|
|
|
|
|
|
- for (UIViewController *vc in [self.navigationController viewControllers]) {
|
|
|
- if ([vc isKindOfClass:[MySetViewController class]]){
|
|
|
- [self.navigationController popToViewController:vc animated:YES];
|
|
|
- break;
|
|
|
+// for (UIViewController *vc in [self.navigationController viewControllers]) {
|
|
|
+// if ([vc isKindOfClass:[MySetViewController class]]){
|
|
|
+// [self.navigationController popToViewController:vc animated:YES];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
|
|
|
+ [[connectDeviceManager shareInstance] getThridMsgBySN:resStr didNetEnd:^(bool didSuc) {
|
|
|
+
|
|
|
+ [self removeNewIndicatorHaveStr];
|
|
|
+
|
|
|
+ if(didSuc){
|
|
|
+
|
|
|
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
|
|
|
+ [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
|
|
|
+ [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
+ }else{
|
|
|
+ [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
|
|
|
}
|
|
|
- }
|
|
|
+ }];
|
|
|
}
|
|
|
}else{
|
|
|
- [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_error",nil)] show];
|
|
|
+ //[[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_error",nil)] show];
|
|
|
NSLog(@"没有扫描到数据");
|
|
|
}
|
|
|
}
|