preparations for requesting "connected clients list" on a new connection
This commit is contained in:
parent
7f4bea94eb
commit
5bdf759e01
5 changed files with 78 additions and 16 deletions
|
@ -54,6 +54,18 @@ CChannelSet::CChannelSet()
|
|||
QObject::connect(&vecChannels[7],SIGNAL(NewConnection()),this,SLOT(OnNewConnectionCh7()));
|
||||
QObject::connect(&vecChannels[8],SIGNAL(NewConnection()),this,SLOT(OnNewConnectionCh8()));
|
||||
QObject::connect(&vecChannels[9],SIGNAL(NewConnection()),this,SLOT(OnNewConnectionCh9()));
|
||||
|
||||
// request connected clients list
|
||||
QObject::connect(&vecChannels[0],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh0()));
|
||||
QObject::connect(&vecChannels[1],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh1()));
|
||||
QObject::connect(&vecChannels[2],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh2()));
|
||||
QObject::connect(&vecChannels[3],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh3()));
|
||||
QObject::connect(&vecChannels[4],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh4()));
|
||||
QObject::connect(&vecChannels[5],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh5()));
|
||||
QObject::connect(&vecChannels[6],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh6()));
|
||||
QObject::connect(&vecChannels[7],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh7()));
|
||||
QObject::connect(&vecChannels[8],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh8()));
|
||||
QObject::connect(&vecChannels[9],SIGNAL(ReqConnClientsList()),this,SLOT(OnNewConnectionCh9()));
|
||||
}
|
||||
|
||||
void CChannelSet::CreateAndSendChanListForAllConClients()
|
||||
|
@ -204,7 +216,18 @@ bool CChannelSet::PutData ( const CVector<unsigned char>& vecbyRecBuf,
|
|||
// requested
|
||||
if ( bCreateChanList )
|
||||
{
|
||||
CreateAndSendChanListForAllConClients();
|
||||
|
||||
|
||||
|
||||
// TODO list is only send for new connected clients after request, only
|
||||
// the already connected clients get the list automatically, because they
|
||||
// don't know when new clients connect!
|
||||
|
||||
// TODO use "void OnReqConnClientsListChx() {}" for sending list to specific client
|
||||
|
||||
CreateAndSendChanListForAllConClients(); // <- replace this
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Mutex.unlock();
|
||||
|
@ -348,6 +371,10 @@ CChannel::CChannel() : sName ( "" ),
|
|||
SIGNAL ( ReqJittBufSize() ),
|
||||
SIGNAL ( ReqJittBufSize() ) );
|
||||
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( ReqConnClientsList() ),
|
||||
SIGNAL ( ReqConnClientsList() ) );
|
||||
|
||||
QObject::connect ( &Protocol,
|
||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ),
|
||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
|
||||
|
|
|
@ -103,6 +103,7 @@ public:
|
|||
}
|
||||
}
|
||||
void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); }
|
||||
void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); }
|
||||
|
||||
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact )
|
||||
{
|
||||
|
@ -171,6 +172,7 @@ signals:
|
|||
void MessReadyForSending ( CVector<uint8_t> vecMessage );
|
||||
void NewConnection();
|
||||
void ReqJittBufSize();
|
||||
void ReqConnClientsList();
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
void ProtocolStatus ( bool bOk );
|
||||
};
|
||||
|
@ -245,6 +247,18 @@ public slots:
|
|||
void OnNewConnectionCh8() {vecChannels[8].CreateReqJitBufMes();}
|
||||
void OnNewConnectionCh9() {vecChannels[9].CreateReqJitBufMes();}
|
||||
|
||||
// TODO
|
||||
void OnReqConnClientsListCh0() {}
|
||||
void OnReqConnClientsListCh1() {}
|
||||
void OnReqConnClientsListCh2() {}
|
||||
void OnReqConnClientsListCh3() {}
|
||||
void OnReqConnClientsListCh4() {}
|
||||
void OnReqConnClientsListCh5() {}
|
||||
void OnReqConnClientsListCh6() {}
|
||||
void OnReqConnClientsListCh7() {}
|
||||
void OnReqConnClientsListCh8() {}
|
||||
void OnReqConnClientsListCh9() {}
|
||||
|
||||
signals:
|
||||
void MessReadyForSending ( int iChID, CVector<uint8_t> vecMessage );
|
||||
};
|
||||
|
|
|
@ -168,6 +168,7 @@ public slots:
|
|||
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
|
||||
void OnReqJittBufSize();
|
||||
void OnProtocolStatus ( bool bOk );
|
||||
void OnNewConnection() { Channel.CreateReqConnClientsList(); }
|
||||
|
||||
signals:
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
|
|
|
@ -77,6 +77,11 @@ 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
|
||||
|
||||
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
|
@ -530,6 +535,17 @@ void CProtocol:: EvaluateConClientListMes ( unsigned int iPos, const CVector<uin
|
|||
emit ConClientListMesReceived ( vecChanInfo );
|
||||
}
|
||||
|
||||
void CProtocol::CreateReqConnClientsList()
|
||||
{
|
||||
CreateAndSendMessage ( PROTMESSID_REQ_CONN_CLIENTS_LIST, CVector<uint8_t> ( 0 ) );
|
||||
}
|
||||
|
||||
void CProtocol::EvaluateReqConnClientsList ( unsigned int iPos, const CVector<uint8_t>& vecData )
|
||||
{
|
||||
// invoke message action
|
||||
emit ReqConnClientsList();
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************\
|
||||
* Message generation (parsing) *
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
#define PROTMESSID_NET_BLSI_FACTOR 13 // network buffer size factor
|
||||
#define PROTMESSID_CHANNEL_GAIN 14 // set channel gain for mix
|
||||
#define PROTMESSID_CONN_CLIENTS_LIST 15 // connected client list
|
||||
#define PROTMESSID_SERVER_FULL 16
|
||||
#define PROTMESSID_SERVER_FULL 16 // server full message
|
||||
#define PROTMESSID_REQ_CONN_CLIENTS_LIST 17 // request connected client list
|
||||
|
||||
// lengths of message as defined in protocol.cpp file
|
||||
#define MESS_HEADER_LENGTH_BYTE 5 /* ID, cnt, length */
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
|
||||
void CreateJitBufMes ( const int iJitBufSize );
|
||||
void CreateReqJitBufMes();
|
||||
void CreateReqConnClientsList();
|
||||
void CreateServerFullMes();
|
||||
void CreateNetwBlSiFactMes ( const int iNetwBlSiFact );
|
||||
void CreateChanGainMes ( const int iChanID, const double dGain );
|
||||
|
@ -129,6 +131,7 @@ protected:
|
|||
|
||||
void EvaluateJitBufMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateReqJitBufMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateReqConnClientsList ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateServerFullMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateNetwBlSiFactMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
void EvaluateChanGainMes ( unsigned int iPos, const CVector<uint8_t>& vecData );
|
||||
|
@ -156,6 +159,7 @@ signals:
|
|||
void ChangeChanGain ( int iChanID, double dNewGain );
|
||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||
void ReqJittBufSize();
|
||||
void ReqConnClientsList();
|
||||
void ServerFull();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue