added disconnect message, some GUI changes

This commit is contained in:
Volker Fischer 2009-05-09 08:22:09 +00:00
parent 19b9918a26
commit 0b3e8c76a2
7 changed files with 95 additions and 59 deletions

View File

@ -62,8 +62,8 @@ CChannelFader::CChannelFader ( QWidget* pNW,
// add user controls to grid
pMainGrid->addWidget( pFader, 0, Qt::AlignHCenter );
pMainGrid->addWidget( pcbMute, 0, Qt::AlignHCenter );
pMainGrid->addWidget( pcbSolo, 0, Qt::AlignHCenter );
pMainGrid->addWidget( pcbMute, 0, Qt::AlignLeft );
pMainGrid->addWidget( pcbSolo, 0, Qt::AlignLeft );
pMainGrid->addWidget( pLabel, 0, Qt::AlignHCenter );
// add fader layout to audio mixer board layout

View File

@ -32,7 +32,8 @@ CChannelSet::CChannelSet ( const int iNewUploadRateLimitKbps ) :
bWriteStatusHTMLFile ( false ),
iUploadRateLimitKbps ( iNewUploadRateLimitKbps )
{
// enable all channels
// enable all channels (for the server all channel must be enabled the
// entire life time of the software
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{
vecChannels[i].SetEnable ( true );
@ -782,6 +783,9 @@ CChannel::CChannel ( const bool bNIsServer ) :
QObject::connect ( &Protocol,
SIGNAL ( ReqNetTranspProps() ),
this, SLOT ( OnReqNetTranspProps() ) );
QObject::connect ( &Protocol, SIGNAL ( Disconnection() ),
this, SLOT ( OnDisconnection() ) );
}
bool CChannel::ProtocolIsEnabled()
@ -1029,6 +1033,14 @@ void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
Protocol.CreateNetwTranspPropsMes ( NetworkTransportProps );
}
void CChannel::OnDisconnection()
{
// set time out counter to a small value > 0 so that the next time a
// received audio block is queried, the disconnection is performed
// (assuming that no audio packet is received in the meantime)
iConTimeOut = 1; // a small number > 0
}
EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
int iNumBytes )
{

View File

@ -150,6 +150,7 @@ public:
}
void CreateNetTranspPropsMessFromCurrentSettings();
void CreateDisconnectionMes() { Protocol.CreateDisconnectionMes(); }
protected:
void SetAudioBlockSizeAndComprIn ( const int iNewBlockSize,
@ -212,6 +213,7 @@ public slots:
void OnChangeChanName ( QString strName );
void OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void OnReqNetTranspProps();
void OnDisconnection();
signals:
void MessReadyForSending ( CVector<uint8_t> vecMessage );

View File

@ -238,6 +238,9 @@ void CClient::Stop()
// stop audio interface
Sound.Stop();
// send disconnect message to server
Channel.CreateDisconnectionMes();
// disable channel
Channel.SetEnable ( false );

View File

@ -350,21 +350,34 @@
<string>Reverb</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<widget class="QLabel" name="TextLabelReverbSelection" >
<property name="text" >
<string>Channel
Selection</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RadioButtonRevSelL" >
<property name="text" >
<string>Left</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RadioButtonRevSelR" >
<property name="text" >
<string>Right</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="spacing" >
@ -461,33 +474,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="TextLabelReverbSelection" >
<property name="text" >
<string>Channel</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RadioButtonRevSelL" >
<property name="text" >
<string>Left</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="RadioButtonRevSelR" >
<property name="text" >
<string>Right</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -499,6 +485,21 @@
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="TextAudInFader" >
<property name="text" >
<string>Local
Audio
Fader</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelAudFader" >
<property name="minimumSize" >
@ -582,20 +583,6 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="TextAudInFader" >
<property name="text" >
<string>Audio
Fader</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -46,10 +46,12 @@ MESSAGES
| 2 bytes number of blocks |
+--------------------------+
- Request jitter buffer size: PROTMESSID_REQ_JITT_BUF_SIZE
note: does not have any data -> n = 0
- Server full message: PROTMESSID_SERVER_FULL
note: does not have any data -> n = 0
@ -63,6 +65,7 @@ MESSAGES
| 2 bytes factor |
+----------------+
- Gain of channel: PROTMESSID_CHANNEL_GAIN
+-------------------+--------------+
@ -78,6 +81,7 @@ MESSAGES
| 1 byte channel ID | 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string |
+-------------------+--------------------+------------------+----------------------+
- Request connected clients list: PROTMESSID_REQ_CONN_CLIENTS_LIST
note: does not have any data -> n = 0
@ -98,12 +102,14 @@ MESSAGES
| 2 bytes number n | n bytes UTF-8 string |
+------------------+----------------------+
- Ping message (for measuring the ping time): PROTMESSID_PING_MS
+-----------------------------+
| 4 bytes transmit time in ms |
+-----------------------------+
- Properties for network transport: PROTMESSID_NETW_TRANSPORT_PROPS
+-------------------+------------------+-----------------+------------------+-----------------------+----------------------+
@ -120,11 +126,17 @@ MESSAGES
- 2: MS-ADPCM
- "audiocod arg": argument for the audio coder, if not used this value shall be set to 0
- Request properties for network transport: PROTMESSID_REQ_NETW_TRANSPORT_PROPS
note: does not have any data -> n = 0
- Disconnect message: PROTMESSID_DISCONNECTION
note: does not have any data -> n = 0
******************************************************************************
*
* This program is free software; you can redistribute it and/or modify it under
@ -383,6 +395,10 @@ bool CProtocol::ParseMessage ( const CVector<uint8_t>& vecbyData,
case PROTMESSID_REQ_NETW_TRANSPORT_PROPS:
bRet = EvaluateReqNetwTranspPropsMes ( vecData );
break;
case PROTMESSID_DISCONNECTION:
bRet = EvaluateDisconnectionMes ( vecData );
break;
}
// send acknowledge message
@ -899,6 +915,18 @@ bool CProtocol::EvaluateReqNetwTranspPropsMes ( const CVector<uint8_t>& vecData
return false; // no error
}
void CProtocol::CreateDisconnectionMes()
{
CreateAndSendMessage ( PROTMESSID_DISCONNECTION, CVector<uint8_t> ( 0 ) );
}
bool CProtocol::EvaluateDisconnectionMes ( const CVector<uint8_t>& vecData )
{
// invoke message action
emit Disconnection();
return false; // no error
}
/******************************************************************************\

View File

@ -51,6 +51,7 @@
#define PROTMESSID_PING_MS 20 // for measuring ping time
#define PROTMESSID_NETW_TRANSPORT_PROPS 21 // properties for network transport
#define PROTMESSID_REQ_NETW_TRANSPORT_PROPS 22 // request properties for network transport
#define PROTMESSID_DISCONNECTION 23 // disconnection
// lengths of message as defined in protocol.cpp file
#define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2)
@ -82,6 +83,7 @@ public:
void CreatePingMes ( const int iMs );
void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps );
void CreateReqNetwTranspPropsMes();
void CreateDisconnectionMes();
void CreateAndSendAcknMess ( const int& iID, const int& iCnt );
@ -152,6 +154,7 @@ protected:
bool EvaluatePingMes ( const CVector<uint8_t>& vecData );
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
bool EvaluateDisconnectionMes ( const CVector<uint8_t>& vecData );
int iOldRecID, iOldRecCnt;
@ -182,6 +185,7 @@ signals:
void PingReceived ( int iMs );
void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void ReqNetTranspProps();
void Disconnection();
};
#endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */