getHostHardwareCode static method
- LicenseHardwareCodeType hardwareCodeType
Retrieves the hardware code of the device using the requested hardware code type. This function retrieves the hardware code of the device you run the library on. The optional parameter is required:
- On Android, it must be the JNIEnv* pointer cast as a void*.
- In other cases, it must be set to NULL.
param hardwareCodeType The requested hardware code type. return The device hardware code. throws BiosealException An error has occurred during Bioseal Library execution.
Implementation
static String getHostHardwareCode(LicenseHardwareCodeType hardwareCodeType) {
Pointer<Char> pCode = calloc.allocate(256);
Pointer<Int> pCodeSize = calloc.allocate(1);
pCodeSize[0] = 256;
Pointer<Void> pOptionalParameter = nullptr;
if (Platform.isAndroid) {
pOptionalParameter = getJniEnvPtr();
}
try {
var err = biosealSDK.id3BiosealLicense_GetHostHardwareCode(hardwareCodeType.value, pCode, pCodeSize, pOptionalParameter);
if (err == BiosealError.insufficientBuffer.value) {
calloc.free(pCode);
pCode = calloc.allocate(pCodeSize.value);
err = biosealSDK.id3BiosealLicense_GetHostHardwareCode(hardwareCodeType.value, pCode, pCodeSize, pOptionalParameter);
if (err != BiosealError.success.value) {
throw BiosealException(err);
}
}
final vCode = utf8.decode(Uint8List.fromList(pCode.cast<Uint8>().asTypedList(pCodeSize.value)));
return vCode;
} finally {
calloc.free(pCode);
calloc.free(pCodeSize);
}
}