Coding commands with Developer's Toolkit for DAPL

This page shows the structure and organization of a processing command.

Command identification
Each code module includes the DTD.H header file and declares the command identity to the DAPL system.

#include "DTDMOD.H"
#include "DTD.H"
#define  COMMAND  "MONITOR"
#define  ENTRY    MONITOR_entry
// Some boilerplate code here

Main function
The main function declares task variables and invokes the task parameter validation. A returned list provides access to runtime interconnections.

int __stdcall  ENTRY (PIB **plib)
{
  void  **argv;
  int     argc, received;
  PIPE  * in_pipe, out_pipe;
  FIRB  * pFirFilter;
  argv = param_process (plib,
    &argc, 3, 3,
    T_PIPE_W, T_VAR_W, T_PIPE_W);

Activate runtime connections
Extract handles from the linkage information provided by the DAPL system. Activate the connections with special function calls.

  in_pipe  = (PIPE *) argv[1];
  limit    = (VAR  *) argv[2];
  out_pipe = (PIPE *) argv[3];
  pipe_open (in_pipe, P_READ);
  pipe_open (out_pipe, P_WRITE);

Initialize
Establish processing state, and construct supplemental elements for internal processes such as filtering.

  pFirFilter = fir_init(pCoeffs,
    iLength, iScale, iDecimate);

Runtime
The main body of the processing command is a continuous cycle: await new data, and when it arrives, fetch and process it. The waiting is automatic. When your processing has nothing to do, the DAPL system will schedule other tasks to run.

  while (1)
  {
    pipe_value_get(in_pipe,
      &pipe_value);
    fir_request(
      pFirFilter,
      &(pipe_value._i16), 1);
    // Your Processing Here...
    pipe_value_put(out_pipe,
      &pipe_value);
  }
} // End main command body

Your processing functions
You invoke your customized processing from the runtime loop, applying specialized data transformations and monitoring processing state.

static void  Special( VAR * pVar )
{
    // Custom processing here!
}