Problem with AT^SJNET on TC65i

449 views
Skip to first unread message

Nikita Kapitonov

unread,
Feb 17, 2010, 5:53:22 AM2/17/10
to Cinterion Java enabled chips support
Hello, guys! I had successfully developed a monitoring application on
TC65i, but there is a problem when I try to set a java internet
profile via AT^SJNET inside java program.

When executing the code

String apn = "\"gprs\",\"internet\",\"gdata\",\"gdata\",,0";
System.out.println(atcommand.send( "AT^SJNET=" + apn +
"\r" ));

,it always return

>AT^SJNET="gprs","internet","gdata","gdata",,0
>
>
>ERROR

but when I execute the same command directly using terminal program,
it always says

>Sent: AT^SJNET="gprs","internet","gdata","gdata",,0
>
>OK

I've found a workaround and connecting to internet via URL parameters
and everything is ok

String destHost = "www.myhost.ru";
String scriptPath = "/debug/setvalue.php";
String connProfile =
"bearer_type=gprs;access_point=internet;username=gdata;password=gdata";
String openParm = "http://" + destHost + scriptPath + ";" +
connProfile;
System.out.println("Connector open: " + openParm);
postViaHttpConnection(openParm, params);

int postViaHttpConnection(String url, FormField[] formdata) throws
IOException {
HttpConnection c = null;
InputStream is = null;
OutputStream os = null;
int rc;

try {
c = (HttpConnection) Connector.open(url);
.........................and so on........

it returns no error and successfully posts a form

>Connector open: http://www.myhost.ru/debug/setvalue.php;bearer_type=gprs;access_point=internet;username=gdata;password=gdata

I think that using AT^SJNET is better way connecting to net, but I
still can't understand what I'm doing wrong. Anybody have thoughts
about this?

Ricardo Guilherme Schmidt

unread,
Feb 17, 2010, 9:48:49 AM2/17/10
to java...@googlegroups.com
Hello Nikita, something very useful is to enable textual error message
with AT+CMEE=2 (I think the parameter is 2, if it throws an error, use
1).
Then show us up what you got with that. I think it may be syntax error.
Try sending this:

AT^SJNET="gprs","internet","gdata","gdata","",0
with this:
String apn = "\"gprs\",\"internet\",\"gdata\",\"gdata\",\"\",0";

Maybe number zero may need the "".
String apn = "\"gprs\",\"internet\",\"gdata\",\"gdata\",\"\",\"0\"";

I think this should solve your syntax problem.

Nikita Kapitonov

unread,
Feb 17, 2010, 1:03:56 PM2/17/10
to Cinterion Java enabled chips support
Ricardo, thank you for your answer!

Your AT+CMEE=2 advice is cool, I didn't know that!
The original string returns that:

| AT^SJNET="gprs","internet","gdata","gdata",,0
|

| +CME ERROR: invalid input value

Unfortunately, inserting quotes in DNS field didn't help:

| AT^SJNET="gprs","internet","gdata","gdata","",0
|

| +CME ERROR: invalid input value


enquoting the 0 didn't help, it returns the same thing:

| AT^SJNET="gprs","internet","gdata","gdata","","0"
|

| +CME ERROR: invalid input value

even if I try not to set DNS and timeout, still:

| AT^SJNET="gprs","internet","gdata","gdata"
|

| +CME ERROR: invalid input value

Note that when I execute the same command directly using terminal
program,
it says OK

tried to play with APN, LOGIN and PASSWORD parameters - no use :-(

Other suppositions?

> > >Connector open:http://www.myhost.ru/debug/setvalue.php;bearer_type=gprs;access_point...

Florent Clairambault

unread,
Feb 17, 2010, 2:26:25 PM2/17/10
to java...@googlegroups.com
   EE don't always help a lot. They're just the translation of an error id, so they won't give you the detail of the error. It might be just a special char you have in your program string due to your editor or a weird copy/past.

   I don't have a solution but if I were you I would read the data on the console and send the AT Command at each '\r' or '\n' char so that you can really check that it's just the java context that messes up everything. I'm little bit skeptical about that.

   Anyway, your AT Command seems ok.

   I like to use the AT^SJNET but I don't think specifying these settings in the Connector.open method is a worse approach. It might just make a difference on the first TCP/UDP connection establishment time (as you only specify what network you will use when you open the connection).

--
Florent Clairambault



--
You received this message because you are subscribed to the Google Groups "Cinterion Java enabled chips support" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javacint+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javacint?hl=en.


Ricardo Guilherme Schmidt

unread,
Feb 17, 2010, 2:39:13 PM2/17/10
to java...@googlegroups.com
Nikita, if in terminal the command works fine, it should work fine sent by java application (there is no reason to not work). Also, according to the documentation it should not send just an "OK", but an answer with the confirmating new configuration

Please discard the hyperlinks in the email from the copy-paste.

Write Command AT^SJNET=<bearer service>, <entry point>, <login>, <password>[,<dns>][, <timeout>] Response(s)

^SJNET: <bearer service>, <entry point>, <login>, <password>, <dns>, <timeout> OK

(or if error) ERROR
(on CMEE > 0) +CME ERROR: <err>

Take a look in the following: IDS: 5 Maintenance > 5.1 IP Service
IDS: 4 Software Platform > 4.2 Interfaces > 4.2.8 JVM Interfaces IDS: 21. Java related Commands > 21.2 AT^SJNET   Set Dialup Network Access Parameters Class com.siemens.icm.io.BearerControl

The error is clear, says that some value is invalid. Try using other configurations and some DNS like from http://www.opendns.com/
Maybe the function that you use to send the ATCommand is sending something wrongly? Maybe this function need to be set not by Java application...

Nikita Kapitonov

unread,
Feb 17, 2010, 4:20:24 PM2/17/10
to Cinterion Java enabled chips support
Florent,
what I'm thinking about when I try AT^SJNET instead of Connector.open
url parameters - is that I don't know what really happens with GPRS
connection. I'm worrying that when I send a little data every time I
open Connector and then close it - then GPRS session is closed too, so
the GSM Operator will cost this as 1 GPRS session of typical
granularity 100 kB (however I've sent just 1 kB).

If you know how to ensure that GPRS session is not closed as much as
it can while using Connector.open url parameters to open GPRS
connection, please tell me!

--
Nikita

> > javacint+u...@googlegroups.com<javacint%2Bunsubscribe@googlegroups.c­om>

Nikita Kapitonov

unread,
Feb 18, 2010, 1:21:57 AM2/18/10
to Cinterion Java enabled chips support
Thank you all for help! I think I've found the problem - it's still
weird, but I know what causes the AT^SJNET command to fail.

It is AT+CSCS="UCS2" command! Before I use it, AT^SJNET works good,
but after I set the encoding to UCS2, AT^SJNET fails. If I set the
encoding to GSM with AT+CSCS="GSM", then AT^SJNET returns OK - maybe
it wants me to send parameters of AT^SJNET as IRA characters?.. I
think, I'll just change the encoding to GSM in my program before
setting AT^SJNET.

> > > javacint+u...@googlegroups.com<javacint%2Bunsubscr...@googlegroups.c­om>

Reply all
Reply to author
Forward
0 new messages