构建版本V9.9.8提交

This commit is contained in:
wbzhan
2019-07-22 15:15:01 +08:00
parent e8fd85f3dd
commit 0b7755866e
6 changed files with 107 additions and 65 deletions
@@ -11,8 +11,6 @@
#import "MineKanHuNotBindSecondViewCell.h"
#import "MineKanHuNormalViewCell.h"
#import "PushMasssageWebViewController.h"
#import "YooseConnectFirstViewController.h"
//#import "IfishSelectCardViewController.h"
#import "IfishBindDeviceSelectViewController.h"
#import "IfishCameraModel.h"
#define CELL_KANHURAG1 555
@@ -23,9 +23,11 @@
BOOL _isCanAutoOrientation;//限制屏幕什么时候可以旋转
BOOL _connectDevice; //是否连接设备
BOOL _isStop;//是否暂停 用于区分是 暂停按钮 还是 连接失败按钮
BOOL _connectDevice; //是否连接到了P2P
BOOL _isConnectCamera;//是否连接到设备
BOOL _isconnecting;//是否正在连接摄像头
int _OnLine;
}
@end
@@ -38,6 +40,7 @@
self.isVideoModeHD = NO;
_isReject=YES;
_isStop = NO;
_isconnecting = NO;
[self addTitleViewWithTitle:@"看护"];
[self connectDevice];
//监控竖屏时,各控件初始化(先)
@@ -74,23 +77,45 @@
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
//初始化设备
if (!_connectDevice) {
NSLog(@"正在初始化设备");
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
NSLog(@"正在检查P2P连接状态");
_connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
if (_connectDevice) {
[self connectCamera];
}else{
NSLog(@"p2pConnect failure.失败,不能操作设备");
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.view makeToast:@"连接失败"];
[self hiddenMonitoringUI:NO callWithErrorType:GWP2PCallErrorNone isReCall:NO];
});
}
}
}
//连接到摄像头
-(void)connectCamera{
if (!_isconnecting) {
_isconnecting = YES;//正在连接中
NSString *newPassword = GIWEI_INITPASS;
NSString *cameraPass = [Utils GetTreatedPassword:newPassword];
[[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:self.kanHuCamera.cameraId password:cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
// [self outputLog:dataDictionary success:success];
_isconnecting = NO;
//获取成功,打印设备信息,之后连接设备
if (success) {
NSLog(@"观看直播连接设备信息:%@",dataDictionary);
_isConnectCamera = YES;
[self monitorP2PCall];
NSLog(@"当前连接设备信息:%@",dataDictionary);
}else{
_isConnectCamera = NO;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.view makeToast:@"连接失败"];
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:NO];
});
return;
}
}];
}
if(!_connectDevice){//p2p连接失败
NSLog(@"p2pConnect failure.失败,不能操作设备");
[self hiddenMonitoringUI:YES callWithErrorType:GWP2PCallErrorTimeout isReCall:NO];
return;
}else{
//设备连接中
}
}
#pragma mark --尝试连接摄像头
@@ -99,12 +124,14 @@
return;
}
//p2p未连接
if (!_connectDevice) {
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
[self connectDevice];
if(_connectDevice){
// 连接摄像头
[self monitorP2PCall];
}
return;
}
//未连接到设备
if (!_isConnectCamera) {
[self connectCamera];
return;
}
WEAK_SELF;
NSString *newPassword = GIWEI_INITPASS;