/* drvNetdev.h * * Example for a networked driver that's suitable for integration * into an EPICS IOC. * * This demo driver is meant to be used with e.g. "netcat": * Run netcat as a TCP server, simulating a networked * device that's awaiting requests. * * The driver will connect to the TCP server and send a request "Value?". * You then have about 2 seconds to type a number. * If you type a number, that's the value that the driver will read. * If you don't type anything useful in time, the driver will time out * and try again later. * * kasemir@lanl.gov */ /* EPICS Base */ #include #include typedef struct { struct sockaddr_in ip; epicsMutexId mutex; /* lock before touching anything else in here! */ int is_valid; /* value is only valid if is_valid > 0 */ int value; /* most recent value from the device */ } drvNetdev; /* Launch a driver thread for the given address (Format: "IP:port"). * The driver will continually try to connect to the address&port. * While connected, it'll send requests. * Whenever receiving a response, it will update the drvNetdev.value. * Any error will show up as drvNetdev.is_valid = 0. */ drvNetdev *drvNetdev_init(const char *address);