54 lines
1.1 KiB
C
54 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "tecc.h"
|
|
#include "errhdl.h"
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
main(int argc, char *argv[])
|
|
{
|
|
char response[80], cmd[80], device[80];
|
|
float val;
|
|
pTecsClient conn;
|
|
char *res;
|
|
|
|
#ifdef __VMS
|
|
ERR_P(conn=TeccInit("@start_tecs test -p 9753 -l -d ud0:[zolliker.lsc.log]", 9753));
|
|
#else
|
|
ERR_P(conn=TeccInit("TecsServer -p 9753 -l -d log/ &", 9753));
|
|
#endif
|
|
|
|
retry:
|
|
while (1) {
|
|
scanf("%s", cmd);
|
|
if (0==strcmp(cmd,"r")) {
|
|
ERR_I(TeccGet(conn, &val));
|
|
ERR_P(res=TeccGetDev(conn));
|
|
printf("T=%f %s\n", val, res);
|
|
|
|
} else if (0==strcmp(cmd,"s")) {
|
|
|
|
scanf("%f", &val);
|
|
ERR_I(TeccSet(conn, val));
|
|
|
|
} else if (0==strcmp(cmd,"c")) {
|
|
|
|
scanf("%s", cmd);
|
|
ERR_I(TeccSend(conn, cmd, response, sizeof(response)));
|
|
printf("%s\n", response);
|
|
|
|
} else if (0==strcmp(cmd,"d")) {
|
|
|
|
scanf("%s", cmd);
|
|
ERR_I(TeccSetDev(conn, cmd));
|
|
|
|
} else if (0==strcmp(cmd,"q")) {
|
|
|
|
TeccClose(conn);
|
|
exit(1);
|
|
|
|
}
|
|
}
|
|
OnError: ErrShow("Client"); goto retry;
|
|
}
|