diff --git a/.DS_Store b/.DS_Store index c415a1c..56287ef 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m index 201d9a5..637b789 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceViewController.m @@ -1283,12 +1283,7 @@ Assign BOOL isPush; } else if ([model.type isEqualToString:@"camera"]){ - // self.hidesBottomBarWhenPushed = YES; - // IfishP2PPlayBackListViewController *cameraShopVC=[[IfishP2PPlayBackListViewController alloc]init]; - // cameraShopVC.camera = model.camera; - // [self.navigationController pushViewController:cameraShopVC animated:YES]; - // self.hidesBottomBarWhenPushed = NO; - + //切换时主动 断开 soket [[Socketsingleton sharedInstance] cutOffSocket]; //进入摄像头页面 diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m index 5b4db33..19c6aad 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishP2PMonitorController.m @@ -640,7 +640,7 @@ Strong UIImage *screenShotImage;//截图 self.bottomToolHView.hidden = NO; //底部view 水族箱view - UIView *bottomHView = [[UIView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY(self.segControl.frame) + 10, width, height-CGRectGetMaxY(self.segControl.frame))]; + UIView *bottomHView = [[UIView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY(self.segControl.frame) + 10, width, height-CGRectGetMaxY(self.segControl.frame)-10)]; bottomHView.backgroundColor = JWUIColorFromRGB(0xdddddd); [self.view addSubview:bottomHView]; self.bottomFishHView = bottomHView; @@ -4570,6 +4570,23 @@ GWP2PCallErrorNotSupport, }]; } + //视频录制 + else if (indexPath.row ==6){ + CameraRecordViewController*ca=[[CameraRecordViewController alloc]init]; + ca.camera=self.contact; + [self.navigationController pushViewController:ca animated:YES]; + + + } + + else if (indexPath.row ==7){ + + IfishP2PPlayBackListViewController *cameraShopVC=[[IfishP2PPlayBackListViewController alloc]init]; + cameraShopVC.camera = self.contact; + [self.navigationController pushViewController:cameraShopVC animated:YES]; + + } + } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraBottomHView.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraBottomHView.m index 960311a..90c4170 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraBottomHView.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraBottomHView.m @@ -68,10 +68,10 @@ static NSString *bootomRecCellIdentifier = @"IfishRecVideoViewCell"; ////录制回放功能打开 //_dataImgArray = @[LXImageWithImageName(@"devicename_iocn_screenshots.png"),LXImageWithImageName(@"devicename_iocn_gallery.png"),LXImageWithImageName(@"devicename_iocn_rec.png"),LXImageWithImageName(@"devicename_iocn_playback.png"),LXImageWithImageName(@"devicename_iocn_care.png"),LXImageWithImageName(@"devicename_iocn_look.png"),LXImageWithImageName(@"devicename_iocn_Ilookat.png"),LXImageWithImageName(@"devicename_iocn_look.png"),LXImageWithImageName(@"devicename_iocn_look.png")]; //equipment_iocn_playback - _dataImgArray = @[LXImageWithImageName(@"equipment_iocn_printscreen"),LXImageWithImageName(@"equipment_iocn_gallery"),LXImageWithImageName(@"equipment_iocn_care"),LXImageWithImageName(@"equipment_iocn_look"),LXImageWithImageName(@"equipment_iocn_mylook"),LXImageWithImageName(@"equipment_iocn_share")]; + _dataImgArray = @[LXImageWithImageName(@"equipment_iocn_printscreen"),LXImageWithImageName(@"equipment_iocn_gallery"),LXImageWithImageName(@"equipment_iocn_care"),LXImageWithImageName(@"equipment_iocn_look"),LXImageWithImageName(@"equipment_iocn_mylook"),LXImageWithImageName(@"equipment_iocn_share"),LXImageWithImageName(@"equipment_iocn_videorecord"),LXImageWithImageName(@"equipment_iocn_videoback")]; //_dataNameArray = @[@"截图",@"图库",@"录制",@"回放",@"我的看护",@"爱鱼看看",@"我的看看",@"",@""]; - _dataNameArray = @[@"截图",@"图库",@"我的看护",@"爱鱼看看",@"我的看看",@"分享爱鱼奇"]; + _dataNameArray = @[@"截图",@"图库",@"我的看护",@"爱鱼看看",@"我的看看",@"分享爱鱼奇",@"视频录制",@"视频回放"]; } #pragma mark - UICollectionViewDataSource @@ -84,7 +84,7 @@ static NSString *bootomRecCellIdentifier = @"IfishRecVideoViewCell"; - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ //return 9; - return 6; + return 8; } #pragma mark 设置item内容 diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.h b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.h index 172aa7b..8b03ef1 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.h +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.h @@ -9,7 +9,11 @@ #import "BaseViewController.h" #import "IfishCameraModel.h" #import "MBProgressHUD.h" +#import + + @interface CameraRecordViewController : BaseViewController @property (nonatomic,strong) IfishCameraModel *camera; +@property (nonatomic, strong) GWP2PVideoPlayer *player;//摄像头页面 @property (strong, nonatomic) MBProgressHUD *progressAlert; @end diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m index 391e087..e2852f6 100644 --- a/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m +++ b/Ifish/controllers/IfishYooseeFile/IfishYooseeControlller/IfishcameraBottomHView/CameraRecordViewController.m @@ -25,7 +25,7 @@ static const CGFloat ToastFade = 0.2; @property(nonatomic) NSInteger minute; @property(nonatomic,strong) NSTimer*timer; @property(nonatomic,copy) NSString *timestr; - +@property (nonatomic, assign) BOOL isConnectCamera; @property(nonatomic) BOOL isRecording; @property(nonatomic) NSIndexPath *timerIndex; @property(nonatomic) NSIndexPath *switchIndex; @@ -92,7 +92,78 @@ static const CGFloat ToastFade = 0.2; [self.view addSubview:self.tab]; } +-(void)connectDevice{ + + UserModel *model=[dataContorl getUserInfo]; + NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff]; + //初始化设备 + if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) { + NSLog(@"正在检查P2P连接状态"); + BOOL 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.失败,不能操作设备"); + } + } + +} +//连接到摄像头 +-(void)connectCamera{ + [[GWP2PClient sharedClient] getMultipleDeviceStatusWithDeviceID:self.camera.cameraId password:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { + + if (success) { + _isConnectCamera = YES; + [self monitorP2PCall]; + NSLog(@"当前连接设备信息:%@",dataDictionary); + }else{ + _isConnectCamera = YES; + [self monitorP2PCall]; +// _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; + } + }]; +} +#pragma mark --尝试连接摄像头 +-(void)monitorP2PCall{ + if ([self.player isPlaying]) {//如果已经连接,则不重复发出连接申请 + return; + } + //p2p未连接 + if ([GWP2PClient sharedClient].linkStatus != P2PLinkStatusOK) { + [self connectDevice]; + return; + } + //未连接到设备 + if (!_isConnectCamera) { + [self connectCamera]; + return; + } + WEAK_SELF; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + + [weakSelf.player p2pCallDeviceWithDeviceId:self.camera.cameraId password:self.camera.cameraPass definition:GWP2PPTZDefinitionSD calling:^(NSDictionary *parameters) { + //呼叫设备 + NSLog(@"[p2pCallDevice-Calling],paras=%@",parameters); + + } accept:^(NSDictionary *parameters) { + + NSLog(@"[p2pCallDevice-Accept],paras=%@",parameters); + + } reject:^(GWP2PCallError error, NSString *errorCode) { + } ready:^{ + } allowLAN:YES]; + + + + }); +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. @@ -623,12 +694,15 @@ static const CGFloat ToastFade = 0.2; [self startTostVIew]; if (swt.isOn) { - _isManual = YES; + _isManual = NO; [[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId - password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_OFF]; + password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON]; + [[P2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeSchedule withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary *dataDictionary) { + NSLog(@"data=%@",dataDictionary); + }];; }else{ - _isManual = NO; + _isManual = YES; [[P2PClient sharedClient] setRemoteRecordWithId:self.camera.cameraId password:self.camera.cameraPass state:SETTING_VALUE_REMOTE_RECORD_STATE_ON]; } diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeSource/IFISHYooseeImg.bundle/images/equipment_iocn_videoback b/Ifish/controllers/IfishYooseeFile/IfishYooseeSource/IFISHYooseeImg.bundle/images/equipment_iocn_videoback new file mode 100644 index 0000000..3c8ef5c Binary files /dev/null and b/Ifish/controllers/IfishYooseeFile/IfishYooseeSource/IFISHYooseeImg.bundle/images/equipment_iocn_videoback differ diff --git a/Ifish/controllers/IfishYooseeFile/IfishYooseeSource/IFISHYooseeImg.bundle/images/equipment_iocn_videorecord b/Ifish/controllers/IfishYooseeFile/IfishYooseeSource/IFISHYooseeImg.bundle/images/equipment_iocn_videorecord new file mode 100644 index 0000000..cea0376 Binary files /dev/null and b/Ifish/controllers/IfishYooseeFile/IfishYooseeSource/IFISHYooseeImg.bundle/images/equipment_iocn_videorecord differ