00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "typedefs.h"
00017 #include <stdio.h>
00018 #include <errno.h>
00019 #include <string.h>
00020 #include <sys/types.h>
00021 #include <ctype.h>
00022 #include <stdlib.h>
00023 #include "sbs_def.h"
00024 #include "sys_def.h"
00025 #include "ml_def.h"
00026 #include "portnum_def.h"
00027 #include "s_daqst.h"
00028 #include "s_setup.h"
00029 #include "s_set_ml.h"
00030 #include "s_set_mo.h"
00031 #include "f_stccomm.h"
00032 #include "f_ut_status.h"
00033
00034 long l_gl_tcp_chan;
00035
00036 int l_status,l;
00037
00038 #define VERSION__DAQST 2
00039 #define VERSION__SETUP 1
00040 #define VERSION__SET_ML 1
00041 #define VERSION__SET_MO 1
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 INTS4 f_mbs_status(CHARS *c_node, s_daqst *ps_daqst)
00058 {
00059 struct s_tcpcomm *ps_tcpcomm;
00060
00061 ps_tcpcomm = (struct s_tcpcomm *) malloc (sizeof( struct s_tcpcomm));
00062 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00063 if (l_status != STC__SUCCESS)
00064 {
00065 free(ps_tcpcomm);
00066 return(-2);
00067 }
00068 l_status = f_ut_status_r (ps_daqst, l_gl_tcp_chan);
00069 f_stc_discclient (l_gl_tcp_chan);
00070 free(ps_tcpcomm);
00071 return l_status;
00072 }
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 INTS4 f_mbs_setup(CHARS *c_node, s_setup *ps_setup)
00090 {
00091 s_daqst *ps_daqst;
00092 struct s_tcpcomm *ps_tcpcomm;
00093
00094 ps_tcpcomm = (struct s_tcpcomm *) malloc (sizeof( struct s_tcpcomm));
00095 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00096 if (l_status != STC__SUCCESS)
00097 {
00098 free(ps_tcpcomm);
00099 return(-2);
00100 }
00101 ps_daqst = (s_daqst *) malloc (sizeof( s_daqst));
00102 l_status = f_ut_status_r (ps_daqst, l_gl_tcp_chan);
00103 f_stc_discclient (l_gl_tcp_chan);
00104 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00105 if (l_status != STC__SUCCESS)
00106 {
00107 free(ps_tcpcomm);
00108 free(ps_daqst);
00109 return(-1);
00110 }
00111 if(ps_daqst->bh_setup_loaded == 0) l_status=-3;
00112 else l_status = f_ut_setup_r (ps_setup, l_gl_tcp_chan);
00113 f_stc_discclient (l_gl_tcp_chan);
00114 free(ps_daqst);
00115 free(ps_tcpcomm);
00116 return l_status;
00117 }
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 INTS4 f_mbs_ml_setup(CHARS *c_node, s_set_ml *ps_set_ml)
00135 {
00136 s_daqst *ps_daqst;
00137 struct s_tcpcomm *ps_tcpcomm;
00138
00139 ps_tcpcomm = (struct s_tcpcomm *) malloc (sizeof( struct s_tcpcomm));
00140 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00141 if (l_status != STC__SUCCESS)
00142 {
00143 free(ps_tcpcomm);
00144 return(-2);
00145 }
00146 ps_daqst = (s_daqst *) malloc (sizeof( s_daqst));
00147 l_status = f_ut_status_r (ps_daqst, l_gl_tcp_chan);
00148 f_stc_discclient (l_gl_tcp_chan);
00149 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00150 if (l_status != STC__SUCCESS)
00151 {
00152 free(ps_tcpcomm);
00153 free(ps_daqst);
00154 return(-1);
00155 }
00156 if(ps_daqst->bh_set_ml_loaded == 0) l_status=-3;
00157 else l_status = f_ut_set_ml_r (ps_set_ml, l_gl_tcp_chan);
00158 f_stc_discclient (l_gl_tcp_chan);
00159 free(ps_tcpcomm);
00160 free(ps_daqst);
00161 return l_status;
00162 }
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 INTS4 f_mbs_mo_setup(CHARS *c_node, s_set_mo *ps_set_mo)
00178 {
00179 s_daqst *ps_daqst;
00180 struct s_tcpcomm *ps_tcpcomm;
00181
00182 ps_tcpcomm = (struct s_tcpcomm *) malloc (sizeof( struct s_tcpcomm));
00183 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00184 if (l_status != STC__SUCCESS)
00185 {
00186 free(ps_tcpcomm);
00187 return(-2);
00188 }
00189 ps_daqst = (s_daqst *) malloc (sizeof( s_daqst));
00190 l_status = f_ut_status_r (ps_daqst, l_gl_tcp_chan);
00191 f_stc_discclient (l_gl_tcp_chan);
00192 l_status = f_stc_connectserver (c_node,PORT__STAT_SERV,&l_gl_tcp_chan,ps_tcpcomm);
00193 if (l_status != STC__SUCCESS)
00194 {
00195 free(ps_tcpcomm);
00196 free(ps_daqst);
00197 return(-1);
00198 }
00199 if(ps_daqst->bh_set_mo_loaded == 0) l_status=-3;
00200 else l_status = f_ut_set_mo_r (ps_set_mo, l_gl_tcp_chan);
00201 f_stc_discclient (l_gl_tcp_chan);
00202 free(ps_tcpcomm);
00203 free(ps_daqst);
00204 return l_status;
00205 }
00206
00207