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;
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
66bool 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
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}
uint m_modelid
Definition: avcinfo.h:50
uint m_firmware_revision
Definition: avcinfo.h:51
uint64_t m_guid
Definition: avcinfo.h:47
int m_port
Definition: avcinfo.h:45
bool IsSubunitType(int subunit_type) const
Definition: avcinfo.cpp:66
uint m_vendorid
Definition: avcinfo.h:49
uint m_specid
Definition: avcinfo.h:48
AVCInfo & operator=(const AVCInfo &o)
Definition: avcinfo.cpp:14
virtual bool SendAVCCommand(const std::vector< uint8_t > &, std::vector< uint8_t > &, int)
Definition: avcinfo.h:30
bool GetSubunitInfo(void)
Definition: avcinfo.cpp:32
int m_node
Definition: avcinfo.h:46
AVCInfo()
Definition: avcinfo.cpp:9
QString m_product_name
Definition: avcinfo.h:52
std::array< uint8_t, 32 > m_unit_table
Definition: avcinfo.h:53
QString GetSubunitInfoString(void) const
Definition: avcinfo.cpp:74
@ kAVCSubunitTypeCameraStorage
@ kAVCSubunitTypeBulletinBoard
unsigned int uint
Definition: freesurround.h:24