connectedclient.h

00001 // Copyright (C) 2008,2009,2010 by Philipp Münzel. All rights reserved.
00002 // Released under the terms of the license described in license.txt
00003 
00004 #ifndef CONNECTEDCLIENT_H
00005 #define CONNECTEDCLIENT_H
00006 
00007 #include "dllexport.h"
00008 
00009 #ifdef HAVE_TR1
00010 #include <tr1/cstdint>
00011 #else
00012 #include <stdint.h>
00013 #endif
00014 #include <boost/date_time.hpp>
00015 
00016 namespace SCS {
00017 
00027 class DLL_PUBLIC ConnectedClient
00028 {
00029 public:
00030 
00034     static const float time_out;
00035 
00043     ConnectedClient(uint8_t node_id, uint8_t hardware_revision, uint8_t software_revision,
00044         uint8_t identifier_distribution, uint8_t header_type);
00045 
00049     void resetTimer();
00050 
00054     void poke();
00055 
00059     bool wasPoked() const;
00060 
00064     bool hasTimedOut() const;
00065 
00069     uint8_t nodeId() const;
00070 
00075     bool operator<(const ConnectedClient& rhs) const;
00076 
00077 private:
00078     uint8_t m_node_id;
00079     uint8_t m_hardware_revision;
00080     uint8_t m_software_revision;
00081     uint8_t m_identifier_distribution;
00082     uint8_t m_header_type;
00083     bool m_poked;
00084     boost::posix_time::ptime m_last_heared_from;
00085 };
00086 
00087 }
00088 
00089 #endif // CONNECTEDCLIENT_H