| 1 |
/* |
| 2 |
* Copyright (C) 2016-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 "threads/Thread.h" |
| 12 |
|
| 13 |
#include <string> |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
namespace KODI |
| 17 |
{ |
| 18 |
namespace JOYSTICK |
| 19 |
{ |
| 20 |
class IInputReceiver; |
| 21 |
|
| 22 |
/*! |
| 23 |
* \ingroup joystick |
| 24 |
*/ |
| 25 |
class CRumbleGenerator : public CThread |
| 26 |
{ |
| 27 |
public: |
| 28 |
CRumbleGenerator(); |
| 29 |
|
| 30 |
~CRumbleGenerator() override { AbortRumble(); } |
| 31 |
|
| 32 |
std::string ControllerID() const; |
| 33 |
|
| 34 |
void NotifyUser(IInputReceiver* receiver); |
| 35 |
bool DoTest(IInputReceiver* receiver); |
| 36 |
|
| 37 |
void AbortRumble(void) { StopThread(); } |
| 38 |
|
| 39 |
protected: |
| 40 |
// implementation of CThread |
| 41 |
void Process() override; |
| 42 |
|
| 43 |
private: |
| 44 |
enum RUMBLE_TYPE |
| 45 |
{ |
| 46 |
RUMBLE_UNKNOWN, |
| 47 |
RUMBLE_NOTIFICATION, |
| 48 |
RUMBLE_TEST, |
| 49 |
}; |
| 50 |
|
| 51 |
static std::vector<std::string> GetMotors(const std::string& controllerId); |
| 52 |
|
| 53 |
// Construction param |
| 54 |
const std::vector<std::string> m_motors; |
| 55 |
|
| 56 |
// Test param |
| 57 |
IInputReceiver* m_receiver = nullptr; |
| 58 |
RUMBLE_TYPE m_type = RUMBLE_UNKNOWN; |
| 59 |
}; |
| 60 |
} // namespace JOYSTICK |
| 61 |
} // namespace KODI |