|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
40 if (!writer.
writeTag(
"setBatteryVoltage", 1, 1)) {
77 if (!writer.
writeTag(
"setBatteryCurrent", 1, 1)) {
114 if (!writer.
writeTag(
"setBatteryCharge", 1, 1)) {
151 if (!writer.
writeTag(
"setBatteryInfo", 1, 1)) {
178 m_temperature{temperature}
188 if (!writer.
writeTag(
"setBatteryTemperature", 1, 1)) {
227 if (!writer.
writeTag(
"getBatteryVoltage", 1, 1)) {
270 if (!writer.
writeTag(
"getBatteryCurrent", 1, 1)) {
313 if (!writer.
writeTag(
"getBatteryCharge", 1, 1)) {
356 if (!writer.
writeTag(
"getBatteryStatus", 1, 1)) {
399 if (!writer.
writeTag(
"getBatteryInfo", 1, 1)) {
442 if (!writer.
writeTag(
"getBatteryTemperature", 1, 1)) {
470 if (!
yarp().canWrite()) {
471 yError(
"Missing server method '%s'?",
"void FakeBatteryService::setBatteryVoltage(const double voltage)");
479 if (!
yarp().canWrite()) {
480 yError(
"Missing server method '%s'?",
"void FakeBatteryService::setBatteryCurrent(const double current)");
488 if (!
yarp().canWrite()) {
489 yError(
"Missing server method '%s'?",
"void FakeBatteryService::setBatteryCharge(const double charge)");
497 if (!
yarp().canWrite()) {
498 yError(
"Missing server method '%s'?",
"void FakeBatteryService::setBatteryInfo(const std::string& info)");
506 if (!
yarp().canWrite()) {
507 yError(
"Missing server method '%s'?",
"void FakeBatteryService::setBatteryTemperature(const double temperature)");
515 if (!
yarp().canWrite()) {
516 yError(
"Missing server method '%s'?",
"double FakeBatteryService::getBatteryVoltage()");
525 if (!
yarp().canWrite()) {
526 yError(
"Missing server method '%s'?",
"double FakeBatteryService::getBatteryCurrent()");
535 if (!
yarp().canWrite()) {
536 yError(
"Missing server method '%s'?",
"double FakeBatteryService::getBatteryCharge()");
545 if (!
yarp().canWrite()) {
546 yError(
"Missing server method '%s'?",
"std::string FakeBatteryService::getBatteryStatus()");
555 if (!
yarp().canWrite()) {
556 yError(
"Missing server method '%s'?",
"std::string FakeBatteryService::getBatteryInfo()");
565 if (!
yarp().canWrite()) {
566 yError(
"Missing server method '%s'?",
"double FakeBatteryService::getBatteryTemperature()");
575 bool showAll = (functionName ==
"--all");
576 std::vector<std::string> helpString;
578 helpString.emplace_back(
"*** Available commands:");
579 helpString.emplace_back(
"setBatteryVoltage");
580 helpString.emplace_back(
"setBatteryCurrent");
581 helpString.emplace_back(
"setBatteryCharge");
582 helpString.emplace_back(
"setBatteryInfo");
583 helpString.emplace_back(
"setBatteryTemperature");
584 helpString.emplace_back(
"getBatteryVoltage");
585 helpString.emplace_back(
"getBatteryCurrent");
586 helpString.emplace_back(
"getBatteryCharge");
587 helpString.emplace_back(
"getBatteryStatus");
588 helpString.emplace_back(
"getBatteryInfo");
589 helpString.emplace_back(
"getBatteryTemperature");
590 helpString.emplace_back(
"help");
592 if (functionName ==
"setBatteryVoltage") {
593 helpString.emplace_back(
"void setBatteryVoltage(const double voltage) ");
595 if (functionName ==
"setBatteryCurrent") {
596 helpString.emplace_back(
"void setBatteryCurrent(const double current) ");
598 if (functionName ==
"setBatteryCharge") {
599 helpString.emplace_back(
"void setBatteryCharge(const double charge) ");
601 if (functionName ==
"setBatteryInfo") {
602 helpString.emplace_back(
"void setBatteryInfo(const std::string& info) ");
604 if (functionName ==
"setBatteryTemperature") {
605 helpString.emplace_back(
"void setBatteryTemperature(const double temperature) ");
607 if (functionName ==
"getBatteryVoltage") {
608 helpString.emplace_back(
"double getBatteryVoltage() ");
610 if (functionName ==
"getBatteryCurrent") {
611 helpString.emplace_back(
"double getBatteryCurrent() ");
613 if (functionName ==
"getBatteryCharge") {
614 helpString.emplace_back(
"double getBatteryCharge() ");
616 if (functionName ==
"getBatteryStatus") {
617 helpString.emplace_back(
"std::string getBatteryStatus() ");
619 if (functionName ==
"getBatteryInfo") {
620 helpString.emplace_back(
"std::string getBatteryInfo() ");
622 if (functionName ==
"getBatteryTemperature") {
623 helpString.emplace_back(
"double getBatteryTemperature() ");
625 if (functionName ==
"help") {
626 helpString.emplace_back(
"std::vector<std::string> help(const std::string& functionName = \"--all\")");
627 helpString.emplace_back(
"Return list of available commands, or help message for a specific function");
628 helpString.emplace_back(
"@param functionName name of command for which to get a detailed description. If none or '--all' is provided, print list of available commands");
629 helpString.emplace_back(
"@return list of strings (one string per line)");
632 if (helpString.empty()) {
633 helpString.emplace_back(
"Command not found");
648 std::string tag = reader.
readTag();
649 bool direct = (tag ==
"__direct__");
654 if (tag ==
"setBatteryVoltage") {
675 if (tag ==
"setBatteryCurrent") {
696 if (tag ==
"setBatteryCharge") {
717 if (tag ==
"setBatteryInfo") {
738 if (tag ==
"setBatteryTemperature") {
759 if (tag ==
"getBatteryVoltage") {
773 if (tag ==
"getBatteryCurrent") {
787 if (tag ==
"getBatteryCharge") {
801 if (tag ==
"getBatteryStatus") {
815 if (tag ==
"getBatteryInfo") {
829 if (tag ==
"getBatteryTemperature") {
844 std::string functionName;
846 functionName =
"--all";
848 auto help_strings =
help(functionName);
854 if (!writer.
writeTag(
"many", 1, 0)) {
860 for (
const auto& help_string : help_strings) {
876 std::string next_tag = reader.
readTag();
877 if (next_tag ==
"") {
880 tag.append(
"_").append(next_tag);
virtual double getBatteryTemperature()
FakeBatteryService_setBatteryCurrent_helper(const double current)
virtual void setBatteryTemperature(const double temperature)
bool readString(std::string &str, bool *is_vocab=nullptr)
This is a base class for objects that can be both read from and be written to the YARP network.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
virtual double getBatteryCurrent()
static thread_local double s_return_helper
bool writeFloat64(yarp::conf::float64_t x) const
bool writeOnewayResponse() const
static thread_local double s_return_helper
bool setOwner(yarp::os::PortReader &owner)
Set the owner of this WireLink.
virtual void setBatteryCurrent(const double current)
bool write(PortWriter &writer)
Write a message to the associated port or reader.
virtual double getBatteryCharge()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual std::string getBatteryStatus()
FakeBatteryService_getBatteryCurrent_helper()
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
static thread_local std::string s_return_helper
FakeBatteryService_setBatteryInfo_helper(const std::string &info)
bool writeString(const std::string &tag) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
FakeBatteryService_setBatteryVoltage_helper(const double voltage)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeListHeader(int len) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
IDL-friendly connection writer.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
virtual void setBatteryVoltage(const double voltage)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
FakeBatteryService_getBatteryTemperature_helper()
An interface for writing to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
FakeBatteryService_getBatteryCharge_helper()
FakeBatteryService_setBatteryTemperature_helper(const double temperature)
FakeBatteryService_getBatteryInfo_helper()
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual void setBatteryCharge(const double charge)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
static thread_local double s_return_helper
bool writeTag(const char *tag, int split, int len) const
IDL-friendly connection reader.
An interface for reading from a network connection.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
virtual double getBatteryVoltage()
virtual void setBatteryInfo(const std::string &info)
FakeBatteryService_getBatteryVoltage_helper()
bool writeListBegin(int tag, std::uint32_t len) const
bool callback(PortWriter &writer, PortReader &reader, const std::string &tag="")
Put a message in a stack to call later, asynchronously.
virtual std::string getBatteryInfo()
static thread_local double s_return_helper
bool writeListEnd() const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
FakeBatteryService_getBatteryStatus_helper()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
FakeBatteryService_setBatteryCharge_helper(const double charge)
bool readFloat64(yarp::conf::float64_t &x)
static thread_local std::string s_return_helper
virtual std::vector< std::string > help(const std::string &functionName="--all")
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.