how to filter content of a received sms from GSM modem (AT commands)

Status
Not open for further replies.

Isuru Senarath

Member level 2
Joined
Apr 10, 2012
Messages
42
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,580
Hi all,
I need to filter received sms as follows.

If received sms contain "Route 2"
LCD must display : Line 1 = Route 2
Line 2 = message (received sms)

If received sms contain "Route 1"
LCD must display : Line 3 = Route 1
Line 4 = message (received sms)

I did successfully for Line 1 and line 2, How can I do it for line 3 and 4?

following is my code. I also attached a picture of received sms and AT commands

Code:
void read_text( unsigned char *msg,unsigned char *no ,unsigned char *time)
{
 	char i=0;
	unsigned char *temp;
	temp=msg;

	start:
	do
	msg++;
	while(*msg!='"');


	{

		if (i++==4){
		msg++;
		do
		*no++=*msg++; 
		while (*msg!='\"');
	}

		else
	{
		goto start;
	}


	}
	do
	msg++;
	while(*msg!='\n');
	msg++;
	do
	*temp++=*msg++;
	while(*msg!='\r'); // reaching at end of message
	*temp='\0';

	{
	if (*msg=='2');
	
lcdcmd(0x80); // 1st line address
lcdstr(rec_no); // array having receipt no
lcdcmd(0xC0); // 2nd line address
lcdstr(msg1); // array having message
	}

	if (*msg=='1');
	{
lcdcmd(0x94); // 3st line address
lcdstr(rec_no); // array having receipt no
lcdcmd(0xD4); // 4nd line address
lcdstr(msg1); // array having message
	}



}

 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…