17 #include "tcpip_rs232.h"
66 char buffer[512], *pbuf, subbuf[512];
69 memset(buffer, 0,
sizeof(buffer));
74 for (i=0; i<size; i++) {
82 pbuf = strstr(buffer,
"Status:");
87 memset(subbuf, 0,
sizeof(subbuf));
88 strncpy(subbuf, pbuf, 32);
91 if (strstr(subbuf,
"Idle"))
117 char cmd[32], str[1024];
118 int done, count = 0, wait_time = wait;
126 if (bd_info->
fd <= 0)
136 strcpy(cmd,
"s\r\n");
141 strcpy(cmd,
"su\r\n");
146 strcpy(cmd,
"system\r\n");
151 sprintf(cmd,
"logout port %d\r\n", bd_info->
settings.
port-4000);
156 sprintf(cmd,
"show ports %d status\r\n", bd_info->
settings.
port-4000);
169 sprintf(cmd,
"logout \r\n");
174 }
while (!done && (count < 5));
179 cm_msg(MINFO,
"ets_logout",
"ets_logout: logged out port %d of ets %s",
183 cm_msg(MERROR,
"ets_logout",
"ets_logout: couldn't logout port %d of ets %s",
TCPIP_RS232_SETTINGS settings
int tcpip_rs232_gets(TCPIP_RS232_INFO *info, char *str, int size, char *pattern, int millisec)
int tcpip_rs232_open(char *host, int port)
int ets_logout(void *info, int wait, int detailed_msg)
int tcpip_rs232_exit(TCPIP_RS232_INFO *info)
int tcpip_rs232_puts(TCPIP_RS232_INFO *info, char *str)
int fd
device handle for socket device
int ets_logout_successfull(char *str, int size)