tools/Master.h
changeset 922 fede1d8f5b71
child 935 b954e9d91ea5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Master.h	Thu May 29 15:11:26 2008 +0000
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ *
+ * $Id$
+ *
+ ****************************************************************************/
+
+#ifndef __EC_MASTER_H__
+#define __EC_MASTER_H__
+
+#include <stdexcept>
+using namespace std;
+
+/****************************************************************************/
+
+class MasterException:
+    public runtime_error
+{
+    public:
+        /** Constructor with std::string parameter. */
+        MasterException(
+                const string &s /**< Message. */
+                ): runtime_error(s) {}
+
+        /** Constructor with const char pointer parameter. */
+        MasterException(
+                const char *s /**< Message. */
+                ): runtime_error(s) {}
+};
+
+/****************************************************************************/
+
+class Master
+{
+    public:
+        Master();
+        ~Master();
+
+        void open(unsigned int);
+        void close();
+
+        unsigned int slaveCount();
+        void listSlaves();
+
+    protected:
+        string slaveState(uint8_t) const;
+        
+    private:
+        unsigned int index;
+        int fd;
+};
+
+/****************************************************************************/
+
+#endif