LEGO MINDSTORMS NXT Driver

1.0.2f0

The main.cpp file contains a simple example.

The below commands are the most basic way to build this example. Using an Integrated Development Environment such as Visual Studio or Xcode may be easier.

To build this example on Windows:

cl.exe /I <path to SDK include directory> <path to fantom.lib in SDK> main.cpp

To build this example on Mac OS X 10.4:

gcc-3.3 -I <path to SDK include directory> -framework Fantom -dylib_file Library/Frameworks/VISA.framework/Versions/A/VISA:/Library/Frameworks/VISA.framework/Versions /A/VISA -lstdc++ main.cpp

Note that you will need to have the VISA and NiSpyLog frameworks installed in order to link the example. A development version of NI-VISA, which includes the VISA and NiSpyLog frameworks may be downloaded from National Instruments.

The following design class diagrams may help understand the Fantom API.

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


FANTOM: LEGO MINDSTORMS NXT Driver File List

Here is a list of all documented files with brief descriptions:
iFile.h [code] | Interface for a file on a LEGO MINDSTORMS NXT
iFileIterator.h [code] | Interface for an iterator for files on a LEGO MINDSTORMS NXT
iModule.h [code] | Interface for a firmware module on a LEGO MINDSTORMS NXT
iModuleIterator.h [code] | Interface for an iterator for firmware modules on a LEGO MINDSTORMS NXT
iNXT.h [code] | Interface for a LEGO MINDSTORMS NXT and declaration of its factory
iNXTIterator.h [code] | Interface used for searching for LEGO MINDSTORMS NXTs
main.cpp | Fantom Driver Example
tStatus.h [code] | Status code class


iFile.h File Reference

Interface for a file on a LEGO MINDSTORMS NXT. More...

#include "platform.h"
#include "tStatus.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Compounds

class | nFANTOM100::iFile
Interface to a file on a LEGO MINDSTORMS NXT. More...

Typedefs

typedef ViObject | nFANTOM100_iFile

Functions

nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_getName (nFANTOM100_iFile filePtr, ViChar fileName[], ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iFile_getSize (nFANTOM100_iFile filePtr, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iFile_getAvailableSize (nFANTOM100_iFile filePtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_openForRead (nFANTOM100_iFile filePtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_openForWrite (nFANTOM100_iFile filePtr, ViUInt32 sizeInBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_openForLinearWrite (nFANTOM100_iFile filePtr, ViUInt32 sizeInBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_openForDataWrite (nFANTOM100_iFile filePtr, ViUInt32 sizeInBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_openForDataAppend (nFANTOM100_iFile filePtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_close (nFANTOM100_iFile filePtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_read (nFANTOM100_iFile filePtr, ViPBuf bufferPtr, ViUInt32 numberOfBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_write (nFANTOM100_iFile filePtr, const ViByte bufferPtr[], ViUInt32 numberOfBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFile_remove (nFANTOM100_iFile filePtr, ViStatus *status)

Detailed Description

Interface for a file on a LEGO MINDSTORMS NXT.


iFileIterator.h File Reference

Interface for an iterator for files on a LEGO MINDSTORMS NXT. More...

#include "platform.h"
#include "iFile.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Compounds

class | nFANTOM100::iFileIterator
Interface to an iterator for files on a LEGO MINDSTORMS NXT. More...

Typedefs

typedef ViObject | nFANTOM100_iFileIterator

Functions

nFANTOM100_kExport nFANTOM100_iFile
_VI_FUNCC 		nFANTOM100_iFileIterator_getFile (nFANTOM100_iFileIterator iteratorPtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFileIterator_advance (nFANTOM100_iFileIterator iteratorPtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iFileIterator_getName (nFANTOM100_iFileIterator iteratorPtr, ViChar filename[], ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iFileIterator_getSize (nFANTOM100_iFileIterator iteratorPtr, ViStatus *status)

Detailed Description

Interface for an iterator for files on a LEGO MINDSTORMS NXT.


iModule.h File Reference

Interface for a firmware module on a LEGO MINDSTORMS NXT. More...

#include "platform.h"
#include "tStatus.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Compounds

class | nFANTOM100::iModule
Interface to a firmware module on a LEGO MINDSTORMS NXT. More...

Typedefs

typedef ViObject | nFANTOM100_iModule

Functions

nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iModule_getName (nFANTOM100_iModule modulePtr, ViChar moduleName[], ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iModule_getModuleID (nFANTOM100_iModule modulePtr, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iModule_getModuleSize (nFANTOM100_iModule modulePtr, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iModule_getIOMapSize (nFANTOM100_iModule modulePtr, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iModule_readIOMap (nFANTOM100_iModule modulePtr, ViUInt32 offset, ViUInt32 numberBytesToRead, ViPBuf dataBuffer, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iModule_writeIOMap (nFANTOM100_iModule modulePtr, ViUInt32 offset, ViUInt32 numberBytesToWrite, const ViByte dataBuffer[], ViStatus *status)

Detailed Description

Interface for a firmware module on a LEGO MINDSTORMS NXT.


iModuleIterator.h File Reference

Interface for an iterator for firmware modules on a LEGO MINDSTORMS NXT. More...

#include "platform.h"
#include "iModule.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Compounds

class | nFANTOM100::iModuleIterator
Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT. More...

Typedefs

typedef ViObject | nFANTOM100_iModuleIterator

Functions

nFANTOM100_kExport nFANTOM100_iModule
_VI_FUNCC 		nFANTOM100_iModuleIterator_getModule (nFANTOM100_iModuleIterator iteratorPtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iModuleIterator_advance (nFANTOM100_iModuleIterator iteratorPtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iModuleIterator_getName (nFANTOM100_iModuleIterator iteratorPtr, ViChar moduleName[], ViStatus *status)

Detailed Description

Interface for an iterator for firmware modules on a LEGO MINDSTORMS NXT.


iNXT.h File Reference

Interface for a LEGO MINDSTORMS NXT and declaration of its factory. More...

#include "platform.h"
#include "iFile.h"
#include "iFileIterator.h"
#include "iModule.h"
#include "iModuleIterator.h"
#include "iNXTIterator.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Compounds

class | nFANTOM100::iNXT
Interface to a LEGO MINDSTORMS NXT. More...

Typedefs

typedef ViObject | nFANTOM100_iNXT

Functions

nFANTOM100_kExport nFANTOM100_iNXTIterator
_VI_FUNCC 		nFANTOM100_createNXTIterator (ViBoolean searchBluetooth, ViUInt32 bluetoothSearchTimeoutInSeconds, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_destroyNXTIterator (nFANTOM100_iNXTIterator iterPtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_pairBluetooth (ViConstString resourceName, ViConstString passkey, ViChar pairedResourceName[], ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_unpairBluetooth (ViConstString resourceName, ViStatus *status)
nFANTOM100_kExport ViBoolean
_VI_FUNCC 		nFANTOM100_isPaired (ViConstString resourceName, ViStatus *status)
nFANTOM100_kExport nFANTOM100_iNXT
_VI_FUNCC 		nFANTOM100_createNXT (ViConstString resourceString, ViStatus *status, ViBoolean checkFirmwareVersion)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_destroyNXT (nFANTOM100_iNXT nxtPtr, ViStatus *status)
nFANTOM100_kExport nFANTOM100_iFile
_VI_FUNCC 		nFANTOM100_iNXT_createFile (nFANTOM100_iNXT nxtPtr, ViConstString fileName, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_destroyFile (nFANTOM100_iNXT nxtPtr, nFANTOM100_iFile filePtr, ViStatus *status)
nFANTOM100_kExport nFANTOM100_iFileIterator
_VI_FUNCC 		nFANTOM100_iNXT_createFileIterator (nFANTOM100_iNXT nxtPtr, ViConstString fileNamePattern, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_destroyFileIterator (nFANTOM100_iNXT nxtPtr, nFANTOM100_iFileIterator fileIteratorPtr, ViStatus *status)
nFANTOM100_kExport nFANTOM100_iModule
_VI_FUNCC 		nFANTOM100_iNXT_createModule (nFANTOM100_iNXT nxtPtr, ViConstString moduleName, ViUInt32 moduleID, ViUInt32 moduleSize, ViUInt32 ioMapSizeInBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_destroyModule (nFANTOM100_iNXT nxtPtr, nFANTOM100_iModule modulePtr, ViStatus *status)
nFANTOM100_kExport nFANTOM100_iModuleIterator
_VI_FUNCC 		nFANTOM100_iNXT_createModuleIterator (nFANTOM100_iNXT nxtPtr, ViConstString moduleNamePattern, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_destroyModuleIterator (nFANTOM100_iNXT nxtPtr, nFANTOM100_iModuleIterator moduleIteratorPtr, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_getFirmwareVersion (nFANTOM100_iNXT nxtPtr, ViUInt8 *protocolVersionMajorPtr, ViUInt8 *protocolVersionMinorPtr, ViUInt8 *firmwareVersionMajorPtr, ViUInt8 *firmwareVersionMinorPtr, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iNXT_sendDirectCommand (nFANTOM100_iNXT nxtPtr, ViBoolean requireResponse, const ViByte commandBufferPtr[], ViUInt32 commandBufferSizeInBytes, ViPBuf responseBufferPtr, ViUInt32 responseBufferSizeInBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_findDeviceInFirmwareDownloadMode (ViChar resourceString[], ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_downloadFirmware (nFANTOM100_iNXT nxtPtr, const ViByte firmwareBufferPtr[], ViUInt32 firmwareBufferSize, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iNXT_write (nFANTOM100_iNXT nxtPtr, const ViByte bufferPtr[], ViUInt32 numberOfBytes, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iNXT_read (nFANTOM100_iNXT nxtPtr, ViPBuf bufferPtr, ViUInt32 numberOfBytes, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_bootIntoFirmwareDownloadMode (ViConstString resouceName, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_setName (nFANTOM100_iNXT nxtPtr, ViConstString newName, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_getDeviceInfo (nFANTOM100_iNXT nxtPtr, ViChar name[], ViByte bluetoothAddress[], ViUInt8 signalStrength[], ViUInt32 *availableFlash, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_eraseUserFlash (nFANTOM100_iNXT nxtPtr, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iNXT_pollAvailableLength (nFANTOM100_iNXT nxtPtr, ViUInt32 bufferIndex, ViStatus *status)
nFANTOM100_kExport ViUInt32
_VI_FUNCC 		nFANTOM100_iNXT_readBufferData (nFANTOM100_iNXT nxtPtr, ViPBuf dataBuffer, ViUInt32 bufferIndex, ViUInt32 numberOfBytesToRead, ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_getResourceString (nFANTOM100_iNXT nxtPtr, ViChar resourceString[], ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXT_bluetoothFactoryReset (nFANTOM100_iNXT nxtPtr, ViStatus *status)

Detailed Description

Interface for a LEGO MINDSTORMS NXT and declaration of its factory.


iNXTIterator.h File Reference

Interface used for searching for LEGO MINDSTORMS NXTs. More...

#include "platform.h"
#include "tStatus.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Compounds

class | nFANTOM100::iNXTIterator
Interface to an iterator for LEGO MINDSTORMS NXTs. More...

Typedefs

typedef ViObject | nFANTOM100_iNXTIterator
typedef ViObject | nFANTOM100_iNXT

Functions

nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXTIterator_getName (nFANTOM100_iNXTIterator iteratorPtr, ViChar resourceName[], ViStatus *status)
nFANTOM100_kExport void _VI_FUNCC | nFANTOM100_iNXTIterator_advance (nFANTOM100_iNXTIterator iteratorPtr, ViStatus *status)
nFANTOM100_kExport nFANTOM100_iNXT
_VI_FUNCC 		nFANTOM100_iNXTIterator_getNXT (nFANTOM100_iNXTIterator iteratorPtr, ViStatus *status)

Detailed Description

Interface used for searching for LEGO MINDSTORMS NXTs.


main.cpp File Reference

Fantom Driver Example. More...

#include "fantom/iNXT.h"
#include "fantom/iNXTIterator.h"
#include "fantom/tStatus.h"
#include <string.h>

Functions

int _VI_FUNCC main (int argc, char **argv)

Detailed Description

Fantom Driver Example.

/*
   © Copyright 2006,
   National Instruments Corporation.
   All rights reserved.

   Originated:  10 March 2006
*/

// includes...

#include "fantom/iNXT.h"
#include "fantom/iNXTIterator.h"
#include "fantom/tStatus.h"

#include <string.h>

// globally-scoped globals...

// private globals...

// methods...

int _VI_FUNCC main( int argc, char** argv )
{
   nFANTOM100::tStatus status;
   nFANTOM100::iNXTIterator* nxtIteratorPtr = NULL;
   nFANTOM100::iNXT* nxtPtr = NULL;
   nFANTOM100::iFile* filePtr = NULL;
   nFANTOM100::iFileIterator* fileIteratorPtr = NULL;

   // Create an NXT iterator object which is used to find all accessible NXT devices.
   nxtIteratorPtr = nFANTOM100::iNXT::createNXTIterator(
         false /* don't search for NXTs over Bluetooth (only search USB) */,
         0 /* timeout for Bluetooth discovery ignored */, status );

   // Creating the NXT iterator object could fail, better check status before dereferencing a
   //    potentially NULL pointer.
   if( status.isNotFatal())
   {
      // Create an NXT object for the first NXT that was found.  Note that if a NXT is found
      //    over BT, the computer and the NXT must be paired before an NXT object can be
      //    created.  This can be done programatically using the iNXT::pairBluetooth method.
      nxtPtr = nxtIteratorPtr->getNXT( status );

      // Destroy the NXT iterator object which we no longer need
      nFANTOM100::iNXT::destroyNXTIterator( nxtIteratorPtr );
   }

   // Creating the NXT object could fail, better check status before dereferencing a potentially
   //    NULL pointer.
   if( status.isNotFatal())
   {
      ViUInt8 protocolVersionMajor = 0;
      ViUInt8 protocolVersionMinor = 0;
      ViUInt8 firmwareVersionMajor = 0;
      ViUInt8 firmwareVersionMinor = 0;

      // Query the version numbers for the protocol and firmware installed on the NXT.
      nxtPtr->getFirmwareVersion( protocolVersionMajor, protocolVersionMinor,
            firmwareVersionMajor, firmwareVersionMinor, status );

      // This is a direct command to play a tone.
      ViUInt8 directCommandBuffer[] = { 0x03, 0x00, 0x18, 0x10, 0x00 };

      // Send the direct command to the NXT.
      nxtPtr->sendDirectCommand( false /* a response is not required for this direct command */,
            reinterpret_cast< ViByte* >( directCommandBuffer ), sizeof( directCommandBuffer ),
            NULL /* no response buffer */, 0 /* no response buffer, specify 0 for size */, status );

      // Create a file object
      filePtr = nxtPtr->createFile( "example.log", status );
   }

   // Creating the file object could fail, better check status before dereferencing a
   //    potentially NULL pointer.
   if( status.isNotFatal())
   {
      ViUInt8 fileBuffer[100] = {};
      ViUInt32 fileSizeInBytes = 100;
      for( ViUInt8 index = 0; index < fileSizeInBytes; ++index )
      {
         fileBuffer[index] = index;
      }

      // Open the file for writing, this will also create this file on the NXT.
      filePtr->openForWrite( fileSizeInBytes, status );

      // Write the file contents.
      filePtr->write( fileBuffer, fileSizeInBytes, status );

      // Close the file.
      filePtr->close( status );

      // Destroy the file object.  Note that this does not affect the file on the NXT.
      nxtPtr->destroyFile( filePtr );

      // Create a file iterator object which is used to find files on the NXT.
      fileIteratorPtr = nxtPtr->createFileIterator( "*.*" /* find all files on the NXT */,
            status );
   }

   // Creating the file iterator object could fail, better check status before dereferencing a
   //    potentially NULL pointer.
   if( status.isNotFatal())
   {
      ViChar fileName[20];

      // Iterate through all of the files on the NXT until we find our log file.  Obviously,
      //    this isn't necessary in this simple example but is for illustrative purposes.
      while( status.isNotFatal())
      {
         fileIteratorPtr->getName( fileName, status );
         if( 0 == ::strcmp( fileName, "example.log" ))
         {
            break;
         }

         fileIteratorPtr->advance( status );
      }

      // Now that we have found our log file, create a file object that corresponds to it.
      filePtr = fileIteratorPtr->getFile( status );

      // Destroy the file iterator.
      nxtPtr->destroyFileIterator( fileIteratorPtr );
   }

   // Creating the file object could fail, better check status before dereferencing a
   //    potentially NULL pointer.
   if( status.isNotFatal())
   {
      ViUInt8 fileBuffer[100] = {};
      ViUInt32 fileSizeInBytes = 100;

      // Open the file for reading.
      filePtr->openForRead( status );

      // Read the file contents.
      filePtr->read( fileBuffer, fileSizeInBytes, status );

      // Close the file.
      filePtr->close( status );

      // Remove the file.  This deletes the file from the NXT.
      filePtr->remove( status );

      // Destroy the file object.
      nxtPtr->destroyFile( filePtr );
   }

   // Destroy the NXT object.
   nFANTOM100::iNXT::destroyNXT( nxtPtr );

   return 0;
}


tStatus.h File Reference

Status code class. More...

#include <string.h>
#include "platform.h"

Go to the source code of this file.

Namespaces

namespace | nFANTOM100

Defines

#define | nFANTOM_mLocation __FILE__, __LINE__
#define | nFANTOM_ForceToWarning(s) (((s) >= 0 ) ? (s) : -(s))
#define | nFANTOM_ForceToFatal(s) (((s) <= 0 ) ? (s) : -(s))

Detailed Description

Status code class.


FANTOM: LEGO MINDSTORMS NXT Driver Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
nFANTOM100::iFile | Interface to a file on a LEGO MINDSTORMS NXT
nFANTOM100::iFileIterator | Interface to an iterator for files on a LEGO MINDSTORMS NXT
nFANTOM100::iModule | Interface to a firmware module on a LEGO MINDSTORMS NXT
nFANTOM100::iModuleIterator | Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT
nFANTOM100::iNXT | Interface to a LEGO MINDSTORMS NXT
nFANTOM100::iNXTIterator | Interface to an iterator for LEGO MINDSTORMS NXTs
nFANTOM100::tStatus | Class that contains a status code and the file name and line number where that status code was generated


nFANTOM100::iFile Class Reference

Interface to a file on a LEGO MINDSTORMS NXT. More...

#include <iFile.h>

List of all members.

Public Methods

virtual void | getName (ViChar fileName[]) const=0
Retrieves the name of this file. More...

virtual ViUInt32 | getSize (tStatus &status)=0
Retrieves the total size of this file in bytes. More...

virtual ViUInt32 | getAvailableSize (tStatus &status)=0
Retrieves the remaining available size, in bytes, in this file. More...

virtual void | openForRead (tStatus &status)=0
Opens this file for reading. More...

virtual void | openForWrite (ViUInt32 sizeInBytes, tStatus &status)=0
Open this file for writing. More...

virtual void | openForLinearWrite (ViUInt32 sizeInBytes, tStatus &status)=0
Open this file for linear (contiguous) writing. More...

virtual void | openForDataWrite (ViUInt32 sizeInBytes, tStatus &status)=0
Open this data file for writing. More...

virtual void | openForDataAppend (tStatus &status)=0
Open this data file for appending additional data. More...

virtual void | close (tStatus &status)=0
Closes this file. More...

virtual ViUInt32 | read (ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus &status)=0
Reads from this file. More...

virtual ViUInt32 | write (const ViByte bufferPtr[], ViUInt32 numberOfBytes, tStatus &status)=0
Writes to this file. More...

virtual void | remove (tStatus &status)=0
Removes this file. More...

Protected Methods

virtual | ~iFile ()=0
Destructor.

Friends

class | tNXT

Detailed Description

Interface to a file on a LEGO MINDSTORMS NXT.

Member Function Documentation

virtual void nFANTOM100::iFile::close ( tStatus & status ) [pure virtual]

Closes this file.

Closes the file that corresponds to this object on the associated NXT. The file is not closed if the specified status is fatal.

Parameters:
status Status chaining object.

virtual ViUInt32 nFANTOM100::iFile::getAvailableSize ( tStatus & status ) [pure virtual]

Retrieves the remaining available size, in bytes, in this file.

This number is only helpful for data logging files, which can contain variable amounts of data. The returned size is undefined if the specified status is fatal.

Parameters:
status Status chaining object.
Returns:
The remaining available size, in bytes, in this file.

virtual void nFANTOM100::iFile::getName ( ViChar fileName[] ) const [pure virtual]

Retrieves the name of this file.

Parameters:
fileName Populated with the name of this file. The file name character array must be able to accomodate a NULL-terminated, 15.3 formatted module name. That is, it must have a capacity of 20 bytes.

virtual ViUInt32 nFANTOM100::iFile::getSize ( tStatus & status ) [pure virtual]

Retrieves the total size of this file in bytes.

The returned size is undefined if the specified status is fatal.

Parameters:
status Status chaining object.
Returns:
The total size of this file in bytes.

virtual void nFANTOM100::iFile::openForDataAppend ( tStatus & status ) [pure virtual]

Open this data file for appending additional data.

Opens, for appending additional data, the data file that corresponds to this object on the associated NXT. If this file doesn't exist on the NXT, the behavior is undefined. If this file does exist on the NXT, the data that is written is appended to the end of the exiting data. The file is not opened if the specified status is fatal.

Parameters:
status Status chaining object.

virtual void nFANTOM100::iFile::openForDataWrite | ( | ViUInt32 | sizeInBytes,
 |  | tStatus & | status
 | ) | [pure virtual]

Open this data file for writing.

Opens, for writing, the data file that corresponds to this object on the associated NXT. This data file differs from normal files in that a data file can be closed before the entire file has been written. If this file doesn't exist on the NXT, it is created. If this file does exist on the NXT, an error is generated. The file is not opened if the specified status is fatal.

Parameters:
sizeInBytes | Size of the data, in bytes, that may be written to the file.
status | Status chaining object.

virtual void nFANTOM100::iFile::openForLinearWrite | ( | ViUInt32 | sizeInBytes,
 |  | tStatus & | status
 | ) | [pure virtual]

Open this file for linear (contiguous) writing.

Opens, for linear (contiguous) writing, the file that corresponds to this object on the associated NXT. If this file doesn't exist on the NXT, it is created. If this file does exist on the NXT, an error is generated. The file is not opened if the specified status is fatal.

Parameters:
sizeInBytes | Size of the data, in bytes, that will be written to the file.
status | Status chaining object.

virtual void nFANTOM100::iFile::openForRead ( tStatus & status ) [pure virtual]

Opens this file for reading.

Opens, for reading, the file that corresponds to this object on the associated NXT. The file is not opened if the specified status is fatal.

Parameters:
status Status chaining object.

virtual void nFANTOM100::iFile::openForWrite | ( | ViUInt32 | sizeInBytes,
 |  | tStatus & | status
 | ) | [pure virtual]

Open this file for writing.

Opens, for writing, the file that corresponds to this object on the associated NXT. If this file doesn't exist on the NXT, it is created. If this file does exist on the NXT, an error is generated. The file is not opened if the specified status is fatal.

Parameters:
sizeInBytes | Size of the data, in bytes, that will be written to this file.
status | Status chaining object.

virtual ViUInt32 nFANTOM100::iFile::read | ( | ViPBuf | bufferPtr,
 |  | ViUInt32 | numberOfBytes,
 |  | tStatus & | status
 | ) | [pure virtual]

Reads from this file.

Reads the specified number of bytes from this file into the specified buffer. No data is read if the specified status is fatal. The ownership of the buffer is not transferred to this file object.

Parameters:
bufferPtr | A pointer to the buffer that will be populated with the data that is read. The capacity of the specified buffer must be at least the specified number of bytes.
numberOfBytes | Number of bytes to read.
status | Status chaining object.
Returns:
The number of bytes actually read from this file.
Precondition:
This file must have been opened for reading with the iFile::openForRead method.
Postcondition:
The specified buffer may be deallocated.

virtual void nFANTOM100::iFile::remove ( tStatus & status ) [pure virtual]

Removes this file.

Removes the file that corresponds to this object on the associated NXT. The file is not removed if the specified status is fatal.

Parameters:
status Status chaining object.

virtual ViUInt32 nFANTOM100::iFile::write | ( | const ViByte | bufferPtr[],
 |  | ViUInt32 | numberOfBytes,
 |  | tStatus & | status
 | ) | [pure virtual]

Writes to this file.

Writes the specified number of bytes from the specified buffer to this file. No data is written if the specified status is fatal. The ownership of the buffer is not transferred to this file object.

Parameters:
bufferPtr | A pointer to the buffer that contains the data that will be written. The capacity of the specified buffer must be at least the specified number of bytes.
numberOfBytes | Number of bytes to write to this file.
status | Status chaining object.
Returns:
The number of bytes actually written to this file.
Precondition:
This file must have previously been opened for writing.
Postcondition:
The specified buffer may be deallocated.

The documentation for this class was generated from the following file:
  • iFile.h


nFANTOM100::iFileIterator Class Reference

Interface to an iterator for files on a LEGO MINDSTORMS NXT. More...

#include <iFileIterator.h>

List of all members.

Public Methods

virtual iFile * | getFile (tStatus &status)=0
Creates a file object for the file referenced by this iterator. More...

virtual void | advance (tStatus &status)=0
Advances this iterator. More...

virtual void | getName (ViChar fileName[], tStatus &status)=0
Retrieves the name of the file to which this iterator refers. More...

virtual ViUInt32 | getSize (tStatus &status)=0
Retrieves the total size, in bytes, of the file to which this iterator refers. More...

Protected Methods

virtual | ~iFileIterator ()=0
Destructor.

Friends

class | tNXT

Detailed Description

Interface to an iterator for files on a LEGO MINDSTORMS NXT.

Member Function Documentation

virtual void nFANTOM100::iFileIterator::advance ( tStatus & status ) [pure virtual]

Advances this iterator.

Advances this iterator to the next file that matches the previously specified file name pattern. If no more files match, this iterator is advanced to the end of the list. The iterator is not advanced if the specified status is fatal. If this iterator is already at the end of the list, a fatal status will be generated.

Parameters:
status Status chaining object.

virtual iFile* nFANTOM100::iFileIterator::getFile ( tStatus & status ) [pure virtual]

Creates a file object for the file referenced by this iterator.

Creates file object for the file referenced by this iterator. An object is not created if the specified status is fatal or if this iterator refers to the end of the list. The returned file object should be destroyed using the iNXT::destroyFile method.

Parameters:
status Status chaining object.
Returns:
A pointer to the iFile object that was created.

virtual void nFANTOM100::iFileIterator::getName | ( | ViChar | fileName[],
 |  | tStatus & | status
 | ) | [pure virtual]

Retrieves the name of the file to which this iterator refers.

Parameters:
fileName | Populated with the name of the file to which this iterator refers. The file name character array must be able to accomodate a NULL-terminated, 15.3 formatted file name. This is, it must have a capacity of 20 bytes.
status | Status chaining object.

virtual ViUInt32 nFANTOM100::iFileIterator::getSize ( tStatus & status ) [pure virtual]

Retrieves the total size, in bytes, of the file to which this iterator refers.

Parameters:
status Status chaining object.
Returns:
The total size of the file in bytes.

The documentation for this class was generated from the following file:
  • iFileIterator.h


nFANTOM100::iModule Class Reference

Interface to a firmware module on a LEGO MINDSTORMS NXT. More...

#include <iModule.h>

List of all members.

Public Methods

virtual void | getName (ViChar moduleName[]) const=0
Retrieves the name of this module. More...

virtual ViUInt32 | getModuleID (void) const=0
Retrieves the internal module ID of this module. More...

virtual ViUInt32 | getModuleSize (void) const=0
Retrieves the size in bytes of this module. More...

virtual ViUInt32 | getModuleIOMapSize (void) const=0
Retrieves the size in bytes of the I/O map associated with this module. More...

virtual ViUInt32 | readIOMap (ViUInt32 offsetInBytes, ViUInt32 numberOfBytes, ViPBuf dataBufferPtr, tStatus &status)=0
Reads a portion of this module's I/O map. More...

virtual ViUInt32 | writeIOMap (ViUInt32 offsetInBytes, ViUInt32 numberOfBytes, const ViByte dataBufferPtr[], tStatus &status)=0
Writes a portion of this module's I/O map. More...

Protected Methods

virtual | ~iModule ()=0
Destructor.

Friends

class | tNXT

Detailed Description

Interface to a firmware module on a LEGO MINDSTORMS NXT.

Member Function Documentation

virtual ViUInt32 nFANTOM100::iModule::getModuleID ( void ) const [pure virtual]

Retrieves the internal module ID of this module.

Returns:
The internal module ID of this module.

virtual ViUInt32 nFANTOM100::iModule::getModuleIOMapSize ( void ) const [pure virtual]

Retrieves the size in bytes of the I/O map associated with this module.

Returns:
The size in bytes of the I/O map associated with this module.

virtual ViUInt32 nFANTOM100::iModule::getModuleSize ( void ) const [pure virtual]

Retrieves the size in bytes of this module.

Returns:
The size in bytes of this module.

virtual void nFANTOM100::iModule::getName ( ViChar moduleName[] ) const [pure virtual]

Retrieves the name of this module.

Parameters:
moduleName Populated with the name of this module. The module name character array must be able to accomodate a NULL-terminated, 15.3 formatted module name. That is, it must have a capacity of 20 bytes.

virtual ViUInt32 nFANTOM100::iModule::readIOMap | ( | ViUInt32 | offsetInBytes,
 |  | ViUInt32 | numberOfBytes,
 |  | ViPBuf | dataBufferPtr,
 |  | tStatus & | status
 | ) | [pure virtual]

Reads a portion of this module's I/O map.

Reads the data located at [I/O map address] + [specified offset in bytes] into the specified data buffer. The read will attempt to copy the specified number of bytes. No read occurs if the specified status is fatal. The ownership of data buffer is not transferred to this module object.

Parameters:
offsetInBytes | The index of the byte in the I/O map at which to start the read.
numberOfBytes | The number of bytes that should be read from the I/O map.
dataBufferPtr | A pointer to the data buffer that will be populated with the data that is read. The capacity of the specified data buffer must be at least the specified number of bytes.
status | Status chaining object.
Returns:
The number of bytes actually read from the I/O map.
Postcondition:
The specified data buffer may be deallocated.

virtual ViUInt32 nFANTOM100::iModule::writeIOMap | ( | ViUInt32 | offsetInBytes,
 |  | ViUInt32 | numberOfBytes,
 |  | const ViByte | dataBufferPtr[],
 |  | tStatus & | status
 | ) | [pure virtual]

Writes a portion of this module's I/O map.

Writes the specified data into this module's I/O map. The write starts at [I/O map address] + [specified offset in bytes] and stops after the specified number of bytes have been written. No write occurs if the specified status is fatal. The ownership of data buffer is not transferred to this module object.

Parameters:
offsetInBytes | The index of the byte in the I/O map at which to start the write.
numberOfBytes | The number of bytes to write into the I/O map.
dataBufferPtr | A pointer to the data buffer that contains the data that will be written. The capacity of the specified data buffer must be at least the specified number of bytes.
status | Status chaining object.
Returns:
The number of bytes actually written into the I/O map.
Postcondition:
The specified data buffer may be deallocated.

The documentation for this class was generated from the following file:
  • iModule.h


nFANTOM100::iModuleIterator Class Reference

Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT. More...

#include <iModuleIterator.h>

List of all members.

Public Methods

virtual iModule * | getModule (tStatus &status)=0
Creates a module object for the module referenced by this iterator. More...

virtual void | advance (tStatus &status)=0
Advances this iterator. More...

virtual void | getName (ViChar moduleName[], tStatus &status)=0
Retrieves the name of the module to which this iterator refers. More...

Protected Methods

virtual | ~iModuleIterator ()=0
Destructor.

Friends

class | tNXT

Detailed Description

Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT.

Member Function Documentation

virtual void nFANTOM100::iModuleIterator::advance ( tStatus & status ) [pure virtual]

Advances this iterator.

Advances this iterator to the next module that matches the previously specified module name pattern. If no more modules match, this iterator is advanced to the end of the list. The iterator is not advanced if the specified status is fatal. If this iterator is already at the end of the list, a fatal status will be generated.

Parameters:
status Status chaining object.

virtual iModule* nFANTOM100::iModuleIterator::getModule ( tStatus & status ) [pure virtual]

Creates a module object for the module referenced by this iterator.

Creates a module object for the module referenced by this iterator. An object is not created if the specified status is fatal or if this iterator refers to the end of the list. The returned module object should be destroyed using the iNXT::destroyModule method.

Parameters:
status Status chaining object.
Returns:
A pointer to the iModule object that was created.

virtual void nFANTOM100::iModuleIterator::getName | ( | ViChar | moduleName[],
 |  | tStatus & | status
 | ) | [pure virtual]

Retrieves the name of the module to which this iterator refers.

Parameters:
moduleName | Populated with the name of the module to which this iterator refers. The module name character array must be able to accomodate a NULL-terminated, 15.3 formatted module name. This is, it must have a capacity of 20 bytes.
status | Status chaining object.

The documentation for this class was generated from the following file:
  • iModuleIterator.h


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 iFile * | createFile (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 iFileIterator * | createFileIterator (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 iModule * | createModule (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 iModuleIterator * | createModuleIterator (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:
  • iNXT.h


nFANTOM100::iNXTIterator Class Reference

Interface to an iterator for LEGO MINDSTORMS NXTs. More...

#include <iNXTIterator.h>

List of all members.

Public Methods

virtual void | getName (ViChar resourceName[], tStatus &status) const=0
Retrieves the name of the NXT to which this iterator refers.

virtual void | advance (tStatus &status)=0
Advances this iterator. More...

virtual iNXT * | getNXT (tStatus &status)=0
Creates an NXT object for the NXT referenced by this iterator.

Protected Methods

virtual | ~iNXTIterator ()=0
Destructor.

Friends

class | iNXT

Detailed Description

Interface to an iterator for LEGO MINDSTORMS NXTs.

Member Function Documentation

virtual void nFANTOM100::iNXTIterator::advance ( tStatus & status ) [pure virtual]

Advances this iterator.

Advances this iterator to the next NXT that was found. If no more NXTs are found, this iterator is advanced to the end of the list. The iterator is not advanced if the specified status is fatal. If this iterator is already at the end of the list, a fatal status will be generated.

Parameters:
status Status chaining object.

The documentation for this class was generated from the following file:
  • iNXTIterator.h


nFANTOM100::tStatus Class Reference

Class that contains a status code and the file name and line number where that status code was generated. More...

#include <tStatus.h>

List of all members.

Public Methods

tStatus (void)
constructor. More...

tStatus (const tStatus &status)
copy constructor. More...

tStatus (ViStatus code, const char *fileName, ViUInt32 lineNumber)
constructor with code, filename, and line number. More...

~tStatus ()
destructor.

ViStatus | getCode (void) const
Returns the status code for this status object. More...

const char * | getFileName (void) const
Returns the file name in which the status code, for this status object, was generated. More...

ViUInt32 | getLineNumber (void) const
Returns the line number at which the status code, for this status object, was. More...

void | setCode (ViStatus code, const char *fileName, ViUInt32 lineNumber)
Sets the status code, file name, and line number for this status object, if. More...

void | assign (const tStatus &status)
Assigns the specified status object to this status object, if appropriate. More...

void | clear (void)
Clears the status code for this status object. More...

bool | isFatal (void) const
Returns true if this status object contains a status code that is fatal. More...

bool | isNotFatal (void) const
Returns true if this status object contains a status code that is not fatal. More...

bool | isWarning (void) const
Returns true if this status object contains a status code that is a warning. More...

bool | isSuccess (void) const
Returns true if this status object contains the status code for success. More...

Private Types

enum | { kMaxFileNameLength = 101 }

Private Methods

tStatus & | operator= (const tStatus &rhs)

Private Attributes

ViStatus | _code
ViChar | _fileName [kMaxFileNameLength]
ViUInt32 | _lineNumber

Detailed Description

Class that contains a status code and the file name and line number where that status code was generated.

Constructor & Destructor Documentation

nFANTOM100::tStatus::tStatus ( void ) [inline]

constructor.

Creates a tStatus object intialized to success.

Postcondition:
The status code is set to VI_SUCCESS.

nFANTOM100::tStatus::tStatus ( const tStatus & status ) [inline]

copy constructor.

Copies the code, line number, and file name from the specified tStatus object.

Parameters:
status The status object to copy.

nFANTOM100::tStatus::tStatus | ( | ViStatus | code,
 |  | const char * | fileName,
 |  | ViUInt32 | lineNumber
 | ) | [inline]

constructor with code, filename, and line number.

Creates a tStatus object initialized to the specified code, file name, and line number. Note that the nFANTOM_mLocation macro can be used to pass the fileName and lineNumber parameters.

Parameters:
code | A status code.
fileName | The name of the file in which the status code was generated.
lineNumber | The line number in the file at which the status code was generated.

Member Function Documentation

void nFANTOM100::tStatus::assign ( const tStatus & status ) [inline]

Assigns the specified status object to this status object, if appropriate.

Stores the status code, file name, and line number of the specified status object in this status object if this status object contains a successful status code or if this status object contains a warning status code and the status code of the speciied status object is fatal. A fatal status code is denoted by a negative value. A successful status code is denoted by VI_SUCCESS.

Parameters:
status The status object to assign.

void nFANTOM100::tStatus::clear ( void ) [inline]

Clears the status code for this status object.

Postcondition:
status The code is set to VI_SUCCESS.

ViStatus nFANTOM100::tStatus::getCode ( void ) const [inline]

Returns the status code for this status object.

Returns:
The status code for this status object.

const char* nFANTOM100::tStatus::getFileName ( void ) const [inline]

Returns the file name in which the status code, for this status object, was generated.

Returns:
The file name in which the status code, for this status object, was generated.

ViUInt32 nFANTOM100::tStatus::getLineNumber ( void ) const [inline]

Returns the line number at which the status code, for this status object, was.

Returns:
The line number at which the status code, for this status object, was generated.

bool nFANTOM100::tStatus::isFatal ( void ) const [inline]

Returns true if this status object contains a status code that is fatal.

A status code with a negative value is considered fatal.

Returns:
true if this status object contains a status code that is fatal; false otherwise.

bool nFANTOM100::tStatus::isNotFatal ( void ) const [inline]

Returns true if this status object contains a status code that is not fatal.

Any status code with a non-negative (including zero) value is considered non-fatal.

Returns:
true if this status object contains a non-fatal status code; false otherwise.

bool nFANTOM100::tStatus::isSuccess ( void ) const [inline]

Returns true if this status object contains the status code for success.

A value of VI_SUCCESS represents success.

Returns:
true if this status object contains the status code for success; false otherwise.

bool nFANTOM100::tStatus::isWarning ( void ) const [inline]

Returns true if this status object contains a status code that is a warning.

A status code with a non-zero, positive value is considered a warning.

Returns:
true if this status object contains a status code that is a warning; false otherwise.

void nFANTOM100::tStatus::setCode | ( | ViStatus | code,
 |  | const char * | fileName,
 |  | ViUInt32 | lineNumber
 | ) | [inline]

Sets the status code, file name, and line number for this status object, if.

Stores the specified status code, file name, and line number in this status object if this status object contains a successful status code or if this status object contains a warning status code and the specified status code is fatal. A fatal status code is denoted by a negative value. A successful status code is denoted by VI_SUCCESS.

Parameters:
code | A status code.
fileName | The name of the file in which the status code was generated.
lineNumber | The line number in the file at which the status code was generated.

The documentation for this class was generated from the following file:
  • tStatus.h


FANTOM: LEGO MINDSTORMS NXT Driver Compound Members

a | b | c | d | e | f | g | i | o | p | r | s | t | u | w | ~

Here is a list of all documented class members with links to the classes they belong to:

- a -

  • advance() : nFANTOM100::iNXTIterator, nFANTOM100::iModuleIterator, nFANTOM100::iFileIterator
  • assign() : nFANTOM100::tStatus

- b -
  • bluetoothFactoryReset() : nFANTOM100::iNXT
  • bootIntoFirmwareDownloadMode() : nFANTOM100::iNXT

- c -
  • clear() : nFANTOM100::tStatus
  • close() : nFANTOM100::iFile
  • createFile() : nFANTOM100::iNXT
  • createFileIterator() : nFANTOM100::iNXT
  • createModule() : nFANTOM100::iNXT
  • createModuleIterator() : nFANTOM100::iNXT
  • createNXT() : nFANTOM100::iNXT
  • createNXTIterator() : nFANTOM100::iNXT

- d -
  • destroyFile() : nFANTOM100::iNXT
  • destroyFileIterator() : nFANTOM100::iNXT
  • destroyModule() : nFANTOM100::iNXT
  • destroyModuleIterator() : nFANTOM100::iNXT
  • destroyNXT() : nFANTOM100::iNXT
  • destroyNXTIterator() : nFANTOM100::iNXT
  • downloadFirmware() : nFANTOM100::iNXT

- e -
  • eraseUserFlash() : nFANTOM100::iNXT

- f -
  • findDeviceInFirmwareDownloadMode() : nFANTOM100::iNXT

- g -
  • getAvailableSize() : nFANTOM100::iFile
  • getCode() : nFANTOM100::tStatus
  • getDeviceInfo() : nFANTOM100::iNXT
  • getFile() : nFANTOM100::iFileIterator
  • getFileName() : nFANTOM100::tStatus
  • getFirmwareVersion() : nFANTOM100::iNXT
  • getLineNumber() : nFANTOM100::tStatus
  • getModule() : nFANTOM100::iModuleIterator
  • getModuleID() : nFANTOM100::iModule
  • getModuleIOMapSize() : nFANTOM100::iModule
  • getModuleSize() : nFANTOM100::iModule
  • getName() : nFANTOM100::iNXTIterator, nFANTOM100::iModuleIterator, nFANTOM100::iModule, nFANTOM100::iFileIterator, nFANTOM100::iFile
  • getNXT() : nFANTOM100::iNXTIterator
  • getResourceString() : nFANTOM100::iNXT
  • getSize() : nFANTOM100::iFileIterator, nFANTOM100::iFile

- i -
  • isFatal() : nFANTOM100::tStatus
  • isNotFatal() : nFANTOM100::tStatus
  • isPaired() : nFANTOM100::iNXT
  • isSuccess() : nFANTOM100::tStatus
  • isWarning() : nFANTOM100::tStatus

- o -
  • openForDataAppend() : nFANTOM100::iFile
  • openForDataWrite() : nFANTOM100::iFile
  • openForLinearWrite() : nFANTOM100::iFile
  • openForRead() : nFANTOM100::iFile
  • openForWrite() : nFANTOM100::iFile

- p -
  • pairBluetooth() : nFANTOM100::iNXT
  • pollAvailableLength() : nFANTOM100::iNXT

- r -
  • read() : nFANTOM100::iNXT, nFANTOM100::iFile
  • readBufferData() : nFANTOM100::iNXT
  • readIOMap() : nFANTOM100::iModule
  • remove() : nFANTOM100::iFile

- s -
  • sendDirectCommand() : nFANTOM100::iNXT
  • setCode() : nFANTOM100::tStatus
  • setName() : nFANTOM100::iNXT

- t -
  • tBuffer : nFANTOM100::iNXT
  • tStatus() : nFANTOM100::tStatus

- u -
  • unpairBluetooth() : nFANTOM100::iNXT

- w -
  • write() : nFANTOM100::iNXT, nFANTOM100::iFile
  • writeIOMap() : nFANTOM100::iModule

- ~ -
  • ~iFile() : nFANTOM100::iFile
  • ~iFileIterator() : nFANTOM100::iFileIterator
  • ~iModule() : nFANTOM100::iModule
  • ~iModuleIterator() : nFANTOM100::iModuleIterator
  • ~iNXT() : nFANTOM100::iNXT
  • ~iNXTIterator() : nFANTOM100::iNXTIterator
  • ~tStatus() : nFANTOM100::tStatus


FANTOM: LEGO MINDSTORMS NXT Driver Namespace List

Here is a list of all documented namespaces with brief descriptions:
nFANTOM100 The namespace for Fantom 1.0


nFANTOM100 Namespace Reference

The namespace for Fantom 1.0. More...

Compounds

class | nFANTOM100::iFile
Interface to a file on a LEGO MINDSTORMS NXT. More...

class | nFANTOM100::iFileIterator
Interface to an iterator for files on a LEGO MINDSTORMS NXT. More...

class | nFANTOM100::iModule
Interface to a firmware module on a LEGO MINDSTORMS NXT. More...

class | nFANTOM100::iModuleIterator
Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT. More...

class | nFANTOM100::iNXT
Interface to a LEGO MINDSTORMS NXT. More...

class | nFANTOM100::iNXTIterator
Interface to an iterator for LEGO MINDSTORMS NXTs. More...

class | nFANTOM100::tStatus
Class that contains a status code and the file name and line number where that status code was generated. More...

Enumerations

enum tFANTOMStatus {
kStatusFirst = (kStatusOffset + 0),
kStatusPairingFailed = (kStatusOffset + -5),
kStatusBluetoothSearchFailed = (kStatusOffset + -6),
kStatusSystemLibraryNotFound = (kStatusOffset + -7),
kStatusUnpairingFailed = (kStatusOffset + -8),
kStatusInvalidFilename = (kStatusOffset + -9),
kStatusInvalidIteratorDereference = (kStatusOffset + -10),
kStatusLockOperationFailed = (kStatusOffset + -11),
kStatusSizeUnknown = (kStatusOffset + -12),
kStatusDuplicateOpen = (kStatusOffset + -13),
kStatusEmptyFile = (kStatusOffset + -14),
kStatusFirmwareDownloadFailed = (kStatusOffset + -15),
kStatusPortNotFound = (kStatusOffset + -16),
kStatusNoMoreItemsFound = (kStatusOffset + -17),
kStatusTooManyUnconfiguredDevices = (kStatusOffset + -18),
kStatusCommandMismatch = (kStatusOffset + -19),
kStatusIllegalOperation = (kStatusOffset + -20),
kStatusBluetoothCacheUpdateFailed = (kStatusOffset + -21),
kStatusNonNXTDeviceSelected = (kStatusOffset + -22),
kStatusRetryConnection = (kStatusOffset + -23),
kStatusPowerCycleNXT = (kStatusOffset + -24),
kStatusFeatureNotImplemented = (kStatusOffset + -99),
kStatusFWIllegalHandle = (kStatusOffset + -189),
kStatusFWIllegalFileName = (kStatusOffset + -190),
kStatusFWOutOfBounds = (kStatusOffset + -191),
kStatusFWModuleNotFound = (kStatusOffset + -192),
kStatusFWFileExists = (kStatusOffset + -193),
kStatusFWFileIsFull = (kStatusOffset + -194),
kStatusFWAppendNotPossible = (kStatusOffset + -195),
kStatusFWNoWriteBuffers = (kStatusOffset + -196),
kStatusFWFileIsBusy = (kStatusOffset + -197),
kStatusFWUndefinedError = (kStatusOffset + -198),
kStatusFWNoLinearSpace = (kStatusOffset + -199),
kStatusFWHandleAlreadyClosed = (kStatusOffset + -200),
kStatusFWFileNotFound = (kStatusOffset + -201),
kStatusFWNotLinearFile = (kStatusOffset + -202),
kStatusFWEndOfFile = (kStatusOffset + -203),
kStatusFWEndOfFileExpected = (kStatusOffset + -204),
kStatusFWNoMoreFiles = (kStatusOffset + -205),
kStatusFWNoSpace = (kStatusOffset + -206),
kStatusFWNoMoreHandles = (kStatusOffset + -207),
kStatusFWUnknownErrorCode = (kStatusOffset + -208),
kStatusLast = (kStatusOffset + -999)
}
Enumeration of Fantom-specific status codes. NI-VISA status codes may also be returned. These are documented in the NI-VISA Programmer Reference Manual which is available from <http://ni.com/>. More...

Functions

ViStatus | convertStatus (ViUInt8 firmwareStatus)

Variables

const ViUInt8 | kProtocolFilenameLength = 19
const ViInt32 | kStatusOffset = -142000
const ViStatus | kStatusSuccess = VI_SUCCESS

Detailed Description

The namespace for Fantom 1.0.

Enumeration Type Documentation

enum nFANTOM100::tFANTOMStatus

Enumeration of Fantom-specific status codes. NI-VISA status codes may also be returned. These are documented in the NI-VISA Programmer Reference Manual which is available from <http://ni.com/>.

Enumeration values:
kStatusPairingFailed | Error: Bluetooth pairing operation failed. Warning: You have already paired with that Bluetooth device.
kStatusBluetoothSearchFailed | Error: Bluetooth search failed.
kStatusSystemLibraryNotFound | Error: System library not found.
kStatusUnpairingFailed | Error: Bluetooth unpairing operation failed.
kStatusInvalidFilename | Error: Invalid filename specified.
kStatusInvalidIteratorDereference | Error: Invalid iterator dereference. (No object to get.).
kStatusLockOperationFailed | Error: Resource locking operation failed.
kStatusSizeUnknown | Error: Could not determine the requested size.
kStatusDuplicateOpen | Error: Cannot open two objects at once.
kStatusEmptyFile | Error: File is empty. Warning: The requested file is empty.
kStatusFirmwareDownloadFailed | Error: Firmware download failed.
kStatusPortNotFound | Error: Could not locate virtual serial port.
kStatusNoMoreItemsFound | Error: No more items found.
kStatusTooManyUnconfiguredDevices | Error: Too many unconfigured devices.
kStatusCommandMismatch | Error: Command mismatch in firmware response.
kStatusIllegalOperation | Error: Illegal operation.
kStatusBluetoothCacheUpdateFailed | Error: Could not update local Bluetooth cache with new name. Warning: Could not update local Bluetooth cache with new name.
kStatusNonNXTDeviceSelected | Error: Selected device is not an NXT.
kStatusRetryConnection | Error: Communication error. Retry the operation.
kStatusPowerCycleNXT | Error: Could not connect to NXT. Turn the NXT off and then back on before continuing.
kStatusFeatureNotImplemented | Error: This feature is not yet implemented.
kStatusFWIllegalHandle | Error: Firmware reported an illegal handle.
kStatusFWIllegalFileName | Error: Firmware reported an illegal file name.
kStatusFWOutOfBounds | Error: Firmware reported an out of bounds reference.
kStatusFWModuleNotFound | Error: Firmware could not find module.
kStatusFWFileExists | Error: Firmware reported that the file already exists.
kStatusFWFileIsFull | Error: Firmware reported that the file is full.
kStatusFWAppendNotPossible | Error: Firmware reported the append operation is not possible.
kStatusFWNoWriteBuffers | Error: Firmware has no write buffers available.
kStatusFWFileIsBusy | Error: Firmware reported that file is busy.
kStatusFWUndefinedError | Error: Firmware reported the undefined error.
kStatusFWNoLinearSpace | Error: Firmware reported that no linear space is available.
kStatusFWHandleAlreadyClosed | Error: Firmware reported that handle has already been closed.
kStatusFWFileNotFound | Error: Firmware could not find file.
kStatusFWNotLinearFile | Error: Firmware reported that the requested file is not linear.
kStatusFWEndOfFile | Error: Firmware reached the end of the file.
kStatusFWEndOfFileExpected | Error: Firmware expected an end of file.
kStatusFWNoMoreFiles | Error: Firmware cannot handle more files.
kStatusFWNoSpace | Error: Firmware reported the NXT is out of space.
kStatusFWNoMoreHandles | Error: Firmware could not create a handle.
kStatusFWUnknownErrorCode | Error: Firmware reported an unknown error code.


FANTOM: LEGO MINDSTORMS NXT Driver Namespace Members

k | t

Here is a list of all documented namespace members with links to the namespaces they belong to:

- k -

  • kStatusBluetoothCacheUpdateFailed : nFANTOM100
  • kStatusBluetoothSearchFailed : nFANTOM100
  • kStatusCommandMismatch : nFANTOM100
  • kStatusDuplicateOpen : nFANTOM100
  • kStatusEmptyFile : nFANTOM100
  • kStatusFeatureNotImplemented : nFANTOM100
  • kStatusFirmwareDownloadFailed : nFANTOM100
  • kStatusFWAppendNotPossible : nFANTOM100
  • kStatusFWEndOfFile : nFANTOM100
  • kStatusFWEndOfFileExpected : nFANTOM100
  • kStatusFWFileExists : nFANTOM100
  • kStatusFWFileIsBusy : nFANTOM100
  • kStatusFWFileIsFull : nFANTOM100
  • kStatusFWFileNotFound : nFANTOM100
  • kStatusFWHandleAlreadyClosed : nFANTOM100
  • kStatusFWIllegalFileName : nFANTOM100
  • kStatusFWIllegalHandle : nFANTOM100
  • kStatusFWModuleNotFound : nFANTOM100
  • kStatusFWNoLinearSpace : nFANTOM100
  • kStatusFWNoMoreFiles : nFANTOM100
  • kStatusFWNoMoreHandles : nFANTOM100
  • kStatusFWNoSpace : nFANTOM100
  • kStatusFWNotLinearFile : nFANTOM100
  • kStatusFWNoWriteBuffers : nFANTOM100
  • kStatusFWOutOfBounds : nFANTOM100
  • kStatusFWUndefinedError : nFANTOM100
  • kStatusFWUnknownErrorCode : nFANTOM100
  • kStatusIllegalOperation : nFANTOM100
  • kStatusInvalidFilename : nFANTOM100
  • kStatusInvalidIteratorDereference : nFANTOM100
  • kStatusLockOperationFailed : nFANTOM100
  • kStatusNoMoreItemsFound : nFANTOM100
  • kStatusNonNXTDeviceSelected : nFANTOM100
  • kStatusPairingFailed : nFANTOM100
  • kStatusPortNotFound : nFANTOM100
  • kStatusPowerCycleNXT : nFANTOM100
  • kStatusRetryConnection : nFANTOM100
  • kStatusSizeUnknown : nFANTOM100
  • kStatusSystemLibraryNotFound : nFANTOM100
  • kStatusTooManyUnconfiguredDevices : nFANTOM100
  • kStatusUnpairingFailed : nFANTOM100

- t -
  • tFANTOMStatus : nFANTOM100


nFANTOM100::iFile Member List

This is the complete list of members for nFANTOM100::iFile, including all inherited members.
  • close(tStatus &status)=0 [pure virtual]
  • getAvailableSize(tStatus &status)=0 [pure virtual]
  • getName(ViChar fileName[]) const=0 [pure virtual]
  • getSize(tStatus &status)=0 [pure virtual]
  • openForDataAppend(tStatus &status)=0 [pure virtual]
  • openForDataWrite(ViUInt32 sizeInBytes, tStatus &status)=0 [pure virtual]
  • openForLinearWrite(ViUInt32 sizeInBytes, tStatus &status)=0 [pure virtual]
  • openForRead(tStatus &status)=0 [pure virtual]
  • openForWrite(ViUInt32 sizeInBytes, tStatus &status)=0 [pure virtual]
  • read(ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus &status)=0 [pure virtual]
  • remove(tStatus &status)=0 [pure virtual]
  • tNXT (defined in nFANTOM100::iFile) [friend]
  • write(const ViByte bufferPtr[], ViUInt32 numberOfBytes, tStatus &status)=0 [pure virtual]
  • ~iFile()=0 [protected, pure virtual]


nFANTOM100::iFileIterator Member List

This is the complete list of members for nFANTOM100::iFileIterator, including all inherited members.
  • advance(tStatus &status)=0 [pure virtual]
  • getFile(tStatus &status)=0 [pure virtual]
  • getName(ViChar fileName[], tStatus &status)=0 [pure virtual]
  • getSize(tStatus &status)=0 [pure virtual]
  • tNXT (defined in nFANTOM100::iFileIterator) [friend]
  • ~iFileIterator()=0 [protected, pure virtual]


nFANTOM100::iModule Member List

This is the complete list of members for nFANTOM100::iModule, including all inherited members.
  • getModuleID(void) const=0 [pure virtual]
  • getModuleIOMapSize(void) const=0 [pure virtual]
  • getModuleSize(void) const=0 [pure virtual]
  • getName(ViChar moduleName[]) const=0 [pure virtual]
  • readIOMap(ViUInt32 offsetInBytes, ViUInt32 numberOfBytes, ViPBuf dataBufferPtr, tStatus &status)=0 [pure virtual]
  • tNXT (defined in nFANTOM100::iModule) [friend]
  • writeIOMap(ViUInt32 offsetInBytes, ViUInt32 numberOfBytes, const ViByte dataBufferPtr[], tStatus &status)=0 [pure virtual]
  • ~iModule()=0 [protected, pure virtual]


nFANTOM100::iModuleIterator Member List

This is the complete list of members for nFANTOM100::iModuleIterator, including all inherited members.
  • advance(tStatus &status)=0 [pure virtual]
  • getModule(tStatus &status)=0 [pure virtual]
  • getName(ViChar moduleName[], tStatus &status)=0 [pure virtual]
  • tNXT (defined in nFANTOM100::iModuleIterator) [friend]
  • ~iModuleIterator()=0 [protected, pure virtual]


nFANTOM100::iNXT Member List

This is the complete list of members for nFANTOM100::iNXT, including all inherited members.
  • bluetoothFactoryReset(tStatus &status)=0 [pure virtual]
  • bootIntoFirmwareDownloadMode(tStatus &status)=0 [pure virtual]
  • createFile(ViConstString fileName, tStatus &status)=0 [pure virtual]
  • createFileIterator(ViConstString fileNamePattern, tStatus &status)=0 [pure virtual]
  • createModule(ViConstString moduleName, ViUInt32 moduleID, ViUInt32 moduleSizeInBytes, ViUInt32 ioMapSizeInBytes, tStatus &status)=0 [pure virtual]
  • createModuleIterator(ViConstString moduleNamePattern, tStatus &status)=0 [pure virtual]
  • createNXT(ViConstString resourceString, tStatus &status, ViBoolean checkFirmwareVersion=true) [static]
  • createNXTIterator(ViBoolean searchBluetooth, ViUInt32 bluetoothSearchTimeoutInSeconds, tStatus &status) [static]
  • destroyFile(iFile *filePtr)=0 [pure virtual]
  • destroyFileIterator(iFileIterator *fileIteratorPtr)=0 [pure virtual]
  • destroyModule(iModule *modulePtr)=0 [pure virtual]
  • destroyModuleIterator(iModuleIterator *moduleIteratorPtr)=0 [pure virtual]
  • destroyNXT(iNXT *nxtPtr) [static]
  • destroyNXTIterator(iNXTIterator *iterPtr) [static]
  • downloadFirmware(const ViByte firmwareBufferPtr[], ViUInt32 firmwareBufferSizeInBytes, tStatus &status)=0 [pure virtual]
  • eraseUserFlash(tStatus &status)=0 [pure virtual]
  • findDeviceInFirmwareDownloadMode(ViChar resourceName[], tStatus &status) [static]
  • getDeviceInfo(ViChar name[], ViByte bluetoothAddress[], ViUInt8 signalStrength[], ViUInt32 &availableFlash, tStatus &status)=0 [pure virtual]
  • getFirmwareVersion(ViUInt8 &protocolVersionMajorRef, ViUInt8 &protocolVersionMinorRef, ViUInt8 &firmwareVersionMajorRef, ViUInt8 &firmwareVersionMinorRef, tStatus &status)=0 [pure virtual]
  • getResourceString(ViChar resourceString[], tStatus &status)=0 [pure virtual]
  • isPaired(ViConstString resourceName, tStatus &status) [static]
  • kBufferHighSpeed enum value (defined in nFANTOM100::iNXT)
  • kBufferStandard enum value (defined in nFANTOM100::iNXT)
  • pairBluetooth(ViConstString resourceName, ViConstString passkey, ViChar pairedResourceName[], tStatus &status) [static]
  • pollAvailableLength(tBuffer bufferSelector, tStatus &status)=0 [pure virtual]
  • read(ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus &status)=0 [pure virtual]
  • readBufferData(ViPBuf dataBuffer, tBuffer bufferSelector, ViUInt32 numberOfBytesToRead, tStatus &status)=0 [pure virtual]
  • sendDirectCommand(ViBoolean requireResponse, const ViByte commandBufferPtr[], ViUInt32 commandBufferSizeInBytes, ViPBuf responseBufferPtr, ViUInt32 responseBufferSizeInBytes, tStatus &status)=0 [pure virtual]
  • setName(ViConstString newName, tStatus &status)=0 [pure virtual]
  • tBuffer enum name
  • unpairBluetooth(ViConstString resourceName, tStatus &status) [static]
  • write(const ViByte bufferPtr[], ViUInt32 numberOfBytes, tStatus &status)=0 [pure virtual]
  • ~iNXT()=0 [protected, pure virtual]


nFANTOM100::iNXTIterator Member List

This is the complete list of members for nFANTOM100::iNXTIterator, including all inherited members.
  • advance(tStatus &status)=0 [pure virtual]
  • getName(ViChar resourceName[], tStatus &status) const=0 [pure virtual]
  • getNXT(tStatus &status)=0 [pure virtual]
  • iNXT (defined in nFANTOM100::iNXTIterator) [friend]
  • ~iNXTIterator()=0 [protected, pure virtual]


nFANTOM100::tStatus Member List

This is the complete list of members for nFANTOM100::tStatus, including all inherited members.
  • _code (defined in nFANTOM100::tStatus) [private]
  • _fileName (defined in nFANTOM100::tStatus) [private]
  • _lineNumber (defined in nFANTOM100::tStatus) [private]
  • assign(const tStatus &status) [inline]
  • clear(void) [inline]
  • getCode(void) const [inline]
  • getFileName(void) const [inline]
  • getLineNumber(void) const [inline]
  • isFatal(void) const [inline]
  • isNotFatal(void) const [inline]
  • isSuccess(void) const [inline]
  • isWarning(void) const [inline]
  • kMaxFileNameLength enum value (defined in nFANTOM100::tStatus) [private]
  • operator=(const tStatus &rhs) (defined in nFANTOM100::tStatus) [private]
  • setCode(ViStatus code, const char *fileName, ViUInt32 lineNumber) [inline]
  • tStatus(void) [inline]
  • tStatus(const tStatus &status) [inline]
  • tStatus(ViStatus code, const char *fileName, ViUInt32 lineNumber) [inline]
  • ~tStatus() [inline]


iFile.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        iFile.h
00011    Originated:  12 May 2005
00012 */
00013
00014 #ifndef ___fantom_iFile_h___
00015 #define ___fantom_iFile_h___
00016
00017 // includes...
00018
00019 #ifndef ___fantom_platform_h___
00020    #include "platform.h"
00021 #endif
00022
00023 #ifndef ___fantom_tStatus_h___
00024    #include "tStatus.h"
00025 #endif
00026
00027
00028 // defines...
00029
00030
00031 namespace nFANTOM100
00032 {
00033    // forward declarations...
00034
00035    // typedefs...
00036
00037    // classes...
00038
00043    class iFile
00044    {
00045       friend class tNXT;
00046
00047       // methods
00048       protected:
00049
00051          virtual ~iFile() = 0;
00052
00053       public:
00054
00056
00061          virtual void getName( ViChar fileName[] ) const = 0;
00062
00064
00070          virtual ViUInt32 getSize( tStatus& status ) = 0;
00071
00073
00081          virtual ViUInt32 getAvailableSize( tStatus& status ) = 0;
00082
00083
00085
00091          virtual void openForRead( tStatus& status ) = 0;
00092
00093
00095
00104          virtual void openForWrite( ViUInt32 sizeInBytes, tStatus& status ) = 0;
00105
00106
00108
00117          virtual void openForLinearWrite( ViUInt32 sizeInBytes, tStatus& status ) = 0;
00118
00119
00121
00131          virtual void openForDataWrite( ViUInt32 sizeInBytes, tStatus& status ) = 0;
00132
00133
00135
00144          virtual void openForDataAppend( tStatus& status ) = 0;
00145
00146
00148
00154          virtual void close( tStatus& status ) = 0;
00155
00156
00158
00173          virtual ViUInt32 read( ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus& status ) = 0;
00174
00175
00177
00192          virtual ViUInt32 write( const ViByte bufferPtr[], ViUInt32 numberOfBytes,
00193                tStatus& status ) = 0;
00194
00195
00197
00203          virtual void remove( tStatus& status ) = 0;
00204
00205    };
00206
00207
00208    // constants...
00209    const ViUInt8 kProtocolFilenameLength = 19;   // 15 basename + 1 dot + 3 extension = 19
00210
00211 } // namespace nFANTOM100
00212
00213
00214    // declarations for globally-scoped globals...
00215
00216    // typedefs...
00217    typedef ViObject nFANTOM100_iFile;
00218
00219    // prototypes...
00220    extern "C"
00221    {
00222       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_getName(
00223             nFANTOM100_iFile filePtr,
00224             ViChar fileName[],
00225             ViStatus* status );
00226
00227       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iFile_getSize(
00228             nFANTOM100_iFile filePtr,
00229             ViStatus* status );
00230
00231       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iFile_getAvailableSize(
00232             nFANTOM100_iFile filePtr,
00233             ViStatus* status );
00234
00235       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForRead(
00236             nFANTOM100_iFile filePtr,
00237             ViStatus* status );
00238
00239       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForWrite(
00240             nFANTOM100_iFile filePtr,
00241             ViUInt32 sizeInBytes,
00242             ViStatus* status );
00243
00244       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForLinearWrite(
00245             nFANTOM100_iFile filePtr,
00246             ViUInt32 sizeInBytes,
00247             ViStatus* status );
00248
00249       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForDataWrite(
00250             nFANTOM100_iFile filePtr,
00251             ViUInt32 sizeInBytes,
00252             ViStatus* status );
00253
00254       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_openForDataAppend(
00255             nFANTOM100_iFile filePtr,
00256             ViStatus* status );
00257
00258       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_close(
00259             nFANTOM100_iFile filePtr,
00260             ViStatus* status );
00261
00262       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_read(
00263             nFANTOM100_iFile filePtr,
00264             ViPBuf bufferPtr,
00265             ViUInt32 numberOfBytes,
00266             ViStatus* status );
00267
00268       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_write(
00269             nFANTOM100_iFile filePtr,
00270             const ViByte bufferPtr[],
00271             ViUInt32 numberOfBytes,
00272             ViStatus* status );
00273
00274       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFile_remove(
00275             nFANTOM100_iFile filePtr,
00276             ViStatus* status );
00277
00278    }
00279
00280 #endif // ___fantom_iFile_h___


iFileIterator.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        iFileIterator.h
00011    Originated:  12 May 2005
00012 */
00013
00014 #ifndef ___fantom_iFileIterator_h___
00015 #define ___fantom_iFileIterator_h___
00016
00017
00018 // includes...
00019
00020 #ifndef ___fantom_platform_h___
00021    #include "platform.h"
00022 #endif
00023
00024 #ifndef ___fantom_iFile_h___
00025    #include "iFile.h"
00026 #endif
00027
00028 #ifndef ___fantom_tStatus_h___
00029    #include "tStatus.h"
00030 #endif
00031
00032
00033 // defines...
00034
00035
00036 namespace nFANTOM100
00037 {
00038    // forward declarations...
00039
00040    // typedefs...
00041
00042    // classes...
00043
00048    class iFileIterator
00049    {
00050       friend class tNXT;
00051
00052       // methods
00053       protected:
00054
00056          virtual ~iFileIterator() = 0;
00057
00058       public:
00059
00061
00070          virtual iFile* getFile( tStatus& status ) = 0;
00071
00073
00082          virtual void advance( tStatus& status ) = 0;
00083
00085
00091          virtual void getName( ViChar fileName[], tStatus& status ) = 0;
00092
00094
00098          virtual ViUInt32 getSize( tStatus& status ) = 0;
00099
00100    };
00101
00102
00103    // constants...
00104
00105 } // namespace nFANTOM100
00106
00107
00108    // declarations for globally-scoped globals...
00109
00110    // typedefs
00111    typedef ViObject nFANTOM100_iFileIterator;
00112
00113    extern "C"
00114    {
00115       nFANTOM100_kExport nFANTOM100_iFile _VI_FUNCC nFANTOM100_iFileIterator_getFile(
00116             nFANTOM100_iFileIterator iteratorPtr,
00117             ViStatus* status );
00118
00119       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFileIterator_advance(
00120             nFANTOM100_iFileIterator iteratorPtr,
00121             ViStatus* status );
00122
00123       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iFileIterator_getName(
00124             nFANTOM100_iFileIterator iteratorPtr,
00125             ViChar filename[],
00126             ViStatus* status );
00127
00128       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iFileIterator_getSize(
00129             nFANTOM100_iFileIterator iteratorPtr,
00130             ViStatus* status );
00131    }
00132
00133 #endif // ___fantom_iFileIterator_h___


iModule.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        iModule.h
00011    Originated:  8 Aug 2005
00012 */
00013
00014 #ifndef ___fantom_iModule_h___
00015 #define ___fantom_iModule_h___
00016
00017 #ifndef ___fantom_platform_h___
00018    #include "platform.h"
00019 #endif
00020
00021 #ifndef ___fantom_tStatus_h___
00022    #include "tStatus.h"
00023 #endif
00024
00025
00026 // defines...
00027
00028
00029 namespace nFANTOM100
00030 {
00031
00036    class iModule
00037    {
00038       friend class tNXT;
00039
00040       // methods
00041       protected:
00042
00044          virtual ~iModule() = 0;
00045
00046       public:
00047
00049
00054          virtual void getName( ViChar moduleName[] ) const = 0;
00055
00057
00060          virtual ViUInt32 getModuleID( void ) const = 0;
00061
00063
00066          virtual ViUInt32 getModuleSize( void ) const = 0;
00067
00069
00072          virtual ViUInt32 getModuleIOMapSize( void ) const = 0;
00073
00075
00091          virtual ViUInt32 readIOMap( ViUInt32 offsetInBytes, ViUInt32 numberOfBytes,
00092                ViPBuf dataBufferPtr, tStatus& status ) = 0;
00093
00095
00111          virtual ViUInt32 writeIOMap( ViUInt32 offsetInBytes, ViUInt32 numberOfBytes,
00112                const ViByte dataBufferPtr[], tStatus& status ) = 0;
00113
00114    };
00115
00116 }; // nFANTOM100
00117
00118 typedef ViObject nFANTOM100_iModule;
00119
00120 extern "C"
00121 {
00122    nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModule_getName(
00123          nFANTOM100_iModule modulePtr,
00124          ViChar moduleName[],
00125          ViStatus* status );
00126
00127    nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getModuleID(
00128          nFANTOM100_iModule modulePtr,
00129          ViStatus* status );
00130
00131    nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getModuleSize(
00132          nFANTOM100_iModule modulePtr,
00133          ViStatus* status );
00134
00135    nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_getIOMapSize(
00136          nFANTOM100_iModule modulePtr,
00137          ViStatus* status );
00138
00139    nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_readIOMap(
00140          nFANTOM100_iModule modulePtr,
00141          ViUInt32 offset,
00142          ViUInt32 numberBytesToRead,
00143          ViPBuf dataBuffer,
00144          ViStatus* status );
00145
00146    nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iModule_writeIOMap(
00147          nFANTOM100_iModule modulePtr,
00148          ViUInt32 offset,
00149          ViUInt32 numberBytesToWrite,
00150          const ViByte dataBuffer[],
00151          ViStatus* status );
00152 }
00153
00154 #endif // ___fantom_iModule_h___


iModuleIterator.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        iModuleIterator.h
00011    Originated:  8 Aug 2005
00012 */
00013
00014 #ifndef ___fantom_iModuleIterator_h___
00015 #define ___fantom_iModuleIterator_h___
00016
00017
00018 // includes...
00019
00020 #ifndef ___fantom_platform_h___
00021    #include "platform.h"
00022 #endif
00023
00024 #ifndef ___fantom_iModule_h___
00025    #include "iModule.h"
00026 #endif
00027
00028 #ifndef ___fantom_tStatus_h___
00029    #include "tStatus.h"
00030 #endif
00031
00032
00033 // defines...
00034
00035
00036 namespace nFANTOM100
00037 {
00038    // forward declarations...
00039
00040    // typedefs...
00041
00042    // classes...
00043
00048    class iModuleIterator
00049    {
00050       friend class tNXT;
00051
00052       // methods
00053       protected:
00054
00056          virtual ~iModuleIterator() = 0;
00057
00058       public:
00059
00061
00070          virtual iModule* getModule( tStatus& status ) = 0;
00071
00073
00082          virtual void advance( tStatus& status ) = 0;
00083
00085
00092          virtual void getName( ViChar moduleName[], tStatus& status ) = 0;
00093
00094    };
00095
00096
00097    // constants...
00098
00099 } // namespace nFANTOM100
00100
00101
00102    // declarations for globally-scoped globals...
00103
00104    // typedefs
00105    typedef ViObject nFANTOM100_iModuleIterator;
00106
00107    extern "C"
00108    {
00109       nFANTOM100_kExport nFANTOM100_iModule _VI_FUNCC nFANTOM100_iModuleIterator_getModule(
00110             nFANTOM100_iModuleIterator iteratorPtr,
00111             ViStatus* status );
00112
00113       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModuleIterator_advance(
00114             nFANTOM100_iModuleIterator iteratorPtr,
00115             ViStatus* status );
00116
00117       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModuleIterator_getName(
00118             nFANTOM100_iModuleIterator iteratorPtr,
00119             ViChar moduleName[],
00120             ViStatus* status );
00121    }
00122
00123 #endif // ___fantom_iModuleIterator_h___


iNXT.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        iNXT.h
00011    Originated:  12 May 2005
00012 */
00013
00014 #ifndef ___fantom_iNXT_h___
00015 #define ___fantom_iNXT_h___
00016
00017
00018 // includes...
00019
00020 #ifndef ___fantom_platform_h___
00021    #include "platform.h"
00022 #endif
00023
00024 #ifndef ___fantom_iFile_h___
00025    #include "iFile.h"
00026 #endif
00027
00028 #ifndef ___fantom_iFileIterator_h___
00029    #include "iFileIterator.h"
00030 #endif
00031
00032 #ifndef ___fantom_iModule_h___
00033    #include "iModule.h"
00034 #endif
00035
00036 #ifndef ___fantom_iModuleIterator_h___
00037    #include "iModuleIterator.h"
00038 #endif
00039
00040 #ifndef ___fantom_iNXTIterator_h___
00041    #include "iNXTIterator.h"
00042 #endif
00043
00044 #ifndef ___fantom_tStatus_h___
00045    #include "tStatus.h"
00046 #endif
00047
00048 // defines...
00049
00050
00051 namespace nFANTOM100
00052 {
00053    // forward declarations...
00054
00055    // typedefs...
00056
00057    // classes...
00058
00063    class iNXT
00064    {
00065       // methods
00066    protected:
00067
00069          virtual ~iNXT() = 0;
00070
00071    public:
00072
00074          enum tBuffer
00075          {
00076             // The buffer associated with the standard port.
00077             kBufferStandard,
00078
00079             // The buffer associated with the high-speed port.
00080             kBufferHighSpeed
00081          };
00082
00084
00096          virtual iFile* createFile( ViConstString fileName, tStatus& status ) = 0;
00097
00098
00100
00107          virtual void destroyFile( iFile* filePtr ) = 0;
00108
00109
00111
00128          virtual iFileIterator* createFileIterator( ViConstString fileNamePattern,
00129                tStatus& status ) = 0;
00130
00131
00133
00136          virtual void destroyFileIterator( iFileIterator* fileIteratorPtr ) = 0;
00137
00139
00153          virtual iModule* createModule( ViConstString moduleName, ViUInt32 moduleID,
00154                ViUInt32 moduleSizeInBytes, ViUInt32 ioMapSizeInBytes, tStatus& status ) = 0;
00155
00157
00164          virtual void destroyModule( iModule* modulePtr ) = 0;
00165
00166
00168
00181          virtual iModuleIterator* createModuleIterator( ViConstString moduleNamePattern,
00182                tStatus& status ) = 0;
00183
00184
00186
00189          virtual void destroyModuleIterator( iModuleIterator* moduleIteratorPtr ) = 0;
00190
00192
00209          virtual void getFirmwareVersion( ViUInt8& protocolVersionMajorRef,
00210                ViUInt8& protocolVersionMinorRef, ViUInt8& firmwareVersionMajorRef,
00211                ViUInt8& firmwareVersionMinorRef, tStatus& status ) = 0;
00212
00213
00215
00240          virtual ViUInt32 sendDirectCommand( ViBoolean requireResponse, const ViByte commandBufferPtr[],
00241                ViUInt32 commandBufferSizeInBytes, ViPBuf responseBufferPtr,
00242                ViUInt32 responseBufferSizeInBytes, tStatus& status ) = 0;
00243
00245
00252          virtual void downloadFirmware( const ViByte firmwareBufferPtr[],
00253                ViUInt32 firmwareBufferSizeInBytes, tStatus& status ) = 0;
00254
00255
00257
00269          virtual ViUInt32 write( const ViByte bufferPtr[], ViUInt32 numberOfBytes,
00270                tStatus& status ) = 0;
00271
00273
00284          virtual ViUInt32 read ( ViPBuf bufferPtr, ViUInt32 numberOfBytes, tStatus& status ) = 0;
00285
00287
00293          virtual void bootIntoFirmwareDownloadMode( tStatus& status ) = 0;
00294
00296
00304          virtual void setName( ViConstString newName, tStatus& status ) = 0;
00305
00307
00324          virtual void getDeviceInfo( ViChar name[], ViByte bluetoothAddress[],
00325                ViUInt8 signalStrength[], ViUInt32 &availableFlash, tStatus& status ) = 0;
00326
00328
00334          virtual void eraseUserFlash( tStatus& status ) = 0;
00335
00337          /*
00338             The data buffer is not polled if the specified status is fatal.
00339
00340             \param bufferSelector The buffer from which to read.
00341             \param status Status chaining object.
00342             \return The number of bytes in the buffer available to be read.
00343          */
00344          virtual ViUInt32 pollAvailableLength( tBuffer bufferSelector, tStatus& status ) = 0;
00345
00347
00356          virtual ViUInt32 readBufferData( ViPBuf dataBuffer, tBuffer bufferSelector,
00357                ViUInt32 numberOfBytesToRead, tStatus& status ) = 0;
00358
00360          /*
00361             An example resource string could look like the one of the following:
00362                BTH::LEGOBrick::00:16:53:04:05:06::5
00363                BTH::LEGOBrick::00:16:53:04:05:06::1
00364                BTH::Brick2::00:16:53:44:FF:66
00365                USB0::0x0694::0x0002::0016535127BA::RAW
00366
00367             \param resourceString Populated with the resource string. The resource string must
00368                have a capacity of 256 bytes.
00369             \param status Status chaining object.
00370          */
00371          virtual void getResourceString( ViChar resourceString[], tStatus& status ) = 0;
00372
00374          /*
00375             \param status Status chaining object.
00376          */
00377          virtual void bluetoothFactoryReset( tStatus& status ) = 0;
00378
00380
00393          nFANTOM100_kExport static iNXT* _VI_FUNCC createNXT( ViConstString resourceString,
00394                tStatus& status, ViBoolean checkFirmwareVersion = true );
00395
00397
00400          nFANTOM100_kExport static void _VI_FUNCC destroyNXT( iNXT* nxtPtr );
00401
00403
00417          nFANTOM100_kExport static iNXTIterator* _VI_FUNCC createNXTIterator(
00418                ViBoolean searchBluetooth, ViUInt32 bluetoothSearchTimeoutInSeconds,
00419                tStatus& status );
00420
00422          /*
00423             \param iterPtr A pointer to the iNXTIterator object to destroy.
00424          */
00425          nFANTOM100_kExport static void _VI_FUNCC destroyNXTIterator( iNXTIterator* iterPtr );
00426
00428
00444          nFANTOM100_kExport static void _VI_FUNCC pairBluetooth( ViConstString resourceName,
00445                ViConstString passkey, ViChar pairedResourceName[], tStatus& status );
00446
00448
00457          nFANTOM100_kExport static void _VI_FUNCC unpairBluetooth( ViConstString resourceName,
00458                tStatus& status );
00459
00461
00470          nFANTOM100_kExport static ViBoolean _VI_FUNCC isPaired( ViConstString resourceName,
00471                tStatus& status );
00472
00474
00481          nFANTOM100_kExport static void findDeviceInFirmwareDownloadMode( ViChar resourceName[],
00482                tStatus& status );
00483
00484
00485       private:
00486
00487    };
00488
00489    // constants...
00490
00491 } // namespace nFANTOM100
00492
00493
00494    // declarations for globally-scoped globals...
00495
00496    // typedefs...
00497    typedef ViObject nFANTOM100_iNXT;
00498
00499    // prototypes...
00500    extern "C"
00501    {
00502
00503       nFANTOM100_kExport nFANTOM100_iNXTIterator _VI_FUNCC nFANTOM100_createNXTIterator(
00504             ViBoolean   searchBluetooth,
00505             ViUInt32    bluetoothSearchTimeoutInSeconds,
00506             ViStatus*   status );
00507
00508       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_destroyNXTIterator(
00509             nFANTOM100_iNXTIterator iterPtr,
00510             ViStatus* status );
00511
00512       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_pairBluetooth(
00513             ViConstString    resourceName,
00514             ViConstString    passkey,
00515             ViChar    pairedResourceName[],
00516             ViStatus*   status );
00517
00518       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_unpairBluetooth(
00519             ViConstString    resourceName,
00520             ViStatus*   status );
00521
00522       nFANTOM100_kExport ViBoolean _VI_FUNCC nFANTOM100_isPaired(
00523             ViConstString  resourceName,
00524             ViStatus*      status );
00525
00526       nFANTOM100_kExport nFANTOM100_iNXT _VI_FUNCC nFANTOM100_createNXT(
00527             ViConstString    resourceString,
00528             ViStatus*   status,
00529             ViBoolean   checkFirmwareVersion );
00530
00531       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_destroyNXT(
00532             nFANTOM100_iNXT  nxtPtr,
00533             ViStatus*      status );
00534
00535       nFANTOM100_kExport nFANTOM100_iFile _VI_FUNCC nFANTOM100_iNXT_createFile(
00536             nFANTOM100_iNXT  nxtPtr,
00537             ViConstString       fileName,
00538             ViStatus*      status );
00539
00540       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyFile(
00541             nFANTOM100_iNXT  nxtPtr,
00542             nFANTOM100_iFile filePtr,
00543             ViStatus*      status );
00544
00545       nFANTOM100_kExport nFANTOM100_iFileIterator _VI_FUNCC nFANTOM100_iNXT_createFileIterator(
00546             nFANTOM100_iNXT  nxtPtr,
00547             ViConstString       fileNamePattern,
00548             ViStatus*      status );
00549
00550       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyFileIterator(
00551             nFANTOM100_iNXT           nxtPtr,
00552             nFANTOM100_iFileIterator  fileIteratorPtr,
00553             ViStatus*               status );
00554
00555       nFANTOM100_kExport nFANTOM100_iModule _VI_FUNCC nFANTOM100_iNXT_createModule(
00556             nFANTOM100_iNXT  nxtPtr,
00557             ViConstString       moduleName,
00558             ViUInt32       moduleID,
00559             ViUInt32       moduleSize,
00560             ViUInt32       ioMapSizeInBytes,
00561             ViStatus*      status );
00562
00563       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyModule(
00564             nFANTOM100_iNXT     nxtPtr,
00565             nFANTOM100_iModule  modulePtr,
00566             ViStatus*         status );
00567
00568       nFANTOM100_kExport nFANTOM100_iModuleIterator _VI_FUNCC nFANTOM100_iNXT_createModuleIterator(
00569             nFANTOM100_iNXT  nxtPtr,
00570             ViConstString       moduleNamePattern,
00571             ViStatus*      status );
00572
00573       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_destroyModuleIterator(
00574             nFANTOM100_iNXT              nxtPtr,
00575             nFANTOM100_iModuleIterator   moduleIteratorPtr,
00576             ViStatus*                  status );
00577
00578       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_getFirmwareVersion(
00579             nFANTOM100_iNXT  nxtPtr,
00580             ViUInt8*       protocolVersionMajorPtr,
00581             ViUInt8*       protocolVersionMinorPtr,
00582             ViUInt8*       firmwareVersionMajorPtr,
00583             ViUInt8*       firmwareVersionMinorPtr,
00584             ViStatus*      status );
00585
00586       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_sendDirectCommand(
00587             nFANTOM100_iNXT  nxtPtr,
00588             ViBoolean      requireResponse,
00589             const ViByte   commandBufferPtr[],
00590             ViUInt32       commandBufferSizeInBytes,
00591             ViPBuf         responseBufferPtr,
00592             ViUInt32       responseBufferSizeInBytes,
00593             ViStatus*      status );
00594
00595       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_findDeviceInFirmwareDownloadMode(
00596             ViChar resourceString[],
00597             ViStatus*   status );
00598
00599       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_downloadFirmware(
00600             nFANTOM100_iNXT nxtPtr,
00601             const ViByte    firmwareBufferPtr[],
00602             ViUInt32    firmwareBufferSize,
00603             ViStatus*   status );
00604
00605       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_write(
00606             nFANTOM100_iNXT  nxtPtr,
00607             const ViByte         bufferPtr[],
00608             ViUInt32       numberOfBytes,
00609             ViStatus*      status );
00610
00611       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_read(
00612             nFANTOM100_iNXT  nxtPtr,
00613             ViPBuf         bufferPtr,
00614             ViUInt32       numberOfBytes,
00615             ViStatus*      status );
00616
00617       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_bootIntoFirmwareDownloadMode(
00618             ViConstString    resouceName,
00619             ViStatus*   status );
00620
00621       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_setName(
00622             nFANTOM100_iNXT  nxtPtr,
00623             ViConstString       newName,
00624             ViStatus*      status );
00625
00626       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_getDeviceInfo(
00627             nFANTOM100_iNXT  nxtPtr,
00628             ViChar       name[],
00629             ViByte        bluetoothAddress[],
00630             ViUInt8       signalStrength[],
00631             ViUInt32*      availableFlash,
00632             ViStatus*      status );
00633
00634       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_eraseUserFlash(
00635             nFANTOM100_iNXT  nxtPtr,
00636             ViStatus*      status );
00637
00638       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_pollAvailableLength(
00639             nFANTOM100_iNXT  nxtPtr,
00640             ViUInt32        bufferIndex,
00641             ViStatus*      status );
00642
00643       nFANTOM100_kExport ViUInt32 _VI_FUNCC nFANTOM100_iNXT_readBufferData(
00644             nFANTOM100_iNXT  nxtPtr,
00645             ViPBuf         dataBuffer,
00646             ViUInt32       bufferIndex,
00647             ViUInt32       numberOfBytesToRead,
00648             ViStatus*      status );
00649
00650       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_getResourceString(
00651             nFANTOM100_iNXT   nxtPtr,
00652             ViChar            resourceString[],
00653             ViStatus*         status );
00654
00655       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXT_bluetoothFactoryReset(
00656             nFANTOM100_iNXT   nxtPtr,
00657             ViStatus*         status );
00658
00659
00660    }  // extern "C"
00661
00662
00663 // inline functions and function macros...
00664
00665
00666 #endif // ___fantom_iNXT_h___


iNXTIterator.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        iNXTIterator.h
00011    Originated:  17 Oct 2005
00012 */
00013
00014 #ifndef ___fantom_iNXTIterator_h___
00015 #define ___fantom_iNXTIterator_h___
00016
00017
00018 // includes...
00019
00020 #ifndef ___fantom_platform_h___
00021    #include "platform.h"
00022 #endif
00023
00024 #ifndef ___fantom_tStatus_h___
00025    #include "tStatus.h"
00026 #endif
00027
00028
00029 // defines...
00030
00031
00032 namespace nFANTOM100
00033 {
00034    // forward declarations...
00035    class iNXT;
00036
00037    // typedefs...
00038
00039    // classes...
00040
00045    class iNXTIterator
00046    {
00047       friend class iNXT;
00048
00049       // methods
00050       protected:
00051
00053          virtual ~iNXTIterator() = 0;
00054
00055       public:
00056
00058          /*
00059             \param resourceName Populated with the name of the NXT to which this iterator
00060                currently refers.  The resource name character array must have a capacity of 256
00061                bytes.
00062             \param status Status chaining object.
00063          */
00064          virtual void getName( ViChar resourceName[], tStatus& status ) const = 0;
00065
00067
00075          virtual void advance( tStatus& status ) = 0;
00076
00078          /*
00079             Creates an NXT object for the NXT referenced by this iterator.  An object is not
00080                created if the specified status is fatal or if this iterator refers to the end of
00081                the list.  The returned iNXT object should be destroyed using the iNXT::destroyNXT
00082                method.
00083
00084             \param status Status chaining object.
00085             \return A pointer to the iNXT object that was created.
00086          */
00087          virtual iNXT* getNXT( tStatus& status ) = 0;
00088    };
00089
00090
00091    // constants...
00092
00093 } // namespace nFANTOM100
00094
00095
00096    // declarations for globally-scoped globals...
00097
00098    // typedefs
00099    typedef ViObject nFANTOM100_iNXTIterator;
00100
00101    // we must duplicate this typedef for the getNXT C wrapper
00102    typedef ViObject nFANTOM100_iNXT;
00103
00104    extern "C"
00105    {
00106       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXTIterator_getName(
00107             nFANTOM100_iNXTIterator iteratorPtr,
00108             ViChar resourceName[],
00109             ViStatus* status );
00110
00111       nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iNXTIterator_advance(
00112             nFANTOM100_iNXTIterator iteratorPtr,
00113             ViStatus* status );
00114
00115       nFANTOM100_kExport nFANTOM100_iNXT _VI_FUNCC nFANTOM100_iNXTIterator_getNXT(
00116             nFANTOM100_iNXTIterator iteratorPtr,
00117             ViStatus* status );
00118    }
00119
00120 #endif // ___fantom_iNXTIterator_h___


tStatus.h

Go to the documentation of this file.
00001
00005 /*
00006    © Copyright 2005-2006,
00007    National Instruments Corporation.
00008    All rights reserved.
00009
00010    File:        tStatus.h
00011    Originated:  10 March 2005
00012 */
00013
00014 #ifndef ___fantom_tStatus_h___
00015 #define ___fantom_tStatus_h___
00016
00017 // includes ...
00018
00019 #ifndef ___fantom_platform_h___
00020    #include "platform.h"
00021 #endif
00022
00023 #include <string.h>
00024
00025
00026 // defines...
00027
00028 #define nFANTOM_mLocation __FILE__, __LINE__
00029
00030 #define nFANTOM_ForceToWarning(s)     (((s) >= 0 ) ? (s) : -(s))
00031 #define nFANTOM_ForceToFatal(s)       (((s) <= 0 ) ? (s) : -(s))
00032
00036 namespace nFANTOM100
00037 {
00038    // forward declarations...
00039
00040    // typedefs...
00041
00042    // classes...
00043    const ViInt32 kStatusOffset = -142000; // 0xFFFDD550
00044    const ViStatus kStatusSuccess = VI_SUCCESS;
00045
00051    enum tFANTOMStatus
00052    {
00053       kStatusFirst                        = (kStatusOffset + 0),
00054
00057       kStatusPairingFailed                = (kStatusOffset + -5),    // 0x54B
00058
00060       kStatusBluetoothSearchFailed        = (kStatusOffset + -6),    // 0x54A
00061
00063       kStatusSystemLibraryNotFound        = (kStatusOffset + -7),    // 0x549
00064
00066       kStatusUnpairingFailed              = (kStatusOffset + -8),    // 0x548
00067
00069       kStatusInvalidFilename              = (kStatusOffset + -9),    // 0x547
00070
00072       kStatusInvalidIteratorDereference   = (kStatusOffset + -10),   // 0x546
00073
00075       kStatusLockOperationFailed          = (kStatusOffset + -11),   // 0x545
00076
00078       kStatusSizeUnknown                  = (kStatusOffset + -12),   // 0x544
00079
00081       kStatusDuplicateOpen                = (kStatusOffset + -13),   // 0x543
00082
00085       kStatusEmptyFile                    = (kStatusOffset + -14),   // 0x542
00086
00088       kStatusFirmwareDownloadFailed       = (kStatusOffset + -15),   // 0x541
00089
00091       kStatusPortNotFound                 = (kStatusOffset + -16),   // 0x540
00092
00094       kStatusNoMoreItemsFound             = (kStatusOffset + -17),   // 0x53F
00095
00097       kStatusTooManyUnconfiguredDevices   = (kStatusOffset + -18),   // 0x53E
00098
00100       kStatusCommandMismatch              = (kStatusOffset + -19),   // 0x53D
00101
00103       kStatusIllegalOperation             = (kStatusOffset + -20),   // 0x53C
00104
00107       kStatusBluetoothCacheUpdateFailed   = (kStatusOffset + -21),   // 0x53B
00108
00110       kStatusNonNXTDeviceSelected         = (kStatusOffset + -22),   // 0x53A
00111
00113       kStatusRetryConnection              = (kStatusOffset + -23),   // 0x539
00114
00116       kStatusPowerCycleNXT                = (kStatusOffset + -24),   // 0x538
00117
00119       kStatusFeatureNotImplemented        = (kStatusOffset + -99),   // 0x4ED
00120
00122       kStatusFWIllegalHandle              = (kStatusOffset + -189),  // 0x493
00123
00125       kStatusFWIllegalFileName            = (kStatusOffset + -190),  // 0x492
00126
00128       kStatusFWOutOfBounds                = (kStatusOffset + -191),  // 0x491
00129
00131       kStatusFWModuleNotFound             = (kStatusOffset + -192),  // 0x490
00132
00134       kStatusFWFileExists                 = (kStatusOffset + -193),  // 0x48F
00135
00137       kStatusFWFileIsFull                 = (kStatusOffset + -194),  // 0x48E
00138
00140       kStatusFWAppendNotPossible          = (kStatusOffset + -195),  // 0x48D
00141
00143       kStatusFWNoWriteBuffers             = (kStatusOffset + -196),  // 0x48C
00144
00146       kStatusFWFileIsBusy                 = (kStatusOffset + -197),  // 0x48B
00147
00149       kStatusFWUndefinedError             = (kStatusOffset + -198),  // 0x48A
00150
00152       kStatusFWNoLinearSpace              = (kStatusOffset + -199),  // 0x489
00153
00155       kStatusFWHandleAlreadyClosed        = (kStatusOffset + -200),  // 0x488
00156
00158       kStatusFWFileNotFound               = (kStatusOffset + -201),  // 0x487
00159
00161       kStatusFWNotLinearFile              = (kStatusOffset + -202),  // 0x486
00162
00164       kStatusFWEndOfFile                  = (kStatusOffset + -203),  // 0x485
00165
00167       kStatusFWEndOfFileExpected          = (kStatusOffset + -204),  // 0x484
00168
00170       kStatusFWNoMoreFiles                = (kStatusOffset + -205),  // 0x483
00171
00173       kStatusFWNoSpace                    = (kStatusOffset + -206),  // 0x482
00174
00176       kStatusFWNoMoreHandles              = (kStatusOffset + -207),  // 0x481
00177
00179       kStatusFWUnknownErrorCode           = (kStatusOffset + -208),  // 0x480
00180
00181       kStatusLast                         = (kStatusOffset + -999)
00182    };
00183
00188    class tStatus
00189    {
00190       public:
00191
00192          // methods
00193
00195
00200          inline tStatus( void ) :
00201                _code( VI_SUCCESS ),
00202                _lineNumber( 0 )
00203          {
00204             _fileName[0] = '\0';
00205          }
00206
00207
00209
00214          inline tStatus( const tStatus& status ) :
00215                _code( status._code ),
00216                _lineNumber( status._lineNumber )
00217          {
00218             ::strcpy( _fileName, "" );
00219             ::strncat( _fileName, status._fileName, kMaxFileNameLength - 1 );
00220          }
00221
00222
00224
00233          inline tStatus( ViStatus code, const char* fileName, ViUInt32 lineNumber ) :
00234                _code( code ),
00235                _lineNumber( lineNumber )
00236          {
00237             ::strcpy( _fileName, "" );
00238             ::strncat( _fileName, reinterpret_cast<const char*>( fileName ), kMaxFileNameLength - 1 );
00239          }
00240
00241
00243          inline ~tStatus()
00244          {
00245          }
00246
00247
00249
00252          inline ViStatus getCode( void ) const
00253          {
00254             return _code;
00255          }
00256
00257
00259
00262          inline const char* getFileName( void ) const
00263          {
00264             return _fileName;
00265          }
00266
00267
00269          //   generated.
00274          inline ViUInt32 getLineNumber( void ) const
00275          {
00276             return _lineNumber;
00277          }
00278
00279
00281          //   appropriate.
00293          inline void setCode( ViStatus code, const char* fileName, ViUInt32 lineNumber )
00294          {
00295             if(( isSuccess() && code != VI_SUCCESS ) || ( isNotFatal() && code < VI_SUCCESS ))
00296             {
00297                _code = code;
00298                _lineNumber = lineNumber;
00299                ::strcpy( _fileName, "" );
00300                ::strncat( _fileName, fileName, kMaxFileNameLength - 1 );
00301             }
00302          }
00303
00304
00306
00315          inline void assign( const tStatus& status )
00316          {
00317             setCode( status.getCode(), status.getFileName(), status.getLineNumber());
00318          }
00319
00320
00322
00325          inline void clear( void )
00326          {
00327             _code = VI_SUCCESS;
00328             _lineNumber = 0;
00329             _fileName[0] = '\0';
00330          }
00331
00332
00334
00340          inline bool isFatal( void ) const
00341          {
00342             return ( _code < VI_SUCCESS );
00343          }
00344
00346
00352          inline bool isNotFatal( void ) const
00353          {
00354             return !isFatal();
00355          }
00356
00357
00359
00365          inline bool isWarning( void ) const
00366          {
00367             return ( _code > VI_SUCCESS );
00368          }
00369
00370
00372
00378          inline bool isSuccess( void ) const
00379          {
00380             return ( _code == VI_SUCCESS );
00381          }
00382
00383       private:
00384
00385          // declared private to prevent assignment
00386          tStatus& operator=(const tStatus& rhs);
00387
00388          enum
00389          {
00390             kMaxFileNameLength = 101
00391          };
00392
00393          ViStatus _code;
00394          ViChar   _fileName[ kMaxFileNameLength ];
00395          ViUInt32 _lineNumber;
00396    };
00397
00398
00399    // declarations for globally-scoped globals...
00400    inline ViStatus convertStatus( ViUInt8 firmwareStatus )
00401    {
00402       ViStatus status;
00403       switch (firmwareStatus)
00404       {
00405       // each of these cases corresponds to a unique status code returned by the firmware
00406       case 0x00 : status = kStatusSuccess;
00407          break;
00408       case 0x81 : status = kStatusFWNoMoreHandles; // No more available handles
00409          break;
00410       case 0x82 : status = kStatusFWNoSpace;   // No space
00411          break;
00412       case 0x83 : status = kStatusFWNoMoreFiles; // No more files
00413          break;
00414       case 0x84 : status = kStatusFWEndOfFileExpected; // End of file expected
00415          break;
00416       case 0x85 : status = kStatusFWEndOfFile; // End of file reached
00417          break;
00418       case 0x86 : status = kStatusFWNotLinearFile; // Not a linear file
00419          break;
00420       case 0x87 : status = kStatusFWFileNotFound; // File not found
00421          break;
00422       case 0x88 : status = kStatusFWHandleAlreadyClosed; // Handle is already closed
00423          break;
00424       case 0x89 : status = kStatusFWNoLinearSpace; // No linear space available
00425          break;
00426       case 0x8A : status = kStatusFWUndefinedError; // Undefined error
00427          break;
00428       case 0x8B : status = kStatusFWFileIsBusy; // File is busy
00429          break;
00430       case 0x8C : status = kStatusFWNoWriteBuffers; // No write buffers available
00431          break;
00432       case 0x8D : status = kStatusFWAppendNotPossible; // Append not possible
00433          break;
00434       case 0x8E : status = kStatusFWFileIsFull; // File is full
00435          break;
00436       case 0x8F : status = kStatusFWFileExists; // File already exists
00437          break;
00438       case 0x90 : status = kStatusFWModuleNotFound; // Module not found
00439          break;
00440       case 0x91 : status = kStatusFWOutOfBounds; // Out of module I/O map boundary
00441          break;
00442       case 0x92 : status = kStatusFWIllegalFileName; // Illegal file name
00443          break;
00444       case 0x93 : status = kStatusFWIllegalHandle; // Illegal handle
00445          break;
00446       default :
00447          status = kStatusFWUnknownErrorCode;
00448       }
00449       return status;
00450    }
00451
00452    // prototypes...
00453
00454 } // namespace nFANTOM100
00455
00456 // inline functions and function macros...
00457
00458 #endif // ___fantom_tStatus_h___