Main page → NatNet SDK → NatNet: Class/Function Reference
This page provides function and class references of the NatNet SDK library.
The NatNetClient class (or NatNetClientML from the managed assembly) is the key object of the SDK. An instance of this client class allows an application to connect to a server application and query data. API helper functions are provided with the C++ library for a more convenient use of the SDK tools. For additional information, refer to the provided headers files (native) or reference the NatNatML.dll file (managed).
Note:
Most of the NatNet SDK functions return their operation results in an integer type representation named ErrorType, which is just an enumerator that describes operation results as the following:
The NatNetClient class is the main component of the NatNet SDK. Using an instance of the NatNetClient class, you can establish a network connection with a server application (e.g. Motive) and query data descriptions, tracking data, and send/receive remote commands. For detailed declarations, refer to the NatNetClient.h header file included in the SDK.
Constructor: Creates a new instance of a NatNetClient class. Defaults to multicast connection if no input is given.
Constructor: Creates a new instance of a NatNet Client using the specified connection protocol; either unicast or multicast.
Input: iConnectionType: (0 = Multicast, 1 = Unicast).
Destructor: Destructor
ErrorCode Connect( const char* szLocalAddress, const char* szServerAddress );
ErrorCode Connect( const char* szLocalAddress, const char* szServerAddress, int hostCommandPort=0, const char* szMulticastAddress = 0 );
ErrorCode Disconnect();
ErrorCode SetFrameReceivedCallback( NatNetFrameReceivedCallback pfnDataCallback, void* pUserContext = 0 );
This method sets a frame handler function and creates a new thread for receiving and processing each frame of capture data.
typedef void (NATNET_CALLCONV* NatNetFrameReceivedCallback)(sFrameOfMocapData* pFrameOfData, void* pUserData);
ErrorCode SendMessageAndWait( const char* szRequest, void** ppServerResponse, int* pResponseSize );
ErrorCode SendMessageAndWait( const char* szRequest, int tries, int timeout, void** ppServerResponse, int* pResponseSize );
ErrorCode GetServerDescription( sServerDescription* pServerDescription );
int GetDataDescriptions( sDataDescriptions** pDataDescriptions );
double SecondsSinceHostTimestamp( uint64_t hostTimestamp ) const;
Once the NatNetSDK library has been imported into a client application, the following helper functions can be used.
These functions are available ONLY for C++ applications.
NATNET_API void NATNET_CALLCONV NatNet_GetVersion( unsigned char outVersion[4] );
NATNET_API void NATNET_CALLCONV NatNet_SetLogCallback( NatNetLogCallback pfnLogCallback );
typedef void (NATNET_CALLCONV* NatNetLogCallback)(Verbosity level, const char* message);
NATNET_API void NATNET_CALLCONV NatNet_DecodeID( int compositeId, int* pOutEntityId, int* pOutMemberId );
NATNET_API ErrorCode NATNET_CALLCONV NatNet_DecodeTimecode( unsigned int timecode, unsigned int timecodeSubframe, int* pOutHour, int* pOutMinute, int* pOutSecond, int* pOutFrame, int* pOutSubframe );
NATNET_API ErrorCode NATNET_CALLCONV NatNet_TimecodeStringify( unsigned int timecode, unsigned int timecodeSubframe, char* outBuffer, int outBufferSize );
NATNET_API ErrorCode NATNET_CALLCONV NatNet_CopyFrame( sFrameOfMocapData* pSrc, sFrameOfMocapData* pDst );
NATNET_API ErrorCode NATNET_CALLCONV NatNet_FreeFrame( sFrameOfMocapData* pFrame );