const PCCCDataType = { Binary: 1, BitString: 2, Byte: 3, Integer: 4, Timer: 5, Counter: 6, Control: 7, Float: 8, Array: 9, Address: 0xf, BCD: 0x10, PID: 0x15, Message: 0x16, SFCStatus: 0x1d, String: 0x1e, BlockTransfer: 0x20 };
function TypedReadReplyParser(data) {
  const info = TypedReadParserInfo(data);
  let offset = info.Length;
  let value = null;

  switch (info.dataTypeID) {
    case PCCCDataType.Binary:
    case PCCCDataType.BitString:
    case PCCCDataType.Byte:
      value = buffer.readUInt8(offset);
      break;
    case PCCCDataType.Integer:
      value = buffer.readInt32LE(offset); // buffer.readInt16LE(offset) ??
      break;
    case PCCCDataType.Float:
      value = buffer.readFloatLE(offset);
      break;
    case PCCCDataType.Array:
      value = TypedReadReplyParserArray(data.slice(offset, offset + info.dataSize));
      break;
    default:
      console.log('PCCC Error: Unknown Type: ' + info.dataTypeID);
  }
  return value;
}