Use logid namespace

This commit is contained in:
PixlOne 2019-10-04 21:56:17 -04:00
parent 295a469505
commit 9272666ffe
13 changed files with 394 additions and 357 deletions

View File

@ -11,6 +11,8 @@
#include "util.h" #include "util.h"
#include "EvdevDevice.h" #include "EvdevDevice.h"
using namespace logid;
NoAction* NoAction::copy(Device *dev) NoAction* NoAction::copy(Device *dev)
{ {
auto action = new NoAction(); auto action = new NoAction();

View File

@ -1,13 +1,15 @@
#ifndef ACTIONS_H #ifndef LOGID_ACTIONS_H
#define ACTIONS_H #define LOGID_ACTIONS_H
#include "Device.h" #include "Device.h"
#include <map> #include <map>
#include <vector> #include <vector>
#include <hidpp20/IReprogControls.h> #include <hidpp20/IReprogControls.h>
enum class Action namespace logid
{ {
enum class Action
{
None, None,
Keypress, Keypress,
Gestures, Gestures,
@ -15,61 +17,61 @@ enum class Action
ChangeDPI, ChangeDPI,
ToggleSmartshift, ToggleSmartshift,
ToggleHiresScroll ToggleHiresScroll
}; };
enum class Direction enum class Direction
{ {
None, None,
Up, Up,
Down, Down,
Left, Left,
Right Right
}; };
enum class GestureMode enum class GestureMode
{ {
NoPress, NoPress,
OnRelease, OnRelease,
OnFewPixels, OnFewPixels,
Axis Axis
}; };
class Device; class Device;
class ButtonAction class ButtonAction
{ {
public: public:
virtual ~ButtonAction() = default; virtual ~ButtonAction() = default;
Action type; Action type;
virtual ButtonAction* copy(Device* dev) = 0; virtual ButtonAction* copy(Device* dev) = 0;
virtual void press() = 0; virtual void press() = 0;
virtual void release() = 0; virtual void release() = 0;
// ButtonAction(const ButtonAction &a, Device* d) : type (a.type), device (d) {} // ButtonAction(const ButtonAction &a, Device* d) : type (a.type), device (d) {}
// ButtonAction* create_instance(Device* d); // ButtonAction* create_instance(Device* d);
protected: protected:
ButtonAction(Action a) : type (a) {}; ButtonAction(Action a) : type (a) {};
Device* device; Device* device;
}; };
class NoAction : public ButtonAction class NoAction : public ButtonAction
{ {
public: public:
NoAction() : ButtonAction(Action::None) {} NoAction() : ButtonAction(Action::None) {}
virtual NoAction* copy(Device* dev); virtual NoAction* copy(Device* dev);
virtual void press() {} virtual void press() {}
virtual void release() {} virtual void release() {}
}; };
class KeyAction : public ButtonAction class KeyAction : public ButtonAction
{ {
public: public:
explicit KeyAction(std::vector<unsigned int> k) : ButtonAction(Action::Keypress), keys (std::move(k)) {}; explicit KeyAction(std::vector<unsigned int> k) : ButtonAction(Action::Keypress), keys (std::move(k)) {};
virtual KeyAction* copy(Device* dev); virtual KeyAction* copy(Device* dev);
virtual void press(); virtual void press();
virtual void release(); virtual void release();
private: private:
std::vector<unsigned int> keys; std::vector<unsigned int> keys;
}; };
class Gesture class Gesture
{ {
public: public:
Gesture(ButtonAction* ba, GestureMode m, int pp=0, uint a=0, float am=1) Gesture(ButtonAction* ba, GestureMode m, int pp=0, uint a=0, float am=1)
: action (ba), mode (m), per_pixel (pp), axis (a), axis_multiplier (am) : action (ba), mode (m), per_pixel (pp), axis (a), axis_multiplier (am)
{ {
@ -85,57 +87,58 @@ public:
int per_pixel_mod; int per_pixel_mod;
uint axis; uint axis;
float axis_multiplier; float axis_multiplier;
}; };
class GestureAction : public ButtonAction class GestureAction : public ButtonAction
{ {
public: public:
GestureAction(std::map<Direction, Gesture*> g) : ButtonAction(Action::Gestures), gestures (std::move(g)) {}; GestureAction(std::map<Direction, Gesture*> g) : ButtonAction(Action::Gestures), gestures (std::move(g)) {};
std::map<Direction, Gesture*> gestures; std::map<Direction, Gesture*> gestures;
virtual GestureAction* copy(Device* dev); virtual GestureAction* copy(Device* dev);
virtual void press(); virtual void press();
virtual void release(); virtual void release();
void move(HIDPP20::IReprogControlsV4::Move m); void move(HIDPP20::IReprogControlsV4::Move m);
private: private:
bool held; bool held;
int x = 0; int x = 0;
int y = 0; int y = 0;
}; };
class SmartshiftAction : public ButtonAction class SmartshiftAction : public ButtonAction
{ {
public: public:
SmartshiftAction() : ButtonAction(Action::ToggleSmartshift) {}; SmartshiftAction() : ButtonAction(Action::ToggleSmartshift) {};
virtual SmartshiftAction* copy(Device* dev); virtual SmartshiftAction* copy(Device* dev);
virtual void press(); virtual void press();
virtual void release() {} virtual void release() {}
}; };
class HiresScrollAction : public ButtonAction class HiresScrollAction : public ButtonAction
{ {
public: public:
HiresScrollAction() : ButtonAction(Action::ToggleHiresScroll) {}; HiresScrollAction() : ButtonAction(Action::ToggleHiresScroll) {};
virtual HiresScrollAction* copy(Device* dev); virtual HiresScrollAction* copy(Device* dev);
virtual void press(); virtual void press();
virtual void release() {} virtual void release() {}
}; };
class CycleDPIAction : public ButtonAction class CycleDPIAction : public ButtonAction
{ {
public: public:
CycleDPIAction(std::vector<int> d) : ButtonAction(Action::CycleDPI), dpis (d) {}; CycleDPIAction(std::vector<int> d) : ButtonAction(Action::CycleDPI), dpis (d) {};
virtual CycleDPIAction* copy(Device* dev); virtual CycleDPIAction* copy(Device* dev);
virtual void press(); virtual void press();
virtual void release() {} virtual void release() {}
private: private:
const std::vector<int> dpis; const std::vector<int> dpis;
}; };
class ChangeDPIAction : public ButtonAction class ChangeDPIAction : public ButtonAction
{ {
public: public:
ChangeDPIAction(int i) : ButtonAction(Action::ChangeDPI), dpi_inc (i) {}; ChangeDPIAction(int i) : ButtonAction(Action::ChangeDPI), dpi_inc (i) {};
virtual ChangeDPIAction* copy(Device* dev); virtual ChangeDPIAction* copy(Device* dev);
virtual void press(); virtual void press();
virtual void release() {} virtual void release() {}
private: private:
int dpi_inc; int dpi_inc;
}; };
}
#endif //ACTIONS_H #endif //LOGID_ACTIONS_H

View File

@ -10,6 +10,7 @@
#include "Configuration.h" #include "Configuration.h"
#include "util.h" #include "util.h"
using namespace logid;
using namespace libconfig; using namespace libconfig;
Configuration::Configuration(const char *config_file) Configuration::Configuration(const char *config_file)
@ -230,7 +231,7 @@ DeviceConfig::DeviceConfig(const libconfig::Setting &root)
} }
} }
ButtonAction* parse_action(Action type, const Setting* action_config, bool is_gesture) ButtonAction* logid::parse_action(Action type, const Setting* action_config, bool is_gesture)
{ {
if(type == Action::None) return new NoAction(); if(type == Action::None) return new NoAction();
if(type == Action::Keypress) if(type == Action::Keypress)

View File

@ -1,18 +1,20 @@
#ifndef CONFIGURATION_H #ifndef LOGID_CONFIGURATION_H
#define CONFIGURATION_H #define LOGID_CONFIGURATION_H
#include <map> #include <map>
#include <libconfig.h++> #include <libconfig.h++>
#include <hidpp20/ISmartShift.h> #include <hidpp20/ISmartShift.h>
#include "Actions.h" #include "Actions.h"
class DeviceConfig; namespace logid
class ButtonAction;
enum class Action;
class DeviceConfig
{ {
public: class DeviceConfig;
class ButtonAction;
enum class Action;
class DeviceConfig
{
public:
DeviceConfig(); DeviceConfig();
~DeviceConfig(); ~DeviceConfig();
DeviceConfig(DeviceConfig* dc, Device* dev); DeviceConfig(DeviceConfig* dc, Device* dev);
@ -22,20 +24,21 @@ public:
const uint8_t* hiresscroll = nullptr; const uint8_t* hiresscroll = nullptr;
std::map<uint16_t, ButtonAction*> actions; std::map<uint16_t, ButtonAction*> actions;
const bool baseConfig = true; const bool baseConfig = true;
}; };
class Configuration class Configuration
{ {
public: public:
Configuration(const char* config_file); Configuration(const char* config_file);
Configuration() {} Configuration() {}
std::map<std::string, DeviceConfig*> devices; std::map<std::string, DeviceConfig*> devices;
private: private:
libconfig::Config cfg; libconfig::Config cfg;
}; };
ButtonAction* parse_action(Action action, const libconfig::Setting* action_config, bool is_gesture=false); ButtonAction* parse_action(Action action, const libconfig::Setting* action_config, bool is_gesture=false);
extern Configuration* global_config; extern Configuration* global_config;
}
#endif //CONFIGURATION_H #endif //LOGID_CONFIGURATION_H

View File

@ -21,6 +21,8 @@
#include "util.h" #include "util.h"
#include "EvdevDevice.h" #include "EvdevDevice.h"
using namespace logid;
using namespace std::chrono_literals; using namespace std::chrono_literals;
Device::Device(std::string p, const HIDPP::DeviceIndex i) : path(std::move(p)), index (i) Device::Device(std::string p, const HIDPP::DeviceIndex i) : path(std::move(p)), index (i)

View File

@ -1,5 +1,5 @@
#ifndef DEVICE_H #ifndef LOGID_DEVICE_H
#define DEVICE_H #define LOGID_DEVICE_H
#include "Actions.h" #include "Actions.h"
#include "DeviceFinder.h" #include "DeviceFinder.h"
@ -13,12 +13,14 @@
#include <hidpp10/IReceiver.h> #include <hidpp10/IReceiver.h>
#include <hidpp20/IWirelessDeviceStatus.h> #include <hidpp20/IWirelessDeviceStatus.h>
class EventListener; namespace logid
class DeviceConfig;
class Device
{ {
public: class EventListener;
class DeviceConfig;
class Device
{
public:
Device(std::string p, const HIDPP::DeviceIndex i); Device(std::string p, const HIDPP::DeviceIndex i);
~Device(); ~Device();
@ -51,7 +53,7 @@ public:
bool initialized = false; bool initialized = false;
bool waiting_for_receiver = false; bool waiting_for_receiver = false;
protected: protected:
DeviceConfig* config; DeviceConfig* config;
EventListener* listener; EventListener* listener;
@ -59,36 +61,36 @@ protected:
void set_smartshift(HIDPP20::ISmartShift::SmartshiftStatus ops); void set_smartshift(HIDPP20::ISmartShift::SmartshiftStatus ops);
void set_hiresscroll(uint8_t flags); void set_hiresscroll(uint8_t flags);
void set_dpi(int dpi); void set_dpi(int dpi);
}; };
class EventHandler class EventHandler
{ {
public: public:
virtual const HIDPP20::FeatureInterface *feature() const = 0; virtual const HIDPP20::FeatureInterface *feature() const = 0;
virtual const std::vector<uint8_t> featureIndices() const virtual const std::vector<uint8_t> featureIndices() const
{ {
return {feature()->index()}; return {feature()->index()};
}; };
virtual void handleEvent (const HIDPP::Report &event) = 0; virtual void handleEvent (const HIDPP::Report &event) = 0;
}; };
class ButtonHandler : public EventHandler class ButtonHandler : public EventHandler
{ {
public: public:
ButtonHandler (Device *d) : dev (d), _irc (HIDPP20::IReprogControls::auto_version(d->hidpp_dev)) { } ButtonHandler (Device *d) : dev (d), _irc (HIDPP20::IReprogControls::auto_version(d->hidpp_dev)) { }
const HIDPP20::FeatureInterface *feature () const const HIDPP20::FeatureInterface *feature () const
{ {
return &_irc; return &_irc;
} }
void handleEvent (const HIDPP::Report &event); void handleEvent (const HIDPP::Report &event);
protected: protected:
Device* dev; Device* dev;
HIDPP20::IReprogControls _irc; HIDPP20::IReprogControls _irc;
std::vector<uint16_t> states; std::vector<uint16_t> states;
std::vector<uint16_t> new_states; std::vector<uint16_t> new_states;
}; };
class ReceiverHandler : public EventHandler class ReceiverHandler : public EventHandler
{ {
public: public:
ReceiverHandler (Device *d) : dev (d) { } ReceiverHandler (Device *d) : dev (d) { }
const HIDPP20::FeatureInterface *feature () const const HIDPP20::FeatureInterface *feature () const
{ {
@ -99,30 +101,30 @@ public:
return HIDPP10::IReceiver::Events; return HIDPP10::IReceiver::Events;
} }
void handleEvent (const HIDPP::Report &event); void handleEvent (const HIDPP::Report &event);
protected: protected:
Device* dev; Device* dev;
}; };
class WirelessStatusHandler : public EventHandler class WirelessStatusHandler : public EventHandler
{ {
public: public:
WirelessStatusHandler (Device *d) : dev (d), _iws (d->hidpp_dev) { } WirelessStatusHandler (Device *d) : dev (d), _iws (d->hidpp_dev) { }
const HIDPP20::FeatureInterface *feature () const const HIDPP20::FeatureInterface *feature () const
{ {
return &_iws; return &_iws;
} }
void handleEvent (const HIDPP::Report &event); void handleEvent (const HIDPP::Report &event);
protected: protected:
Device* dev; Device* dev;
HIDPP20::IWirelessDeviceStatus _iws; HIDPP20::IWirelessDeviceStatus _iws;
}; };
class EventListener class EventListener
{ {
HIDPP::Dispatcher *dispatcher; HIDPP::Dispatcher *dispatcher;
HIDPP::DeviceIndex index; HIDPP::DeviceIndex index;
std::map<uint8_t, std::unique_ptr<EventHandler>> handlers; std::map<uint8_t, std::unique_ptr<EventHandler>> handlers;
std::map<uint8_t, HIDPP::Dispatcher::listener_iterator> iterators; std::map<uint8_t, HIDPP::Dispatcher::listener_iterator> iterators;
public: public:
EventListener (HIDPP::Dispatcher *dispatcher, HIDPP::DeviceIndex index): dispatcher (dispatcher), index (index) {} EventListener (HIDPP::Dispatcher *dispatcher, HIDPP::DeviceIndex index): dispatcher (dispatcher), index (index) {}
virtual void removeEventHandlers (); virtual void removeEventHandlers ();
@ -132,14 +134,14 @@ public:
virtual void start () = 0; virtual void start () = 0;
virtual void stop () = 0; virtual void stop () = 0;
protected: protected:
virtual bool event (EventHandler* handler, const HIDPP::Report &report) = 0; virtual bool event (EventHandler* handler, const HIDPP::Report &report) = 0;
}; };
class SimpleListener : public EventListener class SimpleListener : public EventListener
{ {
HIDPP::SimpleDispatcher *dispatcher; HIDPP::SimpleDispatcher *dispatcher;
public: public:
SimpleListener (HIDPP::SimpleDispatcher* dispatcher, HIDPP::DeviceIndex index): SimpleListener (HIDPP::SimpleDispatcher* dispatcher, HIDPP::DeviceIndex index):
EventListener (dispatcher, index), EventListener (dispatcher, index),
dispatcher (dispatcher) dispatcher (dispatcher)
@ -150,8 +152,10 @@ public:
virtual void start(); virtual void start();
virtual void stop(); virtual void stop();
protected: protected:
virtual bool event (EventHandler* handler, const HIDPP::Report &report); virtual bool event (EventHandler* handler, const HIDPP::Report &report);
}; };
#endif //DEVICE_H }
#endif //LOGID_DEVICE_H

View File

@ -17,6 +17,8 @@
#define NON_WIRELESS_DEV(index) (index) == HIDPP::DefaultDevice ? "default" : "corderd" #define NON_WIRELESS_DEV(index) (index) == HIDPP::DefaultDevice ? "default" : "corderd"
using namespace logid;
void stopAndDeleteConnectedDevice (ConnectedDevice &connected_device) void stopAndDeleteConnectedDevice (ConnectedDevice &connected_device)
{ {
if(!connected_device.device->waiting_for_receiver) if(!connected_device.device->waiting_for_receiver)

View File

@ -1,5 +1,5 @@
#ifndef DEVICEFINDER_H #ifndef LOGID_DEVICEFINDER_H
#define DEVICEFINDER_H #define LOGID_DEVICEFINDER_H
#include <hid/DeviceMonitor.h> #include <hid/DeviceMonitor.h>
#include <hidpp/SimpleDispatcher.h> #include <hidpp/SimpleDispatcher.h>
@ -15,30 +15,34 @@
#define MAX_CONNECTION_TRIES 10 #define MAX_CONNECTION_TRIES 10
#define TIME_BETWEEN_CONNECTION_TRIES 500ms #define TIME_BETWEEN_CONNECTION_TRIES 500ms
class Device; namespace logid
{
struct ConnectedDevice { class Device;
struct ConnectedDevice {
Device *device; Device *device;
std::thread associatedThread; std::thread associatedThread;
}; };
class DeviceFinder : public HID::DeviceMonitor class DeviceFinder : public HID::DeviceMonitor
{ {
public: public:
~DeviceFinder(); ~DeviceFinder();
Device* insertNewDevice (const std::string &path, HIDPP::DeviceIndex index); Device* insertNewDevice (const std::string &path, HIDPP::DeviceIndex index);
Device* insertNewReceiverDevice (const std::string &path, HIDPP::DeviceIndex index); Device* insertNewReceiverDevice (const std::string &path, HIDPP::DeviceIndex index);
void stopAndDeleteAllDevicesIn (const std::string &path); void stopAndDeleteAllDevicesIn (const std::string &path);
void stopAndDeleteDevice (const std::string &path, HIDPP::DeviceIndex index); void stopAndDeleteDevice (const std::string &path, HIDPP::DeviceIndex index);
protected: protected:
void addDevice(const char* path); void addDevice(const char* path);
void removeDevice(const char* path); void removeDevice(const char* path);
private: private:
std::mutex devices_mutex; std::mutex devices_mutex;
std::map<std::string, std::map<HIDPP::DeviceIndex, ConnectedDevice>> devices; std::map<std::string, std::map<HIDPP::DeviceIndex, ConnectedDevice>> devices;
}; };
extern DeviceFinder* finder; extern DeviceFinder* finder;
}
#endif //DEVICEFINDER_H #endif //LOGID_DEVICEFINDER_H

View File

@ -4,6 +4,8 @@
#include "EvdevDevice.h" #include "EvdevDevice.h"
using namespace logid;
EvdevDevice::EvdevDevice(const char* name) EvdevDevice::EvdevDevice(const char* name)
{ {
device = libevdev_new(); device = libevdev_new();

View File

@ -1,20 +1,27 @@
#ifndef EVDEVDEVICE_H #ifndef LOGID_EVDEVDEVICE_H
#define EVDEVDEVICE_H #define LOGID_EVDEVDEVICE_H
#include <libevdev/libevdev.h> #include <libevdev/libevdev.h>
#include <libevdev/libevdev-uinput.h> #include <libevdev/libevdev-uinput.h>
class EvdevDevice namespace logid
{ {
public: class EvdevDevice
EvdevDevice(const char* name); {
public:
EvdevDevice(const char *name);
~EvdevDevice(); ~EvdevDevice();
void move_axis(unsigned int axis, int movement); void move_axis(unsigned int axis, int movement);
void send_event(unsigned int type, unsigned int code, int value); void send_event(unsigned int type, unsigned int code, int value);
libevdev* device;
libevdev_uinput* ui_device;
};
extern EvdevDevice* global_evdev; libevdev *device;
libevdev_uinput *ui_device;
};
#endif //EVDEVDEVICE_H extern EvdevDevice* global_evdev;
}
#endif //LOGID_EVDEVDEVICE_H

View File

@ -19,10 +19,12 @@
#define evdev_name "logid" #define evdev_name "logid"
#define DEFAULT_CONFIG_FILE "/etc/logid.cfg" #define DEFAULT_CONFIG_FILE "/etc/logid.cfg"
LogLevel global_verbosity = INFO; using namespace logid;
Configuration* global_config;
EvdevDevice* global_evdev; LogLevel logid::global_verbosity = INFO;
DeviceFinder* finder; Configuration* logid::global_config;
EvdevDevice* logid::global_evdev;
DeviceFinder* logid::finder;
enum class Option enum class Option
{ {

View File

@ -7,7 +7,9 @@
#include "util.h" #include "util.h"
void log_printf(LogLevel level, const char* format, ...) using namespace logid;
void logid::log_printf(LogLevel level, const char* format, ...)
{ {
if(global_verbosity > level) return; if(global_verbosity > level) return;
@ -22,7 +24,7 @@ void log_printf(LogLevel level, const char* format, ...)
fprintf(stream, "\n"); fprintf(stream, "\n");
} }
const char* level_prefix(LogLevel level) const char* logid::level_prefix(LogLevel level)
{ {
if(level == DEBUG) return "DEBUG"; if(level == DEBUG) return "DEBUG";
if(level == INFO) return "INFO" ; if(level == INFO) return "INFO" ;
@ -32,7 +34,7 @@ const char* level_prefix(LogLevel level)
return "DEBUG"; return "DEBUG";
} }
Direction get_direction(int x, int y) Direction logid::get_direction(int x, int y)
{ {
if(x == 0 && y == 0) return Direction::None; if(x == 0 && y == 0) return Direction::None;
@ -59,7 +61,7 @@ Direction get_direction(int x, int y)
return Direction::None; return Direction::None;
} }
Direction string_to_direction(std::string s) Direction logid::string_to_direction(std::string s)
{ {
const char* original_str = s.c_str(); const char* original_str = s.c_str();
std::transform(s.begin(), s.end(), s.begin(), ::tolower); std::transform(s.begin(), s.end(), s.begin(), ::tolower);
@ -75,7 +77,7 @@ Direction string_to_direction(std::string s)
throw std::invalid_argument(s + " is an invalid direction."); throw std::invalid_argument(s + " is an invalid direction.");
} }
GestureMode string_to_gesturemode(std::string s) GestureMode logid::string_to_gesturemode(std::string s)
{ {
const char* original_str = s.c_str(); const char* original_str = s.c_str();
std::transform(s.begin(), s.end(), s.begin(), ::tolower); std::transform(s.begin(), s.end(), s.begin(), ::tolower);
@ -93,7 +95,7 @@ GestureMode string_to_gesturemode(std::string s)
return GestureMode::OnRelease; return GestureMode::OnRelease;
} }
Action string_to_action(std::string s) Action logid::string_to_action(std::string s)
{ {
std::string original_str = s; std::string original_str = s;
std::transform(s.begin(), s.end(), s.begin(), ::tolower); std::transform(s.begin(), s.end(), s.begin(), ::tolower);
@ -109,7 +111,7 @@ Action string_to_action(std::string s)
throw std::invalid_argument(original_str + " is an invalid action."); throw std::invalid_argument(original_str + " is an invalid action.");
} }
LogLevel string_to_loglevel(std::string s) LogLevel logid::string_to_loglevel(std::string s)
{ {
std::string original_str = s; std::string original_str = s;
std::transform(s.begin(), s.end(), s.begin(), ::tolower); std::transform(s.begin(), s.end(), s.begin(), ::tolower);

View File

@ -1,26 +1,29 @@
#ifndef UTIL_H #ifndef LOGID_UTIL_H
#define UTIL_H #define LOGID_UTIL_H
#include "Actions.h" #include "Actions.h"
enum LogLevel namespace logid
{ {
enum LogLevel
{
DEBUG, DEBUG,
INFO, INFO,
WARN, WARN,
ERROR ERROR
}; };
extern LogLevel global_verbosity; extern LogLevel global_verbosity;
void log_printf(LogLevel level, const char* format, ...); void log_printf(LogLevel level, const char* format, ...);
const char* level_prefix(LogLevel level); const char* level_prefix(LogLevel level);
Direction get_direction(int x, int y); Direction get_direction(int x, int y);
Direction string_to_direction(std::string s); Direction string_to_direction(std::string s);
GestureMode string_to_gesturemode(std::string s); GestureMode string_to_gesturemode(std::string s);
Action string_to_action(std::string s); Action string_to_action(std::string s);
LogLevel string_to_loglevel(std::string s); LogLevel string_to_loglevel(std::string s);
}
#endif //UTIL_H #endif //LOGID_UTIL_H