修复链接摄像头的相关问题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/YTargetAndAction",
"$(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/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/YTargetAndAction",
"$(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/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",

View File

@ -64,13 +64,13 @@ extern BOOL isfromCameraView;
return;
}
dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{
// // 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(), ^{
[SVProgressHUD dismiss];

View File

@ -152,9 +152,9 @@ Strong UIImage *screenShotImage;//截图
return;
}
if ([self.contact.isActive isEqualToString:@"1"]) {
[self cameraConnectSeting];
[self monitorP2PCall];
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES];
}else if ([self.contact.isActive isEqualToString:@"0"]){
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{
@ -274,7 +264,9 @@ Strong UIImage *screenShotImage;//截图
}
#pragma mark - p2pConnect
-(void)connectDevice{
if ([GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) {
_connectDevice = YES;
}
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
//
@ -303,11 +295,11 @@ Strong UIImage *screenShotImage;//截图
return;
}
//p2p
if (!_connectDevice) {
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
[self connectDevice];
if(_connectDevice){
//
[self monitorP2PCall];
//
[self monitorP2PCall];
}
}
WEAK_SELF;
@ -330,6 +322,7 @@ Strong UIImage *screenShotImage;//截图
});
} ready:^{
[self.view makeToast:@"连接成功"];
//
NSLog(@"连接摄像头成功 当前所在线程为%@",[NSThread currentThread]);
//UI
@ -730,7 +723,6 @@ Strong UIImage *screenShotImage;//截图
if (self.contact.cameraId == model.cameraId ) {
[guanxiiArr removeObject:model];
//
[[DataCenter defaultDtacenter] setValue:guanxiiArr forKey:@"devicamerArr"];
@ -753,7 +745,6 @@ Strong UIImage *screenShotImage;//截图
UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
NSString *cameraId=self.contact.cameraId;
;
NSNumber *userId=model.userId;
[para setValue:cameraId forKey:@"cameraId"];

View File

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

View File

@ -388,7 +388,6 @@
if ([camera.cameraId isEqualToString:cameraId]) {
camera.isActive = @"1";
}