MIDAS
Loading...
Searching...
No Matches
minirc.c
Go to the documentation of this file.
1
/********************************************************************\
2
3
Name: minirc.c
4
Created by: Stefan Ritt
5
6
Contents: A "Mini-Run Control" program showing the basic concept
7
of starting/stopping runs in the MIDAS system
8
9
$Id$
10
11
\********************************************************************/
12
13
#include <stdio.h>
14
#include <stdlib.h>
15
#include "
midas.h
"
16
17
/*------------------------------------------------------------------*/
18
19
int
main
()
20
{
21
INT
run_number
,
status
;
22
char
host_name
[256];
23
char
str
[256];
24
25
printf(
"Host to connect: "
);
26
ss_gets
(
host_name
, 256);
27
28
/* connect to experiment */
29
status
=
cm_connect_experiment
(
host_name
,
""
,
"MiniRC"
, NULL);
30
if
(
status
!=
CM_SUCCESS
)
31
return
1;
32
33
printf(
"Enter run number: "
);
34
ss_gets
(
str
, 256);
35
run_number
= atoi(
str
);
36
37
printf(
"Start run\n"
);
38
39
/* start run */
40
if
(
cm_transition
(
TR_START
,
run_number
,
str
,
sizeof
(
str
),
BM_WAIT
,
MT_INFO
) !=
CM_SUCCESS
)
41
printf(
"%s"
,
str
);
42
43
printf(
"Hit RETURN to stop run"
);
44
getchar();
45
46
/* stop run */
47
if
(
cm_transition
(
TR_STOP
,
run_number
,
str
,
sizeof
(
str
),
BM_WAIT
,
MT_INFO
) !=
CM_SUCCESS
)
48
printf(
"%s"
,
str
);
49
50
cm_disconnect_experiment
();
51
52
return
1;
53
}
cm_connect_experiment
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
Definition
midas.cxx:2278
cm_transition
INT cm_transition(INT transition, INT run_number, char *errstr, INT errstr_size, INT async_flag, INT debug_flag)
Definition
midas.cxx:5286
cm_disconnect_experiment
INT cm_disconnect_experiment(void)
Definition
midas.cxx:2846
CM_SUCCESS
#define CM_SUCCESS
Definition
midas.h:582
TR_START
#define TR_START
Definition
midas.h:405
MT_INFO
#define MT_INFO
Definition
midas.h:543
TR_STOP
#define TR_STOP
Definition
midas.h:406
BM_WAIT
#define BM_WAIT
Definition
midas.h:365
ss_gets
char * ss_gets(char *string, int size)
Definition
system.cxx:7770
run_number
INT run_number[2]
Definition
mana.cxx:246
host_name
char host_name[HOST_NAME_LENGTH]
Definition
mana.cxx:242
midas.h
INT
int INT
Definition
midas.h:129
main
int main()
Definition
minirc.c:19
str
char str[256]
Definition
odbhist.cxx:33
status
DWORD status
Definition
odbhist.cxx:39
examples
basic
minirc.c
Generated on Sun May 4 2025 05:01:04 for MIDAS by
1.9.8