bool MessageHandler::validateMsg(SimpleMessage & in) { bool rtn = false; if (in.validateMessage()) { if (in.getMessageType() == this->getMsgType()) { rtn = true; } else { LOG_WARN("Message type: %d, doesn't match handler type: %d", in.getMessageType(), this->getMsgType()); rtn = false; } } else { LOG_WARN("Passed in message invalid"); } return rtn; }
bool SmplMsgConnection::sendMsg(SimpleMessage & message) { bool rtn; ByteArray sendBuffer; ByteArray msgData; if (message.validateMessage()) { message.toByteArray(msgData); sendBuffer.load((int)msgData.getBufferSize()); sendBuffer.load(msgData); rtn = this->sendBytes(sendBuffer); } else { rtn = false; LOG_ERROR("Message validation failed, message not sent"); } return rtn; }