Call an IOUSBDeviceInterface function on an obj-c object instead of a C structure
- by b1onic
Let's say I want to close an USB device. Here is a C structure representing the USB device:
struct __USBDevice {
uint16_t idProduct;
io_service_t usbService;
IOUSBDeviceInterface **deviceHandle;
IOUSBInterfaceInterface **interfaceHandle;
Boolean open;
};
typedef struct __USBDevice *USBDeviceRef;
Here is the code to close the device:
// device is a USBDeviceRef structure
// USBDeviceClose is a function member of IOUSBDeviceInterface C Pseudoclass
(*device->deviceHandle)->USBDeviceClose(device->deviceHandle);
Now imagine that the device properties are declared in an obj-c class
@interface Device : NSObject {
NSNumber idProduct
io_service_t usbService;
IOUSBDeviceInterface **deviceHandle;
IOUSBInterfaceInterface **interfaceHandle;
BOOL open;
}
@end
How would I do to call USBDeviceClose() ?