SampleSets are envelopes that carry data used by the Filters in a VanGo
application; they describe the data passing through a filter chain.
SampleSets, among many things, describe the amount of data, the precision of
the data, which channel the data is from, the format of the data, and a
pointer to the data itself.
SampleSet also contain attributes. Attributes are small pieces of information
that add additional data description not provided by the SampleSet core data
structure. Attributes are attached to the SampleSet by the Filters. As the
SampleSet moves thorough the filter chain, filters have access to the
SampleSet data structure, data, and all the attributes.
Example: vango/tos/lib/MotephonesTypes.nc
...
typedef struct sample_set_s {
uint16_t send_mask; // which fields get transmitted
addr_t src;
uint8_t modality;
uint8_t channels;
uint8_t version;
uint8_t format;
uint16_t rate;
uint16_t mean;
uint16_t md;
uint16_t duty_cycle;
timestamp_t timestamp;
uint32_t sample_number; // first sample number in set
length_t sample_count;
uint16_t flags;
attr_block_t *attrs;
void *data;
} __attribute__ ((packed)) sample_set_t;
...
The size of the data buffer in the SampleSet is dynamically calculated during
run time on the mote. The calculation is initiated by the Sampler and done
through the SingleFilter interface built into every filter. (Find out how the
size is determined below.) Each of these SampleSets are individual entities
and are free to move around the filters as dictated by the filter chain. Since
the SampleSets are all created dynamically when the Sampler generates data,
there can be any number of SampleSets traveling through the filter chain
barring memory capacity.
SampleSetM
The SampleSetM module implements all of the common operations on SampleSets.
The modules includes functions to create SampleSets, allocate buffers, add
and manipulate attributes and packetize/unpacketize packets. SampleSetM is
generally the location of the many common function used in the VanGo framework.