##// END OF EJS Templates
Function added to the plugin to store packets in CSV format.
Function added to the plugin to store packets in CSV format.

File last commit:

r17:409986095715 default
r55:4ea52012da18 default
Show More
stardundee.h
104 lines | 3.4 KiB | text/x-c | CLexer
#ifndef STARDUNDEE_H
#define STARDUNDEE_H
#include <QWidget>
#include <QPushButton>
#include <QGridLayout>
#include <QSpinBox>
#include <QLabel>
#include <QSemaphore>
#include <QTimer>
#include <QDialog>
#include "rmapoperations.h"
#include "spw_usb_api.h"
#include "spw_config_library.h"
#include "ccsds.h"
#include "tmpackettoread.h"
#define BWAIT_0 0
#define BWAIT_1 1
#define PATH_ADDRESSING_OFFSET 1
class StarDundee : public QWidget
{
Q_OBJECT
public:
explicit StarDundee(QWidget *parent = 0);
~StarDundee();
unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
signals:
void sendMessage(QString message);
void sendPacket(TMPacketToRead*);
void isOpen(bool);
void RMAP_write_reply_setText(QString);
void appendToLog(QString);
public slots:
void Open();
void Close();
void reTestSPWLink();
int receiveSPWPacketLoop(unsigned char requestID=0);
int receiveSPWPacket(unsigned char requestID=0);
void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;}
void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
//
void receivePollingLoop();
private:
unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();}
void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();}
unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts);
unsigned int getLinkStatus(unsigned char link);
unsigned int GetRoutingTableEntry(int tableEntry);
unsigned char rmapTargetLogicalAddress ;
unsigned char rmapSourceLogicalAddress ;
RMAP_command_codes commandCode;
QLabel *usbDeviceNumber_LABEL;
QLabel *linkNumber_LABEL;
QLabel *starDundeeStatusQueryDialogLabel;
QSpinBox *usbDeviceNumber_SPINBOX;
QSpinBox *linkNumber_SPINBOX;
QGridLayout *connection_LAYOUT;
QGridLayout *starDundeeStatusQueryDialogLayout;
QDialog *starDundeeStatusQueryDialog;
QPushButton *starDundeeStatusQueryRetryButton;
QPushButton *starDundeeStatusQueryAbortButton;
QTimer *timer;
unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
USB_SPACEWIRE_ID pIdentifierRead; // A pointer to a variable which will be set to contain a unique identifier for the read
USB_SPACEWIRE_ID pIdentifier;
star_device_handle hDevice; // Handle to the SpaceWire device
USB_SPACEWIRE_STATUS result; // The result of the send operation
// Packet receiver
QSemaphore *rmapPacketSEMAPHORE;
QSemaphore *ccsdsPacketSEMAPHORE;
char* rmapPacket; // The buffer to receive RMAP READ packets
unsigned char *ccsdsPacket;
char *spwPacket;
unsigned int rmapPacketSize;
unsigned int ccsdsPacketSize;
};
#endif // STARDUNDEE_H