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

Adding ITA NetAudio tests (ITANA)

parent c0c966a4
......@@ -20,7 +20,7 @@ vista_configure_app( ListDevices )
vista_install( ListDevices )
vista_create_default_info_file( ListDevices )
set_property( TARGET ListDevices PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ListDevices PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Asio" )
add_executable( Loopback Loopback.cpp )
......@@ -30,7 +30,7 @@ vista_configure_app( Loopback )
vista_install( Loopback )
vista_create_default_info_file( Loopback )
set_property( TARGET Loopback PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET Loopback PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Asio" )
add_executable( Play Play.cpp )
......@@ -40,7 +40,7 @@ vista_configure_app( Play )
vista_install( Play )
vista_create_default_info_file( Play )
set_property( TARGET Play PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET Play PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Asio" )
add_executable( Record Record.cpp )
......@@ -50,7 +50,7 @@ vista_configure_app( Record )
vista_install( Record )
vista_create_default_info_file( Record )
set_property( TARGET Record PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET Record PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Asio" )
add_executable( ThreadInit ThreadInit.cpp )
......@@ -60,5 +60,5 @@ vista_configure_app( ThreadInit )
vista_install( ThreadInit )
vista_create_default_info_file( ThreadInit )
set_property( TARGET ThreadInit PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ThreadInit PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Asio" )
......@@ -20,7 +20,7 @@ vista_configure_app( ITAPortaudioInterfaceRecorder )
vista_install( ITAPortaudioInterfaceRecorder )
vista_create_default_info_file( ITAPortaudioInterfaceRecorder )
set_property( TARGET ITAPortaudioInterfaceRecorder PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ITAPortaudioInterfaceRecorder PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Portaudio" )
add_executable( ITAPortaudioInterfaceTest ITAPortaudioInterfaceTest.cpp )
......@@ -30,7 +30,7 @@ vista_configure_app( ITAPortaudioInterfaceTest )
vista_install( ITAPortaudioInterfaceTest )
vista_create_default_info_file( ITAPortaudioInterfaceTest )
set_property( TARGET ITAPortaudioInterfaceTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ITAPortaudioInterfaceTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Portaudio" )
add_executable( ITAPortaudioMeasurementTest ITAPortaudioMeasurementTest.cpp )
......@@ -42,4 +42,4 @@ vista_configure_app( ITAPortaudioMeasurementTest )
vista_install( ITAPortaudioMeasurementTest )
vista_create_default_info_file( ITAPortaudioMeasurementTest )
set_property( TARGET ITAPortaudioMeasurementTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ITAPortaudioMeasurementTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/Portaudio" )
cmake_minimum_required( VERSION 2.9 )
if( NOT ITADATASOURCES_COMMON_BUILD )
project( ITANetAudioTests )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
endif()
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm FIND_DEPENDENCIES )
vista_use_package( ITADataSources REQUIRED FIND_DEPENDENCIES )
add_executable( ITANABufferServerTest ITANABufferServerTest.cpp )
target_link_libraries( ITANABufferServerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANABufferServerTest )
vista_install( ITANABufferServerTest )
vista_create_default_info_file( ITANABufferServerTest )
set_property( TARGET ITANABufferServerTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
add_executable( ITANAPlayerTest ITANAPlayerTest.cpp )
target_link_libraries( ITANAPlayerTest ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( ITANAPlayerTest )
vista_install( ITANAPlayerTest )
vista_create_default_info_file( ITANAPlayerTest )
set_property( TARGET ITANAPlayerTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/NetAudio" )
#include <iostream>
#include <string>
#include <VistaInterProcComm/Concurrency/VistaThreadLoop.h>
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaInterProcComm/IPNet/VistaTCPServer.h>
#include <VistaInterProcComm/IPNet/VistaTCPSocket.h>
//#include <VistaBase/VistaTimeUtils.h>
#include <VistaInterProcComm/IPNet/VistaIPAddress.h>
#include <ITAStringUtils.h>
int main( int argc, char** argv )
{
std::string sServerName = "localhost";
int iServerPort = 12343;
std::cout << "Setting up ITANA server command channel on '" << sServerName << ":" << iServerPort << "'" << std::endl;
VistaTCPServer oNAServer( sServerName, iServerPort, 1 );
std::cout << "Waiting for connection" << std::endl;
VistaTCPSocket* pSocket = oNAServer.GetNextClient();
if( oNAServer.GetIsValid() == false )
{
std::cerr << "Could not start server" << std::endl;
return 255;
}
std::cout << "Waiting for result channel port" << std::endl;
unsigned long l = pSocket->WaitForIncomingData( 0 );
if( l == 8 )
{
unsigned long iRequestedResultChannelPort;
pSocket->ReceiveRaw( &iRequestedResultChannelPort, 8 );
std::string sRemoteAddress;
VistaSocketAddress sAddr;
pSocket->GetPeerSockName( sAddr );
sAddr.GetIPAddress().GetAddressString( sRemoteAddress );
VistaConnectionIP oConnection( VistaConnectionIP::CT_TCP, sRemoteAddress, iRequestedResultChannelPort );
bool bAck = oConnection.GetIsConnected();
oConnection.Send( &bAck, sizeof( bool ) );
oConnection.WaitForSendFinish( 0 );
std::cout << "Result channel connection successfully established" << std::endl;
oConnection.Close( false );
}
pSocket->CloseSocket();
return 0;
}
#include <iostream>
#include <string>
#include <VistaInterProcComm/Connections/VistaConnectionIP.h>
#include <VistaInterProcComm/IPNet/VistaTCPServer.h>
#include <VistaInterProcComm/IPNet/VistaTCPSocket.h>
#include <VistaInterProcComm/IPNet/VistaIPAddress.h>
#include <ITAStringUtils.h>
#include <ITAStopwatch.h>
#include <ITAStringUtils.h>
int main(int argc, char** argv)
{
std::string sServerName ="localhost";
int iServerPort = 12343;
std::cout << "Attempting to connect to ITANA server at '" << sServerName << ":" << iServerPort << "'" << std::endl;
VistaConnectionIP oCommandChannelConnection( VistaConnectionIP::CT_TCP, sServerName, iServerPort);
if( oCommandChannelConnection.GetIsConnected() == false )
{
std::cerr << "Connection error, exiting." << std::endl;
return 255;
}
std::string sLocalAddress;
oCommandChannelConnection.GetLocalAddress().GetIPAddress().GetAddressString( sLocalAddress );
int iBackChannelPort = 12481;
VistaTCPServer oServer( sLocalAddress, iBackChannelPort, 1 );
if( oServer.GetIsValid() == false)
{
std::cerr << "Could not start server" << std::endl;
return 255;
}
else
{
std::cout << "Duplex connection opened, data communication channel port: " << iBackChannelPort << std::endl;
}
// Transmit port on command channel
oCommandChannelConnection.WriteRawBuffer( &iBackChannelPort, 8 );
VistaTCPSocket* pSocket = oServer.GetNextClient();
unsigned long l = pSocket->WaitForIncomingData( 0 );
if( l == sizeof( VistaType::byte ) )
{
bool bAck;
pSocket->ReceiveRaw( &bAck, l );
std::cout << "Client received acknowledge flag '" << bAck << "'" << std::endl;
}
oCommandChannelConnection.Close( false );
return 0;
}
......@@ -19,7 +19,7 @@ vista_configure_app( ITAVistaNetTest )
vista_install( ITAVistaNetTest )
vista_create_default_info_file( ITAVistaNetTest )
set_property( TARGET ITAVistaNetTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ITAVistaNetTest PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/VistaNet" )
add_executable( ITAVistaNetClient VistaNetClient.cpp )
......@@ -31,7 +31,7 @@ vista_configure_app( ITAVistaNetClient )
vista_install( ITAVistaNetClient )
vista_create_default_info_file( ITAVistaNetClient )
set_property( TARGET ITAVistaNetClient PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ITAVistaNetClient PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/VistaNet" )
add_executable( ITAVistaNetServer VistaNetServer.cpp )
......@@ -43,5 +43,5 @@ vista_configure_app( ITAVistaNetServer )
vista_install( ITAVistaNetServer )
vista_create_default_info_file( ITAVistaNetServer )
set_property( TARGET ITAVistaNetServer PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources" )
set_property( TARGET ITAVistaNetServer PROPERTY FOLDER "ITACoreLibs/Tests/ITADataSources/VistaNet" )
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