PR-790 Address merge conflicts

This commit is contained in:
Garret Fick 2019-11-27 11:31:54 -05:00
commit 76fc89ada1
No known key found for this signature in database
GPG Key ID: A1BBEF9D2AB249C6
11 changed files with 39 additions and 23 deletions

View File

@ -19,6 +19,7 @@ if [ $# -eq 0 ]; then
exit 1
fi
mkdir -p bin
touch etc/Config0.c
touch etc/Res0.c
touch etc/glueVars.cpp

View File

@ -70,6 +70,7 @@ enabled = false
; How long to wait for a response before indicating an error.
; Measured in microseconds.
; response_timeout.0 = 100000
; The rate at which to poll the server. Measured in microseconds.
; The actual poll rate may be greater than this depending on response times
; from the remote server and availability of resources on the local host.
@ -123,6 +124,7 @@ enabled = false
; checks at this rate for changes and only persists to disk if a
; value has changed within the poll period
; poll_interval = 10
; poll_interval = 10
; ---------------------------------------------------------
; ---------------------------------------------------------

View File

@ -175,8 +175,7 @@ void bootstrap()
// Our next step here is to start the main loop, so start any
// services that we want now.
for (auto it = config.services.begin(); it != config.services.end(); ++it)
{
for (auto it = config.services.begin(); it != config.services.end(); ++it) {
const char* service_config = "";
ServiceDefinition* def = services_find(it->c_str());
def->start(service_config);

View File

@ -80,8 +80,7 @@ class Dnp3ToSpdLogger final : public openpal::ILogHandler, private openpal::Unco
spdlog::info("{}", entry.message);
}
static std::shared_ptr<openpal::ILogHandler>Create()
{
static std::shared_ptr<openpal::ILogHandler>Create() {
return std::make_shared<Dnp3ToSpdLogger>();
}

View File

@ -73,10 +73,12 @@ inline bool ini_matches(const char* section_expected,
/// @return 0 if there is a match, otherwise non-zero.
inline int strcmp_with_index(const char* name, const char* expected,
std::uint8_t max_index,
std::uint8_t* index) {
std::uint8_t* index)
{
size_t expected_len = strlen(expected);
int ret = strncmp(name, expected, expected_len);
if (ret != 0) {
if (ret != 0)
{
return ret;
}

View File

@ -258,7 +258,8 @@ void interactive_client_command(const char* command, int client_fd)
else if (strncmp(command, "stop_modbus()", 13) == 0)
{
ServiceDefinition* def = services_find("modbusslave");
if (def) {
if (def)
{
def->stop();
}
}
@ -274,7 +275,8 @@ void interactive_client_command(const char* command, int client_fd)
else if (strncmp(command, "stop_dnp3()", 11) == 0)
{
ServiceDefinition* def = services_find("dnp3s");
if (def) {
if (def)
{
def->stop();
}
}
@ -315,7 +317,8 @@ void interactive_client_command(const char* command, int client_fd)
else if (strncmp(command, "stop_pstorage()", 15) == 0)
{
ServiceDefinition* def = services_find("pstorage");
if (def) {
if (def)
{
def->stop();
}
}

View File

@ -174,6 +174,13 @@ int main(int argc, char **argv)
updateBuffersIn();
{
std::lock_guard<std::mutex> guard(bufferLock);
// Make sure the buffer pointers are correct and
// attached to the user variables
glueVars();
// Read input image
updateBuffersIn();
updateCustomIn();
// Update input image table with data from slave devices
services_before_cycle();

View File

@ -18,6 +18,7 @@
#ifndef OPLC_UNIT_TEST
#include <modbus.h>
#endif // OPLC_UNIT_TEST
#include <modbus.h>
#include <cstdint>
#include <cstring>

View File

@ -118,3 +118,4 @@ std::int16_t common_cfg_handler(
/** @}*/
#endif // RUNTIME_CORE_MODBUSMASTER_MASTER_H_

View File

@ -415,7 +415,7 @@ struct ModbusSlaveConfig
int modbus_slave_cfg_handler(void* user_data, const char* section,
const char* name, const char* value)
{
if (strcmp("modbuslave", section) != 0)
if (strcmp("modbusslave", section) != 0)
{
return 0;
}

View File

@ -106,7 +106,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('quit()\n')
s.send(b'quit()\n')
data = s.recv(1000)
s.close()
self.runtime_status = "Stopped"
@ -129,7 +129,8 @@ class runtime:
a = subprocess.Popen([compile_program_path, str(st_file)],
cwd=self_path,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT,
encoding='UTF-8')
compilation_object = NonBlockingStreamReader(a.stdout)
def compilation_status(self):
@ -151,7 +152,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('exec_time()\n')
s.send(b'exec_time()\n')
data = s.recv(10000)
s.close()
self.runtime_status = "Running"
@ -166,7 +167,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('start_modbus(' + str(port_num) + ')\n')
s.send(b'start_modbus(' + str(port_num) + ')\n')
data = s.recv(1000)
s.close()
except:
@ -177,7 +178,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('stop_modbus()\n')
s.send(b'stop_modbus()\n')
data = s.recv(1000)
s.close()
except:
@ -188,7 +189,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('start_dnp3(' + str(port_num) + ')\n')
s.send(b'start_dnp3(' + str(port_num) + ')\n')
data = s.recv(1000)
s.close()
except:
@ -199,7 +200,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('stop_dnp3()\n')
s.send(b'stop_dnp3()\n')
data = s.recv(1000)
s.close()
except:
@ -210,7 +211,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('start_enip(' + str(port_num) + ')\n')
s.send(b'start_enip(' + str(port_num) + ')\n')
data = s.recv(1000)
s.close()
except:
@ -221,7 +222,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('stop_enip()\n')
s.send(b'stop_enip()\n')
data = s.recv(1000)
s.close()
except:
@ -232,7 +233,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('start_pstorage(' + str(poll_rate) + ')\n')
s.send(b'start_pstorage(' + str(poll_rate) + ')\n')
data = s.recv(1000)
s.close()
except:
@ -243,7 +244,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('stop_pstorage()\n')
s.send(b'stop_pstorage()\n')
data = s.recv(1000)
s.close()
except:
@ -254,7 +255,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('runtime_logs()\n')
s.send(b'runtime_logs()\n')
data = s.recv(1000000)
s.close()
return data
@ -270,7 +271,7 @@ class runtime:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 43628))
s.send('exec_time()\n')
s.send(b'exec_time()\n')
data = s.recv(10000)
s.close()
return display_time(int(data), 4)