Download Print this page

Sony Ericsson Controller Mode Application Note page 10

Embedded application

Advertisement

LZT 123 8015 R1A
Embedded applications controller mode
{
char SMS_Buf[SMSBUFSIZE];
int CurrRec = 0;
int CurrLen = 0;
int Len;
prs(0);
/*restore and open db*/
if(dbadm(1) != db_id)
{
/*db error - return to Controller Mode!*/
rst(1);
}
mset(SMS_Buf,0,SMSBUFSIZE);
while(gtb(REG_STATUS) != REGISTERED);
prtf("\n Registered!");
/*Send SMS's with IO Data Retrieved*/
CurrRec = dbfnd(db_id,1,0,NEW_FLAG,0,0);
while(CurrRec != 0)
{
Len = dbget(db_id,CurrRec,SMS_Buf + CurrLen);
CurrLen = CurrLen + Len;
if(CurrLen >= SMSBUFSIZE)
{
prtf("\n Too Much Data!");
break;
}
dbdel(db_id,CurrRec);
CurrRec = dbfnd(db_id,1,0,NEW_FLAG,0,0);
}
if(slen(SMS_Buf) > 0)
{
int err;
atcrt();
prtf("\n SMS String = %s",SMS_Buf);
err = smss(SMS_NUMBER,SMS_Buf,129,slen(SMS_NUMBER),SMSBUFSIZE);
if(err != 0)
{
prtf("\n Failed sending SMS!");
}
atdst();
}
rst(1); /* reset in Controller Mode */
}
/*Main Function*/
main()
{
if(gtf(CONTROLLER_MODE))
{
DoControl();
}
else
{
DoGSM();
}
}
10

Advertisement

loading