|
idle_detect
0.8.3.0
Provides overall idle detection for a linux computer
|
The EventMessage class is a small class that encapsulates the "event message", which is a message sent from the local idle_detect instance to event_detect indicating an event that updates the last active time. The message is effectively timestamp:m_event_type in string format (to make use of pipe easier). More...
#include <util.h>
Public Types | |
| enum | EventType { UNKNOWN, USER_ACTIVE, USER_UNFORCE, USER_FORCE_ACTIVE, USER_FORCE_IDLE } |
| The EventType enum defines event types for the EventMessage class. Currently there is only one event type in use, USER_ACTIVE. | |
Public Member Functions | |
| EventMessage () | |
| Constructs an "empty" EventMessage with timestamp of 0 and EventType of UNKNOWN. | |
| EventMessage (int64_t timestamp, EventType event_type) | |
| Constructs an EventMessage from the provided parameters. More... | |
| EventMessage (std::string timestamp_str, std::string event_type_str) | |
| Constructs an EventMessage from the provided strings. More... | |
| std::string | EventTypeToString () |
| Converts m_event_type member variable in the EventMessage object to a string. More... | |
| bool | IsValid () |
| Validates the EventMessage object. More... | |
| std::string | ToString () |
| Returns the string message format of the EventMessage object. This is meant to go on the pipe. This is in lieu of a full serialization approach, which is overkill here. More... | |
Static Public Member Functions | |
| static std::string | EventTypeToString (const EventType &event_type) |
| Static version that takes the event_type enum as a parameter and provides the string representation. More... | |
Public Attributes | |
| int64_t | m_timestamp |
| EventType | m_event_type |
Private Member Functions | |
| EventType | EventTypeStringToEnum (const std::string &event_type_str) |
| This converts the event type string to the proper enum value. It is the converse of EventTypeToString(). More... | |
The EventMessage class is a small class that encapsulates the "event message", which is a message sent from the local idle_detect instance to event_detect indicating an event that updates the last active time. The message is effectively timestamp:m_event_type in string format (to make use of pipe easier).
The class stores these in their native format.
A validation method and conversion to string format are provided.
| EventMessage::EventMessage | ( | int64_t | timestamp, |
| EventType | event_type | ||
| ) |
Constructs an EventMessage from the provided parameters.
| timestamp | |
| event_type |
| EventMessage::EventMessage | ( | std::string | timestamp_str, |
| std::string | event_type_str | ||
| ) |
Constructs an EventMessage from the provided strings.
| timestamp_str | |
| event_type_str |

|
private |
This converts the event type string to the proper enum value. It is the converse of EventTypeToString().
| event_type_str |

| std::string EventMessage::EventTypeToString | ( | ) |
Converts m_event_type member variable in the EventMessage object to a string.

|
static |
Static version that takes the event_type enum as a parameter and provides the string representation.
| event_type |
| bool EventMessage::IsValid | ( | ) |
Validates the EventMessage object.

| std::string EventMessage::ToString | ( | ) |
Returns the string message format of the EventMessage object. This is meant to go on the pipe. This is in lieu of a full serialization approach, which is overkill here.

1.8.14