构建版本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
@@ -37,7 +37,6 @@
#define DESCREPTION_CAMERANAME3_TAG 3013
#define DESCREPTION_CAMERANAME4_TAG 3014
#import "YooseConnectFirstViewController.h"
#import "DeviceCameraModel.h"
#import "IfishP2PMonitorController.h"
@@ -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;
@@ -73,11 +73,13 @@
UIButton* _btnDefence;
BOOL _isCanAutoOrientation;//
BOOL _connectDevice; //
BOOL _connectDevice; //P2P
BOOL _isConnectCamera;//
BOOL _isStop;//
dispatch_queue_t _xutoMainQueue;
BOOL _isPushNextView; //push下级界面
BOOL _isNewXuanduo; //
BOOL _isconnecting;//
}
@property(nonatomic,strong) SetTimeController*SetTimeVC;
@@ -236,6 +238,7 @@ Strong UIImage *screenShotImage;//截图
_isReject=YES;
_isStop = NO;
_isPushNextView = NO;
_isConnectCamera = NO;
if ([self.contact.isActive isEqualToString:@"1"]) {
[self connectDevice];
}
@@ -276,26 +279,44 @@ Strong UIImage *screenShotImage;//截图
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
//
if (!_connectDevice) {
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
NSLog(@"正在检查P2P连接状态");
if ([GWP2PClient sharedClient].linkStatus == P2PLinkStatusOK) {
[[GWP2PClient sharedClient] disconnect];
}
_connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
if (_connectDevice) {
[[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:self.contact.cameraId password:self.contact.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
//
if (success) {
NSLog(@"当前连接设备信息:%@",dataDictionary);
}
}];
[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];
});
}
}
if(!_connectDevice){//p2p连接失败
NSLog(@"p2pConnect failure.失败,不能操作设备");
[self hiddenMonitoringUI:YES callWithErrorType:100 isReCall:NO];
return;
}
//
-(void)connectCamera{
if (!_isconnecting) {
_isconnecting = YES;//
[[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:self.contact.cameraId password:self.contact.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
_isconnecting = NO;
//
if (success) {
_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;
}
}];
}else{
//
}
}
#pragma mark --尝试连接摄像头
@@ -304,12 +325,14 @@ Strong UIImage *screenShotImage;//截图
return;
}
//p2p未连接
if (!_connectDevice) {
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
[self connectDevice];
if(_connectDevice){
//
[self monitorP2PCall];
}
return;
}
//
if (!_isConnectCamera) {
[self connectCamera];
return;
}
WEAK_SELF;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
@@ -2750,7 +2773,6 @@ Strong UIImage *screenShotImage;//截图
-(void)hiddenMonitoringUI:(BOOL)isHidden callWithErrorType:(GWP2PCallError)errorType isReCall:(BOOL)isReCall{
if (isHidden) {
[self.yProgressView stop];
// self.yProgressView.angle = 0.0f;
[self.yProgressView setHidden:YES];
[self.promptButton setEnabled:NO];
[self.promptButton setHidden:YES];
@@ -387,8 +387,15 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//智能联机
-(void)smartLinkConnect{
WEAK_SELF;
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(90 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//
if (!self.isDeviceLinkIn) {//90秒之后还未连接上,连接超时
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
[self connectNormalView];
[self.view makeToast:@"WiFi连接失败"];
}
});
[[GWP2PDeviceLinker shareInstance] p2pSmartLinkDeviceWithWiFiSSID:weakSelf.wifiName password:weakSelf.wifiPwd useSimpleConfig:YES deviceLinkIn:^(NSDictionary *deviceDict) {
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
if (weakSelf.isDeviceLinkIn) {
@@ -399,30 +406,20 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//如果智能联机,设备配网成功,就断开发送智能联机
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
NSString *deviceID = [deviceDict[@"deviceID"] stringValue];
// NSString *deviceIP = deviceDict[@"deviceIP"];
NSString *deviceIP = deviceDict[@"deviceIP"];
// NSString *devicePassword = deviceDict[@"devicePassword"];
weakSelf.deviceID = deviceID;
[self resetPassWord];//初始化密码
[weakSelf bindCameraDevice];
//如果重置之后,则重新设置密码
// if (IsEmptyStr(devicePassword)) { //设备没有初始化密码,设置密码
// [[GWP2PClient sharedClient] setDeviceInitialPassword:GIWEI_INITPASS withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
// NSLog(@"success:%i %@",success,dataDictionary);
// [weakSelf resetPassWord];//初始化密码
// [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{
if (![deviceDict[@"isInitPassword"] boolValue]){ //设备没有初始化密码,设置密码
[[GWP2PClient sharedClient] setDeviceInitialPassword:self.lastSetPassword withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"success:%i %@",success,dataDictionary);
[weakSelf resetPassWord];//初始化密码
[weakSelf bindCameraDevice];
}];
}else{//如果已经设置过初始密码,则直接使用
[weakSelf bindCameraDevice];
}
// else{
// [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:@"123" completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
// NSLog(@"success:%i %@",success,dataDictionary);
// [weakSelf resetPassWord];//更新密码
@@ -718,7 +715,6 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
}
//绑定成功之后,重新获取用户信息
-(void)setWindowRootWith:(IfishCameraModel *)cameraMdel{
[[GWP2PClient sharedClient] disconnect];
[self.view makeToast:@"添加成功"];
[self getMoreUserData:cameraMdel];