void PlanningDisplay::onEnable()
{
  subscribe();
  advertise();
  load();
  robot_->setVisible(true);
}
Example #2
0
Force::Force(QObject *parent) :
	advTimer(),
	op(NULL),
	state(WaitingForAction),
    QObject(parent)
{
	selfName = QHostInfo::localHostName();

	// Create initial Jedi
	Jedi *j = new Jedi(0, selfName, QHostAddress(), this);
	jediIndex.append(j);
	jediMap[j->host()] = j;

	// Create UDP listening socket
	foreach(QHostAddress ia, QNetworkInterface::allAddresses()) {
		if(ia != ia.LocalHost && ia.protocol() == QAbstractSocket::IPv4Protocol) {
			s_out.bind(ia, udpPort, QUdpSocket::ShareAddress);
			break;
		}
	}

	s_in.bind(udpPort, QUdpSocket::ShareAddress);

	connect(&s_in, SIGNAL(readyRead()), this, SLOT(processDatagramsIn()));
	connect(&s_out, SIGNAL(readyRead()), this, SLOT(processDatagramsOut()));

	// Advertisment timer
	advTimer.setInterval(100);
	connect(&advTimer, SIGNAL(timeout()), this, SLOT(advertise()));
	advTimer.start();

	setState(WaitingForAction);
}
Example #3
0
void
PrefixUpdateProcessor::onCommandValidated(const std::shared_ptr<const ndn::Interest>& request)
{
  const ndn::Name& command = request->getName();
  const ndn::Name::Component& verb = command[COMMAND_PREFIX.size()];
  const ndn::Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1];

  if (verb == ADVERTISE_VERB || verb == WITHDRAW_VERB) {
    ndn::nfd::ControlParameters parameters;

    if (!extractParameters(parameterComponent, parameters)) {
      sendResponse(request, 400, "Malformed command");
      return;
    }

    if (verb == ADVERTISE_VERB) {
      advertise(request, parameters);
    }
    else if (verb == WITHDRAW_VERB) {
      withdraw(request, parameters);
    }

    sendResponse(request, 200, "Success");
  }
  else {
    sendResponse(request, 501, "Unsupported command");
  }
}
void PlanningDisplay::changedTopic()
{
  unsubscribe();
  unadvertise();
  kinematic_path_topic_ = topic_property_->getStdString();
  subscribe();
  advertise();
}
Example #5
0
emit(all, source) {
#ifdef ADVERTISE_PSYCERS
	if (source) advertise(source);
#endif
#ifdef _flag_log_sockets_IRC
	log_file("RAW_IRC", "%d %O\t-> %s", time(), ME, all);
#endif
	return ::emit(all);
}
Example #6
0
jus::Service::Service() :
  propertyIp(this, "ip", "127.0.0.1", "Ip to connect server", &jus::Service::onPropertyChangeIp),
  propertyPort(this, "port", 1982, "Port to connect server", &jus::Service::onPropertyChangePort) {
	
	
	advertise("getExtention", &jus::Service::getExtention);
	setLastFuncDesc("Get List of availlable extention of this service");
	addLastFuncReturn("A list of extention register in the service");
	
}
Example #7
0
ZeroconfPlugin::ZeroconfPlugin ( const QString& pluginId )
    : SipPlugin( pluginId )
    , m_zeroconf( 0 )
    , m_state( Disconnected )
    , m_cachedNodes()
{
    qDebug() << Q_FUNC_INFO;
    m_advertisementTimer.setInterval( 60000 );
    m_advertisementTimer.setSingleShot( false );
    connect( &m_advertisementTimer, SIGNAL( timeout() ), this, SLOT( advertise() ) );
}
Example #8
0
 bool Relay::changeOutputTopicCallback(
   jsk_topic_tools::ChangeTopic::Request &req,
   jsk_topic_tools::ChangeTopic::Response &res)
 {
   boost::mutex::scoped_lock lock(mutex_);
   output_topic_name_ = req.topic;
   if (sample_msg_) {          // we can advertise it!
     pub_ = advertise(sample_msg_, output_topic_name_);
   }
   return true;
 }
 virtual void sendEvent(const osgGA::GUIEventAdapter& event)
 {
     if (event.getName() == "/zeroconf/advertise")
     {
         std::string type;
         unsigned int port = 0;
         event.getUserValue("type",type);
         event.getUserValue("port", port);
         if (type.empty() || (port == 0))
         {
             OSG_WARN << "ZeroConfRegisterDevice :: could not advertise service, missing type/port " << std::endl;
         }
         else
         {
             advertise(type, port);
         }
     }
 }
Example #10
0
 void Relay::inputCallback(const boost::shared_ptr<topic_tools::ShapeShifter const>& msg)
 {
   boost::mutex::scoped_lock lock(mutex_);
   if (!advertised_) {
     // this block is called only once
     // in order to advertise topic.
     // we need to subscribe at least one message
     // in order to detect message definition.
     pub_ = advertise(msg, output_topic_name_);
     advertised_ = true;
     // shutdown subscriber
     sub_.shutdown();
     sample_msg_ = msg;
   }
   else if (pub_.getNumSubscribers() > 0) {
     pub_.publish(msg);
   }
 }
Example #11
0
/**
 * @brief Initializes data values and configures the sensor with desired modules
 * @param _device XsDevice from Xsens API
 */
mtiG::mtiG(XsDevice * _device, int argc, char ** argv):device(_device){

	ros::param::get("~override", override_settings);
	parseOptions(argc, argv);

	if(override_settings){
		//configures Xsensor device with mSettings
		ROS_DEBUG("OVERRIDE MODE");
		configure();
	}else{
		// uses the current device settings - to be used in conjunction with Windows GUI tool
		ROS_DEBUG("UNALTERED MODE");
	}
	readSettings();
	printSettings();
	sensorData = SensorData(mSettings);
	messageMaker = new MessageMaker(sensorData);
	// Advertise all messages published in this node, uses mSettings
	advertise();
}
Example #12
0
bool
ZeroconfPlugin::connectPlugin( bool /*startup*/ )
{
    delete m_zeroconf;
    m_zeroconf = new TomahawkZeroconf( Servent::instance()->port(), this );
    QObject::connect( m_zeroconf, SIGNAL( tomahawkHostFound( QString, int, QString, QString ) ),
                                    SLOT( lanHostFound( QString, int, QString, QString ) ) );

    advertise();
    m_state = Connected;

    foreach( const QStringList& nodeSet, m_cachedNodes )
    {
        if ( !Servent::instance()->connectedToSession( nodeSet[3] ) )
            Servent::instance()->connectToPeer( nodeSet[0], nodeSet[1].toInt(), "whitelist", nodeSet[2], nodeSet[3] );
    }
    m_cachedNodes.clear();

    m_advertisementTimer.start();

    return true;
}
Example #13
0
// Broadcast an advertisement packet with optional payload
// Data type will be 0xFF (Manufacturer Specific Data)
bool BTLE::advertise( void* buf, uint8_t buflen ) {
	return advertise(0xFF, buf, buflen);
}