/home/ciesla/projects/svn.openrobotino.org/openrobotino1/lib/rec/robotino/com/c/Com.h File Reference

In "rec/robotino/com/c/Com.h" you can find functions for manipulating the communication interface to Robotino. More...

#include "rec/robotino/com/c/globals.h"
#include "rec/robotino/com/c/AnalogInput.h"
#include "rec/robotino/com/c/Bumper.h"
#include "rec/robotino/com/c/Camera.h"
#include "rec/robotino/com/c/DigitalInput.h"
#include "rec/robotino/com/c/DigitalOutput.h"
#include "rec/robotino/com/c/DistanceSensor.h"
#include "rec/robotino/com/c/EncoderInput.h"
#include "rec/robotino/com/c/Gripper.h"
#include "rec/robotino/com/c/Info.h"
#include "rec/robotino/com/c/Motor.h"
#include "rec/robotino/com/c/NorthStar.h"
#include "rec/robotino/com/c/Odometry.h"
#include "rec/robotino/com/c/OmniDrive.h"
#include "rec/robotino/com/c/PowerManagement.h"
#include "rec/robotino/com/c/PowerOutput.h"
#include "rec/robotino/com/c/Relay.h"
#include "rec/robotino/com/c/LaserRangeFinder.h"
#include "rec/robotino/com/c/Manipulator.h"

Go to the source code of this file.

Defines

#define INVALID_COMID   -1

Typedefs

typedef int ComId

Functions

DLLEXPORT ComId Com_construct ()
DLLEXPORT BOOL Com_destroy (ComId id)
DLLEXPORT BOOL Com_setAddress (ComId id, const char *address)
DLLEXPORT BOOL Com_address (ComId id, char *addressBuffer, unsigned int addressBuffersSize)
DLLEXPORT BOOL Com_setImageServerPort (ComId id, int port)
DLLEXPORT BOOL Com_connect (ComId id)
DLLEXPORT BOOL Com_disconnect (ComId id)
DLLEXPORT BOOL Com_isConnected (ComId id)


Detailed Description

In "rec/robotino/com/c/Com.h" you can find functions for manipulating the communication interface to Robotino.

Use Com_construct() to create a new com object. Set the IP-address of Robotino with Com_setAddress(). Com_connect() establishes the connection.

include "rec/robotino/com/c/Com.h"

ComId com;

int main( int argc, char **argv )
{
  com = Com_construct();

  if( argc > 1 )
  {
    Com_setAddress( com, argv[1] );
  }
  else
  {
    Com_setAddress( com, "172.26.1.1" );
  }

  if( FALSE == Com_connect( com ) )
  {
    exit( 1 );
  }
  else
  {
    char addressBuffer[256];
    Com_address( com, addressBuffer, 256 );
    printf( "Connected to %s\n", addressBuffer );
  }

  Com_destroy( com );

  return 0;
}

Function Documentation

DLLEXPORT BOOL Com_address ( ComId  id,
char *  addressBuffer,
unsigned int  addressBuffersSize 
)

Parameters:
id The ComId returned by Com_construct().
addressBuffer Will contain the currently active server address set with Com_setAddress() as '' terminated string.
addressBuffersSize The size of addressBuffer.
Returns:
Returns TRUE (1) on success. Returns FALSE (0) if the given ComId is invalid or if addressBuffer is to small to contain the address string.
See also:
Com_setAddress

DLLEXPORT BOOL Com_connect ( ComId  id  ) 

Establish the communication. Call Com_setAddress() first.

Parameters:
id The ComId returned by Com_construct().
Returns:
Returns TRUE (1) on success. Returns FALSE (0) if the given ComId is invalid.

DLLEXPORT ComId Com_construct (  ) 

Construct an interface for communicating to one Robotino

Returns:
Returns the ID of the newly constructed communication interface.

DLLEXPORT BOOL Com_destroy ( ComId  id  ) 

Destroy the communication interface assigned to id

Parameters:
id The id of the communication interface to be destroyed
Returns:
Returns TRUE (1) on success. Returns FALSE (0) if the given ComId is invalid.

DLLEXPORT BOOL Com_disconnect ( ComId  id  ) 

Stop communication.

Parameters:
id The ComId returned by Com_construct().
Returns:
Returns TRUE (1) on success. Returns FALSE (0) if the given ComId is invalid.

DLLEXPORT BOOL Com_isConnected ( ComId  id  ) 

Check if the communication is established.

Parameters:
id The ComId returned by Com_construct().
Returns:
Returns TRUE (1) if the communication is active. Returns FALSE (0) if the communication is inactive or if the given ComId is invalid.

DLLEXPORT BOOL Com_setAddress ( ComId  id,
const char *  address 
)

Parameters:
id The ComId returned by Com_construct().
address A null terminated string containing the (IP)-address (plus port) of Robotino. The default to connect to Robotino is 172.26.1.1 (port can be omitted. To connect to RobotinoSim running at localhost use 127.0.0.1:8080 (or higher ports).
Returns:
Returns TRUE (1) on success. Returns FALSE (0) if the given ComId is invalid.

DLLEXPORT BOOL Com_setImageServerPort ( ComId  id,
int  port 
)

Parameters:
id The ComId returned by Com_construct().
port The image server port. To be able to receive images from Robotino there is a UDP server running on your machine. The default port is 8080, but you might change this.
Returns:
Returns TRUE (1) on success. Returns FALSE (0) if the given ComId is invalid.


Generated on Fri Aug 17 15:09:42 2012 for rec_robotino_com_c by  doxygen 1.5.5