11#include <yarp/os/Bottle.h>
12#include <yarp/os/Value.h>
16using namespace yarp::os;
51 unsigned int l=replies.size();
58 MsgIt it=replies.begin();
60 while(it!=replies.end() && k<l)
62 FCMSG *r=
reinterpret_cast<FCMSG *
>(msgs[k].getPointer());
80 while(it!=boardList.end())
83 for(
unsigned int k=0;k<size;k++)
85 CanMessage &m=
const_cast<CanBuffer &
>(msgs)[k];
86 FCMSG *canM=
reinterpret_cast<FCMSG *
>(m.getPointer());
87 tmp->pushMessage(*canM);
100 cerr<<
"Opening FakeCan network" << endl;
104 int njoints=par.findGroup(
"GENERAL").find(
"Joints").asInt32();
105 Bottle &can = par.findGroup(
"CAN");
106 Bottle ids=can.findGroup(
"CanAddresses");
108 if (ids.size()<njoints/2)
110 fprintf(stderr,
"Check ini file, wrong number of board ids or joints\n");
114 for(
int i=1;i<=njoints/2;i++)
117 int id=ids.get(i).asInt32();
119 tmp->setReplyFifo(&replies);
121 boardList.push_back(tmp);
129 cerr<<
"Closing FakeCan network" << endl;
133 while(it!=boardList.end())
virtual bool open(yarp::os::Searchable &par)
virtual bool canSetBaudRate(unsigned int rate)
virtual bool canWrite(const CanBuffer &msgs, unsigned int size, unsigned int *sent, bool wait=false)
virtual bool canRead(CanBuffer &msgs, unsigned int size, unsigned int *read, bool wait=false)
virtual bool canIdAdd(unsigned int id)
virtual bool canGetBaudRate(unsigned int *rate)
virtual bool canIdDelete(unsigned int id)
std::list< FakeBoard * >::iterator BoardsIt
std::list< FCMSG >::iterator MsgIt