diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-04-14 12:56:48 +0100 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-04-14 12:56:48 +0100 |
commit | 0b624384cd52be20e61284551d832b499d7b7707 (patch) | |
tree | 6f95a4bbef47abc9720b96c0722e8f632aef228a /examples | |
download | libphidget21-6c284da2cfff41863f06ee8109e2e20fbbd73940.tar.gz |
Imported Upstream version 2.1.8.20120216upstream/2.1.8.20120216
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 7 | ||||
-rw-r--r-- | examples/Makefile.in | 499 | ||||
-rw-r--r-- | examples/README | 13 | ||||
-rw-r--r-- | examples/ifkit.c | 136 | ||||
-rw-r--r-- | examples/manager.c | 73 | ||||
-rw-r--r-- | examples/phidgetsbclist.c | 104 |
6 files changed, 832 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..5de19aa --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,7 @@ +## Process this file with automake to produce Makefile.in + +noinst_PROGRAMS = ifkit \ +manager \ +phidgetsbclist + +AM_LDFLAGS = -lphidget21
\ No newline at end of file diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..157dfd0 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,499 @@ +# Makefile.in generated by automake 1.11 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = ifkit$(EXEEXT) manager$(EXEEXT) \ + phidgetsbclist$(EXEEXT) +subdir = examples +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +ifkit_SOURCES = ifkit.c +ifkit_OBJECTS = ifkit.$(OBJEXT) +ifkit_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +manager_SOURCES = manager.c +manager_OBJECTS = manager.$(OBJEXT) +manager_LDADD = $(LDADD) +phidgetsbclist_SOURCES = phidgetsbclist.c +phidgetsbclist_OBJECTS = phidgetsbclist.$(OBJEXT) +phidgetsbclist_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = ifkit.c manager.c phidgetsbclist.c +DIST_SOURCES = ifkit.c manager.c phidgetsbclist.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDCONFIG = @LDCONFIG@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_LDFLAGS = -lphidget21 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +ifkit$(EXEEXT): $(ifkit_OBJECTS) $(ifkit_DEPENDENCIES) + @rm -f ifkit$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ifkit_OBJECTS) $(ifkit_LDADD) $(LIBS) +manager$(EXEEXT): $(manager_OBJECTS) $(manager_DEPENDENCIES) + @rm -f manager$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(manager_OBJECTS) $(manager_LDADD) $(LIBS) +phidgetsbclist$(EXEEXT): $(phidgetsbclist_OBJECTS) $(phidgetsbclist_DEPENDENCIES) + @rm -f phidgetsbclist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(phidgetsbclist_OBJECTS) $(phidgetsbclist_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ifkit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phidgetsbclist.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..164da02 --- /dev/null +++ b/examples/README @@ -0,0 +1,13 @@ +Phidgets examples for Linux +Version 2.1.4 +August 22, 2008 +-------------------------------------------------------------------------- +Included are two simple examples to get you started with Phidgets +and linux in C. + +A full set of linux examples are available from www.phidets.com, as +well as examples in many other languages. + +Also included here is the phidgetsbclist utility, which will list all +of the PhidgetSBCs found on the network. This utility requires that +Avahi be installed to work properly.
\ No newline at end of file diff --git a/examples/ifkit.c b/examples/ifkit.c new file mode 100644 index 0000000..8eaded7 --- /dev/null +++ b/examples/ifkit.c @@ -0,0 +1,136 @@ +// InterfacekitTest.cpp : Defines the entry point for the console application. +// + + +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <phidget21.h> + +void display_generic_properties(CPhidgetHandle phid) +{ + int sernum, version; + const char *deviceptr, *label; + CPhidget_getDeviceType(phid, &deviceptr); + CPhidget_getSerialNumber(phid, &sernum); + CPhidget_getDeviceVersion(phid, &version); + CPhidget_getDeviceLabel(phid, &label); + + printf("%s\n", deviceptr); + printf("Version: %8d SerialNumber: %10d\n", version, sernum); + printf("Label: %s\n", label); + return; +} + + +int IFK_DetachHandler(CPhidgetHandle IFK, void *userptr) +{ + printf("Detach handler ran!\n"); + return 0; +} + +int IFK_ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *ErrorString) +{ + printf("Error handler: %d, %s\n", ErrorCode, ErrorString); + return 0; +} + +int IFK_OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int Index, int Value) +{ + printf("Output %d is %d\n", Index, Value); + return 0; +} + +int IFK_InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int Index, int Value) +{ + printf("Input %d is %d\n", Index, Value); + return 0; +} + +int IFK_SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int Index, int Value) +{ + printf("Sensor %d is %d\n", Index, Value); + return 0; +} + + +int IFK_AttachHandler(CPhidgetHandle IFK, void *userptr) +{ + //CPhidgetInterfaceKit_setSensorChangeTrigger((CPhidgetInterfaceKitHandle)IFK, 0, 0); + printf("Attach handler ran!\n"); + return 0; +} + +int test_interfacekit() +{ + int numInputs, numOutputs, numSensors; + int err; + CPhidgetInterfaceKitHandle IFK = 0; + + CPhidget_enableLogging(PHIDGET_LOG_VERBOSE, NULL); + + CPhidgetInterfaceKit_create(&IFK); + + CPhidgetInterfaceKit_set_OnInputChange_Handler(IFK, IFK_InputChangeHandler, NULL); + CPhidgetInterfaceKit_set_OnOutputChange_Handler(IFK, IFK_OutputChangeHandler, NULL); + CPhidgetInterfaceKit_set_OnSensorChange_Handler(IFK, IFK_SensorChangeHandler, NULL); + CPhidget_set_OnAttach_Handler((CPhidgetHandle)IFK, IFK_AttachHandler, NULL); + CPhidget_set_OnDetach_Handler((CPhidgetHandle)IFK, IFK_DetachHandler, NULL); + CPhidget_set_OnError_Handler((CPhidgetHandle)IFK, IFK_ErrorHandler, NULL); + + CPhidget_open((CPhidgetHandle)IFK, -1); + + //wait 5 seconds for attachment + if((err = CPhidget_waitForAttachment((CPhidgetHandle)IFK, 0)) != EPHIDGET_OK ) + { + const char *errStr; + CPhidget_getErrorDescription(err, &errStr); + printf("Error waiting for attachment: (%d): %s\n",err,errStr); + goto exit; + } + + display_generic_properties((CPhidgetHandle)IFK); + CPhidgetInterfaceKit_getOutputCount((CPhidgetInterfaceKitHandle)IFK, &numOutputs); + CPhidgetInterfaceKit_getInputCount((CPhidgetInterfaceKitHandle)IFK, &numInputs); + CPhidgetInterfaceKit_getSensorCount((CPhidgetInterfaceKitHandle)IFK, &numSensors); + + CPhidgetInterfaceKit_setOutputState((CPhidgetInterfaceKitHandle)IFK, 0, 1); + + printf("Sensors:%d Inputs:%d Outputs:%d\n", numSensors, numInputs, numOutputs); + + //err = CPhidget_setDeviceLabel((CPhidgetHandle)IFK, "test"); + + while(1) + { + sleep(1); + } + + while(1) + { + CPhidgetInterfaceKit_setOutputState(IFK, 7, 1); + CPhidgetInterfaceKit_setOutputState(IFK, 7, 0); + } + + CPhidgetInterfaceKit_setOutputState(IFK, 0, 1); + sleep(1); + CPhidgetInterfaceKit_setOutputState(IFK, 0, 0); + sleep(1); + CPhidgetInterfaceKit_setOutputState(IFK, 0, 1); + sleep(1); + CPhidgetInterfaceKit_setOutputState(IFK, 0, 0); + + sleep(5); + +exit: + CPhidget_close((CPhidgetHandle)IFK); + CPhidget_delete((CPhidgetHandle)IFK); + + return 0; +} + +int main(int argc, char* argv[]) +{ + test_interfacekit(); + return 0; +} + diff --git a/examples/manager.c b/examples/manager.c new file mode 100644 index 0000000..412b7de --- /dev/null +++ b/examples/manager.c @@ -0,0 +1,73 @@ +/* +* manager.cpp +* +* Patrick McNeil - July 19, 2005 +* +* Simple program to list all Phidgets that are added and removed from the system +*/ + +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include "phidget21.h" +#include <signal.h> + +int something; +static int exitMan = 0; + +void sighandler (int n) +{ + printf ("got a signal. exiting.\n"); + exitMan = 1; +} + +int gotAttach(CPhidgetHandle phid, void *ptr) { + const char *id, *label; + int serial, version; + + //print out some info + CPhidget_getDeviceLabel(phid, &label); + CPhidget_getSerialNumber(phid, &serial); + CPhidget_getDeviceVersion(phid, &version); + CPhidget_getDeviceType(phid, &id); + printf("Device Added: %s, Serial: %d, Version: %d Label: %s\n",id,serial,version,label); + + return 0; +} + +int gotDetach(CPhidgetHandle phid, void *ptr) { + char *id; + int serial, version; + + //print out some info + CPhidget_getSerialNumber(phid, &serial); + CPhidget_getDeviceVersion(phid, &version); + CPhidget_getDeviceType((CPhidgetHandle)phid,(const char **)&id); + printf("Device Removed: %s, Serial: %d, Version: %d\n",id,serial,version); + + return 0; +} + + +int main() +{ + CPhidgetManagerHandle phidm; + + //CPhidget_enableLogging(PHIDGET_LOG_VERBOSE, NULL); + + CPhidgetManager_create(&phidm); + CPhidgetManager_set_OnAttach_Handler(phidm, gotAttach, NULL); + CPhidgetManager_set_OnDetach_Handler(phidm, gotDetach, NULL); + CPhidgetManager_open(phidm); + + signal (SIGTERM, sighandler); + signal (SIGINT, sighandler); + +while(!exitMan) + sleep(5); + + printf ("Removing resources.\n"); + CPhidgetManager_close(phidm); + CPhidgetManager_delete(phidm); + return 0; +} diff --git a/examples/phidgetsbclist.c b/examples/phidgetsbclist.c new file mode 100644 index 0000000..14a719e --- /dev/null +++ b/examples/phidgetsbclist.c @@ -0,0 +1,104 @@ +/* + * phidgetsbclist.c + * + * Displays a dynamic list of PhidgetSBCs on the network. + * + * Created by Patrick Mcneil on 22/08/08. + * Copyright 2008 Phidgets Inc.. All rights reserved. + * + */ + +#include <stdio.h> +#include <phidget21.h> + +//Define these here because they are not in the standard .h file +typedef struct _CPhidgetSBC *CPhidgetSBCHandle; +typedef struct _CPhidgetSBCManager *CPhidgetSBCManagerHandle; +int CPhidgetSBCManager_create(CPhidgetSBCManagerHandle *sbcm); +int CPhidgetSBCManager_start(CPhidgetSBCManagerHandle sbcm); +int CPhidgetSBCManager_stop(CPhidgetSBCManagerHandle sbcm); +int CPhidgetSBCManager_delete(CPhidgetSBCManagerHandle sbcm); +int CPhidgetSBCManager_set_OnAttach_Handler(CPhidgetSBCManagerHandle sbcm, int ( *fptr)(CPhidgetSBCHandle sbc, void *userPtr), void *userPtr); +int CPhidgetSBCManager_set_OnDetach_Handler(CPhidgetSBCManagerHandle sbcm, int ( *fptr)(CPhidgetSBCHandle sbc, void *userPtr), void *userPtr);int CPhidgetSBCManager_set_OnError_Handler(CPhidgetSBCManagerHandle sbcm, int( *fptr)(CPhidgetSBCManagerHandle sbcm, void *userPtr, int errorCode, const char *errorString), void *userPtr); +int CPhidgetSBC_getFirmwareVersion(CPhidgetSBCHandle sbc, const char **firmwareVersion); +int CPhidgetSBC_getHardwareVersion(CPhidgetSBCHandle sbc, int *hardwareVersion); +int CPhidgetSBC_getMacAddress(CPhidgetSBCHandle sbc, const char **macAddress); +int CPhidgetSBC_getAddress(CPhidgetSBCHandle sbc, const char **ipAddr); +int CPhidgetSBC_getHostname(CPhidgetSBCHandle sbc, const char **hostname); +int CPhidgetSBC_getDeviceName(CPhidgetSBCHandle sbc, const char **name); + + +int display_device_info(CPhidgetSBCHandle sbc) +{ + int hardwareVersion; + const char *firmwareVersion, *macAddress, *address, *hostname, *name; + + CPhidgetSBC_getFirmwareVersion(sbc, &firmwareVersion); + CPhidgetSBC_getHardwareVersion(sbc, &hardwareVersion); + CPhidgetSBC_getMacAddress(sbc, &macAddress); + CPhidgetSBC_getHostname(sbc, &hostname); + CPhidgetSBC_getDeviceName(sbc, &name); + if(CPhidgetSBC_getAddress(sbc, &address) != EPHIDGET_OK) + address = NULL; + + printf(" Device Name: %s\n",name); + printf(" MAC Address: %s\n",macAddress); + printf(" Address: %s\n",address?address:"(Unknown)"); + printf(" Hostname: %s\n",hostname); + printf(" Hardware Version: %d\n",hardwareVersion); + printf(" Firmware Version: %s\n",firmwareVersion); + + return 0; +} + +int attach(CPhidgetSBCHandle sbc, void *userPtr) +{ + printf("===ATTACH===\n"); + display_device_info(sbc); + return 0; +} + +int detach(CPhidgetSBCHandle sbc, void *userPtr) +{ + printf("===DETACH===\n"); + display_device_info(sbc); + return 0; +} + +int error(CPhidgetSBCManagerHandle sbcm, void *userPtr, int errorCode, const char *errorString) +{ + printf("Error Event: (%d) %s\n", errorCode, errorString); + return 0; +} + +int main(int argc, char *argv[]) +{ + int result; + CPhidgetSBCManagerHandle sbcm; + + CPhidgetSBCManager_create(&sbcm); + + CPhidgetSBCManager_set_OnAttach_Handler(sbcm, attach, NULL); + CPhidgetSBCManager_set_OnDetach_Handler(sbcm, detach, NULL); + CPhidgetSBCManager_set_OnError_Handler(sbcm, error, NULL); + + result = CPhidgetSBCManager_start(sbcm); + + if(result != EPHIDGET_OK) + { + const char *err; + CPhidget_getErrorDescription(result, &err); + printf("Error: (%d) %s\n", result, err); + return 1; + } + + printf("Press any key to end\n"); + getchar(); + printf("Closing...\n"); + + CPhidgetSBCManager_stop(sbcm); + CPhidgetSBCManager_delete(sbcm); + + return 0; +} + |