Commit 342d70f2 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding API adaption for core and hardware getter and file list getter

parent 92f656f4
......@@ -144,6 +144,27 @@ public:
return m_pProtocol->ClientFindFilePath( sFilePath );
};
inline CVAStruct GetCoreConfiguration( const bool bFilterEnabled = true ) const
{
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetCoreConfiguration( bFilterEnabled );
};
inline CVAStruct GetHardwareConfiguration( const bool bFilterEnabled = true ) const
{
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetHardwareConfiguration( bFilterEnabled );
};
inline CVAStruct GetFileList( const bool bRecursive = true, const std::string& sFileSuffixMask = "*" ) const
{
VA_REQUIRE_CONNECTED;
VA_MUTAL_EXCLUDE;
return m_pProtocol->ClientGetFileList( bRecursive, sFileSuffixMask );
};
inline void GetModules( std::vector< CVAModuleInfo >& viModuleInfos ) const
{
VA_REQUIRE_CONNECTED;
......@@ -1510,8 +1531,8 @@ public:
oChannelLock.Unlock();
IndicateLoopEnd();
m_pParent->ProcessEventChannelError();
}
}
}
#ifdef VANET_CLIENT_VERBOSE
catch( VistaExceptionBase& oException )
{
......@@ -1660,13 +1681,13 @@ int CVANetClientImpl::Initialize( const std::string& sServerAddress, const int i
// server responded, but establishing the connection sockets failed
Cleanup();
return VA_CONNECTION_ERROR;
}
}
else if( iCommandChannelPort == -2 )
{
// server responded, but it doesn't accept any more connections
Cleanup();
return VA_SERVICE_IN_USE;
}
}
m_pCommandChannel = new VistaConnectionIP( VistaConnectionIP::CT_TCP, m_sServerIP, iCommandChannelPort );
#ifdef VANET_CLIENT_SHOW_RAW_TRAFFIC
m_pCommandChannel->SetShowRawSendAndReceive( true );
......@@ -1771,7 +1792,7 @@ int CVANetClientImpl::Initialize( const std::string& sServerAddress, const int i
m_pProtocol->InitializeAsClient( this, m_pCommandChannel, m_pHeadChannel,
IExceptionHandlingMode, bBufferSynchronizedCommands );
return VA_NO_ERROR;
}
}
int CVANetClientImpl::Disconnect()
{
......@@ -1900,7 +1921,7 @@ void CVANetClientImpl::ProcessEventChannelError()
catch( VistaExceptionBase& )
{
// its okay for this call to fail - the connection may already be closed
}
}
m_bShutdownFlag = true;
}
......@@ -1944,7 +1965,7 @@ void CVANetClientImpl::ProcessNetEvent( const int iEventID )
}
}
}
}
void CVANetClientImpl::EmitEvent( const IVANetClient::CEvent& oEvent )
{
......
......@@ -122,6 +122,9 @@ void CVANetNetworkProtocol::ServerCallFunctionByMessageType( const int nMessageT
SERVER_FUNCTION_MAPPING( VA_NP_CALL_MODULE, ServerCallModule() );
SERVER_FUNCTION_MAPPING( VA_NP_GET_SEARCH_PATHS, ServerGetSearchPaths() );
SERVER_FUNCTION_MAPPING( VA_NP_FIND_FILE_PATH, ServerFindFilePath() );
SERVER_FUNCTION_MAPPING( VA_NP_GET_CORE_CONFIGURATION, ServerGetCoreConfiguration() );
SERVER_FUNCTION_MAPPING( VA_NP_GET_HARDWARE_CONFIGURATION, ServerGetHardwareConfiguration() );
SERVER_FUNCTION_MAPPING( VA_NP_GET_FILE_LIST, ServerGetFileList() );
// Event handling
SERVER_FUNCTION_MAPPING( VA_NP_ATTACH_EVENT_HANDLER, ServerAttachEventHandler( pConnection ) );
......@@ -768,6 +771,61 @@ void CVANetNetworkProtocol::ServerFindFilePath()
pMsg->WriteString( sFoundFilePath );
}
CVAStruct CVANetNetworkProtocol::ClientGetCoreConfiguration( const bool bFilterEnabled )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_CORE_CONFIGURATION, MESSAGE_WITH_ANSWER );
pMsg->WriteBool( bFilterEnabled );
ClientSendCommand( pMsg );
CVAStruct oCoreConfig;
pMsg->ReadVAStruct( oCoreConfig );
return oCoreConfig;
}
void CVANetNetworkProtocol::ServerGetCoreConfiguration()
{
CVANetMessage* pMsg = ServerGetMessage();
const bool bFilterEnabled = pMsg->ReadBool();
const CVAStruct oCoreConfig = m_pRealCore->GetCoreConfiguration( bFilterEnabled );
pMsg->WriteVAStruct( oCoreConfig );
}
CVAStruct CVANetNetworkProtocol::ClientGetHardwareConfiguration( const bool bFilterEnabled )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_HARDWARE_CONFIGURATION, MESSAGE_WITH_ANSWER );
pMsg->WriteBool( bFilterEnabled );
ClientSendCommand( pMsg );
CVAStruct oHWConfig;
pMsg->ReadVAStruct( oHWConfig );
return oHWConfig;
}
void CVANetNetworkProtocol::ServerGetHardwareConfiguration()
{
CVANetMessage* pMsg = ServerGetMessage();
const bool bFilterEnabled = pMsg->ReadBool();
const CVAStruct oHWConfig = m_pRealCore->GetHardwareConfiguration( bFilterEnabled );
pMsg->WriteVAStruct( oHWConfig );
}
CVAStruct CVANetNetworkProtocol::ClientGetFileList( const bool bRecursive, const std::string& sSuffixFilter )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_GET_FILE_LIST, MESSAGE_WITH_ANSWER );
pMsg->WriteBool( bRecursive );
pMsg->WriteString( sSuffixFilter );
ClientSendCommand( pMsg );
CVAStruct oFileList;
pMsg->ReadVAStruct( oFileList );
return oFileList;
}
void CVANetNetworkProtocol::ServerGetFileList()
{
CVANetMessage* pMsg = ServerGetMessage();
const bool bRecursive = pMsg->ReadBool();
const std::string sFileSuffixMask = pMsg->ReadString();
const CVAStruct oFileList = m_pRealCore->GetFileList( bRecursive, sFileSuffixMask );
pMsg->WriteVAStruct( oFileList );
}
CVAStruct CVANetNetworkProtocol::ClientCallModule( const std::string& sModuleName, const CVAStruct& oArgs )
{
CVANetMessage* pMsg = ClientInitMessage( VA_NP_CALL_MODULE, MESSAGE_WITH_ANSWER );
......
......@@ -78,6 +78,9 @@ public:
static const int VA_NP_CALL_MODULE = 222;
static const int VA_NP_GET_SEARCH_PATHS = 230;
static const int VA_NP_FIND_FILE_PATH = 231;
static const int VA_NP_GET_CORE_CONFIGURATION = 232;
static const int VA_NP_GET_HARDWARE_CONFIGURATION = 233;
static const int VA_NP_GET_FILE_LIST = 234;
// Directivities
static const int VA_NP_CREATE_DIRECTIVITY = 300;
......@@ -408,6 +411,13 @@ public:
std::string ClientFindFilePath( const std::string& sFilePath );
void ServerFindFilePath();
CVAStruct ClientGetCoreConfiguration( const bool bFilterEnabled = true );
void ServerGetCoreConfiguration();
CVAStruct ClientGetHardwareConfiguration( const bool bFilterEnabled = true );
void ServerGetHardwareConfiguration();
CVAStruct ClientGetFileList( const bool bRecursive = true, const std::string& sSuffixFilter = "*" );
void ServerGetFileList();
CVAStruct ClientCallModule( const std::string& sModuleName, const CVAStruct& oArgs );
void ServerCallModule();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment