Merge branch 'master' into mueller/enhanced-controller

This commit is contained in:
Robin Müller 2020-11-26 16:28:25 +01:00
commit 7fadb0d8c6
25 changed files with 49 additions and 28 deletions

View File

@ -1,5 +1,6 @@
#include "ActionHelper.h" #include "ActionHelper.h"
#include "HasActionsIF.h" #include "HasActionsIF.h"
#include "../ipc/MessageQueueSenderIF.h" #include "../ipc/MessageQueueSenderIF.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"

View File

@ -1,5 +1,5 @@
#ifndef ACTIONMESSAGE_H_ #ifndef FSFW_ACTION_ACTIONMESSAGE_H_
#define ACTIONMESSAGE_H_ #define FSFW_ACTION_ACTIONMESSAGE_H_
#include "../ipc/CommandMessage.h" #include "../ipc/CommandMessage.h"
#include "../objectmanager/ObjectManagerIF.h" #include "../objectmanager/ObjectManagerIF.h"
@ -18,15 +18,19 @@ public:
static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(5); static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(5);
static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(6); static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(6);
virtual ~ActionMessage(); virtual ~ActionMessage();
static void setCommand(CommandMessage* message, ActionId_t fid, store_address_t parameters); static void setCommand(CommandMessage* message, ActionId_t fid,
store_address_t parameters);
static ActionId_t getActionId(const CommandMessage* message ); static ActionId_t getActionId(const CommandMessage* message );
static store_address_t getStoreId(const CommandMessage* message ); static store_address_t getStoreId(const CommandMessage* message );
static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); static void setStepReply(CommandMessage* message, ActionId_t fid,
uint8_t step, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
static uint8_t getStep(const CommandMessage* message ); static uint8_t getStep(const CommandMessage* message );
static ReturnValue_t getReturnCode(const CommandMessage* message ); static ReturnValue_t getReturnCode(const CommandMessage* message );
static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data); static void setDataReply(CommandMessage* message, ActionId_t actionId,
static void setCompletionReply(CommandMessage* message, ActionId_t fid, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); store_address_t data);
static void setCompletionReply(CommandMessage* message, ActionId_t fid,
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
static void clear(CommandMessage* message); static void clear(CommandMessage* message);
}; };
#endif /* ACTIONMESSAGE_H_ */ #endif /* FSFW_ACTION_ACTIONMESSAGE_H_ */

View File

@ -1,5 +1,5 @@
#ifndef COMMANDSACTIONSIF_H_ #ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
#define COMMANDSACTIONSIF_H_ #define FSFW_ACTION_COMMANDSACTIONSIF_H_
#include "CommandActionHelper.h" #include "CommandActionHelper.h"
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
@ -24,11 +24,14 @@ public:
virtual MessageQueueIF* getCommandQueuePtr() = 0; virtual MessageQueueIF* getCommandQueuePtr() = 0;
protected: protected:
virtual void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) = 0; virtual void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) = 0;
virtual void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) = 0; virtual void stepFailedReceived(ActionId_t actionId, uint8_t step,
virtual void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) = 0; ReturnValue_t returnCode) = 0;
virtual void dataReceived(ActionId_t actionId, const uint8_t* data,
uint32_t size) = 0;
virtual void completionSuccessfulReceived(ActionId_t actionId) = 0; virtual void completionSuccessfulReceived(ActionId_t actionId) = 0;
virtual void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) = 0; virtual void completionFailedReceived(ActionId_t actionId,
ReturnValue_t returnCode) = 0;
}; };
#endif /* COMMANDSACTIONSIF_H_ */ #endif /* FSFW_ACTION_COMMANDSACTIONSIF_H_ */

View File

@ -3,6 +3,7 @@
#include <FSFWVersion.h> #include <FSFWVersion.h>
#include <cstddef> #include <cstddef>
#include <cstdint>
//! Used to determine whether C++ ostreams are used //! Used to determine whether C++ ostreams are used
//! Those can lead to code bloat. //! Those can lead to code bloat.

View File

@ -1,8 +1,8 @@
#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_ #ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_
#define CONFIG_DEVICES_LOGICALADDRESSES_H_ #define CONFIG_DEVICES_LOGICALADDRESSES_H_
#include <config/objects/systemObjectList.h>
#include <fsfw/devicehandlers/CookieIF.h> #include <fsfw/devicehandlers/CookieIF.h>
#include "../objects/systemObjectList.h"
#include <cstdint> #include <cstdint>
/** /**

View File

@ -1,4 +1,5 @@
#include <config/ipc/MissionMessageTypes.h> #include "missionMessageTypes.h"
#include <fsfw/ipc/CommandMessageIF.h> #include <fsfw/ipc/CommandMessageIF.h>
void messagetypes::clearMissionMessage(CommandMessage* message) { void messagetypes::clearMissionMessage(CommandMessage* message) {

View File

@ -11,6 +11,7 @@
#include <fsfw/tmtcpacket/pus/TmPacketStored.h> #include <fsfw/tmtcpacket/pus/TmPacketStored.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h> #include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h> #include <fsfw/tmtcservices/PusServiceBase.h>
#include <internalError/InternalErrorReporter.h>
#include <cstdint> #include <cstdint>
@ -31,15 +32,15 @@ void Factory::produce(void) {
setStaticFrameworkObjectIds(); setStaticFrameworkObjectIds();
new EventManager(objects::EVENT_MANAGER); new EventManager(objects::EVENT_MANAGER);
new HealthTable(objects::HEALTH_TABLE); new HealthTable(objects::HEALTH_TABLE);
//new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
} }
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetSource = objects::NO_OBJECT;
PusServiceBase::packetDestination = objects::TM_FUNNEL; PusServiceBase::packetDestination = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
@ -48,7 +49,6 @@ void Factory::setStaticFrameworkObjectIds() {
DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT; DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
TmPacketStored::timeStamperId = objects::PUS_TIME; TmPacketStored::timeStamperId = objects::NO_OBJECT;
//TmFunnel::downlinkDestination = objects::NO_OBJECT;
} }

View File

@ -33,7 +33,7 @@ ReturnValue_t TcUnixUdpPollingTask::performOperation(uint8_t opCode) {
while(1) { while(1) {
//! Sender Address is cached here. //! Sender Address is cached here.
struct sockaddr_in senderAddress; struct sockaddr_in senderAddress;
socklen_t senderSockLen = 0; socklen_t senderSockLen = sizeof(senderAddress);
ssize_t bytesReceived = recvfrom(serverUdpSocket, ssize_t bytesReceived = recvfrom(serverUdpSocket,
receptionBuffer.data(), frameSize, receptionFlags, receptionBuffer.data(), frameSize, receptionFlags,
reinterpret_cast<sockaddr*>(&senderAddress), &senderSockLen); reinterpret_cast<sockaddr*>(&senderAddress), &senderSockLen);

View File

@ -65,9 +65,13 @@ TmTcUnixUdpBridge::~TmTcUnixUdpBridge() {
ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) { ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
int flags = 0; int flags = 0;
clientAddress.sin_addr.s_addr = htons(INADDR_ANY); MutexHelper lock(mutex, MutexIF::TimeoutType::WAITING, 10);
//clientAddress.sin_addr.s_addr = inet_addr("127.73.73.1");
clientAddressLen = sizeof(serverAddress); if(ipAddrAnySet){
clientAddress.sin_addr.s_addr = htons(INADDR_ANY);
//clientAddress.sin_addr.s_addr = inet_addr("127.73.73.1");
clientAddressLen = sizeof(serverAddress);
}
// char ipAddress [15]; // char ipAddress [15];
// sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET, // sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET,
@ -85,7 +89,7 @@ ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void TmTcUnixUdpBridge::checkAndSetClientAddress(sockaddr_in newAddress) { void TmTcUnixUdpBridge::checkAndSetClientAddress(sockaddr_in& newAddress) {
MutexHelper lock(mutex, MutexIF::TimeoutType::WAITING, 10); MutexHelper lock(mutex, MutexIF::TimeoutType::WAITING, 10);
// char ipAddress [15]; // char ipAddress [15];
@ -168,3 +172,7 @@ void TmTcUnixUdpBridge::handleSendError() {
} }
} }
void TmTcUnixUdpBridge::setClientAddressToAny(bool ipAddrAnySet){
this->ipAddrAnySet = ipAddrAnySet;
}

View File

@ -20,8 +20,9 @@ public:
uint16_t serverPort = 0xFFFF,uint16_t clientPort = 0xFFFF); uint16_t serverPort = 0xFFFF,uint16_t clientPort = 0xFFFF);
virtual~ TmTcUnixUdpBridge(); virtual~ TmTcUnixUdpBridge();
void checkAndSetClientAddress(sockaddr_in clientAddress); void checkAndSetClientAddress(sockaddr_in& clientAddress);
void setClientAddressToAny(bool ipAddrAnySet);
protected: protected:
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
@ -36,6 +37,8 @@ private:
struct sockaddr_in serverAddress; struct sockaddr_in serverAddress;
socklen_t serverAddressLen = 0; socklen_t serverAddressLen = 0;
bool ipAddrAnySet = false;
//! Access to the client address is mutex protected as it is set //! Access to the client address is mutex protected as it is set
//! by another task. //! by another task.
MutexIF* mutex; MutexIF* mutex;