Skip to content

Device info

Read the target device’s IP, credentials, hostname, and metadata, or ping it.


Returns the IP address of the device object.

Signature

D.device.ip()

Returns

  • string

Example

// returns '192.168.1.1' for a device with this local IP address
D.device.ip()

Returns the MAC address of the device object.

Signature

D.device.macAddress()

Returns

  • string

Example

// returns '00:11:22:33:44:AA' for a device
D.device.macAddress()

Returns the stored password of a device.

Signature

D.device.password()

Returns

  • string

Example

// returns 'the device password'
D.device.password()

Executes a ping operation to the device’s IP address.

Signature

D.device.ping(pingOptions, callback)

Parameters

pingOptions · `object`
The options for the ping operation.
pingOptions.count · `number` · optional, default `10`
The number of ICMP requests to send.
pingOptions.interval · `number` · optional, default `100`
The interval (in ms) between ICMP requests.
pingOptions.timeout · `number` · optional, default `1000`
The timeout (in ms) for each ICMP request.
pingOptions.packet_size · `number` · optional, default `16`
The size of the ICMP packet in bytes.
pingOptions.ttl · `number` · optional, default `64`
The Time-To-Live (TTL) value for the ICMP packets.
callback · `function`
The callback function to handle the ping result.
callback.result · `object` | `null` · optional
The result of the ping operation, or `null` if an error occurred. Contains the following fields:
callback.result.jitter · `number`
The jitter in milliseconds.
callback.result.avg · `number`
The average latency in milliseconds.
callback.result.packet_loss · `number`
The packet loss percentage.
callback.result.min · `number`
The minimum latency in milliseconds.
callback.result.max · `number`
The maximum latency in milliseconds.
callback.result.std · `number`
The standard deviation of latency in milliseconds.
callback.result.samples · `array`
The raw samples, in milliseconds.
callback.error · `Error` | `null` · optional
The error object if the ping operation failed, or `null` if successful.

Returns

  • void

Example

D.device.ping({ count: 5, interval: 100 }, function (result, error) {
if (error) {
console.error('Ping failed:', error);
} else {
console.log('Ping result:', result.avg);
}
});

Returns the serial number of the device object.

Signature

D.device.serial()

Returns

  • string

Example

// returns 'serial_number' for a device
D.device.serial()

Returns stored username of a device.

Signature

D.device.username()

Returns

  • string

Example

// returns 'the device username'
D.device.username()