From 8bfc1215384797f9b709ee06bc721d472182f15b Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期三, 20 十一月 2024 15:11:44 +0800 Subject: [PATCH] feature 萤石摄像头翻转 --- EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 1 deletions(-) diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m index b904e77..fd80138 100644 --- a/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m +++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZSettingViewController.m @@ -18,6 +18,7 @@ #import <EZOpenSDKFramework/EZStorageInfo.h> #import "Toast+UIView.h" #import "HDLEZDetectionTypeViewController.h" +#import "HDLEZMirrorFlipView.h" //#import "EzvizDeviceManager.h" @@ -35,12 +36,14 @@ @property (nonatomic, weak) IBOutlet UILabel *currentVersionLabel; @property (nonatomic, weak) IBOutlet UILabel *nVersionLabel; @property (nonatomic, weak) IBOutlet UIImageView *updateImageView; +@property (nonatomic, strong) HDLEZMirrorFlipView *mirrorFlipView; @property (nonatomic, strong) UIButton *deleteButton; @property (nonatomic, strong) UIButton *privacyMaskButton; // 闅愮閬斀鎵ц杩囩▼鎻愰啋鎸夐挳 @property (nonatomic, strong) EZDeviceVersion *deviceVersion; @property (nonatomic, strong) NSTimer *timer; @property (nonatomic, assign) BOOL isCatEye; // 鏄惁涓虹尗鐪� @property (nonatomic, assign) BOOL privacyMasking; // 闅愮閬斀璁剧疆涓� +@property (nonatomic, copy) NSString *mirrorFlipCommand; // 闀滃儚缈昏浆鍛戒护 @end @@ -116,6 +119,26 @@ weakSelf.nVersionLabel.text = version.currentVersion; } }]; + [[EZHttpUtil sharedManager] getDeviceCapacity:self.deviceInfo.deviceSerial completion:^(ResponseData * _Nonnull responseData) { + NSLog(@"#######闀滃儚缈昏浆鍊艰繑鍥炵粨鏋滐細%@", [responseData yy_modelToJSONString]); + if (responseData.success && responseData.data) { + NSLog(@"#######闀滃儚缈昏浆鍊间负锛�%@", responseData.data); + BOOL ptzCenterMirror = [[responseData.data objectForKey:@"ptzCenterMirror"] boolValue]; + BOOL ptzLeftRightMirror = [[responseData.data objectForKey:@"ptzLeftRightMirror"] boolValue]; + BOOL ptzTopBottomMirror = [[responseData.data objectForKey:@"ptzTopBottomMirror"] boolValue]; + if (ptzTopBottomMirror) { + weakSelf.mirrorFlipCommand = @"0"; + } + if (ptzLeftRightMirror) { + weakSelf.mirrorFlipCommand = @"1"; + } + if (ptzCenterMirror) { + weakSelf.mirrorFlipCommand = @"2"; + } + [weakSelf.tableView reloadData]; + } + }]; + [self.privacyMaskSwitch setOn:NO]; [self getPrivacyMaskSwitchStatus]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; @@ -282,6 +305,13 @@ cell.backgroundColor = [UIColor clearColor]; cell.contentView.backgroundColor = [UIColor clearColor]; cell.textLabel.text = @""; + if (self.mirrorFlipCommand && self.mirrorFlipCommand.length > 0) { + [cell.contentView addSubview:self.mirrorFlipView]; + __weak __typeof(self)weakSelf = self; + [self.mirrorFlipView configTitle:NSLocalizedString(@"api_mirror_flip", @"鐢婚潰缈昏浆") subTitle:NSLocalizedString(@"api_mirror_flip_trip", @"鐐瑰嚮鍚庤棰戠敾闈細缈昏浆灞曠ず锛岄�傚悎鍊掕鐨勫満鏅�") click:^{ + [weakSelf mirrorFlipAction]; + }]; + } [cell.contentView addSubview:self.deleteButton]; [self.deleteButton addTarget:self action:@selector(deleteAction) forControlEvents:UIControlEventTouchUpInside]; [self.deleteButton mas_remakeConstraints:^(MASConstraintMaker *make) { @@ -315,6 +345,13 @@ cell.backgroundColor = [UIColor clearColor]; cell.contentView.backgroundColor = [UIColor clearColor]; cell.textLabel.text = @""; + if (self.mirrorFlipCommand && self.mirrorFlipCommand.length > 0) { + [cell.contentView addSubview:self.mirrorFlipView]; + __weak __typeof(self)weakSelf = self; + [self.mirrorFlipView configTitle:NSLocalizedString(@"api_mirror_flip", @"鐢婚潰缈昏浆") subTitle:NSLocalizedString(@"api_mirror_flip_trip", @"鐐瑰嚮鍚庤棰戠敾闈細缈昏浆灞曠ず锛岄�傚悎鍊掕鐨勫満鏅�") click:^{ + [weakSelf mirrorFlipAction]; + }]; + } [cell.contentView addSubview:self.deleteButton]; [self.deleteButton addTarget:self action:@selector(deleteAction) forControlEvents:UIControlEventTouchUpInside]; [self.deleteButton mas_remakeConstraints:^(MASConstraintMaker *make) { @@ -387,7 +424,7 @@ } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return ((!self.isCatEye && indexPath.section == 8) || (self.isCatEye && indexPath.section == 6)) ? 92 : 50.; + return ((!self.isCatEye && indexPath.section == 8) || (self.isCatEye && indexPath.section == 6)) ? (self.mirrorFlipCommand && self.mirrorFlipCommand.length > 0 ? 192 : 92) : 50.; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { @@ -746,6 +783,17 @@ [self presentViewController:actionSheet animated:YES completion:nil]; } +- (void)mirrorFlipAction { + [[EZHttpUtil sharedManager] setPtzMiroor:self.deviceInfo.deviceSerial command:self.mirrorFlipCommand completion:^(ResponseData * _Nonnull responseData) { + NSLog(@"#######璁剧疆闀滃儚缈昏浆鍊艰繑鍥炵粨鏋滐細%@", [responseData yy_modelToJSONString]); + if (responseData.success) { + [UIView dd_showMessage:NSLocalizedString(@"api_mirror_flip_success", @"鐢婚潰缈昏浆鎴愬姛")]; + } else { + [UIView dd_showMessage:responseData.message]; + } + }]; +} + #pragma mark - Getter - (UIButton *)deleteButton { if (!_deleteButton) { @@ -778,4 +826,11 @@ return _actionRightArrow; } +- (HDLEZMirrorFlipView *)mirrorFlipView { + if (!_mirrorFlipView) { + _mirrorFlipView = [[HDLEZMirrorFlipView alloc] initWithFrame:CGRectMake(0, 0, HDLEZ_APP_SCREEN_WIDTH, 100)]; + } + return _mirrorFlipView; +} + @end -- Gitblit v1.8.0