DummySocket Class Reference#include <DummySocket.h>
Inheritance diagram for DummySocket:
[legend]List of all members.
Detailed Description
Tekkotsu wireless DummySocket class.
This class provides a DummySocket that doesn't really do anything It exists to maintain code readability; while supporting dogs without wireless Of course, since it does nothing, it doesn't need documentation
Definition at line 16 of file DummySocket.h.
|
Public Member Functions |
| DummySocket (int sockn) |
| constructor
|
virtual | ~DummySocket () |
byte * | getWriteBuffer (int bytesreq) |
void | write (int size) |
| writes the specified number of bytes starting at the pointer returned.
|
int | read () |
| Blocking read.
|
byte * | getReadBuffer () |
| getReadBuffer is used with blocking read's
|
void | init () |
| initialize socket member variables. This is different from the constructor since sockets are reused
|
int | setFlushType (FlushType_t fType) |
| Chooses between blocking and non-blocking input, output.
|
void | setTextForward () |
| causes this socket to forward output to stdout if it is not connected, call setForward(NULL) to unset
|
void | setForward (DummySocket *forsock) |
| sets another socket to send data to if this one is not connected
|
void | setVerbosity (int verbose) |
| Picks a level of verbosity for filtering pprintf commands.
|
int | write (const byte *buf, int size) |
int | read (byte *buf, int size) |
| Blocking read.
|
int | printf (const char *fmt,...) |
int | vprintf (const char *fmt, va_list al) |
int | pprintf (int vlevel, const char *fmt,...) |
| Similar to printf, except it takes an extra first argument.
|
void | flush () |
Friends |
class | Wireless |
Constructor & Destructor Documentation
DummySocket::DummySocket |
( |
int |
sockn |
) |
[inline] |
|
virtual DummySocket::~DummySocket |
( |
|
) |
[inline, virtual] |
|
Member Function Documentation
void DummySocket::flush |
( |
|
) |
[inline] |
|
|
All write commands on the socket will implicity call this. You don't need to call it, unless you're implementing your own write
Reimplemented from Socket.
Definition at line 37 of file DummySocket.h. |
byte* DummySocket::getReadBuffer |
( |
|
) |
[inline] |
|
|
getReadBuffer is used with blocking read's
The read(void) and getReadBuffer combo eliminates one buffer copy. You don't need to use getReadBuffer with read(byte*, int)
Blocking read is currently broken - it will be fixed in the next release - Returns:
- pointer to the buffer the previous call to blocking read wrote into or NULL if no data was read
Reimplemented from Socket.
Definition at line 26 of file DummySocket.h. |
byte* DummySocket::getWriteBuffer |
( |
int |
bytesreq |
) |
[inline] |
|
|
The getWriteBuffer-write(int) combo eliminates one buffer copy. You don't need to use getWriteBuffer with write(byte*, int) - Returns:
- pointer to the current position in the current write buffer for this socket or NULL on error
- Parameters:
-
| bytesreq | maximum number of bytes the caller intends to set before the write method is called |
Reimplemented from Socket.
Definition at line 23 of file DummySocket.h. |
void DummySocket::init |
( |
|
) |
[inline] |
|
|
initialize socket member variables. This is different from the constructor since sockets are reused
Reimplemented from Socket.
Definition at line 27 of file DummySocket.h. |
int DummySocket::pprintf |
( |
int |
vlevel, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
[inline] |
|
|
Similar to printf, except it takes an extra first argument.
If vlevel is than or equal to the current verbosity level, the string will be printed else it will be ignored - Parameters:
-
| vlevel | if (vlevel<=verbosity) print, else ignore |
| fmt | same as the standard printf's format string |
Reimplemented from Socket.
Definition at line 36 of file DummySocket.h. |
int DummySocket::printf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
[inline] |
|
|
It's standard stuff. man 3 printf on most systems should give you more information
Reimplemented from Socket.
Definition at line 34 of file DummySocket.h. |
int DummySocket::read |
( |
byte * |
buf, |
|
|
int |
size |
|
) |
[inline] |
|
|
Blocking read.
You might want to consider the read(void) and getReadBuffer combo if you call this often
Blocking read is currently broken - it will be fixed in the next release - Parameters:
-
| buf | buffer to write from |
| size | number of bytes to write |
- Returns:
- number of bytes actually read
Reimplemented from Socket.
Definition at line 33 of file DummySocket.h. |
int DummySocket::read |
( |
|
) |
[inline] |
|
|
Blocking read.
Tries to read upto receive buffer size worth of data from this socket.
Blocking read is currently broken - it will be fixed in the next release - Returns:
- number of bytes read or -1 on error
Reimplemented from Socket.
Definition at line 25 of file DummySocket.h. |
int DummySocket::setFlushType |
( |
FlushType_t |
fType |
) |
[inline] |
|
|
Chooses between blocking and non-blocking input, output.
This function can only be called when a socket is disconnected, since it is a bad idea to mix blocking and non-blocking input, output. The default for a socket is non-blocking - Returns:
- 0 on success
Reimplemented from Socket.
Definition at line 28 of file DummySocket.h. |
void DummySocket::setForward |
( |
DummySocket * |
forsock |
) |
[inline] |
|
|
sets another socket to send data to if this one is not connected
Definition at line 30 of file DummySocket.h. |
void DummySocket::setTextForward |
( |
|
) |
[inline] |
|
|
causes this socket to forward output to stdout if it is not connected, call setForward(NULL) to unset
Reimplemented from Socket.
Definition at line 29 of file DummySocket.h. |
void DummySocket::setVerbosity |
( |
int |
verbose |
) |
[inline] |
|
|
Picks a level of verbosity for filtering pprintf commands.
The higher the verbosity, the more the number of messages printed. This is useful for filtering out non-important messages with very little processor cost. Default is 0. - Parameters:
-
| verbose | the higher the value of verbose, the more the output |
Reimplemented from Socket.
Definition at line 31 of file DummySocket.h. |
int DummySocket::vprintf |
( |
const char * |
fmt, |
|
|
va_list |
al |
|
) |
[inline] |
|
|
It's standard stuff. man 3 printf on most systems should give you more information
Reimplemented from Socket.
Definition at line 35 of file DummySocket.h. |
int DummySocket::write |
( |
const byte * |
buf, |
|
|
int |
size |
|
) |
[inline] |
|
|
You might want to consider the getWriteBuffer-write(int) combo if you call this often - Parameters:
-
| buf | buffer to write from |
| size | number of bytes to write |
- Returns:
- the number of bytes actually written or -1 on error
Reimplemented from Socket.
Definition at line 32 of file DummySocket.h. |
void DummySocket::write |
( |
int |
size |
) |
[inline] |
|
|
writes the specified number of bytes starting at the pointer returned.
in a (prior) call to getWriteBufer - Parameters:
-
| size | number of bytes to be sent from the current write buffer |
Reimplemented from Socket.
Definition at line 24 of file DummySocket.h. |
Friends And Related Function Documentation
The documentation for this class was generated from the following file:
|