Skip to content

Commit

Permalink
Merge pull request #214 from mtconnect/topic_naming_extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
wsobel authored Sep 30, 2022
2 parents ba58bf6 + 7246395 commit 905b2c0
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 8 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,6 @@ Configuration Parameters

*Default*: 17 -> 2^17 = 131,072 slots.

* `MaxAssets` - The maximum number of assets the agent can hold in its buffer. The
number is the actual count, not an exponent.

*Default*: 1024

* `CheckpointFrequency` - The frequency checkpoints are created in the
stream. This is used for current with the at argument. This is an
advanced configuration item and should not be changed unless you
Expand All @@ -589,6 +584,11 @@ Configuration Parameters
the defaults are tried.

*Defaults*: probe.xml or Devices.xml

* `DisableAgentDevice` - When the schema version is >= 1.7, disable the
creation of the Agent device.

*Default*: false

* `PidFile` - UNIX only. The full path of the file that contains the
process id of the daemon. This is not supported in Windows.
Expand Down Expand Up @@ -657,6 +657,11 @@ Configuration Parameters

*Default*: true

* `MaxAssets` - The maximum number of assets the agent can hold in its buffer. The
number is the actual count, not an exponent.

*Default*: 1024

* `MonitorConfigFiles` - Monitor agent.cfg and Devices.xml files and restart agent if they change.

*Default*: false
Expand Down
2 changes: 1 addition & 1 deletion conan/mruby/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class MRubyConan(ConanFile):
name = "mruby"
version = "3.1.1"
version = "3.1.0"
license = "https://github.com/mruby/mruby/blob/master/LICENSE"
author = "Yukihiro “Matz” Matsumoto"
homepage = "https://mruby.org/"
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def requirements(self):
if not self.windows_xp:
self.requires("gtest/1.10.0")
if self.options.with_ruby:
self.requires("mruby/3.1.1")
self.requires("mruby/3.1.0")

def build(self):
cmake = CMake(self)
Expand Down
4 changes: 3 additions & 1 deletion src/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ namespace mtconnect {
char c;
stringstream vstr(m_version);
vstr >> major >> c >> minor;
if (major > 1 || (major == 1 && minor >= 7))

auto disableAgentDevice = GetOption<bool>(m_options, config::DisableAgentDevice);
if (!(disableAgentDevice && *disableAgentDevice) && (major > 1 || (major == 1 && minor >= 7)))
{
createAgentDevice();
}
Expand Down
1 change: 1 addition & 0 deletions src/configuration/agent_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ namespace mtconnect::configuration {
ConfigOptions options;
GetOptions(config, options,
{{configuration::PreserveUUID, true},
{configuration::DisableAgentDevice, false},
{configuration::WorkingDirectory, m_working.string()},
{configuration::ExecDirectory, m_exePath.string()},
{configuration::ServerIp, "0.0.0.0"s},
Expand Down
1 change: 1 addition & 0 deletions src/configuration/config_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace mtconnect {
DECLARE_CONFIGURATION(WorkingDirectory);

// Agent Configuration
DECLARE_CONFIGURATION(DisableAgentDevice);
DECLARE_CONFIGURATION(AllowPut);
DECLARE_CONFIGURATION(AllowPutFrom);
DECLARE_CONFIGURATION(BufferSize);
Expand Down
35 changes: 35 additions & 0 deletions test/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,4 +1328,39 @@ Port = 0

m_config->start();
}

TEST_F(ConfigTest, should_disable_agent_device)
{
chdir(TEST_BIN_ROOT_DIR);
m_config->updateWorkingDirectory();
string streams("SchemaVersion = 2.0\nDisableAgentDevice = true\n");

m_config->loadConfig(streams);
auto agent = const_cast<mtconnect::Agent *>(m_config->getAgent());
ASSERT_TRUE(agent);

auto devices = agent->getDevices();
ASSERT_EQ(1, devices.size());

auto device = devices.front();
ASSERT_EQ("Device", device->getName());
}

TEST_F(ConfigTest, should_default_not_disable_agent_device)
{
chdir(TEST_BIN_ROOT_DIR);
m_config->updateWorkingDirectory();
string streams("SchemaVersion = 2.0\n");

m_config->loadConfig(streams);
auto agent = const_cast<mtconnect::Agent *>(m_config->getAgent());
ASSERT_TRUE(agent);

auto devices = agent->getDevices();
ASSERT_EQ(2, devices.size());

auto device = devices.front();
ASSERT_EQ("Agent", device->getName());
}

} // namespace

0 comments on commit 905b2c0

Please sign in to comment.