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

Bugfix in network messaging (receiving buffer size was to big, now reading in...

Bugfix in network messaging (receiving buffer size was to big, now reading in a while loop only the incoming bytes until entire message data is transmitted)
Also fixing some older structure for PrototypeGenericPath in net client test.
parent 119ac788
This diff is collapsed.
#ifndef __VANET_MESSAGE_H__
#define __VANET_MESSAGE_H__
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics (VA)
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institute of Technical Acoustics (ITA), 2015-2017
* VVVV AAA RWTH Aachen University (http://www.akustik.rwth-aachen.de)
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VANET_MESSAGE
#define IW_VANET_MESSAGE
#include <VABaseDefinitions.h>
#include <VAStruct.h>
......@@ -24,9 +37,11 @@ class CVASoundInfo;
class CVASignalSourceInfo;
class CVASceneInfo;
// Messages consist of a message part and an answer part, each read or written
// separately. Messages have a three-int-header (SIZE, MSGTYPE; EXCEPTIONMODE), while
// answers have a two-int header (SIZE; ANSWERTYPE)
//! Network message helper
/** Messages consist of a message part and an answer part, each read or written
* separately. Messages have a three-int-header (SIZE, MSGTYPE; EXCEPTIONMODE), while
* answers have a two-int header (SIZE; ANSWERTYPE)
*/
class CVANetMessage
{
public:
......@@ -38,9 +53,9 @@ public:
void WriteMessage();
void ReadMessage();
void WriteAnswer();
void WriteAnswer();
void ReadAnswer();
int GetExceptionMode() const;
int GetMessageType() const;
int GetAnswerType() const;
......@@ -114,4 +129,4 @@ private:
VistaConnectionIP* m_pConnection;
};
#endif// __VANET_MESSAGE_H__
#endif// IW_VANET_MESSAGE
......@@ -2,7 +2,7 @@
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institut fr Technische Akustik (ITA)
* VVVV AAA RWTH Aachen (http://www.akustik.rwth-aachen.de)
......@@ -30,6 +30,7 @@
#include <VistaBase/VistaTimeUtils.h>
using namespace std;
int main( int, char** )
{
......@@ -37,7 +38,7 @@ int main( int, char** )
std::string sServerIP = "127.0.0.1";
int iPort = 12340;
if( pClient->Initialize( sServerIP, iPort ) != IVANetClient::VA_NO_ERROR )
{
return -1;
......@@ -58,67 +59,76 @@ int main( int, char** )
{
switch( c )
{
case 'q':
bContinue = false;
break;
case 'd':
{
int iRet = pClient->GetCoreInstance()->LoadDirectivity( "test", "testname" );
std::cout << "LoadDirectivity( test, testname ) = " << iRet << std::endl;
break;
}
case 'm':
{
bMute = !bMute;
pClient->GetCoreInstance()->SetOutputMuted( bMute );
std::cout << "SetOutputMuted( " << bMute << " ) called" << std::endl;
bool bIsMuted = pClient->GetCoreInstance()->IsOutputMuted();
std::cout << "IsOutputMuted() = " << bIsMuted << std::endl;
break;
}
case 's':
{
bMute = !bMute;
pClient->GetCoreInstance()->SetOutputMuted( bMute );
std::cout << "SetListenerPosition( " << bMute << " ) called" << std::endl;
pClient->GetCoreInstance()->SetListenerPosition( 0, 1, 2, 3 );
break;
}
case 'b':
{
pClient->GetCoreInstance()->LockScene();
std::cout << "LockScene() called" << std::endl;
break;
}
case 'e':
{
int iNum = pClient->GetCoreInstance()->UnlockScene();
std::cout << "UnlockScene() = " << iNum << std::endl;
break;
}
case 'j':
{
CVAStruct oArgs, oRet;
oArgs["command"] = "update";
oArgs["type"] = "data";
oArgs["listenerid"] = 1;
oArgs["sourceid"] = 1;
std::vector< float > vfData( 900000 );
for( size_t i=0; i<vfData.size();i++) vfData[i] = float( i / vfData.size() );
oArgs["IRDataCh1"] = CVAStructValue( &vfData[0], int( vfData.size() * sizeof( float ) ) );
oArgs["IRDataCh2"] = CVAStructValue( &vfData[0], int( vfData.size() * sizeof( float ) ) );
pClient->GetCoreInstance()->CallModule( "GenericPath:MyGenericPath", oArgs, oRet );
break;
}
default:
break;
case 'q':
bContinue = false;
break;
case 'd':
{
int iRet = pClient->GetCoreInstance()->LoadDirectivity( "test", "testname" );
std::cout << "LoadDirectivity( test, testname ) = " << iRet << std::endl;
break;
}
case 'm':
{
bMute = !bMute;
pClient->GetCoreInstance()->SetOutputMuted( bMute );
std::cout << "SetOutputMuted( " << bMute << " ) called" << std::endl;
bool bIsMuted = pClient->GetCoreInstance()->IsOutputMuted();
std::cout << "IsOutputMuted() = " << bIsMuted << std::endl;
break;
}
case 's':
{
bMute = !bMute;
pClient->GetCoreInstance()->SetOutputMuted( bMute );
std::cout << "SetListenerPosition( " << bMute << " ) called" << std::endl;
pClient->GetCoreInstance()->SetListenerPosition( 0, 1, 2, 3 );
break;
}
case 'b':
{
pClient->GetCoreInstance()->LockScene();
std::cout << "LockScene() called" << std::endl;
break;
}
case 'e':
{
int iNum = pClient->GetCoreInstance()->UnlockScene();
std::cout << "UnlockScene() = " << iNum << std::endl;
break;
}
case 'j':
{
string sModuleID = "PrototypeGenericPath:MyGenericRenderer";
CVAStruct oArgs, oRet;
oArgs[ "info" ] = true;
pClient->GetCoreInstance()->CallModule( sModuleID, oArgs, oRet );
cout << oRet << endl;
oArgs.Clear();
oArgs[ "listener" ] = pClient->GetCoreInstance()->CreateListener( "PGP_test_listener" );
oArgs[ "source" ] = pClient->GetCoreInstance()->CreateSoundSource( "PGP_test_source" );
std::vector< float > vfData( 900000 );
for( size_t i = 0; i < vfData.size(); i++ )
vfData[ i ] = float( i / vfData.size() );
oArgs[ "ch1" ] = CVAStructValue( &vfData[ 0 ], int( vfData.size() * sizeof( float ) ) );
oArgs[ "ch2" ] = CVAStructValue( &vfData[ 0 ], int( vfData.size() * sizeof( float ) ) );
oArgs[ "verbose" ] = true;
pClient->GetCoreInstance()->CallModule( sModuleID, oArgs, oRet );
cout << oRet << endl;
break;
}
default:
break;
}
}
catch( CVAException& oExc )
{
std::cerr << "Caught VA Exception: \n" << oExc << std::endl;
}
}
}
pClient->Disconnect();
......
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