getLicenseFileSerial static method

String getLicenseFileSerial()

Retrieves the serial number of the previously loaded license.

return The license serial number. throws FaceException An error has occurred during Face Library execution.

Implementation

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