A log entry is a hexadecimal line composed of :

  • a sequential ID (8)
  • epoch (8)
  • a list of parameters values (n * 4)
  • a log event ID (4)
  • a log event value (4)
  • a device ID (4)
  • a checkdigit (2)

This means that for 26 parameters, the length of a log is 134 hexadecimal characters.

calculateCheckDigit

Parse a current settings log.

parseCurrentSettings(line: string, options: object): object
Parameters
line (string)
options (object = {})
Name Description
options.flatten boolean (default false) The parsed log will have all properties at the same level (no sub-object for the parameters)
options.parametersArray boolean (default false) Add an array with all the parameters to the result
options.parameterLabel boolean (default false) Use the variable property of device info as property name
options.parameterInfo boolean (default false) Show all the information about the parameter in the value
options.kind string (default undefined) Specify a device type from those that exist in legoino-device-information
options.deviceInformation object (default undefined) Pass information for a device that does not exist in legoino-device-information . To use if options.kind is undefined.
Returns
object: The parsed settings.

Warning: parameters that are undefined are not returned!

Parse a multilog string

parseMultilog(buffer: any, options: object)
Parameters
buffer (any)
options (object = {})

Parse a multilog line.

parseMultilogLine(line: string, options: object): object
Parameters
line (string)
options (object = {})
Name Description
options.hasEvent boolean (default true) Specify wether the log contains an event
options.flatten boolean (default false) The parsed log will have all properties at the same level (no sub-object for the parameters)
options.parametersArray boolean (default false) Add an array with all the parameters to the result
options.parameterLabel boolean (default false) Use the variable property of device info as property name
options.parameterInfo boolean (default false) Show all the information about the parameter in the value
options.kind string (default undefined) Specify a device type from those that exist in legoino-device-information
options.deviceInformation object (default undefined) Pass information for a device that does not exist in legoino-device-information . To use if options.kind is undefined.
Returns
object: The parsed line.

Warning: parameters that are undefined are not returned!

Parse a buffer (String) containing 4 hexadecimal symbols per parameter

parseParameters(buffer: string, options: object): object
Parameters
buffer (string)
options (object = {})
Name Description
options.parameterLabel boolean (default false) Use the variable property of device info as property name
options.parameterInfo boolean (default false) Show all the information about the parameter in the value
options.flagInfo boolean (default false) Show all the information about the flags, can only be true if options.parameterInfo=true !
options.kind string (default undefined) Specify a device type from those that exist in legoino-device-information
options.deviceInformation object (default undefined) Pass information for a device that does not exist in legoino-device-information . To use if options.kind is undefined.
Returns
object: The parsed parameters