English
English
简体中文
Contact Us
Register
Log In
layoutIndex

PTZ Control

Last Updated on : 2022-01-06 06:58:06download

Pan-tilt-zoom (PTZ) is one of the important data points (DPs) of IP cameras (IPCs) and is widely used in IPC scenarios. The integration of PTZ is lacking in the business encapsulation as vertical resources. To speed up the integration of PTZ, Tuya provides the encapsulation of PTZ features. The following PTZ features are supported:

  • PTZ control
  • Focal length adjustment
  • Site favorites
  • Auto-patrol mode
  • Motion tracking
  • Preset points

API methods

All PTZ features are implemented by the management class.

Get the PTZ management class

Example

ObjC:

TuyaSmartPTZManager *ptzManager = [[TuyaSmartPTZManager alloc] initWithDeviceId:devId];

Swift:

let ptzManager = TuyaSmartPTZManager.init(deviceId: devId)

PTZ control

API description

Specifies whether to support PTZ control.

- (BOOL)isSupportPTZControl;

Return value

Value type Description
BOOL Valid values:
  • YES: supported
  • NO: not supported

Example

ObjC:

if ([self.ptzManager isSupportPTZControl]) {
    NSLog(@"Is support.");
} else {
    NSLog(@"Not support.");
}

Swift:

if ptzManager!.isSupportPTZControl() {
    print("Is support.")
} else {
    print("Not support.")
}

API description

Returns the directions that are supported by IPCs.

- (NSArray *)requestSupportedPTZControlDirections;

Return value

Value type Description
NSArray The array of supported directions of string type. Each element of the array matches the value of TuyaSmartPTZControlDirection. Format: ["0","1","2","3","4","5","6","7"].

Example

ObjC:

NSArray *directions = [self.ptzManager requestSupportedPTZControlDirections];
for (NSString *directionString in directions) {
    NSLog(@"%@", directionString);
}

Swift:

let directions = ptzManager?.requestSupportedPTZControlDirections() ?? []
for directionString in directions {
    print(directionString)
}

API description

Starts PTZ control.

- (void)startPTZWithDirection:(TuyaSmartPTZControlDirection)direction
         success:(TYSuccessID)success
         failure:(TYFailureError)failure;

Parameters

Parameter Description
direction An enum value of supported directions. For more information, see TuyaSmartPTZControlDirection.
success The success callback.
failure The failure callback.

Enum values of TuyaSmartPTZControlDirection

Value Description
TuyaSmartPTZControlDirectionUp Up
TuyaSmartPTZControlDirectionRightUp Upper right
TuyaSmartPTZControlDirectionRight Right
TuyaSmartPTZControlDirectionRightDown Lower right
TuyaSmartPTZControlDirectionDown Down
TuyaSmartPTZControlDirectionLeftDown Lower left
TuyaSmartPTZControlDirectionLeft Left
TuyaSmartPTZControlDirectionLeftUp Upper left

Example

ObjC:

[self.ptzManager startPTZWithDirection:TuyaSmartPTZControlDirectionRight success:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.startPTZ(with: .right, success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Stops PTZ control.

- (void)stopPTZWithSuccess:(TYSuccessID)success
                   failure:(TYFailureError)failure;

Parameters

Parameter Description
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager stopPTZWithSuccess:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.stopPTZ(success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

Zoom control

API description

Specifies whether to support zoom control.

- (BOOL)isSupportZoomAction;

Return value

Value type Description
BOOL Valid values:
  • YES: supported
  • NO: not supported

Example

ObjC:

if ([self.ptzManager isSupportZoomAction]) {
    NSLog(@"Is support.");
} else {
    NSLog(@"Not support.");
}

Swift:

if ptzManager!.isSupportZoomAction() {
    print("Is support.")
} else {
    print("Not support.")
}

API description

Starts zoom control.

- (void)startPTZZoomWithIsEnlarge:(BOOL)isEnlarge
         success:(TYSuccessID)success
         failure:(TYFailureError)failure;

Parameters

Parameter Description
isEnlarge Specifies whether to zoom in. Valid values:
  • YES: zoom in
  • NO: zoom out
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager startPTZZoomWithIsEnlarge:YES success:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.startPTZZoom(withIsEnlarge: true, success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Stops zoom control.

- (void)stopZoomActionWithSuccess:(TYSuccessID)success
                          failure:(TYFailureError)failure;

Parameters

Parameter Description
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager stopZoomActionWithSuccess:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.stopZoomAction(success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

Site favorites

Site favorite model

Site favorite information is encapsulated into TYCameraCollectionPointModel to simplify the management of site favorites.

Property description

Property Description
devId The device ID.
pointId The ID of a site favorite.
mpId The unique ID of a device. The device generates the value.
name The name of a site favorite.
pic The URL of a site favorite image.
pos The position of a site favorite.
encryption The decryption key of a site favorite image.

API description

Indicates whether site favorites are supported.

- (BOOL)isSupportCollectionPoint;

Return value

Value type Description
BOOL Valid values:
  • YES: supported
  • NO: not supported

Example

ObjC:

if ([self.ptzManager isSupportCollectionPoint]) {
    NSLog(@"Is support.");
} else {
    NSLog(@"Not support.");
}

Swift:

if ptzManager!.isSupportCollectionPoint() {
    print("Is support.")
} else {
    print("Not support.")
}

API description

Indicates whether site favorites can be edited, for example, to be added, renamed, or deleted.

Favorite sites cannot be edited in auto-patrol mode but can be edited in other modes.

- (BOOL)couldOperateCollectionPoint;

Return value

Value type Description
BOOL Valid values:
  • YES: can be edited
  • NO: cannot be edited

Example

ObjC:

if ([self.ptzManager couldOperateCollectionPoint]) {
    NSLog(@"Could operate.");
} else {
    NSLog(@"Couldn't operate.");
}

Swift:

if ptzManager!.couldOperateCollectionPoint() {
  print("Could operate.")
} else {
  print("Couldn't operate.")
}

API description

Returns a list of site favorites.

- (void)requestCollectionPointListWithSuccess:(TYSuccessList)success failure:(TYFailureError)failure;

Parameters

Parameter Description
success The success callback. The list of TYCameraCollectionPointModel is returned.
failure The failure callback.

Example

ObjC:

[self.ptzManager requestCollectionPointListWithSuccess:^(NSArray *list) {
    for (TYCameraCollectionPointModel *model in list) {
        NSLog(@"%@", model.name);
    }
} failure:^(NSError *error) {

}];

Swift:

ptzManager?.requestCollectionPointList(success: { (list) in
    if let models = list {
        for model in models {
            let pointModel = model as? TYCameraCollectionPointModel
            let pointName = pointModel?.name ?? ""
            print(pointName)
        }
    }
}, failure: { (error) in

})

API description

Adds a site favorite.

- (void)addCollectionPointWithName:(NSString *)name success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
name The name of a site favorite.
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager addCollectionPointWithName:@"pointName" success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.addCollectionPoint(withName: "pointName", success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Deletes site favorites.

- (void)deleteCollectionPoints:(NSArray<TYCameraCollectionPointModel *> *)models success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
models The collection of site favorites to be deleted.
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager deleteCollectionPoints:@[pointModel] success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.deleteCollectionPoints([pointModel], success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Renames a site favorite.

- (void)renameCollectionPoint:(TYCameraCollectionPointModel *)model name:(NSString *)name success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
model The site favorite to be renamed.
name The new name of a site favorite.
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager renameCollectionPoint:pointModel name:@"newName" success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.renameCollectionPoint(pointModel, name: "newName", success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Navigates to a specified site favorite.

- (void)viewCollectionPoint:(TYCameraCollectionPointModel *)model success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
model The target site favorite.
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager viewCollectionPoint:pointModel success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.viewCollectionPoint(pointModel, success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

Auto-patrol mode

API description

Indicates whether the auto-patrol mode is supported.

- (BOOL)isSupportCruise;

Return value

Value type Description
BOOL Valid values:
  • YES: supported
  • NO: not supported

Example

ObjC:

if ([self.ptzManager isSupportCruise]) {
    NSLog(@"Is support.");
} else {
    NSLog(@"Not support.");
}

Swift:

if ptzManager!.isSupportCruise() {
    print("Is support.")
} else {
    print("Not support.")
}

API description

Indicates whether the auto-patrol mode is enabled.

- (BOOL)isOpenCruise;

Return value

Value type Description
BOOL Valid values:
  • YES: enabled
  • NO: disabled

Example

ObjC:

if ([self.ptzManager isOpenCruise]) {
    NSLog(@"Is opened.");
} else {
    NSLog(@"Is closed.");
}

Swift:

if ptzManager!.isOpenCruise() {
    print("Is opened.")
} else {
    print("Is closed.")
}

API description

Returns the current auto-patrol mode.

- (TuyaSmartPTZControlCruiseMode)getCurrentCruiseMode;

Return value

Value type Description
TuyaSmartPTZControlCruiseMode An enum value of the auto-patrol mode.

Enum values of TuyaSmartPTZControlCruiseMode

Value Description
TuyaSmartPTZControlCruiseModePanoramic The panoramic auto-patrol mode.
TuyaSmartPTZControlCruiseModeCollectionPoint The site favorite auto-patrol mode.

Example

ObjC:

TuyaSmartPTZControlCruiseMode cruiseModel = self.ptzManager.getCurrentCruiseMode;
if (cruiseModel == TuyaSmartPTZControlCruiseModePanoramic) {
    NSLog(@"Panoramic mode");
} else {
    NSLog(@"Collection point mode");
}

Swift:

let cruiseModel = ptzManager!.getCurrentCruiseMode()
if cruiseModel == .panoramic {
    print("Panoramic mode.")
} else {
    print("Collection point mode.")
}

API description

Returns the current auto-patrol schedule mode.

- (TuyaSmartPTZControlCruiseTimeMode)getCurrentCruiseTimeMode;

Return value

Value type Description
TuyaSmartPTZControlCruiseTimeMode An enum value of the auto-patrol schedule mode.

Enum values of TuyaSmartPTZControlCruiseTimeMode

Value Description
TuyaSmartPTZControlCruiseTimeModeAllDay The all-day auto-patrol mode.
TuyaSmartPTZControlCruiseTimeMode The custom auto-patrol mode.

Example

ObjC:

TuyaSmartPTZControlCruiseTimeMode timeModel = self.ptzManager.getCurrentCruiseTimeMode;
if (timeModel == TuyaSmartPTZControlCruiseTimeModeAllDay) {
    NSLog(@"All day mode");
} else {
    NSLog(@"Custom Time mode");
}

Swift:

let timeModel = ptzManager!.getCurrentCruiseTimeMode()
if timeModel == .allDay {
    print("All day mode.")
} else {
    print("Custom Time mode.")
}

API description

Returns the current auto-patrol status.

- (TuyaSmartPTZControlCruiseState)getCurrentCruiseState;

Return value

Value type Description
TuyaSmartPTZControlCruiseState An enum value of the auto-patrol status.

Enum values of TuyaSmartPTZControlCruiseState

Value Description
TuyaSmartPTZControlCruiseStatePanoramic The panoramic auto-patrol mode.
TuyaSmartPTZControlCruiseStateCollectionPoint The site favorite auto-patrol mode.
TuyaSmartPTZControlCruiseStateNone The non-auto-patrol mode.

Example

ObjC:

TuyaSmartPTZControlCruiseState cruiseState = self.ptzManager.getCurrentCruiseState;
if (cruiseState == TuyaSmartPTZControlCruiseStatePanoramic) {
    NSLog(@"Panoramic mode state.");
} else if (cruiseState == TuyaSmartPTZControlCruiseStateCollectionPoint) {
    NSLog(@"Collection point mode state.");
} else if (cruiseState == TuyaSmartPTZControlCruiseStateNone) {
    NSLog(@"Not in cruise mode.");
}

Swift:

let cruiseState = ptzManager!.getCurrentCruiseState()
if cruiseState == .panoramic {
    print("Panoramic mode state.")
} else if cruiseState == .collectionPoint {
    print("Collection point mode state.")
} else if cruiseState == .none {
    print("Not in cruise mode.")
}

API description

Returns the current auto-patrol schedule.

- (NSString *)getCurrentCruiseTime;

Return value

Value type Description
NSString The period from startTime to endTime. Example: “09:00-18:00”.

Example

ObjC:

TuyaSmartPTZControlCruiseTimeMode timeModel = self.ptzManager.getCurrentCruiseTimeMode;
if (timeModel == TuyaSmartPTZControlCruiseTimeModeCustom) {
    NSLog(@"Custom Time mode");
    NSString *timeRangeStr = [self.ptzManager getCurrentCruiseTime];
    NSLog(@"startTime-endTime:%@", timeRangeStr);
} else {
    NSLog(@"All day mode");
}

Swift:

let timeModel = ptzManager!.getCurrentCruiseTimeMode()
if timeModel == .custom {
    print("Custom Time mode.")
    let timeRangeStr = ptzManager?.getCurrentCruiseTime() ?? ""
    print("startTime-endTime:\(timeRangeStr)")
} else {
    print("All day mode.")
}

API description

Enables or disables the auto-patrol mode.

- (void)setCruiseOpen:(BOOL)isOpen success:(TYSuccessID)success failure:(TYFailureError)failure;

Parameters

Parameter Description
isOpen Specifies whether to enable the auto-patrol mode. Valid values:
  • YES: enabled
  • NO: disabled
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setCruiseOpen:YES success:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.setCruiseOpen(true, success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Sets the auto-patrol mode.

- (void)setCruiseMode:(TuyaSmartPTZControlCruiseMode)mode success:(TYSuccessID)success failure:(TYFailureError)failure;

Parameters

Parameter Description
mode The auto-patrol mode. Valid values:
  • TuyaSmartPTZControlCruiseModePanoramic: panoramic auto-patrol
  • TuyaSmartPTZControlCruiseModeCollectionPoint: site favorite auto-patrol
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setCruiseMode:TuyaSmartPTZControlCruiseModePanoramic success:^(id result) {
  NSLog(@"success");
} failure:^(NSError *error) {
  NSLog(@"failure");
}];

Swift:

ptzManager?.setCruiseMode(.panoramic, success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
});

API description

Sets the auto-patrol schedule mode.

- (void)setCruiseTimeMode:(TuyaSmartPTZControlCruiseTimeMode)timeMode success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
timeMode The auto-patrol schedule mode. Valid values:
  • TuyaSmartPTZControlCruiseTimeModeAllDay: all-day auto-patrol
  • TuyaSmartPTZControlCruiseTimeModeCustom: custom auto-patrol

success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setCruiseTimeMode:TuyaSmartPTZControlCruiseTimeModeCustom success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.setCruiseTimeMode(.custom, success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Sets the auto-patrol status.

- (void)setCruiseState:(TuyaSmartPTZControlCruiseState)state success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
state The auto-patrol status. Valid values:
  • TuyaSmartPTZControlCruiseStatePanoramic: panoramic auto-patrol
  • TuyaSmartPTZControlCruiseStateCollectionPoint: site favorite auto-patrol
  • TuyaSmartPTZControlCruiseStateNone: non-auto-patrol mode
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setCruiseState:TuyaSmartPTZControlCruiseStateCollectionPoint success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.setCruiseState(.collectionPoint, success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Sets the auto-patrol schedule.

- (void)setCruiseCustomWithStartTime:(NSString *)startTime endTime:(NSString *)endTime success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
startTime The start time. Format: 00:00.
endTime The end time. Format: 00:00.
success The success callback.
failure The failure callback.

Example

ObjC:

TuyaSmartPTZControlCruiseTimeMode currentTimeModel = self.ptzManager.getCurrentCruiseTimeMode;
if (currentTimeModel == TuyaSmartPTZControlCruiseTimeModeCustom) {
    NSLog(@"Custom Time mode");
    [self.ptzManager setCruiseCustomWithStartTime:@"09:00" endTime:@"15:00" success:^{
        NSLog(@"success");
    } failure:^(NSError *error) {
        NSLog(@"failure");
    }];
} else {
    NSLog(@"All day mode");
}

Swift:

let currentTimeModel = ptzManager!.getCurrentCruiseTimeMode()
if currentTimeModel == .custom {
    print("Custom Time mode.")
    ptzManager?.setCruiseCustomWithStartTime("09:00", endTime: "15:00", success: {
        print("success")
    }, failure: { (error) in
        print("failure")
    })
} else {
    print("All day mode.")
}

Motion tracking

API description

Indicates whether motion tracking is supported.

- (BOOL)isSupportMotionTracking;

Return value

Value type Description
BOOL Valid values:
  • YES: supported
  • NO: not supported

Example

ObjC:

if ([self.ptzManager isSupportMotionTracking]) {
    NSLog(@"Is support.");
} else {
    NSLog(@"Not support.");
}

Swift:

if ptzManager!.isSupportMotionTracking() {
    print("Is support.")
} else {
    print("Not support.")
}

API description

Indicates whether motion tracking is enabled.

- (BOOL)isOpenMotionTracking;

Return value

Value type Description
BOOL Valid values:
  • YES: enabled
  • NO: disabled

Example

ObjC:

if ([self.ptzManager isOpenMotionTracking]) {
    NSLog(@"Is opened.");
} else {
    NSLog(@"Is closed.");
}

Swift:

if ptzManager!.isOpenMotionTracking() {
    print("Is opened.")
} else {
    print("Is closed.")
}

API description

Enables or disables motion tracking.

- (void)setMotionTrackingState:(BOOL)isOpen success:(TYSuccessHandler)success failure:(TYFailureError)failure;

Parameters

Parameter Description
isOpen Valid values:
  • YES: enabled
  • NO: disabled
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setMotionTrackingState:YES success:^{
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.setMotionTrackingState(true, success: {
    print("success")
}, failure: { (error) in
    print("failure")
})

Preset points

API description

Indicates whether preset points are supported.

- (BOOL)isSupportPresetPoint;

Return value

Value type Description
BOOL Valid values:
  • YES: supported
  • NO: not supported

Example

ObjC:

if ([self.ptzManager isSupportPresetPoint]) {
    NSLog(@"Is support.");
} else {
    NSLog(@"Not support.");
}

Swift:

if ptzManager!.isSupportPresetPoint() {
    print("Is support.")
} else {
    print("Not support.")
}

API description

Returns a list of preset points.

- (NSArray *)requestSupportedPresetPoints;

Return value

Value type Description
NSArray The list of preset point indexes. For example, if preset point indexes 1, 2, 3, and 4 are available, ["1","2","3","4"] is returned.

Example

ObjC:

NSArray *points = [self.ptzManager requestSupportedPresetPoints];
for (NSString *indexStr in points) {
    NSLog(@"index:%@", indexStr);
}

Swift:

let points = ptzManager?.requestSupportedPresetPoints() ?? []
for indexStr in points {
    print("index:\(indexStr)")
}

API description

Navigates to a specified preset point.

- (void)viewPresetPointWithIndex:(NSInteger)index success:(TYSuccessID)success failure:(TYFailureError)failure;

Parameters

Parameter Description
index The index of the target preset point.
success The success callback.
failure The failure callback.

Example

ObjC:

int index = 1;
[self.ptzManager viewPresetPointWithIndex:index success:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

let index = 1
ptzManager?.viewPresetPoint(with: index, success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

API description

Sets a preset point with a specified index.

- (void)setPresetPointWithIndex:(NSInteger)index success:(TYSuccessID)success failure:(TYFailureError)failure;

Parameters

Parameter Description
index The index of the target preset point.
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setPresetPointWithIndex:index success:^(id result) {
    NSLog(@"success");
} failure:^(NSError *error) {
    NSLog(@"failure");
}];

Swift:

ptzManager?.setPresetPointWith(index, success: { (obj) in
    print("success")
}, failure: { (error) in
    print("failure")
})

Delegate callbacks

The PTZ management class TuyaSmartPTZManager supports delegate callbacks.

Property description

@property (nonatomic, weak) id<TuyaSmartPTZManagerDeletate> delegate;

API description

Indicates the current operation of site favorites.

- (void)collectionPointAction:(TuyaSmartPTZManager *)manager actionType:(NSInteger)type;

Parameters

Parameter Description
manager The PTZ management class.
type The operation type. Valid values:
  • 1: added
  • 2: deleted
  • 3: navigated

API description

Indicates the current auto-patrol switch status.

- (void)didUpdateCruiseSwitchState:(TuyaSmartPTZManager *)manager isOpen:(BOOL)isOpen;

Parameters

Parameter Description
manager The PTZ management class.
isOpen Indicates whether the auto-patrol mode is enabled. Valid values:
  • YES: enabled
  • NO: disabled

API description

Indicates the current auto-patrol mode.

- (void)didUpdateCruiseMode:(TuyaSmartPTZManager *)manager currentCruiseMode:(TuyaSmartPTZControlCruiseMode)currentCruiseMode;

Parameters

Parameter Description
manager The PTZ management class.
currentCruiseMode The current auto-patrol mode. Valid values:
  • TuyaSmartPTZControlCruiseModePanoramic: panoramic auto-patrol
  • TuyaSmartPTZControlCruiseModeCollectionPoint: site favorite auto-patrol

API description

Indicates the current auto-patrol schedule mode.

- (void)didUpdateCruiseTimeMode:(TuyaSmartPTZManager *)manager currentTimeMode:(TuyaSmartPTZControlCruiseTimeMode)currentTimeMode;

Parameters

Parameter Description
manager The PTZ management class.
currentTimeMode The current auto-patrol schedule mode. Valid values:
  • TuyaSmartPTZControlCruiseTimeModeAllDay: all-day auto-patrol
  • TuyaSmartPTZControlCruiseTimeModeCustom: custom auto-patrol

API description

Indicates the current auto-patrol schedule.

- (void)didUpdateCruiseTimeModeTime:(TuyaSmartPTZManager *)manager startTime:(NSString *)startTime endTime:(NSString *)endTime;

Parameters

Parameter Description
manager The PTZ management class.
startTime The current start time.
endTime The current end time.

API description

Indicates the current motion tracking switch status.

- (void)didUpdateMotionTrackingState:(TuyaSmartPTZManager *)manager isOpen:(BOOL)isOpen;

Parameters

Parameter Description
manager The PTZ management class.
isOpen Valid values:
  • YES: enabled
  • NO: disabled

Error codes

The following table shows the error codes of PTZ features.

Error codes Description
-2001 Site favorites cannot be added during panoramic auto-patrol and site favorite auto-patrol.
-2002 The number of site favorites is less than 2 so that site favorite auto-patrol cannot be enabled.