bug修复

This commit is contained in:
wbzhan_macbook 2019-07-20 08:33:44 +08:00
parent aade501983
commit 24bb267f97
4 changed files with 136 additions and 47 deletions

View File

@ -70,7 +70,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.9.4</string>
<string>9.9.6</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>

View File

@ -19,6 +19,7 @@
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView;
Assign BOOL isConnectP2P;
@end
extern BOOL isfromCameraView;
@implementation IfishBindDeviceSelectViewController
@ -26,6 +27,7 @@ extern BOOL isfromCameraView;
- (void)viewDidLoad {
[super viewDidLoad];
isfromCameraView = NO;
_isConnectP2P = NO;
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"选择设备"];
[self creatTab];

View File

@ -151,17 +151,16 @@ Strong UIImage *screenShotImage;//截图
return;
}
if ([self.contact.isActive isEqualToString:@"1"]) {
// if ([self.contact.isActive isEqualToString:@"1"]) {
[self monitorP2PCall];
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES];
}else if ([self.contact.isActive isEqualToString:@"0"]){
[self cameraConnectSeting];
// }else if ([self.contact.isActive isEqualToString:@"0"]){
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"" message:@"请扫描产品外包装上的激活码来激活摄像头" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往扫描", nil];
alert.tag = WEIJIHUO_ALERT;
[alert show];
}
// UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"" message:@"请扫描产品外包装上的激活码来激活摄像头" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往扫描", nil];
// alert.tag = WEIJIHUO_ALERT;
// [alert show];
//
// }
}
//
-(void)checkNetStatus{
@ -237,19 +236,19 @@ Strong UIImage *screenShotImage;//截图
_isReject=YES;
_isStop = NO;
_isPushNextView = NO;
if ([self.contact.isActive isEqualToString:@"1"]) {
// if ([self.contact.isActive isEqualToString:@"1"]) {
[self connectDevice];
}
// }
//()
[self initComponentForPortrait];
//()
[self initComponentForHorizontalScreen];
if ([self.contact.isActive isEqualToString:@"1"]) {
}else{
// if ([self.contact.isActive isEqualToString:@"1"]) {
//
// }else{
[self.yProgressView stop];
}
// }
}
#pragma mark --LoadBaseUI
-(UIView *)canvasView{
@ -263,15 +262,25 @@ Strong UIImage *screenShotImage;//截图
return _canvasView;
}
#pragma mark - p2pConnect
-(void)connectDevice{
if ([GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) {
_connectDevice = YES;
-(void)cameraConnectSeting{
//rtsp
[self monitorP2PCall];
if (_isPushNextView) {
return;
}
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES];
}
-(void)connectDevice{
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
//
if (!_connectDevice) {
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) {
@ -295,7 +304,7 @@ Strong UIImage *screenShotImage;//截图
return;
}
//p2p
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
if (!_connectDevice) {
[self connectDevice];
if(_connectDevice){
//

View File

@ -28,6 +28,9 @@
#import "PushMasssageWebViewController.h"
#import "IfishUserObsever.h"
#import <GWP2P/GWP2P.h>
#import "MyMD5.h"
#import "IfishUserDataUnity.h"
#import "DeviceCameraModel.h"
typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
lodingViewdissMissSuccsess=0,// default is 0
lodingViewdissMissfail,
@ -326,7 +329,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//密码
-(void)resetPassWord{
NSString *newPassword = @"123";
NSString *newPassword = GIWEI_INITPASS;
self.lastSetPassword = [Utils GetTreatedPassword:newPassword];
}
@ -384,6 +387,8 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//智能联机
-(void)smartLinkConnect{
WEAK_SELF;
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
[[GWP2PDeviceLinker shareInstance] p2pSmartLinkDeviceWithWiFiSSID:weakSelf.wifiName password:weakSelf.wifiPwd useSimpleConfig:YES deviceLinkIn:^(NSDictionary *deviceDict) {
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
if (weakSelf.isDeviceLinkIn) {
@ -394,16 +399,17 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
//如果智能联机,设备配网成功,就断开发送智能联机
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
NSString *deviceID = [deviceDict[@"deviceID"] stringValue];
NSString *deviceIP = deviceDict[@"deviceIP"];
NSString *devicePassword = deviceDict[@"devicePassword"];
// NSString *deviceIP = deviceDict[@"deviceIP"];
// NSString *devicePassword = deviceDict[@"devicePassword"];
weakSelf.deviceID = deviceID;
[self resetPassWord];//初始化密码
[weakSelf bindCameraDevice];
//如果重置之后,则重新设置密码
if (IsEmptyStr(devicePassword)) { //设备没有初始化密码,设置密码
[[GWP2PClient sharedClient] setDeviceInitialPassword:@"123" withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"success:%i %@",success,dataDictionary);
[weakSelf 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{
@ -415,15 +421,15 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
// [weakSelf.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];//更新密码
[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];//更新密码
// [weakSelf bindCameraDevice];
//
// }];
// }
// else {
// //设备已经初始化过密码,则直接获取设备信息
// [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:deviceIP password:devicePassword completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
@ -710,19 +716,91 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
}];
}
//绑定成功之后设置
//绑定成功之后,重新获取用户信息
-(void)setWindowRootWith:(IfishCameraModel *)cameraMdel{
[[GWP2PClient sharedClient] disconnect];
[self.view makeToast:@"添加成功"];
[self getMoreUserData:cameraMdel];
IfishP2PMonitorController *monitorVC=[[IfishP2PMonitorController alloc] init];
monitorVC.contact = cameraMdel;
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:monitorVC];
UIApplication*app=[UIApplication sharedApplication];
AppDelegate*app1=(AppDelegate*)app.delegate;
app1.window.rootViewController=nav;
//绑定成功 加 经验值
[[IfishUserObsever sharedInstance] xinZengJingYanZhi:IFISHADDEXP_BIDCAMERA addType:IFISHADDEXPTYPE1];
}
//获取个人信息
-(void)getMoreUserData:(IfishCameraModel *)cameraMdel{
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[AFHttpTool getMoreUserDataWith:userId success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result=reDic[@"result"];
if ([result isEqualToString:@"100"]) {
NSDictionary *dataDic = reDic[@"data"];
//设备信息
NSArray*deviceArray=dataDic[@"device"];
NSArray*cameraA=dataDic[@"camera"];
NSMutableArray *deviceArr = [[NSMutableArray alloc] init];
if ([deviceArray count]!=0) {
for (NSDictionary*deviceDic in deviceArray) {
DeviceModel*devicemodel=[[DeviceModel alloc] initWithDict:deviceDic];
[deviceArr insertObject:devicemodel atIndex:0];
}
}
[[DataCenter defaultDtacenter]setValue:deviceArr forKey:@"deviceInfo"];
//存储摄像头设备信息
NSMutableArray *camras = [[NSMutableArray alloc] init];
if (cameraA .count !=0) {
if ([cameraA count]!=0) {
for (NSDictionary * cameraDic in cameraA) {
IfishCameraModel *camera=[[IfishCameraModel alloc] initWithDict:cameraDic];
[camras insertObject:camera atIndex:0];
}
}
}
//存储摄像头数组
[[DataCenter defaultDtacenter]setValue:camras forKey:@"cameraArr"];
/**
* 设备摄像头关系数组
*/
NSArray*deviceCamera=dataDic[@"deviceCamera"];
NSMutableArray *devicamerArr=[[NSMutableArray alloc] init];
if (deviceCamera) {
for (NSDictionary * deviceCameraDic in deviceCamera) {
DeviceCameraModel *dcmodel=[[DeviceCameraModel alloc] init];
dcmodel.deviceId = deviceCameraDic[@"deviceId"];
dcmodel.cameraId = deviceCameraDic[@"cameraId"];
[devicamerArr addObject:dcmodel];
}
}
//存储摄像头设备关系数组
[[DataCenter defaultDtacenter]setValue:devicamerArr forKey:@"devicamerArr"];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
IfishP2PMonitorController *monitorVC=[[IfishP2PMonitorController alloc] init];
monitorVC.contact = cameraMdel;
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:monitorVC];
UIApplication*app=[UIApplication sharedApplication];
AppDelegate*app1=(AppDelegate*)app.delegate;
app1.window.rootViewController=nav;
//绑定成功 加 经验值
[[IfishUserObsever sharedInstance] xinZengJingYanZhi:IFISHADDEXP_BIDCAMERA addType:IFISHADDEXPTYPE1];
});
}
} failure:^(NSError *err) {
}];
}
@end