diff options
| author | Manuel Traut <manut@mecka.net> | 2012-05-29 02:10:20 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2012-05-29 02:10:20 +0200 |
| commit | f791f02b89efc984b40b922ed53ff6cb76e3e829 (patch) | |
| tree | 0eaa04c79c493d7815dc2de9a3c4eefb18e85081 | |
| parent | 379492ff3c10eef6479fd85418b797f97889d3f9 (diff) | |
improve interfaces and fix typos
- added timestamp for error
- added log function to collect errors in controller
- merged device.idl into io.idl
- fixed typos in io
- added callbacks to digital/analog io
Signed-off-by: Manuel Traut <manut@mecka.net>
| -rw-r--r-- | interfaces/common.idl | 25 | ||||
| -rw-r--r-- | interfaces/controller.idl | 31 | ||||
| -rw-r--r-- | interfaces/device.idl | 26 | ||||
| -rw-r--r-- | interfaces/io.idl | 78 |
4 files changed, 102 insertions, 58 deletions
diff --git a/interfaces/common.idl b/interfaces/common.idl index c3ca769..7e6266c 100644 --- a/interfaces/common.idl +++ b/interfaces/common.idl @@ -1,12 +1,15 @@ -module common { +#ifndef DISTIO_COMMON_IDL +#define DISTIO_COMMON_IDL - enum error_code { +module Common { + + enum Error_code { SUCCESS, EINVAL, ENOTSUPPORTED }; - enum error_level { + enum Error_level { DEBUG, INFO, WARNING, @@ -14,9 +17,19 @@ module common { CRITICAL }; - struct error { - error_code code; - error_level level; + struct Error_timestamp { + longlong seconds; + long nanoseconds; + }; + + struct Error { + Error_code code; + Error_level level; + Error_timestamp time; + long module_id; string description; }; + }; + +#endif diff --git a/interfaces/controller.idl b/interfaces/controller.idl index b680742..3410ab6 100644 --- a/interfaces/controller.idl +++ b/interfaces/controller.idl @@ -1,17 +1,24 @@ -include common.idl -include io.idl +#ifndef DISTIO_CONTROLLER_IDL +#define DISTIO_CONTROLLER_IDL -module controller { +#include "common.idl" +#include "io.idl" - common.error digital (out list<io.digial>); - common.error analog (out list<io.analog>); - common.error device (out list<device.device_base>); +module Controller { - common.error register (in io.digital); - common.error register (in io.analog); - common.error register (in device.device_base); + interface Manager { + Common::Error digital (out IO::Digital_list io_list); + Common::Error analog (out IO::Analog_list io_list); + Common::Error device (out IO::Device_list dev_list); + Common::Error register_io_digital (in IO::Analog io_ana); + Common::Error register_io_analog (in IO::Digital io_dig); + Common::Error register_io_device (in IO::Device io_dev); + Common::Error unregister_io_digital (in IO::Digital io_dig); + Common::Error unregister_io_analog (in IO::Analog io_ana); + Common::Error unregister_io_device (in IO::Device io_dev); + void log_error (in Common::Error error); + }; - common.error unregister (in io.digital); - common.error unregister (in io.analog); - common.error unregister (in device.device_base); }; + +#endif diff --git a/interfaces/device.idl b/interfaces/device.idl deleted file mode 100644 index 1306639..0000000 --- a/interfaces/device.idl +++ /dev/null @@ -1,26 +0,0 @@ -include common.idl -include io.idl - -module device { - - enum function_id { - START; - STOP; - }; - - struct function { - string description; - int value; - enum fundtion_id id; - }; - - interface device { - common.error name (out string name); - common.error execute (in device.function); - common.error functions (out list <device.function>); - int id; - list <io.analog> analog; - list <io.digital> digital; - }; - -}; diff --git a/interfaces/io.idl b/interfaces/io.idl index d2f95f8..435ea01 100644 --- a/interfaces/io.idl +++ b/interfaces/io.idl @@ -1,22 +1,72 @@ +#ifndef DISTIO_IO_IDL +#define DISTIO_IO_IDL + #include "common.idl" -module io { +module IO { + + interface Device; - interface digital { - common.error name (out string name); - common.error set (); - common.error reset (); - common.error get (out int value); - attribute Int id; + enum Digital_trigger { + TRIGGER_EDGE, + TRIGGER_RISING_EDGE, + TRIGGER_FALLING_EDGE }; - interface analog { - common.error name (out string name); - common.error min (out int min); - common.error max (out int max); - common.error set (in int value); - common.error get (out int value); - attribute Integer id; + interface Digital { + Common::Error name (out string name); + Common::Error set (); + Common::Error reset (); + Common::Error get (out long value); + Common::Error register_callback (in Device dev, in Digital_trigger trigger); + attribute long id; + }; + + typedef sequence<Digital> Digital_list; + + struct Analog_trigger { + long last_value; + long jitter; }; + interface Analog { + Common::Error name (out string name); + Common::Error min (out long min); + Common::Error max (out long max); + Common::Error set (in long value); + Common::Error get (out long value); + Common::Error register_callback (in Device dev, in Analog_trigger trigger); + attribute long id; + }; + + typedef sequence<Analog> Analog_list; + + enum Dev_function_id { + DEV_START, + DEV_STOP + }; + + struct Dev_function { + string description; + long value; + Dev_function_id id; + }; + + typedef sequence<Dev_function> Dev_function_list; + + interface Device { + Common::Error name (out string name); + Common::Error execute (in Dev_function func); + Common::Error functions (out Dev_function_list funcs); + Common::Error callback_digital (in Digital io_dig); + Common::Error callback_analog (in Analog io_ana); + attribute Analog_list io_ana; + attribute Digital_list io_dig; + attribute long id; + }; + + typedef sequence<Device> Device_list; + }; + +#endif |
