CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Receive SMS with Picdem.net 2 and a gsmModem via RS232
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Mon Apr 08, 2013 8:52 am     Reply with quote

Hi,

After I've parsed my TXT message into a string, I do something like this to see if I have a valid command:

Code:

   // Here we test for the 'Output 1' Cmd
   if (strstr(Msg2, CMD1))
   {
      if (strstr(Msg2, CMD4))         // Here we test for the 'On' Cmd
      {   
         Output1_Status = True;
         ReplyMsgType = 1;
      }
      else if (strstr(Msg2, CMD5))   // Here we test for the 'Off' Cmd
      {   
         Output1_Status = False;
         ReplyMsgType = 1;   


I've previously defined my commands like this:
Code:


char CMD1[] = "OUTPUT 1 ";
char CMD4[] = "ON";
char CMD5[] = "OFF";



First, I check for the presence of the "OUTPUT 1" in the string, and then I check for "ON" or "OFF". Note, I use the toupper command to put everything in the MSG2 array in upper case, so it doesn't matter how the user sends it!

John
jojo337



Joined: 05 Apr 2013
Posts: 8

View user's profile Send private message

PostPosted: Wed Apr 10, 2013 12:28 am     Reply with quote

Hi. Thanks ! I think that it is the function that we searched Smile.

We got a problem with the "help function" (f1) of PCW compiler. But finally we reinstall it and it works fine, and we found the STRSTR function on it. It will help us a lot. Thanks.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group