devices/devicecamera/ordevicecamera_device.h

devices/devicecamera/ordevicecamera_device.h
#ifndef __ORDEVICE_CAMERA_DEVICE_H__
#define __ORDEVICE_CAMERA_DEVICE_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 declaration
#include "ordevicecamera_hardware.h"
//--- Registration defines
#define ORDEVICECAMERATEMPLATE__CLASSNAME ORDeviceCamera_Template
#define ORDEVICECAMERATEMPLATE__CLASSSTR "ORDeviceCamera_Template"
class ORDeviceCamera_Template : public FBDeviceCamera
{
//--- FiLMBOX declaration
FBDeviceDeclare( ORDeviceCamera_Template, FBDeviceCamera );
public:
//--- FiLMBOX Construction/Destruction
virtual bool FBCreate();
virtual void FBDestroy();
//--- Standard FiLMBOX Device functions
virtual bool DeviceSyncAnimationNodeNotify ( FBAnimationNode* pAnimationNode, FBEvaluateInfo* pEvaluateInfo, int pCorrectedSync );
virtual void DeviceIONotify ( kDeviceIOs pAction, FBDeviceNotifyInfo &pDeviceNotifyInfo );
virtual bool DeviceOperation ( kDeviceOperations pOperation );
virtual void DeviceCameraEvalData ( FBDeviceNotifyInfo &pDeviceNotifyInfo );
virtual void RecordingDoneAnimation ( FBAnimationNode* pAnimationNode );
virtual bool ModelTemplateBindNotify ( FBModel* pModel, int pIndex, FBModelTemplate* pModelTemplate );
//--- Load/Save.
virtual bool FbxStore ( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat );
virtual bool FbxRetrieve( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat );
//--- Initialisation/Shutdown
bool Init();
bool Done();
bool Stop();
bool Start();
//--- Aggregation of hardware parameters
int GetCommunicationType() { return mHardware.GetCommunicationType(); }
void SetHardwareSetting(double pSetting) { mHardware.SetHardwareSetting( pSetting ); }
double GetHardwareSetting() { return mHardware.GetHardwareSetting(); }
//********* Communications: begin ***********
//--- Serial
void SetSerialPort (int pPort) { mHardware.SetSerialPort(pPort); }
int GetSerialPort () { return mHardware.GetSerialPort(); }
void SetSerialBaudRate (int pRate) { mHardware.SetSerialBaudRate(pRate); }
int GetSerialBaudRate () { return mHardware.GetSerialBaudRate(); }
//--- Network
void SetNetworkAddress (const char* pIPAddress){ mHardware.SetNetworkAddress(pIPAddress); }
const char* GetNetworkAddress () { return mHardware.GetNetworkAddress(); }
void SetNetworkPort (int pPort) { mHardware.SetNetworkPort(pPort); }
int GetNetworkPort () { return mHardware.GetNetworkPort(); }
void SetNetworkProtocol ( FBCommType pType ) { mHardware.SetNetworkProtocol(pType); }
FBCommType GetNetworkProtocol () { return mHardware.GetNetworkProtocol(); }
//--- Simulator
void SetSimulatorFrequency ( double pFrequency ) { mHardware.SetSimulatorFrequency( pFrequency ); }
double GetSimulatorFrequency () { return mHardware.GetSimulatorFrequency(); }
void SetSimulatorAmplitude ( double pAmplitude ) { mHardware.SetSimulatorAmplitude( pAmplitude ); }
double GetSimulatorAmplitude () { return mHardware.GetSimulatorAmplitude(); }
void SetSimulatorZoom ( double pZoom ) { mHardware.SetSimulatorZoom( pZoom ); }
double GetSimulatorZoom () { return mHardware.GetSimulatorZoom(); }
void SetSimulatorFocus ( double pFocus ) { mHardware.SetSimulatorFocus( pFocus ); }
double GetSimulatorFocus () { return mHardware.GetSimulatorFocus(); }
//--- Shared memory
void SetSharedMemoryHandle( const char* pHandle ) { mHardware.SetSharedMemoryHandle( pHandle ); }
const char* GetSharedMemoryHandle() { return mHardware.GetSharedMemoryHandle(); }
void SetSharedMemoryAddress( kReference pAddr) { mHardware.SetSharedMemoryAddress( pAddr ); }
kReference GetSharedMemoryAddress() { return mHardware.GetSharedMemoryAddress(); }
//********* Communications: end **************
//--- Recording
virtual void DeviceCameraRecordFrame( FBTime &pRecordTime, FBDeviceNotifyInfo& pNotifyInfo, ORDeviceCamera_Template_Packet* pPacket );
private:
FBSystem mSystem;
FBPlayerControl mPlayerControl;
ORDeviceCamera_Template_Hardware mHardware;
FBAnimationNode* mNodeCamera_InData;
// Packet recording
bool mFirstPacket;
FBTime mRecordStartTime;
FBTime mFirstPacketTime;
};
#endif /* __ORDEVICE_CAMERA_DEVICE_H__ */