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

# 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___

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