This application is used as reference code for developers to show how to use the C++ API to generate a runtime key. Once a runtime key is generated it must be activated to produce a token.
By default GPU acceleration is disabled. Check here for more information on how to enable.
If you don't want to build this sample by yourself then, use the pre-built versions:
- Windows: runtimeKey.exe under binaries/windows/x86_64
- Linux: runtimeKey under binaries/linux/x86_64. Built on Ubuntu 18. You'll need to download libtensorflow.so as explained here.
- Raspberry Pi: runtimeKey under binaries/raspbian/armv7l
- Android: check android folder
On Windows, the easiest way to try this sample is to navigate to binaries/windows/x86_64 and run binaries/windows/x86_64/runtimeKey.bat.
This sample contains a single C++ source file and is easy to build. The documentation about the C++ API is at https://www.doubango.org/SDKs/micr/docs/cpp-api.html.
You'll need Visual Studio to build the code. The VS project is at runtimeKey.vcxproj. Open it.
- You will need to change the "Command Arguments" like the below image. Default value:
--assets $(ProjectDir)..\..\..\assets
- You will need to change the "Environment" variable like the below image. Default value:
PATH=$(VCRedistPaths)%PATH%;$(ProjectDir)..\..\..\binaries\windows\x86_64
You're now ready to build and run the sample.
Next command is a generic GCC command:
cd ultimateMICR-SDK/samples/c++/runtimeKey
g++ runtimeKey.cxx -O3 -I../../../c++ -L../../../binaries/<yourOS>/<yourArch> -lultimate_micr-sdk -o runtimeKey
- You've to change
yourOS
andyourArch
with the correct values. For example, on Linux x86_64 they would be equal tolinux
andx86_64
respectively. - If you're cross compiling then, you'll have to change
g++
with the correct triplet. For example, on Android ARM64 the triplet would be equal toaarch64-linux-android-g++
.
To build the sample for Raspberry Pi you can either do it on the device itself or cross compile it on Windows, Linux or OSX machines. For more information on how to install the toolchain for cross compilation please check here.
cd ultimateMICR-SDK/samples/c++/runtimeKey
arm-linux-gnueabihf-g++ runtimeKey.cxx -O3 -I../../../c++ -L../../../binaries/raspbian/armv7l -lultimate_micr-sdk -o runtimeKey
- On Windows: replace
arm-linux-gnueabihf-g++
witharm-linux-gnueabihf-g++.exe
- If you're building on the device itself: replace
arm-linux-gnueabihf-g++
withg++
to use the default GCC
After building the application you can test it on your local machine.
runtimeKey is a command line application with the following usage:
runtimeKey \
[--json <json-output:bool>] \
[--assets <path-to-assets-folder>] \
[--type <host-type>]
Options surrounded with [] are optional.
--json
Whether to output the runtime license key as JSON string intead of raw string. Default: true.--assets
Path to the assets folder containing the configuration files and models. Default value is the current folder.--type
Defines how the license is attached to the machine/host. Possible values are aws-instance, aws-byol, azure-instance or azure-byol. Default: null. More info here.
For example, on Raspberry Pi you may call the runtimeKey application using the following command:
LD_LIBRARY_PATH=../../../binaries/raspbian/armv7l:$LD_LIBRARY_PATH ./runtimeKey \
--json false \
--assets ../../../assets
On Linux x86_64 you may use the next command:
LD_LIBRARY_PATH=../../../binaries/linux/x86_64:$LD_LIBRARY_PATH ./runtimeKey \
--json false \
--assets ../../../assets
On Windows x86_64, you may use the next command:
runtimeKey.exe ^
--json false ^
--assets ../../../assets
Please note that if you're cross compiling the application then you've to make sure to copy the application and both the assets and binaries folders to the target device.
Please read this if you're planning to run the SDK on Amazon AWS or Microsoft Azure.