buildFunctMessage function

List<int> buildFunctMessage(
  1. int frameType,
  2. int functId,
  3. List<int>? functParam
)

Return data for a zwave function message

Implementation

List<int> buildFunctMessage(int frameType, int functId, List<int>? functParam) {
  var data = <int>[
    SOF, // start of frame
    3, // length
    frameType, // request
    functId,
  ];

  // Add function parameters if there are any
  if (functParam != null) {
    data.addAll(functParam);
    data[1] = data.length - 1; // update length field
  }

  appendCrc(data);

  return data;
}