Skip to content

Commit

Permalink
sdk: add ipcObject
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 3, 2023
1 parent 445581e commit fbbb916
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions sdk/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 sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/sdk",
"version": "0.2.71",
"version": "0.2.73",
"description": "",
"main": "dist/src/index.js",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions sdk/types/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 sdk/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/types",
"version": "0.2.66",
"version": "0.2.67",
"description": "",
"main": "dist/index.js",
"author": "",
Expand Down
13 changes: 5 additions & 8 deletions sdk/types/scrypted_python/scrypted_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ class AdoptDevice(TypedDict):
settings: DeviceCreatorSettings
pass

class BufferConvertorOptions(TypedDict):
sourceId: str
pass

class ColorHsv(TypedDict):
h: float
s: float
Expand Down Expand Up @@ -423,6 +419,7 @@ class LauncherApplicationInfo(TypedDict):
pass

class MediaObjectOptions(TypedDict):
metadata: Any
sourceId: str
pass

Expand Down Expand Up @@ -698,7 +695,7 @@ async def setBrightness(self, brightness: float) -> None:
class BufferConverter:
fromMimeType: str
toMimeType: str
async def convert(self, data: Any, fromMimeType: str, toMimeType: str, options: BufferConvertorOptions = None) -> Any:
async def convert(self, data: Any, fromMimeType: str, toMimeType: str, options: MediaObjectOptions = None) -> Any:
pass
pass

Expand Down Expand Up @@ -782,7 +779,7 @@ async def openEntry(self) -> None:
pass

class EntrySensor:
entryOpen: bool
entryOpen: bool | Any
pass

class EventRecorder:
Expand Down Expand Up @@ -1559,10 +1556,10 @@ def lockState(self, value: LockState):
self.setScryptedProperty("lockState", value)

@property
def entryOpen(self) -> bool:
def entryOpen(self) -> bool | Any:
return self.getScryptedProperty("entryOpen")
@entryOpen.setter
def entryOpen(self, value: bool):
def entryOpen(self, value: bool | Any):
self.setScryptedProperty("entryOpen", value)

@property
Expand Down
16 changes: 10 additions & 6 deletions sdk/types/src/types.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ export interface Entry {

}
export interface EntrySensor {
entryOpen?: boolean;
entryOpen?: boolean | 'jammed';
}
/**
* DeviceManager is the interface used by DeviceProvider to report new devices, device states, and device events to Scrypted.
Expand Down Expand Up @@ -1054,16 +1054,12 @@ export interface Scriptable {
eval(source: ScriptSource, variables?: { [name: string]: any }): Promise<any>;
}

export interface BufferConvertorOptions {
sourceId?: string;
}

/**
* Add a converter to be used by Scrypted to convert buffers from one mime type to another mime type.
* May optionally accept string urls if accept-url is a fromMimeType parameter.
*/
export interface BufferConverter {
convert(data: string | Buffer | any, fromMimeType: string, toMimeType: string, options?: BufferConvertorOptions): Promise<MediaObject | Buffer | any>;
convert(data: string | Buffer | any, fromMimeType: string, toMimeType: string, options?: MediaObjectOptions): Promise<MediaObject | Buffer | any>;

fromMimeType?: string;
toMimeType?: string;
Expand Down Expand Up @@ -1347,6 +1343,7 @@ export interface MediaObjectOptions {
* The device id of the source of the MediaObject.
*/
sourceId?: string;
metadata?: any;
}

/**
Expand Down Expand Up @@ -2088,4 +2085,11 @@ export interface ScryptedStatic {
* @param options
*/
connect?(socket: NodeNetSocket, options?: ConnectOptions): void;
/**
* Attempt to retrieve an IPC object by directly connecting to the plugin
* that owns the object. All operations on this object will bypass routing
* through the Scrypted Server which typically manages plugin communication.
* This is ideal for sending large amounts of data via IPC.
*/
ipcObject?<T>(value: T): Promise<T>;
}

0 comments on commit fbbb916

Please sign in to comment.