sdk: update

This commit is contained in:
Koushik Dutta
2023-03-08 13:36:40 -08:00
parent f8c16edaae
commit f435f8eff5
6 changed files with 73 additions and 22 deletions

4
sdk/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/sdk",
"version": "0.2.82",
"version": "0.2.84",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/sdk",
"version": "0.2.82",
"version": "0.2.84",
"license": "ISC",
"dependencies": {
"@babel/preset-typescript": "^7.18.6",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/sdk",
"version": "0.2.82",
"version": "0.2.84",
"description": "",
"main": "dist/src/index.js",
"exports": {

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/types",
"version": "0.2.74",
"version": "0.2.76",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/types",
"version": "0.2.74",
"version": "0.2.76",
"license": "ISC",
"devDependencies": {
"@types/rimraf": "^3.0.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/types",
"version": "0.2.74",
"version": "0.2.76",
"description": "",
"main": "dist/index.js",
"author": "",

View File

@@ -227,6 +227,11 @@ class HttpResponseOptions(TypedDict):
headers: object
pass
class ImageOptions(TypedDict):
format: str
resize: Any
pass
class ObjectDetectionResult(TypedDict):
boundingBox: tuple[float, float, float, float]
className: str
@@ -464,6 +469,10 @@ class NotifierOptions(TypedDict):
vibrate: VibratePattern
pass
class ObjectDetectionGeneratorSession(TypedDict):
settings: Any
pass
class ObjectDetectionModel(TypedDict):
classes: list[str]
inputSize: list[float]
@@ -492,9 +501,16 @@ class ObjectsDetected(TypedDict):
timestamp: float
pass
class PanTiltZoomCapabilities(TypedDict):
pan: bool
tilt: bool
zoom: bool
pass
class PanTiltZoomCommand(TypedDict):
horizontal: Any | Any
vertical: Any | Any
pan: float
tilt: float
zoom: float
pass
class Position(TypedDict):
@@ -884,6 +900,8 @@ class OauthClient:
class ObjectDetection:
async def detectObjects(self, mediaObject: MediaObject, session: ObjectDetectionSession = None, callbacks: ObjectDetectionCallbacks = None) -> ObjectsDetected:
pass
async def generateObjectDetections(self, videoFrames: VideoFrame, session: ObjectDetectionGeneratorSession, callback: Any) -> Any:
pass
async def getDetectionModel(self, settings: Any = None) -> ObjectDetectionModel:
pass
pass
@@ -925,7 +943,7 @@ class PM25Sensor:
pass
class PanTiltZoom:
ptzCapabilities: Any
ptzCapabilities: PanTiltZoomCapabilities
async def ptzCommand(self, command: PanTiltZoomCommand) -> None:
pass
pass
@@ -1543,10 +1561,10 @@ class DeviceState:
self.setScryptedProperty("humidity", value)
@property
def ptzCapabilities(self) -> Any:
def ptzCapabilities(self) -> PanTiltZoomCapabilities:
return self.getScryptedProperty("ptzCapabilities")
@ptzCapabilities.setter
def ptzCapabilities(self, value: Any):
def ptzCapabilities(self, value: PanTiltZoomCapabilities):
self.setScryptedProperty("ptzCapabilities", value)
@property
@@ -2302,6 +2320,7 @@ ScryptedInterfaceDescriptors = {
"name": "ObjectDetection",
"methods": [
"detectObjects",
"generateObjectDetections",
"getDetectionModel"
],
"properties": []
@@ -2375,3 +2394,14 @@ class ObjectDetectionCallbacks:
pass
pass
class VideoFrame:
format: str
height: float
mimeType: str
sourceId: str
timestamp: float
width: float
async def read(self, options: ImageOptions = None) -> bytearray:
pass
pass

View File

@@ -760,12 +760,27 @@ export interface Intercom {
}
export interface PanTiltZoomCommand {
horizontal?: 'left' | 'right';
vertical?: 'up' | 'down';
/**
* Ranges between -1 and 1.
*/
pan?: number;
/**
* Ranges between -1 and 1.
*/
tilt?: number;
/**
* Ranges between 0 and 1 for max zoom.
*/
zoom?: number;
}
export interface PanTiltZoomCapabilities {
pan?: boolean;
tilt?: boolean;
zoom?: boolean;
}
export interface PanTiltZoom {
ptzCapabilities: any;
ptzCapabilities?: PanTiltZoomCapabilities;
ptzCommand(command: PanTiltZoomCommand): Promise<void>;
}
@@ -1235,7 +1250,7 @@ export interface ObjectDetectionTypes {
* Given object detections with bounding boxes, return a similar list with tracker ids.
*/
export interface ObjectTracker {
trackObjects(detection: ObjectsDetected): Promise<ObjectsDetected>;
trackObjects(detection: ObjectsDetected): Promise<ObjectsDetected>;
}
/**
* ObjectDetector is found on Cameras that have smart detection capabilities.
@@ -1248,10 +1263,12 @@ export interface ObjectDetector {
getDetectionInput(detectionId: string, eventId?: any): Promise<MediaObject>;
getObjectTypes(): Promise<ObjectDetectionTypes>;
}
export interface ObjectDetectionSession {
export interface ObjectDetectionGeneratorSession {
settings?: { [key: string]: any };
}
export interface ObjectDetectionSession extends ObjectDetectionGeneratorSession {
detectionId?: string;
duration?: number;
settings?: { [key: string]: any };
}
export interface ObjectDetectionModel extends ObjectDetectionTypes {
name: string;
@@ -1268,24 +1285,28 @@ export interface ObjectDetectionCallbacks {
* E.g. TensorFlow, OpenCV, or a Coral TPU.
*/
export interface ObjectDetection {
generateObjectDetections<T>(videoFrames: AsyncGenerator<VideoFrame>, session: ObjectDetectionGeneratorSession, callback: (videoFrame: VideoFrame, detected: ObjectsDetected) => Promise<T>): Promise<AsyncGenerator<T>>;
detectObjects(mediaObject: MediaObject, session?: ObjectDetectionSession, callbacks?: ObjectDetectionCallbacks): Promise<ObjectsDetected>;
getDetectionModel(settings?: { [key: string]: any }): Promise<ObjectDetectionModel>;
}
export interface VideoFrameOptions {
export interface ImageOptions {
resize?: {
width: number,
height: number,
};
format?: string;
}
export interface VideoFrame extends MediaObject {
export interface Image extends MediaObject {
timestamp: number;
width: number;
height: number;
format: string;
read(options?: VideoFrameOptions): Promise<Buffer>;
read(options?: ImageOptions): Promise<Buffer>;
}
export interface VideoFrameGeneratorOptions extends VideoFrameOptions {
export interface VideoFrame extends Image {
timestamp: number;
}
export interface VideoFrameGeneratorOptions extends ImageOptions {
}
export interface VideoFrameGenerator {
generateVideoFrames(mediaObject: MediaObject, options?: VideoFrameGeneratorOptions, filter?: (videoFrame: VideoFrame) => Promise<boolean>): Promise<AsyncGenerator<VideoFrame>>;
@@ -2114,5 +2135,5 @@ export interface ScryptedStatic {
* through the Scrypted Server which typically manages plugin communication.
* This is ideal for sending large amounts of data.
*/
connectRPCObject?<T>(value: T): Promise<T>;
connectRPCObject?<T>(value: T): Promise<T>;
}