修复链接摄像头的相关问题V1

This commit is contained in:
wbzhan_macbook 2019-07-19 08:39:11 +08:00
parent 43bfceb262
commit aade501983
6 changed files with 70 additions and 96 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -15395,7 +15395,6 @@
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YSlider", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YSlider",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YTargetAndAction", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YTargetAndAction",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/FounderButton", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/FounderButton",
"$(PROJECT_DIR)/Ifish/BaiLingSoundSdk/LSemTMFSet",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",
@ -15509,7 +15508,6 @@
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YSlider", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YSlider",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YTargetAndAction", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/YTargetAndAction",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/FounderButton", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYooseeHelper/YooseeExtureLibs/FounderButton",
"$(PROJECT_DIR)/Ifish/BaiLingSoundSdk/LSemTMFSet",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",

View File

@ -64,13 +64,13 @@ extern BOOL isfromCameraView;
return; return;
} }
dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT); dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{ dispatch_async(queue, ^{
// // 1 // // 1
// self.islogInGewell = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil]; if ([GWP2PClient sharedClient].linkStatus!=P2PLinkStatusOK) {
[[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
}
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[SVProgressHUD dismiss]; [SVProgressHUD dismiss];

View File

@ -153,8 +153,8 @@ Strong UIImage *screenShotImage;//截图
} }
if ([self.contact.isActive isEqualToString:@"1"]) { if ([self.contact.isActive isEqualToString:@"1"]) {
[self cameraConnectSeting]; [self monitorP2PCall];
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES];
}else if ([self.contact.isActive isEqualToString:@"0"]){ }else if ([self.contact.isActive isEqualToString:@"0"]){
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"" message:@"请扫描产品外包装上的激活码来激活摄像头" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往扫描", nil]; UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"" message:@"请扫描产品外包装上的激活码来激活摄像头" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往扫描", nil];
@ -163,16 +163,6 @@ Strong UIImage *screenShotImage;//截图
} }
} }
//tab
-(void)cameraConnectSeting{
//rtsp
[self monitorP2PCall];
//
if (_isPushNextView) {
return;
}
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES];
}
// //
-(void)checkNetStatus{ -(void)checkNetStatus{
@ -274,7 +264,9 @@ Strong UIImage *screenShotImage;//截图
} }
#pragma mark - p2pConnect #pragma mark - p2pConnect
-(void)connectDevice{ -(void)connectDevice{
if ([GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) {
_connectDevice = YES;
}
UserModel *model=[dataContorl getUserInfo]; UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff]; NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
// //
@ -303,11 +295,11 @@ Strong UIImage *screenShotImage;//截图
return; return;
} }
//p2p //p2p
if (!_connectDevice) { if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
[self connectDevice]; [self connectDevice];
if(_connectDevice){ if(_connectDevice){
// //
[self monitorP2PCall]; [self monitorP2PCall];
} }
} }
WEAK_SELF; WEAK_SELF;
@ -330,6 +322,7 @@ Strong UIImage *screenShotImage;//截图
}); });
} ready:^{ } ready:^{
[self.view makeToast:@"连接成功"];
// //
NSLog(@"连接摄像头成功 当前所在线程为%@",[NSThread currentThread]); NSLog(@"连接摄像头成功 当前所在线程为%@",[NSThread currentThread]);
//UI //UI
@ -730,7 +723,6 @@ Strong UIImage *screenShotImage;//截图
if (self.contact.cameraId == model.cameraId ) { if (self.contact.cameraId == model.cameraId ) {
[guanxiiArr removeObject:model]; [guanxiiArr removeObject:model];
// //
[[DataCenter defaultDtacenter] setValue:guanxiiArr forKey:@"devicamerArr"]; [[DataCenter defaultDtacenter] setValue:guanxiiArr forKey:@"devicamerArr"];
@ -753,7 +745,6 @@ Strong UIImage *screenShotImage;//截图
UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"]; UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
NSString *cameraId=self.contact.cameraId; NSString *cameraId=self.contact.cameraId;
;
NSNumber *userId=model.userId; NSNumber *userId=model.userId;
[para setValue:cameraId forKey:@"cameraId"]; [para setValue:cameraId forKey:@"cameraId"];

View File

@ -47,7 +47,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
@property (strong,nonatomic) NSMutableDictionary *addresses; @property (strong,nonatomic) NSMutableDictionary *addresses;
//技威服务器 socket返回contactID 即cameraId //技威服务器 socket返回contactID 即cameraId
@property (nonatomic,copy) NSString *contactID; //@property (nonatomic,copy) NSString *contactID;
@property (nonatomic,assign) NSInteger flag; @property (nonatomic,assign) NSInteger flag;
@property (nonatomic,assign) NSInteger type; @property (nonatomic,assign) NSInteger type;
@property (nonatomic,copy) NSString *address; @property (nonatomic,copy) NSString *address;
@ -393,68 +393,76 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
[self.view makeToast:@"声波配网成功"]; [self.view makeToast:@"声波配网成功"];
//如果智能联机,设备配网成功,就断开发送智能联机 //如果智能联机,设备配网成功,就断开发送智能联机
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink]; [[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
NSString *deviceID = [deviceDict[@"deviceID"] stringValue]; NSString *deviceID = [deviceDict[@"deviceID"] stringValue];
NSString *deviceIP = deviceDict[@"deviceIP"]; NSString *deviceIP = deviceDict[@"deviceIP"];
NSString *devicePassword = deviceDict[@"devicePassword"]; NSString *devicePassword = deviceDict[@"devicePassword"];
weakSelf.contactID = [NSString stringWithFormat:@"%d",deviceID]; weakSelf.deviceID = deviceID;
if (![deviceDict[@"isInitPassword"] boolValue]) { //设备没有初始化密码,设置密码 [self resetPassWord];//初始化密码
//如果重置之后,则重新设置密码
if (IsEmptyStr(devicePassword)) { //设备没有初始化密码,设置密码
[[GWP2PClient sharedClient] setDeviceInitialPassword:@"123" withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) { [[GWP2PClient sharedClient] setDeviceInitialPassword:@"123" withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"success:%i %@",success,dataDictionary); NSLog(@"success:%i %@",success,dataDictionary);
[weakSelf.view makeToast:[NSString stringWithFormat:@"未初始化过设备密码,初始化设备密码失败 result = %i",dataDictionary]];
[weakSelf resetPassWord];//初始化密码 [weakSelf resetPassWord];//初始化密码
if (success) { [weakSelf bindCameraDevice];
[weakSelf initPwdResault:dataDictionary]; // if (success) {
}else{ // [weakSelf initPwdResault:dataDictionary];
dispatch_async(dispatch_get_main_queue(), ^{ // }else{
//只为做 dissPogress处理并非成功 // dispatch_async(dispatch_get_main_queue(), ^{
weakSelf.lodviewMissStyle =lodingViewdissMissSuccsess; // //只为做 dissPogress处理并非成功
[weakSelf connectNormalView]; // weakSelf.lodviewMissStyle =lodingViewdissMissSuccsess;
_canDissMissController = YES; // [weakSelf connectNormalView];
// _canDissMissController = YES;
// [weakSelf.view makeToast:NSLocalizedString(@"operator_failure", nil)]; // [weakSelf.view makeToast:NSLocalizedString(@"operator_failure", nil)];
}); // });
} // }
}]; }];
} else { }else{
//设备已经初始化过密码,则直接获取设备信息
[[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) { [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"success:%i %@",success,dataDictionary); NSLog(@"success:%i %@",success,dataDictionary);
[weakSelf.view makeToast:[NSString stringWithFormat:@"获取设备信息失败 result = %i",dataDictionary]];
[weakSelf resetPassWord];//更新密码 [weakSelf resetPassWord];//更新密码
if (success) { [weakSelf bindCameraDevice];
dispatch_async(dispatch_get_main_queue(), ^{
//[self.view makeToast:NSLocalizedString(@"operator_success", nil)];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
usleep(800000);
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf ifishUserBindcameraIdBy:self.contactID];
});
});
});
}else{
dispatch_async(dispatch_get_main_queue(), ^{
self.lodviewMissStyle =lodingViewdissMissSuccsess;
[self connectNormalView];
_canDissMissController = YES;
// [self.view makeToast:NSLocalizedString(@"operator_failure", nil)];
});
}
}]; }];
} }
// else {
// //设备已经初始化过密码,则直接获取设备信息
// [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
// NSLog(@"success:%i %@",success,dataDictionary);
// [weakSelf resetPassWord];//更新密码
// if (success) {
// dispatch_async(dispatch_get_main_queue(), ^{
// //[self.view makeToast:NSLocalizedString(@"operator_success", nil)];
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// usleep(800000);
// dispatch_async(dispatch_get_main_queue(), ^{
//
// [weakSelf ifishUserBindcameraIdBy:self.contactID];
//
// });
// });
// });
// }else{
// dispatch_async(dispatch_get_main_queue(), ^{
//
// self.lodviewMissStyle =lodingViewdissMissSuccsess;
// [self connectNormalView];
// _canDissMissController = YES;
// [self.view makeToast:NSLocalizedString(@"operator_failure", nil)];
//
// });
// }
// }];
// }
}]; }];
} }
//初始化设备密码回调 //初始化设备密码回调
-(void)initPwdResault:(NSDictionary *)parameter{ -(void)bindCameraDevice{
NSString * contactName = [NSString stringWithFormat:@"Cam%@", self.contactID]; NSString * contactName = [NSString stringWithFormat:@"Cam%@", self.deviceID];
ContactDAO *contactDAO = [[ContactDAO alloc] init]; ContactDAO *contactDAO = [[ContactDAO alloc] init];
Contact *contact = [contactDAO isContact:self.contactID]; Contact *contact = [contactDAO isContact:self.deviceID];
if(contact!=nil){ if(contact!=nil){
@ -464,39 +472,18 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
[[FListManager sharedFList] updatee:contact]; [[FListManager sharedFList] updatee:contact];
dispatch_async(dispatch_get_main_queue(), ^{ [self ifishUserBindcameraIdBy:self.deviceID];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
usleep(800000);
dispatch_async(dispatch_get_main_queue(), ^{
//设置密码成功后爱鱼奇用户绑定摄像头
[self ifishUserBindcameraIdBy:self.contactID];
});
});
});
}else{ }else{
Contact *contact = [[Contact alloc] init]; Contact *contact = [[Contact alloc] init];
contact.contactId = self.contactID; contact.contactId = self.deviceID;
contact.contactName = contactName; contact.contactName = contactName;
contact.contactPassword = self.lastSetPassword; contact.contactPassword = self.lastSetPassword;
contact.contactType = CONTACT_TYPE_UNKNOWN; contact.contactType = CONTACT_TYPE_UNKNOWN;
[[FListManager sharedFList] insert:contact]; [[FListManager sharedFList] insert:contact];
//设置密码成功后爱鱼奇用户绑定摄像头
dispatch_async(dispatch_get_main_queue(), ^{ [self ifishUserBindcameraIdBy:self.deviceID];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
usleep(800000);
dispatch_async(dispatch_get_main_queue(), ^{
//设置密码成功后爱鱼奇用户绑定摄像头
[self ifishUserBindcameraIdBy:self.contactID];
});
});
});
} }
} }
@ -638,12 +625,11 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
-(void)ifishUserBindcameraIdBy:(NSString *)cameraId -(void)ifishUserBindcameraIdBy:(NSString *)cameraId
{ {
NSLog(@"cameraId = %@",cameraId);
NSMutableArray *oldCameraArr= [[DataCenter defaultDtacenter]valueForKey:@"cameraArr"]; NSMutableArray *oldCameraArr= [[DataCenter defaultDtacenter]valueForKey:@"cameraArr"];
if (!oldCameraArr) { if (!oldCameraArr) {
//无设备 //无设备
oldCameraArr = [[NSMutableArray alloc] init]; oldCameraArr = [[NSMutableArray alloc] init];
} }
IfishCameraModel *camer=[[IfishCameraModel alloc] init]; IfishCameraModel *camer=[[IfishCameraModel alloc] init];

View File

@ -389,7 +389,6 @@
camera.isActive = @"1"; camera.isActive = @"1";
} }
[newCamerArr addObject:camera]; [newCamerArr addObject:camera];