BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
CHifDecoder Class Reference

Class for decoding and managing HIF events. More...

#include <hif_decoder.h>

Public Member Functions

 CHifDecoder ()
 Constructs a CHifDecoder object.
 
 ~CHifDecoder ()
 Destructs the CHifDecoder object.
 
const b8HifMouseStatus * GetMouseStatus ()
 Retrieves the current mouse or touch panel status.
 
const std::map< u8, HifPoint * > & GetStatus ()
 Retrieves the current status of active input points.
 

Detailed Description

Class for decoding and managing HIF events.

The CHifDecoder class fetches and manages human interface events from the Hardware Interface (HIF) system. It maintains an internal map of active input points (HifPoint instances), identified by their event identifiers.

Constructor & Destructor Documentation

◆ CHifDecoder()

CHifDecoder::CHifDecoder ( )

Constructs a CHifDecoder object.

Initializes the internal implementation of the decoder.

◆ ~CHifDecoder()

CHifDecoder::~CHifDecoder ( )

Destructs the CHifDecoder object.

Cleans up the internal implementation of the decoder.

Member Function Documentation

◆ GetMouseStatus()

const b8HifMouseStatus * CHifDecoder::GetMouseStatus ( )

Retrieves the current mouse or touch panel status.

This method provides access to the current state of the mouse or touch panel by returning a pointer to a b8HifMouseStatus structure. The returned structure includes information about the current position and dragging state of the mouse or touch input.

Usage Example:

const b8HifMouseStatus* status = decoder.GetMouseStatus();
if (status->is_dragging) {
int x = status->mouse_x >> 4; // Convert fixed-point to integer
int y = status->mouse_y >> 4;
// Handle dragging at position (x, y)
}
Note
  • The mouse_x and mouse_y values are 16-bit signed fixed-point numbers with 4 fractional bits. To obtain the integer part of the coordinates, shift right by 4 bits (i.e., mouse_x >> 4).
Returns
A pointer to the current b8HifMouseStatus structure.

◆ GetStatus()

const map< u8, HifPoint * > & CHifDecoder::GetStatus ( )

Retrieves the current status of active input points.

This function processes new HIF events and updates the internal state. It returns a constant reference to a map containing pointers to HifPoint instances, keyed by their event identifiers (u8). The map represents the current active input points, such as ongoing touch or mouse interactions.

Usage Example:

const auto& status = decoder.GetStatus();
for (const auto& [id, point] : status) {
// Use point->ev.xp and point->ev.yp (shifted right by 4 bits for integer part)
int x = point->ev.xp >> 4;
int y = point->ev.yp >> 4;
// Handle different event types
switch (point->ev.type) {
// ...
}
}
Returns
A constant reference to a map of active input points.

The documentation for this class was generated from the following files: