MythTV  master
darwinavcinfo.h
Go to the documentation of this file.
1 #ifndef _DARWIN_AVC_INFO_H_
2 #define _DARWIN_AVC_INFO_H_
3 
4 #ifdef USING_OSX_FIREWIRE
5 
6 // C++ headers
7 #include <vector>
8 using namespace std;
9 
10 // OS X headers
11 #undef always_inline
12 #include <IOKit/IOKitLib.h>
13 #include <IOKit/firewire/IOFireWireLib.h>
14 #include <IOKit/firewire/IOFireWireLibIsoch.h>
15 #include <IOKit/firewire/IOFireWireFamilyCommon.h>
16 #include <IOKit/avc/IOFireWireAVCLib.h>
17 
18 // Qt headers
19 #include <QMap>
20 
21 // MythTV headers
22 #include "avcinfo.h"
23 
25 
26 class DarwinAVCInfo : public AVCInfo
27 {
28  public:
29  DarwinAVCInfo() = default;
30 
31  void Update(uint64_t _guid, DarwinFirewireDevice *dev,
32  IONotificationPortRef notify_port,
33  CFRunLoopRef &thread_cf_ref, io_object_t obj);
34 
35  bool OpenPort(CFRunLoopRef &thread_cf_ref);
36  bool ClosePort(void);
37 
38  bool OpenAVCInterface(CFRunLoopRef &thread_cf_ref);
39  void CloseAVCInterface(void);
40 
41  bool OpenDeviceInterface(CFRunLoopRef &thread_cf_ref);
42  void CloseDeviceInterface(void);
43 
44  bool SendAVCCommand(
45  const vector<uint8_t> &cmd,
46  vector<uint8_t> &result,
47  int retry_cnt) override; // AVCInfo
48 
49  bool GetDeviceNodes(int &local_node, int &remote_node);
50 
51  bool IsAVCInterfaceOpen(void) const { return avc_handle; }
52  bool IsPortOpen(void) const { return fw_handle; }
53 
54  public:
55  io_service_t fw_node_ref {0}; // parent of fw_device_ref
56  io_service_t fw_device_ref {0}; // parent of fw_service_ref
57  io_service_t fw_service_ref {0}; // parent of avc_service_ref
58  io_service_t avc_service_ref {0};
59 
60  io_object_t fw_device_notifier_ref {0};
61 
62  IOFireWireAVCLibUnitInterface **avc_handle {0};
63  IOFireWireLibDeviceRef fw_handle {0};
64 };
65 using avcinfo_list_t = QMap<uint64_t,DarwinAVCInfo*>;
66 
67 #endif // USING_OSX_FIREWIRE
68 
69 #endif // _DARWIN_AVC_INFO_H_
bool IsPortOpen(void) const
Definition: darwinavcinfo.h:52
bool IsAVCInterfaceOpen(void) const
Definition: darwinavcinfo.h:51
QMap< uint64_t, DarwinAVCInfo * > avcinfo_list_t
Definition: darwinavcinfo.h:65