##// END OF EJS Templates
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.

File last commit:

r0:081a6eb3cced default
r0:081a6eb3cced default
Show More
spwpacketreceiver.h
44 lines | 1.6 KiB | text/x-c | CLexer
#ifndef SPWPACKETRECEIVER_H
#define SPWPACKETRECEIVER_H
#include <QSemaphore>
#include <QTcpSocket>
#define READ_WRITE_MAX_COUNTS 4096 // in words
#define RMAP_MAX_DATA_LENGTH 4*READ_WRITE_MAX_COUNTS // in bytes, shall be lower than the limit size of SPW packet of the GRESB bridge
#define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
#define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
#define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
#define RMAP_MAX_PACKET_LENGTH RMAP_READ_REPLY_HEADER_LENGTH + RMAP_MAX_DATA_LENGTH + RMAP_DATA_CRC_LENGTH
#define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
class spwpacketreceiver : public QObject
{
Q_OBJECT
public:
explicit spwpacketreceiver(QObject *parent = 0);
~spwpacketreceiver();
int fetchRMAPPacket();
void acquireRMAPSemaphore();
void acquireCCSDSSemaphore();
bool isRMAPPacketSemaphoreAvailable();
unsigned char* ccsdsPacket;
char* rmapPacket;
char* spwPacket;
unsigned int rmapPacketSize;
unsigned int ccsdsPacketSize;
QSemaphore* rmapPacketSEMAPHORE;
QSemaphore* ccsdsPacketSEMAPHORE;
QTcpSocket* gresbReceptionSocket;
public slots:
int receiveSPWPacket(unsigned char requestID = 0); // request ID by default is 0 for CCSDS
void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
signals:
void ccsdsPacketAvailable(unsigned char* ccsdsPacket, unsigned int size);
void sendMessage(QString message);
};
#endif // SPWPACKETRECEIVER_H