Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ArServerHandlerPopup Class Reference

TODO make the callbacks actually happen. More...

#include <ArServerHandlerPopup.h>

List of all members.

Public Types

enum  PopupType {
  NOICON = 0, INFORMATION = 1, WARNING = 2, CRITICAL = 3,
  QUESTION = 4
}

Public Member Functions

 ArServerHandlerPopup (ArServerBase *server)
 Constructor.
void closePopup (ArTypes::Byte4 id, const char *closeMessage)
 Cancels a popup with the ID.
ArTypes::Byte4 createPopup (ArServerHandlerPopupInfo *popupInfo, ArFunctor2< ArTypes::Byte4, int > *callback=NULL)
 Creates a new popup.
void netPopupClicked (ArServerClient *client, ArNetPacket *packet)
 The call from the network that the popup was clicked.
void serverCycleCallback (void)
 Our cycle callback.
virtual ~ArServerHandlerPopup ()
 Destructor.

Protected Attributes

ArMutex myDataMutex
ArTypes::Byte4 myLastID
ArTime myLastTimeCheck
std::map< ArTypes::Byte4,
PopupData * > 
myMap
ArFunctor2C< ArServerHandlerPopup,
ArServerClient *, ArNetPacket * > 
myNetPopupClickedCB
ArServerBasemyServer
ArFunctorC< ArServerHandlerPopupmyServerCycleCB

Classes

class  PopupData


Detailed Description

TODO make the callbacks actually happen.
Examples:

popupExample.cpp.

Definition at line 42 of file ArServerHandlerPopup.h.


Member Enumeration Documentation

enum ArServerHandlerPopup::PopupType
 

Enumeration values:
NOICON  No icon at all.
INFORMATION  Just an informational message.
WARNING  A warning.
CRITICAL  A critical problem (program failure likely).
QUESTION  A question.

Definition at line 61 of file ArServerHandlerPopup.h.


Constructor & Destructor Documentation

ArServerHandlerPopup::ArServerHandlerPopup ArServerBase server  ) 
 

Constructor.

Definition at line 45 of file ArServerHandlerPopup.cpp.

References ArServerBase::addCycleCallback(), ArServerBase::addData(), myLastID, myLastTimeCheck, myNetPopupClickedCB, myServer, myServerCycleCB, netPopupClicked(), serverCycleCallback(), and ArTime::setToNow().

ArServerHandlerPopup::~ArServerHandlerPopup  )  [virtual]
 

Destructor.

Definition at line 78 of file ArServerHandlerPopup.cpp.


Member Function Documentation

void ArServerHandlerPopup::closePopup ArTypes::Byte4  id,
const char *  closeMessage
 

Cancels a popup with the ID.

Definition at line 157 of file ArServerHandlerPopup.cpp.

References ArServerBase::broadcastPacketTcp(), ArBasePacket::byte4ToBuf(), ArFunctor2< P1, P2 >::invoke(), ArMutex::lock(), ArLog::log(), ArServerHandlerPopup::PopupData::myCallback, myDataMutex, ArServerHandlerPopup::PopupData::myID, myMap, myServer, ArBasePacket::strToBuf(), and ArMutex::unlock().

ArTypes::Byte4 ArServerHandlerPopup::createPopup ArServerHandlerPopupInfo popupInfo,
ArFunctor2< ArTypes::Byte4, int > *  callback = NULL
 

Creates a new popup.

this just describes what happens with the popup...

So you pass in a popupInfo for the popup you want and a functor to call when buttons in the popup are pushed, this returns an id for that popup, which you can use to cancel the popup and so you know which popup this is.... the callback (if there is one) will be called when the popup has a button pushed with the id and the number of the button or -1 if the popup timed out or -2 if it was canceled. The popup has a timeout, so that if no clients are connected watching for popups or if no one is paying attention that things can move on easily.

Parameters:
popupInfo the information that describes the popup... this class makes a copy of the information so you can do whatever you want with the information after you've called this function (ie change the button and call it again or whatever)
callback The class will call this function when one of the buttons is pressed in the popup on one of the clients, the callback will be called with the long int being the ID, and the int being the button that is pushed (or -1 if the timeout happened or -2 if it was closed)

Definition at line 110 of file ArServerHandlerPopup.cpp.

References ArServerBase::broadcastPacketTcp(), ArBasePacket::byte4ToBuf(), ArBasePacket::byteToBuf(), ArServerHandlerPopupInfo::getButton0Label(), ArServerHandlerPopupInfo::getButton1Label(), ArServerHandlerPopupInfo::getButton2Label(), ArServerHandlerPopupInfo::getDefaultButtonNumber(), ArServerHandlerPopupInfo::getEscapeButtonNumber(), ArServerHandlerPopupInfo::getIgnoreIdentifier(), ArServerHandlerPopupInfo::getMessage(), ArServerHandlerPopupInfo::getPopupType(), ArServerHandlerPopupInfo::getTitle(), ArMutex::lock(), myDataMutex, myLastID, myMap, ArServerHandlerPopup::PopupData::myPopupInfo, myServer, ArBasePacket::strToBuf(), and ArMutex::unlock().

Referenced by ArServerSimpleComMovementLogging::popupMovementParams(), ArServerSimpleComLogRobotConfig::popupOrigConfig(), SensorDetectPopup::sensorTask(), and ArServerSimplePopup::simplePopup().

void ArServerHandlerPopup::netPopupClicked ArServerClient client,
ArNetPacket packet
 

The call from the network that the popup was clicked.

Definition at line 186 of file ArServerHandlerPopup.cpp.

References ArServerBase::broadcastPacketTcp(), ArBasePacket::byte4ToBuf(), client, ArServerHandlerPopupInfo::getButton0Pressed(), ArServerHandlerPopupInfo::getButton1Pressed(), ArServerHandlerPopupInfo::getButton2Pressed(), ArFunctor2< P1, P2 >::invoke(), ArMutex::lock(), ArLog::log(), ArServerHandlerPopup::PopupData::myCallback, myDataMutex, ArServerHandlerPopup::PopupData::myID, myMap, ArServerHandlerPopup::PopupData::myPopupInfo, myServer, ArBasePacket::strToBuf(), and ArMutex::unlock().

Referenced by ArServerHandlerPopup().

void ArServerHandlerPopup::serverCycleCallback void   ) 
 

Our cycle callback.

Definition at line 230 of file ArServerHandlerPopup.cpp.

References ArServerBase::broadcastPacketTcp(), ArBasePacket::byte4ToBuf(), ArNetPacket::empty(), ArServerHandlerPopupInfo::getTimeout(), ArServerHandlerPopupInfo::getTimeoutString(), ArFunctor2< P1, P2 >::invoke(), ArMutex::lock(), ArTime::mSecSince(), ArServerHandlerPopup::PopupData::myCallback, myDataMutex, ArServerHandlerPopup::PopupData::myID, myLastTimeCheck, myMap, ArServerHandlerPopup::PopupData::myPopupInfo, myServer, ArServerHandlerPopup::PopupData::myStarted, ArTime::secSince(), ArTime::setToNow(), ArBasePacket::strToBuf(), and ArMutex::unlock().

Referenced by ArServerHandlerPopup().


Member Data Documentation

ArMutex ArServerHandlerPopup::myDataMutex [protected]
 

Definition at line 88 of file ArServerHandlerPopup.h.

Referenced by closePopup(), createPopup(), netPopupClicked(), and serverCycleCallback().

ArTypes::Byte4 ArServerHandlerPopup::myLastID [protected]
 

Definition at line 90 of file ArServerHandlerPopup.h.

Referenced by ArServerHandlerPopup(), and createPopup().

ArTime ArServerHandlerPopup::myLastTimeCheck [protected]
 

Definition at line 91 of file ArServerHandlerPopup.h.

Referenced by ArServerHandlerPopup(), and serverCycleCallback().

std::map<ArTypes::Byte4, PopupData *> ArServerHandlerPopup::myMap [protected]
 

Definition at line 89 of file ArServerHandlerPopup.h.

Referenced by closePopup(), createPopup(), netPopupClicked(), and serverCycleCallback().

ArFunctor2C<ArServerHandlerPopup, ArServerClient*, ArNetPacket *> ArServerHandlerPopup::myNetPopupClickedCB [protected]
 

Definition at line 93 of file ArServerHandlerPopup.h.

Referenced by ArServerHandlerPopup().

ArServerBase* ArServerHandlerPopup::myServer [protected]
 

Definition at line 69 of file ArServerHandlerPopup.h.

Referenced by ArServerHandlerPopup(), closePopup(), createPopup(), netPopupClicked(), and serverCycleCallback().

ArFunctorC<ArServerHandlerPopup> ArServerHandlerPopup::myServerCycleCB [protected]
 

Definition at line 94 of file ArServerHandlerPopup.h.

Referenced by ArServerHandlerPopup().


The documentation for this class was generated from the following files:
Generated on Tue Feb 20 10:51:51 2007 for ArNetworking by  doxygen 1.4.0