PTZ Control

Last Updated on : 2024-03-04 08:33:04

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:

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

Swift:

let ptzManager = ThingSmartPTZManager.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 ThingSmartPTZControlDirection. 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:(ThingSmartPTZControlDirection)direction
         success:(ThingSuccessID)success
         failure:(ThingFailureError)failure;

Parameters

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

Enum values of ThingSmartPTZControlDirection

Value Description
ThingSmartPTZControlDirectionUp Up
ThingSmartPTZControlDirectionRightUp Upper right
ThingSmartPTZControlDirectionRight Right
ThingSmartPTZControlDirectionRightDown Lower right
ThingSmartPTZControlDirectionDown Down
ThingSmartPTZControlDirectionLeftDown Lower left
ThingSmartPTZControlDirectionLeft Left
ThingSmartPTZControlDirectionLeftUp Upper left

Example

ObjC:

[self.ptzManager startPTZWithDirection:ThingSmartPTZControlDirectionRight 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:(ThingSuccessID)success
                   failure:(ThingFailureError)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:(ThingSuccessID)success
         failure:(ThingFailureError)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:(ThingSuccessID)success
                          failure:(ThingFailureError)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 ThingCameraCollectionPointModel 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:(ThingSuccessList)success failure:(ThingFailureError)failure;

Parameters

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

Example

ObjC:

[self.ptzManager requestCollectionPointListWithSuccess:^(NSArray *list) {
    for (ThingCameraCollectionPointModel *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? ThingCameraCollectionPointModel
            let pointName = pointModel?.name ?? ""
            print(pointName)
        }
    }
}, failure: { (error) in

})

API description

Adds a site favorite.

- (void)addCollectionPointWithName:(NSString *)name success:(ThingSuccessHandler)success failure:(ThingFailureError)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<ThingCameraCollectionPointModel *> *)models success:(ThingSuccessHandler)success failure:(ThingFailureError)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:(ThingCameraCollectionPointModel *)model name:(NSString *)name success:(ThingSuccessHandler)success failure:(ThingFailureError)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:(ThingCameraCollectionPointModel *)model success:(ThingSuccessHandler)success failure:(ThingFailureError)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.

- (ThingSmartPTZControlCruiseMode)getCurrentCruiseMode;

Return value

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

Enum values of ThingSmartPTZControlCruiseMode

Value Description
ThingSmartPTZControlCruiseModePanoramic The panoramic auto-patrol mode.
ThingSmartPTZControlCruiseModeCollectionPoint The site favorite auto-patrol mode.

Example

ObjC:

ThingSmartPTZControlCruiseMode cruiseModel = self.ptzManager.getCurrentCruiseMode;
if (cruiseModel == ThingSmartPTZControlCruiseModePanoramic) {
    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.

- (ThingSmartPTZControlCruiseTimeMode)getCurrentCruiseTimeMode;

Return value

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

Enum values of ThingSmartPTZControlCruiseTimeMode

Value Description
ThingSmartPTZControlCruiseTimeModeAllDay The all-day auto-patrol mode.
ThingSmartPTZControlCruiseTimeMode The custom auto-patrol mode.

Example

ObjC:

ThingSmartPTZControlCruiseTimeMode timeModel = self.ptzManager.getCurrentCruiseTimeMode;
if (timeModel == ThingSmartPTZControlCruiseTimeModeAllDay) {
    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.

- (ThingSmartPTZControlCruiseState)getCurrentCruiseState;

Return value

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

Enum values of ThingSmartPTZControlCruiseState

Value Description
ThingSmartPTZControlCruiseStatePanoramic The panoramic auto-patrol mode.
ThingSmartPTZControlCruiseStateCollectionPoint The site favorite auto-patrol mode.
ThingSmartPTZControlCruiseStateNone The non-auto-patrol mode.

Example

ObjC:

ThingSmartPTZControlCruiseState cruiseState = self.ptzManager.getCurrentCruiseState;
if (cruiseState == ThingSmartPTZControlCruiseStatePanoramic) {
    NSLog(@"Panoramic mode state.");
} else if (cruiseState == ThingSmartPTZControlCruiseStateCollectionPoint) {
    NSLog(@"Collection point mode state.");
} else if (cruiseState == ThingSmartPTZControlCruiseStateNone) {
    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:

ThingSmartPTZControlCruiseTimeMode timeModel = self.ptzManager.getCurrentCruiseTimeMode;
if (timeModel == ThingSmartPTZControlCruiseTimeModeCustom) {
    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:(ThingSuccessID)success failure:(ThingFailureError)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:(ThingSmartPTZControlCruiseMode)mode success:(ThingSuccessID)success failure:(ThingFailureError)failure;

Parameters

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

Example

ObjC:

[self.ptzManager setCruiseMode:ThingSmartPTZControlCruiseModePanoramic 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:(ThingSmartPTZControlCruiseTimeMode)timeMode success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

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

success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setCruiseTimeMode:ThingSmartPTZControlCruiseTimeModeCustom 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:(ThingSmartPTZControlCruiseState)state success:(ThingSuccessHandler)success failure:(ThingFailureError)failure;

Parameters

Parameter Description
state The auto-patrol status. Valid values:
  • ThingSmartPTZControlCruiseStatePanoramic: panoramic auto-patrol
  • ThingSmartPTZControlCruiseStateCollectionPoint: site favorite auto-patrol
  • ThingSmartPTZControlCruiseStateNone: non-auto-patrol mode
success The success callback.
failure The failure callback.

Example

ObjC:

[self.ptzManager setCruiseState:ThingSmartPTZControlCruiseStateCollectionPoint 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:(ThingSuccessHandler)success failure:(ThingFailureError)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:

ThingSmartPTZControlCruiseTimeMode currentTimeModel = self.ptzManager.getCurrentCruiseTimeMode;
if (currentTimeModel == ThingSmartPTZControlCruiseTimeModeCustom) {
    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:(ThingSuccessHandler)success failure:(ThingFailureError)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:(ThingSuccessID)success failure:(ThingFailureError)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:(ThingSuccessID)success failure:(ThingFailureError)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 ThingSmartPTZManager supports delegate callbacks.

Property description

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

API description

Indicates the current operation of site favorites.

- (void)collectionPointAction:(ThingSmartPTZManager *)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:(ThingSmartPTZManager *)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:(ThingSmartPTZManager *)manager currentCruiseMode:(ThingSmartPTZControlCruiseMode)currentCruiseMode;

Parameters

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

API description

Indicates the current auto-patrol schedule mode.

- (void)didUpdateCruiseTimeMode:(ThingSmartPTZManager *)manager currentTimeMode:(ThingSmartPTZControlCruiseTimeMode)currentTimeMode;

Parameters

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

API description

Indicates the current auto-patrol schedule.

- (void)didUpdateCruiseTimeModeTime:(ThingSmartPTZManager *)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:(ThingSmartPTZManager *)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.