You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Read params from JSON file and write to JSON file](#Read-params-from-JSON-file-and-write-to-JSON-file)
@@ -46,7 +44,7 @@
46
44
47
45
# Overview
48
46
49
-
**Lens** C++ library provides standard interface as well defines data structures and rules for different lens controllers. **Lens** interface class doesn't do anything, just provides interface, data structures and service functions to encode/decode parameter. Different lens controller classes inherit interface form **Lens** C++ class. **Lens.h** file contains list of data structures (**LensCommand** enum, **LensParam** enum and **LensParams** class) and **Lens** class declaration. **LensCommand** enum contains IDs of commands supported by **Lens** class. **LensParam** enum contains IDs of params supported by **Lens** class. **LensParams** class contains fields for lens parameters values and provides methods to encode/decode and read/write lens parameters from JSON file. All lens controllers should include params and commands listed in **Lens.h** file. Lens interface class depends on **Frame** class (describes video frame and video frame data structures, necessary for autofocus functions) and **ConfigReader** library (provides methods to read/write JSON config files).
47
+
**Lens** C++ library provides standard interface as well defines data structures and rules for different lens controllers. **Lens** interface class doesn't do anything, just provides interface, data structures and service functions to encode/decode parameter and commands. Different lens controller classes inherit interface form **Lens** C++ class. **Lens.h** file contains list of data structures (**LensCommand** enum, **LensParam** enum and **LensParams** class) and **Lens** class declaration. **LensCommand** enum contains IDs of commands supported by **Lens** class. **LensParam** enum contains IDs of params supported by **Lens** class. **LensParams** class contains fields for lens parameters values and provides methods to encode/decode and read/write lens parameters from JSON file. All lens controllers should include params and commands listed in **Lens.h** file. Lens interface class depends on [**Frame**](https://github.com/ConstantRobotics-Ltd/Frame) class (describes video frame and video frame data structures, necessary for autofocus functions) and [**ConfigReader**](https://github.com/ConstantRobotics-Ltd/ConfigReader) library (provides methods to read/write JSON config files).
| 3 | id | Command ID **int32_t** in Little-endian format. |
429
428
| 4 | id | Command ID **int32_t** in Little-endian format. |
430
429
| 5 | id | Command ID **int32_t** in Little-endian format. |
@@ -463,7 +462,7 @@ static int decodeCommand(uint8_t* data, int size, LensParam& paramId, LensComman
463
462
| size | Size of command. Should be 11 bytes. |
464
463
| paramId | Lens parameter ID according to **LensParam** enum. After decoding SET_PARAM command the method will return parameter ID. |
465
464
| commandId | Lens command ID according to **LensCommand** enum. After decoding COMMAND the method will return command ID. |
466
-
| value | Len parameter value (after decoding SET_PARAM command) or lens command argument (after decoding COMMAND). |
465
+
| value | Lens parameter value (after decoding SET_PARAM command) or lens command argument (after decoding COMMAND). |
467
466
468
467
**Returns:** **0** - in case decoding COMMAND, **1** - in case decoding SET_PARAM command or **-1** in case errors.
469
468
@@ -864,11 +863,11 @@ enum class LensParam
864
863
865
864
# LensParams class description
866
865
867
-
**LensParams** class used for lens controller initialization (**initLens(...)** method) or to get all actual params (**getParams()** method). Also **LensParams**provide structure to write/read params from JSON files (**JSON_READABLE** macro) and provide methos to encode and decode params.
866
+
**LensParams** class used for lens controller initialization (**initLens(...)** method) or to get all actual params (**getParams()** method). Also **LensParams**provides structure to write/read params from JSON files (**JSON_READABLE** macro) and provides methos to encode and decode params.
868
867
869
868
870
869
871
-
## Class declaration
870
+
## LensParams class declaration
872
871
873
872
**LensParams** interface class declared in **Lens.h** file. Class declaration:
* @brief Decode params. The method doesn't decode initString and fovPoints.
1159
1160
* @param data Pointer to data.
@@ -1226,33 +1227,111 @@ public:
1226
1227
1227
1228
## Serialize lens params
1228
1229
1229
-
**LensParams** class provides method **encode(...)** to serialize lens params (fields of LensParams class, see Table 4). Serialization of lens params necessary in case when you need to send lens params via communication channels. Method doesn't encode **initString** string field and **fovPoints**. Method declaration:
1230
+
**LensParams** class provides method **encode(...)** to serialize lens params (fields of LensParams class, see Table 4). Serialization of lens params necessary in case when you need to send lens params via communication channels. Method doesn't encode **initString** string field and **fovPoints**. Method provides options to exclude particular parameters from serialization. To do this method inserts binary mask (7 bytes) where each bit represents particular parameter and **decode(...)** method recognizes it. Method declaration:
| mask | Parameters mask - pointer to **LensParamsMask** structure. **LensParamsMask** (declared in Lens.h file) determines flags for each field (parameter) declared in **LensParams** class. If the user wants to exclude any parameters from serialization, he can put a pointer to the mask. If the user wants to exclude a particular parameter from serialization, he should set the corresponding flag in the LensParamsMask structure. |
**LensParams** class provides method **decode(...)** to deserialize lens params (fields of LensParams class, see Table 4). Deserialization of lens params necessary in case when you need to receive lens params via communication channels. Method doesn't decode fields: **initString** and **fovPoints**. Method declaration:
1334
+
**LensParams** class provides method **decode(...)** to deserialize lens params (fields of LensParams class, see Table 4). Deserialization of lens params necessary in case when you need to receive lens params via communication channels. Method automatically recognizes which parameters were serialized by **encode(...)** method. Method doesn't decode fields: **initString** and **fovPoints**. Method declaration:
0 commit comments