Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

RemoteProcess.h

Go to the documentation of this file.
00001 #ifndef RemoteProcess_h_DEFINED
00002 #define RemoteProcess_h_DEFINED
00003 
00004 #include <OPENR/OObject.h>
00005 #include <OPENR/OSubject.h>
00006 #include <OPENR/OObserver.h>
00007 #include "def.h"
00008 
00009 //! Sample RemoteProcessingOPENR process
00010 /*! RemoteProcess runs on Linux with OPEN_R_SDK installed (and the
00011  *  RemoteProcessingOPENR patch). RemoteProcess talks to the Aibo using
00012  *  OPENR messages. RemoteProcessingOPENR can receive all the OPENR system
00013  *  sensor streams and write to all output streams available on the Aibo.
00014  *
00015  *  In short, use this if you're falling short of processing power on the
00016  *  Aibo, and the data you want processed is small in size. It'll help
00017  *  greatly if you're comfortable with OPENR processes and message
00018  *  passing.
00019  *
00020  *  Please read the RemoteProcessingOPENR instructions on the main Tekkotsu
00021  *  page for more information.
00022  */
00023 
00024 class RemoteProcess : public OObject {
00025 public:
00026   //! constructor
00027   RemoteProcess();
00028   ~RemoteProcess(); //!< destructor
00029   void start(); //!< called when objects are connected (by DoStart). Add user code here.
00030   void data_received(const char *buf); //!< called when a message is received (by RPOPENR_notify). Add user code here.
00031 
00032   // usercode: add additional definitions here
00033 
00034   // support code below here:
00035 public:
00036   OSubject* subject[numOfSubject]; //!< holds information for each of our subjects (data we provide)
00037   OObserver* observer[numOfObserver]; //!< holds information for each of the sources we're observing
00038 
00039   virtual OStatus DoInit   (const OSystemEvent& event); //!< first call (after constructor), set up memory
00040   virtual OStatus DoStart  (const OSystemEvent& event); //!< second call, ask for messages
00041   virtual OStatus DoStop   (const OSystemEvent& event); //!< next to last call, stop sending and receiving messages
00042   virtual OStatus DoDestroy(const OSystemEvent& event); //!< last call (before destructor), clean up memory here
00043 
00044   bool RPOPENR_isready; //!< set to true after RPOPENR_ready() was called
00045   bool RPOPENR_isReady() { return RPOPENR_isready; } //!< indicates whether the Aibo is ready to receive more messages
00046   int RPOPENR_send(char *buf, int bufsize); //!< send message to Aibo
00047 
00048   void RPOPENR_ready(const OReadyEvent& event) { RPOPENR_isready=true; } //!< OPENR callback for registering when the Aibo is ready for messages
00049   void RPOPENR_notify(const ONotifyEvent& event); //!< OPENR callback for when a message is received from the Aibo
00050 };
00051 
00052 /*! @file
00053  * @brief Describes RemoteProcess, sample RemoteProcessingOPENR process
00054  * @author alokl (Creator)
00055  *
00056  * $Author: ejt $
00057  * $Name: tekkotsu-1_4_1 $
00058  * $Revision: 1.6 $
00059  * $State: Exp $
00060  * $Date: 2003/06/12 23:41:40 $
00061  */
00062 
00063 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:31 2003 by Doxygen 1.3.2