-
Notifications
You must be signed in to change notification settings - Fork 2
/
srs_plugin.cc
66 lines (47 loc) · 1.34 KB
/
srs_plugin.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "srs_plugin.h"
#include <daq_device_srs.h>
#include <strings.h>
int srs_plugin::create_device(deviceblock *db)
{
//std::cout << __LINE__ << " " << __FILE__ << " " << db->argv0 << std::endl;
if ( strcasecmp(db->argv0,"device_srs") == 0 )
{
// we need at least 3 params
if ( db->npar <4 ) return 1; // indicate wrong params
int eventtype = atoi ( db->argv1); // event type
int subid = atoi ( db->argv2); // subevent id
if ( db->npar ==4 )
{
daq_device *x = new daq_device_srs( eventtype,
subid,
db->argv3 );
// x->identify();
add_readoutdevice (x);
return 0; // say "we handled this request"
}
else if ( db->npar ==5 )
{
daq_device *x = new daq_device_srs( eventtype,
subid,
db->argv3,
atoi (db->argv4) );
// x->identify();
add_readoutdevice (x);
return 0; // say "we handled this request"
}
}
return -1; // say " this is not our device"
}
void srs_plugin::identify(std::ostream& os, const int flag) const
{
if ( flag <=2 )
{
os << " - SRS Plugin" << std::endl;
}
else
{
os << " - SRS Plugin, provides - " << std::endl;
os << " - device_srs (evttype, subid, IP addr) - readout an SRS crate " << std::endl;
}
}
srs_plugin _sp;