Merge branch 'development' into mueller/version-update
This commit is contained in:
commit
741d96d7ed
@ -1,6 +1,7 @@
|
|||||||
#include "fsfw_hal/linux/uart/UartComIF.h"
|
#include "UartComIF.h"
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
|
#include "fsfw_hal/linux/utility.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -60,7 +61,13 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) {
|
|||||||
struct termios options = {};
|
struct termios options = {};
|
||||||
|
|
||||||
std::string deviceFile = uartCookie->getDeviceFile();
|
std::string deviceFile = uartCookie->getDeviceFile();
|
||||||
int fd = open(deviceFile.c_str(), O_RDWR);
|
int flags = O_RDWR;
|
||||||
|
if(uartCookie->getUartMode() == UartModes::CANONICAL) {
|
||||||
|
// In non-canonical mode, don't specify O_NONBLOCK because these properties will be
|
||||||
|
// controlled by the VTIME and VMIN parameters and O_NONBLOCK would override this
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
}
|
||||||
|
int fd = open(deviceFile.c_str(), flags);
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile <<
|
sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile <<
|
||||||
@ -259,23 +266,22 @@ void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCooki
|
|||||||
|
|
||||||
ReturnValue_t UartComIF::sendMessage(CookieIF *cookie,
|
ReturnValue_t UartComIF::sendMessage(CookieIF *cookie,
|
||||||
const uint8_t *sendData, size_t sendLen) {
|
const uint8_t *sendData, size_t sendLen) {
|
||||||
|
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
UartDeviceMapIter uartDeviceMapIter;
|
UartDeviceMapIter uartDeviceMapIter;
|
||||||
|
|
||||||
if(sendData == nullptr) {
|
|
||||||
sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl;
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sendLen == 0) {
|
if(sendLen == 0) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(sendData == nullptr) {
|
||||||
|
sif::warning << "UartComIF::sendMessage: Send data is nullptr" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
||||||
if(uartCookie == nullptr) {
|
if(uartCookie == nullptr) {
|
||||||
sif::debug << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl;
|
sif::warning << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl;
|
||||||
return NULLPOINTER;
|
return NULLPOINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,12 +353,13 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
|
|||||||
size_t maxReplySize = uartCookie.getMaxReplyLen();
|
size_t maxReplySize = uartCookie.getMaxReplyLen();
|
||||||
int fd = iter->second.fileDescriptor;
|
int fd = iter->second.fileDescriptor;
|
||||||
auto bufferPtr = iter->second.replyBuffer.data();
|
auto bufferPtr = iter->second.replyBuffer.data();
|
||||||
|
iter->second.replyLen = 0;
|
||||||
do {
|
do {
|
||||||
size_t allowedReadSize = 0;
|
size_t allowedReadSize = 0;
|
||||||
if(currentBytesRead >= maxReplySize) {
|
if(currentBytesRead >= maxReplySize) {
|
||||||
// Overflow risk. Emit warning, trigger event and break. If this happens,
|
// Overflow risk. Emit warning, trigger event and break. If this happens,
|
||||||
// the reception buffer is not large enough or data is not polled often enough.
|
// the reception buffer is not large enough or data is not polled often enough.
|
||||||
#if OBSW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!"
|
sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -370,7 +377,20 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
|
|||||||
|
|
||||||
bytesRead = read(fd, bufferPtr, allowedReadSize);
|
bytesRead = read(fd, bufferPtr, allowedReadSize);
|
||||||
if (bytesRead < 0) {
|
if (bytesRead < 0) {
|
||||||
return RETURN_FAILED;
|
// EAGAIN: No data available in non-blocking mode
|
||||||
|
if(errno != EAGAIN) {
|
||||||
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "UartComIF::handleCanonicalRead: read failed with code" <<
|
||||||
|
errno << ": " << strerror(errno) << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("UartComIF::handleCanonicalRead: read failed with code %d: %s\n",
|
||||||
|
errno, strerror(errno));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(bytesRead > 0) {
|
else if(bytesRead > 0) {
|
||||||
iter->second.replyLen += bytesRead;
|
iter->second.replyLen += bytesRead;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode,
|
UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode,
|
||||||
uint32_t baudrate, size_t maxReplyLen):
|
uint32_t baudrate, size_t maxReplyLen):
|
||||||
handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), baudrate(baudrate),
|
handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode),
|
||||||
maxReplyLen(maxReplyLen) {
|
baudrate(baudrate), maxReplyLen(maxReplyLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
UartCookie::~UartCookie() {}
|
UartCookie::~UartCookie() {}
|
||||||
|
@ -469,7 +469,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep
|
|||||||
auto replyIter = deviceReplyMap.find(deviceReply);
|
auto replyIter = deviceReplyMap.find(deviceReply);
|
||||||
if (replyIter == deviceReplyMap.end()) {
|
if (replyIter == deviceReplyMap.end()) {
|
||||||
triggerEvent(INVALID_DEVICE_COMMAND, deviceReply);
|
triggerEvent(INVALID_DEVICE_COMMAND, deviceReply);
|
||||||
return RETURN_FAILED;
|
return COMMAND_NOT_SUPPORTED;
|
||||||
} else {
|
} else {
|
||||||
DeviceReplyInfo *info = &(replyIter->second);
|
DeviceReplyInfo *info = &(replyIter->second);
|
||||||
if (maxDelayCycles != 0) {
|
if (maxDelayCycles != 0) {
|
||||||
@ -481,6 +481,25 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandId_t deviceReply) {
|
||||||
|
auto replyIter = deviceReplyMap.find(deviceReply);
|
||||||
|
if (replyIter == deviceReplyMap.end()) {
|
||||||
|
triggerEvent(INVALID_DEVICE_COMMAND, deviceReply);
|
||||||
|
return COMMAND_NOT_SUPPORTED;
|
||||||
|
} else {
|
||||||
|
DeviceReplyInfo *info = &(replyIter->second);
|
||||||
|
if(not info->periodic) {
|
||||||
|
return COMMAND_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
if(enable) {
|
||||||
|
info->delayCycles = info->maxDelayCycles;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
info->delayCycles = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId,
|
ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId,
|
||||||
LocalPoolDataSetBase *dataSet) {
|
LocalPoolDataSetBase *dataSet) {
|
||||||
|
@ -449,7 +449,9 @@ protected:
|
|||||||
* @param replyLen Will be supplied to the requestReceiveMessage call of
|
* @param replyLen Will be supplied to the requestReceiveMessage call of
|
||||||
* the communication interface.
|
* the communication interface.
|
||||||
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
||||||
* by the device repeatedly without request) or not. Default is aperiodic (0)
|
* by the device repeatedly without request) or not. Default is aperiodic (0).
|
||||||
|
* Please note that periodic replies are disabled by default. You can enable them with
|
||||||
|
* #updatePeriodicReply
|
||||||
* @return - @c RETURN_OK when the command was successfully inserted,
|
* @return - @c RETURN_OK when the command was successfully inserted,
|
||||||
* - @c RETURN_FAILED else.
|
* - @c RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
@ -464,7 +466,9 @@ protected:
|
|||||||
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
||||||
* until it times out.
|
* until it times out.
|
||||||
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
||||||
* by the device repeatedly without request) or not. Default is aperiodic (0)
|
* by the device repeatedly without request) or not. Default is aperiodic (0).
|
||||||
|
* Please note that periodic replies are disabled by default. You can enable them with
|
||||||
|
* #updatePeriodicReply
|
||||||
* @return - @c RETURN_OK when the command was successfully inserted,
|
* @return - @c RETURN_OK when the command was successfully inserted,
|
||||||
* - @c RETURN_FAILED else.
|
* - @c RETURN_FAILED else.
|
||||||
*/
|
*/
|
||||||
@ -480,6 +484,14 @@ protected:
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables a periodic reply for a given command. It sets to delay cycles to the specified
|
||||||
|
* maximum delay cycles for a given reply ID if enabled or to 0 if disabled.
|
||||||
|
* @param enable Specify whether to enable or disable a given periodic reply
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ReturnValue_t updatePeriodicReply(bool enable, DeviceCommandId_t deviceReply);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function returns the reply length of the next reply to read.
|
* @brief This function returns the reply length of the next reply to read.
|
||||||
*
|
*
|
||||||
@ -493,16 +505,14 @@ protected:
|
|||||||
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand);
|
virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This is a helper method to facilitate updating entries
|
* @brief This is a helper method to facilitate updating entries in the reply map.
|
||||||
* in the reply map.
|
|
||||||
* @param deviceCommand Identifier of the reply to update.
|
* @param deviceCommand Identifier of the reply to update.
|
||||||
* @param delayCycles The current number of delay cycles to wait.
|
* @param delayCycles The current number of delay cycles to wait. As stated in
|
||||||
* As stated in #fillCommandAndCookieMap, to disable periodic commands,
|
* #fillCommandAndReplyMap, to disable periodic commands, this is set to zero.
|
||||||
* this is set to zero.
|
|
||||||
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
* @param maxDelayCycles The maximum number of delay cycles the reply waits
|
||||||
* until it times out. By passing 0 the entry remains untouched.
|
* until it times out. By passing 0 the entry remains untouched.
|
||||||
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
* @param periodic Indicates if the command is periodic (i.e. it is sent
|
||||||
* by the device repeatedly without request) or not.Default is aperiodic (0).
|
* by the device repeatedly without request) or not. Default is aperiodic (0).
|
||||||
* Warning: The setting always overrides the value that was entered in the map.
|
* Warning: The setting always overrides the value that was entered in the map.
|
||||||
* @return - @c RETURN_OK when the command was successfully inserted,
|
* @return - @c RETURN_OK when the command was successfully inserted,
|
||||||
* - @c RETURN_FAILED else.
|
* - @c RETURN_FAILED else.
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
#include "fsfw/osal/common/TcpTmTcBridge.h"
|
||||||
#include "fsfw/osal/common/tcpipHelpers.h"
|
|
||||||
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
@ -17,8 +16,6 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string TcpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
|
||||||
|
|
||||||
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tmStoreId, object_id_t tcStoreId):
|
object_id_t tmStoreId, object_id_t tcStoreId):
|
||||||
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_
|
#define FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_
|
||||||
|
|
||||||
#include "TcpIpBase.h"
|
#include "TcpIpBase.h"
|
||||||
#include "../../tmtcservices/TmTcBridge.h"
|
#include "fsfw/tmtcservices/TmTcBridge.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
@ -29,8 +29,6 @@ class TcpTmTcBridge:
|
|||||||
public TmTcBridge {
|
public TmTcBridge {
|
||||||
friend class TcpTmTcServer;
|
friend class TcpTmTcServer;
|
||||||
public:
|
public:
|
||||||
/* The ports chosen here should not be used by any other process. */
|
|
||||||
static const std::string DEFAULT_UDP_SERVER_PORT;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -22,14 +22,14 @@
|
|||||||
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7303";
|
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge,
|
TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge,
|
||||||
size_t receptionBufferSize, std::string customTcpServerPort):
|
size_t receptionBufferSize, std::string customTcpServerPort):
|
||||||
SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge),
|
SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge),
|
||||||
tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) {
|
tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) {
|
||||||
if(tcpPort == "") {
|
if(tcpPort == "") {
|
||||||
tcpPort = DEFAULT_TCP_SERVER_PORT;
|
tcpPort = DEFAULT_SERVER_PORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,6 +200,10 @@ void TcpTmTcServer::setTcpBacklog(uint8_t tcpBacklog) {
|
|||||||
this->tcpBacklog = tcpBacklog;
|
this->tcpBacklog = tcpBacklog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string TcpTmTcServer::getTcpPort() const {
|
||||||
|
return tcpPort;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) {
|
ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) {
|
||||||
// Access to the FIFO is mutex protected because it is filled by the bridge
|
// Access to the FIFO is mutex protected because it is filled by the bridge
|
||||||
MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs);
|
MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs);
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
#include "TcpIpBase.h"
|
#include "TcpIpBase.h"
|
||||||
|
|
||||||
#include "../../platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "../../ipc/messageQueueDefinitions.h"
|
#include "fsfw/osal/common/tcpipHelpers.h"
|
||||||
#include "../../ipc/MessageQueueIF.h"
|
#include "fsfw/ipc/messageQueueDefinitions.h"
|
||||||
#include "../../objectmanager/frameworkObjects.h"
|
#include "fsfw/ipc/MessageQueueIF.h"
|
||||||
#include "../../objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/frameworkObjects.h"
|
||||||
#include "../../storagemanager/StorageManagerIF.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "../../tasks/ExecutableObjectIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -41,10 +42,9 @@ class TcpTmTcServer:
|
|||||||
public TcpIpBase,
|
public TcpIpBase,
|
||||||
public ExecutableObjectIF {
|
public ExecutableObjectIF {
|
||||||
public:
|
public:
|
||||||
/* The ports chosen here should not be used by any other process. */
|
static const std::string DEFAULT_SERVER_PORT;
|
||||||
static const std::string DEFAULT_TCP_SERVER_PORT;
|
|
||||||
|
|
||||||
static constexpr size_t ETHERNET_MTU_SIZE = 1500;
|
static constexpr size_t ETHERNET_MTU_SIZE = 1500;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCP Server Constructor
|
* TCP Server Constructor
|
||||||
@ -65,6 +65,8 @@ public:
|
|||||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
|
std::string getTcpPort() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StorageManagerIF* tcStore = nullptr;
|
StorageManagerIF* tcStore = nullptr;
|
||||||
StorageManagerIF* tmStore = nullptr;
|
StorageManagerIF* tmStore = nullptr;
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId):
|
std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId):
|
||||||
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
if(udpServerPort == "") {
|
if(udpServerPort == "") {
|
||||||
this->udpServerPort = DEFAULT_UDP_SERVER_PORT;
|
this->udpServerPort = DEFAULT_SERVER_PORT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->udpServerPort = udpServerPort;
|
this->udpServerPort = udpServerPort;
|
||||||
@ -108,6 +108,10 @@ UdpTmTcBridge::~UdpTmTcBridge() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string UdpTmTcBridge::getUdpPort() const {
|
||||||
|
return udpServerPort;
|
||||||
|
}
|
||||||
|
|
||||||
ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_
|
#define FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_
|
||||||
|
|
||||||
#include "TcpIpBase.h"
|
#include "TcpIpBase.h"
|
||||||
#include "../../platform.h"
|
#include "fsfw/platform.h"
|
||||||
#include "../../tmtcservices/TmTcBridge.h"
|
#include "fsfw/tmtcservices/TmTcBridge.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
@ -28,7 +28,7 @@ class UdpTmTcBridge:
|
|||||||
friend class UdpTcPollingTask;
|
friend class UdpTcPollingTask;
|
||||||
public:
|
public:
|
||||||
/* The ports chosen here should not be used by any other process. */
|
/* The ports chosen here should not be used by any other process. */
|
||||||
static const std::string DEFAULT_UDP_SERVER_PORT;
|
static const std::string DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
std::string udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE,
|
std::string udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE,
|
||||||
@ -44,6 +44,8 @@ public:
|
|||||||
|
|
||||||
void checkAndSetClientAddress(sockaddr& clientAddress);
|
void checkAndSetClientAddress(sockaddr& clientAddress);
|
||||||
|
|
||||||
|
std::string getUdpPort() const;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
#ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
||||||
#define FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
#define FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
||||||
|
|
||||||
#include "../../timemanager/clockDefinitions.h"
|
#include "fsfw/timemanager/clockDefinitions.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace tcpip {
|
namespace tcpip {
|
||||||
|
|
||||||
const char* const DEFAULT_SERVER_PORT = "7301";
|
static constexpr char DEFAULT_SERVER_PORT[] = "7301";
|
||||||
|
|
||||||
enum class Protocol {
|
enum class Protocol {
|
||||||
UDP,
|
UDP,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user