Description
What is the current behaviour and why should it be changed?
The current getClients RPC method does not return skill level, country, city, or instrument for connected clients. In order to close the gap between desired functionality in (now closed) PR #2006, getClients can be extended to provide these additional properties.
Describe possible approaches
@dtinth had as specific goal of not touching server.cpp when initially authoring JSON-RPC. This limited the information available to the RPC interface. The most direct solution I see now is to modify GetConCliParam() to add an additional vector that can be populated with Channel Information (core). GetConCliParam() is already used by JSON-RPC within the getClients method.
void CServer::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<QString>& vecsName,
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact,
CVector<CChannelCoreInfo>& vecChanInfo )
Changing this method impacts server.cpp/h and serverdlg.cpp only. While serverdlg would not make use of this additional information, having connection attributes such as country, city, instrument, and skill would allow the serverdlg to make use of this information in the future within the UI's "connections" widget.
The modified GetConCliParam method proposed is:
void CServer::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<QString>& vecsName,
CVector<int>& veciJitBufNumFrames,
CVector<int>& veciNetwFrameSizeFact,
CVector<CChannelCoreInfo>& vecChanInfo )
{
// init return values
vecHostAddresses.Init ( iMaxNumChannels );
vecsName.Init ( iMaxNumChannels );
veciJitBufNumFrames.Init ( iMaxNumChannels );
veciNetwFrameSizeFact.Init ( iMaxNumChannels );
vecChanInfo.Init ( iMaxNumChannels );
// check all possible channels
for ( int i = 0; i < iMaxNumChannels; i++ )
{
if ( vecChannels[i].IsConnected() )
{
// get requested data
vecHostAddresses[i] = vecChannels[i].GetAddress();
vecsName[i] = vecChannels[i].GetName();
veciJitBufNumFrames[i] = vecChannels[i].GetSockBufNumFrames();
veciNetwFrameSizeFact[i] = vecChannels[i].GetNetwFrameSizeFact();
vecChanInfo[i] = vecChannels[i].GetChanInfo();
}
}
}
The new channel attributes would then be added to the getClients JSON-RPC method:
<SNIP>
CVector<int> veciNetwFrameSizeFact;
CVector<CChannelCoreInfo> vecChanInfo;
pServer->GetConCliParam ( vecHostAddresses, vecsName, veciJitBufNumFrames, veciNetwFrameSizeFact, vecChanInfo );
// we assume that all vectors have the same length
const int iNumChannels = vecHostAddresses.Size();
// fill list with connected clients
for ( int i = 0; i < iNumChannels; i++ )
{
if ( vecHostAddresses[i].InetAddr == QHostAddress ( static_cast<quint32> ( 0 ) ) )
{
continue;
}
QJsonObject client{
{ "id", i },
{ "address", vecHostAddresses[i].toString ( CHostAddress::SM_IP_PORT ) },
{ "name", vecsName[i] },
{ "jitterBufferSize", veciJitBufNumFrames[i] },
{ "channels", pServer->GetClientNumAudioChannels ( i ) },
{ "instrument", vecChanInfo[i].iInstrument },
{ "city", vecChanInfo[i].strCity },
{ "skillLevel", vecChanInfo[i].eSkillLevel },
{ "countryCode", vecChanInfo[i].eCountry },
};
clients.append ( client );
}
<SNIP>
The proposal here returns the enumerated values of some attributes to be consistent with the current approach. Issue #2468 proposes to change this. The solution proposed here could be refactored if that issue moves forward.
Has this feature been discussed and generally agreed?
No
Metadata
Metadata
Assignees
Type
Projects
Status