Skip to content

Commit

Permalink
Merge pull request #430 from mtconnect/419_uuid_command_issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wsobel authored Mar 29, 2024
2 parents 251af5f + 1193c7f commit 9f992f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(AGENT_VERSION_MAJOR 2)
set(AGENT_VERSION_MINOR 3)
set(AGENT_VERSION_PATCH 0)
set(AGENT_VERSION_BUILD 4)
set(AGENT_VERSION_BUILD 5)
set(AGENT_VERSION_RC "")

# This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent
Expand Down
15 changes: 12 additions & 3 deletions src/mtconnect/source/adapter/shdr/shdr_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,20 @@ namespace mtconnect::source::adapter::shdr {
else if (m_handler && m_handler->m_command)
{
m_handler->m_command(command, value, getIdentity());

if (command == "uuid")
{
m_pipeline.setDevice(value);
options[configuration::Device] = value;
setOptions(options);
DevicePtr dp;
if (auto dev = GetOption<string>(m_options, configuration::Device);
dev && (dp = m_pipeline.getContext()->m_contract->findDevice(*dev)))
{
if (!dp->preserveUuid())
{
m_pipeline.setDevice(value);
options[configuration::Device] = value;
setOptions(options);
}
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions test_package/agent_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,9 @@ TEST_F(AgentTest, adapter_should_receive_commands)
PARSE_XML_RESPONSE("/probe");
ASSERT_XML_PATH_EQUAL(doc, "//m:Device@uuid", "MK-1234");
}

auto &options = m_agentTestHelper->m_adapter->getOptions();
ASSERT_EQ("MK-1234", *GetOption<string>(options, configuration::Device));
}

TEST_F(AgentTest, adapter_should_receive_device_commands)
Expand Down

0 comments on commit 9f992f9

Please sign in to comment.