diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-06-10 22:47:14 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-06-10 22:47:14 (GMT) |
commit | 6f56474450b7c54f2c95b5dea6a7a42623141649 (patch) | |
tree | 420c52085d8cf778360c09baf9722b21d01259da /apps/w3c-mmi/MMIEventServlet.h | |
parent | a154682fc1b25581742d38dd5fe9aa06ede167b7 (diff) | |
download | uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.zip uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.tar.gz uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.tar.bz2 |
W3C MMI Architecture framework
Diffstat (limited to 'apps/w3c-mmi/MMIEventServlet.h')
-rw-r--r-- | apps/w3c-mmi/MMIEventServlet.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/apps/w3c-mmi/MMIEventServlet.h b/apps/w3c-mmi/MMIEventServlet.h new file mode 100644 index 0000000..10adbc3 --- /dev/null +++ b/apps/w3c-mmi/MMIEventServlet.h @@ -0,0 +1,59 @@ +#ifndef MMIEVENTSERVLET_H_92WSR1SU +#define MMIEVENTSERVLET_H_92WSR1SU + + +#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h" +#include "uscxml/server/HTTPServer.h" +#include "uscxml/Interpreter.h" +#include "uscxml/Factory.h" +#ifndef _WIN32 +#include <sys/time.h> +#endif + +#include <event2/http.h> +#include <event2/http_struct.h> + +#include <uscxml/plugins/ioprocessor/modality/MMIMessages.h> + +namespace uscxml { + + class MMIEventServlet : public HTTPServlet, public URLMonitor, public MMIEventSender { + public: + MMIEventServlet(const std::string& path); + virtual ~MMIEventServlet(); + + void addMonitor(MMIEventReceiver* mmiMonitor) { + _monitors.insert(mmiMonitor); + } + void removeMonitor(MMIEventReceiver* mmiMonitor) { + _monitors.erase(mmiMonitor); + } + + /// HTTPServlet + void httpRecvRequest(const HTTPServer::Request& req); + void setURL(const std::string& url) { + _url = url; + } + std::string getURL() { return _url; } + + bool canAdaptPath() { + return false; + } + + // URLMonitor + void downloadStarted(const URL& url); + void downloadCompleted(const URL& url); + void downloadFailed(const URL& url, int errorCode); + + // MMIEventSender + virtual void send(const MMIEvent& mmiEvent); + + protected: + std::string _url; + std::string _path; + std::map<std::string, std::pair<URL, SendRequest> > _sendRequests; + std::set<MMIEventReceiver*> _monitors; + }; +} + +#endif /* end of include guard: MMIEVENTSERVLET_H_92WSR1SU */ |