How can I memorize the name of the owner of the number in the same command in addition to the phone number
String phone = "";
String name = " Marc";
sendATCommand("AT +CPBW=1,"" + phone + """,true);
How can I memorize the name of the owner of the number in the same command in addition to the phone number
String phone = "";
String name = " Marc";
sendATCommand("AT +CPBW=1,"" + phone + """,true);
you need to generate a c-string with
AT+CPBW=[<index>] [,<number>[,<type>[,<text>]]]
if I remember correctly type is 145 when the dialing requires the + (international number) otherwise it's 129 (there are other like 161,177)
AT+CPBW=1,"123456789",129,"John Doe"
the catch is that you need to have double quotes and you need to escape them \"
to have them inside a C++ string
the easiest way to generate that is to use String as you've started using those
String command = "AT+CPBW=1,\"";
command += phone;
command += "\",129,\"";
command += name;
sendATCommand(command.c_str(), true);
or use or sprintf() if you want to use the (better for memory) c-strings
thanks
I was confused by the double quotes, but I managed to write the command this way.
it's OK now.
sendATCommand ("AT+CPBW=1,\"" + phone + "\",129,\"Marc\"",true);
OK - yes that should do it too (it creates lots of small hidden Strings when you do concatenation this way, that's why the preferred method is using +=
instead)
I guess then sendATCommand() does expect a String and not a c-string as I thought it would
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.