| 1 |
/* |
| 2 |
* Copyright (C) 2005-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 |
#include "PeripheralNyxboard.h" |
| 10 |
|
| 11 |
#include "PeripheralHID.h" |
| 12 |
#include "application/Application.h" |
| 13 |
#include "utils/log.h" |
| 14 |
|
| 15 |
using namespace PERIPHERALS; |
| 16 |
|
| 17 |
CPeripheralNyxboard::CPeripheralNyxboard(CPeripherals& manager, |
| 18 |
const PeripheralScanResult& scanResult, |
| 19 |
CPeripheralBus* bus) |
| 20 |
: CPeripheralHID(manager, scanResult, bus) |
| 21 |
{ |
| 22 |
m_features.push_back(FEATURE_NYXBOARD); |
| 23 |
} |
| 24 |
|
| 25 |
bool CPeripheralNyxboard::LookupSymAndUnicode(XBMC_keysym& keysym, uint8_t* key, char* unicode) |
| 26 |
{ |
| 27 |
std::string strCommand; |
| 28 |
if (keysym.sym == XBMCK_F7 && keysym.mod == XBMCKMOD_NONE && |
| 29 |
GetSettingBool("enable_flip_commands")) |
| 30 |
{ |
| 31 |
/* switched to keyboard side */ |
| 32 |
CLog::Log(LOGDEBUG, "{} - switched to keyboard side", __FUNCTION__); |
| 33 |
strCommand = GetSettingString("flip_keyboard"); |
| 34 |
} |
| 35 |
else if (keysym.sym == XBMCK_F7 && keysym.mod == XBMCKMOD_LCTRL && |
| 36 |
GetSettingBool("enable_flip_commands")) |
| 37 |
{ |
| 38 |
/* switched to remote side */ |
| 39 |
CLog::Log(LOGDEBUG, "{} - switched to remote side", __FUNCTION__); |
| 40 |
strCommand = GetSettingString("flip_remote"); |
| 41 |
} |
| 42 |
|
| 43 |
if (!strCommand.empty()) |
| 44 |
{ |
| 45 |
CLog::Log(LOGDEBUG, "{} - executing command '{}'", __FUNCTION__, strCommand); |
| 46 |
if (g_application.ExecuteXBMCAction(strCommand)) |
| 47 |
{ |
| 48 |
*key = 0; |
| 49 |
*unicode = (char)0; |
| 50 |
return true; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
return false; |
| 55 |
} |