devices/devicecamera/ordevicecamera_hardware.h

devices/devicecamera/ordevicecamera_hardware.h
#ifndef __ORDEVICE_CAMERA_HARDWARE_H__
#define __ORDEVICE_CAMERA_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>
#ifdef KARCH_ENV_WIN
#include <windows.h>
#endif
class ORDeviceCamera_Template_Packet : public FBDeviceCameraPacket
{
public:
ORDeviceCamera_Template_Packet() : FBDeviceCameraPacket()
{
Data = 0;
Time = 0;
}
double Data;
FBTime Time;
};
class ORDeviceCamera_Template_Hardware
{
public:
ORDeviceCamera_Template_Hardware();
virtual ~ORDeviceCamera_Template_Hardware();
void SetDevice( FBDevice* pDevice ) { mDevice = pDevice; }
//--- 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 ();
//--- Communications
int GetCommunicationType() { return mDevice->CommType; }
void SetNetworkAddress (const char* pIPAddress){ mNetworkAddress = pIPAddress; }
const char* GetNetworkAddress () { return (char *)mNetworkAddress; }
void SetNetworkPort (int pPort) { mNetworkPort = pPort; }
int GetNetworkPort () { return mNetworkPort; }
void SetNetworkProtocol ( FBCommType pType ) { mNetworkProtocol = pType; }
FBCommType GetNetworkProtocol () { return mNetworkProtocol; }
void SetSerialPort (int pPort) { mSerialPort = pPort; }
int GetSerialPort () { return mSerialPort; }
void SetSerialBaudRate (int pRate) { mSerialBaudRate = pRate; }
int GetSerialBaudRate () { return mSerialBaudRate; }
void SetSharedMemoryHandle( const char* pHandle ){ mHandleName = pHandle; }
const char* GetSharedMemoryHandle() { return mHandleName; }
void SetSharedMemoryAddress( kReference pAddr) { mHandleAddress = pAddr; }
kReference GetSharedMemoryAddress() { return mHandleAddress; }
//--- Simulator functions
void SetSimulatorFrequency ( double pFrequency ) { mFrequency = pFrequency; }
double GetSimulatorFrequency () { return mFrequency; }
void SetSimulatorAmplitude ( double pAmplitude ) { mAmplitude = pAmplitude; }
double GetSimulatorAmplitude () { return mAmplitude; }
void SetSimulatorZoom ( double pZoom ) { mZoom = pZoom; }
double GetSimulatorZoom () { return mZoom; }
void SetSimulatorFocus ( double pFocus ) { mFocus = pFocus; }
double GetSimulatorFocus () { return mFocus; }
//--- Hardware setting
void SetHardwareSetting( double pSetting ) { mHardwareSetting = pSetting; }
double GetHardwareSetting( ) { return mHardwareSetting; }
//--- Packet query
FBTime GetTime() { return mDefaultPacket.Time; }
double GetData() { return mDefaultPacket.Data; }
FBVector3d GetRotation() { return mDefaultPacket.Rotation; }
FBVector3d GetPosition() { return mDefaultPacket.Position; }
FBVector2d GetOpticalCenter() { return mDefaultPacket.OpticalCenter; }
double GetFocus() { return mDefaultPacket.Focus; }
double GetZoom() { return mDefaultPacket.Zoom; }
long GetSync() { return mCounter; }
bool RealTimeUpdate();
private:
FBSystem mSystem;
int mCounter;
//--- Communications
FBCommPort mCommPort;
int mSerialPort;
int mSerialBaudRate;
FBTCPIP mTCPIP;
int mNetworkSocket;
FBString mNetworkAddress;
FBCommType mNetworkProtocol;
int mNetworkPort;
FBString mHandleName;
kReference mHandleAddress;
#ifdef KARCH_ENV_WIN
HANDLE mShmHandle;
#endif
//--- Simulator values
double mFrequency;
double mAmplitude;
double mZoom;
double mFocus;
//--- Hardware setting
double mHardwareSetting;
// reading information
ORDeviceCamera_Template_Packet mDefaultPacket;
FBDevice* mDevice;
};
#endif /* __ORDEVICE_CAMERA_HARDWARE_H__ */