Barry::SocketZero Class Reference

Collaboration diagram for Barry::SocketZero:
[legend]

List of all members.

Public Member Functions

SocketHandle Open (uint16_t socket, const char *password=0)
 Open a logical socket on the device.
void Close (Socket &socket)
 Closes a non-default socket (i.e.

Protected Member Functions

bool SequencePacket (const Data &data)
 Returns true if this is a sequence packet that should be ignored.

Detailed Description

Definition at line 46 of file socket.h.


Member Function Documentation

void Barry::SocketZero::Close ( Socket socket  ) 

Closes a non-default socket (i.e.

non-zero socket number)

The packet sequence is just like Open(), except the command is CLOSE_SOCKET.

Exceptions:
Barry::Error 

Definition at line 526 of file socket.cc.

SocketHandle Barry::SocketZero::Open ( uint16_t  socket,
const char *  password = 0 
)

Open a logical socket on the device.

Both the socket number and the flag are based on the response to the SELECT_MODE command. See Controller::SelectMode() for more info on this.

The packet sequence is normal for most socket operations.

  • Down: command packet with OPEN_SOCKET
  • Up: optional sequence handshake packet
  • Up: command response, which repeats the socket and flag data as confirmation
Exceptions:
Barry::Error Thrown on protocol error.
Barry::BadPassword Thrown on invalid password, or not enough retries left on device.

Definition at line 439 of file socket.cc.

References Barry::Packet::Command().

Referenced by Barry::Mode::Mode::RetryPassword().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Barry::SocketZero::SequencePacket ( const Data data  )  [protected]

Returns true if this is a sequence packet that should be ignored.

This function is used in SocketZero::RawReceive() in order to determine whether to keep reading or not. By default, this function checks whether the packet is a sequence packet or not, and returns true if so. Also, if it is a sequence packet, it checks the validity of the sequence number.

If sequence packets become important in the future, this function could be changed to call a user-defined callback, in order to handle these things out of band.

Definition at line 345 of file socket.cc.


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

Generated on 29 Mar 2010 for Barry by  doxygen 1.6.1