Skip to content

Commit 814a1ad

Browse files
Merge pull request #2 from ConstantRobotics-Ltd/update-getParams
Update getParams
2 parents 26a2e86 + 146c9cc commit 814a1ad

File tree

7 files changed

+19
-18
lines changed

7 files changed

+19
-18
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# **Lens interface C++ library**
66

7-
**v4.2.0**
7+
**v4.3.0**
88

99

1010

@@ -66,6 +66,7 @@
6666
| 4.0.3 | 01.07.2023 | - Documentation updated.<br />- Lens class comments in source code updated. |
6767
| 4.1.0 | 11.07.2023 | - Added LensParamsMask for lens params masking.<br />- encode(...) method of LensParams class updated.<br />- Documentation updated. |
6868
| 4.2.0 | 22.09.2023 | - Updated encode(...) and decode(...) methods of LensParams.<br />- Added decodeAndExecuteCommand(...) method.<br />- Added example of lens controller implementation. |
69+
| 4.3.0 | 26.09.2023 | - Updated getParams methode. |
6970

7071

7172

@@ -135,7 +136,7 @@ public:
135136
virtual float getParam(LensParam id) = 0;
136137

137138
/// Get the lens controller params.
138-
virtual LensParams getParams() = 0;
139+
virtual void getParams(LensParams& params) = 0;
139140

140141
/// Execute command.
141142
virtual bool executeCommand(LensCommand id, float arg = 0) = 0;
@@ -182,7 +183,7 @@ std::cout << "Lens class version: " << Lens::getVersion() << std::endl;
182183
Console output:
183184

184185
```bash
185-
Lens class version: 4.2.0
186+
Lens class version: 4.3.0
186187
```
187188

188189

@@ -291,10 +292,12 @@ virtual float getParam(LensParam id) = 0;
291292
**getParams(...)** method designed to obtain lens parameters. The particular implementation of the lens controller must provide thread-safe **getParams(...)** method call. This means that the **getParams(...)** method can be safely called from any thread. Method declaration:
292293

293294
```cpp
294-
virtual LensParams getParams() = 0;
295+
virtual void getParams(LensParams& params) = 0;
295296
```
296297
297-
**Returns:** [**LensParams class**](#LensParams-class-description) class which contains all current lens params.
298+
| Parameter | Description |
299+
| --------- | ---------------------------------------------------------- |
300+
| params | Reference to LensParams object to store params. |
298301
299302
300303
@@ -352,7 +355,7 @@ static void encodeSetParamCommand(uint8_t* data, int& size, LensParam id, float
352355
| ---- | ----- | -------------------------------------------------- |
353356
| 0 | 0x01 | SET_PARAM command header value. |
354357
| 1 | 0x04 | Major version of Lens class. |
355-
| 2 | 0x02 | Minor version of Lens class. |
358+
| 2 | 0x03 | Minor version of Lens class. |
356359
| 3 | id | Parameter ID **int32_t** in Little-endian format. |
357360
| 4 | id | Parameter ID **int32_t** in Little-endian format. |
358361
| 5 | id | Parameter ID **int32_t** in Little-endian format. |
@@ -398,7 +401,7 @@ static void encodeCommand(uint8_t* data, int& size, LensCommand id, float arg =
398401
| ---- | ----- | --------------------------------------------------------- |
399402
| 0 | 0x00 | SET_PARAM command header value. |
400403
| 1 | 0x04 | Major version of Lens class. |
401-
| 2 | 0x02 | Minor version of Lens class. |
404+
| 2 | 0x03 | Minor version of Lens class. |
402405
| 3 | id | Command ID **int32_t** in Little-endian format. |
403406
| 4 | id | Command ID **int32_t** in Little-endian format. |
404407
| 5 | id | Command ID **int32_t** in Little-endian format. |

example/CustomLens.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,9 @@ float cr::lens::CustomLens::getParam(cr::lens::LensParam id)
599599

600600

601601

602-
cr::lens::LensParams cr::lens::CustomLens::getParams()
602+
void cr::lens::CustomLens::getParams(cr::lens::LensParams& params)
603603
{
604-
return m_params;
604+
params = m_params;
605605
}
606606

607607

example/CustomLens.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ class CustomLens: public Lens
8282

8383
/**
8484
* @brief Get the lens controller params.
85-
* @param id Param ID.
86-
* @return Lens params structure.
85+
* @param params Reference to LensParams object.
8786
*/
88-
LensParams getParams();
87+
void getParams(LensParams& params);
8988

9089
/**
9190
* @brief Execute command.

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.13)
66
## INTERFACE-PROJECT
77
## name and version
88
###############################################################################
9-
project(Lens VERSION 4.2.0 LANGUAGES CXX)
9+
project(Lens VERSION 4.3.0 LANGUAGES CXX)
1010

1111

1212

src/Lens.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,9 @@ class Lens
765765

766766
/**
767767
* @brief Get the lens controller params.
768-
* @param id Param ID.
769-
* @return Lens params structure.
768+
* @param params Reference to LensParams object.
770769
*/
771-
virtual LensParams getParams() = 0;
770+
virtual void getParams(LensParams& params) = 0;
772771

773772
/**
774773
* @brief Execute command.

src/LensVersion.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#define LENS_MAJOR_VERSION 4
4-
#define LENS_MINOR_VERSION 2
4+
#define LENS_MINOR_VERSION 3
55
#define LENS_PATCH_VERSION 0
66

7-
#define LENS_VERSION "4.2.0"
7+
#define LENS_VERSION "4.3.0"

0 commit comments

Comments
 (0)