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  memset(m_unit_table, 0xff, sizeof(m_unit_table));
12 }
13 
15  m_port(o.m_port), m_node(o.m_node),
16  m_guid(o.m_guid), m_specid(o.m_specid),
17  m_vendorid(o.m_vendorid), m_modelid(o.m_modelid),
18  m_firmware_revision(o.m_firmware_revision),
19  m_product_name(o.m_product_name)
20 {
21  memcpy(m_unit_table, o.m_unit_table, sizeof(m_unit_table));
22 }
23 
25 {
26  if (this == &o)
27  return *this;
28 
29  m_port = o.m_port;
30  m_node = o.m_node;
31  m_guid = o.m_guid;
32  m_specid = o.m_specid;
34  m_modelid = o.m_modelid;
37  memcpy(m_unit_table, o.m_unit_table, sizeof(m_unit_table));
38 
39  return *this;
40 }
41 
43 {
44  memset(m_unit_table, 0xff, 32 * sizeof(uint8_t));
45 
46  for (uint i = 0; i < 8; i++)
47  {
48  vector<uint8_t> cmd;
49  vector<uint8_t> ret;
50 
55  cmd.push_back((i<<4) | 0x07);
56  cmd.push_back(0xFF);
57  cmd.push_back(0xFF);
58  cmd.push_back(0xFF);
59  cmd.push_back(0xFF);
60 
61  if (!SendAVCCommand(cmd, ret, -1))
62  return false;
63 
64  if (ret.size() >= 8)
65  {
66  m_unit_table[(i<<2)+0] = ret[4];
67  m_unit_table[(i<<2)+1] = ret[5];
68  m_unit_table[(i<<2)+2] = ret[6];
69  m_unit_table[(i<<2)+3] = ret[7];
70  }
71  }
72 
73  return true;
74 }
75 
76 bool AVCInfo::IsSubunitType(int subunit_type) const
77 {
78  for (int subunit : m_unit_table)
79  {
80  if ((subunit != 0xff) &&
81  (subunit & FirewireDevice::kAVCSubunitTypeUnit) == subunit_type)
82  {
83  return true;
84  }
85  }
86 
87  return false;
88 }
89 
90 QString AVCInfo::GetSubunitInfoString(void) const
91 {
92  QString str = "Subunit Types: ";
93 
95  str += "Video Monitor, ";
97  str += "Audio, ";
99  str += "Printer, ";
101  str += "Disk Recorder, ";
103  str += "Tape Recorder, ";
105  str += "Tuner, ";
107  str += "CA, ";
109  str += "Camera, ";
111  str += "Panel, ";
113  str += "Bulletin Board, ";
115  str += "Camera Storage, ";
117  str += "Music, ";
119  str += "Vendor Unique, ";
120 
121  return str;
122 }
FirewireDevice::kAVCSubunitTypePrinter
@ kAVCSubunitTypePrinter
Definition: firewiredevice.h:70
AVCInfo::SendAVCCommand
virtual bool SendAVCCommand(const vector< uint8_t > &, vector< uint8_t > &, int)
Definition: avcinfo.h:30
FirewireDevice::kAVCSubunitTypeCameraStorage
@ kAVCSubunitTypeCameraStorage
Definition: firewiredevice.h:78
AVCInfo::AVCInfo
AVCInfo()
Definition: avcinfo.cpp:9
FirewireDevice::kAVCSubunitTypeMusic
@ kAVCSubunitTypeMusic
Definition: firewiredevice.h:79
FirewireDevice::kAVCSubunitTypeVideoCamera
@ kAVCSubunitTypeVideoCamera
Definition: firewiredevice.h:75
FirewireDevice::kAVCSubunitTypeAudio
@ kAVCSubunitTypeAudio
Definition: firewiredevice.h:69
FirewireDevice::kAVCSubunitTypeVendorUnique
@ kAVCSubunitTypeVendorUnique
Definition: firewiredevice.h:80
FirewireDevice::kAVCSubunitTypeTapeRecorder
@ kAVCSubunitTypeTapeRecorder
Definition: firewiredevice.h:72
FirewireDevice::kAVCSubunitTypeBulletinBoard
@ kAVCSubunitTypeBulletinBoard
Definition: firewiredevice.h:77
firewiredevice.h
FirewireDevice::kAVCSubunitIdIgnore
@ kAVCSubunitIdIgnore
Definition: firewiredevice.h:66
AVCInfo
Definition: avcinfo.h:23
AVCInfo::GetSubunitInfoString
QString GetSubunitInfoString(void) const
Definition: avcinfo.cpp:90
FirewireDevice::kAVCSubunitTypeTuner
@ kAVCSubunitTypeTuner
Definition: firewiredevice.h:73
AVCInfo::GetSubunitInfo
bool GetSubunitInfo(void)
Definition: avcinfo.cpp:42
AVCInfo::m_specid
uint m_specid
Definition: avcinfo.h:48
avcinfo.h
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
FirewireDevice::kAVCSubunitTypeDiscRecorder
@ kAVCSubunitTypeDiscRecorder
Definition: firewiredevice.h:71
AVCInfo::m_modelid
uint m_modelid
Definition: avcinfo.h:50
FirewireDevice::kAVCStatusInquiryCommand
@ kAVCStatusInquiryCommand
Definition: firewiredevice.h:41
FirewireDevice::kAVCSubunitTypeVideoMonitor
@ kAVCSubunitTypeVideoMonitor
Definition: firewiredevice.h:68
FirewireDevice::kAVCSubunitTypeCA
@ kAVCSubunitTypeCA
Definition: firewiredevice.h:74
FirewireDevice::kAVCSubunitTypePanel
@ kAVCSubunitTypePanel
Definition: firewiredevice.h:76
FirewireDevice::kAVCUnitSubunitInfoOpcode
@ kAVCUnitSubunitInfoOpcode
Definition: firewiredevice.h:101
AVCInfo::m_guid
uint64_t m_guid
Definition: avcinfo.h:47
AVCInfo::IsSubunitType
bool IsSubunitType(int subunit_type) const
Definition: avcinfo.cpp:76
AVCInfo::operator=
AVCInfo & operator=(const AVCInfo &o)
Definition: avcinfo.cpp:24
AVCInfo::m_port
int m_port
Definition: avcinfo.h:45
FirewireDevice::kAVCSubunitTypeUnit
@ kAVCSubunitTypeUnit
Definition: firewiredevice.h:82
AVCInfo::m_unit_table
uint8_t m_unit_table[32]
Definition: avcinfo.h:53