int setDeviceLicense(void* context, BS2_DEVICE_ID id) { DeviceControl dc(context); BS2LicenseBlob licenseBlob = { 0, }; vector deviceIDs; vector licenseResult; int sdkResult = BS_SDK_SUCCESS; licenseBlob.licenseType = (BS2_LICENSE_TYPE)Utility::getInput("Enter the license type. (0: None, 1: Visual QR)"); licenseBlob.numOfDevices = (uint16_t)Utility::getInput("How many devices do you want to register?"); if (0 < licenseBlob.numOfDevices) { // Device ID for (uint16_t idx = 0; idx < licenseBlob.numOfDevices; idx++) { BS2_DEVICE_ID deviceID = (BS2_DEVICE_ID)Utility::getInput("Enter a device ID:"); deviceIDs.push_back(deviceID); } licenseBlob.deviceIDObjs = deviceIDs.data(); string pathName = Utility::getLine("Enter the path and name of license."); licenseBlob.licenseLen = Utility::getResourceSize(pathName); shared_ptr buffer(new uint8_t[licenseBlob.licenseLen], ArrayDeleter()); if (0 < licenseBlob.licenseLen && Utility::getResourceFromFile(pathName, buffer, licenseBlob.licenseLen)) { licenseBlob.licenseObj = buffer.get(); sdkResult = dc.enableDeviceLicense(id, &licenseBlob, licenseResult); if (BS_SDK_SUCCESS == sdkResult) DeviceControl::print(licenseResult); } } return sdkResult; } int DeviceControl::enableDeviceLicense(BS2_DEVICE_ID id, const BS2LicenseBlob* licenseBlob, vector& licenseResult) { BS2LicenseResult* result = NULL; uint32_t numOfResult = 0; int sdkResult = BS2_EnableDeviceLicense(context_, id, licenseBlob, &result, &numOfResult); if (BS_SDK_SUCCESS != sdkResult) { TRACE("BS2_EnableDeviceLicense call failed: %d", sdkResult); return sdkResult; } licenseResult.clear(); for (uint32_t idx = 0; idx < numOfResult; idx++) { licenseResult.push_back(result[idx]); } return sdkResult; }