43 currentTexture(nullptr),
44 currentStatus(BatteryStatusMissing),
90 bool TextureBattery::initBatteryClient()
97 std::string robot_name =
"foo";
98 std::string localPort =
"/oculus/battery:i";
99 std::string remotePort =
"/" + robot_name +
"/battery:o";
102 options.
put(
"robot", robot_name.c_str());
103 options.
put(
"device",
"BatteryClient");
104 options.
put(
"local", localPort.c_str());
105 options.
put(
"remote", remotePort.c_str());
107 options.
put(
"quiet",
true);
111 if (!drv || !(drv->
isValid())) {
140 if (!initBatteryClient()) {
166 }
else if (charge > 80.0) {
172 }
else if (charge > 60.0) {
178 }
else if (charge > 40.0) {
184 }
else if (charge > 20.0) {
const yarp::os::LogComponent & OVRHEADSET()
TextureStatic * currentTexture
@ BatteryStatusCharging060
@ BatteryStatusChargingLow
@ BatteryStatusChargingCaution
@ BatteryStatusCharging080
@ BatteryStatusCharging040
virtual void run()
Loop function.
TextureBattery(ovrSession session, bool enabled)
bool view(T *&x)
Get an interface to the device driver.
virtual bool getBatteryStatus(Battery_status &status)=0
get the battery status
virtual bool getBatteryCharge(double &charge)=0
get the battery status of charge
A container for a device driver.
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
void suspend()
Suspend the thread, the thread keeps running by doLoop is never executed.
bool start()
Call this to start the thread.
double getPeriod() const
Return the current period of the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
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.
const TextureStatic::Image battery_040
const TextureStatic::Image battery_060
const TextureStatic::Image battery_080
const TextureStatic::Image battery_100
const TextureStatic::Image battery_caution
const TextureStatic::Image battery_charging_040
const TextureStatic::Image battery_charging_060
const TextureStatic::Image battery_charging_080
const TextureStatic::Image battery_charging_caution
const TextureStatic::Image battery_charging_low
const TextureStatic::Image battery_charging
const TextureStatic::Image battery_low
const TextureStatic::Image battery_missing
#define yCError(component,...)
#define yCAssert(component, x)
#define yCWarning(component,...)
The main, catch-all namespace for YARP.