MythTV  master
avcinfo.h
Go to the documentation of this file.
1 #ifndef AVC_INFO_H
2 #define AVC_INFO_H
3 
4 // C++ headers
5 #include <array>
6 #include <cstdint>
7 #include <vector>
8 
9 // Qt headers
10 #include <QString>
11 
12 static inline QString guid_to_string(uint64_t guid)
13 {
14  return QString("%1").arg(guid, 16, 16, QLatin1Char('0')).toUpper();
15 }
16 
17 static inline uint64_t string_to_guid(const QString &guid)
18 {
19  return guid.toULongLong(nullptr, 16);
20 }
21 
22 class AVCInfo
23 {
24  public:
25  AVCInfo();
26  AVCInfo(const AVCInfo &o) = default;
27  AVCInfo &operator=(const AVCInfo &o);
28  virtual ~AVCInfo() = default;
29 
30  virtual bool SendAVCCommand(
31  const std::vector<uint8_t> &/*cmd*/,
32  std::vector<uint8_t> &/*result*/,
33  int /*retry_cnt*/)
34  {
35  return false;
36  }
37 
38  bool GetSubunitInfo(void);
39 
40  bool IsSubunitType(int subunit_type) const;
41  QString GetSubunitInfoString(void) const;
42  QString GetGUIDString(void) const { return guid_to_string(m_guid); }
43 
44  public:
45  int m_port {-1};
46  int m_node {-1};
47  uint64_t m_guid {0};
52  QString m_product_name;
53  std::array<uint8_t,32> m_unit_table {};
54 };
55 
56 #endif // AVC_INFO_H
AVCInfo::GetGUIDString
QString GetGUIDString(void) const
Definition: avcinfo.h:42
AVCInfo::~AVCInfo
virtual ~AVCInfo()=default
AVCInfo::AVCInfo
AVCInfo()
Definition: avcinfo.cpp:9
guid_to_string
static QString guid_to_string(uint64_t guid)
Definition: avcinfo.h:12
string_to_guid
static uint64_t string_to_guid(const QString &guid)
Definition: avcinfo.h:17
AVCInfo
Definition: avcinfo.h:22
AVCInfo::GetSubunitInfoString
QString GetSubunitInfoString(void) const
Definition: avcinfo.cpp:74
AVCInfo::m_unit_table
std::array< uint8_t, 32 > m_unit_table
Definition: avcinfo.h:53
AVCInfo::GetSubunitInfo
bool GetSubunitInfo(void)
Definition: avcinfo.cpp:32
AVCInfo::m_specid
uint m_specid
Definition: avcinfo.h:48
AVCInfo::SendAVCCommand
virtual bool SendAVCCommand(const std::vector< uint8_t > &, std::vector< uint8_t > &, int)
Definition: avcinfo.h:30
AVCInfo::m_vendorid
uint m_vendorid
Definition: avcinfo.h:49
AVCInfo::m_product_name
QString m_product_name
Definition: avcinfo.h:52
AVCInfo::m_node
int m_node
Definition: avcinfo.h:46
uint
unsigned int uint
Definition: compat.h:140
AVCInfo::m_firmware_revision
uint m_firmware_revision
Definition: avcinfo.h:51
AVCInfo::m_modelid
uint m_modelid
Definition: avcinfo.h:50
AVCInfo::m_guid
uint64_t m_guid
Definition: avcinfo.h:47
AVCInfo::IsSubunitType
bool IsSubunitType(int subunit_type) const
Definition: avcinfo.cpp:66
AVCInfo::operator=
AVCInfo & operator=(const AVCInfo &o)
Definition: avcinfo.cpp:14
AVCInfo::m_port
int m_port
Definition: avcinfo.h:45