Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members  

nFANTOM100::iNXT Class Reference

Interface to a LEGO MINDSTORMS NXT. More...

#include <iNXT.h>

List of all members.

Public Types

enum  tBuffer {
  kBufferStandard,
  kBufferHighSpeed
}
 Enumeration of buffer types on the NXT.


Public Methods

virtual iFilecreateFile (ViConstString fileName, tStatus &status)=0
 Creates a file object for the file with the specified name on this NXT. More...

virtual void destroyFile (iFile *filePtr)=0
 Destroys the specified file object. More...

virtual iFileIteratorcreateFileIterator (ViConstString fileNamePattern, tStatus &status)=0
 Creates an iterator to the files on this NXT. More...

virtual void destroyFileIterator (iFileIterator *fileIteratorPtr)=0
 Destroys the specified file iterator. More...

virtual iModulecreateModule (ViConstString moduleName, ViUInt32 moduleID, ViUInt32 moduleSizeInBytes, ViUInt32 ioMapSizeInBytes, tStatus &status)=0
 Creates a module object for the module with the specified name on this NXT. More...

virtual void destroyModule (iModule *modulePtr)=0
 Destroys the specified module object. More...

virtual iModuleIteratorcreateModuleIterator (ViConstString moduleNamePattern, tStatus &status)=0
 Creates an iterator to the modules on this NXT. More...

virtual void destroyModuleIterator (iModuleIterator *moduleIteratorPtr)=0
 Destroys the specified module iterator. More...

virtual void getFirmwareVersion (ViUInt8 &protocolVersionMajorRef, ViUInt8 &protocolVersionMinorRef, ViUInt8 &firmwareVersionMajorRef, ViUInt8 &firmwareVersionMinorRef, tStatus &status)=0
 Retrieves the firmware version of this NXT. More...

virtual ViUInt32 sendDirectCommand (ViBoolean requireResponse, const ViByte commandBufferPtr[], ViUInt32 commandBufferSizeInBytes, ViPBuf responseBufferPtr, ViUInt32 responseBufferSizeInBytes, tStatus &status)=0
 Sends the specified direct command to this NXT. More...

virtual void downloadFirmware (const ViByte firmwareBufferPtr[], ViUInt32 firmwareBufferSizeInBytes, tStatus &status)=0
 Downloads firmware to this NXT. More...

virtual ViUInt32 write (const ViByte bufferPtr[], ViUInt32 numberOfBytes, tStatus &status)=0
 Writes, in a generic fashion, to this NXT. More...

virtual ViUInt32 read (ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus &status)=0
 Reads, in a generic fashion, from this NXT. More...

virtual void bootIntoFirmwareDownloadMode (tStatus &status)=0
 Reboots this NXT into firmware-download mode. More...

virtual void setName (ViConstString newName, tStatus &status)=0
 Sets the name of this NXT. More...

virtual void getDeviceInfo (ViChar name[], ViByte bluetoothAddress[], ViUInt8 signalStrength[], ViUInt32 &availableFlash, tStatus &status)=0
 Retrieves basic information about this NXT. More...

virtual void eraseUserFlash (tStatus &status)=0
 Erases all files from this NXT, leaving only the firmware. More...

virtual ViUInt32 pollAvailableLength (tBuffer bufferSelector, tStatus &status)=0
 Polls the data buffer on this NXT for the number of bytes available to be read.

virtual ViUInt32 readBufferData (ViPBuf dataBuffer, tBuffer bufferSelector, ViUInt32 numberOfBytesToRead, tStatus &status)=0
 Reads data from the data buffer on this NXT. More...

virtual void getResourceString (ViChar resourceString[], tStatus &status)=0
 Retrieves the resource string for this NXT's session.

virtual void bluetoothFactoryReset (tStatus &status)=0
 Resets the Bluetooth module on this NXT to its factory settings.


Static Public Methods

nFANTOM100_kExport iNXT *_VI_FUNCC createNXT (ViConstString resourceString, tStatus &status, ViBoolean checkFirmwareVersion=true)
 Creates an NXT object. More...

nFANTOM100_kExport void _VI_FUNCC destroyNXT (iNXT *nxtPtr)
 Destroys an NXT object. More...

nFANTOM100_kExport iNXTIterator
*_VI_FUNCC 
createNXTIterator (ViBoolean searchBluetooth, ViUInt32 bluetoothSearchTimeoutInSeconds, tStatus &status)
 Creates an NXT iterator. More...

nFANTOM100_kExport void _VI_FUNCC destroyNXTIterator (iNXTIterator *iterPtr)
 Destroys an NXT iterator object.

nFANTOM100_kExport void _VI_FUNCC pairBluetooth (ViConstString resourceName, ViConstString passkey, ViChar pairedResourceName[], tStatus &status)
 Pairs with an NXT via Bluetooth. More...

nFANTOM100_kExport void _VI_FUNCC unpairBluetooth (ViConstString resourceName, tStatus &status)
 Unpairs with an NXT via Bluetooth. More...

nFANTOM100_kExport ViBoolean
_VI_FUNCC 
isPaired (ViConstString resourceName, tStatus &status)
 Determines if the NXT associated with the specified resource string is paired. More...

nFANTOM100_kExport void findDeviceInFirmwareDownloadMode (ViChar resourceName[], tStatus &status)
 Finds the NXT that is currently in firmware-download mode. More...


Protected Methods

virtual ~iNXT ()=0
 Destructor.


Detailed Description

Interface to a LEGO MINDSTORMS NXT.


Member Function Documentation

virtual void nFANTOM100::iNXT::bootIntoFirmwareDownloadMode tStatus   status [pure virtual]
 

Reboots this NXT into firmware-download mode.

This is required before invoking the downloadFirmware method. The reboot does not occur is the specified status is fatal.

Parameters:
status  Status chaining object.

virtual iFile* nFANTOM100::iNXT::createFile ViConstString    fileName,
tStatus   status
[pure virtual]
 

Creates a file object for the file with the specified name on this NXT.

Invoking this method does not actually create a file on the NXT. Rather, this method creates a file object which may be used to open a file on this NXT, for reading or writing, or may be used to delete a file on the NXT. A file is not created if the specified status is fatal. The returned file object should be destroyed using the iNXT::destroyFile method.

Parameters:
fileName  Name of the file. The file name must conform to the 15.3 naming convention and be NULL-terminated.
status  Status chaining object.
Returns:
A pointer to the iFile object that was created.

virtual iFileIterator* nFANTOM100::iNXT::createFileIterator ViConstString    fileNamePattern,
tStatus   status
[pure virtual]
 

Creates an iterator to the files on this NXT.

The iterator traverses those files on this NXT that match the specified file name pattern. The iterator is not created if the specified status is fatal. The returned file iterator object should be destroyed using the iNXT::destroyFileIterator method.

Parameters:
fileNamePattern  The file name pattern against which to match when iterating over the files on this NXT. The file name pattern may contain wildcards. The wildcards may be used in the following manner: *.* (all files on this NXT); fileBaseName.* (all files on this NXT with the specified base name regardless of extension); *.fileExtension (all files on this NXT with the specified extension, regardless of basename); fileBaseName.fileExtension (the file on this NXT with the specified base name and extension).
status  Status chaining object.
Returns:
A pointer to the iFileIterator object that was created.

virtual iModule* nFANTOM100::iNXT::createModule ViConstString    moduleName,
ViUInt32    moduleID,
ViUInt32    moduleSizeInBytes,
ViUInt32    ioMapSizeInBytes,
tStatus   status
[pure virtual]
 

Creates a module object for the module with the specified name on this NXT.

Invoking this method does not actually create a module on the NXT. Rather, this method creates a module object which may be used to access an I/O map on this NXT. A module is not created if the specified status is fatal. The returned module object should be destroyed using the iNXT::destroyModule method.

Parameters:
moduleName  The name of the module. The module name must conform to the 15.3 naming convention and be NULL-terminated.
moduleID  The NXT-internal ID of the module.
moduleSizeInBytes  The number of bytes the module occupies.
ioMapSizeInBytes  The number of bytes the module's I/O map occupies.
status  Status chaining object.
Returns:
A pointer to the iModule object that was created.

virtual iModuleIterator* nFANTOM100::iNXT::createModuleIterator ViConstString    moduleNamePattern,
tStatus   status
[pure virtual]
 

Creates an iterator to the modules on this NXT.

The iterator traverses those modules on this NXT that match the specified module name pattern. The iterator is not created if the specified status is fatal. The returned module iterator object should be destroyed using the iNXT::destroyModuleIterator method.

Parameters:
moduleNamePattern  The module name pattern against which to match. The module name pattern may contain wildcards. Since extensions are implicit in the case of modules, a wildcard may only be used for the module name, as in "*.mod".
status  Status chaining object.
Returns:
A pointer to an iModuleIterator object that was created.

nFANTOM100_kExport iNXT* _VI_FUNCC nFANTOM100::iNXT::createNXT ViConstString    resourceString,
tStatus   status,
ViBoolean    checkFirmwareVersion = true
[static]
 

Creates an NXT object.

Creates an NXT object representing the specified NXT. The NXT object is not created if the specified status is fatal. The returned NXT object should be destroyed using the iNXT::destroyNXT method.

Parameters:
resourceString  A string identifying which resource should be opened. A list of possible strings can be obtained using an iNXTIterator (refer to the createNXTIterator method).
status  Status chaining object.
checkFirmwareVersion  A boolean flag that specifies whether version validation should occur (defaults to true).
Returns:
A pointer to the iNXT object that was created.

nFANTOM100_kExport iNXTIterator* _VI_FUNCC nFANTOM100::iNXT::createNXTIterator ViBoolean    searchBluetooth,
ViUInt32    bluetoothSearchTimeoutInSeconds,
tStatus   status
[static]
 

Creates an NXT iterator.

The NXT iterator can be used to find all NXTs that are connected (USB) or in range (Bluetooth). The NXT iterator is not created if the specified status is fatal. The returned NXT iterator object should be destroyed using the iNXT::destroyNXTIterator method.

Parameters:
searchBluetooth  A boolean flag that specifies if the iterator should traverse NXTs via Bluetooth.
bluetoothSearchTimeoutInSeconds  The minimum number of seconds that should be spent waiting for Bluetooth devices to respond.
status  Status chaining object.
Returns:
A pointer to the iNXTIterator object that was created.

virtual void nFANTOM100::iNXT::destroyFile iFile   filePtr [pure virtual]
 

Destroys the specified file object.

Invoking this method does not actually delete a file on the NXT. Rather, this method destroys a file object which may have been used to open a file on this NXT for reading or writing, or may have been used to delete a file on the NXT.

Parameters:
filePtr  Pointer to the file object to destroy.

virtual void nFANTOM100::iNXT::destroyFileIterator iFileIterator   fileIteratorPtr [pure virtual]
 

Destroys the specified file iterator.

Parameters:
fileIteratorPtr  A pointer to the file iterator to destroy.

virtual void nFANTOM100::iNXT::destroyModule iModule   modulePtr [pure virtual]
 

Destroys the specified module object.

Invoking this method does not actually delete a module on this NXT. Rather, this method destroys a module object which may have been used to access an I/O map on this NXT.

Parameters:
modulePtr  Pointer to the module object to destroy.

virtual void nFANTOM100::iNXT::destroyModuleIterator iModuleIterator   moduleIteratorPtr [pure virtual]
 

Destroys the specified module iterator.

Parameters:
moduleIteratorPtr  A pointer to the module iterator object to destroy.

nFANTOM100_kExport void _VI_FUNCC nFANTOM100::iNXT::destroyNXT iNXT *    nxtPtr [static]
 

Destroys an NXT object.

Parameters:
nxtPtr  A pointer to the NXT object to destroy; may be NULL

virtual void nFANTOM100::iNXT::downloadFirmware const ViByte    firmwareBufferPtr[],
ViUInt32    firmwareBufferSizeInBytes,
tStatus   status
[pure virtual]
 

Downloads firmware to this NXT.

The NXT must already be in firmware-download mode.

Parameters:
firmwareBufferPtr  The buffer containing the new firmware binary image.
firmwareBufferSizeInBytes  The number of bytes in the new firmware image.
status  Status chaining object.

virtual void nFANTOM100::iNXT::eraseUserFlash tStatus   status [pure virtual]
 

Erases all files from this NXT, leaving only the firmware.

All programs, sounds, and data logs are erased. The erasure does not occur if specified status is fatal.

Parameters:
status  Status chaining object.

nFANTOM100_kExport void nFANTOM100::iNXT::findDeviceInFirmwareDownloadMode ViChar    resourceName[],
tStatus   status
[static]
 

Finds the NXT that is currently in firmware-download mode.

Note that only a single NXT may be in firmware-download mode at a time.

Parameters:
resourceName  Populated with the resource string. The resource string must have a capacity of 256 bytes.
status  Status chaining object.

virtual void nFANTOM100::iNXT::getDeviceInfo ViChar    name[],
ViByte    bluetoothAddress[],
ViUInt8    signalStrength[],
ViUInt32 &    availableFlash,
tStatus   status
[pure virtual]
 

Retrieves basic information about this NXT.

Retrieves the name of this NXT, its Bluetooth address, the Bluetooth signal strength, and the number of bytes available. Information retrieval is not done if specified status is fatal.

Parameters:
name  Populated with the name of this NXT. The name character array must be able to accomodate a NULL-terminated 15 character name. That is, it must have a capacity of 16 bytes.
bluetoothAddress  Populated with this NXT's Bluetooth address. The bluetooth address array must have a capacity of six bytes.
signalStrength  Populated with strength of the signal for this NXT's four Bluetooth conenctions. The signal strength array must have a capacity of four bytes.
availableFlash  Populated with the amount of memory in bytes that is not occupied by firmware or user files.
status  Status chaining object.

virtual void nFANTOM100::iNXT::getFirmwareVersion ViUInt8 &    protocolVersionMajorRef,
ViUInt8 &    protocolVersionMinorRef,
ViUInt8 &    firmwareVersionMajorRef,
ViUInt8 &    firmwareVersionMinorRef,
tStatus   status
[pure virtual]
 

Retrieves the firmware version of this NXT.

Returns the protocol and firmware versions installed on this NXT. The current version of this driver supports a protocol major version number of 1 and a firmware major version number of 1. If either of these major version numbers is a value other than 1, the driver will not attempt to communicate to the NXT. The returned versions are undefined if the specified status is fatal.

Parameters:
protocolVersionMajorRef  Reference to parameter that will be populated with the major protocol version.
protocolVersionMinorRef  Reference to parameter that will be populated with the minor protocol version.
firmwareVersionMajorRef  Reference to parameter that will be populated with the major firmware verison.
firmwareVersionMinorRef  Reference to parameter that will be populated with the minor firmware verison.
status  Status chaining object.

nFANTOM100_kExport ViBoolean _VI_FUNCC nFANTOM100::iNXT::isPaired ViConstString    resourceName,
tStatus   status
[static]
 

Determines if the NXT associated with the specified resource string is paired.

The determination is not done if the specified status is fatal.

Parameters:
resourceName  A resource string that specifies the NXT for which to check its pairing status.
status  Status chaining object.
Returns:
VI_TRUE if the NXT is paired with this computer (or if it is connected via USB); VI_FALSE otherwise.

nFANTOM100_kExport void _VI_FUNCC nFANTOM100::iNXT::pairBluetooth ViConstString    resourceName,
ViConstString    passkey,
ViChar    pairedResourceName[],
tStatus   status
[static]
 

Pairs with an NXT via Bluetooth.

Programmatically pairs the specified NXT to this computer and, on Windows, creates a virtual serial port to use for communication with that NXT. However, clients should not depend on the creation of this virtual serial port. The pairing is not done if the specified status is fatal.

Parameters:
resourceName  The resource string that specifies the NXT with which to pair.
passkey  A string containing the passkey the computer should exchange with the device. The passkey cannot be longer than 15 characters and must be NULL-terminated.
pairedResourceName  A Bluetooth resource string representing the paired device. On Windows, the specified resourceName is suffixed with the COM port; On Mac OS X, the RFCOMM channel identifier. The resource string must have a capacity of 256 bytes.
status  Status chaining object.

virtual ViUInt32 nFANTOM100::iNXT::read ViPBuf    bufferPtr,
ViUInt32    numberOfBytes,
tStatus   status
[pure virtual]
 

Reads, in a generic fashion, from this NXT.

Reads a response directly from this NXT. In general, this method isn't used and, instead, the sendDirectCommand and other more specific methods are invoked when communication to the NXT. The command is not sent if the specified status is fatal.

Parameters:
bufferPtr  A pointer to the buffer that will be populated with the response.
numberOfBytes  Number of bytes expected to be read from this NXT.
status  Status chaining object.
Returns:
The number of bytes actually read from this NXT.

virtual ViUInt32 nFANTOM100::iNXT::readBufferData ViPBuf    dataBuffer,
tBuffer    bufferSelector,
ViUInt32    numberOfBytesToRead,
tStatus   status
[pure virtual]
 

Reads data from the data buffer on this NXT.

Data is not read if the specified status is fatal.

Parameters:
dataBuffer  Populated with the data that is read from the specified buffer.
bufferSelector  The buffer from which to read.
numberOfBytesToRead  The number of bytes to read from the data buffer.
status  Status chaining object.
Returns:
The number of bytes actually read from the data buffer.

virtual ViUInt32 nFANTOM100::iNXT::sendDirectCommand ViBoolean    requireResponse,
const ViByte    commandBufferPtr[],
ViUInt32    commandBufferSizeInBytes,
ViPBuf    responseBufferPtr,
ViUInt32    responseBufferSizeInBytes,
tStatus   status
[pure virtual]
 

Sends the specified direct command to this NXT.

For more information on direct commands, refer to the LEGO MINDSTORMS NXT Direct commands document. The command is not sent if the specified status is fatal. The command buffer must be non-NULL and the command buffer size in bytes must be non-zero. If require response is set to true, the response buffer must be non-NULL and the response buffer size in bytes must be non-zero. If require response is set to false, the response buffer must be NULL and the response buffer size in bytes must be zero. Both of the buffer size parameters must be small enough to fit in one packet for whichever bus the NXT is connected over (USB or Bluetooth). This means the maximum length for a direct command over USB is 63 bytes; over Bluetooth, 65,533 bytes. If any of these requirements are violated, VI_ERROR_USER_BUF will be returned.

Parameters:
requireResponse  Boolean flag indicating if a response is required.
commandBufferPtr  Buffer containing the direct command to send to the NXT.
commandBufferSizeInBytes  Number of bytes in the command buffer.
responseBufferPtr  Buffer that will be populated with the response to the direct command.
responseBufferSizeInBytes  Capacity of the response buffer in bytes.
status  Status chaining object.
Returns:
Number of bytes written to the response buffer.

virtual void nFANTOM100::iNXT::setName ViConstString    newName,
tStatus   status
[pure virtual]
 

Sets the name of this NXT.

The specified name will be displayed on the NXT, show up during Bluetooth scans, and returned when the getDeviceInfo method is called.

Parameters:
newName  The name for the NXT. The name can be at most 15 characters. However, the NXT can only display 8 characters. The string must be NULL terminated.
status  Status chaining object.

nFANTOM100_kExport void _VI_FUNCC nFANTOM100::iNXT::unpairBluetooth ViConstString    resourceName,
tStatus   status
[static]
 

Unpairs with an NXT via Bluetooth.

Programmatically destroys the Bluetooth pairing that was previously established between this computer and the specified NXT. On Mac OS X, this method has no effect and doesn't generate a fatal status. The unpairing is not done if the specified status is fatal.

Parameters:
resourceName  The resource string that specifies the NXT with which to unpair.
status  Status chaining object.

virtual ViUInt32 nFANTOM100::iNXT::write const ViByte    bufferPtr[],
ViUInt32    numberOfBytes,
tStatus   status
[pure virtual]
 

Writes, in a generic fashion, to this NXT.

Writes a command directly to this NXT. In general, this method isn't used and, instead, the sendDirectCommand and other more specific methods are invoked when communication to the NXT. The write doesn not occur if the specified status is fatal.

Parameters:
bufferPtr  A pointer to the buffer that contains the command that will be written.
numberOfBytes  Size of the buffer.
status  Status chaining object.
Returns:
The number of bytes actually written to the NXT.


The documentation for this class was generated from the following file:

© Copyright 2005-2006, National Instruments Corporation. All rights reserved.