Subversion Repositories HomeAutomation

Rev

Rev 1664 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  *
  3.  *  Copyright (C) 2010  Mattias Runge
  4.  *
  5.  *  This program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2 of the License, or
  8.  *  (at your option) any later version.
  9.  *
  10.  *  This program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *  GNU General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU General Public License along
  16.  *  with this program; if not, write to the Free Software Foundation, Inc.,
  17.  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18.  *
  19.  */
  20.  
  21. #ifndef VM_PLUGIN_CONSOLE_H
  22. #define VM_PLUGIN_CONSOLE_H
  23.  
  24. #include <boost/shared_ptr.hpp>
  25.  
  26. #include "logging/Logger.h"
  27. #include "net/Subscriber.h"
  28. #include "net/types.h"
  29. #include "common/Byteset.h"
  30.  
  31. #include "vm/Plugin.h"
  32.  
  33. namespace atom {
  34. namespace vm {
  35. namespace plugin {
  36.  
  37. class Console : public Plugin
  38. {
  39. public:
  40.     typedef boost::shared_ptr<Console> Pointer;
  41.    
  42.     Console(boost::asio::io_service& io_service, unsigned int port);
  43.     virtual ~Console();
  44.    
  45.     void InitializeDone();
  46.     void CallOutput(unsigned int request_id, std::string output);
  47.    
  48. private:
  49.     net::SocketId server_id_;
  50.     static net::SocketId current_client_id_;
  51.    
  52.     void SlotOnNewState(net::SocketId client_id, net::SocketId server_id, net::ClientState client_state);
  53.     void SlotOnNewData(net::SocketId client_id, net::SocketId server_id, common::Byteset data);
  54.    
  55.     void SlotOnNewStateHandler(net::SocketId client_id, net::SocketId server_id, net::ClientState client_state);
  56.     void SlotOnNewDataHandler(net::SocketId client_id, net::SocketId server_id, common::Byteset data);
  57.    
  58.     static logging::Logger LOG;
  59.    
  60.     static Value Export_PromptRequest(const v8::Arguments& args);
  61.     static Value Export_AutoCompleteResponse(const v8::Arguments& args);
  62.     static Value Export_LogToClient(const v8::Arguments& args);
  63.     static Value Export_DisconnectClient(const v8::Arguments& args);
  64. };
  65.  
  66. }; // namespace plugin
  67. }; // namespace vm
  68. }; // namespace atom
  69.  
  70. #endif // VM_PLUGIN_CONSOLE_H
  71.