Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Fix PrintingSOEHandler octet string size printing.
Browse files Browse the repository at this point in the history
  • Loading branch information
emgre committed Aug 10, 2021
1 parent 132f2fd commit 4372862
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
### Next ###
* :beetle: Fix `PrintingSOEHandler` octet string size not printing properly.

### 3.1.1 ###
* :beetle: Fix static octet string serilazation bug.
* :star: Add missing octet string configuration to C# `EventBufferConfig`.
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/master/main.cpp
Expand Up @@ -90,7 +90,7 @@ int main(int argc, char* argv[])
auto integrityScan = master->AddClassScan(ClassField::AllClasses(), TimeDuration::Minutes(1), test_soe_handler);

// do a Class 1 exception poll every 5 seconds
auto exceptionScan = master->AddClassScan(ClassField(ClassField::CLASS_1), TimeDuration::Seconds(2), test_soe_handler);
auto exceptionScan = master->AddClassScan(ClassField(ClassField::CLASS_1), TimeDuration::Seconds(5), test_soe_handler);

// Enable the master. This will start communications.
master->Enable();
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/tls/outstation/main.cpp
Expand Up @@ -97,7 +97,7 @@ int main(int argc, char* argv[])
// You can override the default link layer settings here
// in this example we've changed the default link layer addressing
stackConfig.link.LocalAddr = 10;
stackConfig.link.RemoteAddr = 1;
stackConfig.link.RemoteAddr = 1;

// Create a new outstation with a log level, command handler, and
// config info this returns a thread-safe interface used for
Expand Down
2 changes: 1 addition & 1 deletion cpp/lib/src/master/PrintingSOEHandler.cpp
Expand Up @@ -77,7 +77,7 @@ void PrintingSOEHandler::Process(const HeaderInfo& /*info*/, const ICollection<I
{
auto print = [](const Indexed<OctetString>& pair) {
std::cout << "OctetString "
<< " [" << pair.index << "] : Size : " << pair.value.Size() << std::endl;
<< " [" << pair.index << "] : Size : " << std::to_string(pair.value.Size()) << std::endl;
};

values.ForeachItem(print);
Expand Down
28 changes: 28 additions & 0 deletions cpp/tests/unit/TestMaster.cpp
Expand Up @@ -751,3 +751,31 @@ TEST_CASE(SUITE("Warm restart fails with empty response"))
REQUIRE(queue.responses[0].summary == TaskCompletion::SUCCESS);
REQUIRE(queue.responses[0].restartTime == TimeDuration::Milliseconds(0xBBBB));
}

TEST_CASE(SUITE("IntegrityPollOnBufferOverflowIIN"))
{
MasterParams params;
params.disableUnsolOnStartup = false;
params.unsolClassMask = ClassField::None();
MasterTestFixture t(params);
t.context->OnLowerLayerUp();

t.exe->run_many();

REQUIRE(t.lower->PopWriteAsHex() == hex::IntegrityPoll(0));
t.context->OnTxReady();

t.SendToMaster("E0 81 00 08 01 02 00 02 02 81"); // group 2 var 1, index = 2, 0x81 = Online, true, with EVENT_BUFFER_OVERFLOW
REQUIRE(t.meas->TotalReceived() == 1);
REQUIRE((Binary(true, Flags(0x01)) == t.meas->binarySOE[2].meas));

t.exe->run_many();

REQUIRE(t.lower->PopWriteAsHex() == hex::Confirm(0, false));
t.context->OnTxReady();

t.exe->run_many();

REQUIRE(t.lower->PopWriteAsHex() == hex::IntegrityPoll(1));
t.context->OnTxReady();
}

0 comments on commit 4372862

Please sign in to comment.