stardundeespw_usb.h
128 lines
| 4.1 KiB
| text/x-c
|
CLexer
/ spwplugin / stardundeespw_usb.h
Jeandet Alexis
|
r8 | /*------------------------------------------------------------------------------ | ||
-- This file is a part of the SocExplorer Software | ||||
Jeandet Alexis
|
r11 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | ||
Jeandet Alexis
|
r8 | -- | ||
-- This program is free software; you can redistribute it and/or modify | ||||
-- it under the terms of the GNU General Public License as published by | ||||
-- the Free Software Foundation; either version 3 of the License, or | ||||
-- (at your option) any later version. | ||||
-- | ||||
-- This program is distributed in the hope that it will be useful, | ||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
-- GNU General Public License for more details. | ||||
-- | ||||
-- You should have received a copy of the GNU General Public License | ||||
-- along with this program; if not, write to the Free Software | ||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
-------------------------------------------------------------------------------*/ | ||||
/*-- Author : Alexis Jeandet | ||||
-- Mail : alexis.jeandet@member.fsf.org | ||||
----------------------------------------------------------------------------*/ | ||||
r0 | #ifndef STARDUNDEESPW_USB_H | |||
#define STARDUNDEESPW_USB_H | ||||
#include <QObject> | ||||
#include <spw_usb_api.h> | ||||
#include <spw_config_library.h> | ||||
#include <socexplorerplugin.h> | ||||
#include <abstractspwbridge.h> | ||||
#include <QThread> | ||||
#include <QMutex> | ||||
#include <QSemaphore> | ||||
Jeandet Alexis
|
r8 | #include <QGridLayout> | ||
#include <QPushButton> | ||||
r10 | #include <QComboBox> | |||
#include <QLabel> | ||||
#include "stardundeegui.h" | ||||
r0 | ||||
class RMAP_Answer | ||||
{ | ||||
public: | ||||
RMAP_Answer(int ID,char* data,int len) | ||||
{ | ||||
transactionID = ID; | ||||
this->data = data; | ||||
this->len = len; | ||||
} | ||||
int transactionID; | ||||
char* data; | ||||
int len; | ||||
}; | ||||
class stardundeeSPW_USB_Manager: public QThread | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
Jeandet Alexis
|
r8 | explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0); | ||
r0 | ~stardundeeSPW_USB_Manager(); | |||
void run(); | ||||
bool connectBridge(); | ||||
bool disconnectBridge(); | ||||
int getRMAPtransactionID(); | ||||
int getRMAPanswer(int transactionID,char** buffer); | ||||
bool sendPacket(char* packet,int size); | ||||
Jeandet Alexis
|
r11 | |||
signals: | ||||
void updateAvailableBrickCount(int count); | ||||
r0 | private: | |||
QMutex* handleMutex,*RMAP_AnswersMtx,*RMAP_pending_transaction_IDsMtx; | ||||
QSemaphore* RMAP_AnswersSem; | ||||
void pushRmapPacket(char* packet,int len); | ||||
star_device_handle hDevice; | ||||
socexplorerplugin* plugin; | ||||
bool connected; | ||||
char* SPWPacketBuff; | ||||
QList<RMAP_Answer*> RMAP_Answers; | ||||
QList<int> RMAP_pending_transaction_IDs; | ||||
Jeandet Alexis
|
r11 | |||
public: | ||||
int selectedBrick; | ||||
Jeandet Alexis
|
r9 | int linkNumber; | ||
r10 | int brickList; | |||
Jeandet Alexis
|
r11 | int linkSpeed; | ||
int destinationKey; | ||||
int rmapAddress; | ||||
int rmapKey; | ||||
int RMAPtimeout; | ||||
r0 | }; | |||
class stardundeeSPW_USB : public abstractSpwBridge | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
explicit stardundeeSPW_USB(socexplorerplugin *parent = 0); | ||||
Jeandet Alexis
|
r8 | ~stardundeeSPW_USB(); | ||
r0 | ||||
signals: | ||||
r14 | void setRmapTimeout(const QString & timeout); | |||
void SelectBrick(int brickIndex); | ||||
void SelectLinkNumber(int linkIndex); | ||||
void SelectLinkSpeed(int linkSpeed); | ||||
void SetDestinationKey(const QString & destKey); | ||||
void SetRmapAddress(const QString & address); | ||||
void SetRmapKey(const QString & key); | ||||
void SetRmapTimeout(const QString & timeout); | ||||
r0 | public slots: | |||
Jeandet Alexis
|
r8 | void toggleBridgeConnection(); | ||
r0 | bool connectBridge(); | |||
bool disconnectBridge(); | ||||
int pushRMAPPacket(char* packet,int size); | ||||
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); | ||||
Jeandet Alexis
|
r11 | void brickSelectionChanged(int brickIndex); | ||
void linkNumberSelectionChanged(int linkIndex); | ||||
void linkSpeedSelectionChanged(const QString & linkSpeed); | ||||
void destinationKeyChanged(const QString & destKey); | ||||
void rmapAddressChanged(const QString & rmapaddress); | ||||
void rmapKeyChanged(const QString & key); | ||||
r14 | void rmapTimeoutChanged(const QString & timeout); | |||
r0 | private: | |||
Jeandet Alexis
|
r9 | void makeGUI(socexplorerplugin *parent); | ||
r0 | stardundeeSPW_USB_Manager* manager; | |||
Jeandet Alexis
|
r11 | // QGridLayout* mainLayout; | ||
r0 | }; | |||
#endif // STARDUNDEESPW_USB_H | ||||