Skip to content

Commit

Permalink
Add cmd seperator to outgoing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamcat4 committed Mar 23, 2011
1 parent 24da507 commit 4a07947
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
7 changes: 4 additions & 3 deletions CmdMessenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ char* CmdMessenger::sendCmd(int cmdId, char *msg, boolean reqAc,
int tryCount = 0;
pauseProcessing = true;
//*comms << cmdId << field_separator << msg << endl;
comms->print(cmdId);
comms->print(field_separator);
comms->print(msg);
comms->print(cmdId);
comms->print(field_separator);
comms->print(msg);
comms->print(command_separator);
if(print_newlines)
comms->println(); // should append BOTH \r\n
if (reqAc) {
Expand Down
32 changes: 16 additions & 16 deletions CmdMessengerExample/CmdMessengerExample.pde
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ CmdMessenger cmdMessenger = CmdMessenger(Serial, field_separator, command_separa
//
// Expected output:
//
// 1,Arduino ready
// 1,bens cmd recieved
// 1,hi
// 1,heh
// 1,ho!
// 1,jerrys cmd recieved
// 1,"the bears are allright" encoded in base64...
// 1,dGhlIGJlYXJzIGFyZSBhbGxyaWdodA==
// 1,jerrys cmd recieved
// 1,what you send me, decoded base64...
// 1,the bears are allright
// 1,jerrys cmd recieved
// 1,what you send me, decoded base64...
// 1,those nasty control ;; characters ,,
// 1,Arduino ready
// 3,Unknown command
// 1,Arduino ready;
// 1,bens cmd recieved;
// 1,hi;
// 1,heh;
// 1,ho!;
// 1,jerrys cmd recieved;
// 1,"the bears are allright" encoded in base64...;
// 1,dGhlIGJlYXJzIGFyZSBhbGxyaWdodA==;
// 1,jerrys cmd recieved;
// 1,what you send me, decoded base64...;
// 1,the bears are allright;
// 1,jerrys cmd recieved;
// 1,what you send me, decoded base64...;
// 1,those nasty control ;; characters ,,;
// 1,Arduino ready;
// 3,Unknown command;
//


Expand Down

0 comments on commit 4a07947

Please sign in to comment.