Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Examples

LCDTimeSensor Class Reference
[Sensors]

#include "api/LCDTimeSensor.h"

Inheritance diagram for LCDTimeSensor:

Inheritance graph
[legend]
Collaboration diagram for LCDTimeSensor:

Collaboration graph
[legend]
List of all members.

Detailed Description

This sensor will return the current time in specified format. The format is the one used by date(1)
Examples:

client.cpp.

Definition at line 16 of file LCDTimeSensor.h.

Public Member Functions

virtual void waitForChange ()
 Returns when a change occured on the measured value.

virtual std::string getCurrentValue ()
 Get the current value measured by the sensor.

 LCDTimeSensor (const std::string &format=LCD_TIME_HOUR_MINUTE)
 Default constructor.

std::string intToString (int value)
 Convert an integer to a string.

std::string executeCommand (const std::string &cmd)
 Execute an external command.

void addOnChangeWidget (LCDWidget *widget)
 Add a new widget that must be set when the sensor value changes.

void addOnTimeOutWidget (LCDWidget *widget, int timeOut)
 Add a new widget that must be changed regularly.

void removeOnChangeWidget (LCDWidget *widget)
 Remove a widget that was added with addOnChangeWidget.

void removeOnChangeWidget (std::string id)
 Remove a widget that was added with addOnChangeWidget.

void removeOnTimeOutWidget (LCDWidget *widget)
 Remove a widget that was added with addOnTimeOutWidget.

void removeOnTimeOutWidget (std::string id)
 Remove a widget that was added with addOnTimeOutWidget.


Constructor & Destructor Documentation

LCDTimeSensor const std::string &  format = LCD_TIME_HOUR_MINUTE  ) 
 

Used to build such a sensor.

Parameters:
format A string containing the format to use, as defined by date(1). The default value makes this sensor return current hour and minute seperated by a colon.

Definition at line 10 of file LCDTimeSensor.cpp.


Member Function Documentation

void addOnChangeWidget LCDWidget widget  )  [inherited]
 

This method is used to associate a wiget to a sensor. When the sensor value change, the widget value will be changed accordingly.

Parameters:
widget The widget to associate with this sensor.
Examples:
client.cpp.

Definition at line 108 of file LCDSensor.cpp.

void addOnTimeOutWidget LCDWidget widget,
int  timeOut
[inherited]
 

This method is used to associate a wiget to a sensor. Each time the specified timeout ellapsed, widget value is changed.

Parameters:
widget The widget to associate with this sensor.
timeOut The time to wait between each update (second tenths).

Definition at line 137 of file LCDSensor.cpp.

string executeCommand const std::string &  cmd  )  [inherited]
 

This method can be used to invoke another program and get its output. Only the first line is returned.

Parameters:
cmd The command to execute as if a shell is used.
Returns:
A string containing the first line of the command output.

Definition at line 88 of file LCDSensor.cpp.

string getCurrentValue  )  [virtual]
 

This virtual function should be implemented by a real sensor. It should return the current value as a string.

Returns:
Current value of the sensor.

Implements LCDSensor.

Definition at line 20 of file LCDTimeSensor.cpp.

string intToString int  value  )  [inherited]
 

Utility function to convert an integer to a string so it can be returned by getCurrentValue. It should return the current value as a string.

Parameters:
value The integer value to convert.
Returns:
String version of the value.

Definition at line 83 of file LCDSensor.cpp.

void removeOnChangeWidget std::string  id  )  [inherited]
 

This method is used to delete the association between a wiget and a sensor.

Parameters:
id The identifier of the widget to remove from sensor configuration.

Definition at line 124 of file LCDSensor.cpp.

void removeOnChangeWidget LCDWidget widget  )  [inherited]
 

This method is used to delete the association between a wiget and a sensor.

Parameters:
widget The widget to remove from sensor configuration.

Definition at line 119 of file LCDSensor.cpp.

void removeOnTimeOutWidget std::string  id  )  [inherited]
 

This method is used to delete the association between a wiget and a sensor.

Parameters:
id The identifier of the widget to remove from sensor configuration.

Definition at line 155 of file LCDSensor.cpp.

void removeOnTimeOutWidget LCDWidget widget  )  [inherited]
 

This method is used to delete the association between a wiget and a sensor.

Parameters:
widget The widget to remove from sensor configuration.

Definition at line 150 of file LCDSensor.cpp.

void waitForChange  )  [virtual]
 

This virtual function should be implemented by a real sensor. It should wait for the value to change and then just return.

Implements LCDSensor.

Definition at line 15 of file LCDTimeSensor.cpp.


Generated on Wed Aug 4 19:39:11 2004 for LCDApi by doxygen 1.3.6