How to make use of "Phonebook AT commands" effectively?


#1

Hello All,
I am new to the OAT. your help will be much appreciated.
Aim:

  1. FXT009 Modem should receive a text message : +447412334056 (phone number)

  2. I want to save that number into the memory, how to do that?
    I tried flashwrite and flashread API’s but didnt work it.

  3. I want to save that contact number into the phonebook using AT+CPBW=1, +447412334056

  4. Read the saved contact number at location , perform different tasks on that phone number like smssend etc

  5. I want to write and read upto 10 number, is it possible?

  6. To write into the phonebook, I am using following command,
    phonehandle1 = adl_atCmdSend((“AT+CPBW=55, +447412334056”),
    ( adl_atRspHandler_t ) phonewrite_handler1, “*”, NULL );
    I want to make “55” and “+447412334056” as a variable, is it possible, what is the correct way to do that?

  7. to read the phonebook, I am using following command,
    phonehandle2 = adl_atCmdSend((“AT+CPBR=1”),
    ( adl_atRspHandler_t ) phoneread_handler1, “*”, NULL );
    I want to make “1” as a variable, is it possible, what is the correct way to do that?

Thank you very much in advance.

Ganesh


#2

What you require can be done with standard ‘C’ string handling - nothing specific to OAT.

You need to build the command string - using standard ‘C’ techniques - and then pass the resulting string to adl_atCmdSend()

Note that the cast is unnecessary at best, and dangerous at worst.


#3
  1. ca you please give more information, how it can be done using C string handlings.?
  2. I tried to use “substr(rsp1, rsp, 9, 11);” this string function but in Dev Studio, gives error- Link error: undefined reference to `substr’ (I have included srting.h)

#4

Have a look at http://www.cplusplus.com/reference/cstring/ for C string functions. Also, have a look at http://www.cplusplus.com/reference/cstdio/ for formatted strings.

Here is an example of using variables in strings:

u8 cpbw_no = 55;
ascii * telNo = "+447412334056";
ascii at_cpbw[50];

sprintf(at_cpbr, "AT+CPBW=%d,%s", cpbr_no, telNo);

adl_atCmdSend(at_cpbr, phonewrite_handler1, "*", NULL );

and:

u8 cpbr_no = 1;
ascii at_cpbr[20];

sprintf(at_cpbr, "AT+CPBR=%d", cpbr_no);

adl_atCmdSend(at_cpbr, phoneread_handler1, "*", NULL );

#5

I think you should take some time to really learn the basics of ‘C’ before starting with Open-AT.

Trying to learn both at once is bound to be a struggle :exclamation:

‘C’ learning references and resources: blog.antronics.co.uk/2010/12/12


#6

thanks Awenil for the link.
Yes, I am learning basics of ‘C’ also going to join 5 days course in Feabhas ltd.


#7

Well, if you want some Open-AT training/consultancy…

:smiley:


#8

Thanks Awneil. Please inbox me the details of training/consultancy you provide.