Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Wireless Class Reference

#include <Wireless.h>

List of all members.


Detailed Description

Tekkotsu wireless class.

For more information on using wireless, please read the following tutorials:

The networking interface needs more documentation. It also needs a cleanup. In the mean time, take a look at the TekkotsuMon objects in Tekkotsu/Behaviors/Mon. They all listen for new connections. Unfortunately, at the momement there are no examples of outgoing connections, but it should give you a pretty good idea how to start moving.

Definition at line 36 of file Wireless.h.

Public Member Functions

 Wireless ()
 constructor - only one wireless object is required per Aperios process.
 ~Wireless ()
 destructor
int listen (int sock, int port)
 The socket waits for incoming connections.
int connect (int sock, const char *ipaddr, int port)
 The socket tries to connect to a specific.
void setReceiver (int sock, int(*rcvcbckfn)(char *, int))
 sets receiver callback for a socket
void setDaemon (int sock, bool val=true)
 sets the socket to be a daemon (recycles on close)
bool getDaemon (int sock)
 sets the socket to be a daemon (recycles on close)
void close (int sock)
 closes and destroys non server, daemon sockets
Socketsocket (TransportType_t ttype)
 Creates a new socket.
Socketsocket (TransportType_t ttype, int recvsize, int sendsize)
bool isConnected (int sock)
 utility function that you can use if you're curious about the state of the socket.
bool isReady (int sock)
 utility function that you can use if you're curious about the state of the socket.
bool hasData (int sock)
 utility function that you can use if you're curious about the state of the socket.
void setReceiver (Socket &sobj, int(*rcvcbckfn)(char *, int))
 helper function for the function with the same name that takes a socket descriptor (int)
void setReceiver (Socket *sobj, int(*rcvcbckfn)(char *, int))
 helper function for the function with the same name that takes a socket descriptor (int)
void setDaemon (Socket &sobj, bool val=true)
 helper function for the function with the same name that takes a socket descriptor (int)
void setDaemon (Socket *sobj, bool val=true)
 helper function for the function with the same name that takes a socket descriptor (int)
bool getDaemon (Socket &sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
bool getDaemon (Socket *sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
int listen (Socket &sobj, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
int listen (Socket *sobj, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
int connect (Socket &sobj, const char *ipaddr, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
int connect (Socket *sobj, const char *ipaddr, int port)
 helper function for the function with the same name that takes a socket descriptor (int)
void close (Socket &sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
void close (Socket *sobj)
 helper function for the function with the same name that takes a socket descriptor (int)
unsigned int getNumInterfaces ()
 helper function for the function with the same name that takes a socket descriptor (int)
uint32 getIPAddress (unsigned int idx=0)
 helper function for the function with the same name that takes a socket descriptor (int)
void receive (int sock, int(*rcvcbckfn)(char *, int))
 function for internal and Socket use. You should not call this
void receive (int sock)
 function for internal and Socket use. You should not call this
void send (int sock)
void blockingSend (int sock)
void ListenCont (void *msg)
void BindCont (void *msg)
void ConnectCont (void *msg)
void SendCont (void *msg)
void ReceiveCont (void *msg)
void CloseCont (void *msg)

Static Public Attributes

static const int WIRELESS_MAX_SOCKETS = 100
 Maximum number of sockets which can be created.
static const int WIRELESS_DEF_RECV_SIZE = 1024
 Default number of bytes to use for receive buffers (overridden by value passed to socket()).
static const int WIRELESS_DEF_SEND_SIZE = 1024
 Default number of bytes to use for send buffers (overridden by value passed to socket()).

Protected Attributes

antStackRef ipstackRef
 private ALOKL_TODO
OID myOID
 private ALOKL_TODO
Socketsockets [WIRELESS_MAX_SOCKETS]
 private ALOKL_TODO
std::list< int > freeSockets
 private ALOKL_TODO
std::list< int > usedSockets
 private ALOKL_TODO

Static Protected Attributes

static const int MAXCONNECTIONS = 5
 the maximum number of connections which can be queued when listening

Private Member Functions

 Wireless (const Wireless &)
 don't call
Wirelessoperator= (const Wireless &)
 don't call

Friends

class Socket


Constructor & Destructor Documentation

Wireless::Wireless  ) 
 

constructor - only one wireless object is required per Aperios process.

MMCombo already creates one. The (global) instance is called wireless, and you can access it by including Wireless/Wireless.h (this file) in your code

Definition at line 20 of file Wireless.cc.

Wireless::~Wireless  ) 
 

destructor

Definition at line 33 of file Wireless.cc.

Wireless::Wireless const Wireless  )  [private]
 

don't call


Member Function Documentation

void Wireless::BindCont void *  msg  ) 
 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 253 of file Wireless.cc.

void Wireless::blockingSend int  sock  ) 
 

Bug:
This doesn't actually seem to block until the message is fully sent... a crash immediately after this will still cause a line or two to be dropped. This is still less dropped than regular send, but doesn't do much good for debugging until we fix this. (if we can...)

Definition at line 358 of file Wireless.cc.

Referenced by Socket::flush().

void Wireless::close Socket sobj  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 115 of file Wireless.h.

void Wireless::close Socket sobj  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 114 of file Wireless.h.

void Wireless::close int  sock  ) 
 

closes and destroys non server, daemon sockets

Definition at line 512 of file Wireless.cc.

Referenced by close(), StewartPlatformBehavior::closeComm(), SpeakerServer::DoStart(), MicrophoneServer::DoStart(), WMMonitorBehavior::DoStop(), WalkControllerBehavior::DoStop(), UPennWalkControllerBehavior::DoStop(), SpiderMachineBehavior::DoStop(), SpeakerServer::DoStop(), SegCamBehavior::DoStop(), RegionCamBehavior::DoStop(), RawCamBehavior::DoStop(), MicrophoneServer::DoStop(), HeadPointControllerBehavior::DoStop(), EStopControllerBehavior::DoStop(), Controller::DoStop(), Aibo3DControllerBehavior::DoStop(), ReceiveCont(), SendCont(), EchoBehavior::teardownNetwork(), and EventLogger::~EventLogger().

void Wireless::CloseCont void *  msg  ) 
 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 569 of file Wireless.cc.

int Wireless::connect Socket sobj,
const char *  ipaddr,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 112 of file Wireless.h.

int Wireless::connect Socket sobj,
const char *  ipaddr,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 110 of file Wireless.h.

int Wireless::connect int  sock,
const char *  ipaddr,
int  port
 

The socket tries to connect to a specific.

Tell the ipstack we want to recieve messages with this function.

Definition at line 137 of file Wireless.cc.

Referenced by connect(), EchoBehavior::processCallback(), EchoBehavior::processEvent(), and ReceiveCont().

void Wireless::ConnectCont void *  msg  ) 
 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 222 of file Wireless.cc.

bool Wireless::getDaemon Socket sobj  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 107 of file Wireless.h.

bool Wireless::getDaemon Socket sobj  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 106 of file Wireless.h.

bool Wireless::getDaemon int  sock  )  [inline]
 

sets the socket to be a daemon (recycles on close)

Definition at line 82 of file Wireless.h.

Referenced by getDaemon().

uint32 Wireless::getIPAddress unsigned int  idx = 0  ) 
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 546 of file Wireless.cc.

Referenced by FlashIPAddrBehavior::setupSequence().

unsigned int Wireless::getNumInterfaces  )  [inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 116 of file Wireless.h.

bool Wireless::hasData int  sock  )  [inline]
 

utility function that you can use if you're curious about the state of the socket.

You shouldn't need to use it, since asking sockets for write and read buffers does the necessary sanity checks

Definition at line 95 of file Wireless.h.

bool Wireless::isConnected int  sock  )  [inline]
 

utility function that you can use if you're curious about the state of the socket.

You shouldn't need to use it, since asking sockets for write and read buffers does the necessary sanity checks

Definition at line 91 of file Wireless.h.

Referenced by Controller::console_callback(), StringInputControl::doReadStdIn(), ControlBase::doReadStdIn(), SegCamBehavior::DoStop(), RawCamBehavior::DoStop(), StewartPlatformBehavior::isConnected(), EventLogger::logImage(), EventLogger::logMessage(), EventLogger::logWebcam(), EchoBehavior::processCallback(), SpiderMachineBehavior::processEvent(), SegCamBehavior::processEvent(), RegionCamBehavior::processEvent(), RawCamBehavior::processEvent(), MicrophoneServer::processEvent(), EventLogger::processEvent(), EchoBehavior::processEvent(), ConnectionMadeTrans::processEvent(), WalkCalibration::refresh(), ValueEditControl< T >::refresh(), ControlBase::refresh(), BatteryCheckControl::refresh(), and EchoBehavior::teardownNetwork().

bool Wireless::isReady int  sock  )  [inline]
 

utility function that you can use if you're curious about the state of the socket.

You shouldn't need to use it, since asking sockets for write and read buffers does the necessary sanity checks

Definition at line 94 of file Wireless.h.

int Wireless::listen Socket sobj,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 109 of file Wireless.h.

int Wireless::listen Socket sobj,
int  port
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 108 of file Wireless.h.

int Wireless::listen int  sock,
int  port
 

The socket waits for incoming connections.

That is, it acts like a server. If a connection is established and later broken, it resumes waiting for new connections if the socket's daemon flag is set.

Definition at line 88 of file Wireless.cc.

Referenced by CloseCont(), WMMonitorBehavior::DoStart(), WalkControllerBehavior::DoStart(), UPennWalkControllerBehavior::DoStart(), StewartPlatformBehavior::DoStart(), SpiderMachineBehavior::DoStart(), SpeakerServer::DoStart(), SegCamBehavior::DoStart(), RegionCamBehavior::DoStart(), RawCamBehavior::DoStart(), MicrophoneServer::DoStart(), HeadPointControllerBehavior::DoStart(), EStopControllerBehavior::DoStart(), Controller::DoStart(), Aibo3DControllerBehavior::DoStart(), EventLogger::EventLogger(), listen(), EchoBehavior::setupNetwork(), and WorldStateSerializerBehavior::WorldStateSerializerBehavior().

void Wireless::ListenCont void *  msg  ) 
 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 186 of file Wireless.cc.

Wireless& Wireless::operator= const Wireless  )  [private]
 

don't call

void Wireless::receive int  sock  ) 
 

function for internal and Socket use. You should not call this

Definition at line 386 of file Wireless.cc.

void Wireless::receive int  sock,
int(*)(char *, int)  rcvcbckfn
 

function for internal and Socket use. You should not call this

Definition at line 410 of file Wireless.cc.

Referenced by ConnectCont(), listen(), ListenCont(), and ReceiveCont().

void Wireless::ReceiveCont void *  msg  ) 
 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 435 of file Wireless.cc.

void Wireless::send int  sock  ) 
 

function called by the Socket objects to actually write data to the network. You should not call this.

Definition at line 282 of file Wireless.cc.

Referenced by Socket::flush().

void Wireless::SendCont void *  msg  ) 
 

callback function for communicating with Aperios Networking Toolkit. You should not call this.

Definition at line 311 of file Wireless.cc.

void Wireless::setDaemon Socket sobj,
bool  val = true
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 105 of file Wireless.h.

void Wireless::setDaemon Socket sobj,
bool  val = true
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 104 of file Wireless.h.

void Wireless::setDaemon int  sock,
bool  val = true
[inline]
 

sets the socket to be a daemon (recycles on close)

Definition at line 80 of file Wireless.h.

Referenced by WMMonitorBehavior::DoStart(), WalkControllerBehavior::DoStart(), UPennWalkControllerBehavior::DoStart(), StewartPlatformBehavior::DoStart(), SpiderMachineBehavior::DoStart(), SpeakerServer::DoStart(), SegCamBehavior::DoStart(), RegionCamBehavior::DoStart(), RawCamBehavior::DoStart(), MicrophoneServer::DoStart(), HeadPointControllerBehavior::DoStart(), EStopControllerBehavior::DoStart(), Controller::DoStart(), Aibo3DControllerBehavior::DoStart(), WMMonitorBehavior::DoStop(), WalkControllerBehavior::DoStop(), UPennWalkControllerBehavior::DoStop(), StewartPlatformBehavior::DoStop(), SpiderMachineBehavior::DoStop(), SpeakerServer::DoStop(), SegCamBehavior::DoStop(), RegionCamBehavior::DoStop(), RawCamBehavior::DoStop(), MicrophoneServer::DoStop(), HeadPointControllerBehavior::DoStop(), EStopControllerBehavior::DoStop(), Controller::DoStop(), Aibo3DControllerBehavior::DoStop(), EventLogger::EventLogger(), setDaemon(), EchoBehavior::setupNetwork(), EchoBehavior::teardownNetwork(), WorldStateSerializerBehavior::WorldStateSerializerBehavior(), and EventLogger::~EventLogger().

void Wireless::setReceiver Socket sobj,
int(*)(char *, int)  rcvcbckfn
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 102 of file Wireless.h.

void Wireless::setReceiver Socket sobj,
int(*)(char *, int)  rcvcbckfn
[inline]
 

helper function for the function with the same name that takes a socket descriptor (int)

Definition at line 100 of file Wireless.h.

void Wireless::setReceiver int  sock,
int(*)(char *, int)  rcvcbckfn
 

sets receiver callback for a socket

Definition at line 378 of file Wireless.cc.

Referenced by WMMonitorBehavior::DoStart(), WalkControllerBehavior::DoStart(), UPennWalkControllerBehavior::DoStart(), StewartPlatformBehavior::DoStart(), SpiderMachineBehavior::DoStart(), SpeakerServer::DoStart(), HeadPointControllerBehavior::DoStart(), EStopControllerBehavior::DoStart(), Controller::DoStart(), Aibo3DControllerBehavior::DoStart(), EchoBehavior::processEvent(), setReceiver(), and EchoBehavior::setupNetwork().

Socket * Wireless::socket TransportType_t  ttype,
int  recvsize,
int  sendsize
 

Parameters:
ttype selects between TCP and UDP
recvsize size of input buffer
sendsize size of output buffer

Definition at line 51 of file Wireless.cc.

Socket * Wireless::socket TransportType_t  ttype  ) 
 

Creates a new socket.

Returns:
pointer to Socket object created
Parameters:
ttype selects between TCP and UDP
See also:
WIRELESS_DEF_RECV_SIZE, WIRELESS_DEF_SEND_SIZE

Definition at line 46 of file Wireless.cc.

Referenced by WMMonitorBehavior::DoStart(), WalkControllerBehavior::DoStart(), UPennWalkControllerBehavior::DoStart(), StewartPlatformBehavior::DoStart(), SpiderMachineBehavior::DoStart(), SpeakerServer::DoStart(), SegCamBehavior::DoStart(), RegionCamBehavior::DoStart(), RawCamBehavior::DoStart(), MicrophoneServer::DoStart(), HeadPointControllerBehavior::DoStart(), EStopControllerBehavior::DoStart(), Controller::DoStart(), Aibo3DControllerBehavior::DoStart(), EventLogger::EventLogger(), EchoBehavior::processEvent(), EchoBehavior::setupNetwork(), and WorldStateSerializerBehavior::WorldStateSerializerBehavior().


Friends And Related Function Documentation

friend class Socket [friend]
 

Definition at line 154 of file Wireless.h.

Referenced by socket().


Member Data Documentation

std::list<int> Wireless::freeSockets [protected]
 

private ALOKL_TODO

Definition at line 172 of file Wireless.h.

Referenced by CloseCont(), socket(), Wireless(), and ~Wireless().

antStackRef Wireless::ipstackRef [protected]
 

private ALOKL_TODO

Definition at line 160 of file Wireless.h.

Referenced by blockingSend(), close(), connect(), getIPAddress(), listen(), receive(), send(), socket(), and Wireless().

const int Wireless::MAXCONNECTIONS = 5 [static, protected]
 

the maximum number of connections which can be queued when listening

Definition at line 155 of file Wireless.h.

OID Wireless::myOID [protected]
 

private ALOKL_TODO

Definition at line 161 of file Wireless.h.

Referenced by close(), connect(), listen(), receive(), send(), and Wireless().

Socket* Wireless::sockets[WIRELESS_MAX_SOCKETS] [protected]
 

private ALOKL_TODO

Definition at line 171 of file Wireless.h.

Referenced by BindCont(), blockingSend(), close(), CloseCont(), connect(), ConnectCont(), getDaemon(), hasData(), isConnected(), isReady(), listen(), ListenCont(), receive(), ReceiveCont(), send(), SendCont(), setDaemon(), setReceiver(), socket(), Wireless(), and ~Wireless().

std::list<int> Wireless::usedSockets [protected]
 

private ALOKL_TODO

Definition at line 173 of file Wireless.h.

Referenced by CloseCont(), socket(), and ~Wireless().

const int Wireless::WIRELESS_DEF_RECV_SIZE = 1024 [static]
 

Default number of bytes to use for receive buffers (overridden by value passed to socket()).

Definition at line 42 of file Wireless.h.

Referenced by socket().

const int Wireless::WIRELESS_DEF_SEND_SIZE = 1024 [static]
 

Default number of bytes to use for send buffers (overridden by value passed to socket()).

Definition at line 45 of file Wireless.h.

Referenced by socket().

const int Wireless::WIRELESS_MAX_SOCKETS = 100 [static]
 

Maximum number of sockets which can be created.

Definition at line 39 of file Wireless.h.

Referenced by blockingSend(), connect(), listen(), receive(), ReceiveCont(), send(), setReceiver(), and Wireless().


The documentation for this class was generated from the following files:

Tekkotsu v2.4.1
Generated Tue Aug 16 16:35:13 2005 by Doxygen 1.4.4