EIVE upstream #29

Merged
muellerr merged 693 commits from use-eive-upstream into develop 2023-06-30 15:44:39 +02:00
2 changed files with 17 additions and 62 deletions
Showing only changes of commit 21ac86619e - Show all commits

View File

@ -1329,67 +1329,6 @@ void DeviceHandlerBase::handleDeviceTm(util::DataWrapper dataWrapper, DeviceComm
}
}
void DeviceHandlerBase::handleDeviceTM(const uint8_t* data, size_t dataSize,
DeviceCommandId_t replyId, bool forceDirectTm) {
// TODO: Horrible duplicate code. Avoiding this would require using the Serializable union
// type. Furthermore, DeviceTmReportingWrapper needs to be extended to allow using raw
// buffers.
if (data == nullptr) {
return;
}
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
if (iter == deviceReplyMap.end()) {
triggerEvent(DEVICE_UNKNOWN_REPLY, replyId);
return;
}
/* Regular replies to a command */
if (iter->second.command != deviceCommandMap.end()) {
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
if (queueId != NO_COMMANDER) {
/* This may fail, but we'll ignore the fault. */
actionHelper.reportData(queueId, replyId, data, dataSize);
}
/* This check should make sure we get any TM but don't get anything doubled. */
// TODO: The wrapper does not support this..
// if (wiretappingMode == TM && (requestedRawTraffic != queueId)) {
// DeviceTmReportingWrapper wrapper(getObjectId(), replyId, data, dataSize);
// actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
// }
else if (forceDirectTm and (defaultRawReceiver != queueId) and
(defaultRawReceiver != MessageQueueIF::NO_QUEUE)) {
// hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed)
// it is in
actionHelper.reportData(defaultRawReceiver, replyId, data, dataSize, true);
}
}
/* Unrequested or aperiodic replies */
// TODO: The wrapper does not support this..
// else {
// DeviceTmReportingWrapper wrapper(getObjectId(), replyId, data, dataSize);
// if (wiretappingMode == TM) {
// actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
// }
// if (forceDirectTm and defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
// // sid_t setSid = sid_t(this->getObjectId(), replyId);
// // LocalPoolDataSetBase* dataset = getDataSetHandle(setSid);
// // if(dataset != nullptr) {
// // poolManager.generateHousekeepingPacket(setSid, dataset, true);
// // }
//
// // hiding of sender needed so the service will handle it as
// // unexpected Data, no matter what state (progress or completed)
// // it is in
// actionHelper.reportData(defaultRawReceiver, replyId, &wrapper, true);
// }
// }
}
ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = acceptExternalDeviceCommands();

View File

@ -23,9 +23,25 @@ union DataUnion {
};
struct DataWrapper {
using BufPairT = std::pair<const uint8_t*, size_t>;
DataWrapper() = default;
DataWrapper(const uint8_t* data, size_t size): type(DataTypes::RAW) {
setRawData({data, size});
}
explicit DataWrapper(BufPairT raw): type(DataTypes::RAW) {
setRawData(raw);
}
explicit DataWrapper(SerializeIF& serializable): type(DataTypes::SERIALIZABLE) {
setSerializable(serializable);
}
DataTypes type = DataTypes::NONE;
DataUnion dataUnion;
using BufPairT = std::pair<const uint8_t*, size_t>;
[[nodiscard]] size_t getLength() const {
if (type == DataTypes::RAW) {