Functions



IOWarriorClose


Performs some cleanup. You should call this function when you application is about to quit.
void IOWarriorClose (void);

IOWarriorCloseAllInterfaces


Closes all open IOWarriorInterfaces.
void IOWarriorCloseAllInterfaces (void);

If you previously used IOWarriorSetAutoCloseInterfaces to leave interfaces open, use this function to close interface that may be still open.


IOWarriorFirstInterfaceNodeOfType


Returns a reference to the first IOWarriorListNode struct of a certain interface type.

Parameters

NameDescription
inInterfaceTypeThe requested interface type. NULL if no such interface is available.
IOWarriorListNode* IOWarriorFirstInterfaceNodeOfType (
    int inInterfaceType
);

Use this function to obtain a reference to the IOWarriorListNode struct of the first interface of type inInterfaceType. Use the result as a parameter for the IOWarriorRead and IOWarriorWrite functions.


IOWarriorInit


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);

IOWarriorInstallReportHandlerForInterfaceAtNode


Install report handler for an interface.

Parameters

NameDescription
inNodeThe interface node pointing to the interface.
inHandlerToInstallSee Hid.h for a description of this callback function type.
inHandlerRefConA reference value thats passed to your report handler function when invoked.
Result: An error code.
OSErr IOWarriorInstallReportHandlerForInterfaceAtNode (
    IOWarriorListNode *inNode,
    HIDReportHandlerProcPtr inHandlerToInstall,
    UInt32 inHandlerRefCon
);

Installs a custom report handler for the interface specified by inNode. Your handler will be invoked when the interface sends a report in interrupt mode.


IOWarriorInstallReportHandlerInterface1


Install report handler for interface1 of first IOWarrior40.

Parameters

NameDescription
inHandlerToInstallSee Hid.h for a description of this callback function type.
inHandlerRefConA reference value thats passed to your report handler function when invoked.
OSErr IOWarriorInstallReportHandlerInterface1 (
    HIDReportHandlerProcPtr inHandlerToInstall,
    UInt32 inHandlerRefCon
);

Install a report handler function that is invoked when report data is received from interface 1 of the first IOWarrior40 encountered.


IOWarriorIsPresent


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);

IOWarriorRead


Reads an HID report from an interface.

Parameters

NameDescription
inNodeThe interface the report data should be written from. Can be obtained by calling IOWarriorFirstInterfaceNodeOfType.
inReportIDThe id of report to be read.
inSizeThe size of the report.
inDataPointer to the space where the report data can be stored.
Result: Returns noErr (0) if operation was successful. Otherwise returns an error code different from noErr.
int IOWarriorRead (
    IOWarriorListNode* inNode,
    int inReportID,
    int inSize,
    void* outData
);

Use this function to read an HID report with a certain id and a certain size from the interface at inNode.


IOWarriorReadInterface0


Reads 4 byte (32 bit) from interface 0 of the first IOWarrior40 encountered.

Parameters

NameDescription
outDataA 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 IOWarriorReadInterface0 (
    void *outData
);

IOWarriorRemoveReportHandlerForInterfaceAtNode


Removes previously installed report handler.

Parameters

NameDescription
inNodeThe interface
Result: An error code.
OSErr IOWarriorRemoveReportHandlerForInterfaceAtNode (
    IOWarriorListNode *inNode
);

Removes any previously installed report handler for the interface specified by inNode.


IOWarriorRemoveReportHandlerInterface1


Removes report handler.
OSErr IOWarriorRemoveReportHandlerInterface1 (void);

Removes any previously installed report handler installed by IOWarriorInstallReportHandlerInterface1.


IOWarriorSetAutoCloseInterfaces


Toggles interface auto close mode.

Parameters

NameDescription
inFlagtrue: close interface after read/write operations, false: leave interface opened
void IOWarriorSetAutoCloseInterfaces (
    int inFlag
);

Use this function to change the way the IOWarriorRead and IOWarrriorWrite functions treat open interfaces after the requested operation finished. Per default the interface is closed. Closing the interface breaks previously installed report handlers. If you are using report handler, you should invoked this function with inFlag set to false.


IOWarriorWrite


Sends an HID report to an interface.

Parameters

NameDescription
inNodeThe interface the report data should be written to. Can be obtained by calling IOWarriorFirstInterfaceNodeOfType.
inReportIDThe id of report to be written.
inSizeThe size of the report.
inDataPointer to the data to be written.
Result: Returns noErr (0) if operation was successful. Otherwise returns an error code different from noErr.
int IOWarriorWrite (
    IOWarriorListNode* inNode,
    int inReportID,
    int inSize,
    void* inData
);

Use this function to send an HID report with a certain id and a certain size to the interface at inNode.


IOWarriorWriteInterface0


Writes a 4 byte buffer (32 bit) to interface 0 of the first IOWarrior40 encountered.

Parameters

NameDescription
inDataA 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 IOWarriorWriteInterface0 (
    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.


IOWarriorWriteInterface1


Writes a 7 byte output report to interface 1 of the first IOWarrior40 encountered.

Parameters

NameDescription
inReportIDThe report ID of the request. See the IO Warrior Datasheet for the appropriate values.
inDataA 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 IOWarriorWriteInterface1 (
    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.

(Last Updated 12/2/2003)