add name for server in HTML status file

This commit is contained in:
Volker Fischer 2008-08-09 07:55:27 +00:00
parent 9d3793d0d8
commit 74d838999d
3 changed files with 25 additions and 5 deletions

View File

@ -49,6 +49,7 @@ int main ( int argc, char** argv )
quint16 iPortNumber = LLCON_PORT_NUMBER; quint16 iPortNumber = LLCON_PORT_NUMBER;
std::string strIniFileName = ""; std::string strIniFileName = "";
std::string strHTMLStatusFileName = ""; std::string strHTMLStatusFileName = "";
std::string strServerName = "";
/* QT docu: argv()[0] is the program name, argv()[1] is the first /* QT docu: argv()[0] is the program name, argv()[1] is the first
argument and argv()[argc()-1] is the last argument. argument and argv()[argc()-1] is the last argument.
@ -96,6 +97,13 @@ int main ( int argc, char** argv )
continue; continue;
} }
if ( GetStringArgument ( argc, argv, i, "-a", "--servername", strArgument ) )
{
strServerName = strArgument;
cerr << "server name for HTML status file: " << strServerName << std::endl;
continue;
}
/* Initialization file ---------------------------------------------------- */ /* Initialization file ---------------------------------------------------- */
if ( GetStringArgument ( argc, argv, i, "-i", "--inifile", strArgument ) ) if ( GetStringArgument ( argc, argv, i, "-i", "--inifile", strArgument ) )
{ {
@ -168,7 +176,9 @@ int main ( int argc, char** argv )
// TODO use QString // TODO use QString
CServer Server ( bUseServerLogging, iPortNumber, strHTMLStatusFileName.c_str() ); CServer Server ( bUseServerLogging, iPortNumber,
strHTMLStatusFileName.c_str(),
strServerName.c_str() );
if ( bUseGUI ) if ( bUseGUI )
{ {

View File

@ -27,7 +27,8 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CServer::CServer ( const bool bUseLogging, const quint16 iPortNumber, CServer::CServer ( const bool bUseLogging, const quint16 iPortNumber,
const QString& strHTMLStatusFileName ) : const QString& strHTMLStatusFileName,
const QString& strServerNameForHTMLStatusFile ) :
Socket ( &ChannelSet, this, iPortNumber ) Socket ( &ChannelSet, this, iPortNumber )
{ {
vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES ); vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES );
@ -59,11 +60,19 @@ CServer::CServer ( const bool bUseLogging, const quint16 iPortNumber,
// HTML status file writing // HTML status file writing
if ( !strHTMLStatusFileName.isEmpty() ) if ( !strHTMLStatusFileName.isEmpty() )
{ {
// TEST only use port number as the server name right now QString strCurServerNameForHTMLStatusFile = strServerNameForHTMLStatusFile;
// if server name is empty, substitude a default name
if ( strCurServerNameForHTMLStatusFile.isEmpty() )
{
strCurServerNameForHTMLStatusFile = "[server address]";
}
// (the static cast to integer of the port number is required so that it // (the static cast to integer of the port number is required so that it
// works correctly under Linux) // works correctly under Linux)
ChannelSet.StartStatusHTMLFileWriting ( strHTMLStatusFileName, ChannelSet.StartStatusHTMLFileWriting ( strHTMLStatusFileName,
"[server address]:" + QString().number( static_cast<int> ( iPortNumber ) ) ); strCurServerNameForHTMLStatusFile + ":" +
QString().number( static_cast<int> ( iPortNumber ) ) );
} }
} }

View File

@ -42,7 +42,8 @@ class CServer : public QObject
public: public:
CServer ( const bool bUseLogging, const quint16 iPortNumber, CServer ( const bool bUseLogging, const quint16 iPortNumber,
const QString& strHTMLStatusFileName ); const QString& strHTMLStatusFileName,
const QString& strServerNameForHTMLStatusFile );
virtual ~CServer() {} virtual ~CServer() {}
void Start(); void Start();