Innovate Motorsports OT-2 SDK User Manual

Page 65

Advertising
background image

65


The interface is byte oriented, and only involves a few calls:

Discovery

BOOL imsusbCanConnect(BOOL *inuse); // OUT: indicates if the reason for

// failure is that the device is in
// use



Check if a device is available.
Returns: TRUE if a USB device can be connected to, FALSE if not. If the result is
FALSE, inuse can be used to determine if there is no device present, or if a device is
present but currently in use.

Open/Close

BOOL imsusbConnect();


Connect to the IMS USB Device.
Returns: TRUE if successful, FALSE on failure.

void imsusbClose();


Release the previously connected IMS USB device.

Receive Data

BOOL imsusbIsByte();


Check if a byte is ready to be received.
Returns: TRUE if a data byte is ready, FALSE if no data is ready.

BYTE imsusbGetByte();


Read a byte from device.
Returns: byte read from USB, will block until a byte is received. If USB terminates
abnormally, returns 0.

int imsusbGetBytes(int len,

// Number of bytes to read

BYTE *data)

// OUT: buffer for read data


Read multiple bytes from USB.
Returns: Number of bytes read or -1 for error.

Send Data

BOOL imsusbPutByte(BYTE b);

Advertising