YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
utils.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#if defined(_WIN32)
7 #pragma warning (disable : 4099)
8 #pragma warning (disable : 4250)
9 #pragma warning (disable : 4520)
10#endif
11
12#include <dirent.h>
13
14#if defined(_WIN32)
15 #undef max /*conflict with pango lib coverage.h*/
16 #include <direct.h>
17 #define GetCurrentDir _getcwd
18#else
19 #include <unistd.h>
20 #include <cerrno>
21 #include <sys/stat.h>
22 #define GetCurrentDir getcwd
23#endif
24
25#include <yarp/os/Time.h>
26#include <cstdio> /* defines FILENAME_MAX */
27#include "include/utils.h"
28
29#include <iostream>
30#include <utility>
31#include "include/mainwindow.h"
32
33using namespace yarp::os;
34using namespace yarp::sig;
35
36/**********************************************************/
40/**********************************************************/
41QUtilities::QUtilities(QObject *parent) : QObject(parent), qengine(nullptr)
42{
43 connect(this,SIGNAL(updateGuiThread()),(MainWindow*)parent,
44 SLOT(onUpdateGuiRateThread()),Qt::BlockingQueuedConnection);
45
46 connect(this,SIGNAL(pause()),(MainWindow*)parent,
47 SLOT(resetButtonOnStop()),Qt::BlockingQueuedConnection);
48
49 connect(this,SIGNAL(errorMessage(QString)),(MainWindow*)parent,
50 SLOT(onErrorMessage(QString)),Qt::QueuedConnection);
51}
52
53/**********************************************************/
55{
56 this->qengine->stepfromCmd = true;
57 yInfo() << "asking qutils to step the thread";
58 if ( this->qengine->isRunning() ){
59 yInfo() << "asking qutils to pause the thread";
60 this->qengine->pause();
61 }
62 if ( this->qengine->isSuspended() ){
63 yInfo() << "asking qutils to resume the thread";
64 this->qengine->resume();
65 } else if ( !this->qengine->isRunning() ) {
66 yInfo() << "asking qutils to start the thread";
67 for (int i=0; i < totalThreads; i++){
68 this->partDetails[i].worker->init();
69 }
70 this->qengine->start();
71 }
72 yInfo() << "ok................ \n";
73
74}
75
76/**********************************************************/
78{
79 pause();
80}
#define yInfo(...)
Definition Log.h:319
int SIGNAL(int pid, int signum)
MainWindow class.
Definition display.h:22
QEngine * qengine
Definition utils.h:36
void updateGuiThread()
void errorMessage(QString)
void pause()
void resetButton()
Definition utils.cpp:77
~QUtilities()
Definition utils.cpp:37
void stepThread()
Definition utils.cpp:54
QUtilities(QObject *parent=NULL)
Definition utils.cpp:41
A mini-server for performing network communication in the background.
An interface to the operating system, including Port based communication.