diff --git a/campcaster/src/products/gLiveSupport/etc/Makefile.in b/campcaster/src/products/gLiveSupport/etc/Makefile.in index 147beba62..fe75b25da 100644 --- a/campcaster/src/products/gLiveSupport/etc/Makefile.in +++ b/campcaster/src/products/gLiveSupport/etc/Makefile.in @@ -304,7 +304,7 @@ G_LIVESUPPORT_EXE_LIBS = -l${PLAYLIST_EXECUTOR_LIB} \ -l${SCHEDULER_CLIENT_LIB} \ -l${CORE_LIB} \ ${BOOST_DATE_TIME_LIB} \ - -lxmlrpc++ -lssl -ltar + -lxmlrpc++ -lssl -ltar -lserial TEST_RUNNER_OBJS = ${G_LIVESUPPORT_OBJS} \ ${TMP_DIR}/TestRunner.o \ diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx index 4b252c832..bfbbd1466 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -182,6 +182,11 @@ const std::string authenticationNotReachableKey = *----------------------------------------------------------------------------*/ const std::string localeNotAvailableKey = "localeNotAvailableMsg"; +/*------------------------------------------------------------------------------ + * The default serial device + *----------------------------------------------------------------------------*/ +const std::string defaultSerialDevice = "/dev/ttyS0"; + } /* =============================================== local function prototypes */ @@ -396,6 +401,9 @@ GLiveSupport :: configure(const xmlpp::Element & element) testAudioUrl.reset(new Glib::ustring( testAudioUrlElement->get_attribute("path") ->get_value() )); + + // TODO: make this configurable + serialDevice.reset(new std::string(defaultSerialDevice)); } @@ -1781,3 +1789,23 @@ GLiveSupport :: createScratchpadWindow(void) } } + +/*------------------------------------------------------------------------------ + * Write a string to the serial device. + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: writeToSerial(Ptr::Ref message) + throw () +{ + try { + serialStream->Open(*serialDevice); + (*serialStream) << *message; + serialStream->flush(); + serialStream->Close(); + } catch (...) { + // TODO: handle this somehow + std::cerr << "IO error in GLiveSupport::writeToSerial()" << std::endl; + } +} + diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h index daa581e4e..099b3e460 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h @@ -45,6 +45,7 @@ #include #include #include +#include #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/LocalizedConfigurable.h" @@ -253,17 +254,27 @@ class GLiveSupport : public LocalizedConfigurable, /** * The location of the test audio file. */ - Ptr::Ref testAudioUrl; + Ptr::Ref testAudioUrl; /** * The command which starts the scheduler daemon. */ - Ptr::Ref schedulerDaemonStartCommand; + Ptr::Ref schedulerDaemonStartCommand; /** * The command which stops the scheduler daemon. */ - Ptr::Ref schedulerDaemonStopCommand; + Ptr::Ref schedulerDaemonStopCommand; + + /** + * The serial device. + */ + Ptr::Ref serialDevice; + + /** + * The serial stream object. + */ + Ptr::Ref serialStream; /** * Read a supportedLanguages configuration element, @@ -375,6 +386,7 @@ class GLiveSupport : public LocalizedConfigurable, { openedAudioClips.reset(new AudioClipMap()); openedPlaylists.reset(new PlaylistMap()); + serialStream.reset(new LibSerial::SerialStream()); } /** @@ -1277,6 +1289,12 @@ class GLiveSupport : public LocalizedConfigurable, */ void createScratchpadWindow(void) throw (); + + /** + * Write a string to the serial device. + */ + void + writeToSerial(Ptr::Ref message) throw (); }; /* ================================================= external data structures */ diff --git a/campcaster/src/tools/libserial/libserial-0.5.2/bin/prepare.sh b/campcaster/src/tools/libserial/libserial-0.5.2/bin/prepare.sh index f50d5d7c6..604d8709e 100755 --- a/campcaster/src/tools/libserial/libserial-0.5.2/bin/prepare.sh +++ b/campcaster/src/tools/libserial/libserial-0.5.2/bin/prepare.sh @@ -48,6 +48,7 @@ cd ${tmpdir} if [ ! -d $product ]; then tar xfz ${tar} cd $product - # put patches here + # patch not submitted yet + patch -p1 < $etcdir/libserial-gcc-4.0-fix.patch fi diff --git a/campcaster/src/tools/libserial/libserial-0.5.2/etc/libserial-gcc-4.0-fix.patch b/campcaster/src/tools/libserial/libserial-0.5.2/etc/libserial-gcc-4.0-fix.patch new file mode 100644 index 000000000..71e2455f2 --- /dev/null +++ b/campcaster/src/tools/libserial/libserial-0.5.2/etc/libserial-gcc-4.0-fix.patch @@ -0,0 +1,21 @@ +diff -aur libserial-0.5.2 libserial-0.5.2-gcc-4.0 +--- libserial-0.5.2/src/SerialStreamBuf.h 2005-10-17 02:19:12.000000000 +0200 ++++ libserial-0.5.2-gcc-4.0/src/SerialStreamBuf.h 2007-01-23 14:16:18.000000000 +0100 +@@ -568,6 +568,6 @@ + return next_ch ; + } + +- } ; // namespace LibSerial ++ } // namespace LibSerial + } // extern "C++" + #endif // #ifndef _SerialStreamBuf_h_ +--- libserial-0.5.2/src/SerialStream.h 2005-10-01 23:24:21.000000000 +0200 ++++ libserial-0.5.2-gcc-4.0/src/SerialStream.h 2007-01-23 14:16:23.000000000 +0100 +@@ -346,6 +346,6 @@ + return mIOBuffer->is_open() ; + } + +- } ; // namespace LibSerial ++ } // namespace LibSerial + } // extern "C++" + #endif // #ifndef _SerialStream_h_