/** Example statistics and parameters configuration file. * * This file configures statistics and parameters for our component. We have * two structures to configure: * - struct utils_param params[] for parameters, and * - struct utils_stat stats[] for statistics. * * Read sw_api/include/swapi_utils.h and http://flexnets.upc.edu/trac/wiki/ObjectDeveloperGuide * for more documentation on how to use this file * */ /** Here we declare the variables that will be readed or written. * * In our example, we have 2 variables: * - datatype: It is an initialization parameter that configures the * input and output data types. * * - confBlockLength: Will be used as a parameter and as a statistic. It is * the unique variable that configures our module. Note that * our module can be configured in three ways: Parameteres, * Statistics and control interface. * * If the parameter is not defined the module will not stop. Therefore, we * recommend to initialize the variable to a default value. * */ int datatype=0; int confBlockLength=1024; /** Initialization parameters are retrieved during the INIT phase. They are * configured for every application under the repository/statsman/appName/ * directory on a file for each component with the name componentName.params. * The value indicated in this structure must match the name on the file. * You also have to pass a pointer to the variable where the skeleton will * store the value. */ struct utils_param params[] = { /** Type is represented with an integer, defined at * modules/typetools/include/typetools.h */ { "datatype", /** Parameter name */ STAT_TYPE_INT, /** Data type (see sw_daemons/include/stats.h) */ 1, /** Number of elements */ &datatype}, /** Pointer to the variable to store value */ { "block_length", STAT_TYPE_INT, 1, &confBlockLength}, /** Note that the same pointer is used by stats and parameter */ {NULL, 0, 0, 0}}; /** Statistics are automatically initialized and readed or written. You must * pass a pointer to an integer to store the statId. This id can be used to * manually set or get variable value. * * After initialized, the variable will be initialized to the contents in the * pointer set in this structure. You can manually set to any value, or use * initialization parameters to set an initial value (like in our example). * * The statistics have two automatic methods of reading and writting: * * - READ: to automatically read the contents of the variable * at the beggining of every timeslot (with the contents at value * with fixed length size). * - WRITE: to automatically set the contents of the variable at the end of * every timeslot (with the contents at value with fixed length size). * - OFF: to deactivate automatic reading and writting. Then you will have to * use SWAPI functions (SetStatsValue and GetStatsValue) to use it. */ /** declare first an integer for each variable id */ int idBlockLength,idInSignal,idOutSignal; /** Our component will use integer data representation to work with samples, * declare here an auxiliary buffer */ int input_temp[INPUT_MAX_DATA],output_temp[INPUT_MAX_DATA]; struct utils_stat stats[] = { { "block_length", /** Name of the variable */ STAT_TYPE_INT, /** Type of the variable */ 1, /** Number of elements */ &idBlockLength, /** Pointer to the StatId */ (void*)&confBlockLength, /** Pointer to the data buffer */ READ}, /** We want to GET the value at the begging */ { "output_signal", STAT_TYPE_INT, 100, /** In this case our signal is a buffer */ &idOutSignal, (void*)output_temp, /** Pointer to the data buffer */ WRITE}, /** Now we want to SET the value after processing */ {NULL, 0, 0, 0, 0, 0}};