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 // add user controls to grid
pMainGrid->addWidget( pFader, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pFader, 0, Qt::AlignHCenter );
pMainGrid->addWidget( pcbMute, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pcbMute, 0, Qt::AlignLeft );
pMainGrid->addWidget( pcbSolo, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pcbSolo, 0, Qt::AlignLeft );
pMainGrid->addWidget( pLabel, 0, Qt::AlignHCenter ); pMainGrid->addWidget( pLabel, 0, Qt::AlignHCenter );
// add fader layout to audio mixer board layout // add fader layout to audio mixer board layout

View file

@ -32,7 +32,8 @@ CChannelSet::CChannelSet ( const int iNewUploadRateLimitKbps ) :
bWriteStatusHTMLFile ( false ), bWriteStatusHTMLFile ( false ),
iUploadRateLimitKbps ( iNewUploadRateLimitKbps ) 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++ ) for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
{ {
vecChannels[i].SetEnable ( true ); vecChannels[i].SetEnable ( true );
@ -782,6 +783,9 @@ CChannel::CChannel ( const bool bNIsServer ) :
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( ReqNetTranspProps() ), SIGNAL ( ReqNetTranspProps() ),
this, SLOT ( OnReqNetTranspProps() ) ); this, SLOT ( OnReqNetTranspProps() ) );
QObject::connect ( &Protocol, SIGNAL ( Disconnection() ),
this, SLOT ( OnDisconnection() ) );
} }
bool CChannel::ProtocolIsEnabled() bool CChannel::ProtocolIsEnabled()
@ -1029,6 +1033,14 @@ void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
Protocol.CreateNetwTranspPropsMes ( NetworkTransportProps ); 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, EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
int iNumBytes ) int iNumBytes )
{ {

View file

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

View file

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

View file

@ -350,21 +350,34 @@
<string>Reverb</string> <string>Reverb</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="spacing" > <item>
<number>6</number> <widget class="QLabel" name="TextLabelReverbSelection" >
</property> <property name="text" >
<property name="leftMargin" > <string>Channel
<number>9</number> Selection</string>
</property> </property>
<property name="topMargin" > <property name="alignment" >
<number>9</number> <set>Qt::AlignCenter</set>
</property> </property>
<property name="rightMargin" > <property name="wordWrap" >
<number>9</number> <bool>false</bool>
</property> </property>
<property name="bottomMargin" > </widget>
<number>9</number> </item>
</property> <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> <item>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="spacing" > <property name="spacing" >
@ -461,33 +474,6 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </item>
@ -499,6 +485,21 @@
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<item> <item>
<layout class="QVBoxLayout" > <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> <item>
<widget class="QLabel" name="TextLabelAudFader" > <widget class="QLabel" name="TextLabelAudFader" >
<property name="minimumSize" > <property name="minimumSize" >
@ -582,20 +583,6 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</item> </item>
<item> <item>

View file

@ -46,10 +46,12 @@ MESSAGES
| 2 bytes number of blocks | | 2 bytes number of blocks |
+--------------------------+ +--------------------------+
- Request jitter buffer size: PROTMESSID_REQ_JITT_BUF_SIZE - Request jitter buffer size: PROTMESSID_REQ_JITT_BUF_SIZE
note: does not have any data -> n = 0 note: does not have any data -> n = 0
- Server full message: PROTMESSID_SERVER_FULL - Server full message: PROTMESSID_SERVER_FULL
note: does not have any data -> n = 0 note: does not have any data -> n = 0
@ -63,6 +65,7 @@ MESSAGES
| 2 bytes factor | | 2 bytes factor |
+----------------+ +----------------+
- Gain of channel: PROTMESSID_CHANNEL_GAIN - 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 | | 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 - Request connected clients list: PROTMESSID_REQ_CONN_CLIENTS_LIST
note: does not have any data -> n = 0 note: does not have any data -> n = 0
@ -98,12 +102,14 @@ MESSAGES
| 2 bytes number n | n bytes UTF-8 string | | 2 bytes number n | n bytes UTF-8 string |
+------------------+----------------------+ +------------------+----------------------+
- Ping message (for measuring the ping time): PROTMESSID_PING_MS - Ping message (for measuring the ping time): PROTMESSID_PING_MS
+-----------------------------+ +-----------------------------+
| 4 bytes transmit time in ms | | 4 bytes transmit time in ms |
+-----------------------------+ +-----------------------------+
- Properties for network transport: PROTMESSID_NETW_TRANSPORT_PROPS - Properties for network transport: PROTMESSID_NETW_TRANSPORT_PROPS
+-------------------+------------------+-----------------+------------------+-----------------------+----------------------+ +-------------------+------------------+-----------------+------------------+-----------------------+----------------------+
@ -120,11 +126,17 @@ MESSAGES
- 2: MS-ADPCM - 2: MS-ADPCM
- "audiocod arg": argument for the audio coder, if not used this value shall be set to 0 - "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 - Request properties for network transport: PROTMESSID_REQ_NETW_TRANSPORT_PROPS
note: does not have any data -> n = 0 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 * 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: case PROTMESSID_REQ_NETW_TRANSPORT_PROPS:
bRet = EvaluateReqNetwTranspPropsMes ( vecData ); bRet = EvaluateReqNetwTranspPropsMes ( vecData );
break; break;
case PROTMESSID_DISCONNECTION:
bRet = EvaluateDisconnectionMes ( vecData );
break;
} }
// send acknowledge message // send acknowledge message
@ -899,6 +915,18 @@ bool CProtocol::EvaluateReqNetwTranspPropsMes ( const CVector<uint8_t>& vecData
return false; // no error 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_PING_MS 20 // for measuring ping time
#define PROTMESSID_NETW_TRANSPORT_PROPS 21 // properties for network transport #define PROTMESSID_NETW_TRANSPORT_PROPS 21 // properties for network transport
#define PROTMESSID_REQ_NETW_TRANSPORT_PROPS 22 // request 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 // lengths of message as defined in protocol.cpp file
#define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2) #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 CreatePingMes ( const int iMs );
void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps ); void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps );
void CreateReqNetwTranspPropsMes(); void CreateReqNetwTranspPropsMes();
void CreateDisconnectionMes();
void CreateAndSendAcknMess ( const int& iID, const int& iCnt ); void CreateAndSendAcknMess ( const int& iID, const int& iCnt );
@ -152,6 +154,7 @@ protected:
bool EvaluatePingMes ( const CVector<uint8_t>& vecData ); bool EvaluatePingMes ( const CVector<uint8_t>& vecData );
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData ); bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
bool EvaluateReqNetwTranspPropsMes ( const CVector<uint8_t>& vecData ); bool EvaluateReqNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
bool EvaluateDisconnectionMes ( const CVector<uint8_t>& vecData );
int iOldRecID, iOldRecCnt; int iOldRecID, iOldRecCnt;
@ -182,6 +185,7 @@ signals:
void PingReceived ( int iMs ); void PingReceived ( int iMs );
void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps ); void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
void ReqNetTranspProps(); void ReqNetTranspProps();
void Disconnection();
}; };
#endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */ #endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */