#ifndef _TECS_CLI_H_
#define _TECS_CLI_H_

#include "coc_client.h"
/*
  tecs_cli.h: tecs client interface routines

  M. Zolliker March 2000
*/

typedef CocConn *pTecsClient;


pTecsClient TeccInit(char *server, int port);
/*  init tecs client (connect to server)  */

int TeccGet(pTecsClient conn, float *temp);
/*  get temperature  */

int TeccGetX(pTecsClient conn, float *tC, float *tP, float *tDif);
/*  get controlled temperature  */

int TeccGet3(pTecsClient conn, float *tSet, float *tExch, float *tSamp);
/*  get temperatures  */

int TeccGetMult(pTecsClient conn, int argc, char *argv[], void (* outfunc)(char *, void *), void *arg);
/*  get multiple values */

int TeccSet(pTecsClient conn, float temp);
/*  set temperature */

int TeccSend(pTecsClient conn, char *cmd, char *reply, int replyLen);
/*  send a command transparently to the controller
    replyLen is the maximal length of reply */

void TeccClose(pTecsClient conn);
/*  close connection and free ressources */

int TeccQuitServer(pTecsClient conn, int kill);
/*  quit the server process, kill = 0: restart if possible */

/* Fortran interface:

    integer function TECS_INIT(STARTCMD, PORT)      - open server connection
    logical function TECS_IS_OPEN ()                - check if tecs is open
    integer function TECS_GET3(SET_T, REG_T, SAM_T) - read 3 temperatures
    integer function TECS_WAIT()                    - wait for end of configuration
    integer function TECS_SET (TEMP)                - set temperature target
    integer function TECS_GET (TEMP)                - get sample temperature
    integer function TECS_QUIT_SERVER ()            - force server to quit
    integer function TECS_GET_PAR (NAME, PAR)       - get parameter
    integer function TECS_SET_PAR (NAME, PAR)       - set parameter
    integer function TECS_SEND (CMND, REPLY)        - send command to LakeShore
    subroutine TECS_CLOSE                           - close connection to tecs
   
      character*(*) STARTCMD    - command to start server (no restart if empty)
      integer PORT              - port number
      real SET_T,REG_T,SAM_T    - set-temperature, regulation temperature, sample temperature
      real TEMP                 - temperature
      character*(*) NAME        - parameter name
      character*(*) PAR         - parameter value
      character*(*) CMND        - raw command
      character*(*) REPLY       - reply to command

    integer return values are error codes (negative means error, like in most C system routines)
*/

#endif /* _TECS_CLI_H_ */
