xbmc
GameClientDevice.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 "games/GameTypes.h"
12 #include "games/controllers/ControllerTypes.h"
13 
14 #include <string>
15 
16 struct game_input_device;
17 struct game_input_port;
18 
19 namespace KODI
20 {
21 namespace GAME
22 {
23 class CPhysicalPort;
24 
31 {
32 public:
38  CGameClientDevice(const game_input_device& device);
39 
45  CGameClientDevice(const ControllerPtr& controller);
46 
51 
55  const ControllerPtr& Controller() const { return m_controller; }
56 
60  const GameClientPortVec& Ports() const { return m_ports; }
61 
62 private:
69  void AddPort(const game_input_port& logicalPort, const CPhysicalPort& physicalPort);
70 
71  // Helper function
72  static ControllerPtr GetController(const char* controllerId);
73 
74  ControllerPtr m_controller;
75  GameClientPortVec m_ports;
76 };
77 } // namespace GAME
78 } // namespace KODI
Port that can provide input.
Definition: game.h:842
const GameClientPortVec & Ports() const
The ports on this device.
Definition: GameClientDevice.h:60
Device that can provide input.
Definition: game.h:819
CGameClientDevice(const game_input_device &device)
Construct a device.
Definition: GameClientDevice.cpp:25
Definition: AudioDecoder.h:18
Definition: PhysicalPort.h:27
std::shared_ptr< CController > ControllerPtr
Smart pointer to a game controller (CController)
Definition: ControllerTypes.h:25
std::vector< GameClientPortPtr > GameClientPortVec
Vector of smart pointers to input ports for a game client (CGameClientPort)
Definition: GameTypes.h:50
const ControllerPtr & Controller() const
The controller profile.
Definition: GameClientDevice.h:55
Represents a device connected to a port.
Definition: GameClientDevice.h:30