>>>>TODO Overview text.
Currently, booting up the camera is as follows:
When the service is disabled, the user can run this script manually, which:
All of those lead to a solid lockup of the Beta, because if you write to one of those memory addresses which are used for communicating with the PL, and there is no handler in the FPGA, the ARM cores lock up solid, no recovery possible they basically wait for an ACK/NACK forever.
Research is taking place in the Labs here.
TODO: Add image which shows structure of module communication (WebGUI -> RESTServer > Daemon, and back)
The control daemon project currently consists of three different modules:
TODO: Add JSON/REST package description from Lab (https://lab.apertus.org/T865)
Required packages (names are varying between Linux distributions):
To set/get parameters from command line, DaemonCLI can be used:
Syntax: DaemonCLI <module> set_/get_<parameter> <value>
Prepend set_ or get_ to parameter, to tell daemon if parameter should be read or set.
DaemonCLI image_sensor set_gain 2
|general||General methods, like getting available parameters through get_available_methods|
CMV12000Adapter will be used as example. Please look at the class for examples of implementation.
Before registering new parameters, two methods should be added: a setter and a getter.
bool <setter_name>(std::string value, std::string& message)
bool <getter_name>(std::string& value, std::string& message)
Note the ampersand (&) after the type, it is very important for returning multiple values. As methods can return only one value, bool in this case, variables can be passed by reference (&) to be able to set their values inside methods. Values can be modified as usual and the value will be passed back to the caller (see IDaemonModule.h and MessageHandler.cpp for examples).
After the setter and getter are implemented, it's time to attach them to a parameter name. Here they are registered to gain parameter:
AddParameterHandler("gain", std::bind(&CMV12000Adapter::GetGain, this, std::placeholders::_1, std::placeholders::_2),
std::bind(&CMV12000Adapter::SetGain, this, std::placeholders::_1, std::placeholders::_2));
This code will attach SetGain() and GetGain(). Macros to make the code more readable, will be added in the future.
Unit tests have been added to the project to verify correct functionality. Catch2 framework is used because it's single-header only and utilizes the C++11 way of doing things.
Note: (for development on PC) - RAM access of the camera is different from x86/x64 CPUs, modified classes have to be used to bypass this, otherwise SEGFAULT would be the result.
In the CMake scripts a switch called ENABLE_MOCK was added so that users can disable any code which won't work on a regular PC (see CMV12000AdapterTests.cpp for an example). While running the build on camera
cmake .. is sufficient, but for development one should use:
$ cmake -DENABLE_MOCK=ON ..