17#include <QApplication>
26#include "ui_display.h"
31int main(
int argc,
char *argv[])
36 if (!
yarp.checkNetwork())
38 yError(
"Error initializing yarp network (is yarpserver running?)");
49 yInfo() <<
"Options:";
50 yInfo() <<
"--local <name> The name of the local port opened by this module. e.g. batteryMonitor";
51 yInfo() <<
"--remote <name> The name of the remote port to connect to, e.g. /mybattery.";
52 yInfo() <<
" The port name is completed by the client adding /data:o, /rpc:i";
53 yInfo() <<
"--refresh_period <seconds> Refresh period of the gui. Default value: 10s";
54 yInfo() <<
"--keep-above Keep window above the others";
61 std::string remotePort =
"";
62 if (rf.
check(
"remote"))
68 if (rf.
check(
"refresh_period"))
73 yError() <<
"refresh_period cannot be <=0. Using default value.";
80 yInfo() <<
"refresh_period parameter missing. Using default value:" <<
refresh_period <<
"s";
92 std::string localPort =
pname;
94 if (rf.
check(
"local"))
98 yInfo() <<
"Using local port:" << localPort;
101 options.
put(
"device",
"battery_nwc_yarp");
102 options.
put(
"local", localPort);
103 options.
put(
"remote", remotePort);
108 yError(
"Problems instantiating the device driver");
116 yError(
"Problems viewing the battery interface");
124 if (rf.
check(
"keep-above"))
126 w.setWindowFlags(Qt::WindowStaysOnTopHint);
134 yInfo(
"Closing Battery Interface");
contains the definition of a Vector type
bool view(T *&x)
Get an interface to the device driver.
A generic battery interface.
A container for a device driver.
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
A mini-server for performing network communication in the background.
static bool exists(const std::string &port, bool quiet=true, bool checkVer=true)
Check for a port to be ready and responsive.
Utilities for manipulating the YARP network, including initialization and shutdown.
A class for storing options and configuration information.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Helper class for finding config files and other external resources.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
virtual yarp::conf::float32_t asFloat32() const
Get 32-bit floating point value.
virtual std::string asString() const
Get string value.
int main(int argc, char *argv[])
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.