AnimatLab  2
Test
RbLANWirelessInterface.cpp
1 // RbLANWirelessInterface.cpp: implementation of the RbLANWirelessInterface class.
2 //
4 
5 #include "StdAfx.h"
6 #include <stdarg.h>
7 #include "RbMovableItem.h"
8 #include "RbBody.h"
9 #include "RbJoint.h"
10 #include "RbRigidBody.h"
11 #include "RbStructure.h"
12 #include "RbLANWirelessInterface.h"
13 
14 // Defulat setting
15 #define DEFAULT_PORTNUM 3 // COM3
16 #define DEFAULT_BAUDNUM 1 // 1Mbps
17 #define DEFAULT_ID 1
18 
19 namespace RoboticsAnimatSim
20 {
21  namespace Robotics
22  {
23  namespace RobotInterfaces
24  {
25 
27 // Construction/Destruction
29 
30 RbLANWirelessInterface::RbLANWirelessInterface()
31 {
32 }
33 
34 RbLANWirelessInterface::~RbLANWirelessInterface()
35 {
36  try
37  {
38  }
39  catch(...)
40  {Std_TraceMsg(0, "Caught Error in desctructor of RbLANWirelessInterface\r\n", "", -1, false, true);}
41 }
42 
43 #pragma region DataAccesMethods
44 
45 float *RbLANWirelessInterface::GetDataPointer(const std::string &strDataType)
46 {
47  std::string strType = Std_CheckString(strDataType);
48 
49  //if(strType == "LIMITPOS")
50  // return &m_fltLimitPos;
51  //else
52  THROW_TEXT_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Robot Interface ID: " + STR(m_strName) + " DataType: " + strDataType);
53 
54  return NULL;
55 }
56 
57 bool RbLANWirelessInterface::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
58 {
59  std::string strType = Std_CheckString(strDataType);
60 
61  if(RobotInterface::SetData(strDataType, strValue, false))
62  return true;
63 
64  //if(strType == "PORT")
65  //{
66  // PortNumber((int) atoi(strValue.c_str()));
67  // return true;
68  //}
69  //else if(strType == "BAUDRATE")
70  //{
71  // BaudRate((int) atoi(strValue.c_str()));
72  // return true;
73  //}
74 
75  //If it was not one of those above then we have a problem.
76  if(bThrowError)
77  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
78 
79  return false;
80 }
81 
82 void RbLANWirelessInterface::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
83 {
84  RobotInterface::QueryProperties(aryProperties);
85 
86  //aryNames.Add("ComPort");
87  //aryTypes.Add("Integer");
88 
89  //aryNames.Add("BaudRate");
90  //aryTypes.Add("Integer");
91 }
92 
93 #pragma endregion
94 
95 
97 {
98  RobotInterface::Initialize();
99 }
100 
102 {
103  RobotInterface::StepSimulation();
104 }
105 
107 {
108  RobotInterface::Load(oXml);
109 
110 }
111  } //RobotInterfaces
112  } // Robotics
113 } //RoboticsAnimatSim
114 
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
virtual void StepSimulation()
Step the simulation for this object.
Declares the vortex structure class.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
A standard xml manipulation class.
Definition: StdXml.h:19
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual float * GetDataPointer(const std::string &strDataType)
Returns a float pointer to a data item of interest in this object.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
std::string m_strName
The name for this object.
Definition: AnimatBase.h:61