mainloop: moved instruction execution to main loop, do not send intial scan when readonly, added "--inject" option, allow --readonly with --scanconfig[=none], store scans initiated by other participants, removed unused code
This commit is contained in:
@@ -99,8 +99,8 @@ result_t UserList::addFromFile(map<string, string>& row, vector< map<string, str
|
||||
|
||||
MainLoop::MainLoop(const struct options opt, Device *device, MessageMap* messages)
|
||||
: Thread(), m_device(device), m_reconnectCount(0), m_userList(opt.accessLevel), m_messages(messages),
|
||||
m_address(opt.address), m_scanConfig(opt.scanConfig),
|
||||
m_initialScan(opt.initialScan), m_enableHex(opt.enableHex), m_shutdown(false) {
|
||||
m_address(opt.address), m_scanConfig(opt.scanConfig), m_initialScan(opt.readOnly ? ESC : opt.initialScan),
|
||||
m_polling(opt.pollInterval>0), m_enableHex(opt.enableHex), m_shutdown(false) {
|
||||
// open Device
|
||||
result_t result = m_device->open();
|
||||
if (result != RESULT_OK) {
|
||||
@@ -287,6 +287,13 @@ void MainLoop::run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (reload && m_busHandler->hasSignal()) {
|
||||
reload = false;
|
||||
// execute initial instructions
|
||||
executeInstructions(m_messages);
|
||||
if (m_messages->sizeConditions() > 0 && !m_polling) {
|
||||
logError(lf_main, "conditions require a poll interval > 0");
|
||||
}
|
||||
}
|
||||
if (!m_shutdown && now > nextCheckRun) {
|
||||
TCPClient client;
|
||||
|
||||
Reference in New Issue
Block a user