id property

ZenohId get id

The ZenohId of the HLC that produced this timestamp.

Implementation

ZenohId get id {
  final tsSize = bindings.zd_timestamp_sizeof();
  final idSize = bindings.zd_id_sizeof();
  assert(tsSize == 24, 'z_timestamp_t drifted from 24 bytes: $tsSize');
  assert(idSize == 16, 'z_id_t drifted from 16 bytes: $idSize');
  final tsPtr = calloc<Uint8>(tsSize);
  final idPtr = calloc<Uint8>(idSize);
  try {
    tsPtr.asTypedList(tsSize).setAll(0, _raw);
    bindings.zd_timestamp_id(tsPtr, idPtr);
    return ZenohId(Uint8List.fromList(idPtr.asTypedList(idSize)));
  } finally {
    calloc
      ..free(tsPtr)
      ..free(idPtr);
  }
}