27 #define NAME_READ "_Read" 28 #define NAME_WRITE "_Write" 35 const std::string& name,
const int* mode,
36 int16_t vt,
bool Read,
bool Write,
bool ID,
int Duration)
37 :
DensoBase(parent, service, handle, name, mode),
38 m_vt(vt), m_bRead(Read), m_bWrite(Write), m_bID(ID)
57 if(tmpName !=
"") tmpName.append(
"/");
162 boost::mutex::scoped_lock lockSrv(
m_mtxSrv);
168 Int32 varI; Float32 varF; Float64 varD;
169 String varS; Bool varIO;
170 Float32MultiArray varFArray;
171 Float64MultiArray varDArray;
185 if(vntRet->vt ==
m_vt) {
188 varI.data = vntRet->lVal;
192 varF.data = vntRet->fltVal;
196 varD.data = vntRet->dblVal;
204 varIO.data = (vntRet->boolVal !=
VARIANT_FALSE) ?
true :
false;
208 num = vntRet->parray->rgsabound->cElements;
210 varFArray.data.resize(num);
211 std::copy(pfltval, &pfltval[num], varFArray.data.begin());
216 num = vntRet->parray->rgsabound->cElements;
218 varDArray.data.resize(num);
219 std::copy(pdblval, &pdblval[num], varDArray.data.begin());
220 SafeArrayUnaccessData(vntRet->parray);
244 vntArgs.push_back(*vntHandle.get());
263 vntArgs.push_back(*vntHandle.get());
265 vntArgs.push_back(*value.get());
290 vntArgs.push_back(*vntHandle.get());
292 vntValue->vt =
VT_I4;
294 vntArgs.push_back(*vntValue.get());
309 vntVal->lVal = msg->data;
318 vntVal->fltVal = msg->data;
327 vntVal->dblVal = msg->data;
359 std::copy(msg->data.begin(), msg->data.end(), pval);
374 std::copy(msg->data.begin(), msg->data.end(), pval);
HRESULT SafeArrayUnaccessData(SAFEARRAY *psa)
#define ID_VARIABLE_GETVALUE
SAFEARRAY * SafeArrayCreateVector(uint16_t vt, int32_t lLbound, uint32_t cElements)
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::Publisher m_pubValue
HRESULT ExecPutValue(const VARIANT_Ptr &value)
void Callback_F32Array(const Float32MultiArray::ConstPtr &msg)
void Callback_ID(const Int32::ConstPtr &msg)
std::vector< VARIANT, VariantAllocator< VARIANT > > VARIANT_Vec
std::vector< uint32_t > Handle_Vec
HRESULT ExecPutID(const int id)
HRESULT StartService(ros::NodeHandle &node)
std::vector< BCAPService_Ptr > Service_Vec
void Callback_I32(const Int32::ConstPtr &msg)
void VariantInit(VARIANT *pvarg)
void Callback_String(const String::ConstPtr &msg)
static std::string ConvertBSTRToString(const BSTR bstr)
boost::interprocess::unique_ptr< VARIANT, variant_deleter > VARIANT_Ptr
HRESULT ExecGetValue(VARIANT_Ptr &value)
HRESULT SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
static BSTR ConvertStringToBSTR(const std::string &str)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void Callback_F32(const Float32::ConstPtr &msg)
ros::Subscriber m_subValue
#define ID_VARIABLE_PUTVALUE
DensoVariable(DensoBase *parent, Service_Vec &service, Handle_Vec &handle, const std::string &name, const int *mode, int16_t vt, bool Read, bool Write, bool ID, int Duration)
std::string RosName() const
void Callback_F64Array(const Float64MultiArray::ConstPtr &msg)
void Callback_Bool(const Bool::ConstPtr &msg)
void Callback_F64(const Float64::ConstPtr &msg)
#define ID_VARIABLE_PUTID