diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h | 112 |
1 files changed, 28 insertions, 84 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h index c2efc05..9b2a43f 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h | |||
| @@ -1,22 +1,11 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2014-2017 Team Kodi | 2 | * Copyright (C) 2014-2018 Team Kodi |
| 3 | * http://kodi.tv | 3 | * This file is part of Kodi - https://kodi.tv |
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this Program; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 19 | */ | 7 | */ |
| 8 | |||
| 20 | #pragma once | 9 | #pragma once |
| 21 | 10 | ||
| 22 | #include "Peripheral.h" | 11 | #include "Peripheral.h" |
| @@ -97,10 +86,7 @@ namespace addon | |||
| 97 | public: | 86 | public: |
| 98 | Peripheral(PERIPHERAL_TYPE type = PERIPHERAL_TYPE_UNKNOWN, const std::string& strName = "") : | 87 | Peripheral(PERIPHERAL_TYPE type = PERIPHERAL_TYPE_UNKNOWN, const std::string& strName = "") : |
| 99 | m_type(type), | 88 | m_type(type), |
| 100 | m_strName(strName), | 89 | m_strName(strName) |
| 101 | m_vendorId(0), | ||
| 102 | m_productId(0), | ||
| 103 | m_index(0) | ||
| 104 | { | 90 | { |
| 105 | } | 91 | } |
| 106 | 92 | ||
| @@ -149,9 +135,9 @@ namespace addon | |||
| 149 | private: | 135 | private: |
| 150 | PERIPHERAL_TYPE m_type; | 136 | PERIPHERAL_TYPE m_type; |
| 151 | std::string m_strName; | 137 | std::string m_strName; |
| 152 | uint16_t m_vendorId; | 138 | uint16_t m_vendorId = 0; |
| 153 | uint16_t m_productId; | 139 | uint16_t m_productId = 0; |
| 154 | unsigned int m_index; | 140 | unsigned int m_index = 0; |
| 155 | }; | 141 | }; |
| 156 | 142 | ||
| 157 | typedef PeripheralVector<Peripheral, PERIPHERAL_INFO> Peripherals; | 143 | typedef PeripheralVector<Peripheral, PERIPHERAL_INFO> Peripherals; |
| @@ -259,12 +245,7 @@ namespace addon | |||
| 259 | Joystick(const std::string& provider = "", const std::string& strName = "") : | 245 | Joystick(const std::string& provider = "", const std::string& strName = "") : |
| 260 | Peripheral(PERIPHERAL_TYPE_JOYSTICK, strName), | 246 | Peripheral(PERIPHERAL_TYPE_JOYSTICK, strName), |
| 261 | m_provider(provider), | 247 | m_provider(provider), |
| 262 | m_requestedPort(NO_PORT_REQUESTED), | 248 | m_requestedPort(NO_PORT_REQUESTED) |
| 263 | m_buttonCount(0), | ||
| 264 | m_hatCount(0), | ||
| 265 | m_axisCount(0), | ||
| 266 | m_motorCount(0), | ||
| 267 | m_supportsPowerOff(false) | ||
| 268 | { | 249 | { |
| 269 | } | 250 | } |
| 270 | 251 | ||
| @@ -345,11 +326,11 @@ namespace addon | |||
| 345 | private: | 326 | private: |
| 346 | std::string m_provider; | 327 | std::string m_provider; |
| 347 | int m_requestedPort; | 328 | int m_requestedPort; |
| 348 | unsigned int m_buttonCount; | 329 | unsigned int m_buttonCount = 0; |
| 349 | unsigned int m_hatCount; | 330 | unsigned int m_hatCount = 0; |
| 350 | unsigned int m_axisCount; | 331 | unsigned int m_axisCount = 0; |
| 351 | unsigned int m_motorCount; | 332 | unsigned int m_motorCount = 0; |
| 352 | bool m_supportsPowerOff; | 333 | bool m_supportsPowerOff = false; |
| 353 | }; | 334 | }; |
| 354 | 335 | ||
| 355 | typedef PeripheralVector<Joystick, JOYSTICK_INFO> Joysticks; | 336 | typedef PeripheralVector<Joystick, JOYSTICK_INFO> Joysticks; |
| @@ -402,12 +383,7 @@ namespace addon | |||
| 402 | */ | 383 | */ |
| 403 | DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex) : | 384 | DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex) : |
| 404 | m_type(type), | 385 | m_type(type), |
| 405 | m_driverIndex(driverIndex), | 386 | m_driverIndex(driverIndex) |
| 406 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 407 | m_center(0), | ||
| 408 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), | ||
| 409 | m_range(1), | ||
| 410 | m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) | ||
| 411 | { | 387 | { |
| 412 | } | 388 | } |
| 413 | 389 | ||
| @@ -415,16 +391,7 @@ namespace addon | |||
| 415 | /*! | 391 | /*! |
| 416 | * \brief Construct an invalid driver primitive | 392 | * \brief Construct an invalid driver primitive |
| 417 | */ | 393 | */ |
| 418 | DriverPrimitive(void) : | 394 | DriverPrimitive(void) = default; |
| 419 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN), | ||
| 420 | m_driverIndex(0), | ||
| 421 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 422 | m_center(0), | ||
| 423 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), | ||
| 424 | m_range(1), | ||
| 425 | m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) | ||
| 426 | { | ||
| 427 | } | ||
| 428 | 395 | ||
| 429 | /*! | 396 | /*! |
| 430 | * \brief Construct a driver primitive representing a joystick button | 397 | * \brief Construct a driver primitive representing a joystick button |
| @@ -441,11 +408,7 @@ namespace addon | |||
| 441 | DriverPrimitive(unsigned int hatIndex, JOYSTICK_DRIVER_HAT_DIRECTION direction) : | 408 | DriverPrimitive(unsigned int hatIndex, JOYSTICK_DRIVER_HAT_DIRECTION direction) : |
| 442 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION), | 409 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION), |
| 443 | m_driverIndex(hatIndex), | 410 | m_driverIndex(hatIndex), |
| 444 | m_hatDirection(direction), | 411 | m_hatDirection(direction) |
| 445 | m_center(0), | ||
| 446 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), | ||
| 447 | m_range(1), | ||
| 448 | m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) | ||
| 449 | { | 412 | { |
| 450 | } | 413 | } |
| 451 | 414 | ||
| @@ -456,11 +419,9 @@ namespace addon | |||
| 456 | DriverPrimitive(unsigned int axisIndex, int center, JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction, unsigned int range) : | 419 | DriverPrimitive(unsigned int axisIndex, int center, JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction, unsigned int range) : |
| 457 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS), | 420 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS), |
| 458 | m_driverIndex(axisIndex), | 421 | m_driverIndex(axisIndex), |
| 459 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 460 | m_center(center), | 422 | m_center(center), |
| 461 | m_semiAxisDirection(direction), | 423 | m_semiAxisDirection(direction), |
| 462 | m_range(range), | 424 | m_range(range) |
| 463 | m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) | ||
| 464 | { | 425 | { |
| 465 | } | 426 | } |
| 466 | 427 | ||
| @@ -477,13 +438,7 @@ namespace addon | |||
| 477 | */ | 438 | */ |
| 478 | DriverPrimitive(std::string keycode) : | 439 | DriverPrimitive(std::string keycode) : |
| 479 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY), | 440 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY), |
| 480 | m_driverIndex(0), | 441 | m_keycode(std::move(keycode)) |
| 481 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 482 | m_center(0), | ||
| 483 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), | ||
| 484 | m_range(1), | ||
| 485 | m_keycode(std::move(keycode)), | ||
| 486 | m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) | ||
| 487 | { | 442 | { |
| 488 | } | 443 | } |
| 489 | 444 | ||
| @@ -501,23 +456,12 @@ namespace addon | |||
| 501 | */ | 456 | */ |
| 502 | DriverPrimitive(JOYSTICK_DRIVER_RELPOINTER_DIRECTION direction) : | 457 | DriverPrimitive(JOYSTICK_DRIVER_RELPOINTER_DIRECTION direction) : |
| 503 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION), | 458 | m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION), |
| 504 | m_driverIndex(0), | ||
| 505 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 506 | m_center(0), | ||
| 507 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), | ||
| 508 | m_range(1), | ||
| 509 | m_relPointerDirection(direction) | 459 | m_relPointerDirection(direction) |
| 510 | { | 460 | { |
| 511 | } | 461 | } |
| 512 | 462 | ||
| 513 | explicit DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) : | 463 | explicit DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) : |
| 514 | m_type(primitive.type), | 464 | m_type(primitive.type) |
| 515 | m_driverIndex(0), | ||
| 516 | m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN), | ||
| 517 | m_center(0), | ||
| 518 | m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN), | ||
| 519 | m_range(1), | ||
| 520 | m_relPointerDirection(JOYSTICK_DRIVER_RELPOINTER_UNKNOWN) | ||
| 521 | { | 465 | { |
| 522 | switch (m_type) | 466 | switch (m_type) |
| 523 | { | 467 | { |
| @@ -677,14 +621,14 @@ namespace addon | |||
| 677 | } | 621 | } |
| 678 | 622 | ||
| 679 | private: | 623 | private: |
| 680 | JOYSTICK_DRIVER_PRIMITIVE_TYPE m_type; | 624 | JOYSTICK_DRIVER_PRIMITIVE_TYPE m_type = JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN; |
| 681 | unsigned int m_driverIndex; | 625 | unsigned int m_driverIndex = 0; |
| 682 | JOYSTICK_DRIVER_HAT_DIRECTION m_hatDirection; | 626 | JOYSTICK_DRIVER_HAT_DIRECTION m_hatDirection = JOYSTICK_DRIVER_HAT_UNKNOWN; |
| 683 | int m_center; | 627 | int m_center = 0; |
| 684 | JOYSTICK_DRIVER_SEMIAXIS_DIRECTION m_semiAxisDirection; | 628 | JOYSTICK_DRIVER_SEMIAXIS_DIRECTION m_semiAxisDirection = JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN; |
| 685 | unsigned int m_range; | 629 | unsigned int m_range = 1; |
| 686 | std::string m_keycode; | 630 | std::string m_keycode; |
| 687 | JOYSTICK_DRIVER_RELPOINTER_DIRECTION m_relPointerDirection; | 631 | JOYSTICK_DRIVER_RELPOINTER_DIRECTION m_relPointerDirection = JOYSTICK_DRIVER_RELPOINTER_UNKNOWN; |
| 688 | }; | 632 | }; |
| 689 | 633 | ||
| 690 | typedef PeripheralVector<DriverPrimitive, JOYSTICK_DRIVER_PRIMITIVE> DriverPrimitives; | 634 | typedef PeripheralVector<DriverPrimitive, JOYSTICK_DRIVER_PRIMITIVE> DriverPrimitives; |
