MythTV  master
firewiredevice.h
Go to the documentation of this file.
1 
7 #ifndef FIREWIRE_DEVICE_H
8 #define FIREWIRE_DEVICE_H
9 
10 // C++ headers
11 #include <vector>
12 
13 // Qt headers
14 #include <QString>
15 #include <QMutex>
16 
17 // MythTV headers
18 #include "streamlisteners.h"
19 #include "avcinfo.h"
20 
21 class TSPacket;
22 
24 {
25  public:
26 
27  // Public enums
29  {
34  };
35 
36  // AVC commands
38  {
44 
51 
54  };
55 
56  // AVC unit addresses
58  {
66 
68  kAVCSubunitTypeAudio = (0x01 << 3),
69  kAVCSubunitTypePrinter = (0x02 << 3),
72  kAVCSubunitTypeTuner = (0x05 << 3),
73  kAVCSubunitTypeCA = (0x06 << 3),
75  kAVCSubunitTypePanel = (0x09 << 3),
78  kAVCSubunitTypeMusic = (0x0c << 3),
80  kAVCSubunitTypeExtended = (0x1e << 3),
81  kAVCSubunitTypeUnit = (0x1f << 3),
82  };
83 
84  // AVC opcode
86  {
87  // Unit
103 
104  // Common Unit + Subunit
114 
115  // Panel
117  };
118 
119  // AVC param 0
121  {
125  };
126 
128  {
143 
157 
167 
181 
184 
186 
189 
190  };
191 
192  virtual ~FirewireDevice() = default;
193 
194  // Commands
195  virtual bool OpenPort(void) = 0;
196  virtual bool ClosePort(void) = 0;
197  virtual bool ResetBus(void) { return false; }
198 
199  virtual void AddListener(TSDataListener *listener);
200  virtual void RemoveListener(TSDataListener *listener);
201 
202  // Sets
203  virtual bool SetPowerState(bool on);
204  virtual bool SetChannel(const QString &panel_model,
205  uint alt_method, uint channel);
206 
207  // Gets
208  virtual bool IsPortOpen(void) const = 0;
209  bool IsSTBBufferCleared(void) const { return m_bufferCleared; }
210 
211  // non-const Gets
212  virtual PowerState GetPowerState(void);
213 
214  // Statics
215  static bool IsSTBSupported(const QString &model);
216  static QString GetModelName(uint vendor_id, uint model_id);
217  static std::vector<AVCInfo> GetSTBList(void);
218 
219  protected:
220  FirewireDevice(uint64_t guid, uint subunitid, uint speed);
221 
222  virtual bool SendAVCCommand(const std::vector<uint8_t> &cmd,
223  std::vector<uint8_t> &result,
224  int retry_cnt) = 0;
226  void ProcessPATPacket(const TSPacket &tspacket);
227  virtual void BroadcastToListeners(
228  const unsigned char *data, uint dataSize);
229 
230  uint64_t m_guid;
235  bool m_bufferCleared {true};
236 
238  std::vector<TSDataListener*> m_listeners;
239  mutable QMutex m_lock;
240 
242  static QMap<uint64_t,QString> s_idToModel;
243  static QMutex s_staticLock;
244 };
245 
246 #endif // FIREWIRE_DEVICE_H
FirewireDevice::kAVCCommonVendorDependentOpcode
@ kAVCCommonVendorDependentOpcode
Definition: firewiredevice.h:113
FirewireDevice::kAVCPanelKeyPageUp
@ kAVCPanelKeyPageUp
Definition: firewiredevice.h:165
FirewireDevice::kAVCPanelKeyMute
@ kAVCPanelKeyMute
Definition: firewiredevice.h:171
FirewireDevice::kAVCPanelKeyPlay
@ kAVCPanelKeyPlay
Definition: firewiredevice.h:172
FirewireDevice::kAVCSubunitId3
@ kAVCSubunitId3
Definition: firewiredevice.h:62
FirewireDevice::kAVCSubunitTypePrinter
@ kAVCSubunitTypePrinter
Definition: firewiredevice.h:69
channel
QDomElement channel
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:501
FirewireDevice::kAVCPanelKeyDisplayInfo
@ kAVCPanelKeyDisplayInfo
Definition: firewiredevice.h:163
FirewireDevice::kAVCPowerStateOff
@ kAVCPowerStateOff
Definition: firewiredevice.h:123
FirewireDevice::kAVCPanelKeyTuneFunction
@ kAVCPanelKeyTuneFunction
Definition: firewiredevice.h:185
FirewireDevice::kAVCPanelKeyPreviousChannel
@ kAVCPanelKeyPreviousChannel
Definition: firewiredevice.h:160
FirewireDevice::RemoveListener
virtual void RemoveListener(TSDataListener *listener)
Definition: firewiredevice.cpp:49
FirewireDevice::m_lastCrc
uint m_lastCrc
Definition: firewiredevice.h:234
FirewireDevice::kAVCPanelKeyPageDown
@ kAVCPanelKeyPageDown
Definition: firewiredevice.h:166
FirewireDevice::m_bufferCleared
bool m_bufferCleared
Definition: firewiredevice.h:235
FirewireDevice::kAVCPanelKeyRightDown
@ kAVCPanelKeyRightDown
Definition: firewiredevice.h:135
FirewireDevice::kAVCGeneralInquiryCommand
@ kAVCGeneralInquiryCommand
Definition: firewiredevice.h:43
FirewireDevice::kAVCUnitSignalSourceOpcode
@ kAVCUnitSignalSourceOpcode
Definition: firewiredevice.h:101
FirewireDevice::kAVCUnitDisconnectAVOpcode
@ kAVCUnitDisconnectAVOpcode
Definition: firewiredevice.h:95
FirewireDevice::kAVCPowerStateOn
@ kAVCPowerStateOn
Definition: firewiredevice.h:122
FirewireDevice::kAVCPowerOn
@ kAVCPowerOn
Definition: firewiredevice.h:30
FirewireDevice::kAVCSubunitTypeCameraStorage
@ kAVCSubunitTypeCameraStorage
Definition: firewiredevice.h:77
FirewireDevice::FirewireDevice
FirewireDevice(uint64_t guid, uint subunitid, uint speed)
Definition: firewiredevice.cpp:30
FirewireDevice::kAVCPanelKeyRootMenu
@ kAVCPanelKeyRootMenu
Definition: firewiredevice.h:138
FirewireDevice::kAVCPanelKeyVolumeDown
@ kAVCPanelKeyVolumeDown
Definition: firewiredevice.h:170
FirewireDevice::kAVCPanelKey9
@ kAVCPanelKey9
Definition: firewiredevice.h:153
FirewireDevice::kAVCSubunitTypeMusic
@ kAVCSubunitTypeMusic
Definition: firewiredevice.h:78
FirewireDevice::kAVCPanelKeyRewind
@ kAVCPanelKeyRewind
Definition: firewiredevice.h:176
FirewireDevice::m_guid
uint64_t m_guid
Definition: firewiredevice.h:230
FirewireDevice::kAVCSubunitTypeVideoCamera
@ kAVCSubunitTypeVideoCamera
Definition: firewiredevice.h:74
FirewireDevice::kAVCPanelKeyFavoriteMenu
@ kAVCPanelKeyFavoriteMenu
Definition: firewiredevice.h:141
FirewireDevice::IEEE1394Command
IEEE1394Command
Definition: firewiredevice.h:37
FirewireDevice::GetModelName
static QString GetModelName(uint vendor_id, uint model_id)
Definition: firewiredevice.cpp:352
FirewireDevice::kAVCSubunitTypeAudio
@ kAVCSubunitTypeAudio
Definition: firewiredevice.h:68
FirewireDevice::kAVCSubunitTypeVendorUnique
@ kAVCSubunitTypeVendorUnique
Definition: firewiredevice.h:79
FirewireDevice::kAVCPanelKeyAngle
@ kAVCPanelKeyAngle
Definition: firewiredevice.h:182
FirewireDevice::kAVCAcceptedStatus
@ kAVCAcceptedStatus
Definition: firewiredevice.h:46
FirewireDevice::kAVCSubunitTypeTapeRecorder
@ kAVCSubunitTypeTapeRecorder
Definition: firewiredevice.h:71
FirewireDevice::kAVCPanelKey2
@ kAVCPanelKey2
Definition: firewiredevice.h:146
FirewireDevice::AddListener
virtual void AddListener(TSDataListener *listener)
Definition: firewiredevice.cpp:36
FirewireDevice::kAVCCommonWriteDescriptorOpcode
@ kAVCCommonWriteDescriptorOpcode
Definition: firewiredevice.h:107
FirewireDevice::kAVCPanelKey0
@ kAVCPanelKey0
Definition: firewiredevice.h:144
FirewireDevice::kAVCPanelKeyClear
@ kAVCPanelKeyClear
Definition: firewiredevice.h:156
FirewireDevice::kAVCUnitConnectOpcode
@ kAVCUnitConnectOpcode
Definition: firewiredevice.h:97
FirewireDevice::kAVCSubunitId0
@ kAVCSubunitId0
Definition: firewiredevice.h:59
FirewireDevice::ProcessPATPacket
void ProcessPATPacket(const TSPacket &tspacket)
Definition: firewiredevice.cpp:331
FirewireDevice::kAVCPanelKeyEnter
@ kAVCPanelKeyEnter
Definition: firewiredevice.h:155
FirewireDevice::kAVCSubunitTypeBulletinBoard
@ kAVCSubunitTypeBulletinBoard
Definition: firewiredevice.h:76
FirewireDevice::kAVCSubunitId1
@ kAVCSubunitId1
Definition: firewiredevice.h:60
FirewireDevice::kAVCUnitOutputPlugSignalFormatOpcode
@ kAVCUnitOutputPlugSignalFormatOpcode
Definition: firewiredevice.h:92
FirewireDevice::kAVCPanelKey5
@ kAVCPanelKey5
Definition: firewiredevice.h:149
TSDataListener
Definition: streamlisteners.h:52
FirewireDevice::SendAVCCommand
virtual bool SendAVCCommand(const std::vector< uint8_t > &cmd, std::vector< uint8_t > &result, int retry_cnt)=0
FirewireDevice::kAVCPanelKey6
@ kAVCPanelKey6
Definition: firewiredevice.h:150
streamlisteners.h
FirewireDevice::kAVCSubunitIdIgnore
@ kAVCSubunitIdIgnore
Definition: firewiredevice.h:65
FirewireDevice::kAVCUnitInputPlugSignalFormatOpcode
@ kAVCUnitInputPlugSignalFormatOpcode
Definition: firewiredevice.h:93
FirewireDevice::GetSTBList
static std::vector< AVCInfo > GetSTBList(void)
Definition: firewiredevice.cpp:365
FirewireDevice::kAVCPanelKeyLeftDown
@ kAVCPanelKeyLeftDown
Definition: firewiredevice.h:137
FirewireDevice::PowerState
PowerState
Definition: firewiredevice.h:28
FirewireDevice::kAVCControlCommand
@ kAVCControlCommand
Definition: firewiredevice.h:39
FirewireDevice::kAVCPanelKeySubPicture
@ kAVCPanelKeySubPicture
Definition: firewiredevice.h:183
FirewireDevice::kAVCSubunitTypeTuner
@ kAVCSubunitTypeTuner
Definition: firewiredevice.h:72
FirewireDevice::kAVCPanelPassThrough
@ kAVCPanelPassThrough
Definition: firewiredevice.h:116
FirewireDevice::kAVCPanelKeyContentsMenu
@ kAVCPanelKeyContentsMenu
Definition: firewiredevice.h:140
FirewireDevice::kAVCPanelKeyChannelUp
@ kAVCPanelKeyChannelUp
Definition: firewiredevice.h:158
FirewireDevice::kAVCPanelKey7
@ kAVCPanelKey7
Definition: firewiredevice.h:151
FirewireDevice::kAVCPanelKey4
@ kAVCPanelKey4
Definition: firewiredevice.h:148
FirewireDevice::kAVCPanelKeyRightUp
@ kAVCPanelKeyRightUp
Definition: firewiredevice.h:134
FirewireDevice::kAVCPanelKeyDown
@ kAVCPanelKeyDown
Definition: firewiredevice.h:131
FirewireDevice::kAVCInTransitionStatus
@ kAVCInTransitionStatus
Definition: firewiredevice.h:48
FirewireDevice::kAVCUnitChannelUsageOpcode
@ kAVCUnitChannelUsageOpcode
Definition: firewiredevice.h:91
FirewireDevice::kAVCPanelKeyFastForward
@ kAVCPanelKeyFastForward
Definition: firewiredevice.h:177
FirewireDevice::kAVCPanelKeyPower
@ kAVCPanelKeyPower
Definition: firewiredevice.h:168
FirewireDevice::kAVCPanelKeyLeft
@ kAVCPanelKeyLeft
Definition: firewiredevice.h:132
FirewireDevice::kAVCImplementedStatus
@ kAVCImplementedStatus
Definition: firewiredevice.h:49
TSPacket
Used to access the data of a Transport Stream packet.
Definition: tspacket.h:169
FirewireDevice::kAVCSubunitId2
@ kAVCSubunitId2
Definition: firewiredevice.h:61
FirewireDevice::kAVCCommonSearchDescriptorOpcode
@ kAVCCommonSearchDescriptorOpcode
Definition: firewiredevice.h:108
avcinfo.h
FirewireDevice::kAVCPanelKeySetupMenu
@ kAVCPanelKeySetupMenu
Definition: firewiredevice.h:139
FirewireDevice::kAVCPanelKeyRecord
@ kAVCPanelKeyRecord
Definition: firewiredevice.h:175
FirewireDevice::kAVCPanelKeyRelease
@ kAVCPanelKeyRelease
Definition: firewiredevice.h:188
FirewireDevice::kAVCUnitConnectAVOpcode
@ kAVCUnitConnectAVOpcode
Definition: firewiredevice.h:94
FirewireDevice::kAVCPanelKeyUp
@ kAVCPanelKeyUp
Definition: firewiredevice.h:130
FirewireDevice::kAVCPanelKeySelect
@ kAVCPanelKeySelect
Definition: firewiredevice.h:129
FirewireDevice::kAVCPanelKeyPress
@ kAVCPanelKeyPress
Definition: firewiredevice.h:187
FirewireDevice::kAVCPanelKeyVolumeUp
@ kAVCPanelKeyVolumeUp
Definition: firewiredevice.h:169
FirewireDevice::kAVCPanelKeyDot
@ kAVCPanelKeyDot
Definition: firewiredevice.h:154
FirewireDevice::kAVCResponseImplemented
@ kAVCResponseImplemented
Definition: firewiredevice.h:53
FirewireDevice::kAVCPanelKeyExit
@ kAVCPanelKeyExit
Definition: firewiredevice.h:142
FirewireDevice::kAVCPanelKey3
@ kAVCPanelKey3
Definition: firewiredevice.h:147
FirewireDevice::kAVCCommonReserveOpcode
@ kAVCCommonReserveOpcode
Definition: firewiredevice.h:111
uint
unsigned int uint
Definition: compat.h:141
FirewireDevice::kAVCSpecificInquiryCommand
@ kAVCSpecificInquiryCommand
Definition: firewiredevice.h:41
FirewireDevice::kAVCPanelKey1
@ kAVCPanelKey1
Definition: firewiredevice.h:145
FirewireDevice::kAVCSubunitTypeDiscRecorder
@ kAVCSubunitTypeDiscRecorder
Definition: firewiredevice.h:70
FirewireDevice::IsSTBSupported
static bool IsSTBSupported(const QString &model)
Definition: firewiredevice.cpp:485
FirewireDevice::kAVCInterimStatus
@ kAVCInterimStatus
Definition: firewiredevice.h:52
FirewireDevice::kAVCPanelKeyInputSelect
@ kAVCPanelKeyInputSelect
Definition: firewiredevice.h:162
FirewireDevice::BroadcastToListeners
virtual void BroadcastToListeners(const unsigned char *data, uint dataSize)
Definition: firewiredevice.cpp:309
FirewireDevice::s_idToModel
static QMap< uint64_t, QString > s_idToModel
Vendor ID + Model ID to FirewireDevice STB model string.
Definition: firewiredevice.h:242
FirewireDevice::kAVCPanelKeyForward
@ kAVCPanelKeyForward
Definition: firewiredevice.h:179
FirewireDevice::kAVCPowerUnknown
@ kAVCPowerUnknown
Definition: firewiredevice.h:32
FirewireDevice::kAVCPanelKeyBackward
@ kAVCPanelKeyBackward
Definition: firewiredevice.h:180
FirewireDevice::kAVCPanelKey8
@ kAVCPanelKey8
Definition: firewiredevice.h:152
FirewireDevice::kAVCStatusInquiryCommand
@ kAVCStatusInquiryCommand
Definition: firewiredevice.h:40
FirewireDevice::m_subunitid
uint m_subunitid
Definition: firewiredevice.h:231
FirewireDevice::SetLastChannel
void SetLastChannel(uint channel)
Definition: firewiredevice.cpp:322
FirewireDevice::m_lastChannel
uint m_lastChannel
Definition: firewiredevice.h:233
FirewireDevice::kAVCPanelKeyStop
@ kAVCPanelKeyStop
Definition: firewiredevice.h:173
FirewireDevice::~FirewireDevice
virtual ~FirewireDevice()=default
FirewireDevice::kAVCPowerQueryFailed
@ kAVCPowerQueryFailed
Definition: firewiredevice.h:33
FirewireDevice::kAVCUnitConnectionsOpcode
@ kAVCUnitConnectionsOpcode
Definition: firewiredevice.h:96
FirewireDevice::kAVCSubunitTypeVideoMonitor
@ kAVCSubunitTypeVideoMonitor
Definition: firewiredevice.h:67
FirewireDevice::s_staticLock
static QMutex s_staticLock
Definition: firewiredevice.h:243
FirewireDevice::kAVCUnitPlugInfoOpcode
@ kAVCUnitPlugInfoOpcode
Definition: firewiredevice.h:88
FirewireDevice::kAVCSubunitIdExtended
@ kAVCSubunitIdExtended
Definition: firewiredevice.h:64
FirewireDevice::kAVCUnitDisconnectOpcode
@ kAVCUnitDisconnectOpcode
Definition: firewiredevice.h:98
FirewireDevice::m_listeners
std::vector< TSDataListener * > m_listeners
Definition: firewiredevice.h:238
FirewireDevice::kAVCSubunitId4
@ kAVCSubunitId4
Definition: firewiredevice.h:63
FirewireDevice::kAVCSubunitTypeCA
@ kAVCSubunitTypeCA
Definition: firewiredevice.h:73
FirewireDevice::kAVCPanelKeyEject
@ kAVCPanelKeyEject
Definition: firewiredevice.h:178
FirewireDevice::kAVCCommonPowerOpcode
@ kAVCCommonPowerOpcode
Definition: firewiredevice.h:110
FirewireDevice::kAVCCommonReadDescriptorOpcode
@ kAVCCommonReadDescriptorOpcode
Definition: firewiredevice.h:106
FirewireDevice::kAVCCommonPlugInfoOpcode
@ kAVCCommonPlugInfoOpcode
Definition: firewiredevice.h:112
FirewireDevice::IEEE1394PanelPassThroughParam0
IEEE1394PanelPassThroughParam0
Definition: firewiredevice.h:127
FirewireDevice::m_speed
uint m_speed
Definition: firewiredevice.h:232
FirewireDevice::kAVCUnitUnitInfoOpcode
@ kAVCUnitUnitInfoOpcode
Definition: firewiredevice.h:99
FirewireDevice::kAVCPanelKeySoundSelect
@ kAVCPanelKeySoundSelect
Definition: firewiredevice.h:161
FirewireDevice::kAVCSubunitTypePanel
@ kAVCSubunitTypePanel
Definition: firewiredevice.h:75
FirewireDevice::kAVCUnitSubunitInfoOpcode
@ kAVCUnitSubunitInfoOpcode
Definition: firewiredevice.h:100
FirewireDevice::kAVCPowerStateQuery
@ kAVCPowerStateQuery
Definition: firewiredevice.h:124
FirewireDevice::kAVCUnitDigitalOutputOpcode
@ kAVCUnitDigitalOutputOpcode
Definition: firewiredevice.h:89
FirewireDevice::IEEE1394Opcode
IEEE1394Opcode
Definition: firewiredevice.h:85
FirewireDevice::kAVCUnitPowerOpcode
@ kAVCUnitPowerOpcode
Definition: firewiredevice.h:102
FirewireDevice::kAVCPanelKeyRight
@ kAVCPanelKeyRight
Definition: firewiredevice.h:133
FirewireDevice::GetPowerState
virtual PowerState GetPowerState(void)
Definition: firewiredevice.cpp:102
FirewireDevice::kAVCSubunitTypeExtended
@ kAVCSubunitTypeExtended
Definition: firewiredevice.h:80
FirewireDevice::IsSTBBufferCleared
bool IsSTBBufferCleared(void) const
Definition: firewiredevice.h:209
FirewireDevice::kAVCRejectedStatus
@ kAVCRejectedStatus
Definition: firewiredevice.h:47
FirewireDevice::kAVCPanelKeyHelp
@ kAVCPanelKeyHelp
Definition: firewiredevice.h:164
FirewireDevice::SetChannel
virtual bool SetChannel(const QString &panel_model, uint alt_method, uint channel)
Definition: firewiredevice.cpp:148
FirewireDevice::kAVCPowerOff
@ kAVCPowerOff
Definition: firewiredevice.h:31
FirewireDevice::SetPowerState
virtual bool SetPowerState(bool on)
Definition: firewiredevice.cpp:68
FirewireDevice::kAVCPanelKeyPause
@ kAVCPanelKeyPause
Definition: firewiredevice.h:174
FirewireDevice::ResetBus
virtual bool ResetBus(void)
Definition: firewiredevice.h:197
FirewireDevice::m_lock
QMutex m_lock
Definition: firewiredevice.h:239
FirewireDevice::kAVCChangedStatus
@ kAVCChangedStatus
Definition: firewiredevice.h:50
FirewireDevice::IEEE1394UnitAddress
IEEE1394UnitAddress
Definition: firewiredevice.h:57
FirewireDevice::IsPortOpen
virtual bool IsPortOpen(void) const =0
FirewireDevice::ClosePort
virtual bool ClosePort(void)=0
FirewireDevice::kAVCSubunitTypeUnit
@ kAVCSubunitTypeUnit
Definition: firewiredevice.h:81
FirewireDevice::kAVCPanelKeyLeftUp
@ kAVCPanelKeyLeftUp
Definition: firewiredevice.h:136
FirewireDevice::kAVCCommonOpenDescriptorOpcode
@ kAVCCommonOpenDescriptorOpcode
Definition: firewiredevice.h:105
FirewireDevice::kAVCNotImplementedStatus
@ kAVCNotImplementedStatus
Definition: firewiredevice.h:45
FirewireDevice::m_openPortCnt
uint m_openPortCnt
Definition: firewiredevice.h:237
FirewireDevice
Definition: firewiredevice.h:23
FirewireDevice::IEEE1394UnitPowerParam0
IEEE1394UnitPowerParam0
Definition: firewiredevice.h:120
FirewireDevice::OpenPort
virtual bool OpenPort(void)=0
FirewireDevice::kAVCNotifyCommand
@ kAVCNotifyCommand
Definition: firewiredevice.h:42
FirewireDevice::kAVCCommonObjectNumberSelectOpcode
@ kAVCCommonObjectNumberSelectOpcode
Definition: firewiredevice.h:109
FirewireDevice::kAVCUnitDigitalInputOpcode
@ kAVCUnitDigitalInputOpcode
Definition: firewiredevice.h:90
FirewireDevice::kAVCPanelKeyChannelDown
@ kAVCPanelKeyChannelDown
Definition: firewiredevice.h:159