Hi,
I am doing this work for ST Ericsson modem.
Now i registered callback function for result handling and added quotes in
cmd. Now cmd is
AT+CPBW=10,"123456789",129,"Testing"
*Log message:*
Control @ Command is AT+CPBW=10,"123456789",129,"Testing"
Add New contact number in Sim
Status is 69
Saving contact on Sim is failed
*Code :*
static const char *cpbw_prefix[] = { "+CPBW:", NULL };
static void myResult(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
if(!ok)
printf(" Saving contact on Sim is failed\n");
}
static int new_contact(struct ofono_phonebook *pb,char
*num,ofono_phonebook_cb_t cb)
{
struct pb_data *pbd = ofono_phonebook_get_data(pb);
char cmd[50];int return_value;
sprintf(cmd,"AT+CPBW=10,\"%s\",129,\"Testing\"",
num);
printf("Command is %s\n",cmd);
return_value=g_at_chat_send(pbd->chat,cmd, cpbw_prefix,
myResult,NULL, NULL);
printf("Add New contact number in Sim\n Status is
%d\n",return_value);
return return_value;
}
Thanks
Yuvi R
On Mon, May 16, 2011 at 1:57 PM, Jeevaka Prabu Badrappan <
jeevakaprabu(a)gmail.com> wrote:
Hi Yuvi,
> On Mon, May 16, 2011 at 10:28 AM, Yuvaraj Ragupathi <
yuvaraj.addu(a)gmail.com> wrote:
> Hi All,
>
> I am trying to add new contact in sim via following sample code
>
>
> static int new_contact(struct ofono_phonebook *pb,char
*num,ofono_phonebook_cb_t cb)
> {
> struct pb_data *pbd = ofono_phonebook_get_data(pb);
> char cmd[50];int return_value;
> sprintf(cmd,"AT+CPBW=10,%s,129,Testing", num);
> printf("Command is %s\n",cmd);
> return_value=g_at_chat_send(pbd->chat,cmd, none_prefix,
> NULL,NULL, NULL);
> printf("Add New contact number in Sim\n Status is
%d\n",return_value);
> return return_value;
> }
>
I don't think there is any plan to support storing contacts to SIM
storage in the ofono core. Can be confirmed by
the Denis/Marcel.
As per the 27.007 spec,
+CPBW=[<index>][,<number>[,<type>[,<text>[,<group>[,<adnumber>[,<adtype>[,<secondtext>[,<email>[,<sip_uri>[,<tel_uri>[,<hidden>]]]]]]]]]]]
Possible response(s)
+CPBW: <written index>
+CME ERROR: <err>
Atleast as per the code, I notice that you are using none_prefix which
is not correct. Also you haven't given any callback function to handle
the result.
Regards,
Jeevaka
_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono