Skip to content

Commit 4a4c6f8

Browse files
Replace setPropertyValueInternal with setPropertyValue / setProtectedPropertyValue (#73)
1 parent 7527e88 commit 4a4c6f8

8 files changed

Lines changed: 44 additions & 43 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,13 @@ if (MSVC)
4747
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4100>)
4848
endif()
4949

50-
add_definitions(-DFMT_HEADER_ONLY)
50+
add_compile_definitions(FMT_HEADER_ONLY)
5151

5252
if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE)
5353
set(DAQMODULES_REF_DEVICE_MODULE ON)
5454
set(DAQMODULES_REF_FB_MODULE ON)
5555
endif()
5656

57-
# TODO: move add_subdirectory(external) after openDAQ SDK fetch once TBBAS-3072 is resolved
58-
add_subdirectory(external)
59-
6057
if (NOT TARGET "${OPENDAQ_SDK_TARGET_NAMESPACE}::${OPENDAQ_SDK_TARGET_NAME}")
6158
if (PROJECT_IS_TOP_LEVEL)
6259
find_package(${OPENDAQ_SDK_NAME} GLOBAL)
@@ -82,6 +79,7 @@ if (NOT TARGET "${OPENDAQ_SDK_TARGET_NAMESPACE}::${OPENDAQ_SDK_TARGET_NAME}")
8279
endif()
8380
endif()
8481

82+
add_subdirectory(external)
8583
add_subdirectory(shared)
8684
add_subdirectory(modules)
8785
if (${REPO_OPTION_PREFIX}_ENABLE_EXAMPLE)

cmake/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
set(CMAKE_FOLDER "cmake")
2+
23
list(APPEND CMAKE_MESSAGE_CONTEXT cmake)
4+
set(CURR_MESSAGE_CONTEXT ${CMAKE_MESSAGE_CONTEXT})
35

46
message(STATUS "Import functions and macro from opendaq-cmake-utils repo")
57
include(FetchContent)
68
FetchContent_Declare(
79
opendaq-cmake-utils
8-
GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git
9-
GIT_TAG v1.0.0
10-
GIT_PROGRESS ON
10+
GIT_REPOSITORY https://github.com/openDAQ/opendaq-cmake-utils.git
11+
GIT_TAG v1.0.1
12+
GIT_PROGRESS ON
1113
)
12-
FetchContent_MakeAvailable(opendaq-cmake-utils)
14+
FetchContent_MakeAvailable(opendaq-cmake-utils)

external/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
opendaq_get_cmake_mode(_ASAM_CMP_CMAKE_MODERN_MODE_SAVED)
2+
opendaq_set_cmake_mode(ANCIENT)
3+
14
set(CMAKE_FOLDER external)
25
list(APPEND CMAKE_MESSAGE_CONTEXT external)
36

47
if (${REPO_OPTION_PREFIX}_ENABLE_TESTS AND NOT TARGET gtest)
58
set(BUILD_GMOCK ON)
69
opendaq_module_setup_gtest(1.12.1)
10+
11+
get_target_property(GTEST_INCLUDE_DIRS gtest INTERFACE_INCLUDE_DIRECTORIES)
12+
target_include_directories(gmock PRIVATE ${GTEST_INCLUDE_DIRS})
13+
target_include_directories(gmock_main PRIVATE ${GTEST_INCLUDE_DIRS})
714
endif()
815

916
add_subdirectory(PcapPlusPlus)
1017
add_subdirectory(AsamCmpLib)
18+
19+
opendaq_set_cmake_mode(${_ASAM_CMP_CMAKE_MODERN_MODE_SAVED})

modules/asam_cmp_capture_module/src/capture_fb.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ CaptureFb::CaptureFb(const ModuleInfoPtr& moduleInfo,
1919
, ethernetWrapper(init.ethernetWrapper)
2020
, selectedEthernetDeviceName(init.selectedDeviceName)
2121
{
22+
initStatusPacket();
2223
initProperties();
2324
initEncoders();
24-
initStatusPacket();
2525
startStatusLoop();
2626
}
2727

@@ -33,14 +33,16 @@ CaptureFb::~CaptureFb()
3333
void CaptureFb::initProperties()
3434
{
3535
initDeviceInfoProperties(false);
36+
objPtr.beginUpdate();
3637
deviceDescription = "DefaultDeviceDescription";
37-
setPropertyValueInternal(String("DeviceDescription").asPtr<IString>(true), deviceDescription, false, false, false);
38+
objPtr.setPropertyValue("DeviceDescription", deviceDescription);
3839
serialNumber = "DefaultSerialNumber";
39-
setPropertyValueInternal(String("SerialNumber").asPtr<IString>(true), serialNumber, false, false, false);
40+
objPtr.setPropertyValue("SerialNumber", serialNumber);
4041
hardwareVersion = "DefaultHardwareVersion";
41-
setPropertyValueInternal(String("HardwareVersion").asPtr<IString>(true), hardwareVersion, false, false, false);
42+
objPtr.setPropertyValue("HardwareVersion", hardwareVersion);
4243
softwareVersion = "DefaultSoftwareVersion";
43-
setPropertyValueInternal(String("SoftwareVersion").asPtr<IString>(true), softwareVersion, false, false, false);
44+
objPtr.setPropertyValue("SoftwareVersion", softwareVersion);
45+
objPtr.endUpdate();
4446
}
4547

4648
void CaptureFb::propertyChanged()

modules/asam_cmp_capture_module/src/stream_fb.cpp

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,12 @@ void StreamFb::configureScaledAnalogSignal()
140140
analogDataSampleDt = postScaling.getInputSampleType() == SampleType::Int16 ? 16 : 32;
141141
analogDataHasInternalPostScaling = false;
142142

143-
setPropertyValueInternal(
144-
String("Scale").asPtr<IString>(true), BaseObjectPtr(analogDataScale).asPtr<IBaseObject>(true), false, true, false);
145-
146-
setPropertyValueInternal(
147-
String("Offset").asPtr<IString>(true), BaseObjectPtr(analogDataOffset).asPtr<IBaseObject>(true), false, true, false);
148-
149-
setPropertyValueInternal(
150-
String("IsClientPostScaling").asPtr<IString>(true), BaseObjectPtr(true).asPtr<IBaseObject>(true), false, true, false);
143+
PropertyObjectProtectedPtr objPtrProtected = objPtr.asPtr<IPropertyObjectProtected>(true);
144+
objPtr.beginUpdate();
145+
objPtrProtected.setProtectedPropertyValue("Scale", analogDataScale);
146+
objPtrProtected.setProtectedPropertyValue("Offset", analogDataOffset);
147+
objPtrProtected.setProtectedPropertyValue("IsClientPostScaling", true);
148+
objPtr.endUpdate();
151149
}
152150

153151
void StreamFb::configureMinMaxAnalogSignal()
@@ -189,20 +187,17 @@ void StreamFb::configureMinMaxAnalogSignal()
189187
analogDataHasInternalPostScaling = true;
190188
}
191189

192-
setPropertyValueInternal(
193-
String("MinValue").asPtr<IString>(true), BaseObjectPtr(analogDataMin).asPtr<IBaseObject>(true), false, true, false);
194-
195-
setPropertyValueInternal(
196-
String("MaxValue").asPtr<IString>(true), BaseObjectPtr(analogDataMax).asPtr<IBaseObject>(true), false, true, false);
197-
198-
setPropertyValueInternal(
199-
String("IsClientPostScaling").asPtr<IString>(true), BaseObjectPtr(false).asPtr<IBaseObject>(true), false, true, false);
190+
PropertyObjectProtectedPtr objPtrProtected = objPtr.asPtr<IPropertyObjectProtected>(true);
191+
objPtr.beginUpdate();
192+
objPtrProtected.setProtectedPropertyValue("MinValue", analogDataMin);
193+
objPtrProtected.setProtectedPropertyValue("MaxValue", analogDataMax);
194+
objPtrProtected.setProtectedPropertyValue("IsClientPostScaling", false);
195+
objPtr.endUpdate();
200196
}
201197

202198
void StreamFb::onAnalogSignalConnected()
203199
{
204-
setPropertyValueInternal(
205-
String("IsConnectedAnalogSignal").asPtr<IString>(true), BaseObjectPtr(true).asPtr<IBaseObject>(true), false, true, false);
200+
objPtr.asPtr<IPropertyObjectProtected>(true).setProtectedPropertyValue("IsConnectedAnalogSignal", true);
206201

207202
constexpr double invertedTickResolution = 1'000'000;
208203
int64_t delta = inputDomainDataDescriptor.getRule().getParameters().get("delta");
@@ -220,8 +215,7 @@ void StreamFb::onAnalogSignalConnected()
220215

221216
void StreamFb::onAnalogSignalDisconnected()
222217
{
223-
setPropertyValueInternal(
224-
String("IsConnectedAnalogSignal").asPtr<IString>(true), BaseObjectPtr(false).asPtr<IBaseObject>(true), false, true, false);
218+
objPtr.asPtr<IPropertyObjectProtected>(true).setProtectedPropertyValue("IsConnectedAnalogSignal", false);
225219
}
226220

227221
void StreamFb::onDisconnected(const InputPortPtr& inputPort)
@@ -236,7 +230,7 @@ void StreamFb::onDisconnected(const InputPortPtr& inputPort)
236230

237231
void StreamFb::onPacketReceived(const InputPortPtr& port)
238232
{
239-
auto lock = this->getAcquisitionLock();
233+
auto lock = this->getRecursiveConfigLock2();
240234

241235
PacketPtr packet;
242236
const auto connection = inputPort.getConnection();

modules/asam_cmp_capture_module/tests/test_analog_messages.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void AnalogMessagesTest::testAnalogPackets(bool setScale)
194194

195195
size_t timeElapsed = 0;
196196
auto stTime = std::chrono::steady_clock::now();
197-
while (!checker() && timeElapsed < 2500'000'000)
197+
while (!checker() && timeElapsed < 60'000)
198198
{
199199
std::this_thread::sleep_for(std::chrono::milliseconds(200));
200200
auto curTime1 = std::chrono::steady_clock::now();

shared/libraries/asam_cmp_common_lib/src/interface_common_fb.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ void InterfaceCommonFb::updatePayloadTypeInternal()
9393

9494
if (newType < 0 || static_cast<size_t>(newType) > maxPayloadIndex())
9595
{
96-
setPropertyValueInternal(String("PayloadType").asPtr<IString>(true),
97-
BaseObjectPtr(payloadTypeToIndex(payloadType.getType())).asPtr<IBaseObject>(true),
98-
false,
99-
false,
100-
false);
96+
objPtr.setPropertyValue("PayloadType", payloadTypeToIndex(payloadType.getType()));
10197
}
10298
else
10399
{

shared/libraries/asam_cmp_common_lib/src/network_manager_fb.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void NetworkManagerFb::networkAdapterChangedInternal()
5454
int oldInd = objPtr.getPropertyValue("NetworkAdaptersNames");
5555
int newInd = objPtr.getPropertyValue("NetworkAdapters");
5656

57-
setPropertyValueInternal(String("NetworkAdaptersNames"), BaseObjectPtr(newInd), false, false, false);
57+
objPtr.setPropertyValue("NetworkAdaptersNames", newInd);
5858
StringPtr newName = objPtr.getPropertySelectionValue("NetworkAdaptersNames");
5959

6060
if (ethernetWrapper->setDevice(newName))
@@ -63,8 +63,8 @@ void NetworkManagerFb::networkAdapterChangedInternal()
6363
}
6464
else
6565
{
66-
setPropertyValueInternal(String("NetworkAdaptersNames"), BaseObjectPtr(oldInd), false, false, false);
67-
setPropertyValueInternal(String("NetworkAdapters"), BaseObjectPtr(oldInd), false, false, false);
66+
objPtr.setPropertyValue("NetworkAdaptersNames", oldInd);
67+
objPtr.setPropertyValue("NetworkAdapters", oldInd);
6868
}
6969
}
7070

0 commit comments

Comments
 (0)