mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
onvif: preset support
This commit is contained in:
4
plugins/onvif/package-lock.json
generated
4
plugins/onvif/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.1.25",
|
||||
"version": "0.1.27",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.1.25",
|
||||
"version": "0.1.27",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.1.25",
|
||||
"version": "0.1.27",
|
||||
"description": "ONVIF Camera Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -79,23 +79,53 @@ export class OnvifPtzMixin extends SettingsMixinDeviceBase<Settings> implements
|
||||
if (e)
|
||||
return f(e);
|
||||
r();
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
else if (movement === PanTiltZoomMovement.Continuous) {
|
||||
let x= command.pan;
|
||||
let y = command.tilt;
|
||||
let zoom = command.zoom;
|
||||
if (command.speed?.pan)
|
||||
x *= command.speed.pan;
|
||||
if (command.speed?.tilt)
|
||||
y *= command.speed.tilt;
|
||||
if (command.speed?.zoom)
|
||||
zoom *= command.speed.zoom;
|
||||
return new Promise<void>((r, f) => {
|
||||
client.cam.continuousMove({
|
||||
x: command.pan,
|
||||
y: command.tilt,
|
||||
zoom: command.zoom,
|
||||
speed: speed,
|
||||
timeout: command.timeout || 1000,
|
||||
}, (e, result, xml) => {
|
||||
if (e)
|
||||
return f(e);
|
||||
r();
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
else if (movement === PanTiltZoomMovement.Home) {
|
||||
return new Promise<void>((r, f) => {
|
||||
client.cam.gotoHomePosition({
|
||||
speed: speed,
|
||||
}, (e, result, xml) => {
|
||||
if (e)
|
||||
return f(e);
|
||||
r();
|
||||
})
|
||||
});
|
||||
}
|
||||
else if (movement === PanTiltZoomMovement.Preset) {
|
||||
return new Promise<void>((r, f) => {
|
||||
client.cam.gotoPreset({
|
||||
preset: command.preset,
|
||||
}, (e, result, xml) => {
|
||||
if (e)
|
||||
return f(e);
|
||||
r();
|
||||
})
|
||||
});
|
||||
}
|
||||
else {
|
||||
// relative movement is default.
|
||||
@@ -110,7 +140,7 @@ export class OnvifPtzMixin extends SettingsMixinDeviceBase<Settings> implements
|
||||
return f(e);
|
||||
r();
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ class PanTiltZoomMovement(str, Enum):
|
||||
|
||||
Absolute = "Absolute"
|
||||
Continuous = "Continuous"
|
||||
Home = "Home"
|
||||
Preset = "Preset"
|
||||
Relative = "Relative"
|
||||
|
||||
class ScryptedDeviceType(str, Enum):
|
||||
@@ -709,8 +711,9 @@ class PanTiltZoomCapabilities(TypedDict):
|
||||
|
||||
class PanTiltZoomCommand(TypedDict):
|
||||
|
||||
movement: PanTiltZoomMovement # Specify the movement origin. If unspecified, the movement will be relative to the current position.
|
||||
movement: PanTiltZoomMovement # Specify the movement type. If unspecified, the movement will be relative to the current position.
|
||||
pan: float # Ranges between -1 and 1.
|
||||
preset: str # The preset to move to.
|
||||
speed: Any # The speed of the movement.
|
||||
tilt: float # Ranges between -1 and 1.
|
||||
timeout: float # The duration of the movement in milliseconds.
|
||||
|
||||
@@ -951,11 +951,13 @@ export enum PanTiltZoomMovement {
|
||||
Absolute = "Absolute",
|
||||
Relative = "Relative",
|
||||
Continuous = "Continuous",
|
||||
Preset = "Preset",
|
||||
Home = 'Home',
|
||||
}
|
||||
|
||||
export interface PanTiltZoomCommand {
|
||||
/**
|
||||
* Specify the movement origin. If unspecified, the movement will be relative to the current position.
|
||||
* Specify the movement type. If unspecified, the movement will be relative to the current position.
|
||||
*/
|
||||
movement?: PanTiltZoomMovement;
|
||||
/**
|
||||
@@ -991,6 +993,10 @@ export interface PanTiltZoomCommand {
|
||||
* The duration of the movement in milliseconds.
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* The preset to move to.
|
||||
*/
|
||||
preset?: string;
|
||||
}
|
||||
|
||||
export interface PanTiltZoomCapabilities {
|
||||
|
||||
Reference in New Issue
Block a user