nds2-client - ClientAdministrator  0.16.8
 All Functions Typedefs Enumerations Enumerator Groups Pages
NDS2 Application Program Interface

This module defines the client interface to both versions of the Network Data Server (classic NDS and NDS2). It is based on the "daq_" function set originally defined by Alex Ivanov for the classic NDS. The C-functions provide a low level interface to the server. In general, these must be used to implement the client server protocol defined elsewhere, e.g. here. A new set of client functions maintain a list of channels to be requested, properly formats the NDS server commands and help retrieve the requested data.

The following code snippet demonstrates how to use the nds2 client:

 -- Initialize
 --
 int rc = daq_startup();
 if (rc) {
     printf("global initialization failed\n");
     return 1;
 }

 -- Connect to server
 --
 const char* server = "ldas-pcdev1.ligo.caltech.edu";
 int           port = 31200;
 daq_t daqd;
 rc = daq_connect(&daqd, server, port, nds_v2);
 if (rc) {
     printf("Connection failed with error: %s\n", daq_strerror(rc));
     return 2;
 }

 -- Specify channels
 --
 const char* channel[4] = {
     "H1:DMT-STRAIN",
     "L1:DMT-STRAIN",
     "V1:h16384Hz",
     0
 }

 int i;
 for (i=0; i<4; i++) {
     rc = daq_request_channel(&daqd, channel+i, 0, 0);
 }

 --  Request data
 --
 time_t start_gps = 876543210;
 time_t end_gps   = 876543366;
 time_t delta     = 32;
 rc = daq_request_data(&daqd, start_gps, end_gps, delta);
 if (rc) {
     printf("Data request failed with error: %s\n", daq_strerror(rc));
     return 3;
 }

 --  Read data blocks
 --
 time_t t;
 for (t=start_gps; t<end_gps; t+=delta) {
     rc = daq_recv_next(&daqd);
     if (rc) {
         printf("Receive data failed with error: %s\n", daq_strerror(rc));
         return 4;
     }

     --  Get data
     --
     chan_req_t* stat = daq_get_channel_status(&daqd, channel[1]);
     if (!stat || stat->status <= 0) break;

 }

 --  Disconnect from server
 --
 daq_disconnect(&daqd);

The API is subdivided into the following modules: