diff options
Diffstat (limited to 'devices')
| -rw-r--r-- | devices/Makefile | 12 | ||||
| -rw-r--r-- | devices/simple_dev/Makefile | 36 | ||||
| -rwxr-xr-x | devices/simple_dev/distrio_simple_dev | bin | 0 -> 42865 bytes | |||
| -rwxr-xr-x | devices/simple_dev/run.sh | 9 | ||||
| -rw-r--r-- | devices/simple_dev/simple_dev.cpp | 45 |
5 files changed, 102 insertions, 0 deletions
diff --git a/devices/Makefile b/devices/Makefile new file mode 100644 index 0000000..9a8528b --- /dev/null +++ b/devices/Makefile @@ -0,0 +1,12 @@ +MAKE_DIRECTORIES = simple_dev + +.PHONY: all +idl: $(MAKE_DIRECTORIES) +all: $(MAKE_DIRECTORIES) + +.PHONY: $(MAKE_DIRECTORIES) +$(MAKE_DIRECTORIES): + @$(MAKE) --keep-going --directory=$@ $(MAKECMDGOALS) + +.PHONY: $(MAKECMDGOALS) +$(MAKECMDGOALS): $(MAKE_DIRECTORIES) diff --git a/devices/simple_dev/Makefile b/devices/simple_dev/Makefile new file mode 100644 index 0000000..0d6e728 --- /dev/null +++ b/devices/simple_dev/Makefile @@ -0,0 +1,36 @@ +CC := $(CROSS_COMPILE)gcc +CXX := $(CROSS_COMPILE)g++ +LD := $(CROSS_COMPILE)g++ + +DISTRIO_MANAGER := ../../manager/lib +DISTRIO_COMMON := ../../common +DISTRIO_IO := ../../io + +LDFLAGS += -L$(DISTRIO_COMMON) -ldistrio_common \ + -L$(DISTRIO_IO) -ldistrio_io \ + -L$(DISTRIO_MANAGER) -ldistrio_manager \ + -lrt -lACE -lTAO -lTAO_AnyTypeCode -lTAO_CosNaming -lTAO_PortableServer +CFLAGS += -fPIC -I$(DISTRIO_COMMON) -I$(DISTRIO_IO) -I$(DISTRIO_MANAGER) +CXXFLAGS += $(CFLAGS) + +DESTDIR := /usr + +COMPONENT = distrio_simple_dev +EXEC = $(COMPONENT) +OBJ = simple_dev.o + +all: $(OBJ) + $(LD) $(LDFLAGS) -o $(EXEC) $(OBJ) + +clean: + rm -f *.o + rm -f $(EXEC) + +install: all + cp -a $(EXEC) $(DESTDIR)/bin + +uninstall: + rm -f $(DESTDIR)/bin/$(EXEC) + +idl: + /bin/true diff --git a/devices/simple_dev/distrio_simple_dev b/devices/simple_dev/distrio_simple_dev Binary files differnew file mode 100755 index 0000000..2687132 --- /dev/null +++ b/devices/simple_dev/distrio_simple_dev diff --git a/devices/simple_dev/run.sh b/devices/simple_dev/run.sh new file mode 100755 index 0000000..6d38011 --- /dev/null +++ b/devices/simple_dev/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# +# startup script for distrio simple device +# +# author: Manuel Traut <manut@mecka.net> + +LD_LIBRARY_PATH=../../io:../../common:../../manager/lib ./distrio_simple_dev \ + -ORBInitRef NameService=corbaloc:iiop:localhost:12345/NameService \ + $@ 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; +} |
