TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tsp_data_receiver.h File Reference

#include "tsp_prjcfg.h"
#include "tsp_sample_ringbuf.h"
#include "tsp_group.h"

Go to the source code of this file.

Typedefs

typedef int(* TSP_data_decoder_t )(void *v, char *in_buf)
 Generic function to decode data.


Functions

int TSP_data_receiver_receive (TSP_data_receiver_t _receiver, TSP_groups_t _groups, TSP_sample_ringbuf_t *sample_fifo, int *fifo_full)
 Receive the data coming from the provider.

TSP_data_receiver_t TSP_data_receiver_create (const char *data_address, TSP_sample_callback_t callback, void *user_data)
 Creation of the data receiver data object.

void TSP_data_receiver_prepare_stop (TSP_data_receiver_t _receiver)
 Prepare the receiver to stop.

void TSP_data_receiver_stop (TSP_data_receiver_t _receiver)
 Stop receiving data.

void TSP_data_receiver_destroy (TSP_data_receiver_t _receiver)
 Destroy a data receiver object.

TSP_data_decoder_t TSP_data_receiver_get_double_decoder (void)
 Get the function that's used to decode a double encoded in the data stream.

int TSP_data_receiver_get_double_encoded_size (void)
 Get the size of an encoded double coming from the data stream FIXME : Other functions like this one will have to be implemented when other types are managed.

int TSP_data_receiver_set_read_callback (TSP_data_receiver_t _receiver, TSP_sample_callback_t callback)
 Set the callback function that must be called for each incoming sample.


Detailed Description

Header
/cvsroot/tsp/tsp/src/core/driver/tsp_data_receiver.h,v 1.7 2003/12/27 13:31:01 uid67973 Exp

-----------------------------------------------------------------------

TSP Library - core components for a generic Transport Sampling Protocol.

Copyright (c) 2002 Yves DUFRENNE, Stephane GALLES, Eric NOULARD and Robert PAGNOT

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

-----------------------------------------------------------------------

Project : TSP Maintainer : tsp@astrium-space.com Component : Consumer

-----------------------------------------------------------------------

Purpose : Interface for the functions used to receive and decode the data stream for the requested symbols -----------------------------------------------------------------------

Definition in file tsp_data_receiver.h.


Typedef Documentation

typedef int(* TSP_data_decoder_t)(void* v, char* in_buf)
 

Generic function to decode data.

Definition at line 49 of file tsp_data_receiver.h.

Referenced by TSP_data_receiver_get_double_decoder().


Function Documentation

TSP_data_receiver_t TSP_data_receiver_create const char *  data_address,
TSP_sample_callback_t  callback,
void *  user_data
 

Creation of the data receiver data object.

Parameters:
data_address The data address string (ex : 'hostname:port' for TCP/IP based protocol)
callback The callback function that must be called with the incoming data (set to 0 if not used)
user_data pointer on any custom user data ( set to 0 if not used)

Definition at line 161 of file tsp_data_receiver.c.

References TSP_DATA_RECEIVER_BUFFER_SIZE, TSP_sample_callback_t, and TSP_stream_receiver_create().

Referenced by TSP_consumer_request_sample_init().

void TSP_data_receiver_destroy TSP_data_receiver_t  _receiver  ) 
 

Destroy a data receiver object.

Parameters:
receiver handle that must be destroyed

Definition at line 370 of file tsp_data_receiver.c.

References TSP_stream_receiver_destroy().

Referenced by TSP_consumer_request_sample_destroy().

TSP_data_decoder_t TSP_data_receiver_get_double_decoder void   ) 
 

Get the function that's used to decode a double encoded in the data stream.

This function address is stored by the group object to decode the incoming data as fast as possible. FIXME : Other functions like this one will have to be implemented when other types are managed ( ex : TSP_data_receiver_get_string_decoder, TSP_data_receiver_get_raw_decoder)

Returns:
The address of the decoder function for doubles

Definition at line 385 of file tsp_data_receiver.c.

References TSP_data_decoder_t.

Referenced by TSP_group_create_group_table().

int TSP_data_receiver_get_double_encoded_size void   ) 
 

Get the size of an encoded double coming from the data stream FIXME : Other functions like this one will have to be implemented when other types are managed.

Returns:
The size (bytes) of an encoded double for the data stream

Definition at line 390 of file tsp_data_receiver.c.

Referenced by TSP_group_create_group_table().

void TSP_data_receiver_prepare_stop TSP_data_receiver_t  _receiver  ) 
 

Prepare the receiver to stop.

This function set the receiver in a state, where the it does not complain if the data stream is broken by the provider stream sender.

Parameters:
receiver handle

Definition at line 357 of file tsp_data_receiver.c.

References TSP_stream_receiver_prepare_stop().

Referenced by TSP_consumer_request_sample_destroy().

int TSP_data_receiver_receive TSP_data_receiver_t  _receiver,
TSP_groups_t  _groups,
TSP_sample_ringbuf_t *  sample_fifo,
int *  fifo_full
 

Receive the data coming from the provider.

Parameters:
_groups The group object handle
sample_fifo The ringbuf in which the incoming data must be put
fifo_full (*fifo_full) is set to TRUE when the ringbuf is full

Definition at line 197 of file tsp_data_receiver.c.

References TSP_sample_t::provider_global_index, TSP_sample_t::time, TSP_stream_receiver_is_stopped(), TSP_stream_receiver_receive(), and TSP_sample_t::user_value.

int TSP_data_receiver_set_read_callback TSP_data_receiver_t  _receiver,
TSP_sample_callback_t  callback
 

Set the callback function that must be called for each incoming sample.

Parameters:
_receiver The receiver object handle
callback The callback function address
Returns:
TRUE or FALSE. TRUE = OK

void TSP_data_receiver_stop TSP_data_receiver_t  _receiver  ) 
 

Stop receiving data.

Parameters:
receiver handle

Definition at line 345 of file tsp_data_receiver.c.

References TSP_stream_receiver_stop().

Referenced by TSP_consumer_request_sample_destroy().

Framework Home Page.


Beware !! TSP wave is coming...