#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <math.h>
#include <unistd.h>
#include <stdint.h>
#include "di194.h"
Go to the source code of this file.
Functions | |
| int | socket_make (void) |
| Create server socket, ready for accept(). | |
| void | sighandler (int signal) |
| Control-break handler. Sets global flag to indicate exit request. | |
| int | daq_loop (const int CLIENT_SOCKET, const int USEC_DELAY) |
| Read data, convert to ASCII, send out over port. | |
| void | main_loop (const int usec_delay) |
| Setup a socket, wait for a connection, start streaming. | |
| int | main (int argc, char *argv[]) |
| Driver / test routine to exercise the DI code. | |
Variables | |
| const int | SRV_PORT = 31337 |
| TCP server port. | |
| const int | QUEUE_LENGTH = 64 |
| TCP connection queue length. | |
| bool | do_exit |
| Global boolean set by signal handler to force exit. | |
This file implements a simple daemon process for sourcing data from the DI-194. It waits for a TCP connection to its port, at which point it starts reading data (currently a fixed rate) which it converts to ASCII and sends it out over the port.
Intended use is for testing SOAP, meaning that ASCII will need to become XML/XSIL.
To test this, start di_source and then telnet to localhost, port 31337 - you should see streaming data!
Definition in file di_source.c.
|
||||||||||||
|
Read data, convert to ASCII, send out over port.
Definition at line 159 of file di_source.c. References daq_reading_t::analog, di_close(), di_daq_sync(), di_open(), di_read(), di_start(), daq_reading_t::digital, and do_exit. |
|
||||||||||||
|
Driver / test routine to exercise the DI code.
Too: -p port parsing, will need for USB serial. getopt!
Definition at line 318 of file di_source.c. References do_exit, main_loop(), and sighandler(). |
|
|
Setup a socket, wait for a connection, start streaming.
Definition at line 240 of file di_source.c. References daq_loop(), do_exit, and socket_make(). |
|
|
Control-break handler. Sets global flag to indicate exit request. Assumes Installed in interrupt chain by someone else
Definition at line 139 of file di_source.c. References do_exit. |
|
|
Create server socket, ready for accept().
Definition at line 50 of file di_source.c. References QUEUE_LENGTH, and SRV_PORT. Referenced by main_loop(). |
|
|
Global boolean set by signal handler to force exit.
Definition at line 40 of file di_source.c. |
|
|
TCP connection queue length.
Definition at line 38 of file di_source.c. Referenced by socket_make(). |
|
|
TCP server port.
Definition at line 36 of file di_source.c. Referenced by socket_make(). |
1.3