MythTV master
avcinfo.cpp
Go to the documentation of this file.
1// -*- Mode: c++ -*-
2
3// C++ headers
4#include <algorithm>
5
6// MythTV headers
7#include "avcinfo.h"
8#ifndef GUID_ONLY
9#include "firewiredevice.h"
10#endif
11
13{
14 m_unit_table.fill(0xff);
15}
16
18{
19 if (this == &o)
20 return *this;
21
22 m_port = o.m_port;
23 m_node = o.m_node;
24 m_guid = o.m_guid;
31
32 return *this;
33}
34
36{
37 m_unit_table.fill(0xff);
38
39 for (uint i = 0; i < 8; i++)
40 {
41 std::vector<uint8_t> cmd;
42 std::vector<uint8_t> ret;
43
48 cmd.push_back((i<<4) | 0x07);
49 cmd.push_back(0xFF);
50 cmd.push_back(0xFF);
51 cmd.push_back(0xFF);
52 cmd.push_back(0xFF);
53
54 if (!SendAVCCommand(cmd, ret, -1))
55 return false;
56
57 if (ret.size() >= 8)
58 {
59 m_unit_table[(i<<2)+0] = ret[4];
60 m_unit_table[(i<<2)+1] = ret[5];
61 m_unit_table[(i<<2)+2] = ret[6];
62 m_unit_table[(i<<2)+3] = ret[7];
63 }
64 }
65
66 return true;
67}
68
69bool AVCInfo::IsSubunitType(int subunit_type) const
70{
71 return std::ranges::any_of(m_unit_table,
72 [subunit_type](int subunit)
73 { return (subunit != 0xff) &&
74 (subunit & FirewireDevice::kAVCSubunitTypeUnit) == subunit_type; } );
75}
76
78{
79 QString str = "Subunit Types: ";
80
82 str += "Video Monitor, ";
84 str += "Audio, ";
86 str += "Printer, ";
88 str += "Disk Recorder, ";
90 str += "Tape Recorder, ";
92 str += "Tuner, ";
94 str += "CA, ";
96 str += "Camera, ";
98 str += "Panel, ";
100 str += "Bulletin Board, ";
102 str += "Camera Storage, ";
104 str += "Music, ";
106 str += "Vendor Unique, ";
107
108 return str;
109}
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:69
uint m_vendorid
Definition: avcinfo.h:49
uint m_specid
Definition: avcinfo.h:48
AVCInfo & operator=(const AVCInfo &o)
Definition: avcinfo.cpp:17
virtual bool SendAVCCommand(const std::vector< uint8_t > &, std::vector< uint8_t > &, int)
Definition: avcinfo.h:30
bool GetSubunitInfo(void)
Definition: avcinfo.cpp:35
int m_node
Definition: avcinfo.h:46
AVCInfo()
Definition: avcinfo.cpp:12
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:77
@ kAVCSubunitTypeCameraStorage
@ kAVCSubunitTypeBulletinBoard
unsigned int uint
Definition: compat.h:60