- Added a warning for excessive data rates on monitors - Added statistics to devser and thus to scriptcontext - Added byte concatenation to dynstring - Added aborting for reflection generation to fourmess.c - Added data checksum testing to hipadaba, use for update tests - Fixed interrupt discovery in network.c, caused invalid interrupt codes which in turn confused sicscron which had to be fixed too. - Renamed ubcalc into ubcalcint in order to reclaim the ubcalc for Jurg - Added an a3offset to tasub in order to fix what I perceive an IS problem - Added support for the newer version of the Siemens SPS, the S7 - Added a not yet fully working sinqhttpopt driver which talks to http HM without libghttp SKIPPED: psi/delcam.c psi/make_gen psi/psi.c psi/sinq.c psi/sinq.h psi/sinqhttpopt.c psi/slsvme.c psi/spss7.c
104 lines
3.3 KiB
C
104 lines
3.3 KiB
C
#ifndef ASCON_H
|
|
#define ASCON_H
|
|
|
|
#include "sics.h"
|
|
|
|
/** \file
|
|
* \brief Asynchronous connection handling for devices controlled over tcp-ip
|
|
* connections. Interface for higher level modules.
|
|
*/
|
|
|
|
/** \brief the asynchronous connection
|
|
*/
|
|
typedef struct Ascon Ascon;
|
|
|
|
/** \brief the possible results of AsconTask
|
|
*/
|
|
typedef enum {
|
|
AsconOffline,
|
|
AsconUnconnected,
|
|
AsconPending,
|
|
AsconReady,
|
|
AsconFailure
|
|
} AsconStatus;
|
|
|
|
/** \brief make a new asynchronous connection
|
|
* \param con the SICS connection
|
|
* \param argc number of arguments
|
|
* \param argv the arguments. argv[0] must be the protocol name, the other arguments
|
|
* are protocol specific, but argv[1] is usually host::port
|
|
* \return the created connection or NULL on failure
|
|
*/
|
|
Ascon *AsconMake(SConnection * con, int argc, char *argv[]);
|
|
|
|
/** \brief kill function
|
|
* \param a the connection to be killed
|
|
*/
|
|
void AsconKill(Ascon * a);
|
|
/** \brief disconnect and disable
|
|
* \param a the connection to disconnect
|
|
*/
|
|
void AsconDisconnect(Ascon * a);
|
|
|
|
/** \brief Reconnect function
|
|
* \param a the connection to reconnect
|
|
* \param hostport <host>:<port> to reconnect to (empty for reconnecting to the same port)
|
|
*/
|
|
void AsconReconnect(Ascon * a, char *hostport);
|
|
|
|
/** \brief the task handler. To be called repeatedly.
|
|
* \param a the connection
|
|
* \return the state of the connection
|
|
*/
|
|
AsconStatus AsconTask(Ascon * a);
|
|
|
|
/** \brief write to the connection. allowed only when the state is AsconReady
|
|
* \param a the connection
|
|
* \param command the command to be sent
|
|
* \param noResponse 0 normally, 1 if no reponse is expected
|
|
* \return 1 on success, 0 when not ready
|
|
*/
|
|
int AsconWrite(Ascon * a, char *command, int noResponse);
|
|
|
|
/** \brief read from the connection. allowed only when a response is available
|
|
* \param a the connection
|
|
* \return the response when a response is ready
|
|
* NULL when the command has not completed and the response is not yet finished
|
|
* "" when the command has completed, but no response was expected.
|
|
* The result is only valid until the next call to any AsconXxx function
|
|
* with the same connection and has to be duplicated if needed later.
|
|
*/
|
|
char *AsconRead(Ascon * a);
|
|
|
|
/** \brief get the last error message
|
|
* \return the error message
|
|
* The result is only valid until the next call to any AsconXxx function
|
|
* with the same connection and has to be duplicated if needed later.
|
|
*/
|
|
char *AsconGetError(Ascon *a);
|
|
|
|
/** \brief a helper function
|
|
* \param argc the number of args
|
|
* \param argv the args to be concatenated
|
|
* \result a allocated string containing the concatenated arguments
|
|
* the args are properly quoted to be used as tcl proc arguments
|
|
*/
|
|
char *ConcatArgs(int argc, char *argv[]);
|
|
|
|
/** \brief emit an error message. The state switches to AsconFailed.
|
|
* \param a the connection
|
|
* \param msg, a message to be emitted
|
|
* \param errorno, for user messages, this should be 0. After
|
|
* detection of a system error, eerno may be placed as argument
|
|
* for adding strerror(errno) to the message.
|
|
*/
|
|
void AsconError(Ascon *a, char *msg, int errorno);
|
|
|
|
/**
|
|
* \brief return the last ascon state. Only used for statistics
|
|
* \param a The Adcon to query
|
|
* \return the AsconState as an integer.
|
|
*/
|
|
int AsconLastState(Ascon *a);
|
|
#endif
|