55 lines
1.6 KiB
C
55 lines
1.6 KiB
C
/*
|
|
* M U L T I C H A N
|
|
*
|
|
* This module manages communications on a multi-channel controller.
|
|
*
|
|
* A multi-channel controller is one where multiple channels or units are on a
|
|
* single controller and share a single command channel.
|
|
*
|
|
* Douglas Clowes, February 2007
|
|
*
|
|
*/
|
|
#ifndef SICSMULTICHAN
|
|
#define SICSMULTICHAN
|
|
|
|
#define MCC_TIMEOUT -1
|
|
#define MCC_DISCONNECT -2
|
|
#define MCC_RECONNECT -3
|
|
#define MCC_RETRY_CMD -4
|
|
#define MCC_POP_CMD -5
|
|
|
|
typedef struct __MultiChan MultiChan, *pMultiChan;
|
|
|
|
int MultiChanFactory(SConnection *pCon, SicsInterp *pSics,
|
|
void *pData, int argc, char *argv[]);
|
|
|
|
int MultiChanCreate(const char* controller, pMultiChan* handle);
|
|
|
|
int MultiChanCreateHost(const char* host,
|
|
const char* port,
|
|
pMultiChan* handle);
|
|
int MultiChanDestroy(pMultiChan handle);
|
|
|
|
int MultiChanReconnect(pMultiChan handle);
|
|
|
|
mkChannel* MultiChanGetSocket(pMultiChan handle);
|
|
|
|
typedef int (*MCC_Transmit)(void* context);
|
|
typedef int (*MCC_Receive)(void* context, int ch);
|
|
int MultiChanEnque(pMultiChan unit, void* context, MCC_Transmit tx, MCC_Receive rx);
|
|
|
|
int MultiChanWrite(pMultiChan unit, void* buffer, int buflen);
|
|
|
|
typedef void (*MCC_Notify)(void* context, int event);
|
|
void MultiChanSetNotify(pMultiChan unit, void* context, MCC_Notify notify);
|
|
|
|
int MultiChanGetDelay(pMultiChan unit);
|
|
int MultiChanSetDelay(pMultiChan unit, int iDelay);
|
|
int MultiChanGetTimeout(pMultiChan unit);
|
|
int MultiChanSetTimeout(pMultiChan unit, int timeout);
|
|
|
|
int MultiChanAction(SConnection *pCon, SicsInterp *pSics,
|
|
void *pData, int argc, char *argv[]);
|
|
|
|
#endif /* SICSMULTICHAN */
|