The VisAO Camera
dioserver_main.cpp
Go to the documentation of this file.
1 /************************************************************
2 * dioserver_main.cpp
3 *
4 * Author: Jared R. Males (jrmales@email.arizona.edu)
5 *
6 * The main program for the digital I/O server
7 *
8 * Developed as part of the Magellan Adaptive Optics system.
9 ************************************************************/
10 
11 /** \file dioserver_main.cpp
12  * \author Jared R. Males
13  * \brief The main program for the digital I/O server
14  *
15  * Does not use VisAO_main because of the dio card setup, which is external
16  * to the dioserver class.
17  *
18 */
19 
20 //Here the order of include matters, apc464_dioserver.h must be first to avoid double define of WORD by Logger.h
21 #include "apc464_dioserver.h"
22 #include "dioserver.h"
23 
25 std::string global_app_name;
26 
27 int main(int argc, char **argv)
28 {
29  TimeToDie = 0;
30 
31  try
32  {
33  VisAO::dioserver * dios;
34 
35  apc464_info apc464;
36 
37  init_apc464_info(&apc464);
38 
39  if(argc > 1)
40  {
41  dios = new VisAO::dioserver(argc,argv);
42  }
43  else
44  {
45  std::string confdir = Utils::getConffile("dioserver");
46  dios = new VisAO::dioserver("dioserver", confdir);
47  }
48 
49  //Install the apc464 functions
50  dios->diocard_info = (void *) &apc464;
51  dios->diocard_init = &apc464_init;
52  dios->diocard_write = &apc464_write;
53  dios->diocard_read = &apc464_read;
54 
55  dios->Exec();
56 
57  delete dios;
58 
59  return 0;
60 
61  }
62  catch(...)
63  {
64  Logger::get()->log( Logger::LOG_LEV_FATAL, "%s:%d: %s", __FILE__, __LINE__, "exception caught in dioserver");
65  return -1;
66  }
67 }
68 
Declarations for the dioserver.
Class to manage access to a digital input/output device.
Definition: dioserver.h:73
int(* diocard_init)(void *)
Initialize the card.
Definition: dioserver.h:90
int(* diocard_read)(void *card, int ch)
Read a bit from the channel.
Definition: dioserver.h:93
int(* diocard_write)(void *card, int ch, int bit)
Write a bit to a channel.
Definition: dioserver.h:92
int TimeToDie
Global set by SIGTERM.
void * diocard_info
The generic DIO interface. This pointer is passed unaltered to the diocard_* functions.
Definition: dioserver.h:89
virtual int Exec()
Installs the term and XXXX signal handlers, and calls Run().