void ZMQActor::readTasks() { while(_isReading) { ZMQMessage message; ZMQSocket::Error error; std::string id; std::string address; if (_actor.receive(message, error)) { if (message.data() == "ZMQActor::stopPerformingTasks") { break; } if (_taskCallBack) if (!_taskCallBack(message)) break; } else { break; } } ZMQ_LOG_INFO("ZMQActor::readTasks ENDED"); _isReading = false; }
bool ZMQActor::readReactorTasks(const std::string& id, const std::string& address, ZMQMessage& message) { std::ostringstream task; task << id << " " << address << " " << message.data(); ZMQMessage reactorMessage(task.str()); putTask(reactorMessage); return true; }
bool rx(ZMQSubscribeSocket &socket) { ZMQMessage msg; if (msg.recv(socket) == 0) return false; ZMQServoMessage *data = (ZMQServoMessage *)msg.data(); Servos::iterator j = servos.find(data->servoId); if (j != servos.end()) { switch(data->messageId) { case ZMQServoMessage::GET_ANGLE: j->second->presentAngle=data->value; break; case ZMQServoMessage::GET_TEMP: j->second->temp(data->value); break; } } return true; }