MythTV  master
avcinfo.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 // MythTV headers
4 #include "avcinfo.h"
5 #ifndef GUID_ONLY
6 #include "firewiredevice.h"
7 #endif
8 
10 {
11  m_unit_table.fill(0xff);
12 }
13 
15 {
16  if (this == &o)
17  return *this;
18 
19  m_port = o.m_port;
20  m_node = o.m_node;
21  m_guid = o.m_guid;
22  m_specid = o.m_specid;
24  m_modelid = o.m_modelid;
28 
29  return *this;
30 }
31 
33 {
34  m_unit_table.fill(0xff);
35 
36  for (uint i = 0; i < 8; i++)
37  {
38  std::vector<uint8_t> cmd;
39  std::vector<uint8_t> ret;
40 
45  cmd.push_back((i<<4) | 0x07);
46  cmd.push_back(0xFF);
47  cmd.push_back(0xFF);
48  cmd.push_back(0xFF);
49  cmd.push_back(0xFF);
50 
51  if (!SendAVCCommand(cmd, ret, -1))
52  return false;
53 
54  if (ret.size() >= 8)
55  {
56  m_unit_table[(i<<2)+0] = ret[4];
57  m_unit_table[(i<<2)+1] = ret[5];
58  m_unit_table[(i<<2)+2] = ret[6];
59  m_unit_table[(i<<2)+3] = ret[7];
60  }
61  }
62 
63  return true;
64 }
65 
66 bool AVCInfo::IsSubunitType(int subunit_type) const
67 {
68  return std::any_of(m_unit_table.cbegin(), m_unit_table.cend(),
69  [subunit_type](int subunit)
70  { return (subunit != 0xff) &&
71  (subunit & FirewireDevice::kAVCSubunitTypeUnit) == subunit_type; } );
72 }
73 
74 QString AVCInfo::GetSubunitInfoString(void) const
75 {
76  QString str = "Subunit Types: ";
77 
79  str += "Video Monitor, ";
81  str += "Audio, ";
83  str += "Printer, ";
85  str += "Disk Recorder, ";
87  str += "Tape Recorder, ";
89  str += "Tuner, ";
91  str += "CA, ";
93  str += "Camera, ";
95  str += "Panel, ";
97  str += "Bulletin Board, ";
99  str += "Camera Storage, ";
101  str += "Music, ";
103  str += "Vendor Unique, ";
104 
105  return str;
106 }
FirewireDevice::kAVCSubunitTypePrinter
@ kAVCSubunitTypePrinter
Definition: firewiredevice.h:69
FirewireDevice::kAVCSubunitTypeCameraStorage
@ kAVCSubunitTypeCameraStorage
Definition: firewiredevice.h:77
AVCInfo::AVCInfo
AVCInfo()
Definition: avcinfo.cpp:9
FirewireDevice::kAVCSubunitTypeMusic
@ kAVCSubunitTypeMusic
Definition: firewiredevice.h:78
FirewireDevice::kAVCSubunitTypeVideoCamera
@ kAVCSubunitTypeVideoCamera
Definition: firewiredevice.h:74
FirewireDevice::kAVCSubunitTypeAudio
@ kAVCSubunitTypeAudio
Definition: firewiredevice.h:68
FirewireDevice::kAVCSubunitTypeVendorUnique
@ kAVCSubunitTypeVendorUnique
Definition: firewiredevice.h:79
FirewireDevice::kAVCSubunitTypeTapeRecorder
@ kAVCSubunitTypeTapeRecorder
Definition: firewiredevice.h:71
FirewireDevice::kAVCSubunitTypeBulletinBoard
@ kAVCSubunitTypeBulletinBoard
Definition: firewiredevice.h:76
firewiredevice.h
FirewireDevice::kAVCSubunitIdIgnore
@ kAVCSubunitIdIgnore
Definition: firewiredevice.h:65
AVCInfo
Definition: avcinfo.h:22
AVCInfo::GetSubunitInfoString
QString GetSubunitInfoString(void) const
Definition: avcinfo.cpp:74
FirewireDevice::kAVCSubunitTypeTuner
@ kAVCSubunitTypeTuner
Definition: firewiredevice.h:72
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.h
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:81
AVCInfo::m_firmware_revision
uint m_firmware_revision
Definition: avcinfo.h:51
FirewireDevice::kAVCSubunitTypeDiscRecorder
@ kAVCSubunitTypeDiscRecorder
Definition: firewiredevice.h:70
AVCInfo::m_modelid
uint m_modelid
Definition: avcinfo.h:50
FirewireDevice::kAVCStatusInquiryCommand
@ kAVCStatusInquiryCommand
Definition: firewiredevice.h:40
FirewireDevice::kAVCSubunitTypeVideoMonitor
@ kAVCSubunitTypeVideoMonitor
Definition: firewiredevice.h:67
FirewireDevice::kAVCSubunitTypeCA
@ kAVCSubunitTypeCA
Definition: firewiredevice.h:73
FirewireDevice::kAVCSubunitTypePanel
@ kAVCSubunitTypePanel
Definition: firewiredevice.h:75
FirewireDevice::kAVCUnitSubunitInfoOpcode
@ kAVCUnitSubunitInfoOpcode
Definition: firewiredevice.h:100
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
FirewireDevice::kAVCSubunitTypeUnit
@ kAVCSubunitTypeUnit
Definition: firewiredevice.h:81