Low-Energy Muon (LEM) Experiment  0.5.1
ets_logout.c File Reference
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "midas.h"
#include "tcpip_rs232.h"
#include "ets_logout.h"
Include dependency graph for ets_logout.c:

Go to the source code of this file.

Data Structures

struct  TCPIP_RS232_SETTINGS
 
struct  TCPIP_RS232_INFO
 

Functions

int tcpip_rs232_open (char *host, int port)
 
int tcpip_rs232_exit (TCPIP_RS232_INFO *info)
 
int tcpip_rs232_puts (TCPIP_RS232_INFO *info, char *str)
 
int tcpip_rs232_gets (TCPIP_RS232_INFO *info, char *str, int size, char *pattern, int millisec)
 
int ets_logout_successfull (char *str, int size)
 
int ets_logout (void *info, int wait, int detailed_msg)
 

Function Documentation

int ets_logout ( void *  info,
int  wait,
int  detailed_msg 
)

This routine connects to the rs232 terminal server and logouts the port specified in the ETS_INFO structure. It is needed since the rs232 terminal server sometimes is blocking a port (reason: unkown).

return:

  • 1 (true), if OK
  • 0 (false), if a problem occured
Parameters
infostructure containing data in form of the ETS_INFO structure.
waitwaiting timer in (us) between commands.
detailed_msgflag indicating if detailed messages shall be sent to MIDAS (cm_msg)

Definition at line 113 of file ets_logout.c.

References ets_logout_successfull(), TCPIP_RS232_INFO::fd, TCPIP_RS232_SETTINGS::host, TCPIP_RS232_SETTINGS::port, TCPIP_RS232_INFO::settings, tcpip_rs232_exit(), tcpip_rs232_gets(), tcpip_rs232_open(), and tcpip_rs232_puts().

Referenced by bh_get(), bruker_get(), danfysik_get(), hv_fug_get(), ls340_get(), mirror_get(), twickenham_get(), w6100_get(), and xtc_get().

int ets_logout_successfull ( char *  str,
int  size 
)

The 'string' returned by the ets is not a C like string, since it contains characters '\0'!!
str, originating from the command 'show ports 18 status' (18 is the portnumber an can be any of the 32 ports of the rs232 terminal server) should look like

Port 18: Username:                   Physical Port 18 (Idle)
 Access:                  Dynamic    Current Service:             None
 Status:                     Idle    Current Node:                None
 Sessions:                      0    Current Port:                None
 Input/Output Flow Ctrl:   No/ No    DSR/DTR/CTS/RTS:   No/Yes/Yes/Yes
Local_34>>

return:

  • 1 (true), if the port is 'Idle'
  • 0 (false), otherwise
Parameters
strreturn string from the ets of the command 'show ports xx status', where 'xx' is the port number
sizesize of the return string

Definition at line 62 of file ets_logout.c.

Referenced by ets_logout().

int tcpip_rs232_exit ( TCPIP_RS232_INFO info)

Referenced by ets_logout().

int tcpip_rs232_gets ( TCPIP_RS232_INFO info,
char *  str,
int  size,
char *  pattern,
int  millisec 
)

Referenced by ets_logout().

int tcpip_rs232_open ( char *  host,
int  port 
)

Referenced by ets_logout().

int tcpip_rs232_puts ( TCPIP_RS232_INFO info,
char *  str 
)

Referenced by ets_logout().