Enhancements
- Server now updates the "packet list" after every "apply" rather than before a "start transmit" (if dirty) - this better reflects user's expectation from these operations - Client disables the entire application and changes to a "Busy" cursor when "applying" stream configuration Fixes - UDP checksum no longer is zero but a valid value - Order of streams no longer gets messed up across a "apply"
This commit is contained in:
parent
78a2de040b
commit
70ca42fbb3
@ -2,11 +2,16 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
|
QMainWindow *mainWindow;
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow mainWin;
|
int exitCode;
|
||||||
|
|
||||||
mainWin.show();
|
mainWindow = new MainWindow;
|
||||||
return app.exec();
|
mainWindow->show();
|
||||||
|
exitCode = app.exec();
|
||||||
|
delete mainWindow;
|
||||||
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void Port::updateStreamOrdinalsFromIndex()
|
|||||||
|
|
||||||
void Port::reorderStreamsByOrdinals()
|
void Port::reorderStreamsByOrdinals()
|
||||||
{
|
{
|
||||||
qSort(mStreams);
|
qSort(mStreams.begin(), mStreams.end(), StreamBase::StreamLessThan);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Port::newStreamAt(int index)
|
bool Port::newStreamAt(int index)
|
||||||
@ -176,7 +176,7 @@ void Port::getModifiedStreamsSinceLastSync(
|
|||||||
|
|
||||||
void Port::when_syncComplete()
|
void Port::when_syncComplete()
|
||||||
{
|
{
|
||||||
qSort(mStreams);
|
//reorderStreamsByOrdinals();
|
||||||
|
|
||||||
mLastSyncStreamList.clear();
|
mLastSyncStreamList.clear();
|
||||||
for (int i=0; i<mStreams.size(); i++)
|
for (int i=0; i<mStreams.size(); i++)
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
#include <QtGlobal>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QTemporaryFile>
|
|
||||||
|
|
||||||
#include "portgroup.h"
|
#include "portgroup.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QCursor>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QTemporaryFile>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
extern QMainWindow *mainWindow;
|
||||||
|
|
||||||
quint32 PortGroup::mPortGroupAllocId = 0;
|
quint32 PortGroup::mPortGroupAllocId = 0;
|
||||||
|
|
||||||
@ -129,6 +133,9 @@ void PortGroup::when_configApply(int portIndex, uint *cookie)
|
|||||||
{
|
{
|
||||||
OstProto::StreamIdList streamIdList;
|
OstProto::StreamIdList streamIdList;
|
||||||
|
|
||||||
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
|
mainWindow->setDisabled(true);
|
||||||
|
|
||||||
qDebug("applying 'deleted streams' ...");
|
qDebug("applying 'deleted streams' ...");
|
||||||
|
|
||||||
streamIdList.mutable_port_id()->set_id(mPorts[portIndex]->id());
|
streamIdList.mutable_port_id()->set_id(mPorts[portIndex]->id());
|
||||||
@ -177,6 +184,10 @@ void PortGroup::when_configApply(int portIndex, uint *cookie)
|
|||||||
qDebug("apply completed");
|
qDebug("apply completed");
|
||||||
mPorts[portIndex]->when_syncComplete();
|
mPorts[portIndex]->when_syncComplete();
|
||||||
delete cookie;
|
delete cookie;
|
||||||
|
|
||||||
|
mainWindow->setEnabled(true);
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -431,7 +442,7 @@ _exit:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortGroup::processModifyStreamAck(OstProto::Ack */*ack*/)
|
void PortGroup::processModifyStreamAck(OstProto::Ack * /*ack*/)
|
||||||
{
|
{
|
||||||
qDebug("In %s", __FUNCTION__);
|
qDebug("In %s", __FUNCTION__);
|
||||||
|
|
||||||
|
@ -113,11 +113,6 @@ ProtocolListIterator* StreamBase::createProtocolListIterator() const
|
|||||||
return new ProtocolListIterator(*currentFrameProtocols);
|
return new ProtocolListIterator(*currentFrameProtocols);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StreamBase::operator < (const StreamBase &s) const
|
|
||||||
{
|
|
||||||
return(mCore->ordinal() < s.mCore->ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 StreamBase::id()
|
quint32 StreamBase::id()
|
||||||
{
|
{
|
||||||
return mStreamId->id();
|
return mStreamId->id();
|
||||||
@ -380,3 +375,7 @@ int StreamBase::frameValue(uchar *buf, int bufMaxSize, int n) const
|
|||||||
return pktLen;
|
return pktLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StreamBase::StreamLessThan(StreamBase* stream1, StreamBase* stream2)
|
||||||
|
{
|
||||||
|
return stream1->ordinal() < stream2->ordinal() ? true : false;
|
||||||
|
}
|
||||||
|
@ -54,8 +54,6 @@ public:
|
|||||||
e_nw_goto_id
|
e_nw_goto_id
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator < (const StreamBase &s) const;
|
|
||||||
|
|
||||||
quint32 id();
|
quint32 id();
|
||||||
bool setId(quint32 id);
|
bool setId(quint32 id);
|
||||||
|
|
||||||
@ -114,6 +112,8 @@ public:
|
|||||||
|
|
||||||
bool isFrameVariable() const;
|
bool isFrameVariable() const;
|
||||||
int frameValue(uchar *buf, int bufMaxSize, int n) const;
|
int frameValue(uchar *buf, int bufMaxSize, int n) const;
|
||||||
|
|
||||||
|
static bool StreamLessThan(StreamBase* stream1, StreamBase* stream2);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -203,6 +203,7 @@ QVariant UdpProtocol::fieldData(int index, FieldAttrib attrib,
|
|||||||
else
|
else
|
||||||
cksum = protocolFrameCksum(streamIndex, CksumTcpUdp);
|
cksum = protocolFrameCksum(streamIndex, CksumTcpUdp);
|
||||||
qDebug("UDP cksum = %hu", cksum);
|
qDebug("UDP cksum = %hu", cksum);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
cksum = 0;
|
cksum = 0;
|
||||||
|
@ -31,6 +31,12 @@ AbstractPort::~AbstractPort()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StreamBase* AbstractPort::streamAtIndex(int index)
|
||||||
|
{
|
||||||
|
Q_ASSERT(index < streamList_.size());
|
||||||
|
return streamList_.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
StreamBase* AbstractPort::stream(int streamId)
|
StreamBase* AbstractPort::stream(int streamId)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < streamList_.size(); i++)
|
for (int i = 0; i < streamList_.size(); i++)
|
||||||
@ -79,7 +85,7 @@ void AbstractPort::updatePacketList()
|
|||||||
qDebug("In %s", __FUNCTION__);
|
qDebug("In %s", __FUNCTION__);
|
||||||
|
|
||||||
// First sort the streams by ordinalValue
|
// First sort the streams by ordinalValue
|
||||||
qSort(streamList_);
|
qSort(streamList_.begin(), streamList_.end(), StreamBase::StreamLessThan);
|
||||||
|
|
||||||
clearPacketList();
|
clearPacketList();
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
void protoDataCopyInto(OstProto::Port *port) { port->CopyFrom(data_); }
|
void protoDataCopyInto(OstProto::Port *port) { port->CopyFrom(data_); }
|
||||||
|
|
||||||
int streamCount() { return streamList_.size(); }
|
int streamCount() { return streamList_.size(); }
|
||||||
|
StreamBase* streamAtIndex(int index);
|
||||||
StreamBase* stream(int streamId);
|
StreamBase* stream(int streamId);
|
||||||
bool addStream(StreamBase *stream);
|
bool addStream(StreamBase *stream);
|
||||||
bool deleteStream(int streamId);
|
bool deleteStream(int streamId);
|
||||||
|
@ -88,7 +88,7 @@ void MyService::getStreamIdList(::google::protobuf::RpcController* controller,
|
|||||||
OstProto::StreamId *s;
|
OstProto::StreamId *s;
|
||||||
|
|
||||||
s = response->add_stream_id();
|
s = response->add_stream_id();
|
||||||
s->set_id(portInfo[portId]->stream(i)->id());
|
s->set_id(portInfo[portId]->streamAtIndex(i)->id());
|
||||||
}
|
}
|
||||||
done->Run();
|
done->Run();
|
||||||
return;
|
return;
|
||||||
@ -224,6 +224,9 @@ void MyService::modifyStream(::google::protobuf::RpcController* controller,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (portInfo[portId]->isDirty())
|
||||||
|
portInfo[portId]->updatePacketList();
|
||||||
|
|
||||||
//! \todo(LOW): fill-in response "Ack"????
|
//! \todo(LOW): fill-in response "Ack"????
|
||||||
|
|
||||||
done->Run();
|
done->Run();
|
||||||
|
@ -29,8 +29,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void startTransmit() {
|
virtual void startTransmit() {
|
||||||
if (isDirty())
|
Q_ASSERT(!isDirty());
|
||||||
updatePacketList();
|
|
||||||
transmitter_->start();
|
transmitter_->start();
|
||||||
}
|
}
|
||||||
virtual void stopTransmit() { transmitter_->stop(); }
|
virtual void stopTransmit() { transmitter_->stop(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user