Add SIM phonebook entry over SMS

I want to add entries to the SIM phonebook by sending SMS to my Fasttrack supreme. I have created the functions…but they don’t do the trick. Has anyone done something similar before?

bool SMS_AUTO_Handler(ascii *SmsTel, ascii *SmsTimeOrLength, ascii *SmsText)
{

    bool sms_tobe_fwd = FALSE;

    //Keyword match, SETUP
    //SETUP syntax: setup add <number> <name>

    if(wm_strncmp( "setup",SmsText,5 ) == 0)
    {
    	adl_atSendResponse ( ADL_AT_UNS, "\r\n Keyword match\r\n" );
    	wm_strcpy( reply_number, SmsTel);
    	
    	
    		if(wm_strncmp( "add",SmsText+6,3 ) == 0)
			{
    			adl_atSendResponse ( ADL_AT_UNS, "\r\n Command match\r\n" );
    			//entry_pos=atoi(SmsText+11)
    			wm_strncpy(new_number, SmsText+10,8 );
    			wm_strcpy(entry_name,SmsText+19);
    			add_number();
    			if(smsSend_flag)
    			    	    	{
    								//Send SMS
    			    	    		auto_sendSms(reply_number,setup_txt);
    			    	    	}
			}
    	



    }
}

void add_number()
{
	adl_atCmdCreate("AT+CPBS?",ADL_AT_PORT_TYPE ( ADL_PORT_UART1, FALSE ), (adl_atRspHandler_t) number_storage_Handler,"+CPBS", NULL);



}

bool number_storage_Handler(adl_atResponse_t * response) {
	//Store number
	ascii *pos;
	ascii string[50];
	int number_pos=200;

	adl_atSendResponse ( ADL_AT_UNS, "\r\nStorage handler\r\n" );
	

	// Find the first ","
	pos=strchr(response->StrData,',');

	// number_pos = number of phonebook entries.
	number_pos=atoi(pos+1);

	//Create command string
	wm_sprintf(string,"AT+CPBW=%d,""%s"",""129"",""%s""",number_pos+1,new_number,entry_name);

	//Write new entry
	adl_atCmdCreate(string,ADL_AT_PORT_TYPE ( ADL_PORT_UART1, FALSE ), (adl_atRspHandler_t) number_add_Handler,"*", NULL);

    return FALSE;
}

I think I found the problem, the command string “string” looks like this after sprintf : AT+CPBW=5,55555555,129,ole

The " are not included even if they er double. Anyone know how the syntax suposed to be?

SOLVED: "

please share me the source code of this.
It is very interesting.
Did you compile it into .dwl file and then download into your wavecom product (into the Wireless CPU) or compile it into a windows application?

Thanks for your example, I am developing a similar application, I have to enter data on my SIM memory, your example has opened a great idea, but this is hard for me, could you share your code?

Thanks. :smiley:

He did share his code - in the very first post!

It’s in the box marked, “CODE” - the clue is in the name!

(corrections needed to that code were described in the following 2 posts)

I’m Sorry, You are smart.