OpenSplice Community Edition - Chatter PreviousNext
Data Distribution Service (DDS) Forum > DDS Technical Forum >
Message/Author
Next message Jonathan  posted on Monday, January 25, 2010 - 08:33 pm
I'm new to DDS trying to modify the OpenSplice chatter tutorial example to add a new field to the topic.

I've modified Chat.idl and added a new variable to ChatMessage,

struct ChatMessage {
long userID;
long index;
string content;
string testString; // the new var
};

and then also to NameService struct to include the same addition as above.

I've then updated the Chatter.c code such that it sets the new var via,

msg->testString = DDS_string_alloc(MAX_MSG_LEN);
checkHandle(msg->testString, "DDS_string_alloc");
sprintf_s (msg->testString, MAX_MSG_LEN, "TEST STRING");

and left the rest of it the same, such that it sends it out as before. I then
changed the MessageBoard.c code such that it prints out the new variable when received.

The problem is this variable is never set and I've tried other types such int and double,

but these are never received/set as well.

What is it I'm doing wrong?

Any help would be greatly appreciated.

Thanks,

Jon.
Next message Erik Hendriks  posted on Tuesday, January 26, 2010 - 09:33 am
Hi Jon,

In the Chatter tutorial example, the MessageBoard and the Chatter do not attach to the same topic. The Chatter publishes the ChatMessage topic, but the MessageBoard subscribes to the NamedMessage topic.

The NamedMessage topic in this case simulates the behaviour of a multitopic that merges data from both the NameService and the ChatMessage into 1 combined datatype called NamedMessage. The merge process is performed in the multitopic.c file.

If the string you added to ChatMessage should become visible to the MessageBoard as well, you should add such a string to the NamedMessage datatype as well, and make sure the merge function in multitopic.c also copies the testString from ChatMessage to NamedMessage.

Hope that solves your problem.

Regards,
Erik.
Next message Jonathan  posted on Tuesday, January 26, 2010 - 03:11 pm
Genius.

Didn't see that.

Thanks very very much!
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Post as "Anonymous"
Enable HTML code in message
Automatically activate URLs in message
Action: