kodi
PeripheralKeyboard.h
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 "Peripheral.h"
12 #include "XBDateTime.h"
13 #include "input/keyboard/interfaces/IKeyboardDriverHandler.h"
14 #include "threads/CriticalSection.h"
15 
16 #include <vector>
17 
18 namespace PERIPHERALS
19 {
24 {
25 public:
27  const PeripheralScanResult& scanResult,
28  CPeripheralBus* bus);
29 
30  ~CPeripheralKeyboard(void) override;
31 
32  // implementation of CPeripheral
33  bool InitialiseFeature(const PeripheralFeature feature) override;
34  void RegisterKeyboardDriverHandler(KODI::KEYBOARD::IKeyboardDriverHandler* handler,
35  bool bPromiscuous) override;
36  void UnregisterKeyboardDriverHandler(KODI::KEYBOARD::IKeyboardDriverHandler* handler) override;
37  CDateTime LastActive() const override { return m_lastActive; }
39 
40  // implementation of IKeyboardDriverHandler
41  bool OnKeyPress(const CKey& key) override;
42  void OnKeyRelease(const CKey& key) override;
43 
44 private:
45  struct KeyboardHandle
46  {
48  bool bPromiscuous;
49  };
50 
51  std::vector<KeyboardHandle> m_keyboardHandlers;
52  CCriticalSection m_mutex;
53  CDateTime m_lastActive;
54 };
55 } // namespace PERIPHERALS
Definition: PeripheralTypes.h:326
bool InitialiseFeature(const PeripheralFeature feature) override
Initialise one of the features of this peripheral.
Definition: PeripheralKeyboard.cpp:37
Definition: RetroPlayerInput.h:15
KODI::GAME::ControllerPtr ControllerProfile() const override
Get the controller profile that best represents this peripheral.
Definition: PeripheralKeyboard.cpp:82
void OnKeyRelease(const CKey &key) override
A key has been released.
Definition: PeripheralKeyboard.cpp:119
std::shared_ptr< CController > ControllerPtr
Smart pointer to a game controller (CController)
Definition: ControllerTypes.h:25
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
Definition: PeripheralBus.h:36
Interface for handling keyboard events.
Definition: IKeyboardDriverHandler.h:22
Definition: PeripheralKeyboard.h:23
bool OnKeyPress(const CKey &key) override
A key has been pressed.
Definition: PeripheralKeyboard.cpp:90
Definition: Peripheral.h:71
Definition: Key.h:17
CDateTime LastActive() const override
Return the last time this peripheral was active.
Definition: PeripheralKeyboard.h:37
Definition: Peripherals.h:56