| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <string> |
| 24 |
|
| 25 |
#include "DataModel/Feedback.h" |
| 26 |
#include "Hardware/FeedbackCache.h" |
| 27 |
|
| 28 |
namespace DataModel |
| 29 |
{ |
| 30 |
class FeedbackConfig |
| 31 |
{ |
| 32 |
public: |
| 33 |
inline FeedbackConfig() |
| 34 |
: controlId(ControlNone), |
| 35 |
feedbackId(FeedbackNone), |
| 36 |
pin(FeedbackPinNone), |
| 37 |
isInUse(false) |
| 38 |
{ |
| 39 |
} |
| 40 |
|
| 41 |
inline FeedbackConfig(const DataModel::Feedback& feedback) |
| 42 |
: controlId(feedback.GetControlID()), |
| 43 |
feedbackId(feedback.GetID()), |
| 44 |
pin(feedback.GetPin()), |
| 45 |
name(feedback.GetName()), |
| 46 |
matchKey(feedback.GetMatchKey()), |
| 47 |
isInUse(feedback.IsInUse()) |
| 48 |
{ |
| 49 |
} |
| 50 |
|
| 51 |
inline FeedbackConfig(const Hardware::FeedbackCacheEntry& feedback) |
| 52 |
: controlId(feedback.GetControlID()), |
| 53 |
feedbackId(feedback.GetFeedbackID()), |
| 54 |
pin(feedback.GetPin()), |
| 55 |
name(feedback.GetName()), |
| 56 |
matchKey(feedback.GetMatchKey()), |
| 57 |
isInUse(false) |
| 58 |
{ |
| 59 |
} |
| 60 |
|
| 61 |
inline FeedbackConfig& operator=(const DataModel::Feedback& feedback) |
| 62 |
{ |
| 63 |
controlId = feedback.GetControlID(); |
| 64 |
feedbackId = feedback.GetID(); |
| 65 |
pin = feedback.GetPin(); |
| 66 |
name = feedback.GetName(); |
| 67 |
matchKey = feedback.GetMatchKey(); |
| 68 |
isInUse = feedback.IsInUse(); |
| 69 |
return *this; |
| 70 |
} |
| 71 |
|
| 72 |
inline FeedbackConfig& operator=(const Hardware::FeedbackCacheEntry& feedback) |
| 73 |
{ |
| 74 |
controlId = feedback.GetControlID(); |
| 75 |
feedbackId = feedback.GetFeedbackID(); |
| 76 |
pin = feedback.GetPin(); |
| 77 |
name = feedback.GetName(); |
| 78 |
matchKey = feedback.GetMatchKey(); |
| 79 |
return *this; |
| 80 |
} |
| 81 |
|
| 82 |
inline ControlID GetControlId() const |
| 83 |
{ |
| 84 |
return controlId; |
| 85 |
} |
| 86 |
|
| 87 |
inline FeedbackID GetFeedbackId() const |
| 88 |
{ |
| 89 |
return feedbackId; |
| 90 |
} |
| 91 |
|
| 92 |
inline FeedbackPin GetPin() const |
| 93 |
{ |
| 94 |
return pin; |
| 95 |
} |
| 96 |
|
| 97 |
inline std::string GetName() const |
| 98 |
{ |
| 99 |
return name; |
| 100 |
} |
| 101 |
|
| 102 |
inline void SetName(const std::string& name) |
| 103 |
{ |
| 104 |
this->name = name; |
| 105 |
} |
| 106 |
|
| 107 |
inline std::string GetMatchKey() const |
| 108 |
{ |
| 109 |
return matchKey; |
| 110 |
} |
| 111 |
|
| 112 |
inline bool IsInUse() const |
| 113 |
{ |
| 114 |
return isInUse; |
| 115 |
} |
| 116 |
|
| 117 |
private: |
| 118 |
ControlID controlId; |
| 119 |
FeedbackID feedbackId; |
| 120 |
FeedbackPin pin; |
| 121 |
std::string name; |
| 122 |
std::string matchKey; |
| 123 |
bool isInUse; |
| 124 |
}; |
| 125 |
} |