Options
All
  • Public
  • Public/Protected
  • All
Menu

Module types

Index

Enumerations

Interfaces

Type aliases

Type aliases

AddCommand

AddCommand: (path: string | string[], value?: (JSValue | JSValue[] | InputRecord) | (JSValue | JSValue[] | InputRecord)[] | null, options?: { raw?: false }) => Promise<AddResponse> & (path: string | string[], value: (JSValue | JSValue[] | InputRecord) | (JSValue | JSValue[] | InputRecord)[] | null | undefined, options: { raw: true }) => Promise<AddRawResponse> & (values: [string, JSValue | JSValue[] | InputRecord][], options?: { raw?: boolean }) => Promise<AddResponse>

AddLookupCreateObject

AddLookupCreateObject: "Add.CreateObject"

AddLookupCreateParamSetting

AddLookupCreateParamSetting: "Add.CreateParamSetting"

AddRawResponse

AddRawResponse: { body: { response: { addResp: { createdObjResults: { operStatus: { operSuccess: { instantiatedPath: string; uniqueKeys: Record<string, string> } }; requestedPath: string }[] } } }; header: { msgId: string; msgType: "ADD_RESP" } }

Type declaration

  • body: { response: { addResp: { createdObjResults: { operStatus: { operSuccess: { instantiatedPath: string; uniqueKeys: Record<string, string> } }; requestedPath: string }[] } } }
    • response: { addResp: { createdObjResults: { operStatus: { operSuccess: { instantiatedPath: string; uniqueKeys: Record<string, string> } }; requestedPath: string }[] } }
      • addResp: { createdObjResults: { operStatus: { operSuccess: { instantiatedPath: string; uniqueKeys: Record<string, string> } }; requestedPath: string }[] }
        • createdObjResults: { operStatus: { operSuccess: { instantiatedPath: string; uniqueKeys: Record<string, string> } }; requestedPath: string }[]
  • header: { msgId: string; msgType: "ADD_RESP" }
    • msgId: string
    • msgType: "ADD_RESP"

AddResponse

AddResponse: string[]

BaseRecord

BaseRecord: { disconnect?: string; fromId: string; noSessionContext?: { payload: string }; sessionContext?: { payload: string[] }; toId: string; version: USPVersion }

Type declaration

  • Optional disconnect?: string
  • fromId: string
  • Optional noSessionContext?: { payload: string }
    • payload: string
  • Optional sessionContext?: { payload: string[] }
    • payload: string[]
  • toId: string
  • version: USPVersion

BuildConnectionFn

BuildConnectionFn: (connectConfig: { connectClient: ConnectClientFn; decodeID: DecodeIDFn; errors?: Record<VerifyResult, string>; loadProtobuf: LoadProtobufFn }) => Connect

Type declaration

CallArgs

CallArgs: Record<string, any>

CallFn

CallFn: (cmd: CommandType, args: Record<string, any>, callOpts?: CallOptions) => Promise<any>

Type declaration

CallOptions

CallOptions: { responseMsgType?: CommandType }

Type declaration

CallbackOptions

CallbackOptions: { sendResp: boolean }

Type declaration

  • sendResp: boolean

CertType

CertType: string | string[] | Buffer | Buffer[]

ClearFn

ClearFn: () => void

Type declaration

    • (): void
    • Returns void

Command

CommandObject

CommandObject: { decode: DecodeFn; encode: EncodeFn }

Type declaration

CommandOptions

CommandOptions: GetCommandOptions

CommandTrigger

CommandTrigger: { decode: string | ((msg: Record<string, string>) => boolean); encode: string }

Type declaration

  • decode: string | ((msg: Record<string, string>) => boolean)
  • encode: string

CommandType

CommandType: "GET" | "SET" | "ADD" | "DELETE" | "OPERATE" | "NOTIFY" | "NOTIFY_RESP" | "GET_SUPPORTED_DM" | "GET_INSTANCES" | "GET_SUPPORTED_PROTO"

Connect

Connect: (options: ConnectionOptions, events?: ConnectionEvents) => Promise<USP>

Connect to device

param

Connection options

param

Optional event handlers

returns

A set of functions for interacting with the device

Type declaration

ConnectClientFn

ConnectClientFn: (options: ConnectionOptions) => Promise<ConnectionClient>

Type declaration

ConnectionClient

ConnectionClient: { end: () => void; on: (key: string, responseFn: (topic: string, data: any) => void) => void; publish: (endpoint: string, msg: any) => void; subscribe: (to: string) => void; unsubscribe: (from: string) => void }

Type declaration

  • end: () => void
      • (): void
      • Returns void

  • on: (key: string, responseFn: (topic: string, data: any) => void) => void
      • (key: string, responseFn: (topic: string, data: any) => void): void
      • Parameters

        • key: string
        • responseFn: (topic: string, data: any) => void
            • (topic: string, data: any): void
            • Parameters

              • topic: string
              • data: any

              Returns void

        Returns void

  • publish: (endpoint: string, msg: any) => void
      • (endpoint: string, msg: any): void
      • Parameters

        • endpoint: string
        • msg: any

        Returns void

  • subscribe: (to: string) => void
      • (to: string): void
      • Parameters

        • to: string

        Returns void

  • unsubscribe: (from: string) => void
      • (from: string): void
      • Parameters

        • from: string

        Returns void

ConnectionOptions

DecodeFn

DecodeFn: (msg: Record<string, any>, decodeOptions?: DecodeOptions) => DecodeResponse | [any]

Type declaration

DecodeIDFn

DecodeIDFn: (data: any) => string

Type declaration

    • (data: any): string
    • Parameters

      • data: any

      Returns string

DecodeOptions

DecodeOptions: { raw?: boolean; retainPath?: boolean }

Type declaration

  • Optional raw?: boolean
  • Optional retainPath?: boolean

DecodeResponse

DecodeResponse: [any] | [any, ResponseID | null, null | Response] | [any, ResponseID | null, null | Response, CommandType]

DelCommand

DelCommand: (path: string | string[], allowPartial?: boolean) => Promise<string[]>

Type declaration

    • (path: string | string[], allowPartial?: boolean): Promise<string[]>
    • Parameters

      • path: string | string[]
      • Optional allowPartial: boolean

      Returns Promise<string[]>

EncodeArgs

EncodeArgs: { args: Record<string, any>; header: any; options: Record<string, string>; rootMsg: any; rootRecord: any }

Type declaration

  • args: Record<string, any>
  • header: any
  • options: Record<string, string>
  • rootMsg: any
  • rootRecord: any

EncodeFn

EncodeFn: (args: Record<string, any>) => PbRequestMessage

Type declaration

GetCommand

GetCommand: (paths: string | string[], options?: GetCommandOptions) => Promise<GetReturn>

Type declaration

GetCommandGeneralOptions

GetCommandGeneralOptions: { max_depth?: number }

Type declaration

  • Optional max_depth?: number

    Defaults to 2 (Only applies to usp version 1.2 )

GetCommandOptions

GetCommandOptions: { raw?: boolean; retainPath?: boolean } & GetCommandGeneralOptions

GetNestedCommand

GetNestedCommand: <T>(path: string, options?: GetNestedCommandOptions) => Promise<T> & <T>(paths: string[], options?: GetNestedCommandOptions) => Promise<T[]>

GetNestedCommandOptions

GetNestedCommandOptions: {} & GetCommandGeneralOptions

GetNestedReturn

GetReturn

GetReturn: string | Record<string, any> | Record<string, any>[]

HostConnectionOptions

HostConnectionOptions: { host: string; hostname?: string; path?: string; port: number; protocol: "wss" | "ws" | "mqtt" | "mqtts" | "tcp" | "ssl" | "wx" | "wxs" } & MainConnectionOptions

InputRecord

InputRecord: {} & { allowPartial?: boolean }

InstancesCommand

InstancesCommand: (paths: string | string[], opts?: { firstLevelOnly?: boolean }) => Promise<Record<string, any>>

Type declaration

    • (paths: string | string[], opts?: { firstLevelOnly?: boolean }): Promise<Record<string, any>>
    • Parameters

      • paths: string | string[]
      • Optional opts: { firstLevelOnly?: boolean }
        • Optional firstLevelOnly?: boolean

      Returns Promise<Record<string, any>>

JSValue

JSValue: string | number | boolean

LoadProtobufFn

LoadProtobufFn: (version: USPVersion) => Promise<Proto>

Type declaration

MakeFn

MakeFn: (call: CallFn, on: OnFn) => Command

Type declaration

MakeRecipeFn

MakeRecipeFn: (call: CallFn) => Recipe

Type declaration

MqttOptions

MqttOptions: { reconnectPeriod?: number }

Type declaration

  • Optional reconnectPeriod?: number

OnCallback

OnCallback: (msg: Response, fullMsg?: Record<string, any>, opts?: CallbackOptions) => void

Type declaration

OnFn

OnFn: (ident: OnIdent, callback: OnCallback) => ClearFn

Type declaration

OnIdent

OnIdent: string | RegExp

OperateClearFn

OperateClearFn: () => Promise<void>

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

OperateCommand

OperateCommand: (path: string, id: string, resp: boolean, input?: Record<string, any>) => Promise<any>

Type declaration

    • (path: string, id: string, resp: boolean, input?: Record<string, any>): Promise<any>
    • Parameters

      • path: string
      • id: string
      • resp: boolean
      • Optional input: Record<string, any>

      Returns Promise<any>

OperateFn

OperateFn: { subscribe: (cb: (msg: any) => void, opts?: OperateSubscribeOptions) => { trigger: (input?: Record<string, any>) => Promise<any> } }

Type declaration

    • (input?: Record<string, string>): Promise<any>
    • Parameters

      • Optional input: Record<string, string>

      Returns Promise<any>

  • subscribe: (cb: (msg: any) => void, opts?: OperateSubscribeOptions) => { trigger: (input?: Record<string, any>) => Promise<any> }
      • (cb: (msg: any) => void, opts?: OperateSubscribeOptions): { trigger: (input?: Record<string, any>) => Promise<any> }
      • Parameters

        Returns { trigger: (input?: Record<string, any>) => Promise<any> }

        • trigger: (input?: Record<string, any>) => Promise<any>
            • (input?: Record<string, any>): Promise<any>
            • Parameters

              • Optional input: Record<string, any>

              Returns Promise<any>

OperateRecipe

OperateRecipe: (path: string, opts?: OperateOptions) => Promise<[OperateFn, OperateClearFn]>

Type declaration

OperateSubscribeOptions

OperateSubscribeOptions: { skipOperateResponse?: boolean }

Type declaration

  • Optional skipOperateResponse?: boolean

    Skip response from calling operate, defaults to true

Options

Options: { get?: { max_depth?: number; retainPath?: boolean }; postCall?: PostCallCallback; preCall?: PreCallCallback; timeout?: number }

Options that allow extending command funcitonality

Type declaration

  • Optional get?: { max_depth?: number; retainPath?: boolean }
    • Optional max_depth?: number

      Set the max depth parameter to all get calls

    • Optional retainPath?: boolean

      Set the retainPath option to all get calls

  • Optional postCall?: PostCallCallback

    Call after before command

  • Optional preCall?: PreCallCallback

    Call function before command

  • Optional timeout?: number

    Timeout command after given number of milliseconds (throws an error for handling with catch)

PbRequestCommand

PbRequestCommandAdd

PbRequestCommandAdd: { add: { allowPartial: boolean; createObjs: { lookup: AddLookupCreateObject; objPath: string; paramSettings: { lookup: AddLookupCreateParamSetting; param: string; required: boolean; value: any }[] }[] } }

Type declaration

PbRequestCommandDel

PbRequestCommandDel: { delete: { allowPartial: boolean; objPaths: string[] } }

Type declaration

  • delete: { allowPartial: boolean; objPaths: string[] }
    • allowPartial: boolean
    • objPaths: string[]

PbRequestCommandGet

PbRequestCommandGet: { get: { paramPaths: string[] } }

Type declaration

  • get: { paramPaths: string[] }
    • paramPaths: string[]

PbRequestCommandInstance

PbRequestCommandInstance: { getInstances: { firstLevelOnly: boolean; objPaths: string[] } }

Type declaration

  • getInstances: { firstLevelOnly: boolean; objPaths: string[] }
    • firstLevelOnly: boolean
    • objPaths: string[]

PbRequestCommandNotify

PbRequestCommandNotify: { notify: { sendResp: boolean; subscriptionId: string } }

Type declaration

  • notify: { sendResp: boolean; subscriptionId: string }
    • [key: string]: unknown
    • sendResp: boolean
    • subscriptionId: string

PbRequestCommandNotifyResp

PbRequestCommandNotifyResp: { notifyResp: { subscriptionId: string } }

Type declaration

  • notifyResp: { subscriptionId: string }
    • subscriptionId: string

PbRequestCommandOperate

PbRequestCommandOperate: { operate: { command: string; commandKey: string; inputArgs: Record<string, any>; sendResp: boolean } }

Type declaration

  • operate: { command: string; commandKey: string; inputArgs: Record<string, any>; sendResp: boolean }
    • command: string
    • commandKey: string
    • inputArgs: Record<string, any>
    • sendResp: boolean

PbRequestCommandSet

PbRequestCommandSet: { set: { allowPartial: boolean; updateObjs: { lookup: SetLookupUpdateObject; objPath: string; paramSettings: { lookup: SetLookupUpdateParamSetting; param: string; required: boolean; value: any }[] }[] } }

Type declaration

PbRequestCommandSupport

PbRequestCommandSupport: { getSupportedDm: { firstLevelOnly: boolean; objPaths: string[]; returnCommands: boolean; returnEvents: boolean; returnParams: boolean } }

Type declaration

  • getSupportedDm: { firstLevelOnly: boolean; objPaths: string[]; returnCommands: boolean; returnEvents: boolean; returnParams: boolean }
    • firstLevelOnly: boolean
    • objPaths: string[]
    • returnCommands: boolean
    • returnEvents: boolean
    • returnParams: boolean

PbRequestCommandSupportProto

PbRequestCommandSupportProto: { getSupportedProtocol: { controllerSupportedProtocolVersions: string } }

Type declaration

  • getSupportedProtocol: { controllerSupportedProtocolVersions: string }
    • controllerSupportedProtocolVersions: string

PostCallCallback

PostCallCallback: (name: string, args: any[], result: any) => void

Type declaration

    • (name: string, args: any[], result: any): void
    • Parameters

      • name: string
      • args: any[]
      • result: any

      Returns void

PreCallCallback

PreCallCallback: (name: string, args: any[]) => void

Type declaration

    • (name: string, args: any[]): void
    • Parameters

      • name: string
      • args: any[]

      Returns void

PromiseClearFn

PromiseClearFn: () => Promise<void>

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

Proto

Proto: { header: any; rootMsg: any; rootRecord: any }

Type declaration

  • header: any
  • rootMsg: any
  • rootRecord: any

Recipe

ResolveRecipe

ResolveRecipe: (msg: GetReturn, level?: number) => Promise<GetReturn>

Type declaration

Response

Response: string | Record<string, any>

ResponseID

ResponseID: "ignore" | "error" | string

SessionInitMsg

SessionInitMsg: { fromId: string; sessionContext: { expectedId: string; sequenceId: string; sessionId: string }; toId: string; version: USPVersion }

Type declaration

  • fromId: string
  • sessionContext: { expectedId: string; sequenceId: string; sessionId: string }
    • expectedId: string
    • sequenceId: string
    • sessionId: string
  • toId: string
  • version: USPVersion

SetCommand

SetCommand: (path: string | string[], value: (JSValue | JSValue[] | InputRecord) | (JSValue | JSValue[] | InputRecord)[], options?: { raw?: false } & SetCommandOptions) => Promise<SetResponse> & (path: string | string[], value: (JSValue | JSValue[] | InputRecord) | (JSValue | JSValue[] | InputRecord)[], options: { raw: true } & SetCommandOptions) => Promise<SetRawResponse> & (values: [string, JSValue | JSValue[] | InputRecord][], options?: SetCommandOptions) => Promise<SetResponse>

SetCommandOptions

SetCommandOptions: { raw?: boolean }

Type declaration

  • Optional raw?: boolean

    Prints raw set response message

SetLookupUpdateObject

SetLookupUpdateObject: "Set.UpdateObject"

SetLookupUpdateParamSetting

SetLookupUpdateParamSetting: "Set.UpdateParamSetting"

SetRawResponse

SetRawResponse: { body: { response: { setResp: { updatedObjResults: { operStatus: { operSuccess: { updatedInstResults: [{ affectedPath: string; updatedParams: Record<string, string> }] } }; requestedPath: string }[] } } }; header: { msgId: string; msgType: "SET_RESP" } }

Type declaration

  • body: { response: { setResp: { updatedObjResults: { operStatus: { operSuccess: { updatedInstResults: [{ affectedPath: string; updatedParams: Record<string, string> }] } }; requestedPath: string }[] } } }
    • response: { setResp: { updatedObjResults: { operStatus: { operSuccess: { updatedInstResults: [{ affectedPath: string; updatedParams: Record<string, string> }] } }; requestedPath: string }[] } }
      • setResp: { updatedObjResults: { operStatus: { operSuccess: { updatedInstResults: [{ affectedPath: string; updatedParams: Record<string, string> }] } }; requestedPath: string }[] }
        • updatedObjResults: { operStatus: { operSuccess: { updatedInstResults: [{ affectedPath: string; updatedParams: Record<string, string> }] } }; requestedPath: string }[]
  • header: { msgId: string; msgType: "SET_RESP" }
    • msgId: string
    • msgType: "SET_RESP"

SetResponse

SetResponse: { affectedPath: string; updatedParams: Record<string, string> }[]

SubscribeRecipe

SubscribeRecipe: (opts: SubscriptionOptions, callback: SubscriptionCallback) => Promise<PromiseClearFn>

Type declaration

SubscriptionCallback

SubscriptionCallback: (msg: Response, fullMsg?: Record<string, any>) => void

Type declaration

    • (msg: Response, fullMsg?: Record<string, any>): void
    • Parameters

      • msg: Response
      • Optional fullMsg: Record<string, any>

      Returns void

SupportedDMCommand

SupportedDMCommand: (paths: string | string[], opts?: SuportedCommandOpts) => Promise<Record<string, any>>

Type declaration

    • Parameters

      Returns Promise<Record<string, any>>

SupportedProtoCommand

SupportedProtoCommand: (version?: USPVersion) => Promise<string[]>

Type declaration

    • Parameters

      Returns Promise<string[]>

URLConnectionOptions

URLConnectionOptions: { url: string } & MainConnectionOptions

USPSession

USPSession: { expectedId?: number; payloadSarState?: 0 | 1 | 2 | 3; payloadrecSarState?: 0 | 1 | 2 | 3; retransmitId?: number; sequenceId: number; sessionId: number }

Type declaration

  • Optional expectedId?: number
  • Optional payloadSarState?: 0 | 1 | 2 | 3
  • Optional payloadrecSarState?: 0 | 1 | 2 | 3
  • Optional retransmitId?: number
  • sequenceId: number
  • sessionId: number

USPVersion

USPVersion: typeof knownUSPVersions[number]

UspObject

UspObject: { __query__: string; result: { __query__: string } }

Type declaration

  • __query__: string
  • result: { __query__: string }
    • [key: string]: ReturnValue
    • __query__: string

UspObjectList

UspObjectList: { __query__: string; result: { __query__: string }[] }

Type declaration

  • __query__: string
  • result: { __query__: string }[]

UspProperty

UspProperty: { __query__: string; result: string }

Type declaration

  • __query__: string
  • result: string

UspPropertyList

UspPropertyList: { __query__: string; result: { __query__: string; result: string }[] }

Type declaration

  • __query__: string
  • result: { __query__: string; result: string }[]

VerifierFunc

VerifierFunc: (args: Record<string, any>) => VerifyResult

Type declaration

Generated using TypeDoc