ECRobot C++ API for LEGO MINDSTORMS NXT  1.0.10
ecrobot::Usb Class Reference

USB communication class. More...

#include <Usb.h>

List of all members.

Public Member Functions

 Usb (void)
 Constructor.
 ~Usb (void)
 Destructor (shut down USB).
void commHandler (void)
 USB communication handler which must be invoked every 1msec while application is running.
bool isConnected (void) const
 Check connection status.
U32 send (U8 *data, U32 offset, U32 length)
 Send data to the host device.
U32 receive (U8 *data, U32 offset, U32 length) const
 Receive data from the host device.
bool close (void)
 Close the existing connection.

Static Public Attributes

static const U32 MAX_USB_DATA_LENGTH = 64
 Maximum length of data in byte for send/receive.

Detailed Description

USB communication class.


Constructor & Destructor Documentation

ecrobot::Usb::Usb ( void  )

Constructor.

Note:
This class must be constructed as a global object. Otherwise, a device assertion will be displayed
in the LCD when the object is constructed as a non global object. When the object is destructed while the system is shut down, USB is shut down automatically.

Parameters:
-
Returns:
-
ecrobot::Usb::~Usb ( void  )

Destructor (shut down USB).

Parameters:
-
Returns:
-

Member Function Documentation

bool ecrobot::Usb::close ( void  )

Close the existing connection.

Parameters:
-
Returns:
true:closed/false failed to close
void ecrobot::Usb::commHandler ( void  )

USB communication handler which must be invoked every 1msec while application is running.

Parameters:
-
Returns:
-
bool ecrobot::Usb::isConnected ( void  ) const

Check connection status.

Parameters:
-
Returns:
true:connected/false:not connected
U32 ecrobot::Usb::receive ( U8 *  data,
U32  offset,
U32  length 
) const

Receive data from the host device.

Parameters:
dataData to be received
offsetOffset of data to be received
lengthLength of data to be received
Returns:
Length of received data
U32 ecrobot::Usb::send ( U8 *  data,
U32  offset,
U32  length 
)

Send data to the host device.

Parameters:
dataData to be sent
offsetOffset of data to be sent
lengthLength of data to be sent
Returns:
Length of sent data

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator Friends Defines