formatting
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user