xbmc
PeripheralKeyboard.h
1 /*
2  * Copyright (C) 2017-2018 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 {
21 {
22 public:
24  const PeripheralScanResult& scanResult,
25  CPeripheralBus* bus);
26 
27  ~CPeripheralKeyboard(void) override;
28 
29  // implementation of CPeripheral
30  bool InitialiseFeature(const PeripheralFeature feature) override;
31  void RegisterKeyboardDriverHandler(KODI::KEYBOARD::IKeyboardDriverHandler* handler,
32  bool bPromiscuous) override;
33  void UnregisterKeyboardDriverHandler(KODI::KEYBOARD::IKeyboardDriverHandler* handler) override;
34  CDateTime LastActive() override { return m_lastActive; }
35  KODI::GAME::ControllerPtr ControllerProfile() const override;
36 
37  // implementation of IKeyboardDriverHandler
38  bool OnKeyPress(const CKey& key) override;
39  void OnKeyRelease(const CKey& key) override;
40 
41 private:
42  struct KeyboardHandle
43  {
45  bool bPromiscuous;
46  };
47 
48  std::vector<KeyboardHandle> m_keyboardHandlers;
49  CCriticalSection m_mutex;
50  CDateTime m_lastActive;
51 };
52 } // namespace PERIPHERALS
Definition: PeripheralTypes.h:318
bool InitialiseFeature(const PeripheralFeature feature) override
Initialise one of the features of this peripheral.
Definition: PeripheralKeyboard.cpp:37
Definition: RetroPlayerInput.h:15
CDateTime LastActive() override
Return the last time this peripheral was active.
Definition: PeripheralKeyboard.h:34
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:117
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
Definition: PeripheralBus.h:34
Interface for handling keyboard events.
Definition: IKeyboardDriverHandler.h:21
Definition: PeripheralKeyboard.h:20
bool OnKeyPress(const CKey &key) override
A key has been pressed.
Definition: PeripheralKeyboard.cpp:88
Definition: Peripheral.h:62
Definition: Key.h:135
Definition: Peripherals.h:49