2008-05-03 09:37:10 -05:00
|
|
|
#ifndef _PORT_H
|
|
|
|
#define _PORT_H
|
|
|
|
|
|
|
|
#include <Qt>
|
|
|
|
#include <QString>
|
|
|
|
#include <QList>
|
|
|
|
#include "stream.h"
|
|
|
|
|
2008-08-08 22:22:13 -05:00
|
|
|
class StreamModel;
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
class Port {
|
2008-08-08 22:22:13 -05:00
|
|
|
|
|
|
|
#if 0 // PB
|
2008-05-03 09:37:10 -05:00
|
|
|
friend class PortStatsModel;
|
2008-08-08 22:22:13 -05:00
|
|
|
#endif
|
|
|
|
friend class StreamModel;
|
2008-05-03 09:37:10 -05:00
|
|
|
|
2008-08-08 22:22:13 -05:00
|
|
|
//friend class PbHelper;
|
|
|
|
|
|
|
|
// FIXME: non-friend mechanism
|
|
|
|
//friend QList<Stream>* StreamModel::currentPortStreamList(void);
|
2008-05-03 09:37:10 -05:00
|
|
|
|
|
|
|
private:
|
2008-08-08 22:22:13 -05:00
|
|
|
OstProto::PortConfig d;
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
quint32 mPortId;
|
|
|
|
quint32 mPortGroupId;
|
2008-08-08 22:22:13 -05:00
|
|
|
QString mUserAlias; // user defined
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
QList<Stream> mStreams;
|
2008-08-08 22:22:13 -05:00
|
|
|
|
|
|
|
#if 0 // PB
|
|
|
|
quint32 mPortId;
|
2008-05-03 09:37:10 -05:00
|
|
|
QString mName;
|
|
|
|
QString mDescription;
|
|
|
|
AdminStatus mAdminStatus;
|
|
|
|
OperStatus mOperStatus;
|
|
|
|
ControlMode mControlMode;
|
|
|
|
|
|
|
|
quint32 mPortStats[10]; // FIXME(HI):Hardcoding
|
2008-08-08 22:22:13 -05:00
|
|
|
#endif
|
2008-05-03 09:37:10 -05:00
|
|
|
|
|
|
|
public:
|
2008-08-08 22:22:13 -05:00
|
|
|
enum AdminStatus { AdminDisable, AdminEnable };
|
|
|
|
enum OperStatus { OperDown, OperUp };
|
|
|
|
enum ControlMode { ControlShared, ControlExclusive };
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
// FIXME(HIGH): default args is a hack for QList operations on Port
|
|
|
|
Port(quint32 id = 0xFFFFFFFF, quint32 pgId = 0xFFFFFFFF);
|
|
|
|
|
|
|
|
quint32 portGroupId() const { return mPortGroupId; }
|
|
|
|
const QString& userAlias() const { return mUserAlias; }
|
|
|
|
|
2008-08-08 22:22:13 -05:00
|
|
|
quint32 id() const
|
|
|
|
{ return d.port_id(); }
|
|
|
|
const QString name() const
|
|
|
|
{ return QString().fromStdString(d.name()); }
|
|
|
|
const QString description() const
|
|
|
|
{ return QString().fromStdString(d.description()); }
|
|
|
|
AdminStatus adminStatus()
|
|
|
|
{ return (d.is_enabled()?AdminEnable:AdminDisable); }
|
|
|
|
OperStatus operStatus()
|
|
|
|
{ return (d.is_oper_up()?OperUp:OperDown); }
|
|
|
|
ControlMode controlMode()
|
|
|
|
{ return (d.is_exclusive_control()?ControlExclusive:ControlShared); }
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
void setName(QString &name) { d.name; }
|
2008-05-03 09:37:10 -05:00
|
|
|
void setName(const char* name) { mName = QString(name); }
|
|
|
|
void setDescription(QString &description) { mDescription = description; }
|
|
|
|
void setDescription(const char *description)
|
|
|
|
{ mDescription = QString(description); }
|
2008-08-08 22:22:13 -05:00
|
|
|
#endif
|
2008-05-03 09:37:10 -05:00
|
|
|
//void setAdminEnable(AdminStatus status) { mAdminStatus = status; }
|
|
|
|
void setAlias(QString &alias) { mUserAlias = alias; }
|
|
|
|
//void setExclusive(bool flag);
|
2008-08-08 22:22:13 -05:00
|
|
|
|
|
|
|
void updatePortConfig(OstProto::PortConfig *portConfig);
|
|
|
|
|
2008-05-03 09:37:10 -05:00
|
|
|
// FIXME(HIGH): Only for testing
|
|
|
|
void insertDummyStreams();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|