tools/Master.h
changeset 922 fede1d8f5b71
child 935 b954e9d91ea5
equal deleted inserted replaced
921:c8c2caf0d667 922:fede1d8f5b71
       
     1 /*****************************************************************************
       
     2  *
       
     3  * $Id$
       
     4  *
       
     5  ****************************************************************************/
       
     6 
       
     7 #ifndef __EC_MASTER_H__
       
     8 #define __EC_MASTER_H__
       
     9 
       
    10 #include <stdexcept>
       
    11 using namespace std;
       
    12 
       
    13 /****************************************************************************/
       
    14 
       
    15 class MasterException:
       
    16     public runtime_error
       
    17 {
       
    18     public:
       
    19         /** Constructor with std::string parameter. */
       
    20         MasterException(
       
    21                 const string &s /**< Message. */
       
    22                 ): runtime_error(s) {}
       
    23 
       
    24         /** Constructor with const char pointer parameter. */
       
    25         MasterException(
       
    26                 const char *s /**< Message. */
       
    27                 ): runtime_error(s) {}
       
    28 };
       
    29 
       
    30 /****************************************************************************/
       
    31 
       
    32 class Master
       
    33 {
       
    34     public:
       
    35         Master();
       
    36         ~Master();
       
    37 
       
    38         void open(unsigned int);
       
    39         void close();
       
    40 
       
    41         unsigned int slaveCount();
       
    42         void listSlaves();
       
    43 
       
    44     protected:
       
    45         string slaveState(uint8_t) const;
       
    46         
       
    47     private:
       
    48         unsigned int index;
       
    49         int fd;
       
    50 };
       
    51 
       
    52 /****************************************************************************/
       
    53 
       
    54 #endif