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

ArHybridForwarderVideo.h

Go to the documentation of this file.
00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARHYBRIDFORWARDERVIDEO_H
00027 #define ARHYBRIDFORWARDERVIDEO_H
00028 
00029 #include "Aria.h"
00030 #include "ArServerBase.h"
00031 #include "ArClientBase.h"
00032 
00034 class ArHybridForwarderVideo : public ArCameraCollectionItem
00035 {
00036 public:
00038   AREXPORT ArHybridForwarderVideo(ArServerBase *server, ArClientBase *client);
00040   AREXPORT ArHybridForwarderVideo(ArServerBase *server, 
00041                                   const char *hostname = "localhost", 
00042                                   int port = 7070);
00044   AREXPORT virtual ~ArHybridForwarderVideo();
00045 
00047   AREXPORT bool isForwardingVideo(void) const;
00048 
00049 
00050   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00051   // ArCameraCollectionItem methods
00052   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00053 
00055   AREXPORT virtual const char *getCameraName();
00056 
00058 
00061   AREXPORT virtual void setCameraName(const char *cameraName);
00062 
00064   AREXPORT virtual void addToCameraCollection(ArCameraCollection &collection);
00065 
00066 
00067   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00068   // Packet methods
00069   // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00070 
00072   AREXPORT void sendVideoSize(ArServerClient *client, ArNetPacket *packet);
00074   AREXPORT void sendVideo(ArServerClient *client, ArNetPacket *packet);
00076   AREXPORT void receiveVideoSize(ArNetPacket *packet);
00078   AREXPORT void receiveVideo(ArNetPacket *packet);
00080   AREXPORT void clientCycleCallback(void);
00082   void setVideoRequestTime(int ms) { myVideoRequestTime = ms; }
00084   int setVideoRequestTime(void) const { return myVideoRequestTime; }
00085 protected:
00086   AREXPORT void finishConstructor(void);
00087 
00088   std::string myCameraName;
00089 
00090   ArMutex myMutex;
00091   bool myForwardingVideo;
00092   ArNetPacket myReceivedVideoSize;
00093   ArNetPacket myReceivedVideo;
00094   ArNetPacket mySendVideoArgument;
00095   ArTime myLastReceivedVideo;
00096   ArTime myLastReqSent;
00097   bool myReqSent;
00098   int myVideoRequestTime;
00099   ArServerBase *myServer;
00100   ArClientBase *myClient;
00101   ArFunctor2C<ArHybridForwarderVideo, ArServerClient*, 
00102       ArNetPacket *> *mySendVideoSizeCB;
00103   ArFunctor2C<ArHybridForwarderVideo, ArServerClient*, 
00104       ArNetPacket *> *mySendVideoCB;
00105   ArFunctor1C<ArHybridForwarderVideo, ArNetPacket *> *myReceiveVideoSizeCB;
00106   ArFunctor1C<ArHybridForwarderVideo, ArNetPacket *> *myReceiveVideoCB;
00107   ArFunctorC<ArHybridForwarderVideo> *myClientCycleCB;
00108 
00109   bool myIsSendVideoAvailable;
00110 };
00111 
00112 
00113 #endif 

Generated on Tue Feb 20 10:51:50 2007 for ArNetworking by  doxygen 1.4.0