AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
BluetoothMessageParameter.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
10 #include <QLoggingCategory>
11 
12 Q_DECLARE_LOGGING_CATEGORY(card)
13 
14 namespace governikus
15 {
16 
18 {
19  private:
20  BluetoothParamId mParamId;
21 
22  protected:
23  QByteArray mValue;
24  bool mValid;
25 
26  inline QString toStringBase() const
27  {
28  return mParamId + QStringLiteral(" | Value: ");
29  }
30 
31 
32  template<typename T> bool parseByteParameter(const QByteArray& pValue, T& pDest) const
33  {
34  if (pValue.size() == 1)
35  {
36  pDest = static_cast<T>(pValue.at(0));
37  if (!Enum<T>::isValue(pValue.at(0)))
38  {
39  qCWarning(card) << "Value is unknown:" << pDest;
40  }
41  return true;
42  }
43  else
44  {
45  qCWarning(card) << "Content has wrong size:" << pValue.toHex();
46  }
47 
48  return false;
49  }
50 
51 
52  public:
53  using Ptr = QSharedPointer<const BluetoothMessageParameter>;
54 
55  BluetoothMessageParameter(BluetoothParamId pParamId, const QByteArray& pValue);
56  virtual ~BluetoothMessageParameter();
57 
58  BluetoothParamId getParameterId() const;
59  const QByteArray& getValue() const;
60  QByteArray toData() const;
61  bool isValid() const;
62 
63  virtual QString toString() const;
64  virtual QString toStringValue() const;
65 };
66 
67 } /* namespace governikus */
68 
69 QDebug operator<<(QDebug pDbg, const governikus::BluetoothMessageParameter& pMsg);
Definition: EnumHelper.h:76
QDebug operator<<(QDebug pDbg, const governikus::CVCertificate &pCvc)
Definition: CVCertificate.cpp:146
#define T(v)
Definition: http_parser.cpp:234
bool mValid
Definition: BluetoothMessageParameter.h:24
QSharedPointer< const BluetoothMessageParameter > Ptr
Definition: BluetoothMessageParameter.h:53
bool parseByteParameter(const QByteArray &pValue, T &pDest) const
Definition: BluetoothMessageParameter.h:32
Definition: BluetoothMessageParameter.h:17
QByteArray mValue
Definition: BluetoothMessageParameter.h:23
QString toStringBase() const
Definition: BluetoothMessageParameter.h:26