00001 #ifndef _DARWIN_AVC_INFO_H_
00002 #define _DARWIN_AVC_INFO_H_
00003
00004 #ifdef USING_OSX_FIREWIRE
00005
00006
00007 #include <vector>
00008 using namespace std;
00009
00010
00011 #undef always_inline
00012 #include <IOKit/IOKitLib.h>
00013 #include <IOKit/firewire/IOFireWireLib.h>
00014 #include <IOKit/firewire/IOFireWireLibIsoch.h>
00015 #include <IOKit/firewire/IOFireWireFamilyCommon.h>
00016 #include <IOKit/avc/IOFireWireAVCLib.h>
00017
00018
00019 #include <qmap.h>
00020
00021
00022 #include "avcinfo.h"
00023
00024 class DarwinFirewireDevice;
00025
00026 class DarwinAVCInfo : public AVCInfo
00027 {
00028 public:
00029 DarwinAVCInfo() :
00030 fw_node_ref(NULL), fw_device_ref(NULL),
00031 fw_service_ref(NULL), avc_service_ref(NULL),
00032 fw_device_notifier_ref(NULL),
00033 avc_handle(NULL), fw_handle(NULL) { }
00034
00035 void Update(uint64_t _guid, DarwinFirewireDevice *dev,
00036 IONotificationPortRef notify_port,
00037 CFRunLoopRef &thread_cf_ref, io_object_t obj);
00038
00039 bool OpenPort(CFRunLoopRef &thread_cf_ref);
00040 bool ClosePort(void);
00041
00042 bool OpenAVCInterface(CFRunLoopRef &thread_cf_ref);
00043 void CloseAVCInterface(void);
00044
00045 bool OpenDeviceInterface(CFRunLoopRef &thread_cf_ref);
00046 void CloseDeviceInterface(void);
00047
00048 virtual bool SendAVCCommand(
00049 const vector<uint8_t> &cmd,
00050 vector<uint8_t> &result,
00051 int retry_cnt);
00052
00053 bool GetDeviceNodes(int &local_node, int &remote_node);
00054
00055 bool IsAVCInterfaceOpen(void) const { return avc_handle; }
00056 bool IsPortOpen(void) const { return fw_handle; }
00057
00058 public:
00059 io_service_t fw_node_ref;
00060 io_service_t fw_device_ref;
00061 io_service_t fw_service_ref;
00062 io_service_t avc_service_ref;
00063
00064 io_object_t fw_device_notifier_ref;
00065
00066 IOFireWireAVCLibUnitInterface **avc_handle;
00067 IOFireWireLibDeviceRef fw_handle;
00068 };
00069 typedef QMap<uint64_t,DarwinAVCInfo*> avcinfo_list_t;
00070
00071 #endif // USING_OSX_FIREWIRE
00072
00073 #endif // _DARWIN_AVC_INFO_H_