|
Fast Research Interface Library
Manual and Documentation
|
00001 // ---------------------- Doxygen info ---------------------- 00051 // ---------------------------------------------------------- 00052 // For a convenient reading of this file's source code, 00053 // please use a tab width of four characters. 00054 // ---------------------------------------------------------- 00055 00056 00057 #include <FastResearchInterface.h> 00058 #include <pthread.h> 00059 #include <friComm.h> 00060 00061 00062 // **************************************************************** 00063 // SetKRLBoolValues() 00064 // 00065 void FastResearchInterface::SetKRLBoolValues(const bool *KRLBoolValues) 00066 { 00067 unsigned int i = 0; 00068 00069 pthread_mutex_lock(&(this->MutexForControlData)); 00070 for (i = 0; i < FRI_USER_SIZE; i++) 00071 { 00072 if (KRLBoolValues[i]) 00073 { 00074 this->CommandData.krl.boolData |= (1 << i); 00075 } 00076 else 00077 { 00078 this->CommandData.krl.boolData &= ( ~( 1 << i) ); 00079 } 00080 } 00081 pthread_mutex_unlock(&(this->MutexForControlData)); 00082 00083 return; 00084 } 00085 00086 00087 // **************************************************************** 00088 // SetKRLIntValues() 00089 // 00090 void FastResearchInterface::SetKRLIntValues(const int *KRLIntValues) 00091 { 00092 unsigned int i = 0; 00093 00094 pthread_mutex_lock(&(this->MutexForControlData)); 00095 for (i = 0; i < FRI_USER_SIZE; i++) 00096 { 00097 this->CommandData.krl.intData[i] = KRLIntValues[i]; 00098 } 00099 pthread_mutex_unlock(&(this->MutexForControlData)); 00100 00101 return; 00102 } 00103 00104 00105 // **************************************************************** 00106 // SetKRLFloatValues() 00107 // 00108 void FastResearchInterface::SetKRLFloatValues(const float *KRLFloatValues) 00109 { 00110 unsigned int i = 0; 00111 00112 pthread_mutex_lock(&(this->MutexForControlData)); 00113 for (i = 0; i < FRI_USER_SIZE; i++) 00114 { 00115 this->CommandData.krl.realData[i] = KRLFloatValues[i]; 00116 } 00117 pthread_mutex_unlock(&(this->MutexForControlData)); 00118 00119 return; 00120 } 00121 00122 00123 // **************************************************************** 00124 // SetKRLBoolValue() 00125 // 00126 void FastResearchInterface::SetKRLBoolValue( const unsigned int &Index 00127 , const bool &Value ) 00128 { 00129 pthread_mutex_lock(&(this->MutexForControlData)); 00130 if (Value) 00131 { 00132 this->CommandData.krl.boolData |= (1 << Index); 00133 } 00134 else 00135 { 00136 this->CommandData.krl.boolData &= ( ~( 1 << Index) ); 00137 } 00138 pthread_mutex_unlock(&(this->MutexForControlData)); 00139 return; 00140 } 00141 00142 00143 // **************************************************************** 00144 // SetKRLIntValue() 00145 // 00146 void FastResearchInterface::SetKRLIntValue( const unsigned int &Index 00147 , const int &Value ) 00148 { 00149 pthread_mutex_lock(&(this->MutexForControlData)); 00150 this->CommandData.krl.intData[Index] = Value; 00151 pthread_mutex_unlock(&(this->MutexForControlData)); 00152 return; 00153 } 00154 00155 00156 // **************************************************************** 00157 // SetKRLFloatValue() 00158 // 00159 void FastResearchInterface::SetKRLFloatValue( const unsigned int &Index 00160 , const float &Value ) 00161 { 00162 pthread_mutex_lock(&(this->MutexForControlData)); 00163 this->CommandData.krl.realData[Index] = Value; 00164 pthread_mutex_unlock(&(this->MutexForControlData)); 00165 return; 00166 } 00167