Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
DispatcherCMD Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-04-09/EventDispatcher_CommandSet/cxx/include/DispatcherCmd.h"

Classes

struct  DspCmd
 

Public Types

enum  MagicNumbers {
  DSPCMD_BYTECOUNTMAGIC1 = 0xBBADBEEF, DSPCMD_BYTECOUNTMAGIC2 = 0xBEEFBBAD, DSPCMD_BYTECOUNTMAGIC_B3 = 0xBB, DSPCMD_BYTECOUNTMAGIC_B2 = 0xAD,
  DSPCMD_BYTECOUNTMAGIC_B1 = 0xBE, DSPCMD_BYTECOUNTMAGIC_B0 = 0xFF, DSPCMD_BYTECOUNTMAGIC_B7 = 0xBE, DSPCMD_BYTECOUNTMAGIC_B6 = 0xEF,
  DSPCMD_BYTECOUNTMAGIC_B5 = 0xBB, DSPCMD_BYTECOUNTMAGIC_B4 = 0xAD
}
 
enum  DispatcherCommands {
  DSPCMD_NOT_SET = 0, DSPCMD_ACK = 6, DSPCMD_IDENT = 'I', DSPCMD_DATA_VERSION = 'V',
  DSPCMD_SET_PRESCALE = 'P', DSPCMD_SET_EVENTSTREAM_SINGLE = 'S', DSPCMD_SET_EVENTSTREAM_MAX_EVENTS = 'M', DSPCMD_SET_EVENTSTREAM_CONTINOUS = 'C',
  DSPCMD_SET_TRIGGER_MASK_1 = 100, DSPCMD_SET_TRIGGER_MASK_2 = 101, DSPCMD_SET_TRIGGER_MASK_3 = 102, DSPCMD_START_DATAFLOW = 23,
  DSPCMD_STOP_DATAFLOW = 24, DSPCMD_NEXT_EVENT = 25, DSPCMD_END = 'E', DSPCMD_END_EVENT_STREAM = 0xFFFFFFFF
}
 
enum  DispatcherCommandDefaults {
  DEFAULT_SINGLE_EVENT_MODE = -1, DEFAULT_MAX_EVENTS = 1000, DEFAULT_TRIGGER_MASK = 0xFFFFFFFF, DEFAULT_PRESCALE_MASK = 0xFFFFFFFF,
  DEFAULT_PRESCALE_VALUE = 1
}
 

Public Member Functions

 DispatcherCMD (void *output_buff, bool ack=false)
 
 DispatcherCMD (DispatcherCommands cmd, void *output_buff, bool ack=false)
 
 DispatcherCMD (DispatcherCommands cmd, int32_t value, void *output_buff, bool ack=false)
 
 DispatcherCMD (DispatcherCommands cmd, int32_t value1, int32_t value2, void *output_buff, bool ack=false)
 
 DispatcherCMD (DispatcherCommands cmd, std::vector< int32_t > values, void *output_buff, bool ack=false)
 
 DispatcherCMD (uint8_t *input_buffer)
 
 ~DispatcherCMD ()
 
void addCommand (DispatcherCommands cmd, int32_t value)
 
void addCommand (DispatcherCommands cmd, std::vector< int32_t > values)
 
void reset ()
 
ssize_t write ()
 
DispatcherCommands getCommand ()
 Function to insert magic numbers into the buffer. More...
 
std::vector< int32_t > getCommandData ()
 
voidgetExternalBuffer ()
 

Static Public Member Functions

static uint8_t * InsertByteCountMagic (uint8_t *insertion_pointer)
 
static bool cmdNeedsAck (DispatcherCommands cmd)
 
static bool cmdNeedsAck (DispatcherCMD &cmd)
 

Private Member Functions

void Init (void *output_buff)
 
void setCommandDefault (DispatcherCommands cmd)
 
void serializeCmd ()
 
bool deserializeCmd (void *input_buffer)
 

Private Attributes

DspCmd aCommand
 
bool Acknowledge_flag
 A command. More...
 
voidexternal_buff
 
uint8_t internal_buff [256]
 Pointer to the external output buffer. More...
 
union {
   void *   buff_base
 
   uint8_t *   buff8_base
 
   uint16_t *   buff16_base
 
   uint32_t *   buff32_base
 
}; 
 256byte internal buffer for serialization More...
 
union {
   uint32_t   magicNumberWord [2]
 
   uint8_t   magicNumberBytes [8]
 
}; 
 
union {
   void *   buff
 
   uint8_t *   buff8
 
   uint16_t *   buff16
 
   uint32_t *   buff32
 
}; 
 

Detailed Description

Definition at line 12 of file DispatcherCmd.h.

Member Enumeration Documentation

Enumerator
DEFAULT_SINGLE_EVENT_MODE 
DEFAULT_MAX_EVENTS 
DEFAULT_TRIGGER_MASK 
DEFAULT_PRESCALE_MASK 
DEFAULT_PRESCALE_VALUE 

Definition at line 52 of file DispatcherCmd.h.

Enumerator
DSPCMD_NOT_SET 
DSPCMD_ACK 
DSPCMD_IDENT 
DSPCMD_DATA_VERSION 
DSPCMD_SET_PRESCALE 
DSPCMD_SET_EVENTSTREAM_SINGLE 
DSPCMD_SET_EVENTSTREAM_MAX_EVENTS 
DSPCMD_SET_EVENTSTREAM_CONTINOUS 
DSPCMD_SET_TRIGGER_MASK_1 
DSPCMD_SET_TRIGGER_MASK_2 
DSPCMD_SET_TRIGGER_MASK_3 
DSPCMD_START_DATAFLOW 
DSPCMD_STOP_DATAFLOW 
DSPCMD_NEXT_EVENT 
DSPCMD_END 
DSPCMD_END_EVENT_STREAM 

Definition at line 33 of file DispatcherCmd.h.

33  {
34  DSPCMD_NOT_SET = 0,
35  DSPCMD_ACK = 6,
36  DSPCMD_IDENT = 'I',
37  DSPCMD_DATA_VERSION = 'V',
38  DSPCMD_SET_PRESCALE = 'P',
47  DSPCMD_NEXT_EVENT = 25,
48  DSPCMD_END = 'E',
49  DSPCMD_END_EVENT_STREAM = 0xFFFFFFFF
50  };
Enumerator
DSPCMD_BYTECOUNTMAGIC1 
DSPCMD_BYTECOUNTMAGIC2 
DSPCMD_BYTECOUNTMAGIC_B3 
DSPCMD_BYTECOUNTMAGIC_B2 
DSPCMD_BYTECOUNTMAGIC_B1 
DSPCMD_BYTECOUNTMAGIC_B0 
DSPCMD_BYTECOUNTMAGIC_B7 
DSPCMD_BYTECOUNTMAGIC_B6 
DSPCMD_BYTECOUNTMAGIC_B5 
DSPCMD_BYTECOUNTMAGIC_B4 

Definition at line 18 of file DispatcherCmd.h.

Constructor & Destructor Documentation

DispatcherCMD::DispatcherCMD ( void output_buff,
bool  ack = false 
)

Definition at line 32 of file DispatcherCmd.cpp.

References Acknowledge_flag, and Init().

32  {
33  // Initialize
34  Init(output_buff);
35  Acknowledge_flag = ack;
36 }
bool Acknowledge_flag
A command.
void Init(void *output_buff)
DispatcherCMD::DispatcherCMD ( DispatcherCommands  cmd,
void output_buff,
bool  ack = false 
)

Definition at line 38 of file DispatcherCmd.cpp.

References Acknowledge_flag, Init(), serializeCmd(), and setCommandDefault().

38  {
39  // Initialize
40  Init(output_buff);
41  Acknowledge_flag = ack;
42  // Setup the command with default values
44  // Serialize the command to the buffer
45  serializeCmd();
46 }
bool Acknowledge_flag
A command.
void Init(void *output_buff)
string cmd
Definition: run_hadd.py:52
void setCommandDefault(DispatcherCommands cmd)
DispatcherCMD::DispatcherCMD ( DispatcherCommands  cmd,
int32_t  value,
void output_buff,
bool  ack = false 
)

Definition at line 48 of file DispatcherCmd.cpp.

References Acknowledge_flag, aCommand, run_hadd::cmd, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, Init(), and serializeCmd().

48  {
49  // Initialize
50  Init(output_buff);
51  Acknowledge_flag = ack;
52 
53  // Setup the command
54  aCommand.cmd = cmd;
55  aCommand.data.push_back(value);
56 
57  // Serialize the command to the buffer
58  serializeCmd();
59 }
bool Acknowledge_flag
A command.
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
void Init(void *output_buff)
string cmd
Definition: run_hadd.py:52
const XML_Char int const XML_Char * value
Definition: expat.h:331
DispatcherCMD::DispatcherCMD ( DispatcherCommands  cmd,
int32_t  value1,
int32_t  value2,
void output_buff,
bool  ack = false 
)

Definition at line 61 of file DispatcherCmd.cpp.

References Acknowledge_flag, aCommand, run_hadd::cmd, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, Init(), and serializeCmd().

61  {
62  // Initialize
63  Init(output_buff);
64 
65  Acknowledge_flag = ack;
66 
67  // Setup the command
68  aCommand.cmd = cmd;
69  aCommand.data.push_back(value1);
70  aCommand.data.push_back(value2);
71 
72  // Serialize the command to the buffer
73  serializeCmd();
74 }
bool Acknowledge_flag
A command.
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
void Init(void *output_buff)
string cmd
Definition: run_hadd.py:52
DispatcherCMD::DispatcherCMD ( DispatcherCommands  cmd,
std::vector< int32_t >  values,
void output_buff,
bool  ack = false 
)

Definition at line 76 of file DispatcherCmd.cpp.

References Acknowledge_flag, aCommand, run_hadd::cmd, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, Init(), serializeCmd(), and train_latest_snapshot::values.

76  {
77  // Initialize
78  Init(output_buff);
79 
80  Acknowledge_flag = ack;
81 
82  // Setup the command
83  aCommand.cmd = cmd;
85 
86  // Serialize the command to the buffer
87  serializeCmd();
88 }
bool Acknowledge_flag
A command.
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
void Init(void *output_buff)
string cmd
Definition: run_hadd.py:52
DispatcherCMD::DispatcherCMD ( uint8_t *  input_buffer)

Definition at line 21 of file DispatcherCmd.cpp.

References Acknowledge_flag, buff, buff_base, deserializeCmd(), external_buff, and internal_buff.

21  {
22  Acknowledge_flag = false;
23  external_buff = NULL;
24 
25  deserializeCmd(input_buffer);
26 
28  buff = buff_base;
29 
30 }
bool deserializeCmd(void *input_buffer)
bool Acknowledge_flag
A command.
uint8_t internal_buff[256]
Pointer to the external output buffer.
void * external_buff
DispatcherCMD::~DispatcherCMD ( )

Definition at line 91 of file DispatcherCmd.cpp.

91  {
92 }

Member Function Documentation

void DispatcherCMD::addCommand ( DispatcherCommands  cmd,
int32_t  value 
)

Definition at line 94 of file DispatcherCmd.cpp.

References aCommand, run_hadd::cmd, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, and serializeCmd().

94  {
95  aCommand.cmd = cmd;
96  aCommand.data.clear();
97  aCommand.data.push_back(value);
98 
99  serializeCmd();
100  return;
101 }
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
string cmd
Definition: run_hadd.py:52
const XML_Char int const XML_Char * value
Definition: expat.h:331
void DispatcherCMD::addCommand ( DispatcherCommands  cmd,
std::vector< int32_t >  values 
)

Definition at line 103 of file DispatcherCmd.cpp.

References aCommand, run_hadd::cmd, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, serializeCmd(), and train_latest_snapshot::values.

103  {
104  aCommand.cmd = cmd;
105  aCommand.data.clear();
106  aCommand.data = values;
107 
108  serializeCmd();
109  return;
110 }
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
string cmd
Definition: run_hadd.py:52
static bool DispatcherCMD::cmdNeedsAck ( DispatcherCommands  cmd)
inlinestatic

Definition at line 92 of file DispatcherCmd.h.

References DSPCMD_ACK, DSPCMD_DATA_VERSION, DSPCMD_END, DSPCMD_END_EVENT_STREAM, DSPCMD_IDENT, DSPCMD_NEXT_EVENT, DSPCMD_NOT_SET, DSPCMD_SET_EVENTSTREAM_CONTINOUS, DSPCMD_SET_EVENTSTREAM_MAX_EVENTS, DSPCMD_SET_EVENTSTREAM_SINGLE, DSPCMD_SET_PRESCALE, DSPCMD_SET_TRIGGER_MASK_1, DSPCMD_SET_TRIGGER_MASK_2, DSPCMD_SET_TRIGGER_MASK_3, DSPCMD_START_DATAFLOW, and DSPCMD_STOP_DATAFLOW.

92  {
93 
94  switch( cmd ){
95  // Commands that need Acknowledgement
96  case DSPCMD_IDENT :
98  return true;
99  break;
100  // Commands that do NOT need Acknowledgement
101  case DSPCMD_DATA_VERSION :
102  case DSPCMD_SET_PRESCALE :
108  case DSPCMD_START_DATAFLOW :
109  case DSPCMD_STOP_DATAFLOW :
110  case DSPCMD_NEXT_EVENT :
111  case DSPCMD_END :
113  case DSPCMD_NOT_SET :
114  case DSPCMD_ACK :
115  return false;
116  break;
117  default:
118  return false;
119  }
120  }
string cmd
Definition: run_hadd.py:52
static bool DispatcherCMD::cmdNeedsAck ( DispatcherCMD cmd)
inlinestatic

Definition at line 122 of file DispatcherCmd.h.

References DispatcherCMD::DspCmd::cmd, cmdNeedsAck(), deserializeCmd(), getCommand(), Init(), serializeCmd(), and setCommandDefault().

Referenced by cmdNeedsAck().

122 { return cmdNeedsAck(cmd.getCommand()); }
static bool cmdNeedsAck(DispatcherCommands cmd)
Definition: DispatcherCmd.h:92
DispatcherCommands getCommand()
Function to insert magic numbers into the buffer.
Definition: DispatcherCmd.h:86
bool DispatcherCMD::deserializeCmd ( void input_buffer)
private

Definition at line 182 of file DispatcherCmd.cpp.

References aCommand, buff32, buff8, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, DSPCMD_BYTECOUNTMAGIC1, DSPCMD_BYTECOUNTMAGIC2, DSPCMD_END, internal_buff, magicNumberWord, gen_hdf5record::size, and SWAB32.

Referenced by cmdNeedsAck(), and DispatcherCMD().

182  {
183  bool valid = true;
184  uint8_t size = 0;
185 
186  // First take off the byte count
187  size = ((uint8_t*)input_buffer)[0];
188 
189 #ifdef USE_MAGIC_NO
190  // Then take off the magic numbers
191  uint32_t* magic = (uint32_t*) (&(((uint8_t*)input_buffer)[1]));
192 
193  if( !(DSPCMD_BYTECOUNTMAGIC1 == magic[0] )){
194  valid = false;
195  }
196 
197  if( !(DSPCMD_BYTECOUNTMAGIC2 == magic[1] )){
198  valid = false;
199  }
200 
201  // Check the magic numbers
202  // if the check fails then set valid = false
203 #endif
204 
205  // Copy the buffer
206  if(valid){
207  memcpy(internal_buff, input_buffer, size);
208  }else{
209  return false; // Invalid buffer
210  }
211 
212  // Figure out where the end of the buffer is
213  uint8_t* endbuff = internal_buff + size;
214 
215  // At this point we have a local copy of the data
216  // we set a pointer to the start of it
218  size = buff8[0];
219  ++buff8;
220 
221 #ifdef USE_MAGIC_NO
222  magicNumberWord[0] = buff32[0];
223  magicNumberWord[1] = buff32[1];
224  ++buff32; // Advance over the first magic word
225  ++buff32; // Advance over the second magic word
226 #endif
227  // Then take the command character
228  aCommand.cmd = static_cast<DispatcherCommands>(buff8[0]);
229  ++buff8;
230 
231  // Unpack the data words into a the data vector untill we
232  // get to the end of the buffer
233  while( endbuff > buff8){
234  aCommand.data.push_back(SWAB32(buff32[0]));
235  ++buff32;
236  }
237 
238  // The last byte in the buffer should be the end mark, check that it is
239  if(DSPCMD_END != endbuff[0]){
240  valid = false;
241  }
242 
243  return valid;
244 }
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
uint32_t magicNumberWord[2]
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
uint8_t * buff8
uint8_t internal_buff[256]
Pointer to the external output buffer.
uint32_t * buff32
#define SWAB32(word)
DispatcherCommands DispatcherCMD::getCommand ( )
inline

Function to insert magic numbers into the buffer.

Definition at line 86 of file DispatcherCmd.h.

References aCommand, and DispatcherCMD::DspCmd::cmd.

Referenced by cmdNeedsAck().

86 {return aCommand.cmd;};
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector<int32_t> DispatcherCMD::getCommandData ( )
inline

Definition at line 87 of file DispatcherCmd.h.

References aCommand, and DispatcherCMD::DspCmd::data.

87 {return aCommand.data;};
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
void* DispatcherCMD::getExternalBuffer ( )
inline

Definition at line 89 of file DispatcherCmd.h.

References external_buff.

89 {return external_buff;}
void * external_buff
void DispatcherCMD::Init ( void output_buff)
private

Definition at line 138 of file DispatcherCmd.cpp.

References Acknowledge_flag, aCommand, buff, buff8, buff_base, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, DSPCMD_NOT_SET, external_buff, and internal_buff.

Referenced by cmdNeedsAck(), and DispatcherCMD().

138  {
139  Acknowledge_flag = false;
140 
141  external_buff = output_buffer;
142 
143  // Zero the internal buffer
144  memset(internal_buff, 0, 256);
145 
146  // We initially serialize to the internal
147  // buffer
149 
150  // Set the buffer insertion point
151  // to the start of the buffer
152  buff = buff_base;
153 
154  // Write a leading zero byte count
155  *buff8 = 0;
156 
157  // Advance one byte so we are
158  // ready for command insertion
159  buff8++;
160 
162  aCommand.data.clear();
163 }
bool Acknowledge_flag
A command.
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
uint8_t * buff8
uint8_t internal_buff[256]
Pointer to the external output buffer.
void * external_buff
uint8_t * DispatcherCMD::InsertByteCountMagic ( uint8_t *  insertion_pointer)
static

Definition at line 165 of file DispatcherCmd.cpp.

References DSPCMD_BYTECOUNTMAGIC_B0, DSPCMD_BYTECOUNTMAGIC_B1, DSPCMD_BYTECOUNTMAGIC_B2, DSPCMD_BYTECOUNTMAGIC_B3, DSPCMD_BYTECOUNTMAGIC_B4, DSPCMD_BYTECOUNTMAGIC_B5, DSPCMD_BYTECOUNTMAGIC_B6, and DSPCMD_BYTECOUNTMAGIC_B7.

Referenced by serializeCmd().

165  {
166 
167  // Copy the insertion pointer so we don't modify the original
168  uint8_t* local_buffp = insert_buffer;
169 
170  // Insert (write) the 64Bit magic number "0xBBADBEEF 0xBEEFBBAD"
171  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B0; ++local_buffp;
172  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B1; ++local_buffp;
173  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B2; ++local_buffp;
174  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B3; ++local_buffp;
175  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B4; ++local_buffp;
176  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B5; ++local_buffp;
177  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B6; ++local_buffp;
178  *local_buffp = (uint8_t)DSPCMD_BYTECOUNTMAGIC_B7; ++local_buffp;
179  return local_buffp;
180 }
void DispatcherCMD::reset ( )

Definition at line 112 of file DispatcherCmd.cpp.

References aCommand, buff, buff8, buff_base, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, DSPCMD_NOT_SET, and internal_buff.

112  {
113  // Zero the internal buffer
114  memset(internal_buff, 0, 256);
115 
116  // Reset the insertion point of the
117  // the internal buffer
118  buff = buff_base;
119  *buff8 =0;
120  buff8++;
121 
123  aCommand.data.clear();
124 }
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
uint8_t * buff8
uint8_t internal_buff[256]
Pointer to the external output buffer.
void DispatcherCMD::serializeCmd ( )
private

Definition at line 246 of file DispatcherCmd.cpp.

References Acknowledge_flag, aCommand, buff32, buff8, buff8_base, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, DSPCMD_ACK, DSPCMD_END, MECModelEnuComparisons::i, InsertByteCountMagic(), and SWAB32.

Referenced by addCommand(), cmdNeedsAck(), and DispatcherCMD().

246  {
247  // Zero the leading byte count
248  *buff8_base = 0;
249 
250 #ifdef USE_MAGIC_NO
252 #endif
253 
254  // If we need to embed an acknowledgement flag
255  // put that in next
256  if(Acknowledge_flag){
257  *buff8 = (uint8_t)DSPCMD_ACK;
258  buff8++;
259  }
260 
261  // Write the command into the buffer
262  *buff8 = (uint8_t)aCommand.cmd;
263  buff8++;
264 
265  // Write the data values into the buffer
266  for(uint i=0; i<aCommand.data.size();++i ){
267  *buff32 = SWAB32(aCommand.data[i]);
268  buff32++;
269  }
270 
271  // Write the end value
272  *buff8 = (uint8_t)DSPCMD_END;
273  buff8++;
274 
275  // Rewrite the leading byte count
276  // first calculate the command size in bytes and check that it is
277  // able to fit into 1 byte (i.e. a value less than 255)
278  uint8_t cmdsize = (buff8 - buff8_base -1);
279  uint32_t bsize = (buff8 - buff8_base -1);
280  if(bsize < 255){
281  *buff8_base = cmdsize;
282  }else{
283  // If the size is over 1 byte we put in the overflow value
284  *buff8_base = 255;
285  }
286 
287  // Back up the insertion point one byte
288  // incase we want to insert more commands
289  buff8--;
290 
291  return;
292 }
static uint8_t * InsertByteCountMagic(uint8_t *insertion_pointer)
bool Acknowledge_flag
A command.
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
uint8_t * buff8_base
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
uint8_t * buff8
uint32_t * buff32
#define SWAB32(word)
unsigned int uint
void DispatcherCMD::setCommandDefault ( DispatcherCommands  cmd)
private

Definition at line 294 of file DispatcherCmd.cpp.

References aCommand, run_hadd::cmd, DispatcherCMD::DspCmd::cmd, DispatcherCMD::DspCmd::data, DEFAULT_MAX_EVENTS, DEFAULT_PRESCALE_MASK, DEFAULT_TRIGGER_MASK, DSPCMD_DATA_VERSION, DSPCMD_IDENT, DSPCMD_NEXT_EVENT, DSPCMD_SET_EVENTSTREAM_CONTINOUS, DSPCMD_SET_EVENTSTREAM_MAX_EVENTS, DSPCMD_SET_EVENTSTREAM_SINGLE, DSPCMD_SET_PRESCALE, DSPCMD_SET_TRIGGER_MASK_1, DSPCMD_SET_TRIGGER_MASK_2, DSPCMD_SET_TRIGGER_MASK_3, DSPCMD_START_DATAFLOW, and DSPCMD_STOP_DATAFLOW.

Referenced by cmdNeedsAck(), and DispatcherCMD().

294  {
295  // Setup the command with default parameters
296  aCommand.cmd = cmd;
297 
298  switch(cmd){
299  // This block of commands have no parameter
300  case DSPCMD_IDENT:
301  case DSPCMD_DATA_VERSION:
304  case DSPCMD_NEXT_EVENT:
306  break;
307  // This block of commands take one parameter
309  aCommand.data.push_back(-1);
310  break;
312  aCommand.data.push_back(DEFAULT_MAX_EVENTS);
313  break;
318  // This block of commands take two parameters
319  case DSPCMD_SET_PRESCALE:
322  break;
323  default:
324  break;
325  }//endswitch
326  return;
327 }
DispatcherCommands cmd
Definition: DispatcherCmd.h:61
std::vector< int32_t > data
Definition: DispatcherCmd.h:62
string cmd
Definition: run_hadd.py:52
ssize_t DispatcherCMD::write ( )

Definition at line 126 of file DispatcherCmd.cpp.

References buff8, buff8_base, external_buff, and internal_buff.

Referenced by daq2raw::NOvASocketInputDriver::readFile(), and daq2raw::NOvASocketInputDriver::readNext().

126  {
127  ssize_t cmdsize;
128 
129  // Calculate the length of the command
130  cmdsize = buff8 - buff8_base + 1;
131 
132  // Copy the serialized command out to the external buffer
133  memcpy(external_buff, internal_buff, cmdsize);
134 
135  return cmdsize;
136 }
uint8_t * buff8_base
uint8_t * buff8
uint8_t internal_buff[256]
Pointer to the external output buffer.
void * external_buff

Member Data Documentation

union { ... }

256byte internal buffer for serialization

union { ... }
union { ... }
bool DispatcherCMD::Acknowledge_flag
private

A command.

Definition at line 135 of file DispatcherCmd.h.

Referenced by DispatcherCMD(), Init(), and serializeCmd().

DspCmd DispatcherCMD::aCommand
private
void* DispatcherCMD::buff

Definition at line 155 of file DispatcherCmd.h.

Referenced by DispatcherCMD(), Init(), and reset().

uint16_t* DispatcherCMD::buff16

Definition at line 157 of file DispatcherCmd.h.

uint16_t* DispatcherCMD::buff16_base

Definition at line 144 of file DispatcherCmd.h.

uint32_t* DispatcherCMD::buff32

Definition at line 158 of file DispatcherCmd.h.

Referenced by deserializeCmd(), and serializeCmd().

uint32_t* DispatcherCMD::buff32_base

Definition at line 145 of file DispatcherCmd.h.

uint8_t* DispatcherCMD::buff8

Definition at line 156 of file DispatcherCmd.h.

Referenced by deserializeCmd(), Init(), reset(), serializeCmd(), and write().

uint8_t* DispatcherCMD::buff8_base

Definition at line 143 of file DispatcherCmd.h.

Referenced by serializeCmd(), and write().

void* DispatcherCMD::buff_base

Definition at line 142 of file DispatcherCmd.h.

Referenced by DispatcherCMD(), Init(), and reset().

void* DispatcherCMD::external_buff
private

Definition at line 137 of file DispatcherCmd.h.

Referenced by DispatcherCMD(), getExternalBuffer(), Init(), and write().

uint8_t DispatcherCMD::internal_buff[256]
private

Pointer to the external output buffer.

Definition at line 138 of file DispatcherCmd.h.

Referenced by deserializeCmd(), DispatcherCMD(), Init(), reset(), and write().

uint8_t DispatcherCMD::magicNumberBytes[8]

Definition at line 150 of file DispatcherCmd.h.

uint32_t DispatcherCMD::magicNumberWord[2]

Definition at line 149 of file DispatcherCmd.h.

Referenced by deserializeCmd().


The documentation for this class was generated from the following files: