Psyllid  v1.12.4
Project 8 Data Acquisisition Software
server_config.cc
Go to the documentation of this file.
1 /*
2  * server_config.cc
3  *
4  * Created on: Nov 4, 2013
5  * Author: nsoblath
6  */
7 
8 #include "server_config.hh"
9 #include "logger.hh"
10 #include "psyllid_error.hh"
11 
12 //scarab
13 #include "path.hh"
14 
15 #include<string>
16 
17 using std::string;
18 
19 using scarab::param_array;
20 using scarab::param_node;
21 using scarab::param_value;
22 
23 namespace psyllid
24 {
25 
26  LOGGER( plog, "server_config" );
27 
29  {
30  // default server configuration
31 
32  param_node t_amqp_node = param_node();
33  t_amqp_node.add( "broker", "localhost" );
34  t_amqp_node.add( "queue", "psyllid" );
35  t_amqp_node.add( "slack-queue", "slack_interface" );
36  //add logic for default auth file if it exists
37  scarab::path t_auth_default_path = scarab::expand_path( "~/.project8_authentications.json" );
38  if ( boost::filesystem::exists( t_auth_default_path ) )
39  {
40  LDEBUG( plog, "default auth file found, setting that as initial value" << t_auth_default_path.string() );
41  t_amqp_node.add( "auth-file", t_auth_default_path.string() );
42  }
43  else
44  {
45  LDEBUG( plog, "default auth file <" << t_auth_default_path.string() << "> does not exist, not setting" );
46  }
47 
48  // other available values
49  // - auth-file
50  // - requests-exchange
51  // - alerts-exchange
52  // - listen-timeout-ms
53  // - broker-port
54  add( "amqp", t_amqp_node );
55 
56  add( "post-to-slack", false );
57 
58  param_node t_daq_node;
59  t_daq_node.add( "activate-at-startup", false );
60  t_daq_node.add( "n-files", 1U );
61  t_daq_node.add( "duration", 1000U );
62  t_daq_node.add( "max-file-size-mb", 500.0 );
63  add( "daq", t_daq_node );
64 
65  param_node t_batch_commands;
66  param_array t_stop_array;
67  param_node t_stop_action;
68  t_stop_action.add( "type", "cmd" );
69  t_stop_action.add( "rks", "stop-run" );
70  t_stop_action.add( "payload", param_node() );
71  t_stop_array.push_back( t_stop_action );
72  t_batch_commands.add( "hard-abort", t_stop_array );
73  add( "batch-commands", t_batch_commands );
74 
75  param_node t_set_conditions;
76  t_set_conditions.add( "10", "hard-abort" );
77  t_set_conditions.add( "12", "hard-abort" );
78  add( "set-conditions", t_set_conditions );
79 
80  /*
81  // this devices node can be used for multiple streams
82  param_node* t_dev_node = new param_node();
83  t_dev_node->add( "n-channels", new param_value( 1U ) );
84  t_dev_node->add( "bit-depth", new param_value( 8U ) );
85  t_dev_node->add( "data-type-size", new param_value( 1U ) );
86  t_dev_node->add( "sample-size", new param_value( 2U ) );
87  t_dev_node->add( "record-size", new param_value( 4096U ) );
88  t_dev_node->add( "acq-rate", new param_value( 100U ) );
89  t_dev_node->add( "v-offset", new param_value( 0.0 ) );
90  t_dev_node->add( "v-range", new param_value( 0.5 ) );
91 
92  param_node* t_streams_node = new param_node();
93 
94  param_node* t_stream0_node = new param_node();
95  t_stream0_node->add( "preset", new param_value( "str-1ch") );
96  t_stream0_node->add( "device", t_dev_node );
97 
98  t_streams_node->add( "stream0", t_stream0_node );
99 
100  add( "streams", t_streams_node );
101  */
102  }
103 
105  {
106  }
107 
108 } /* namespace psyllid */
static scarab::logger plog("batch_executor")
LOGGER(plog, "egg_writer")