View unanswered posts | View active topics It is currently Fri Oct 30, 2020 1:18 am

Reply to topic  [ 2 posts ] 
What happend to the sendMessageWithParm()-function? 
Author Message

Joined: Sat Aug 09, 2008 4:22 pm
Posts: 1
Post What happend to the sendMessageWithParm()-function?
hi everybody

I tested robotC in version 1.0 and wrote quite a long program with bluetooth communication between three NXTs. They connected automatically and sent messages to each other with the function called sendMessageWithParm(). The parameters were three integers called command, parameter1 and parameter2. So the final code line looked like that:
   sendMessageWithParm(command, parameter1, parameter2);

Now I bought the Single License and installed RobotC 1.05. I also downloaded the new firmware to the NXT. But my code didn't want to compile with the following error message:
**Error**:Procedure call Parameters don't match declaration for 'sendMessageWithParm(short &nMessage, short &nParm1, short &nParm2, short &nParm3)'

So I changed the variable-type and added a fourth one:

   sendMessageWithParm((short) command, (short) parameter1, (short) parameter2, (short) parameter3);

The programm know compiles but sends nothing over bluetooth and the error remains:

**Error**:Parameter   'sendMessageWithParm::command' index must   evaluation to   one   byte value
**Error**:Parameter   'sendMessageWithParm::parameter1' index must   evaluation to   one   byte value
**Error**:Parameter   'sendMessageWithParm::parameter2' index must   evaluation to   one   byte value
**Error**:Parameter   'sendMessageWithParm::parameter3' index must   evaluation to   one   byte value

Does anybody know what this means? In the documentation the messaging-functions vanished, there is no sample which uses this function, so I don't know what to change?

Sat Aug 09, 2008 4:33 pm

Joined: Fri Feb 09, 2007 9:21 am
Posts: 616
Post Re: What happend to the sendMessageWithParm()-function?
This is my fault. Sorry. I didn't realize that anyone was using this capability in ROBOTC. It was originally added to provide Bluetooth messaging support for ROBOLAB which uses a subset of the ROBOTC firmware and could not be easily extended to the more powerful and robust messaging functionality found in ROBOTC.

The best "solution" is to revise your code to use the more robust "bluetooth functions mentioned below. I'm a little reluctant to re-add to ROBOTC because the implementation was less robust with the possibility of dropped messages through buffer overflows which is less likely than the solution described here.

cCmdMessageWriteToBluetooth(nStream, pData, nLength, nQueueID)
cCmdMessageWriteToBluetooth(pData, nLength, nQueueID)

cCmdMessageRead(pData, nLengthToRead, nQueueID)

The easiest way is to write a small function with sames parameters as "SendMessageWithParms" that simply fills a struct with your messages parms and then sends as a message on 'nQueuieID' 1. This is essentially what the missing message function did.

Similarly, on the read side, you cann "GetSize" to see if there is a message. If so, call "cCmdeMessageRead" to read the message into same struct declaration as for send. Wrap both of these in a new function that is called whenever you want to read.

If you want, I'll write a version of these and send to you. Please communicate directly via email to on this as it will get a faster response from me.

I'm surprised that you mentioned three NXTs. You must be doing the external connection management within your program? I assume single master and two slaves. And the slaves only need to talk to master. Is communication only master to slave. Or is there slave to master messages as well. [Did we already talk about this?]

Wed Aug 13, 2008 3:26 am
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.