1.1.2 • Published 2 years ago

@particle/device-control-util v1.1.2

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 years ago

@particle/device-control-util

Utility classes and functions used by other packages in this repository.

Installation

npm install @particle/device-control-util --save

API

areEqualArrays(arr1, arr2) ⇒ Boolean

Compare two array-like objects.

Kind: global function
Returns: Boolean - true if the arrays are equal or false otherwise.

ParamTypeDescription
arr1Array.<*>First array.
arr2Array.<*>Second array.

writeUint32Be(buf, val, offs)

Write a 32-bit unsigned integer to a buffer (big-endian).

Kind: global function

ParamTypeDefaultDescription
bufUint8ArrayDestination buffer.
valNumberValue.
offsNumber0Offset in the destination buffer.

writeUint32Le(buf, val, offs)

Write a 32-bit unsigned integer to a buffer (little-endian).

Kind: global function

ParamTypeDefaultDescription
bufUint8ArrayDestination buffer.
valNumberValue.
offsNumber0Offset in the destination buffer.

writeUint16Be(buf, val, offs)

Write a 16-bit unsigned integer to a buffer (big-endian).

Kind: global function

ParamTypeDefaultDescription
bufUint8ArrayDestination buffer.
valNumberValue.
offsNumber0Offset in the destination buffer.

writeUint16Le(buf, val, offs)

Write a 16-bit unsigned integer to a buffer (little-endian).

Kind: global function

ParamTypeDefaultDescription
bufUint8ArrayDestination buffer.
valNumberValue.
offsNumber0Offset in the destination buffer.

writeUint8(buf, val, offs)

Write an 8-bit unsigned integer to a buffer.

Kind: global function

ParamTypeDefaultDescription
bufUint8ArrayDestination buffer.
valNumberValue.
offsNumber0Offset in the destination buffer.

readUint32Be(buf, offs) ⇒ Number

Read a 32-bit unsigned integer from a buffer (big-endian).

Kind: global function
Returns: Number - Value.

ParamTypeDefaultDescription
bufUint8ArraySource buffer.
offsNumber0Offset in the source buffer.

readUint32Le(buf, offs) ⇒ Number

Read a 32-bit unsigned integer from a buffer (little-endian).

Kind: global function
Returns: Number - Value.

ParamTypeDefaultDescription
bufUint8ArraySource buffer.
offsNumber0Offset in the source buffer.

readUint16Be(buf, offs) ⇒ Number

Read a 16-bit unsigned integer from a buffer (big-endian).

Kind: global function
Returns: Number - Value.

ParamTypeDefaultDescription
bufUint8ArraySource buffer.
offsNumber0Offset in the source buffer.

readUint16Le(buf, offs) ⇒ Number

Read a 16-bit unsigned integer from a buffer (little-endian).

Kind: global function
Returns: Number - Value.

ParamTypeDefaultDescription
bufUint8ArraySource buffer.
offsNumber0Offset in the source buffer.

readUint8(buf, offs) ⇒ Number

Read an 8-bit unsigned integer from a buffer.

Kind: global function
Returns: Number - Value.

ParamTypeDefaultDescription
bufUint8ArraySource buffer.
offsNumber0Offset in the source buffer.

toUint8Array(val) ⇒ Uint8Array

Convert a value to a Uint8Array.

Kind: global function

ParamTypeDescription
val*Value to convert.

concatUint8Arrays(...arrs) ⇒ Uint8Array

Concatenate a number of Uint8Array objects.

Kind: global function

ParamTypeDescription
...arrsUint8ArrayArrays to concatenate.

NOTE: Unfortunately, docs have a nasty habit of falling out of date. When in doubt, check usage in tests