Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

omConnector Class Reference
[GENERIC LIBRARY classes]

#include <omConnector.h>

Inheritance diagram for omConnector:

omObject

Public Member Functions

 omConnector ()
 omConnector (wxString, unsigned short)
 omConnector (omObject *)
 omConnector (omObject *, wxString, unsigned short)
bool Connect ()
void SendMessage (omTCPMessage)
void SendClick ()

Private Member Functions

void OnSocketEvent (wxSocketEvent)
 Called by the event handler.

void OnSocketConnection (wxSocketEvent)

Private Attributes

wxSocketClient * sock
 Socket information.

omObjecttoNotify
 Object to notify.

wxString hostname
 Hostname to connect.

unsigned short service
 Port to connect.

bool connected
 True if connection established.

wxString currentIP
 Current IP, setted after connection.

wxString currentHost
 Store current host name after connection.

int currentPort
 Store current port number after connection.

bool notifyMessages
 flag

omTCPParser tcpParser
wxString incomingMessage
 Partial message.


Detailed Description

TCP/IP Communication object.

This object is used to connect the OpenMAIA Application with the rest of the OpenMAIA system.
Every Application (agent) uses an instance of omConnector object to receive and send message to the other agents of the system.
This object provides basic interfaces for receiving and sending messages.
Messages are sent using SendMessage method of omConnector class.
Messages are received via NotifyMessage event generated from omConnector to an omObject or derived class (see image)

omConnector.png


Constructor & Destructor Documentation

omConnector::omConnector  ) 
 

Builds the omConnector object using defaults:

  • hostname = localhost
  • port = 60201
  • notify messages = false

omConnector::omConnector wxString  host,
unsigned short  port
 

Builds the omConnector object for only message trasmission.

Parameters:
host Host to connect.
port Port.

omConnector::omConnector omObject tn  ) 
 

Builds the omConnector object for only receiving.

Parameters:
tn object to sent NotifyMessage event

omConnector::omConnector omObject tn,
wxString  hn,
unsigned short  p
 

Builds the omConnector object for sending and receiving.

Parameters:
tn object to send NotifyMessage event
hn hostname
p port


Member Function Documentation

bool omConnector::Connect  ) 
 

Connect and register the agent

Returns:
true if the connection was ok

void omConnector::OnSocketConnection wxSocketEvent   )  [private]
 

void omConnector::OnSocketEvent wxSocketEvent   )  [private]
 

Called by the event handler.

void omConnector::SendClick  ) 
 

Send the click event to the connected server

void omConnector::SendMessage omTCPMessage  m  ) 
 

Send a message to the server

Parameters:
m Message to send.


Field Documentation

bool omConnector::connected [private]
 

True if connection established.

wxString omConnector::currentHost [private]
 

Store current host name after connection.

wxString omConnector::currentIP [private]
 

Current IP, setted after connection.

int omConnector::currentPort [private]
 

Store current port number after connection.

wxString omConnector::hostname [private]
 

Hostname to connect.

wxString omConnector::incomingMessage [private]
 

Partial message.

bool omConnector::notifyMessages [private]
 

flag

unsigned short omConnector::service [private]
 

Port to connect.

wxSocketClient* omConnector::sock [private]
 

Socket information.

omTCPParser omConnector::tcpParser [private]
 

omObject* omConnector::toNotify [private]
 

Object to notify.


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