Logical Interfaces

#define FLOW_READ_ONLY   1
#define FLOW_WRITE_ONLY   2
#define FLOW_READ_WRITE   3

Functions

int CreateItf (char *itf_name, int mode)
int CloseItf (int fd)
int WriteItf (int fd, void *buffer, int size)
int ReadItf (int fd, void *buffer, int size)
int GetItfStatus (int fd)

Detailed Description

This section contains all functions related to the utilization of logical interfaces

An logical interface is a flow of data between one object an another. Before using it, it must be created (initialized) by the object, as well as described in the waveform definition file (*.app).


Define Documentation

#define FLOW_READ_ONLY   1

#define FLOW_READ_WRITE   3

#define FLOW_WRITE_ONLY   2


Function Documentation

int CloseItf ( int  fd  ) 

Close Interface

Deallocates interface resources and prevents it for using again. This action is performed automatically by ClosePHAL() function (at exit), however it is a good policy to manually call it for each interface for debuggin purposes.

Parameters:
fd File descriptor to close
Returns:
1 closed ok

0 not closed

int CreateItf ( char *  itf_name,
int  mode 
)

Create Interface

Initializes an interface and allocated necessary resources. After this function has been called you can begin sending and receiving data through the interface. The function returns a file descriptor than will be used later to use the interface.

Parameters:
itf_name Name of the interface. For maximum length, see HW API SYSTEM_STR_MAX_LEN
mode FLOW_READ_ONLY, FLOW_WRITE_ONLY or FLOW_READ_WRITE
Returns:
>0 file descriptor to use the interface

-1 if error

int GetItfStatus ( int  fd  ) 

Obtain Interface Status

Obtain actual interface utilization, i.e. the amount of bytes in the queue

Parameters:
fd File descriptor of the interface
Returns:
>=0 The amount of bytes in the queue

-1 Error

int ReadItf ( int  fd,
void *  buffer,
int  size 
)

Read from an interface

This function reads certain amount of data from a logical interface. The packetization problem is managed internally by ALOE. This means that although the remote object send its information in discrete packets, the receiver can obtain any desired amount of information. If packet has to be splitted or joined, it'll be done by ALOE.

Warning:
: The function is non-blocking.
Parameters:
fd File descriptor of the interface
buffer Pointer where to save the data
size Amount of bytes to be received
Returns:
>0 The amount of bytes received

=0 Any data available

-1 Error receiveing from interface

int WriteItf ( int  fd,
void *  buffer,
int  size 
)

Write to an interface

This function writes certain amount of data into a logical interface. *

Warning:
: The function is non-blocking (if the queue is full, no data will be written)
Parameters:
fd File descriptor of the interface
buffer Pointer for the user data
size Amount of bytes to be written
Returns:
>0 The amount of bytes written

=0 Data could not be written

-1 Error sending through interface


Generated on Thu Jul 29 19:37:21 2010 for ALOESoftwareAPI(SWAPI) by  doxygen 1.5.5