#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 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: //****************** // general functions 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();} //**************** // general members unsigned char rmapTargetLogicalAddress ; unsigned char rmapSourceLogicalAddress ; RMAP_command_codes commandCode; QGridLayout *bridge_LAYOUT; QSemaphore *rmapPacketSEMAPHORE; QSemaphore *ccsdsPacketSEMAPHORE; char* rmapPacket; unsigned char *ccsdsPacket; char *spwPacket; unsigned int rmapPacketSize; unsigned int ccsdsPacketSize; //************************** // specific member functions unsigned int GetRoutingTableEntry(); //************************** // specific member variables QLabel *usbDeviceNumber_LABEL; QLabel *linkNumber_LABEL; QLabel *sourceLogicalAddress_LABEL; QSpinBox *usbDeviceNumber_SPINBOX; QSpinBox *linkNumber_SPINBOX; QSpinBox *sourceLogicalAddress_SPINBOX; USB_SPACEWIRE_ID pIdentifier; // unique identifier for the send/receive operations star_device_handle hDevice; // Handle to the SpaceWire device USB_SPACEWIRE_STATUS result; // The result of the send operation }; #endif // STARDUNDEE_H