getLicenseFileSerial static method

String getLicenseFileSerial()

Retrieves the serial number of the previously loaded license.

return The license serial number. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

static String getLicenseFileSerial() {
  Pointer<Char> pLicenseFileSerial = calloc.allocate(256);
  Pointer<Int> pLicenseFileSerialSize = calloc.allocate(1);
  pLicenseFileSerialSize[0] = 256;
  try {
    var err = biosealSDK.id3BiosealLicense_GetLicenseFileSerial(pLicenseFileSerial, pLicenseFileSerialSize);
    if (err == BiosealError.insufficientBuffer.value) {
      calloc.free(pLicenseFileSerial);
      pLicenseFileSerial = calloc.allocate(pLicenseFileSerialSize.value);
      err = biosealSDK.id3BiosealLicense_GetLicenseFileSerial(pLicenseFileSerial, pLicenseFileSerialSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vLicenseFileSerial = utf8.decode(Uint8List.fromList(pLicenseFileSerial.cast<Uint8>().asTypedList(pLicenseFileSerialSize.value)));
    return vLicenseFileSerial;
  } finally {
    calloc.free(pLicenseFileSerial);
    calloc.free(pLicenseFileSerialSize);
  }
}