Robotics Library  0.7.0
HilscherCifx.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2009, Markus Rickert
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 // POSSIBILITY OF SUCH DAMAGE.
25 //
26 
27 #ifndef RL_HAL_HILSCHERCIFX_H
28 #define RL_HAL_HILSCHERCIFX_H
29 
30 #include <cifXErrors.h>
31 #include <cifXUser.h>
32 #include <cstdint>
33 #include <string>
34 
35 #include "ComException.h"
36 #include "Fieldbus.h"
37 
38 namespace rl
39 {
40  namespace hal
41  {
42  class HilscherCifx : public Fieldbus
43  {
44  public:
45  class Exception : public ComException
46  {
47  public:
48  Exception(const ::std::int32_t& error);
49 
50  virtual ~Exception() throw();
51 
52  ::std::int32_t getError() const;
53 
54  virtual const char* what() const throw();
55 
56  protected:
57 
58  private:
59  char buffer[1024];
60 
61  ::std::int32_t error;
62  };
63 
64  HilscherCifx(const ::std::string& board = "cifX0", const ::std::size_t& number = 0);
65 
66  virtual ~HilscherCifx();
67 
68  void close();
69 
70  void open();
71 
72  void read(void* data, const ::std::size_t& offset, const ::std::size_t& length);
73 
74  void write(void* data, const ::std::size_t& offset, const ::std::size_t& length);
75 
76  protected:
77 
78  private:
79  ::std::string board;
80 
81  ::CIFXHANDLE channel;
82 
83  ::CIFXHANDLE driver;
84 
85  ::std::size_t number;
86  };
87  }
88 }
89 
90 #endif // RL_HAL_HILSCHERCIFX_H
rl::hal::HilscherCifx
Definition: HilscherCifx.h:43
rl::hal::Fieldbus
Definition: Fieldbus.h:39
rl::hal::HilscherCifx::read
void read(void *data, const ::std::size_t &offset, const ::std::size_t &length)
Definition: HilscherCifx.cpp:161
rl::hal::HilscherCifx::open
void open()
Definition: HilscherCifx.cpp:98
rl::hal::HilscherCifx::write
void write(void *data, const ::std::size_t &offset, const ::std::size_t &length)
Definition: HilscherCifx.cpp:172
rl::hal::HilscherCifx::Exception::error
::std::int32_t error
Definition: HilscherCifx.h:61
rl::hal::HilscherCifx::driver
::CIFXHANDLE driver
Definition: HilscherCifx.h:83
rl::hal::HilscherCifx::number
::std::size_t number
Definition: HilscherCifx.h:85
Fieldbus.h
rl::hal::HilscherCifx::HilscherCifx
HilscherCifx(const ::std::string &board="cifX0", const ::std::size_t &number=0)
Definition: HilscherCifx.cpp:39
rl::hal::HilscherCifx::board
::std::string board
Definition: HilscherCifx.h:79
rl::hal::HilscherCifx::Exception::buffer
char buffer[1024]
Definition: HilscherCifx.h:59
rl::hal::HilscherCifx::~HilscherCifx
virtual ~HilscherCifx()
Definition: HilscherCifx.cpp:48
rl::hal::HilscherCifx::Exception::getError
::std::int32_t getError() const
Definition: HilscherCifx.cpp:195
rl::hal::HilscherCifx::Exception
Definition: HilscherCifx.h:46
ComException.h
rl::hal::HilscherCifx::Exception::Exception
Exception(const ::std::int32_t &error)
Definition: HilscherCifx.cpp:182
rl::hal::HilscherCifx::close
void close()
Definition: HilscherCifx.cpp:53
rl::hal::HilscherCifx::Exception::~Exception
virtual ~Exception()
Definition: HilscherCifx.cpp:190
rl::hal::HilscherCifx::channel
::CIFXHANDLE channel
Definition: HilscherCifx.h:81
rl::hal::ComException
Definition: ComException.h:37
rl::hal::HilscherCifx::Exception::what
virtual const char * what() const
Definition: HilscherCifx.cpp:201
rl
Robotics Library.
Definition: AnalogInput.cpp:30