activateActivationKeyBuffer static method
Activates a license using an activation key and returns the license in a data buffer.
param hardwareCode The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function. param activationKey The id3 activation key. param commentary Commentary associated to this license activation. return The license data buffer. throws BiosealException An error has occurred during Bioseal Library execution.
Implementation
static Uint8List activateActivationKeyBuffer(String? hardwareCode, String? activationKey, String? commentary) {
Pointer<Char>? pHardwareCode = hardwareCode?.toNativeUtf8().cast<Char>();
Pointer<Char>? pActivationKey = activationKey?.toNativeUtf8().cast<Char>();
Pointer<Char>? pCommentary = commentary?.toNativeUtf8().cast<Char>();
Pointer<UnsignedChar> pLicenseFileBuffer = calloc.allocate(2048);
Pointer<Int> pLicenseFileBufferSize = calloc.allocate(1);
pLicenseFileBufferSize[0] = 2048;
try {
var err = biosealSDK.id3BiosealLicense_ActivateActivationKeyBuffer(pHardwareCode ?? nullptr, pActivationKey ?? nullptr, pCommentary ?? nullptr, pLicenseFileBuffer, pLicenseFileBufferSize);
if (err == BiosealError.insufficientBuffer.value) {
calloc.free(pLicenseFileBuffer);
pLicenseFileBuffer = calloc.allocate(pLicenseFileBufferSize.value);
err = biosealSDK.id3BiosealLicense_ActivateActivationKeyBuffer(pHardwareCode ?? nullptr, pActivationKey ?? nullptr, pCommentary ?? nullptr, pLicenseFileBuffer, pLicenseFileBufferSize);
}
if (err != BiosealError.success.value) {
throw BiosealException(err);
}
final vLicenseFileBuffer = Uint8List.fromList(pLicenseFileBuffer.cast<Uint8>().asTypedList(pLicenseFileBufferSize.value));
return vLicenseFileBuffer;
} finally {
if (pHardwareCode != null) {
calloc.free(pHardwareCode);
}
if (pActivationKey != null) {
calloc.free(pActivationKey);
}
if (pCommentary != null) {
calloc.free(pCommentary);
}
calloc.free(pLicenseFileBuffer);
calloc.free(pLicenseFileBufferSize);
}
}