Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bcc

This class provides methods for calculating the Block Check Character of a message.

export

Hierarchy

  • Bcc

Index

Constructors

Methods

Constructors

constructor

  • new Bcc(): Bcc

Methods

Static calculate

  • calculate(message: string[]): number
  • calculate(message: number[]): number
  • calculate(message: Buffer): number
  • This function calculates a Block Check Character for the given array of strings.

    Example

    console.log(calculateBcc(['01', '02', '03', '04']));
    

    Output

    4

    static

    Parameters

    • message: string[]

      The bytes of the message as a hex string array.

    Returns number

    The calculated BCC.

  • This function calculates a Block Check Character for the given array of numbers.

    Example

    console.log(Bcc.calculate([1, 2, 3, 4]));
    

    Output

    4

    static

    Parameters

    • message: number[]

      The bytes of the message as a number array.

    Returns number

    The calculated BCC.

  • This function calculates a Block Check Character for the buffer.

    Example

    console.log(Bcc.calculate(Buffer.from([1, 2, 3, 4])))
    

    Output

    4

    static

    Parameters

    • message: Buffer

      The bytes of the message as a buffer.

    Returns number

    The calculated BCC.

Generated using TypeDoc