NDS client API


Classes

struct  DAQDChannel
 Channel data-base entry. More...
struct  DAQDRecHdr
 DAQD header record. More...
class  DAQC_api
 The DAQD socket class. More...
struct  DAQDChannel
 Channel data-base entry. More...
struct  DAQDRecHdr
 DAQD header record. More...
class  DAQSocket
 The DAQD socket class. More...
class  NDS1Socket
 The DAQD socket class. More...
class  NDS2Socket
 The DAQD socket class. More...

Data Access API (C++)

A typical online NDS client would do the following:
    DAQC_api* nds(0);

    //---------  Construct a concrete DAQC_api socket with
    nds = new NDS1Socket;

    //---------  or with
    nds = new NDS2Socket;

    //---------  Open a socket to the specified server port.
    const char* servername = "nds-server:port";
    nds.open(servername);
    if (!nds.TestOpen()) fail("Open failed!");

    //---------  Specify the channel to be read.
    const char* chan = "channel name";
    if (!nds.AddChannel(chan)) fail("Add channel failed!");
    if (nds.RequestOnlineData()) fail("Data Request failed");

    //---------  Specify the channel to be read.
    float* Samples = new float[data_len];
    while (1) {
        int nData = nds.GetData((char*) Samples, data_len);
	if (nData <= 0) break;
        ...  Process data ...
    }
    
brief Access channel data through the network data server
Author:
John Zweizig
Version:
0.1; Last modified March 5, 2008
This API provides a client interface for the "classic" NDS server. It allows the user to get channel data over the network. The syntax implemented by this interface is:
Function DAQSocket method NDS command
Get data from specified time RequestData start net-writer <start> <duration> [{"channel" ...} | all];
Get file names RequestNames start name-writer all;
Get available channel list Available status channels [2];
Get fast online data RequestOnlineData start fast-writer [{"channel" ...} | all];
Get slow online data RequestOnlineData start net-writer [{"channel" ...} | all];
Get trend data RequestTrendData start trend [60] net-writer <start> <duration> [{"channel" ...} | all];
Stop a net-writer StopWriter kill net-writer nnnnnnnn;

The data trasfer protocol is as follows. After connecting to the nds server, the client sends a command. The commands corresponding to each DAQSocket method are listed above. The syntax of the comands are:

       <command> [{<channel-1> [<rate-1>] [... <channel-n> [<rate-n>]]}];
    
Each command is terminated by a semi-colon and a new-line character. Upon receipt of a valid command, the servers replies with a 4-hex-digit ascii response code. a non-zero response code indicates that no further data will be sent for the command. After each writer (frame-writer, name-writer, [trend] net-writer) is started, a writer id is returned as an 8-hex digit ascii string. The writer ID is used by the StopWriter method to terminate the writer. Following this, the writer sends an online/offline mode flag as a binary 4-byte integer valie. A zero value indicates an online writer.

A typical online NDS client would do the following:

    //---------  Construct a DAQD socket 
    DAQSocket nds;

    //---------  Open a socket to the specified server port.
    const char* servername = "nds-server:port";
    nds.open(servername);
    if (!nds.TestOpen()) fail("Open failed!");

    //---------  Specify the channel to be read.
    const char* chan = "channel name";
    if (!nds.AddChannel(chan)) fail("Add channel failed!");
    if (nds.RequestOnlineData()) fail("Data Request failed");

    //---------  Specify the channel to be read.
    float* Samples = new float[data_len];
    while (1) {
        int nData = nds.GetData((char*) Samples, data_len);
	if (nData <= 0) break;
        ...  Process data ...
    }
    
brief Access channel data through the network data server
Author:
John Zweizig
Version:
0.1; Last modified March 5, 2008
This API provides a client interface for the "classic" NDS server. It allows the user to get channel data over the network. The syntax implemented by this interface is:
Function DAQSocket method NDS command
Get data from specified time RequestData start net-writer <start> <duration> [{"channel" ...} | all];
Get file names RequestNames start name-writer all;
Get available channel list Available status channels [2];
Get fast online data RequestOnlineData start fast-writer [{"channel" ...} | all];
Get slow online data RequestOnlineData start net-writer [{"channel" ...} | all];
Get trend data RequestTrendData start trend [60] net-writer <start> <duration> [{"channel" ...} | all];
Stop a net-writer StopWriter kill net-writer nnnnnnnn;

A typical online NDS client would do the following:

    //---------  Construct a DAQD socket 
    DAQSocket nds;

    //---------  Open a socket to the specified server port.
    const char* servername = "nds-server:port";
    nds.open(servername);
    if (!nds.TestOpen()) fail("Open failed!");

    //---------  Specify the channel to be read.
    const char* chan = "channel name";
    if (!nds.AddChannel(chan)) fail("Add channel failed!");
    if (nds.RequestOnlineData()) fail("Data Request failed");

    //---------  Specify the channel to be read.
    float* Samples = new float[data_len];
    while (1) {
    int nData = nds.GetData((char*) Samples, data_len);
    if (nData <= 0) break;
    ...  Process data ...
    }
    
brief Access channel data through the network data server
Author:
John Zweizig
Version:
0.1; Last modified March 5, 2008

Network Data Access (NDS2) API (C++)

This API provides a client interface for the NDS2 server. It allows the user to get channel data over the network. Usage is generally by way of the abstract DAQC_api class. Several server specific methods methods are provided.

The protocol rules are similar to the classic nds server protocol. Each request (including the authentication message) result in a 4 hex digit response code that indicates the status of the request. The

The syntax implemented by this interface is:
Function NDS2Socket method NDS2 command
Get data from specified time RequestData get-data <start> <duration> [<stride>] {<channel-desc> ...};
Get available channel list Available get-channels [<gps>] [<chan-type>] ;
Get continuous stream of online data. RequestOnlineData get-online-data [[<duration>] <stride>] {"channel"...};
Quit session StopWriter quit;

A typical online NDS2 client would do the following:

    //---------  Construct a DAQD socket 
    NDS2Socket nds;

    //---------  Open a socket to the specified server port.
    const char* servername = "nds-server";
    int port(31200);
    nds.open(servername, port);
    if (!nds.isOpen()) fail("Open failed!");

    //---------  Specify the channel to be read.
    const char* chan = "channel name";
    if (!nds.AddChannel(chan, 0.0, _undefined)) fail("Add channel failed!");
    if (nds.RequestData(gpsStart, gpsEnd, 2.0)) fail("Data Request failed");

    //---------  Specify the channel to be read.
    float* Samples = new float[data_len];
    while (1) {
    int nData = nds.GetChannelData(chan, Samples, data_len);
    if (nData <= 0) break;
    ...  Process data ...
    }
    
brief Access channel data through the network data server
Author:
John Zweizig
Version:
0.1; Last modified March 5, 2008

Generated on Sun Mar 8 19:20:55 2009 for dmt by  doxygen 1.5.4