qnode.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef rocon_qorchestra_QNODE_HPP_
00013 #define rocon_qorchestra_QNODE_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include <ros/ros.h>
00020 #include <string>
00021 #include <QThread>
00022 #include <QMutex>
00023 #include <QStandardItemModel>
00024 #include <concert_msgs/ConcertClients.h>
00025 #include "implementations.hpp"
00026 
00027 /*****************************************************************************
00028 ** Namespaces
00029 *****************************************************************************/
00030 
00031 namespace rocon_qorchestra
00032 {
00033 
00034 /*****************************************************************************
00035 ** Class
00036 *****************************************************************************/
00037 
00038 class QNode : public QThread
00039 {
00040   Q_OBJECT
00041   public:
00042     QNode(int argc, char** argv );
00043     virtual ~QNode();
00044     bool init();
00045     bool init(const std::string &master_url, const std::string &host_url);
00046     void run();
00047 
00048     /*********************
00049     ** Models
00050     **********************/
00051     QStandardItemModel* concertClientsModel() { return &concert_clients_model_; }
00052     void checkSolution( const QModelIndex &index );
00053 
00054     /*********************
00055         ** Variables
00056         **********************/
00057     Implementations implementations;
00058 
00059   public Q_SLOTS:
00060     void retrieveClientAppList( const QModelIndex &index );
00061     void retrieveAppDetails( const QModelIndex &index );
00062     void installApp( const QModelIndex &index );
00063     void uninstallApp( const QModelIndex &index );
00064     void installMissingApps( const QStandardItem* );
00065     void startSolution() { triggerSolution(true); }
00066     void stopSolution() { triggerSolution(false); }
00067 
00068   Q_SIGNALS:
00069     void rosShutdown();
00070     void concertClientsUpdate();
00071     void clientAppListRetrieved( QStandardItemModel* );
00072     void appDetailsRetrieved( QStandardItemModel* );
00073     void installMissingAppsRequest ( const QStandardItem* );
00074     void missingAppsInstalled( const QModelIndex &index );
00075     void solutionRequirementsMet();
00076 
00077   private:
00078     /*********************
00079     ** Ros Comms
00080     **********************/
00081     void establishRosComms();
00082     void subscribeConcertClients(const concert_msgs::ConcertClientsConstPtr concert);
00083     QStandardItem* createConcertClientDataElement(const std::string &str,
00084                                                   const Qt::Alignment &alignment = Qt::AlignHCenter);
00085     QStandardItem* createConcertClientAppsDataElement(const std::string &str,
00086                                                       const Qt::Alignment &alignment = Qt::AlignHCenter);
00087     void getClientAppsData(std::string robot_namespace);
00088 
00089     /*********************
00090         ** Concert Client Intro
00091         **********************/
00092     bool clientIsConnected(const int &row);
00093     bool clientIsAndroid(const int &row);
00094     QString clientDeviceTriple(const int &row);
00095 
00096     /*********************
00097         ** Backends
00098         **********************/
00099     void triggerSolution(bool start = true);
00100 
00101     int init_argc_;
00102     char** init_argv_;
00103     ros::Publisher chatter_publisher_;
00104     ros::Subscriber concert_clients_subscriber_;
00105     QStandardItemModel concert_clients_model_;
00106     QStandardItemModel concert_clients_apps_model_;
00107     QStandardItemModel client_apps_model_;
00108     QStandardItemModel app_details_model_;
00109     QMutex mutex_;
00110     QStringList solution_device_configurations_;
00111 
00112     concert_msgs::ConcertClientsConstPtr concert_clients_ptr_;
00113     QModelIndex current_client_index_, check_solution_index_;
00114     unsigned int current_highlighted_app_;
00115     QList<QStandardItem*> client_installable_apps_list_, client_installed_apps_list_;
00116 };
00117 
00118 }  // namespace rocon_qorchestra
00119 
00120 #endif /* rocon_qorchestra_QNODE_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


graveyard_rocon_qorchestra
Author(s): Daniel Stonier
autogenerated on Wed Jan 23 2013 13:42:01