| 1 |
/* |
| 2 |
* Copyright (C) 2017-2024 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <cstdint> |
| 12 |
#include <map> |
| 13 |
#include <memory> |
| 14 |
#include <string> |
| 15 |
|
| 16 |
namespace tinyxml2 |
| 17 |
{ |
| 18 |
class XMLNode; |
| 19 |
} |
| 20 |
|
| 21 |
namespace KODI |
| 22 |
{ |
| 23 |
namespace KEYMAP |
| 24 |
{ |
| 25 |
/*! |
| 26 |
* \ingroup keymap |
| 27 |
*/ |
| 28 |
class CIRTranslator |
| 29 |
{ |
| 30 |
public: |
| 31 |
CIRTranslator() = default; |
| 32 |
|
| 33 |
/*! |
| 34 |
* \brief Loads Lircmap.xml/IRSSmap.xml |
| 35 |
*/ |
| 36 |
void Load(const std::string& irMapName); |
| 37 |
|
| 38 |
/*! |
| 39 |
* \brief Clears the map |
| 40 |
*/ |
| 41 |
void Clear(); |
| 42 |
|
| 43 |
unsigned int TranslateButton(const std::string& szDevice, const std::string& szButton); |
| 44 |
|
| 45 |
static uint32_t TranslateString(std::string strButton); |
| 46 |
static uint32_t TranslateUniversalRemoteString(const std::string& szButton); |
| 47 |
|
| 48 |
private: |
| 49 |
bool LoadIRMap(const std::string& irMapPath); |
| 50 |
void MapRemote(tinyxml2::XMLNode* pRemote, const std::string& szDevice); |
| 51 |
|
| 52 |
using IRButtonMap = std::map<std::string, std::string>; |
| 53 |
|
| 54 |
std::map<std::string, std::shared_ptr<IRButtonMap>> m_irRemotesMap; |
| 55 |
}; |
| 56 |
} // namespace KEYMAP |
| 57 |
} // namespace KODI |