YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IBatteryTest.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef IBATTEYTEST_H
7#define IBATTERYTEST_H
8
9#include <yarp/dev/IBattery.h>
10#include <catch2/catch_amalgamated.hpp>
11
12using namespace yarp::dev;
13using namespace yarp::os;
14
15namespace yarp::dev::tests
16{
17 inline void exec_iBattery_test_1(IBattery* ibat)
18 {
19 REQUIRE(ibat != nullptr);
20
21 bool b;
22 double voltage, charge, curr, temp;
23 std::string info;
25 b = ibat->getBatteryVoltage(voltage); CHECK(b);
26 b = ibat->getBatteryCharge(charge); CHECK(b);
27 b = ibat->getBatteryCurrent(curr); CHECK(b);
28 b = ibat->getBatteryTemperature(temp); CHECK(b);
29 b = ibat->getBatteryStatus(status); CHECK(b);
30 b = ibat->getBatteryInfo(info); CHECK(b);
31 }
32}
33
34#endif
A generic battery interface.
Definition IBattery.h:26
virtual yarp::dev::ReturnValue getBatteryTemperature(double &temperature)=0
get the battery temperature
virtual yarp::dev::ReturnValue getBatteryInfo(std::string &battery_info)=0
get the battery hardware characteristics (e.g.
virtual yarp::dev::ReturnValue getBatteryCharge(double &charge)=0
get the battery status of charge
virtual yarp::dev::ReturnValue getBatteryStatus(Battery_status &status)=0
get the battery status
virtual yarp::dev::ReturnValue getBatteryCurrent(double &current)=0
Get the instantaneous current measurement.
virtual yarp::dev::ReturnValue getBatteryVoltage(double &voltage)=0
Get the instantaneous voltage measurement.
A mini-server for performing network communication in the background.
void exec_iBattery_test_1(IBattery *ibat)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.