Skip to content

Commit

Permalink
sdk: add ObjectDetectionGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Sep 10, 2023
1 parent 6e109d8 commit 988f297
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
9 changes: 9 additions & 0 deletions sdk/types/scrypted_python/scrypted_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class ScryptedInterface(str, Enum):
Notifier = "Notifier"
OauthClient = "OauthClient"
ObjectDetection = "ObjectDetection"
ObjectDetectionGenerator = "ObjectDetectionGenerator"
ObjectDetector = "ObjectDetector"
ObjectTracker = "ObjectTracker"
OccupancySensor = "OccupancySensor"
Expand Down Expand Up @@ -1109,6 +1110,9 @@ async def getDetectionModel(self, settings: Any = None) -> ObjectDetectionModel:
pass


class ObjectDetectionGenerator:


class ObjectDetector:
"""ObjectDetector is found on Cameras that have smart detection capabilities."""

Expand Down Expand Up @@ -2913,6 +2917,11 @@ def applicationInfo(self, value: LauncherApplicationInfo):
],
"properties": []
},
"ObjectDetectionGenerator": {
"name": "ObjectDetectionGenerator",
"methods": [],
"properties": []
},
"HumiditySetting": {
"name": "HumiditySetting",
"methods": [
Expand Down
12 changes: 7 additions & 5 deletions sdk/types/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ function toTypescriptType(type: any): string {

for (const name of Object.values(ScryptedInterface)) {
const td = schema.children.find((child: any) => child.name === name);
const properties = td.children.filter((child: any) => child.kindString === 'Property').map((child: any) => child.name);
const methods = td.children.filter((child: any) => child.kindString === 'Method').map((child: any) => child.name);
const children = td.children || [];
const properties = children.filter((child: any) => child.kindString === 'Property').map((child: any) => child.name);
const methods = children.filter((child: any) => child.kindString === 'Method').map((child: any) => child.name);
ScryptedInterfaceDescriptors[name] = {
name,
methods,
properties,
};

for (const p of td.children.filter((child: any) => child.kindString === 'Property')) {
for (const p of children.filter((child: any) => child.kindString === 'Property')) {
allProperties[p.name] = p.type;
}
}
Expand Down Expand Up @@ -196,8 +197,9 @@ class ${td.name}:
${toDocstring(td)}
`;

const properties = td.children.filter((child: any) => child.kindString === 'Property');
const methods = td.children.filter((child: any) => child.kindString === 'Method');
const children = td.children || [];
const properties = children.filter((child: any) => child.kindString === 'Property');
const methods = children.filter((child: any) => child.kindString === 'Method');
for (const property of properties) {
python += ` ${property.name}: ${toPythonType(property.type)}${toComment(property)}
`
Expand Down
4 changes: 4 additions & 0 deletions sdk/types/src/types.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,9 @@ export interface ObjectDetection {
detectObjects(mediaObject: MediaObject, session?: ObjectDetectionSession): Promise<ObjectsDetected>;
getDetectionModel(settings?: { [key: string]: any }): Promise<ObjectDetectionModel>;
}

export interface ObjectDetectionGenerator {
}
export type ImageFormat = 'gray' | 'rgba' | 'rgb' | 'jpg';
export interface ImageOptions {
crop?: {
Expand Down Expand Up @@ -2006,6 +2009,7 @@ export enum ScryptedInterface {
ObjectTracker = "ObjectTracker",
ObjectDetector = "ObjectDetector",
ObjectDetection = "ObjectDetection",
ObjectDetectionGenerator = "ObjectDetectionGenerator",
HumiditySetting = "HumiditySetting",
Fan = "Fan",
RTCSignalingChannel = "RTCSignalingChannel",
Expand Down

0 comments on commit 988f297

Please sign in to comment.