BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
hif_decoder.h File Reference

Module for decoding and managing HIF events in the BEEP-8 system. More...

#include <map>
#include <b8/hif.h>

Go to the source code of this file.

Classes

struct  HifPoint
 Structure representing a single input point (touch or mouse). More...
 
class  CHifDecoder
 Class for decoding and managing HIF events. More...
 

Detailed Description

Module for decoding and managing HIF events in the BEEP-8 system.

This module provides functionality for decoding and managing human interface events (b8HifEvent) from the Hardware Interface (HIF) system of the BEEP-8 system. The CHifDecoder class fetches and manages events, storing them in an internal map, and allows retrieval of the current status of input points such as touch and mouse events.

Note: The hif_decoder.h is a utility library, and the use of this module is not mandatory. If you wish to implement mouse control and multi-touch event handling yourself, or if you already have the necessary expertise, you can use the APIs provided directly in <b8/hif.h>.

Features

  • HifPoint: Structure representing a single input point (touch or mouse).
  • CHifDecoder: Class for decoding and managing HIF events.

Usage Example

Here is an example of how to use this module to fetch and process events:

#include "hif_decoder.h"
static CHifDecoder decoder;
void some_func() {
const auto& status = decoder.GetStatus();
for (const auto& [key, value] : status) {
switch (value->ev.type) {
case B8_HIF_EV_TOUCH_START:
printf(fp_bgprint, "%d t start\n", (int)value->hdl);
break;
case B8_HIF_EV_TOUCH_MOVE:
printf(fp_bgprint, "%d t move\n", (int)value->hdl);
break;
case B8_HIF_EV_TOUCH_CANCEL:
printf(fp_bgprint, "%d t cancel\n", (int)value->hdl);
break;
case B8_HIF_EV_TOUCH_END:
printf(fp_bgprint, "%d t end\n", (int)value->hdl);
break;
case B8_HIF_EV_MOUSE_DOWN:
printf(fp_bgprint, "%d m down %d %d\n", (int)value->hdl, value->ev.xp >> 4, value->ev.yp >> 4);
break;
case B8_HIF_EV_MOUSE_MOVE:
printf(fp_bgprint, "%d m move %d %d\n", (int)value->hdl, value->ev.xp >> 4, value->ev.yp >> 4);
break;
case B8_HIF_EV_MOUSE_HOVER_MOVE:
printf(fp_bgprint, "%d m hover %d %d\n", (int)value->hdl, value->ev.xp >> 4, value->ev.yp >> 4);
break;
case B8_HIF_EV_MOUSE_UP:
printf(fp_bgprint, "%d m up %d %d\n", (int)value->hdl, value->ev.xp >> 4, value->ev.yp >> 4);
break;
}
}
}
Class for decoding and managing HIF events.
Definition hif_decoder.h:115
const std::map< u8, HifPoint * > & GetStatus()
Retrieves the current status of active input points.
Definition hif_decoder.cpp:44
Module for decoding and managing HIF events in the BEEP-8 system.
Version
1.0
Date
2024