reactivateBuffer static method
Reactivates a license in a data buffer using the host hardware code and the product reference.
param hardwareCode The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function. param productReference The product reference. return The new license data buffer. throws FaceException An error has occurred during Face Library execution.
Implementation
static Uint8List reactivateBuffer(String? hardwareCode, String? productReference) {
Pointer<Char>? pHardwareCode = hardwareCode?.toNativeUtf8().cast<Char>();
Pointer<Char>? pProductReference = productReference?.toNativeUtf8().cast<Char>();
Pointer<UnsignedChar> pLicenseFileBuffer = calloc.allocate(2048);
Pointer<Int> pLicenseFileBufferSize = calloc.allocate(1);
pLicenseFileBufferSize[0] = 2048;
try {
var err = faceSDK.id3FaceLicense_ReactivateBuffer(pHardwareCode ?? nullptr, pProductReference ?? nullptr, pLicenseFileBuffer, pLicenseFileBufferSize);
if (err == FaceError.insufficientBuffer.value) {
calloc.free(pLicenseFileBuffer);
pLicenseFileBuffer = calloc.allocate(pLicenseFileBufferSize.value);
err = faceSDK.id3FaceLicense_ReactivateBuffer(pHardwareCode ?? nullptr, pProductReference ?? nullptr, pLicenseFileBuffer, pLicenseFileBufferSize);
}
if (err != FaceError.success.value) {
throw FaceException(err);
}
final vLicenseFileBuffer = Uint8List.fromList(pLicenseFileBuffer.cast<Uint8>().asTypedList(pLicenseFileBufferSize.value));
return vLicenseFileBuffer;
} finally {
if (pHardwareCode != null) {
calloc.free(pHardwareCode);
}
if (pProductReference != null) {
calloc.free(pProductReference);
}
calloc.free(pLicenseFileBuffer);
calloc.free(pLicenseFileBufferSize);
}
}