Functions
Reads 4 byte (32 bit) from interface 0 of the first IOWarrior 40 device connected to this system using a GetOutputReport request.
Parameters
Name | Description |
outData | A pointer to a buffer where the data should be stored. Buffer has to be at least 4 bytes long |
Result: Returns 0 if reading operation was successfull. Returns a value different from 0 otherwise.
int IOWarrior40ReadInterface0 (
void *outData
);
Reads a 7 byte output report from interface 1 of the first IOWarrior 40 device connected to this system.
This function won't work for interfaces 1 of an IOWarrior 40 on Mac OS X 10.2.x.
Parameters
Name | Description |
inReportID | The report ID of the request. See the IO Warrior Datasheet for the appropriate values. |
outData | A pointer to a buffer where the data should be stored. Buffer has to be at least 7 bytes long |
Result: Returns 0 if reading operation was successfull. Returns a value different from 0 otherwise.
int IOWarrior40ReadInterface1 (
int inReportID,
void *outData
);
Use this function to obtain data from the IOWarrior when in special mode. See the IOWarrior datasheet for details.
Writes a 4 byte buffer (32 bit) to interface 0 of the first IOWarrior 40 devices using a SetOutputReport request.
Parameters
Name | Description |
inData | A pointer to the data being written. Should be at least 4 bytes long. |
Result: Returns 0 if writing operation was successfull. Returns a value different from 0 otherwise.
int IOWarrior40WriteInterface0 (
void *inData
);
The first byte of the passed buffer becomes mapped to the pins of port 0, the second byte to the pins of port 1 and so on.
Writes a 7 byte output report to interface 1 of the first IOWarrior 40 device connected to this system.
Parameters
Name | Description |
inReportID | The report ID of the request. See the IO Warrior Datasheet for the appropriate values. |
inData | A pointer to the data being written. Should be at least 7 bytes long. |
Result: Returns 0 if writing operation was successfull. Returns a value different from 0 otherwise.
int IOWarrior40WriteInterface1 (
int inReportID,
void *inData
);
Use the function to control IOWarrior special modes (like IIC and LCD mode) of the IOWarrior. See the IOWarrior datasheet for details.
Returns the number of interfaces connected to this system.
Result: The number of IOWarrior interfaces.
int IOWarriorCountInterfaces (void);
Returns the first IOWarrior interface of type inInterfaceType.
Parameters
Name | Description |
inInterfaceType | The type of the interface to be returned. |
Result: Returns an interface object if found, NULL otherwise.
IOWarriorHIDDeviceInterface** IOWarriorFirstInterfaceOfType (
int inInterfaceType
);
Use this function to get the first discovered interface of a certain type. See the Constants definitions for a list of supported IOWarrior interface types. The result of this function can be used as paramter for IOWarriorWriteToInterface or IOWarriorReadFromInterface. Returns NULL if no interface matching inInterfaceType could be found.
Initializes the IOWarrior library. Call this before calling any other functions.
Result: Returns 0 if successfull, otherwise return value is different from 0.
int IOWarriorInit (void);
Returns the list node element at index inIndex.
Parameters
Name | Description |
inIndex | The index of the desired list node. First list node has index 0. |
Result: A pointer to a structure of type IOWarriorListNode. NULL if index is out of bounds.
IOWarriorListNode* IOWarriorInterfaceListNodeAtIndex (
int inIndex
);
Use this function to obtain more information (serial number, device type) about an interface of an IOWarrior device.
Use this function to too see of an IOWarrior device is present.
Result: Returns 1 if at least one IOWarrior is connected to this system. Returns 0 if no IOWarrior device could be discovered.
int IOWarriorIsPresent (void);
Reads data from a specific interface.
Parameters
Name | Description |
inInterface | The interface the data should be read from. Pass the ioWarriorHIDInterface member of an IOWarriorListNode struct. This function will not get you the data sent in interrupt mode from interface 1. Instead you will receive a copy of the last HID report sent in interrupt mode. Use IOWarriorSetInterruptCallback to receive data received in interrupt mode. |
inReportID | The report ID of the request. See the IO Warrior Datasheet for the appropriate values. |
inSize | The size of the data to be read. |
inData | A pointer to a buffer thats at least inSize bytes long. Read data will be stored here. |
Result: Returns 0 if read operation was successful, returns an error code different from 0 otherwise.
int IOWarriorReadFromInterface (
IOWarriorHIDDeviceInterface** inInterface,
int inReportID,
int inSize,
void* outData
);
Use this function to read a certain amount of data associated with a certain reportID to a specific interface.
Sets the function to be called when IOWarrior devices ar added or removed.
void IOWarriorSetDeviceCallback (
IOWarriorDeviceCallbackFunctionPtr inCallbackPtr,
void* inRefCon
);
Use this function to install a custom callback function. You function will be called whenever IOWarrior devices are added or removed from the system. You should invalidate any references to IOWarriorListNode structures you might have saved when your callback functions gets called. Be sure to call IOWarriorCountInterfaces at least once after you callback function was invoked before calling any other functions from the IOWarrior Library.
Sets the function to be called when a report data is received on inInterface.
Parameters
Name | Description |
inInterface | The interface where your data arrives |
inBuffer | A buffer provided by the caller. |
inBufferSize | The size of inBuffer. |
inCallbackPtr | A pointer to your callback function. See IOHIDLib.h for more info. |
inRefCon | A reference value passed to your callback on invocation. |
int IOWarriorSetInterruptCallback (
IOWarriorHIDDeviceInterface** inInterface,
void* inBuffer,
UInt32 inBufferSize,
IOHIDReportCallbackFunction inCallbackPtr,
void* inRefCon
);
Use this function to install a custom callback routine that gets invoked when data is received on interface inInterface. This function will only work when your application was compiled on Mac OS 10.3 or later and is running on Mac OS 10.3 or later. For earlier systems the implementation of the function is hidden from the compiler using preprocessor commands, because the system does not implement the required API calls.
Writes data to a specific interface.
Parameters
Name | Description |
inInterface | The interface the data should be written to. Pass the ioWarriorHIDInterface member of an IOWarriorListNode struct obtained earlier. |
inSize | The size of the data to be written. |
inData | A pointer to the data to be written. First byte is report id. |
Result: Returns 0 if write operation was successful, returns an error code different from 0 otherwise.
int IOWarriorWriteToInterface (
IOWarriorHIDDeviceInterface** inInterface,
int inSize,
void* inData
);
Use this function to write to a certain amount of data associated with a certain reportID to a specific interface.
(Last Updated 11/5/2003)