From 4425807e26c35fa8d3874b6f93948ece64c147f1 Mon Sep 17 00:00:00 2001 From: James <158135022+yqz562@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:42:23 +0800 Subject: [PATCH 1/2] Update offline-registration-license.md --- faq/general/offline-registration-license.md | 137 ++++++++++---------- 1 file changed, 70 insertions(+), 67 deletions(-) diff --git a/faq/general/offline-registration-license.md b/faq/general/offline-registration-license.md index d1741683..445fe91f 100644 --- a/faq/general/offline-registration-license.md +++ b/faq/general/offline-registration-license.md @@ -26,36 +26,43 @@ You can follow the steps below to manually register the device and get the licen 4. Unzip the file and run the GenerateUUID tool on the device to be registered and get the UUID.
-For Windows:
--Open Command Prompt (cmd.exe)
--Change the working directory to the one where GenerateUUID.exe is
--Run the command `GenerateUUID.exe`
-The returned string, e.g. 8ECCA3B6-66F9-4fd6-B6B6-308C874140C6, is the machine ID.
-![uuid](./assets/uuid.jpg)
- - -For Linux:
--Open Terminal
--Change the working directory to the one where GenerateUUID.exe is
--Run the command ` sudo chmod 777 GenerateUUID`
--After inputting the password, run `./GenerateUUID`
- -You will see the generated UUID like this (the ID should be different)
-SoftbindUUID:230e089a-7dc3-4caa-9c77-f7cc6d567f9b
-"230e089a-7dc3-4caa-9c77-f7cc6d567f9b" is the generated UUID. You can now use it to register the device and get an Authorization String for it.
- -> Note: If your device is an arm based architecture, please use get device uuid API to generate the uuid: -> ```python -> # sample code in python -> print(BarcodeReader.get_device_uuid(1)) -> ``` - -> Note: If you want multiple users in operating system to use the license, you will need to move the .Dynamsoft folder to a path where all the users can access. Let us say `/Home/shared/.Dynamsoft`. -> For all the programs in the devices, you will need to set the license cache path to `/Home/shared` before initialize the license -> ```python -> # set license cache path before initialize the license -> BarcodeReader.set_license_cache_path("/Home/shared") -> ``` +## For Windows: + +1. Open Command Prompt (cmd.exe) +2. Change the working directory to the one where `GenerateUUID.exe` is located +3. Run the command: `GenerateUUID.exe` + +The returned string, e.g. `8ECCA3B6-66F9-4fd6-B6B6-308C874140C6`, is the machine ID. + +![uuid](./assets/uuid.jpg) + +## For Linux: + +1. Open Terminal +2. Change the working directory to the one where `GenerateUUID` is located +3. Run the command: `sudo chmod 777 GenerateUUID` +4. After inputting the password, run: `./GenerateUUID` + + You will see the generated UUID like this (the ID should be different): + + ``` + SoftbindUUID: 230e089a-7dc3-4caa-9c77-f7cc6d567f9b + ``` + + `230e089a-7dc3-4caa-9c77-f7cc6d567f9b` is the generated UUID. You can now use it to register the device and get an Authorization String for it. + + > Note: If your device is an ARM-based architecture, please use get device uuid API to generate the uuid: + > ```python + > # sample code in python + > print(BarcodeReader.get_device_uuid(1)) + > ``` + + > Note: If you want multiple users in operating system to use the license, you will need to move the .Dynamsoft folder to a path where all the users can access. Let us say `/Home/shared/.Dynamsoft`. + > For all the programs in the devices, you will need to set the license cache path to `/Home/shared` before initialize the license + > ```python + > # set license cache path before initialize the license + > BarcodeReader.set_license_cache_path("/Home/shared") + > ``` 5. Input the generated UUID and device name and click Submit. @@ -79,54 +86,50 @@ Code snippet in C: ``` Code snippet in C++ ```C++ - char errorBuf[512]; - dynamsoft::dbr::CBarcodeReader::InitLicense("DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL …", errorBuf, 512); - CBarcodeReader* reader = new CBarcodeReader(); +errorCode = CLicenseManager::InitLicense("YOUR-LICENSE-KEY", szErrorMsg, 256); +if (errorCode != ErrorCode::EC_OK && errorCode != ErrorCode::EC_LICENSE_CACHE_USED) +{ + cout << "License initialization failed: ErrorCode: " << errorCode << ", ErrorString: " << szErrorMsg << endl; +} +else +{ + // other codes... +} // add further process ``` Code snippet in C#: ```C# -string errorMsg; - BarcodeReader.InitLicense("DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL…", out errorMsg); - BarcodeReader reader = new BarcodeReader(); - // add further process +errorCode = LicenseManager.InitLicense("YOUR-LICENSE-KEY", out errorMsg); +if (errorCode != (int)EnumErrorCode.EC_OK && errorCode != (int)EnumErrorCode.EC_LICENSE_CACHE_USED) +{ + Console.WriteLine("License initialization error: " + errorMsg); +} +else +{ + CaptureVisionRouter cvr = new CaptureVisionRouter(); + // add code for further process +} ``` Code snippet in Java: ```Java - BarcodeReader.initLicense("DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL…"); - BarcodeReader reader = new BarcodeReader(); - // add further process + LicenseError licenseError = LicenseManager.initLicense("YOUR-LICENSE-KEY"); + if (licenseError.getErrorCode() != EnumErrorCode.EC_OK && + licenseError.getErrorCode() != EnumErrorCode.EC_LICENSE_CACHE_USED) { + System.out.println("License initialization error: " + licenseError.getErrorString()); + } else { + CaptureVisionRouter cvrInstance = new CaptureVisionRouter(); + // add code for further process + } ``` Code snippet in Python: ```Python -error = BarcodeReader.init_license("DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL…") -dbr = BarcodeReader() -``` -Code snippet in Android SDK: -```java -BarcodeReader.initLicense("DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL…", new DBRLicenseVerificationListener() { - @Override - public void DBRLicenseVerificationCallback(boolean isSuccessful, Exception e) { -// Add your code for license verification. - } -}); -``` -Code snippet in Objective-C: -```Objective-C -[DynamsoftBarcodeReader initLicense:@" DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL…" verificationDelegate:self]; -- (void)DBRLicenseVerificationCallback:(bool)isSuccess error:(NSError *)error -{ - // Add your code for license verification. -} -``` -Code snippet in Swift: -```Swift -DynamsoftBarcodeReader.initLicense("DLC2+4LgkxoZik5yCuJxMDneqJPVQZJROL…", verificationDelegate: self) -func dbrLicenseVerificationCallback(_ isSuccess: Bool, error: Error?) -{ - // Add your code for license verification. -} +error_code, error_msg = LicenseManager.init_license("YOUR-LICENSE-KEY") +if error_code != EnumErrorCode.EC_OK.value and error_code != EnumErrorCode.EC_LICENSE_CACHE_USED.value: + print("License initialization error: " + error_msg) +else: + cvr_instance = CaptureVisionRouter() ``` + From 1c2601cb89bf14e19e8e19190a95d18c00ae729d Mon Sep 17 00:00:00 2001 From: James <158135022+yqz562@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:59:56 +0800 Subject: [PATCH 2/2] Update offline-registration-license.md --- faq/general/offline-registration-license.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/faq/general/offline-registration-license.md b/faq/general/offline-registration-license.md index 445fe91f..f852ab97 100644 --- a/faq/general/offline-registration-license.md +++ b/faq/general/offline-registration-license.md @@ -57,8 +57,8 @@ The returned string, e.g. `8ECCA3B6-66F9-4fd6-B6B6-308C874140C6`, is the machine > print(BarcodeReader.get_device_uuid(1)) > ``` - > Note: If you want multiple users in operating system to use the license, you will need to move the .Dynamsoft folder to a path where all the users can access. Let us say `/Home/shared/.Dynamsoft`. - > For all the programs in the devices, you will need to set the license cache path to `/Home/shared` before initialize the license + > Note: If you want multiple users in operating system to use the license, you will need to move the Dynamsoft folder to a path where all the users can access. Let us say `/Home/shared/.Dynamsoft`. + > For all the programs in the devices, you will need to set the license cache path to `/Home/shared` before initializing the license > ```python > # set license cache path before initialize the license > BarcodeReader.set_license_cache_path("/Home/shared")