#ifndef STARDUNDEE_H #define STARDUNDEE_H #include #include "spw_usb_api.h" #include "spw_config_library.h" #include #include #include #include #include #include "rmapoperations.h" #define BWAIT_0 0 #define BWAIT_1 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 WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address); unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); unsigned int getLinkStatus(unsigned char link); signals: void sendMessage(QString message); void isOpen(bool); void RMAP_write_reply_setText(QString); void appendToLog(QString); void ccsdsPacketAvailable(unsigned char*, unsigned int); public slots: unsigned int Open(); unsigned int Close(); int receiveSPWPacket(unsigned char requestID); void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;} private: unsigned int GetRoutingTableEntry(); 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->acquire();} void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();} unsigned char rmapTargetLogicalAddress ; unsigned char rmapSourceLogicalAddress ; RMAP_command_codes commandCode; QLabel *usbDeviceNumber_LABEL; QLabel *linkNumber_LABEL; QLabel *sourceLogicalAddress_LABEL; QSpinBox *usbDeviceNumber_SPINBOX; QSpinBox *linkNumber_SPINBOX; QSpinBox *sourceLogicalAddress_SPINBOX; QGridLayout *connection_LAYOUT; unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send 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