在Excel中读取Java生成的RTI DDS数据
我正在查看用于Excel的RTI DDS外接程序,并试图重写它附带的Hello_simple HelloupBlisher.java示例,以发布字符串,并让Excel获取它。 除了显示我输入的字符串的值之外,一切都正常。(它会拾取消息发送的时间,所有其他元数据都很好) 我的代码如下所示:在Excel中读取Java生成的RTI DDS数据,java,excel,data-distribution-service,Java,Excel,Data Distribution Service,我正在查看用于Excel的RTI DDS外接程序,并试图重写它附带的Hello_simple HelloupBlisher.java示例,以发布字符串,并让Excel获取它。 除了显示我输入的字符串的值之外,一切都正常。(它会拾取消息发送的时间,所有其他元数据都很好) 我的代码如下所示: public class Publish { public static void main(final String[] args){ // Create the DDS Domain partic
public class Publish {
public static void main(final String[] args){
// Create the DDS Domain participant on domain ID 123
final DomainParticipant participant = DomainParticipantFactory.get_instance().create_participant(
123, //Domain ID
DomainParticipantFactory.PARTICIPANT_QOS_DEFAULT,
null, // Listener
StatusKind.STATUS_MASK_NONE);
if (participant == null) {
System.err.println("Unable to create domain participant");
return;
}
// Create the topic "Message" for the String type
final Topic topic = participant.create_topic(
"Message",
StringTypeSupport.get_type_name(),
DomainParticipant.TOPIC_QOS_DEFAULT,
null, // listener
StatusKind.STATUS_MASK_NONE);
if (topic == null) {
System.err.println("Unable to create topic.");
return;
}
// Create the data writer using the default publisher
final StringDataWriter dataWriter =
(StringDataWriter) participant.create_datawriter(
topic,
Publisher.DATAWRITER_QOS_DEFAULT,
null, // listener
StatusKind.STATUS_MASK_NONE);
if (dataWriter == null) {
System.err.println("Unable to create data writer\n");
return;
}
System.out.println("Ready to write data.");
System.out.println("When the subscriber is ready, you can start writing.");
System.out.print("Press CTRL+C to terminate or enter an empty line to do a clean shutdown.\n\n");
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
while (true) {
System.out.print("Please type a message> ");
final String value = reader.readLine();
if (value == null) {break;}
dataWriter.write(value, InstanceHandle_t.HANDLE_NIL);
if (value.equals("")) { break; }
}
} catch (final IOException e) {e.printStackTrace();
} catch (final RETCODE_ERROR e) {e.printStackTrace();}
System.out.println("Exiting...");
participant.delete_contained_entities();
DomainParticipantFactory.get_instance().delete_participant(participant);
}
}
我在Excel中调用以显示该值是
=RTD("dds2excel.connect",,"TYPE:DDS::String","TYPENAME:DDS::String","TOPIC:Message","FIELD:value")
(由RTI加载项自动生成)
我还不太熟悉RTI和DDS,但我感觉Excel不想获取这些数据的实际内容,因为它认为这些数据不属于它?因此,它只承认它正在侦听的域的元数据
任何提示都将不胜感激。在RTI社区论坛上,您是否尝试过命令行工具提供的功能?当您使用参数
-printSample
运行更新时,它应该打印出更新的内容。不要忘记通过-domainid123
使用正确的域id。