getLicenseName static method

String getLicenseName()

Retrieves the license name.

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

Implementation

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