You are here

Concept Board: Internet Services - basics

Tutorial, March 25, 2014 - 1:07pm, 15584 views

This is part of tutorial series for Internet Services usage on Gemalto Concept Board:

General overview

EHS6 has an embedded TCP/IP stack that is driven by AT commands and enables the host application to easily access the Internet. The advantage of this solution is that it eliminates the need for the application manufacturer to implement own TCP/IP and PPP stacks, thus minimizing cost and time to integrate Internet connectivity into a new or existing host application.

Please note that although other Gemalto products also offer Internet Services feature, the configuration and usage may vary. Feel free to inspire with this tutorial, but always refer to corresponding AT Command Set when configuring Internet Service for other products.

With EHS6 following Internet Services may be used:

  • Non-Transparent/Transparent TCP client
  • Non-Transparent/Transparent TCP listener
  • Non-Transparent/Transparent UDP client
  • Non-Transparent UDP endpoint
  • FTP client
  • HTTP client
  • SMTP client 

How to start?

As an example we will configure Non-Transparent TCP client accessing Internet over GPRS0. According to AT Command Set documentation there are generally two strategies in using Internet Services - polling mode and URC-driven mode. For example purposes URC-driven mode will be used, so before start, please make sure that AT^SCFG="Tcp/WithURCs" is set to "on".

All Internet Services are configured and used according to following scheme:

  1. Configuring Internet Connection and Internet Service
  2. Opening Internet Service
  3. Reading from/writing to internet service
  4. Closing Internet Service

Please find step by step instruction below.

Configuration of Internet Connection

Before Internet network resources can be accessed, connection profile must be configured.

Connection profile determines which access technology will be used for establishing Internet connection (for EHS6 only GPRS0 is available) and defines APN. User and password may also be passed if required.

Up to six connection profiles may be configured (under ids from range 0-5).

AT^SICS command is used to configure connection profile. General syntax for this command is as follows:

AT^SICS=<conProfileId>,<conParmTag>,<conParmValue>

where:

  • <conProfileId> is the id of the connection,
  • <conParmTag> is connection parameter name,
  • <conParmValue> is value of above parameter.

Please input below AT commands to setup the connection:

AT^SICS=0,"conType","GPRS0"

Above command sets the 0th profile to access network over GPRS0.

AT^SICS=0,"apn","internet"

Above command sets the 0th profile to use access point name equal "internet" (quotes omitted).

If network operator doesn't require passing user and password, after setting proper APN the connection should work. For other configuration options, please refer to description of <conParmTag> in AT command set.

Configuration of Internet Service

As Internet Connection has been already configured, you can setup Internet Service. As an example TCP client will be used. To setup Internet Service AT^SISS command is used. General syntax for this command is as follows:

AT^SISS=<srvProfileId>,<srvParmTag>,<srvParmValue>

where:

  • <srvProfileId> is the id of the service (don't mix up with connection id),
  • <srvParmTag> is service parameter name,
  • <srvParmValue> is value of above parameter.

First you need to define which type of Internet Service will be used:

AT^SISS=2,"srvType","Socket"

Above command sets socket client to be accessible under service profile id equal 2.

Now let's setup the address of the server:

AT^SISS=2,"address","socktcp://x.x.x.x:p"

Above command sets destination address x.x.x.x and port p.

Finally you have to assign service profile to connection profile:

AT^SISS=2,"conId",0

After above command execution, the service will be assigned to access the Internet using connection profile on id equal 0, which was configured in section "Configuration of Internet Connection".

It is worth mentioning that up to 10 services may be created (under ids from range 0-9). Various Internet Services may use the same Internet Connection.

Opening Internet Service

As configuration is over, Internet Service may be open with following command:

AT^SISO=2

After above command Internet Connection will be established (if not established yet) and the service will start working. URCs will signalize that new data may be put or received.

Reading and writing

When the module is ready to accept new data, following URC appears:

^SISW: 2,1

Above URC notifies that Internet Service with id = 2 is ready for new data. Let's write 5 bytes to the service using:

AT^SISW=2,10

After ^SISW: 2,10,0 intermediate result code the module waits for 10 bytes. 1500 bytes can be written at once.

When the module receives new data, following URC appears:

^SISR: 2,1

This means that there is new data in buffer waiting to be flushed. Use following command to read the data (log with answer):

AT^SISR=2,100

^SISR: 2,10

1234567890

OK

AT^SISR command performs non-blocking query. It returns received data up to requested limit. If no sufficient amount of data is provided it will return all the data from the buffer. Intermediate return code informs how much data will be flushed.

Closing Internet Service

If Internet Service is no longer needed, it may be closed with:

AT^SISC=2

After above command execution the socket will be closed and Internet Connection will be dropped after inactivity timeout's expiration if no other active Internet Services are assigned to this Connection.

Monitoring connection state

For connection and service monitoring following commands can be used:

AT^SICI? - monitoring state of Internet Connections,

AT^SISI? - monitoring state of Internet Services

AT^SISO? - as above

Monitoring commands report state with numerical codes. The values may be looked up in corresponding AT Command Set sections.

Summary

Internet Services may be powerful tool in developer's hands. With only few commands Internet Connection may be set to be used in embedded applications without the necessity of network stack implementation - hence application designer may focus on his strict goals. For more details refer to Concept Board documentation page in Knowledge Base, AT Command Set is especially helpful.

1 - 10 of 15 Comments

Pages

antero.markkula@enkom.fi's picture
antero.markkula...

This is a very good overview. In order to get good results with TCP/IP,
network and signal monitoring is also important (AT^SMONI, AT+CSQ).
Also, it is useful to set the AT+CMEE=2 to see verbose error messages.

Antero Markkula
Communication and Mechatronics

Enkom Active Oy – www.enkom-active.fi
Upseerinkatu 3 A, 02600 Espoo, Finland
Mobile: +358 400 411368
Office: +358 10 204 0000
Fax: +358 10 204 0010
E-mail: antero.markkula@enkom-active.fi

ddewaele's picture
ddewaele

Nice write-up.

I was wondering if there was a higher level Java API available to interact with the modem and the HTTP layer ?

Something that abstracts away the low-level TCP connectivity and implements a subset of the HTTP protocol.

Cause if I understand correctly, in order to implement a GET/POST request, one needs to basically implement the HTTP protocol himself on top of these AT commands.

Can we for example use the HttpConnection Object Connector class of the javax.microedition.io package in order to interact with HTTP services ?

Jędrzej Gemalto Moderator's picture
Jędrzej Gemalto...

Yes, as mentioned in the tutorial, you can also configure HTTP Internet Service. Setup process is similar to described above. We plan to add tutorials for other services too.

You can also use HttpConnection API when implementing Java MIDlet. Generally there is no need to implement socket-based HTTP protocol on your own.

ddewaele's picture
ddewaele

Great to see you're working on this.

We're implementing Java midlets.

I also remember a demo where the Gemalto board was connected to a little windmill and sending data to the cloud. You wouldn't happen to know if that demo code could be made available somewhere ?

That would be a great help.

We're excited to get started with the board but documentation / samples are a bit scarce so it's easy to get stuck on something.

Is there for example information available on this "HTTP Internet Service" ? It's unclear to me at this point what this is. Is this a Cinterion Java API ?

Looking forward to learning more about this.

Jędrzej Gemalto Moderator's picture
Jędrzej Gemalto...

The application you've mentioned seems to be early demo of SensorLogic. It is Gemalto's M2M cloud system accessible from Java capable modules with usage of special Java API libraries provided by Gemalto.
The source code for the demo wasn't released.

All "Internet Services", HTTP Internet Service too, allow you to access Internet resources over AT command interface. Refer to Chapter 10 of AT Command Set for details and simple examples of usage. Tutorial for HTTP Internet Service is also planned.

If you're implementing Java MIDlets, you should use HttpConnection API. It is described in Java API reference delivered with SDK.

Feel free to start new threads if you're stuck on something. We wish this platform to be place full of valuable technical questions with valuable technical answers.

nc_emendo's picture
nc_emendo

Have you finished the HTTP connection with java tutorial yet?

HAhmed's picture
HAhmed

Thank you . Kindly i would like the know in case of Transparent TCP client

after using command AT^SIST and enable data mode. How can i exit data mode to AT command?

Thank you

Jędrzej Gemalto Moderator's picture
Jędrzej Gemalto...

There are couple of ways to leave transparent mode. Please check our Transparent Internet Service tutorial, section "Leaving transparent mode and closing the service":
https://developer.gemalto.com/tutorial/concept-board-internet-services-t...

Regards
Jedrzej

Gujie's picture
Gujie

Hi everyone,

I'm using the EHS6 board and I don't get any URC when I send AT^SISO=0 eventhough I previously sent AT^SCFG="Tcp/WithURCs","on". I only get OK...
I have configured the connection profile and the internet service successfully (I can use SISR/SISW without any problem). I just can't get the URC to tell me when the connection is established...
Any idea why?
Thanks for your help!

EDIT: I restarted the device and now it's working... I don't think it is mentioned in the documentation that we have to restart it after sending AT^SCFG, small bug(?)

turson's picture
turson

Hi,

I've been following this tutorial for few days without any success. Everytime, I type AT^SISO=2, the following message pops up in the screen:

^SIS: 2,0,94, "PDP; connection failed".

I obtained my IP address from myipaddress.com. I port forwarded port 747 first, then 80. I downloaded the SocketTest Application to listened to port 747. Then tried port 80. Both failed.

What did I do wrong? How can I finish this tutorial successfully? Thanks in advance.

Eric.

1 - 10 of 15 Comments

Pages

Jędrzej Gemalto Moderator