添加录制功能

This commit is contained in:
kai60
2020-10-18 16:55:30 +08:00
parent 3356311c86
commit 52c13cc416
21 changed files with 355 additions and 53 deletions
@@ -25,7 +25,7 @@
// CFShow((__bridge CFTypeRef)(infoDic));
NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"];
NSLog(@"app_Version%@",app_Version);
app_Version=@"4.7.6";
app_Version=@"4.7.7";
NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version];
NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"];
if (buildVersion.length > 0) {
@@ -12,6 +12,7 @@
#import "IfishPlaybackViewCell.h"
#import <GWP2P/GWP2P.h>
#import "DatePickerCustomView.h"
#import "PlayBackViewController.h"
#define BACKVIEW_ROWH 60
#define ANIM_VIEW_WIDTH_AND_HEIGHT 80
@@ -282,25 +283,13 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[self.movieView setHidden:NO];
self.movieView.alpha = 0.3;
GWPlaybackFileModel*model=[self.playbackFiles objectAtIndex:indexPath.row];
PlayBackViewController*play=[[PlayBackViewController alloc]init];
play.camera=self.camera;
play.model=model;
[UIView transitionWithView:self.movieView duration:0.3 options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.movieView.alpha = 1.0;
}
completion:^(BOOL finished){
}
];
if (indexPath.section ==0) {
[[P2PClient sharedClient] p2pPlaybackCallWithId:self.camera.cameraId password:self.camera.cameraPass index:indexPath.row];
}else{
[[P2PClient sharedClient] p2pPlaybackCallWithId:self.camera.cameraId password:self.camera.cameraPass index:indexPath.row + self.playbackFiles.count];
}
[self.navigationController pushViewController:play animated:YES];
}
@@ -29,6 +29,20 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HW3-zp-qaz" userLabel="start">
<rect key="frame" x="0.0" y="20" width="414" height="60"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="g9K-Lj-fdX" userLabel="line2">
<rect key="frame" x="0.0" y="59.5" width="414" height="0.5"/>
<color key="backgroundColor" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="eYX-dI-CCb"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GsK-Vz-f8c" userLabel="line1">
<rect key="frame" x="0.0" y="0.0" width="414" height="0.5"/>
<color key="backgroundColor" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="ARj-zQ-gsw"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="开始日期:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="I8c-Yw-b6c">
<rect key="frame" x="0.0" y="0.0" width="100" height="60"/>
<constraints>
@@ -60,18 +74,21 @@
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="g9K-Lj-fdX" firstAttribute="leading" secondItem="HW3-zp-qaz" secondAttribute="leading" id="4lF-M9-cfP"/>
<constraint firstItem="GsK-Vz-f8c" firstAttribute="top" secondItem="HW3-zp-qaz" secondAttribute="top" id="9AY-YC-o1a"/>
<constraint firstAttribute="bottom" secondItem="I8c-Yw-b6c" secondAttribute="bottom" id="9kN-30-AYl"/>
<constraint firstAttribute="bottom" secondItem="g9K-Lj-fdX" secondAttribute="bottom" id="OI4-VN-uXY"/>
<constraint firstItem="I8c-Yw-b6c" firstAttribute="top" secondItem="HW3-zp-qaz" secondAttribute="top" id="RNn-F5-Xeq"/>
<constraint firstAttribute="bottom" secondItem="kku-gY-Q7f" secondAttribute="bottom" constant="10" id="RjY-yi-2zb"/>
<constraint firstItem="GsK-Vz-f8c" firstAttribute="leading" secondItem="HW3-zp-qaz" secondAttribute="leading" id="RqV-wa-sUI"/>
<constraint firstAttribute="height" constant="60" id="bbP-qb-Nyd"/>
<constraint firstAttribute="trailing" secondItem="g9K-Lj-fdX" secondAttribute="trailing" id="bra-HK-zdf"/>
<constraint firstItem="I8c-Yw-b6c" firstAttribute="leading" secondItem="HW3-zp-qaz" secondAttribute="leading" id="gvF-ka-pbb"/>
<constraint firstItem="kku-gY-Q7f" firstAttribute="centerX" secondItem="HW3-zp-qaz" secondAttribute="centerX" id="hcl-7j-RES"/>
<constraint firstItem="kku-gY-Q7f" firstAttribute="top" secondItem="HW3-zp-qaz" secondAttribute="top" constant="10" id="ldA-ZL-75A"/>
<constraint firstAttribute="trailing" secondItem="GsK-Vz-f8c" secondAttribute="trailing" id="o1G-oH-GFV"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</userDefinedRuntimeAttribute>
@@ -89,6 +106,13 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hek-yp-JXZ" userLabel="line3">
<rect key="frame" x="0.0" y="59.5" width="414" height="0.5"/>
<color key="backgroundColor" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstAttribute="height" constant="0.5" id="6P3-F7-EXy"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tn6-eP-Fcy" userLabel="endBtn">
<rect key="frame" x="132" y="10" width="150" height="40"/>
<color key="backgroundColor" red="0.86272245650000001" green="0.85881525280000004" blue="0.85882407429999996" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
@@ -111,18 +135,18 @@
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="Hek-yp-JXZ" secondAttribute="bottom" id="Fyk-hr-dlw"/>
<constraint firstAttribute="bottom" secondItem="tn6-eP-Fcy" secondAttribute="bottom" constant="10" id="SUI-cz-yfp"/>
<constraint firstItem="RAo-9M-Wa2" firstAttribute="top" secondItem="gbN-3d-Trv" secondAttribute="top" id="VDB-rV-fB2"/>
<constraint firstItem="tn6-eP-Fcy" firstAttribute="centerX" secondItem="gbN-3d-Trv" secondAttribute="centerX" id="a0d-KX-0lz"/>
<constraint firstAttribute="bottom" secondItem="RAo-9M-Wa2" secondAttribute="bottom" id="b9w-79-N3y"/>
<constraint firstItem="Hek-yp-JXZ" firstAttribute="leading" secondItem="gbN-3d-Trv" secondAttribute="leading" id="jdm-Ai-2VY"/>
<constraint firstAttribute="height" constant="60" id="lhS-sk-0G5"/>
<constraint firstItem="RAo-9M-Wa2" firstAttribute="leading" secondItem="gbN-3d-Trv" secondAttribute="leading" id="q94-03-dQ9"/>
<constraint firstAttribute="trailing" secondItem="Hek-yp-JXZ" secondAttribute="trailing" id="vUo-tc-qfJ"/>
<constraint firstItem="tn6-eP-Fcy" firstAttribute="top" secondItem="gbN-3d-Trv" secondAttribute="top" constant="10" id="zmh-Za-93K"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.5"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.50594329829999996" green="0.50971984859999997" blue="0.51372647289999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</userDefinedRuntimeAttribute>
@@ -13,7 +13,7 @@
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
self.playImageView.image = LXImageWithImageName(@"playback_iocn_video");
self.playImageView.image = LXImageWithImageName(@"playBackIcon");
}
@@ -50,7 +50,7 @@
}
self.startTimeLabel.text=start;
self.endTimeLabel.text=end;
NSLog(@"date =%@ time=%ld",model.date,model.time);
}
@end
@@ -37,10 +37,10 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YVK-ee-AkR">
<rect key="frame" x="30.5" y="-15" width="30" height="30"/>
<rect key="frame" x="25.5" y="-20" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="OAr-LF-mDb"/>
<constraint firstAttribute="height" constant="30" id="y9z-26-RmD"/>
<constraint firstAttribute="width" constant="40" id="OAr-LF-mDb"/>
<constraint firstAttribute="height" constant="40" id="y9z-26-RmD"/>
</constraints>
</imageView>
</subviews>
@@ -0,0 +1,21 @@
//
// PlayBackViewController.h
// Ifish
//
// Created by 祝发冬 on 2020/10/18.
// Copyright © 2020 lianlian. All rights reserved.
//
#import "BaseViewController.h"
#import "IfishCameraModel.h"
#import <GWP2P/GWP2P.h>
NS_ASSUME_NONNULL_BEGIN
@interface PlayBackViewController : BaseViewController
@property (nonatomic,strong) IfishCameraModel *camera;
@property (weak, nonatomic) IBOutlet UIView *playView;
@property (weak, nonatomic) IBOutlet UIButton *retryBtn;
@property (nonatomic,strong) GWPlaybackFileModel *model;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,123 @@
//
// PlayBackViewController.m
// Ifish
//
// Created by on 2020/10/18.
// Copyright © 2020 lianlian. All rights reserved.
//
#import "PlayBackViewController.h"
@interface PlayBackViewController ()<GWP2PPlayerProtocol>
@property (nonatomic, strong) GWP2PPlaybackPlayer *player;//
@property (nonatomic) BOOL isReject;
@end
@implementation PlayBackViewController
- (void)viewDidLoad {
[super viewDidLoad];
// NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
// formatter.dateFormat = @"yyyy-MM-dd HH:mm";
//
// NSString *string = [formatter stringFromDate:self.model.date]; //
[self setTitleString:@"视频回放"];
self.view.backgroundColor=[UIColor lightGrayColor];
[self connectDevice];
// Do any additional setup after loading the view from its nib.
}
-(void)playFiles
{
//VC
self.player = [[GWP2PPlaybackPlayer alloc] init];
self.player.mute = YES;
self.player.delegate=self;
self.player.viewController.view.backgroundColor = [UIColor clearColor];
self.player.viewController.view.frame=self.playView.bounds;
[self addChildViewController:self.player.viewController];
[self.playView addSubview:self.player.viewController.view];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
WEAK_SELF;
[self.player p2pCallPlaybackFileWithDeviceId:self.camera.cameraId password:self.camera.cameraPass playbackFile:self.model calling:^(NSDictionary *parameters) {
} accept:^(NSDictionary *parameters) {
} reject:^(GWP2PCallError error, NSString *errorCode) {
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
[weakSelf.view makeToast:@"连接失败请重试!"];
weakSelf.retryBtn.hidden=NO;
});
} ready:^{
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
weakSelf.retryBtn.hidden=YES;
});
}] ;
;
}
-(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 playFiles];
}else{
[self retry:nil];
}
}
else
{
[self playFiles];
}
}
-(BOOL)p2pPlayer:(GWP2PPlayer *)player shouldHandlerSwipeGesture:(UIGestureRecognizer *)gesture
{
return YES;;
}
-(void)goBackAction{
[self.player p2pPause];
self.player=nil;
[self.navigationController popViewControllerAnimated:YES];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
- (IBAction)retry:(UIButton *)sender {
[self.player p2pStop];
[self.player.viewController.view removeFromSuperview];
self.player=nil;
[self connectDevice];
}
@end
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="PlayBackViewController">
<connections>
<outlet property="playView" destination="mNp-Wq-9sr" id="zUA-J4-PXU"/>
<outlet property="retryBtn" destination="JXh-6B-ny2" id="R7G-iJ-hDT"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mNp-Wq-9sr" userLabel="playView">
<rect key="frame" x="0.0" y="298" width="414" height="300"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="Zpl-26-a1t"/>
</constraints>
</view>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JXh-6B-ny2">
<rect key="frame" x="185" y="678" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="aIO-hU-m50"/>
<constraint firstAttribute="height" constant="44" id="eI2-fw-A9X"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="重试">
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="retry:" destination="-1" eventType="touchUpInside" id="Wcp-lZ-BMl"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="mNp-Wq-9sr" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="C17-he-7L2"/>
<constraint firstItem="JXh-6B-ny2" firstAttribute="top" secondItem="mNp-Wq-9sr" secondAttribute="bottom" constant="80" id="HhU-0V-Mvn"/>
<constraint firstItem="JXh-6B-ny2" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="I6S-Xj-ICX"/>
<constraint firstItem="mNp-Wq-9sr" firstAttribute="centerY" secondItem="i5M-Pr-FkT" secondAttribute="centerY" id="NtZ-L6-gOK"/>
<constraint firstItem="Q5M-cg-NOt" firstAttribute="trailing" secondItem="mNp-Wq-9sr" secondAttribute="trailing" id="q7g-0A-JED"/>
<constraint firstItem="mNp-Wq-9sr" firstAttribute="leading" secondItem="Q5M-cg-NOt" secondAttribute="leading" id="qUP-ru-Lyf"/>
</constraints>
<point key="canvasLocation" x="138" y="71"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
@@ -36,6 +36,7 @@ static const CGFloat ToastFade = 0.2;
@property(assign) unsigned int remoteRecordState;
//app
@property(nonatomic,strong) NSMutableArray*array;
@property(nonatomic,strong) NSString*recordType;
@property (nonatomic, strong)MydatePickerView *mydatepicView;
@end
@@ -46,8 +47,11 @@ static const CGFloat ToastFade = 0.2;
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"录制视频"];
self.recordType=[[DataCenter defaultDtacenter].cache stringForKey:@"recordType"];
if (self.recordType.length)
{
self.recordType=@"0";
}
[self creatUI];
// self.view.backgroundColor = RGB(242, 242, 242);
@@ -80,11 +84,20 @@ static const CGFloat ToastFade = 0.2;
BOOL connectDevice = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
if (connectDevice) {
[[GWP2PClient sharedClient] setDeviceRecordDefinition:GWP2PRecordDefinitionStandardDefinition withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
}];
}else{
NSLog(@"p2pConnect failure.失败,不能操作设备");
[self.view makeToast:@"p2pConnect failure.失败,不能操作设备,请重试"];
}
}
else
{
[[GWP2PClient sharedClient] setDeviceRecordDefinition:GWP2PRecordDefinitionStandardDefinition withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
}];
}
}
@@ -132,7 +145,7 @@ static const CGFloat ToastFade = 0.2;
TemperatureSetModel*model=[[TemperatureSetModel alloc]init];
model.title=@"即时录制";
model.temperatureLabel=@"";
model.status=[[DataCenter defaultDtacenter].cache stringForKey:@"NowRecord"];
model.status=self.recordType;;
cell.titleLabel.text=model.title;
cell.temperaturelabel.text=model.temperatureLabel;
@@ -140,7 +153,7 @@ static const CGFloat ToastFade = 0.2;
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateSelected];
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal];
cell.selected=[model.status isEqualToString:@"1"];
cell.temPSwitch.selected=[model.status isEqualToString:@"1"];
@@ -152,7 +165,7 @@ static const CGFloat ToastFade = 0.2;
TemperatureSetModel*model=[[TemperatureSetModel alloc]init];
model.title=@"定时录制";
model.temperatureLabel=[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"].length?[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"]:@"09:00-16:00";
model.status=[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecord"];
model.status=self.recordType;;
cell.titleLabel.text=model.title;
cell.temperaturelabel.text=model.temperatureLabel;
@@ -161,7 +174,7 @@ static const CGFloat ToastFade = 0.2;
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"greenbtn_big"] forState:UIControlStateSelected];
[cell.temPSwitch setBackgroundImage:[UIImage imageNamed:@"graybtn_big"] forState:UIControlStateNormal];
cell.selected=[model.status isEqualToString:@"1"];
cell.temPSwitch.selected=[model.status isEqualToString:@"2"];
@@ -257,20 +270,40 @@ static const CGFloat ToastFade = 0.2;
-(void)nowRecordBtnAction:(UIButton*)btn{
btn.selected=!btn.selected;
[[DataCenter defaultDtacenter].cache setString:[NSString stringWithFormat:@"%ld",btn.selected] forKey:@"NowRecord"];
;
if (btn.selected)
{
self.recordType=@"1";
[[DataCenter defaultDtacenter].cache setString:self.recordType forKey:@"recordType"];
[[GWP2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeManual withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
if (success)
{
[self.view makeToast:@"设置成功"];
}
else
{
[self.view makeToast:@"设置失败"];
}
}];
}else
{
self.recordType=@"0";
[[DataCenter defaultDtacenter].cache setString:self.recordType forKey:@"recordType"];
[[GWP2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeAlarm withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"data=%@",dataDictionary);
}];
[[GWP2PClient sharedClient] setDevicePrerecordState:YES withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
}];
[[GWP2PClient sharedClient] setDeviceAlarmRecordTime:3 withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
}];
}
[self.tab reloadData];
}
@@ -281,19 +314,53 @@ static const CGFloat ToastFade = 0.2;
btn.selected=!btn.selected;
[[DataCenter defaultDtacenter].cache setString:[NSString stringWithFormat:@"%ld",btn.selected] forKey:@"schduleRecord"];
if (btn.selected) {
self.recordType=@"2";
[[DataCenter defaultDtacenter].cache setString:self.recordType forKey:@"recordType"];
[[GWP2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeSchedule withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"data=%@",dataDictionary);
}];
NSString*time=[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"].length?[[DataCenter defaultDtacenter].cache stringForKey:@"schduleRecordTime"]:@"09:00-16:00";
NSString*start=[[time componentsSeparatedByString:@"-"] firstObject];
NSString*end=[[time componentsSeparatedByString:@"-"] lastObject];
NSString*startHour=[[start componentsSeparatedByString:@":"] firstObject];
NSString*startMin=[[start componentsSeparatedByString:@":"] lastObject];
NSString*endHour=[[end componentsSeparatedByString:@":"] firstObject];
NSString*endMin=[[end componentsSeparatedByString:@":"] lastObject];
[[GWP2PClient sharedClient] setDevicePlanedRecordTimeWithFromHour:startHour.integerValue fromMinute:startMin.integerValue toHour:endHour.integerValue toMinute:endMin.integerValue deviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
if (success)
{
[self.view makeToast:@"设置成功"];
}
else
{
[self.view makeToast:@"设置失败"];
}
}];
}else{
self.recordType=@"0";
[[DataCenter defaultDtacenter].cache setString:self.recordType forKey:@"recordType"];
[[GWP2PClient sharedClient] setDeviceRecordType:GWP2PRecordTypeAlarm withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
NSLog(@"data=%@",dataDictionary);
}];
[[GWP2PClient sharedClient] setDevicePrerecordState:YES withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
}];
[[GWP2PClient sharedClient] setDeviceAlarmRecordTime:3 withDeviceID:self.camera.cameraId devicePassword:self.camera.cameraPass completionBlock:^(GWP2PClient *client, BOOL success, NSDictionary<NSString *,id> *dataDictionary) {
}];
}
[self.tab reloadData];
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB