KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
monitor.h File Reference

The monitor module is responsible for sending variables to the remote party based on subscription. More...

#include <stdint.h>
#include <stdbool.h>
#include "vars.h"
#include "util/databuffer.h"

Go to the source code of this file.

Macros

#define MON_MAX_VARS   ( TOTAL_VAR_COUNT )
 Maximum number of variables which can be monitored.
 
#define MON_MAX_BLOB   (559 + TOTAL_VAR_COUNT * 4)
 Maximim blob size.
 

Functions

bool monSubscribeVars (int32_t *varIds, int count, int rate)
 Subscribe to array of variables. More...
 
void monUnsubscribeVars (int32_t *varIds, int count)
 Unsubscribe to array of variables. More...
 
bool monSubscribeVar (int32_t varId, int rate)
 Subscribe to a variable. More...
 
void monUnsubscribeVar (int32_t varId)
 Unsubscribe to a variable. More...
 
int monUpdate (DataBuffer *buffer, int offset, int rate)
 Write update variable information into the specified buffer. More...
 

Detailed Description

The monitor module is responsible for sending variables to the remote party based on subscription.

It does not do any of the actual sending of data it self. It just keeps track of which variables to write.

Author
Vincent van Beveren

Definition in file monitor.h.

Function Documentation

bool monSubscribeVar ( int32_t  varId,
int  rate 
)

Subscribe to a variable.

Parameters
varIdThe variable ID
rateThe rate value
Return values
trueSuccess
falseFailure, see err module

Definition at line 53 of file monitor.c.

bool monSubscribeVars ( int32_t *  varIds,
int  count,
int  rate 
)

Subscribe to array of variables.

Parameters
varIdsThe array of variable IDs
countThe number of variables
rateThe rate value
Return values
trueSuccess
falseFailure, see err module

Definition at line 83 of file monitor.c.

void monUnsubscribeVar ( int32_t  varId)

Unsubscribe to a variable.

If the ID does not exist, it is ignored.

Parameters
varIdThe variable ID

Definition at line 95 of file monitor.c.

void monUnsubscribeVars ( int32_t *  varIds,
int  count 
)

Unsubscribe to array of variables.

If the ID does not exist, it is ignored.

Parameters
varIdsThe array of variable IDs
countThe number of variables
int monUpdate ( DataBuffer buffer,
int  offset,
int  rate 
)

Write update variable information into the specified buffer.

Parameters
bufferBuffer to write into
offsetOffset (variable index) to start from. Begin at 0.
rateThe rate value acts as a filter such that all variables var_rate >= rate will be added to the update packet. For example, is there are variables with rate 1, 2 and 3, providing rate value 3, only variables with 3 will be added. When providing rate 2, variables with rate 2 and 3 will be added.
Return values
-1Error, check error module
0All ok, all variables written
otherWritten up to specified offset

Definition at line 119 of file monitor.c.