Command

Command

new Command()

Source:

The base class for all commands

Members

adapter :Adapter

Source:

The adapter instance

Type:

args :Object

Source:

The args passed in from K4Model

Type:
  • Object

body :Buffer

Source:

The command body.

Type:
  • Buffer

device :Device

Source:

The device the command was sent to

Type:
Source:

The header (if any) for this command. Can either be a Buffer or an Object whose 'packet' field is a Buffer containing the relevant header data.

Type:
  • Buffer | Object

name :String

Source:

The command name

Type:
  • String

nested :Boolean

Source:

Returns true if commands is nested and supports commands() function

Type:
  • Boolean

Methods

(abstract) buildBody() → {Buffer}

Source:

Builds a data buffer for the command, and assigns it to the body property of this Command object.

Returns:
Type
Buffer

(abstract) buildHeader() → {Buffer|Object}

Source:

Builds a header for the command, and assigns it to the header property of this Command object.

Returns:
Type
Buffer | Object

(abstract) commands() → {Promise}

Source:

Return a promise chain of nested commands. buildBody() will not be called if commands() exists

Returns:
Type
Promise

(abstract) response(response) → {Object}

Source:

Optionally build a response object

Parameters:
Name Type Description
response Response

The command response

Returns:

Object to return to the model

Type
Object