Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

XFuBluetoothNetwork Class Reference

#include <XFuBluetoothNetwork.h>

Inheritance diagram for XFuBluetoothNetwork:

Inheritance graph
[legend]
Collaboration diagram for XFuBluetoothNetwork:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual INT enableClientService ()
 Enables the Bluetooth communication handler and opens it for service.

virtual INT enableServerService (UINT16 aPort)
 Enables the Bluetooth communication handler and opens it for service.

virtual void closeService ()
 Closes the currently active service (communication handler).

virtual void reset ()
 Resets the communication manager.

virtual void runCommunicationScheduler ()
 Runs the communication scheduler.

virtual void clientLost (INT32 aClientId)
 Connection lost handler (XFuClientLost) (callback).

virtual INT32 addClient (XFcAddress *aAddress, INT32 aTimeoutTime=15000)
 Adds a client with the specific address.

virtual XFcClientCommWin * getClient (INT32 aClientId)
 Returns the specified client.

virtual void removeClient (INT32 aClientId)
 Removes the specified client.

virtual void removeAllClients ()
 Removes all clients.

virtual UINT32 getAcceptGameToken ()
 Returns the game token that is checked before new clients are allowed to connect.

virtual void setAcceptGameToken (UINT32 aAcceptGameToken)
 Sets the game token that is checked before new clients are allowed to connect.

virtual void sendGameConnectPacket (INT32 aClientId, UINT32 aGameToken)
 Sends a game connection packet.

virtual XFcDataReceiver * getDefaultDataReceiver ()
 Returns a pointer to the default data receiver.

virtual XFcDataReceiver * getDataReceiver (UINT32 aId)
 Returns the specified data receiver.

virtual INT addDataReceiver (UINT32 aId, XFcDataReceiver *aReceiver)
 Adds a new data receiver.

virtual void setDefaultDataReceiver (XFcDataReceiver *aReceiver)
 Sets the default data receiver.

virtual XFcDataReceiver * removeDataReceiver (UINT32 aId)
 Removes a data receiver.

virtual INT handleSender (const void *aAddress, const CHAR8 *aData, INT32 aLen)
 Handle data from an unknown client (callback).

virtual XFcObjectDataFrame * getPacketFrame (INT32 aClientId, XFCNET_MESSAGE_SLOT aSlot)
 Get packet frame.

virtual XFcObjectDataFrame * getRecentStateFrame (INT32 aClientId, INT32 aRecentId)
 Get recent state frame.

virtual void removeRecentStateFrame (INT32 aClientId, INT32 aRecentId)
 Remove recent state frame.

virtual INT32 getRoundTripTime (INT32 aClientId)
 Returns the round trip time for the specified client.

virtual INT32 send (INT32 aClientId, UINT32 aReceiverId, XFCNET_MESSAGE_SLOT aSlot, XFuSerializable *aSerializable)
 Sends a serializable object to the specified client.

virtual INT32 sendRecentState (INT32 aClientId, UINT32 aReceiverId, INT32 aRecentId, XFuSerializable *aSerializable)
 Sends a serializable object to the specified client as a recent state packet.

virtual void addEventHandler (XFuNetworkEventHandler *aHandler)
 Adds a communication event handler.

virtual void removeEventHandler (XFuNetworkEventHandler *aHandler)
 Removes a communication event handler.

virtual void removeAllEventHandlers ()
 Removes all communication event handlers.

virtual void stopDeviceDiscovery ()
 Stops device discovery.

virtual void stopServerDiscovery ()
 Stops server discovery.

virtual void stopAdvertiser ()
 Stops server advertiser.

virtual INT startDeviceDiscovery ()
 Starts device discovery.

virtual INT startServerDiscovery (const XFcBtAddress *aAddress)
 Starts server discovery, if address is NULL engine will search througth all available bt devices.

virtual INT startAdvertiser (const CHAR8 *aMessage)
 Starts advertiser, if message is NULL default message is used.

virtual void deviceDiscovery (const XFcLinkedList< XFcHostEntry * > &aHostEntry)
 Callback for device discovery.

virtual void deviceDiscovery (const XFcLinkedList< XFcAdvertiser * > &aAdvertiser)
 Callback for server discovery.

virtual ~XFuBluetoothNetwork ()
 Virtual destructor. Closes all open tasks and deletes all created objects.


Static Public Member Functions

XFuBluetoothNetwork * create ()
 Static constructor.


Protected Member Functions

virtual void deleteAllClients ()
 Deletes all clients.

 XFuBluetoothNetwork ()
 Protected constructor.

INT init ()
 Initializes this Bluetooth communication manager.

INT initEnable (UINT16 aPort, INT aIsServer)
 Initializes enable service.


Private Attributes

XFuDynamicArray< XFuNetworkEventHandler * > * mNetworkEventHandlers
 Pointer to array of communication event handlers.

XFcCommunicationScheduler * mCommunicationScheduler
 Pointer to the communication scheduler.

XFcBtHandler * mCommunicationHandler
 Pointer to the communication handler.

XFcBtCommService * mCommunicationService
 Holds pointer to the Bluetooth communication services.

XFcDataReceiver * mDefaultDataReceiver
 Pointer to the default data receiver.

XFcBtServerSearch * mBtServerSearch
 Holds pointer to bt server search.

XFcBtCommService * mService
 Holds bluetooth communication service, needed for bluetooth SDP and first free server port query.

XFcBtHostResolver * mHostResolver
 Holds pointer to bt host resolver.

INT32 mCommunicationHandlerId
 Id of the communication handler.

XFcBtClientWin * mClient
 Array of pointers to clients.

INT32 mClientId
 Holds ClientId, only one client is supported for now.

UINT32 mAcceptGameToken
 Game token that is checked before new clients are allowed to connect.

UINT16 mGamePort
 Holds game port.


Constructor & Destructor Documentation

XFuBluetoothNetwork::XFuBluetoothNetwork   [protected]
 

Protected constructor.

Definition at line 52 of file XFuBluetoothNetwork.cpp.

References mAcceptGameToken, mBtServerSearch, mClient, mClientId, mCommunicationHandler, mCommunicationHandlerId, mCommunicationScheduler, mCommunicationService, mDefaultDataReceiver, mGamePort, mHostResolver, mNetworkEventHandlers, and mService.

XFuBluetoothNetwork::~XFuBluetoothNetwork   [virtual]
 

Virtual destructor. Closes all open tasks and deletes all created objects.

Definition at line 71 of file XFuBluetoothNetwork.cpp.

References closeService(), deleteAllClients(), mHostResolver, mNetworkEventHandlers, mService, and removeAllEventHandlers().


Member Function Documentation

INT32 XFuBluetoothNetwork::addClient XFcAddress *    aAddress,
INT32    aTimeoutTime = 15000
[virtual]
 

Adds a client with the specific address.

Returns:
The client id or XFCNET_CLIENTADD_ERROR if failed.

Implements XFuNetwork.

Definition at line 341 of file XFuBluetoothNetwork.cpp.

References mClient, mClientId, and mCommunicationScheduler.

INT XFuBluetoothNetwork::addDataReceiver UINT32    aId,
XFcDataReceiver *    aReceiver
[virtual]
 

Adds a new data receiver.

Implements XFuNetwork.

Definition at line 305 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

void XFuBluetoothNetwork::addEventHandler XFuNetworkEventHandler   aHandler [virtual]
 

Adds a communication event handler.

Implements XFuNetwork.

Definition at line 317 of file XFuBluetoothNetwork.cpp.

References mNetworkEventHandlers, and XFuDynamicArray< XFuNetworkEventHandler * >::put().

void XFuBluetoothNetwork::clientLost INT32    aClientId [virtual]
 

Connection lost handler (XFuClientLost) (callback).

Definition at line 490 of file XFuBluetoothNetwork.cpp.

References XFuDynamicArray< XFuNetworkEventHandler * >::get(), XFuNetworkEventHandler::handleClientLost(), mNetworkEventHandlers, removeClient(), and XFuDynamicArray< XFuNetworkEventHandler * >::size().

void XFuBluetoothNetwork::closeService   [virtual]
 

Closes the currently active service (communication handler).

Implements XFuNetwork.

Definition at line 211 of file XFuBluetoothNetwork.cpp.

References mCommunicationHandler, mCommunicationScheduler, mService, stopAdvertiser(), stopDeviceDiscovery(), and stopServerDiscovery().

Referenced by initEnable(), reset(), and ~XFuBluetoothNetwork().

XFuBluetoothNetwork * XFuBluetoothNetwork::create   [static]
 

Static constructor.

Definition at line 40 of file XFuBluetoothNetwork.cpp.

References init().

void XFuBluetoothNetwork::deleteAllClients   [protected, virtual]
 

Deletes all clients.

Definition at line 259 of file XFuBluetoothNetwork.cpp.

References mClient, mClientId, and mCommunicationScheduler.

Referenced by initEnable(), reset(), and ~XFuBluetoothNetwork().

void XFuBluetoothNetwork::deviceDiscovery const XFcLinkedList< XFcAdvertiser * > &    aAdvertiser [virtual]
 

Callback for server discovery.

Definition at line 639 of file XFuBluetoothNetwork.cpp.

References XFuDynamicArray< XFuNetworkEventHandler * >::get(), XFuNetworkEventHandler::handleAdvertiseDiscovered(), mNetworkEventHandlers, and XFuDynamicArray< XFuNetworkEventHandler * >::size().

void XFuBluetoothNetwork::deviceDiscovery const XFcLinkedList< XFcHostEntry * > &    aHostEntry [virtual]
 

Callback for device discovery.

Definition at line 622 of file XFuBluetoothNetwork.cpp.

References XFuDynamicArray< XFuNetworkEventHandler * >::get(), XFuNetworkEventHandler::handleDeviceDiscovered(), mNetworkEventHandlers, and XFuDynamicArray< XFuNetworkEventHandler * >::size().

INT XFuBluetoothNetwork::enableClientService   [virtual]
 

Enables the Bluetooth communication handler and opens it for service.

Definition at line 144 of file XFuBluetoothNetwork.cpp.

References initEnable(), mCommunicationHandler, mCommunicationHandlerId, and mCommunicationScheduler.

INT XFuBluetoothNetwork::enableServerService UINT16    aPort [virtual]
 

Enables the Bluetooth communication handler and opens it for service.

Definition at line 161 of file XFuBluetoothNetwork.cpp.

References initEnable(), mClient, mClientId, mCommunicationHandler, mCommunicationHandlerId, and mCommunicationScheduler.

UINT32 XFuBluetoothNetwork::getAcceptGameToken   [virtual]
 

Returns the game token that is checked before new clients are allowed to connect.

Definition at line 230 of file XFuBluetoothNetwork.cpp.

References mAcceptGameToken.

XFcClientCommWin * XFuBluetoothNetwork::getClient INT32    aClientId [virtual]
 

Returns the specified client.

Implements XFuNetwork.

Definition at line 335 of file XFuBluetoothNetwork.cpp.

References mClient.

XFcDataReceiver * XFuBluetoothNetwork::getDataReceiver UINT32    aId [virtual]
 

Returns the specified data receiver.

Implements XFuNetwork.

Definition at line 299 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

XFcDataReceiver * XFuBluetoothNetwork::getDefaultDataReceiver   [virtual]
 

Returns a pointer to the default data receiver.

Implements XFuNetwork.

Definition at line 286 of file XFuBluetoothNetwork.cpp.

References mDefaultDataReceiver.

XFcObjectDataFrame * XFuBluetoothNetwork::getPacketFrame INT32    aClientId,
XFCNET_MESSAGE_SLOT    aSlot
[virtual]
 

Get packet frame.

Implements XFuNetwork.

Definition at line 429 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

Referenced by send(), and sendGameConnectPacket().

XFcObjectDataFrame * XFuBluetoothNetwork::getRecentStateFrame INT32    aClientId,
INT32    aRecentId
[virtual]
 

Get recent state frame.

Implements XFuNetwork.

Definition at line 435 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

Referenced by sendRecentState().

INT32 XFuBluetoothNetwork::getRoundTripTime INT32    aClientId [virtual]
 

Returns the round trip time for the specified client.

Definition at line 423 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

INT XFuBluetoothNetwork::handleSender const void *    aAddress,
const CHAR8 *    aData,
INT32    aLen
[virtual]
 

Handle data from an unknown client (callback).

Definition at line 505 of file XFuBluetoothNetwork.cpp.

References XFuDynamicArray< XFuNetworkEventHandler * >::get(), XFuNetworkEventHandler::handleClientAccepted(), mAcceptGameToken, mClient, mNetworkEventHandlers, removeClient(), and XFuDynamicArray< XFuNetworkEventHandler * >::size().

INT XFuBluetoothNetwork::init   [protected]
 

Initializes this Bluetooth communication manager.

Definition at line 84 of file XFuBluetoothNetwork.cpp.

References XFuDynamicArray< T >::create(), mCommunicationScheduler, and mNetworkEventHandlers.

Referenced by create(), and reset().

INT XFuBluetoothNetwork::initEnable UINT16    aPort,
INT    aIsServer
[protected]
 

Initializes enable service.

Definition at line 118 of file XFuBluetoothNetwork.cpp.

References closeService(), deleteAllClients(), mCommunicationHandler, mGamePort, and mService.

Referenced by enableClientService(), and enableServerService().

void XFuBluetoothNetwork::removeAllClients   [virtual]
 

Removes all clients.

Implements XFuNetwork.

Definition at line 276 of file XFuBluetoothNetwork.cpp.

References mCommunicationHandler, and removeClient().

void XFuBluetoothNetwork::removeAllEventHandlers   [virtual]
 

Removes all communication event handlers.

Implements XFuNetwork.

Definition at line 329 of file XFuBluetoothNetwork.cpp.

References XFuDynamicArray< XFuNetworkEventHandler * >::isEmpty(), mNetworkEventHandlers, and XFuDynamicArray< XFuNetworkEventHandler * >::remove().

Referenced by reset(), and ~XFuBluetoothNetwork().

void XFuBluetoothNetwork::removeClient INT32    aClientId [virtual]
 

Removes the specified client.

Implements XFuNetwork.

Definition at line 379 of file XFuBluetoothNetwork.cpp.

References mClient, mClientId, mCommunicationHandler, and mCommunicationScheduler.

Referenced by clientLost(), handleSender(), and removeAllClients().

XFcDataReceiver * XFuBluetoothNetwork::removeDataReceiver UINT32    aId [virtual]
 

Removes a data receiver.

Implements XFuNetwork.

Definition at line 311 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

void XFuBluetoothNetwork::removeEventHandler XFuNetworkEventHandler   aHandler [virtual]
 

Removes a communication event handler.

Implements XFuNetwork.

Definition at line 323 of file XFuBluetoothNetwork.cpp.

References mNetworkEventHandlers, and XFuDynamicArray< XFuNetworkEventHandler * >::remove().

void XFuBluetoothNetwork::removeRecentStateFrame INT32    aClientId,
INT32    aRecentId
[virtual]
 

Remove recent state frame.

Implements XFuNetwork.

Definition at line 441 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

void XFuBluetoothNetwork::reset   [virtual]
 

Resets the communication manager.

Definition at line 104 of file XFuBluetoothNetwork.cpp.

References closeService(), deleteAllClients(), init(), mAcceptGameToken, and removeAllEventHandlers().

void XFuBluetoothNetwork::runCommunicationScheduler   [virtual]
 

Runs the communication scheduler.

Implements XFuNetwork.

Definition at line 98 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler.

INT32 XFuBluetoothNetwork::send INT32    aClientId,
UINT32    aReceiverId,
XFCNET_MESSAGE_SLOT    aSlot,
XFuSerializable   aSerializable
[virtual]
 

Sends a serializable object to the specified client.

Definition at line 447 of file XFuBluetoothNetwork.cpp.

References getPacketFrame(), and XFuSerializable::serialize().

void XFuBluetoothNetwork::sendGameConnectPacket INT32    aClientId,
UINT32    aGameToken
[virtual]
 

Sends a game connection packet.

Definition at line 242 of file XFuBluetoothNetwork.cpp.

References getPacketFrame().

INT32 XFuBluetoothNetwork::sendRecentState INT32    aClientId,
UINT32    aReceiverId,
INT32    aRecentId,
XFuSerializable   aSerializable
[virtual]
 

Sends a serializable object to the specified client as a recent state packet.

Definition at line 469 of file XFuBluetoothNetwork.cpp.

References getRecentStateFrame(), and XFuSerializable::serialize().

void XFuBluetoothNetwork::setAcceptGameToken UINT32    aAcceptGameToken [virtual]
 

Sets the game token that is checked before new clients are allowed to connect.

Definition at line 236 of file XFuBluetoothNetwork.cpp.

References mAcceptGameToken.

void XFuBluetoothNetwork::setDefaultDataReceiver XFcDataReceiver *    aReceiver [virtual]
 

Sets the default data receiver.

Implements XFuNetwork.

Definition at line 292 of file XFuBluetoothNetwork.cpp.

References mCommunicationScheduler, and mDefaultDataReceiver.

INT XFuBluetoothNetwork::startAdvertiser const CHAR8 *    aMessage [virtual]
 

Starts advertiser, if message is NULL default message is used.

Definition at line 656 of file XFuBluetoothNetwork.cpp.

References mService.

INT XFuBluetoothNetwork::startDeviceDiscovery   [virtual]
 

Starts device discovery.

Definition at line 554 of file XFuBluetoothNetwork.cpp.

References mHostResolver, and stopDeviceDiscovery().

INT XFuBluetoothNetwork::startServerDiscovery const XFcBtAddress *    aAddress [virtual]
 

Starts server discovery, if address is NULL engine will search througth all available bt devices.

Definition at line 579 of file XFuBluetoothNetwork.cpp.

References mBtServerSearch, and mService.

void XFuBluetoothNetwork::stopAdvertiser   [virtual]
 

Stops server advertiser.

Definition at line 688 of file XFuBluetoothNetwork.cpp.

References mService.

Referenced by closeService().

void XFuBluetoothNetwork::stopDeviceDiscovery   [virtual]
 

Stops device discovery.

Definition at line 572 of file XFuBluetoothNetwork.cpp.

References mHostResolver.

Referenced by closeService(), and startDeviceDiscovery().

void XFuBluetoothNetwork::stopServerDiscovery   [virtual]
 

Stops server discovery.

Definition at line 607 of file XFuBluetoothNetwork.cpp.

References mBtServerSearch, and mService.

Referenced by closeService().


Member Data Documentation

UINT32 XFuBluetoothNetwork::mAcceptGameToken [private]
 

Game token that is checked before new clients are allowed to connect.

Definition at line 82 of file XFuBluetoothNetwork.h.

Referenced by getAcceptGameToken(), handleSender(), reset(), setAcceptGameToken(), and XFuBluetoothNetwork().

XFcBtServerSearch* XFuBluetoothNetwork::mBtServerSearch [private]
 

Holds pointer to bt server search.

Definition at line 64 of file XFuBluetoothNetwork.h.

Referenced by startServerDiscovery(), stopServerDiscovery(), and XFuBluetoothNetwork().

XFcBtClientWin* XFuBluetoothNetwork::mClient [private]
 

Array of pointers to clients.

Definition at line 76 of file XFuBluetoothNetwork.h.

Referenced by addClient(), deleteAllClients(), enableServerService(), getClient(), handleSender(), removeClient(), and XFuBluetoothNetwork().

INT32 XFuBluetoothNetwork::mClientId [private]
 

Holds ClientId, only one client is supported for now.

Definition at line 79 of file XFuBluetoothNetwork.h.

Referenced by addClient(), deleteAllClients(), enableServerService(), removeClient(), and XFuBluetoothNetwork().

XFcBtHandler* XFuBluetoothNetwork::mCommunicationHandler [private]
 

Pointer to the communication handler.

Definition at line 55 of file XFuBluetoothNetwork.h.

Referenced by closeService(), enableClientService(), enableServerService(), initEnable(), removeAllClients(), removeClient(), and XFuBluetoothNetwork().

INT32 XFuBluetoothNetwork::mCommunicationHandlerId [private]
 

Id of the communication handler.

Definition at line 73 of file XFuBluetoothNetwork.h.

Referenced by enableClientService(), enableServerService(), and XFuBluetoothNetwork().

XFcCommunicationScheduler* XFuBluetoothNetwork::mCommunicationScheduler [private]
 

Pointer to the communication scheduler.

Definition at line 52 of file XFuBluetoothNetwork.h.

Referenced by addClient(), addDataReceiver(), closeService(), deleteAllClients(), enableClientService(), enableServerService(), getDataReceiver(), getPacketFrame(), getRecentStateFrame(), getRoundTripTime(), init(), removeClient(), removeDataReceiver(), removeRecentStateFrame(), runCommunicationScheduler(), setDefaultDataReceiver(), and XFuBluetoothNetwork().

XFcBtCommService* XFuBluetoothNetwork::mCommunicationService [private]
 

Holds pointer to the Bluetooth communication services.

Definition at line 58 of file XFuBluetoothNetwork.h.

Referenced by XFuBluetoothNetwork().

XFcDataReceiver* XFuBluetoothNetwork::mDefaultDataReceiver [private]
 

Pointer to the default data receiver.

Definition at line 61 of file XFuBluetoothNetwork.h.

Referenced by getDefaultDataReceiver(), setDefaultDataReceiver(), and XFuBluetoothNetwork().

UINT16 XFuBluetoothNetwork::mGamePort [private]
 

Holds game port.

Definition at line 85 of file XFuBluetoothNetwork.h.

Referenced by initEnable(), and XFuBluetoothNetwork().

XFcBtHostResolver* XFuBluetoothNetwork::mHostResolver [private]
 

Holds pointer to bt host resolver.

Definition at line 70 of file XFuBluetoothNetwork.h.

Referenced by startDeviceDiscovery(), stopDeviceDiscovery(), XFuBluetoothNetwork(), and ~XFuBluetoothNetwork().

XFuDynamicArray<XFuNetworkEventHandler*>* XFuBluetoothNetwork::mNetworkEventHandlers [private]
 

Pointer to array of communication event handlers.

Definition at line 49 of file XFuBluetoothNetwork.h.

Referenced by addEventHandler(), clientLost(), deviceDiscovery(), handleSender(), init(), removeAllEventHandlers(), removeEventHandler(), XFuBluetoothNetwork(), and ~XFuBluetoothNetwork().

XFcBtCommService* XFuBluetoothNetwork::mService [private]
 

Holds bluetooth communication service, needed for bluetooth SDP and first free server port query.

Definition at line 67 of file XFuBluetoothNetwork.h.

Referenced by closeService(), initEnable(), startAdvertiser(), startServerDiscovery(), stopAdvertiser(), stopServerDiscovery(), XFuBluetoothNetwork(), and ~XFuBluetoothNetwork().


The documentation for this class was generated from the following files:
   
X-Forge Documentation
Confidential
Copyright © 2002-2003 Fathammer
   
Documentation generated
with doxygen
by Dimitri van Heesch