devices/devicesync/ordevicesync_hardware.h

devices/devicesync/ordevicesync_hardware.h
#ifndef __ORDEVICE_SYNC_HARDWARE_H__
#define __ORDEVICE_SYNC_HARDWARE_H__
/***************************************************************************************
Autodesk(R) Open Reality(R) Samples
(C) 2009 Autodesk, Inc. and/or its licensors
All rights reserved.
AUTODESK SOFTWARE LICENSE AGREEMENT
Autodesk, Inc. licenses this Software to you only upon the condition that
you accept all of the terms contained in the Software License Agreement ("Agreement")
that is embedded in or that is delivered with this Software. By selecting
the "I ACCEPT" button at the end of the Agreement or by copying, installing,
uploading, accessing or using all or any portion of the Software you agree
to enter into the Agreement. A contract is then formed between Autodesk and
either you personally, if you acquire the Software for yourself, or the company
or other legal entity for which you are acquiring the software.
AUTODESK, INC., MAKES NO WARRANTY, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE REGARDING THESE MATERIALS, AND MAKES SUCH MATERIALS AVAILABLE SOLELY ON AN
"AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC., BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE
OR USE OF THESE MATERIALS. THE SOLE AND EXCLUSIVE LIABILITY TO AUTODESK, INC.,
REGARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THE
MATERIALS DESCRIBED HEREIN.
Autodesk, Inc., reserves the right to revise and improve its products as it sees fit.
Autodesk and Open Reality are registered trademarks or trademarks of Autodesk, Inc.,
in the U.S.A. and/or other countries. All other brand names, product names, or
trademarks belong to their respective holders.
GOVERNMENT USE
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as
set forth in FAR 12.212 (Commercial Computer Software-Restricted Rights) and
DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Manufacturer is Autodesk, Inc., 10 Duke Street, Montreal, Quebec, Canada, H3C 2L7.
***************************************************************************************/
//--- SDK include
#include <fbsdk/fbsdk.h>
class ORDeviceSync_Template_Packet : public FBDeviceSyncPacket
{
public:
ORDeviceSync_Template_Packet() : FBDeviceSyncPacket()
{
Data = 0;
Time = 0;
}
double Data;
FBTime Time;
};
class ORDeviceSync_Template_Hardware
{
public:
ORDeviceSync_Template_Hardware();
virtual ~ORDeviceSync_Template_Hardware();
//--- Opens and closes connection with data server. returns true if successful
bool Init ();
bool Open ();
bool Close ();
bool Done ();
//--- Channel information
// After the connection has been established with the Open call
// This call will retreive all channel information (type, name, etc...)
bool GetSetupInfo();
// Streaming functions
// Once connection is established and information packets have been received
// these functions start and stops the data streaming
bool StartDataStream();
bool StopDataStream();
//--- Non blocking read of data stream which fills mChannel[] with a new data packet.
// Returns true if a new data frame is ready
bool FetchDataPacket ();
//--- Attribute management.
void SetServerAddress (char *pIPAddress) { mServerAddress = pIPAddress; }
char* GetServerAddress () { return mServerAddress; }
void SetServerPort (int pPort) { mServerPort = pPort; }
int GetServerPort () { return mServerPort; }
void SetSerialPort (int pPort) { mSerialPort = pPort; }
int GetSerialPort () { return mSerialPort; }
//--- Packet query
FBTime GetTime() { return mDefaultPacket.Time; }
double GetData() { return mDefaultPacket.Data; }
long GetSync() { return mCounter; }
private:
FBSystem mSystem;
FBString mServerAddress;
int mServerPort;
int mSerialPort;
long mCounter;
// reading information
ORDeviceSync_Template_Packet mDefaultPacket;
};
#endif /* _FB_SIMPLECAMERA_HARDWARE_H_ */