bug修复
This commit is contained in:
parent
aade501983
commit
24bb267f97
|
|
@ -70,7 +70,7 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>9.9.4</string>
|
<string>9.9.6</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
|
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||||
@property (nonatomic,strong) UITableView *tableView;
|
@property (nonatomic,strong) UITableView *tableView;
|
||||||
|
Assign BOOL isConnectP2P;
|
||||||
@end
|
@end
|
||||||
extern BOOL isfromCameraView;
|
extern BOOL isfromCameraView;
|
||||||
@implementation IfishBindDeviceSelectViewController
|
@implementation IfishBindDeviceSelectViewController
|
||||||
|
|
@ -26,6 +27,7 @@ extern BOOL isfromCameraView;
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
isfromCameraView = NO;
|
isfromCameraView = NO;
|
||||||
|
_isConnectP2P = NO;
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
[self addTitleViewWithTitle:@"选择设备"];
|
[self addTitleViewWithTitle:@"选择设备"];
|
||||||
[self creatTab];
|
[self creatTab];
|
||||||
|
|
|
||||||
|
|
@ -151,17 +151,16 @@ Strong UIImage *screenShotImage;//截图
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ([self.contact.isActive isEqualToString:@"1"]) {
|
// if ([self.contact.isActive isEqualToString:@"1"]) {
|
||||||
|
|
||||||
[self monitorP2PCall];
|
[self cameraConnectSeting];
|
||||||
[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];
|
||||||
alert.tag = WEIJIHUO_ALERT;
|
// alert.tag = WEIJIHUO_ALERT;
|
||||||
[alert show];
|
// [alert show];
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
//环境校验
|
//环境校验
|
||||||
-(void)checkNetStatus{
|
-(void)checkNetStatus{
|
||||||
|
|
@ -237,19 +236,19 @@ Strong UIImage *screenShotImage;//截图
|
||||||
_isReject=YES;
|
_isReject=YES;
|
||||||
_isStop = NO;
|
_isStop = NO;
|
||||||
_isPushNextView = NO;
|
_isPushNextView = NO;
|
||||||
if ([self.contact.isActive isEqualToString:@"1"]) {
|
// if ([self.contact.isActive isEqualToString:@"1"]) {
|
||||||
[self connectDevice];
|
[self connectDevice];
|
||||||
}
|
// }
|
||||||
//监控竖屏时,各控件初始化(先)
|
//监控竖屏时,各控件初始化(先)
|
||||||
[self initComponentForPortrait];
|
[self initComponentForPortrait];
|
||||||
//监控横屏时,各控件初始化(后)
|
//监控横屏时,各控件初始化(后)
|
||||||
[self initComponentForHorizontalScreen];
|
[self initComponentForHorizontalScreen];
|
||||||
|
|
||||||
if ([self.contact.isActive isEqualToString:@"1"]) {
|
// if ([self.contact.isActive isEqualToString:@"1"]) {
|
||||||
|
//
|
||||||
}else{
|
// }else{
|
||||||
[self.yProgressView stop];
|
[self.yProgressView stop];
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
#pragma mark --LoadBaseUI
|
#pragma mark --LoadBaseUI
|
||||||
-(UIView *)canvasView{
|
-(UIView *)canvasView{
|
||||||
|
|
@ -263,15 +262,25 @@ Strong UIImage *screenShotImage;//截图
|
||||||
return _canvasView;
|
return _canvasView;
|
||||||
}
|
}
|
||||||
#pragma mark - 初始化设备 p2pConnect
|
#pragma mark - 初始化设备 p2pConnect
|
||||||
-(void)connectDevice{
|
-(void)cameraConnectSeting{
|
||||||
if ([GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) {
|
//rtsp监控界面弹出修改
|
||||||
_connectDevice = YES;
|
[self monitorP2PCall];
|
||||||
|
if (_isPushNextView) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
[self hiddenMonitoringUI:NO callWithErrorType:100 isReCall:YES];
|
||||||
|
|
||||||
|
}
|
||||||
|
-(void)connectDevice{
|
||||||
|
|
||||||
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];
|
||||||
//初始化设备
|
//初始化设备
|
||||||
if (!_connectDevice) {
|
if (!_connectDevice) {
|
||||||
NSLog(@"正在检查P2P连接状态");
|
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];
|
_connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
|
||||||
|
|
||||||
if (_connectDevice) {
|
if (_connectDevice) {
|
||||||
|
|
@ -295,7 +304,7 @@ Strong UIImage *screenShotImage;//截图
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//p2p未连接
|
//p2p未连接
|
||||||
if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) {
|
if (!_connectDevice) {
|
||||||
[self connectDevice];
|
[self connectDevice];
|
||||||
if(_connectDevice){
|
if(_connectDevice){
|
||||||
// 连接摄像头
|
// 连接摄像头
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@
|
||||||
#import "PushMasssageWebViewController.h"
|
#import "PushMasssageWebViewController.h"
|
||||||
#import "IfishUserObsever.h"
|
#import "IfishUserObsever.h"
|
||||||
#import <GWP2P/GWP2P.h>
|
#import <GWP2P/GWP2P.h>
|
||||||
|
#import "MyMD5.h"
|
||||||
|
#import "IfishUserDataUnity.h"
|
||||||
|
#import "DeviceCameraModel.h"
|
||||||
typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
lodingViewdissMissSuccsess=0,// default is 0
|
lodingViewdissMissSuccsess=0,// default is 0
|
||||||
lodingViewdissMissfail,
|
lodingViewdissMissfail,
|
||||||
|
|
@ -326,7 +329,7 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
//密码
|
//密码
|
||||||
-(void)resetPassWord{
|
-(void)resetPassWord{
|
||||||
|
|
||||||
NSString *newPassword = @"123";
|
NSString *newPassword = GIWEI_INITPASS;
|
||||||
self.lastSetPassword = [Utils GetTreatedPassword:newPassword];
|
self.lastSetPassword = [Utils GetTreatedPassword:newPassword];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,6 +387,8 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
//智能联机
|
//智能联机
|
||||||
-(void)smartLinkConnect{
|
-(void)smartLinkConnect{
|
||||||
WEAK_SELF;
|
WEAK_SELF;
|
||||||
|
[[GWP2PDeviceLinker shareInstance] p2pStopSmartLink];
|
||||||
|
|
||||||
[[GWP2PDeviceLinker shareInstance] p2pSmartLinkDeviceWithWiFiSSID:weakSelf.wifiName password:weakSelf.wifiPwd useSimpleConfig:YES deviceLinkIn:^(NSDictionary *deviceDict) {
|
[[GWP2PDeviceLinker shareInstance] p2pSmartLinkDeviceWithWiFiSSID:weakSelf.wifiName password:weakSelf.wifiPwd useSimpleConfig:YES deviceLinkIn:^(NSDictionary *deviceDict) {
|
||||||
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
|
NSLog(@"声波配网成功,返回数据:%@",deviceDict);
|
||||||
if (weakSelf.isDeviceLinkIn) {
|
if (weakSelf.isDeviceLinkIn) {
|
||||||
|
|
@ -394,16 +399,17 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
//如果智能联机,设备配网成功,就断开发送智能联机
|
//如果智能联机,设备配网成功,就断开发送智能联机
|
||||||
[[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.deviceID = deviceID;
|
weakSelf.deviceID = deviceID;
|
||||||
[self resetPassWord];//初始化密码
|
[self resetPassWord];//初始化密码
|
||||||
|
[weakSelf bindCameraDevice];
|
||||||
//如果重置之后,则重新设置密码
|
//如果重置之后,则重新设置密码
|
||||||
if (IsEmptyStr(devicePassword)) { //设备没有初始化密码,设置密码
|
// if (IsEmptyStr(devicePassword)) { //设备没有初始化密码,设置密码
|
||||||
[[GWP2PClient sharedClient] setDeviceInitialPassword:@"123" withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
|
// [[GWP2PClient sharedClient] setDeviceInitialPassword:GIWEI_INITPASS withDeviceID:deviceIP completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
|
||||||
NSLog(@"success:%i %@",success,dataDictionary);
|
// NSLog(@"success:%i %@",success,dataDictionary);
|
||||||
[weakSelf resetPassWord];//初始化密码
|
// [weakSelf resetPassWord];//初始化密码
|
||||||
[weakSelf bindCameraDevice];
|
// [weakSelf bindCameraDevice];
|
||||||
// if (success) {
|
// if (success) {
|
||||||
// [weakSelf initPwdResault:dataDictionary];
|
// [weakSelf initPwdResault:dataDictionary];
|
||||||
// }else{
|
// }else{
|
||||||
|
|
@ -415,15 +421,15 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
// [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:@"123" completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
|
||||||
NSLog(@"success:%i %@",success,dataDictionary);
|
// NSLog(@"success:%i %@",success,dataDictionary);
|
||||||
[weakSelf resetPassWord];//更新密码
|
// [weakSelf resetPassWord];//更新密码
|
||||||
[weakSelf bindCameraDevice];
|
// [weakSelf bindCameraDevice];
|
||||||
|
//
|
||||||
}];
|
// }];
|
||||||
}
|
// }
|
||||||
// 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) {
|
||||||
|
|
@ -710,19 +716,91 @@ typedef NS_ENUM(NSInteger,lodingViewdissMissStyle) {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
//绑定成功之后设置
|
//绑定成功之后,重新获取用户信息
|
||||||
-(void)setWindowRootWith:(IfishCameraModel *)cameraMdel{
|
-(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];
|
-(void)getMoreUserData:(IfishCameraModel *)cameraMdel{
|
||||||
|
|
||||||
UIApplication*app=[UIApplication sharedApplication];
|
|
||||||
AppDelegate*app1=(AppDelegate*)app.delegate;
|
|
||||||
app1.window.rootViewController=nav;
|
|
||||||
//绑定成功 加 经验值
|
|
||||||
[[IfishUserObsever sharedInstance] xinZengJingYanZhi:IFISHADDEXP_BIDCAMERA addType:IFISHADDEXPTYPE1];
|
|
||||||
|
|
||||||
|
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
|
@end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue