μHAL (v2.7.9)
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 }
uhal::tests::UDPDummyHardware::run
void run()
Concrete implementation of the run function Starts the UDP server and runs indefinitely,...
Definition: UDPDummyHardware.cpp:8
uhal::tests
Definition: definitions.hpp:37
uhal::tests::DummyHardwareOptions
Struct to store the dummy hardware command line options.
Definition: DummyHardwareOptions.hpp:50
uhal::tests::DummyHardwareOptions::delay
uint32_t delay
The delay in seconds between the request and response of the first IPbus transaction.
Definition: DummyHardwareOptions.hpp:52
uhal::tests::DummyHardwareOptions::parseFromCommandLine
static DummyHardwareOptions parseFromCommandLine(int argc, char *argv[])
Static function to parse the command line arguments into a struct containing the information.
Definition: DummyHardwareOptions.hpp:76
uhal
Definition: HttpResponseGrammar.hpp:49
uhal::tests::DummyHardwareOptions::bigendian
bool bigendian
Whether we use the big-endian hack.
Definition: DummyHardwareOptions.hpp:56
uhal::log
void log(FatalLevel &aFatal, const T0 &aArg0)
Function to add a log entry at Fatal level.
Definition: log.hxx:20
log_inserters.integer.hpp
uhal::Integer
_Integer< T, IntFmt<> > Integer(const T &aT)
Forward declare a function which creates an instance of the ultra-lightweight wrapper from an integer...
Definition: log_inserters.integer.hxx:43
UDPDummyHardware.hpp
uhal::Error
ErrorLevel Error
Definition: LogLevels.cpp:61
log.hpp
uhal::tests::DummyHardwareOptions::version
uint32_t version
IPbus version number - 1 or 2.
Definition: DummyHardwareOptions.hpp:58
uhal::tests::UDPDummyHardware
Concrete implementation of emulator of hardware using UDP.
Definition: UDPDummyHardware.hpp:45
main
int main(int argc, char *argv[])
Definition: DummyHardwareUdp.cxx:43
LogLevels.hpp
DummyHardwareOptions.hpp
uhal::tests::DummyHardwareOptions::port
uint16_t port
The port used by the dummy hardware.
Definition: DummyHardwareOptions.hpp:54