formatting

This commit is contained in:
John
2023-10-14 16:24:46 +02:00
parent 5e2509b60c
commit 4c453a2354
2 changed files with 12 additions and 5 deletions
+2 -1
View File
@@ -1095,9 +1095,10 @@ result_t MainLoop::executeWrite(const vector<string>& args, const string levels,
if (!message->isWrite()) { if (!message->isWrite()) {
return RESULT_ERR_INVALID_ARG; return RESULT_ERR_INVALID_ARG;
} }
if (circuit.length() > 0 && circuit != message->getCircuit()) { if (!circuit.empty() && circuit != message->getCircuit()) {
return RESULT_ERR_INVALID_ARG; // non-matching circuit return RESULT_ERR_INVALID_ARG; // non-matching circuit
} }
// send message // send message
SlaveSymbolString slave; SlaveSymbolString slave;
ret = m_protocol->sendAndWait(master, &slave); ret = m_protocol->sendAndWait(master, &slave);
+10 -4
View File
@@ -841,18 +841,24 @@ void MqttHandler::run() {
} }
if (includeActiveWrite) { if (includeActiveWrite) {
if (message->isWrite()) { if (message->isWrite()) {
bool skipMultiFieldWrite = (!m_hasDefinitionFieldsPayload || m_publishByField) && !message->isPassive() && message->getFieldCount() > 1; bool skipMultiFieldWrite = (!m_hasDefinitionFieldsPayload || m_publishByField)
&& !message->isPassive() && message->getFieldCount() > 1;
if (skipMultiFieldWrite) { if (skipMultiFieldWrite) {
continue; // multi-field message is not writable when publishing by field or combining multiple fields in one definition, so skip it // multi-field message is not writable when publishing by field or combining
// multiple fields in one definition, so skip it
continue;
} }
} else { } else {
// check for existance of write message with same name // check for existance of write message with same name
Message* write = m_messages->find(message->getCircuit(), message->getName(), "", true); Message* write = m_messages->find(message->getCircuit(), message->getName(), "", true);
if (write) { if (write) {
bool skipMultiFieldWrite = (!m_hasDefinitionFieldsPayload || m_publishByField) && write->getFieldCount() > 1; bool skipMultiFieldWrite = (!m_hasDefinitionFieldsPayload || m_publishByField)
&& write->getFieldCount() > 1;
if (!skipMultiFieldWrite) { if (!skipMultiFieldWrite) {
continue; // avoid sending definition of read AND write message with the same key continue; // avoid sending definition of read AND write message with the same key
} // else: multi-field write message is not writable when publishing by field or combining multiple fields in one definition, so skip it }
// else: multi-field write message is not writable when publishing by field or combining
// multiple fields in one definition, so skip it
} }
} }
} }