getMessage method

String getMessage()

Gets the the log message.

return The log message. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String getMessage() {
  Pointer<Char> pMessage = nullptr;
  Pointer<Int> pMessageSize = calloc.allocate(1);
  pMessageSize[0] = -1;
  try {
    var err = biosealSDK.id3BiosealLogItem_GetMessage(_pHandle.value, pMessage, pMessageSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pMessage = calloc.allocate(pMessageSize.value);
      err = biosealSDK.id3BiosealLogItem_GetMessage(_pHandle.value, pMessage, pMessageSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vMessage = utf8.decode(Uint8List.fromList(pMessage.cast<Uint8>().asTypedList(pMessageSize.value)));
    return vMessage;
  } finally {
    calloc.free(pMessage);
    calloc.free(pMessageSize);
  }
}