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