Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Device

Device API

Hierarchy

  • Device

Index

Properties

add

add: (path: string, values?: JSObject) => Promise<string>

Add object to path

param

Path to add to (e.g. "Device.NAT.PortMapping.")

param

Optional object to add (if skipped will use default values)

returns

Full path of new object

await usp.add("Device.NAT.PortMapping.")

Type declaration

    • (path: string, values?: JSObject): Promise<string>
    • Parameters

      • path: string
      • Optional values: JSObject

      Returns Promise<string>

del

del: (path: string | string[]) => Promise<void>

Delete object at path

param

Full path to delete (e.g. "Device.NAT.PortMapping.1.")

await usp.del("Device.NAT.PortMapping.1.")

Type declaration

    • (path: string | string[]): Promise<void>
    • Parameters

      • path: string | string[]

      Returns Promise<void>

disconnect

disconnect: () => Promise<void>

Disconenct from device

await usp.disconnect()

Type declaration

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

get

get: (path: string | string[]) => Promise<JSType>

Get value at path

param

Location of value (e.g. "Device.DeviceInfo.")

await usp.get("Device.WiFi.Radio.1.")
// or
await usp.get(["Device.WiFi.Radio.1.", "Device.WiFi.Radio.2."])

Type declaration

    • (path: string | string[]): Promise<JSType>
    • Parameters

      • path: string | string[]

      Returns Promise<JSType>

id

id: () => string

Connection id

Type declaration

    • (): string
    • Returns string

operate

operate: (path: string, opts?: OperateOptions) => Promise<[OperateFunction, OperateCleanupFunction]>

Create a command

param

Full path of command (e.g. "Device.IP.Diagnostics.IPPing()")

param

Subscription options (not required)

returns

Function that executes command

const [ping, cleanPing] = await usp.operate("Device.IP.Diagnostics.IPPing()")
const results = await ping({ Host: "iopsys.eu" })
await cleanPing()

Type declaration

resolve

resolve: (msg: JSType, level?: number) => Promise<JSType>

Resolve references in message

param

Message with reference in it

param

Optional level of nesting to resolve to (avoid using high numbers)

await usp.get("Device.WiFi.Radio.1.").then(device.resolve)

Type declaration

    • Parameters

      • msg: JSType
      • Default value level: number = 1

      Returns Promise<JSType>

roles

roles: () => Role[]

Roles of current session

Type declaration

set

set: (path: string, value: JSType) => Promise<void>

Set value at path

param

Location of value (e.g. "Device.DeviceInfo.")

param

Value to assign

await usp.set("Device.WiFi.Radio.1.", { Name: "radio-1" })
// or
await usp.set("Device.WiFi.Radio.1.Name", "radio-1")

Type declaration

    • (path: string, value: JSType): Promise<void>
    • Parameters

      Returns Promise<void>

Generated using TypeDoc