diff options
| author | Manuel Traut <manut@mecka.net> | 2012-06-03 20:12:26 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2012-06-03 20:12:26 +0200 |
| commit | f79ee1d59423488c3de89e97e3648515a9143b36 (patch) | |
| tree | 93e4922283a5d03c1c559f48970317b8f50056f1 /devices/simple_dev/simple_dev.cpp | |
| parent | 796c97ef8d5a437fff1edb5679b82db49806e576 (diff) | |
add simple_dev example
- registers device at the manager
- fixup manager to enable device registration
- extend distrio_helper to support device registration
Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'devices/simple_dev/simple_dev.cpp')
| -rw-r--r-- | devices/simple_dev/simple_dev.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/devices/simple_dev/simple_dev.cpp b/devices/simple_dev/simple_dev.cpp new file mode 100644 index 0000000..eb2dfdd --- /dev/null +++ b/devices/simple_dev/simple_dev.cpp @@ -0,0 +1,45 @@ +#include <distrio_helper.h> +#include <distrio_error.h> + +#include <distrio_ioI.h> + +#include <iostream> + +class My_device : public Distrio_Device_i { + public: + ::CORBA::Long id (void) + { + return my_id; + } + void id (::CORBA::Long id) + { + my_id = id; + } + private: + ::CORBA::Long my_id; +}; + +int main (int argc, char **argv) +{ + int ret = 0; + My_device *dev; + + if (init_corba (argc, argv)) + return -EINVAL; + + if (run_orb ()) + return -EINVAL; + + dev = new My_device (); + + if (register_device ("simpele device", dev)) { + ret = -EINVAL; + goto out; + } + + std::cout << "registered id: " << dev->id () << std::endl; + +out: + free (dev); + return ret; +} |
