dag_config_init(3)

NAME
dag_config_reset -This function initialises the DAG card and retrieves a reference to the card for use with other functions in the API.

SYNOPSIS
#include "dag_config.h "

dag_card_ref_t
dag_config_init(const char* device_name);

DESCRIPTION
dag_config_init initialises the DAG card and retrieves a reference to the card for use with other functions in the API

RETURN VALUE
On success dag_config_init returns a reference to DAG card. On failure dag_config_init returns NULL.

EXAMPLES
The following program illustrates how the function is used. It queries the active attributes of all ports on the card and displays the result. For the sake of clarity the error-handling code has been omitted from this example. int main(int argc, const char* argv[]) {

   dag_card_ref_t card_ref = NULL;
   dag_component_t root_component = NULL;
   uint32_t count;
   uint32_t i;

   /* Get a reference to the card. */
   card_ref = dag_config_init("/dev/dag0");
   /* Get a reference to the root component. */
   root_component = dag_config_get_root_component(card_ref);
   /* Find out how many ports the card has. */
   count = dag_component_get_subcomponent_count_of_type(root_component,
   kComponentPort);

   for (i = 0; i < count; i++)
   {
          dag_component_t port = NULL;
          attr_uuid_t active_uuid = 0;
          uint8_t val = 0;
          /* Get a reference to the port. */
          port = dag_component_get_subcomponent(root_component,
            kComponentPort, i);
          /* Get a reference to the active attribute of the port. */
          active_uuid = dag_component_get_config_attribute_uuid(port,
         kBooleanAttributeActive);
          /* Read and display the value of the attribute. */
          val = (uint8_t) dag_config_get_boolean_attribute(card_ref,
           active_uuid);
          printf("Port %u active = %u, i, val);
   }
   /* Dispose of the card. */
   dag_config_dispose(card_ref);
   return EXIT_SUCCESS; }

SEE ALSO
dag_config_default(3),dag_config_reset(3),dag_config_dispose(3)

BUGS
Report bugs to <support@endace.com>.

LAST UPDATED
$Author: $
$Revision: -1 $
$Date: $

COPYRIGHT
(c) 2009 Endace Technology Ltd, Hamilton, New Zealand. All Rights Reserved.