Skip to content

Commit

Permalink
onvif: make relative movement the ptz default
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 19, 2023
1 parent 2ce187b commit 7e6230d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugins/onvif/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/onvif/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/onvif",
"version": "0.0.117",
"version": "0.0.118",
"description": "ONVIF Camera Plugin for Scrypted",
"author": "Scrypted",
"license": "Apache",
Expand Down
11 changes: 6 additions & 5 deletions plugins/onvif/src/onvif-ptz.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DeviceState, MixinDeviceBase, MixinDeviceOptions, MixinProvider, PanTiltZoom, PanTiltZoomCommand, PanTiltZoomMovement, ScryptedDeviceBase, ScryptedDeviceType, ScryptedInterface, Setting, Settings, SettingValue } from "@scrypted/sdk";
import { StorageSettings } from "@scrypted/sdk/storage-settings";
import { connectCameraAPI } from "./onvif-api";
import {SettingsMixinDeviceBase, SettingsMixinDeviceOptions} from '../../../common/src/settings-mixin';
import { SettingsMixinDeviceBase, SettingsMixinDeviceOptions } from '../../../common/src/settings-mixin';

export class OnvifPtzMixin extends SettingsMixinDeviceBase<Settings> implements PanTiltZoom, Settings {
storageSettings = new StorageSettings(this, {
Expand Down Expand Up @@ -55,9 +55,9 @@ export class OnvifPtzMixin extends SettingsMixinDeviceBase<Settings> implements
};
}

if (command.movement === PanTiltZoomMovement.Relative) {
if (command.movement === PanTiltZoomMovement.Absolute) {
return new Promise<void>((r, f) => {
client.cam.relativeMove({
client.cam.absoluteMove({
x: command.pan,
y: command.tilt,
zoom: command.zoom,
Expand All @@ -69,9 +69,10 @@ export class OnvifPtzMixin extends SettingsMixinDeviceBase<Settings> implements
})
})
}
else if (command.movement === PanTiltZoomMovement.Absolute) {
else {
// relative movement is default.
return new Promise<void>((r, f) => {
client.cam.absoluteMove({
client.cam.relativeMove({
x: command.pan,
y: command.tilt,
zoom: command.zoom,
Expand Down

0 comments on commit 7e6230d

Please sign in to comment.