本文整理汇总了C++中imc::Message::setDestination方法的典型用法代码示例。如果您正苦于以下问题:C++ Message::setDestination方法的具体用法?C++ Message::setDestination怎么用?C++ Message::setDestination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imc::Message
的用法示例。
在下文中一共展示了Message::setDestination方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchReply
//! Dispatch message to the message bus in reply to another
//! message.
//! @param[in] original original message.
//! @param[in] msg message reference.
//! @param[in] flags bitfield with flags (see Tasks::DispatchFlags).
void
dispatchReply(const IMC::Message& original, IMC::Message& msg, unsigned int flags = 0)
{
msg.setDestination(original.getSource());
msg.setDestinationEntity(original.getSourceEntity());
dispatch(msg, flags);
}
示例2: dest
int
main(int argc, char** argv)
{
if (argc < 4)
{
fprintf(stderr, "DUNE message sender\n\n");
if (argc == 2 && (!strcmp(argv[1], "-l") || !strcmp(argv[1], "--list")))
{
fprintf(stdout, "Available Messages:\n");
fprintf(stdout, " [A]: Abort, AcousticMessage, AcousticOperation, AcousticSystemsQuery\n");
fprintf(stdout, " [B]: Brake, ButtonEvent\n");
fprintf(stdout, " [C]: CacheControl, Calibration, ClockControl, ControlLoops\n");
fprintf(stdout, " [D]: DataSanity, DesiredControl, DesiredHeading, DesiredHeadingRate, DesiredPitch,\n");
fprintf(stdout, " DesiredSpeed, DesiredRoll, DesiredZ, DevCalibrationControl, DevDataText\n");
fprintf(stdout, " [E]: EmergencyControl, EntityList, EntityState, EntityActivationState, EstimatedState\n");
fprintf(stdout, " [F]: FuelLevel\n");
fprintf(stdout, " [G]: GpsFix, GpsFixRtk\n");
fprintf(stdout, " [H]: Heartbeat\n");
fprintf(stdout, " [I]: IridiumMsgTx\n");
fprintf(stdout, " [L]: LblConfig, LblRange, LeaderState, LeakSimulation, LogBookControl, LogBookEntry,\n");
fprintf(stdout, " LoggingControl\n");
fprintf(stdout, " [M]: MagneticField, MonitorEntityState\n");
fprintf(stdout, " [O]: OperationalLimits\n");
fprintf(stdout, " [P]: PlanControl, PlanGeneration, PopEntityParameters, PowerChannelControl,\n");
fprintf(stdout, " PowerChannelState, PushEntityParameters\n");
fprintf(stdout, " [Q]: QueryEntityInfo, QueryEntityParameters\n");
fprintf(stdout, " [R]: RegisterManeuver, RemoteActions, RemoteActionsRequest, ReplayControl, ReportControl,\n");
fprintf(stdout, " RestartSystem\n");
fprintf(stdout, " [S]: SaveEntityParameters, SetEntityParameters, SetLedBrightness, SetServoPosition,\n");
fprintf(stdout, " SetThrusterActuation, Sms, SoundSpeed\n");
fprintf(stdout, " [T]: Target, TeleoperationDone, Temperature, TextMessage, TrexCommand\n");
fprintf(stdout, " [U]: UASimulation\n");
fprintf(stdout, " [V]: VehicleCommand, VehicleMedium\n");
return 1;
}
fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s <destination host> <destination port> <abbrev> [arguments]\n\n", argv[0]);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -l, --list Print list of acceptable messages\n\n\n");
return 1;
}
Address dest(argv[1]);
// Parse port.
unsigned port = 0;
if (!castLexical(argv[2], port))
{
fprintf(stderr, "ERROR: invalid port '%s'\n", argv[2]);
return 1;
}
if (port > 65535)
{
fprintf(stderr, "ERROR: invalid port '%s'\n", argv[2]);
return 1;
}
IMC::Message* msg = NULL;
if (strcmp(argv[3], "Abort") == 0)
{
msg = new IMC::Abort;
if (argc == 5)
msg->setDestination(atoi(argv[4]));
}
if (strcmp(argv[3], "AcousticMessage") == 0)
{
IMC::AcousticMessage* tmsg = new IMC::AcousticMessage;
msg = tmsg;
IMC::Message* imsg = IMC::Factory::produce(atoi(argv[4]));
tmsg->message.set(*imsg);
delete imsg;
}
if (strcmp(argv[3], "AcousticOperation") == 0)
{
IMC::AcousticOperation* tmsg = new IMC::AcousticOperation;
msg = tmsg;
tmsg->op = IMC::AcousticOperation::AOP_RANGE_RECVED;
tmsg->system = argv[4];
tmsg->range = atoi(argv[5]);
}
if (strcmp(argv[3], "AcousticSystemsQuery") == 0)
{
IMC::AcousticSystemsQuery* tmsg = new IMC::AcousticSystemsQuery;
msg = tmsg;
}
if (strcmp(argv[3], "Brake") == 0)
{
IMC::Brake* tmsg = new IMC::Brake;
msg = tmsg;
tmsg->op = atoi(argv[4]);
}
//.........这里部分代码省略.........