##// END OF EJS Templates
Added disconnection auto-detection to the spacewire plugin.
Added disconnection auto-detection to the spacewire plugin.

File last commit:

r11:27ed47eb6044 default
r11:27ed47eb6044 default
Show More
apbdevicelist.h
99 lines | 2.8 KiB | text/x-c | CLexer
First init /!\ outdated spwplugin!
r0 /*------------------------------------------------------------------------------
Jeandet Alexis
updated plugin headers and win32/Apbuart fix tentative.
r4 -- This file is a part of the SocExplorer Software
Jeandet Alexis
Added disconnection auto-detection to the spacewire plugin.
r11 -- Copyright (C) 2011, Plasma Physics Laboratory - CNRS
First init /!\ outdated spwplugin!
r0 --
-- 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@lpp.polytechnique.fr
----------------------------------------------------------------------------*/
#ifndef APBDEVICELIST_H
#define APBDEVICELIST_H
#include <QTableWidget>
#include <QString>
#include <QList>
typedef struct
{
unsigned int address;
unsigned int size;
unsigned char type;
}APBbarreg;
class apbdeviceInfo
{
public:
apbdeviceInfo()
{
}
apbdeviceInfo(const QString deviceName,APBbarreg BAR0,int VID,int PID)
{
this->deviceName = deviceName;
this->BAR[0]=BAR0;
this->VID = VID;
this->PID = PID;
}
QString barAdressSize(int barIndex)
{
int k=0;
unsigned int size=this->BAR[barIndex].size;
while(size>=1024){size=size>>10;k++;}
switch(k)
{
case 0:
return (QString::number(size, 10) + "B");
break;
case 1:
return (QString::number(size, 10) + "kB");
break;
case 2:
return (QString::number(size, 10) + "MB");
break;
case 3:
return (QString::number(size, 10) + "GB");
break;
case 4:
return (QString::number(size, 10) + "TB");
break;
default:
return (QString::number(this->BAR[barIndex].size, 10) + "B");
break;
}
}
QString deviceName;
APBbarreg BAR[1];
int VID;
int PID;
};
class apbdevicelist: public QTableWidget
{
Q_OBJECT
public:
explicit apbdevicelist(QWidget * parent = 0);
public slots:
void addAPBdevice(apbdeviceInfo* device);
void clearAPBdevicesList();
private:
QList<apbdeviceInfo*> apbdevices;
};
#endif // APBDEVICELIST_H