开发版本-developer——01 first commit

This commit is contained in:
wbzhan
2019-07-08 18:24:03 +08:00
parent 5a10dfa182
commit 8693efe121
386 changed files with 7069 additions and 1951 deletions
@@ -8,6 +8,9 @@
#import "BaseViewController.h"
/**
首页点击添加设备进入此添加设备页面
*/
@interface IfishBindDeviceSelectViewController : BaseViewController
@end
@@ -8,7 +8,7 @@
#import "IfishBindDeviceSelectViewController.h"
#import "FishSelectDeviceListViewCell.h"
#import "P2PClient.h"
#import <GWP2P/GWP2P.h>
#import "UDPManager.h"
#import "YooseeNextConnectViewController.h"
#import "SecondConnectWifiController.h"
@@ -19,7 +19,6 @@
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView;
@property(nonatomic)BOOL islogInGewell;
@end
extern BOOL isfromCameraView;
@implementation IfishBindDeviceSelectViewController
@@ -30,49 +29,23 @@ extern BOOL isfromCameraView;
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"选择设备"];
[self creatTab];
[self loginGewell];
[self loginGWP2P];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
// [self loginGewell];
// if( _islogInGewell){
//
// NSLog(@"p2pConnect success.成功,你可以操作设备了");
//
// }else{//new added
// [self loginGewell];
// NSLog(@"p2pConnect failure.失败,你将不能操作设备");
//
//// return;
// }
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
//CGPoint curentpoint= [self.cardScrollView contentOffsetWithIndex:[self.cardScrollView currentCard]];
//[self.cardScrollView.scrollView setContentOffset:curentpoint animated:NO];
// [self loginGewell];
}
#pragma mark - loginGewell
-(void)loginGewell{
#pragma mark - loginGWP2P
-(void)loginGWP2P{
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
[[UDPManager sharedDefault] ScanLanDevice];
_islogInGewell = NO;
// LoginResult *loginResult = [UDManager getLoginInfo];
// NSString * P2PVerifyCode1 = @"1528438234";
// NSString * P2PVerifyCode2 = @"992805759";
// NSString *UserID = @"-2144354932";
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
@@ -95,8 +68,8 @@ extern BOOL isfromCameraView;
dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{
// 追加任务1
[[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
// // 追加任务1
// self.islogInGewell = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
dispatch_async(dispatch_get_main_queue(), ^{
@@ -165,35 +138,24 @@ extern BOOL isfromCameraView;
//wifi环境下转跳下一界面
switch (indexPath.row) {
case 0:
{
//摄像头
NSArray * cameraArr =[[DataCenter defaultDtacenter]valueForKey:@"cameraArr"];
if ([cameraArr count]>=5) {
[self.view makeToast:@"设备已达上线限"];
[self.view makeToast:@"设备已达上限"];
return;
}
if ( self.islogInGewell) {
if ( [GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) {
self.hidesBottomBarWhenPushed = YES;
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
[self.navigationController pushViewController:nextvc animated:YES];
nextvc.conectType = 0;
}else{
UserModel *model=[dataContorl getUserInfo];
[self loginGewellWith:model];
}
}
break;
case 1:
@@ -204,7 +166,7 @@ extern BOOL isfromCameraView;
if ([deviceArr count]>=5) {
[self.view makeToast:@"设备已达上线"];
[self.view makeToast:@"设备已达上限"];
return;
}
@@ -245,13 +207,13 @@ extern BOOL isfromCameraView;
}
-(void)loginGewellWith:(UserModel *)model;
-(void)loginGewellWith:(UserModel *)model
{
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
NSString *accountId =[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
if ([userIDName isEqualToString:@"0"]) {
if ([accountId isEqualToString:@"0"]) {
[self.view makeToast:@"暂未检测到设备"];
@@ -266,10 +228,11 @@ extern BOOL isfromCameraView;
[self.view makeToast:@"暂未检测到设备"];
return;
}
self.islogInGewell = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
if ([GWP2PClient sharedClient]!=P2PLinkStatusOK) {
[[GWP2PClient sharedClient] connectWithAccount:accountId codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
}
//loginResult.contactId 用户ID号
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
NSLog(@"%@%@%@",accountId,model.P2PVerifyCode1,model.P2PVerifyCode2,model.sessionID,model.sessionID2);
}