00001 //=========================================================================== 00002 /* 00003 This file is part of the CHAI 3D visualization and haptics libraries. 00004 Copyright (C) 2003-2009 by CHAI 3D. All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License("GPL") version 2 00008 as published by the Free Software Foundation. 00009 00010 For using the CHAI 3D libraries with software that can not be combined 00011 with the GNU GPL, and for taking advantage of the additional benefits 00012 of our support services, please contact CHAI 3D about acquiring a 00013 Professional Edition License. 00014 00015 \author <http://www.chai3d.org> 00016 \author Francois Conti 00017 \version 2.0.0 $Rev: 251 $ 00018 */ 00019 //=========================================================================== 00020 00021 //--------------------------------------------------------------------------- 00022 #ifndef CVirtualDeviceH 00023 #define CVirtualDeviceH 00024 //--------------------------------------------------------------------------- 00025 #include "devices/CGenericHapticDevice.h" 00026 //--------------------------------------------------------------------------- 00027 #if defined(_ENABLE_VIRTUAL_DEVICE_SUPPORT) 00028 //--------------------------------------------------------------------------- 00029 00030 00031 //=========================================================================== 00039 //=========================================================================== 00040 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00041 struct cVirtualDeviceData 00042 { 00043 double ForceX; // Force component X. 00044 double ForceY; // Force component Y. 00045 double ForceZ; // Force component Z. 00046 double TorqueA; // Torque alpha. 00047 double TorqueB; // Torque beta. 00048 double TorqueG; // Torque gamma. 00049 double PosX; // Position X. 00050 double PosY; // Position Y. 00051 double PosZ; // Position Z. 00052 double AngleA; // Angle alpha. 00053 double AngleB; // Angle beta. 00054 double AngleG; // Angle gamma. 00055 bool Button0; // Button 0 status. 00056 bool AckMsg; // Acknowledge Message 00057 bool CmdReset; // Command Reset 00058 }; 00059 #endif // DOXYGEN_SHOULD_SKIP_THIS 00060 00061 00062 //=========================================================================== 00070 //=========================================================================== 00071 class cVirtualDevice : public cGenericHapticDevice 00072 { 00073 public: 00074 00075 //----------------------------------------------------------------------- 00076 // CONSTRUCTOR & DESTRUCTOR: 00077 //----------------------------------------------------------------------- 00078 00080 cVirtualDevice(); 00081 00083 virtual ~cVirtualDevice(); 00084 00085 00086 //----------------------------------------------------------------------- 00087 // METHODS: 00088 //----------------------------------------------------------------------- 00090 int open(); 00091 00093 int close(); 00094 00096 int initialize(const bool a_resetEncoders); 00097 00099 unsigned int getNumDevices(); 00100 00102 int getPosition(cVector3d& a_position); 00103 00105 int getRotation(cMatrix3d& a_rotation); 00106 00108 int getUserSwitch(int a_switchIndex, bool& a_status); 00109 00111 int setForce(cVector3d& a_force); 00112 00114 int getForce(cVector3d& a_force); 00115 00116 private: 00118 HANDLE m_hMapFile; 00119 00121 LPVOID m_lpMapAddress; 00122 00124 cVirtualDeviceData* m_pDevice; 00125 }; 00126 00127 //--------------------------------------------------------------------------- 00128 #endif 00129 //--------------------------------------------------------------------------- 00130 #endif // _ENABLE_VIRTUAL_DEVICE_SUPPORT 00131 //--------------------------------------------------------------------------- 00132