##

RestWebPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PLUGINS_REST_WEB_RESTWEBPLUGIN_HH_
#define GAZEBO_PLUGINS_REST_WEB_RESTWEBPLUGIN_HH_
#include <list>
#include <mutex>
#include <vector>
#include <string>
#include <thread>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include "RestApi.hh"
namespace gazebo
{
class GAZEBO_VISIBLE RestWebPlugin : public SystemPlugin
{
public: RestWebPlugin();
public: virtual ~RestWebPlugin();
public: virtual void Load(int _argc, char **_argv);
public: void OnRestLoginRequest(ConstRestLoginPtr &_msg);
public: void OnRestLogoutRequest(ConstRestLogoutPtr &_msg);
public: void OnEventRestPost(ConstRestPostPtr &_msg);
public: void OnSimEvent(ConstSimEventPtr &_msg);
private: virtual void Init();
private: void RunRequestQ();
private: void ProcessLoginRequest(ConstRestLoginPtr _msg);
private: gazebo::transport::NodePtr node;
private: gazebo::transport::SubscriberPtr subLogin;
private: gazebo::transport::SubscriberPtr subLogout;
private: gazebo::transport::SubscriberPtr subEvent;
private: gazebo::transport::SubscriberPtr subSimEvent;
private: gazebo::transport::PublisherPtr pub;
private: std::vector<event::ConnectionPtr> connections;
private: RestApi restApi;
private: bool stopMsgProcessing;
private: std::list<boost::shared_ptr<const gazebo::msgs::RestLogin>>
msgLoginQ;
private: std::thread *requestQThread;
private: std::mutex requestQMutex;
private: std::string session;
};
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::transport::PublisherPtr
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
gazebo::transport::SubscriberPtr
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
gazebo.hh
gazebo::transport::NodePtr
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
gazebo::RestApi
REST interface.
Definition: RestApi.hh:32
RestApi.hh
gazebo::SystemPlugin
A plugin loaded within the gzserver on startup.
Definition: Plugin.hh:361
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::RestWebPlugin
REST web plugin.
Definition: RestWebPlugin.hh:36
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59