new task for tc unix polling
This commit is contained in:
parent
26ab1983dc
commit
724fee09ff
8
osal/linux/TcUnixUdpPollingTask.cpp
Normal file
8
osal/linux/TcUnixUdpPollingTask.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <framework/osal/linux/TcSocketPollingTask.h>
|
||||
|
||||
TcSocketPollingTask::TcSocketPollingTask(object_id_t objectId,
|
||||
object_id_t tmtcUnixUdpBridge): SystemObject(objectId) {
|
||||
}
|
||||
|
||||
TcSocketPollingTask::~TcSocketPollingTask() {
|
||||
}
|
28
osal/linux/TcUnixUdpPollingTask.h
Normal file
28
osal/linux/TcUnixUdpPollingTask.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef FRAMEWORK_OSAL_LINUX_TCSOCKETPOLLINGTASK_H_
|
||||
#define FRAMEWORK_OSAL_LINUX_TCSOCKETPOLLINGTASK_H_
|
||||
#include <framework/objectmanager/SystemObject.h>
|
||||
#include <framework/tasks/ExecutableObjectIF.h>
|
||||
|
||||
/**
|
||||
* @brief This class can be used to implement the polling of a Unix socket,
|
||||
* using UDP for now.
|
||||
* @details
|
||||
* The task will be blocked while the specified number of bytes has not been
|
||||
* received, so TC reception is handled inside a separate task.
|
||||
* This class caches the IP address of the sender. It is assumed there
|
||||
* is only one sender for now.
|
||||
*/
|
||||
class TcSocketPollingTask: public SystemObject,
|
||||
public ExecutableObjectIF {
|
||||
public:
|
||||
TcSocketPollingTask(object_id_t objectId, object_id_t tmtcUnixUdpBridge);
|
||||
virtual~ TcSocketPollingTask();
|
||||
|
||||
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
||||
virtual ReturnValue_t initialize() override;
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_OSAL_LINUX_TCSOCKETPOLLINGTASK_H_ */
|
@ -47,15 +47,15 @@ TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
||||
TmTcUnixUdpBridge::~TmTcUnixUdpBridge() {
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcUnixUdpBridge::handleTc() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcUnixUdpBridge::receiveTc(uint8_t **recvBuffer, size_t *size) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
||||
int flags = 0;
|
||||
ssize_t result = send(serverSocket, data, dataLen, flags);
|
||||
if(result < 0) {
|
||||
//handle error
|
||||
sif::error << "TmTcUnixUdpBridge::sendTm: Send operation failed "
|
||||
"with error " << strerror(errno) << std::endl;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -114,5 +114,10 @@ void TmTcUnixUdpBridge::handleBindError() {
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ReturnValue_t TmTcUnixUdpBridge::receiveTc(uint8_t **recvBuffer, size_t *size) {
|
||||
// TC reception handled by separate polling task because it is blocking.
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ public:
|
||||
virtual~ TmTcUnixUdpBridge();
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t handleTc() override;
|
||||
virtual ReturnValue_t receiveTc(uint8_t ** recvBuffer,
|
||||
size_t * size) override;
|
||||
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
|
||||
|
Loading…
Reference in New Issue
Block a user