μHAL (v2.6.5)
Part of the IPbus software repository
DummyHardwareUdp.cxx
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 
4  This file is part of uHAL.
5 
6  uHAL is a hardware access library and programming framework
7  originally developed for upgrades of the Level-1 trigger of the CMS
8  experiment at CERN.
9 
10  uHAL is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  uHAL is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with uHAL. If not, see <http://www.gnu.org/licenses/>.
22 
23  Marc Magrans de Abril, CERN
24  email: marc.magrans.de.abril <AT> cern.ch
25 
26  Andrew Rose, Imperial College, London
27  email: awr01 <AT> imperial.ac.uk
28 
29 ---------------------------------------------------------------------------
30 */
31 
32 
33 #include "uhal/log/LogLevels.hpp"
35 #include "uhal/log/log.hpp"
38 
39 
40 using namespace uhal;
41 using namespace uhal::tests;
42 
43 int main ( int argc, char* argv[] )
44 {
46 
47  if ( lOptions.version == 1 )
48  {
49  UDPDummyHardware<1,3> lDummyHardware ( lOptions.port , lOptions.delay, false );
50  lDummyHardware.run();
51  }
52  else if ( lOptions.version == 2 )
53  {
54  UDPDummyHardware<2,0> lDummyHardware ( lOptions.port , lOptions.delay, lOptions.bigendian );
55  lDummyHardware.run();
56  }
57  else
58  {
59  log ( Error() , "Unknown IPbus version, " , Integer ( lOptions.version ) );
60  return 1;
61  }
62 
63  return 0;
64 }
uint32_t delay
The delay in seconds between the request and response of the first IPbus transaction.
bool bigendian
Whether we use the big-endian hack.
static DummyHardwareOptions parseFromCommandLine(int argc, char *argv[])
Static function to parse the command line arguments into a struct containing the information.
ErrorLevel Error
Definition: LogLevels.cpp:61
void run()
Concrete implementation of the run function Starts the UDP server and runs indefinitely, until exception or user kills the server.
int main(int argc, char *argv[])
Struct to store the dummy hardware command line options.
Concrete implementation of emulator of hardware using UDP.
uint32_t version
IPbus version number - 1 or 2.
uint16_t port
The port used by the dummy hardware.
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...