PRODUCTS
 


Main Page   Data Structures   File List   Data Fields   Globals  

TeleoInterface.h File Reference

Generic Low Level IO interface. More...

#include "TeleoError.h"
#include "TeleoTypes.h"

Go to the source code of this file.

Data Structures

struct  TeleoInterface
 Teleo Interface. More...


Enumerations

enum  TI_InterfaceType {
  TI_USB, TI_USB0, TI_USB1, TI_USB2,
  TI_USB3, TI_SERIAL, TI_SERIAL0, TI_SERIAL1,
  TI_SERIAL2, TI_SERIAL3, TI_NETWORK
}

Functions

TeleoError TI_Create (cchar *name, TI_InterfaceType interfaceType, TeleoInterface **ti)
 Creates and initializes the interface structure.

TeleoError TI_destroy (TeleoInterface *teleoInterface)
 Destroys the interface.

TeleoError TI_nameGet (TeleoInterface *teleoInterface, cchar **name)
 Allows the user to retrieve the interface name.

TeleoError TI_typeGet (TeleoInterface *teleoInterface, cchar **type)
 Allows the user to get the short name - i.e.

TeleoError TI_blockingSet (TeleoInterface *teleoInterface, bool blocking)
 Control whether the interface does blocking IO or not.

TeleoError TI_open (TeleoInterface *teleoInterface)
 Open the port.

TeleoError TI_close (TeleoInterface *teleoInterface)
 Close the port.

TeleoError TI_get (TeleoInterface *teleoInterface, uint8 *cp, int count)
 Get characters.

TeleoError TI_put (TeleoInterface *teleoInterface, uint8 *cp, int count)
 Put characters.

TeleoError TI_SleepMs (long ms)
 Sleep for the specified ms.


Detailed Description

Generic Low Level IO interface.

Provides the implementation for opening, reading, writing, and closing interfaces of different types

Designed to be linked with the version of TeleoInterfaceXXX.c that is appropriate for the target OS.

Definition in file TeleoInterface.h.


Enumeration Type Documentation

enum TI_InterfaceType
 

Enumeration values:
TI_USB 
TI_USB0 
TI_USB1 
TI_USB2 
TI_USB3 
TI_SERIAL 
TI_SERIAL0 
TI_SERIAL1 
TI_SERIAL2 
TI_SERIAL3 
TI_NETWORK 

Definition at line 34 of file TeleoInterface.h.


Function Documentation

TeleoError TI_blockingSet TeleoInterface   teleoInterface,
bool    blocking
 

Control whether the interface does blocking IO or not.

Parameters:
teleoInterface the interface structure
blocking yes or no
Returns:
TELEO_OK (0) or appropriate error

Definition at line 144 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::blocking, TELEO_OK, and TeleoError.

Referenced by main(), TeleoEasy_Init(), and TeleoModule_Init().

TeleoError TI_close TeleoInterface   teleoInterface
 

Close the port.

Parameters:
teleoInterface the interface structure
Returns:
TELEO_OK (0) or appropriate error

Definition at line 207 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::deviceHandle, TELEO_OK, TeleoError, and TeleoInterfaceInt::terminalSettingsOld.

Referenced by TI_destroy().

TeleoError TI_Create cchar   name,
TI_InterfaceType    interfaceType,
TeleoInterface **    ti
 

Creates and initializes the interface structure.

Does not open the device, since there maybe be configuration to be done first. The name may be omitted. If this happens, the default name for the supplied interface type will be used.

Parameters:
name the device pathname or URI (optional)
interfaceType the type of interface
ti place to return the new interface
Returns:
TELEO_OK (0) or appropriate error

Definition at line 46 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::blocking, TeleoInterfaceInt::interfaceType, TeleoInterfaceInt::name, TELEO_E_ALLOC, TELEO_OK, TeleoError, TI_NETWORK, TI_SERIAL, TI_SERIAL0, TI_SERIAL1, TI_SERIAL2, TI_USB, TI_USB0, TI_USB1, and TI_USB2.

Referenced by main(), TeleoEasy_Init(), and TeleoModule_Init().

TeleoError TI_destroy TeleoInterface   teleoInterface
 

Destroys the interface.

Parameters:
teleoInterface the interface structure

Definition at line 93 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::name, TELEO_OK, TeleoError, and TI_close().

Referenced by TeleoEasy_destroy(), TeleoEasy_End(), and TeleoModule_End().

TeleoError TI_get TeleoInterface   teleoInterface,
uint8   cp,
int    count
 

Get characters.

Currently only permits a single character at a time.

Parameters:
teleoInterface the interface structure
cp pointer to the character
count number of characters to get
Returns:
TELEO_OK (0) or appropriate error

Definition at line 233 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::blocking, TeleoInterfaceInt::deviceHandle, TELEO_E_NOTHING, and TeleoError.

Referenced by doInput(), and main().

TeleoError TI_nameGet TeleoInterface   teleoInterface,
cchar **    name
 

Allows the user to retrieve the interface name.

Parameters:
teleoInterface the interface structure
name pointer to the name pointer
Returns:
TELEO_OK (0) or appropriate error

Definition at line 107 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::name, TELEO_E_NULL_POINTER, TELEO_OK, and TeleoError.

TeleoError TI_open TeleoInterface   teleoInterface
 

Open the port.

Parameters:
teleoInterface the interface structure
Returns:
TELEO_OK (0) or appropriate error

Definition at line 155 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::blocking, TeleoInterfaceInt::deviceHandle, TeleoInterfaceInt::name, TELEO_E_NULL_POINTER, TELEO_E_OPEN, TELEO_OK, TeleoError, TeleoInterfaceInt::terminalSettings, and TeleoInterfaceInt::terminalSettingsOld.

Referenced by main(), TeleoEasy_Init(), and TeleoModule_Init().

TeleoError TI_put TeleoInterface   teleoInterface,
uint8   cp,
int    count
 

Put characters.

Parameters:
teleoInterface the interface structure
cp pointer to the character
count number of characters to put
Returns:
TELEO_OK (0) or appropriate error

Definition at line 264 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::deviceHandle, TELEO_E_IO, TELEO_OK, and TeleoError.

Referenced by output().

TeleoError TI_SleepMs long    ms
 

Sleep for the specified ms.

Parameters:
ms number of milliseconds

Definition at line 280 of file TeleoInterfaceLinux.c.

References TELEO_OK, and TeleoError.

Referenced by doInput(), doTimer(), and main().

TeleoError TI_typeGet TeleoInterface   teleoInterface,
cchar **    type
 

Allows the user to get the short name - i.e.

"ser", "usb", "net", etc.

Parameters:
teleoInterface the interface structure
type the type text pointer
Returns:
TELEO_OK (0) or appropriate error

Definition at line 119 of file TeleoInterfaceLinux.c.

References TeleoInterfaceInt::interfaceType, TELEO_E_NULL_POINTER, TELEO_OK, TeleoError, TI_NETWORK, TI_SERIAL, TI_SERIAL0, TI_SERIAL1, TI_SERIAL2, TI_USB, TI_USB0, TI_USB1, and TI_USB2.

Referenced by main(), TeleoEasy_Init(), and TeleoModule_Init().

 

copyright © 2002, 2003 MakingThings LLC