ue runs again on exmimo2 (but does not connect yet) added openair0_reconfig function in exmimo2 library added sensing thread for SPECTRA in lte-softmodem (protected by #ifdef SPECTRA) added Rohde and Schwarz client git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5780 818b1a75-f10b-46b9-bf7c-635c3b92a50f
91 lines
1.6 KiB
C++
91 lines
1.6 KiB
C++
#include <iostream>
|
|
#include "TcpClient.h"
|
|
|
|
void printUsage()
|
|
{
|
|
cout<<"usage: EthernetRawCommand <server-ip> [scpi-command]"<<endl;
|
|
}
|
|
|
|
|
|
int main( int argc, char *argv[] )
|
|
{
|
|
int errorCode = 0; //no error
|
|
|
|
bool useSingleCommand = false;
|
|
string singleCommand = "";
|
|
string hostname = "";
|
|
int port = 5025;
|
|
|
|
string input = "";
|
|
TcpClient client;
|
|
|
|
|
|
switch( argc )
|
|
{
|
|
case 3:
|
|
useSingleCommand = true;
|
|
singleCommand = argv[2];
|
|
case 2:
|
|
hostname = argv[1];
|
|
break;
|
|
default:
|
|
printUsage();
|
|
return(-1);
|
|
}
|
|
|
|
try
|
|
{
|
|
client.connectToServer( hostname, port );
|
|
|
|
bool terminate = false;
|
|
|
|
while( !terminate )
|
|
{
|
|
char buffer[1024];
|
|
|
|
if( useSingleCommand )
|
|
{
|
|
input = singleCommand; //send string
|
|
}
|
|
else
|
|
{
|
|
cin.getline( buffer, 1024 );
|
|
input = buffer;
|
|
|
|
if( input == "end" )
|
|
{
|
|
terminate = true;
|
|
}
|
|
|
|
}
|
|
|
|
if( !terminate)
|
|
{
|
|
client.transmit( input ); //send string
|
|
|
|
int qPos = input.find( "?", 0 );
|
|
//receive string only when needed
|
|
if( qPos > 0 )
|
|
{
|
|
string rcStr = "";
|
|
client.receive( rcStr );
|
|
cout << rcStr << endl;
|
|
}
|
|
}
|
|
|
|
if( useSingleCommand )
|
|
{
|
|
terminate = true;
|
|
}
|
|
}
|
|
|
|
}catch( const string errorString )
|
|
{
|
|
cout<<errorString<<endl;
|
|
}
|
|
|
|
client.disconnect( );
|
|
|
|
return errorCode;
|
|
}
|