now using the libserial library (part of #722)
This commit is contained in:
parent
7b79a6835e
commit
99c182d179
5 changed files with 73 additions and 5 deletions
|
@ -304,7 +304,7 @@ G_LIVESUPPORT_EXE_LIBS = -l${PLAYLIST_EXECUTOR_LIB} \
|
||||||
-l${SCHEDULER_CLIENT_LIB} \
|
-l${SCHEDULER_CLIENT_LIB} \
|
||||||
-l${CORE_LIB} \
|
-l${CORE_LIB} \
|
||||||
${BOOST_DATE_TIME_LIB} \
|
${BOOST_DATE_TIME_LIB} \
|
||||||
-lxmlrpc++ -lssl -ltar
|
-lxmlrpc++ -lssl -ltar -lserial
|
||||||
|
|
||||||
TEST_RUNNER_OBJS = ${G_LIVESUPPORT_OBJS} \
|
TEST_RUNNER_OBJS = ${G_LIVESUPPORT_OBJS} \
|
||||||
${TMP_DIR}/TestRunner.o \
|
${TMP_DIR}/TestRunner.o \
|
||||||
|
|
|
@ -182,6 +182,11 @@ const std::string authenticationNotReachableKey =
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
const std::string localeNotAvailableKey = "localeNotAvailableMsg";
|
const std::string localeNotAvailableKey = "localeNotAvailableMsg";
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* The default serial device
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
const std::string defaultSerialDevice = "/dev/ttyS0";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
@ -396,6 +401,9 @@ GLiveSupport :: configure(const xmlpp::Element & element)
|
||||||
testAudioUrl.reset(new Glib::ustring(
|
testAudioUrl.reset(new Glib::ustring(
|
||||||
testAudioUrlElement->get_attribute("path")
|
testAudioUrlElement->get_attribute("path")
|
||||||
->get_value() ));
|
->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<const std::string>::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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <unicode/resbund.h>
|
#include <unicode/resbund.h>
|
||||||
|
#include <SerialStream.h>
|
||||||
|
|
||||||
#include "LiveSupport/Core/Ptr.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
#include "LiveSupport/Core/LocalizedConfigurable.h"
|
#include "LiveSupport/Core/LocalizedConfigurable.h"
|
||||||
|
@ -253,17 +254,27 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
/**
|
/**
|
||||||
* The location of the test audio file.
|
* The location of the test audio file.
|
||||||
*/
|
*/
|
||||||
Ptr<Glib::ustring>::Ref testAudioUrl;
|
Ptr<Glib::ustring>::Ref testAudioUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The command which starts the scheduler daemon.
|
* The command which starts the scheduler daemon.
|
||||||
*/
|
*/
|
||||||
Ptr<Glib::ustring>::Ref schedulerDaemonStartCommand;
|
Ptr<Glib::ustring>::Ref schedulerDaemonStartCommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The command which stops the scheduler daemon.
|
* The command which stops the scheduler daemon.
|
||||||
*/
|
*/
|
||||||
Ptr<Glib::ustring>::Ref schedulerDaemonStopCommand;
|
Ptr<Glib::ustring>::Ref schedulerDaemonStopCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The serial device.
|
||||||
|
*/
|
||||||
|
Ptr<std::string>::Ref serialDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The serial stream object.
|
||||||
|
*/
|
||||||
|
Ptr<LibSerial::SerialStream>::Ref serialStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a supportedLanguages configuration element,
|
* Read a supportedLanguages configuration element,
|
||||||
|
@ -375,6 +386,7 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
{
|
{
|
||||||
openedAudioClips.reset(new AudioClipMap());
|
openedAudioClips.reset(new AudioClipMap());
|
||||||
openedPlaylists.reset(new PlaylistMap());
|
openedPlaylists.reset(new PlaylistMap());
|
||||||
|
serialStream.reset(new LibSerial::SerialStream());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1277,6 +1289,12 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
createScratchpadWindow(void) throw ();
|
createScratchpadWindow(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a string to the serial device.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
writeToSerial(Ptr<const std::string>::Ref message) throw ();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================= external data structures */
|
/* ================================================= external data structures */
|
||||||
|
|
|
@ -48,6 +48,7 @@ cd ${tmpdir}
|
||||||
if [ ! -d $product ]; then
|
if [ ! -d $product ]; then
|
||||||
tar xfz ${tar}
|
tar xfz ${tar}
|
||||||
cd $product
|
cd $product
|
||||||
# put patches here
|
# patch not submitted yet
|
||||||
|
patch -p1 < $etcdir/libserial-gcc-4.0-fix.patch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -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_
|
Loading…
Add table
Add a link
Reference in a new issue