1

I'm doing an embedded-system project now. From my view, AT commands can be sent to a device to retrieve 4G information, dial and so on. On the other hand, we can also do that by calling APIs provided by the 4G vendor.

My question is what's the relationship between them? Is the API a wrapper for the AT commands?

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
Caiyi Zhou
  • 143
  • 1
  • 9

3 Answers3

3

TL;DR

Vendor's API (not only C, but also C++, Java or Python depending to the vendor and the modem model) can both be wrappers for AT commands and a wider, more powerful set of API were the user can port complex applications.

It depends on the vendor and on the model.


A jungle of modems produced by different vendors

It is impossible to define a general "rule" about API provided by a Cellular Module (not necessarily a 4G module).

First of all every vendor usually implements standard AT Commands (both Hayes commands and extended standard commands for cellular devices). In the same way every vendor has it's own implementation of the user application area where the customers can store their own application to control the modem's functionalities and to use them according to their own application requirements.

AT commands remain the interface to be used when the modem needs to be connected (and driven) by an external host. When the user application area is used, instead, a wider set of API is usually provided. They may include:

  • A library exporting a subset of the OS capabilities (threads management, events, semaphores, mutexes, SW timers, FS access and so on)
  • A library offering the capability to manage the specific HW of the device (GPIOs, SPI, I2C, ADC, DAC and so on)
  • A library offering a programmatical way to perform action, related to connectivity, that would normally be executed through AT commands (registration status check, PIN code insertion, PDP context activation, SMS management, TCP/UDP/TLS sockets)

The latter usually access a base layer involving all the functionalities provided by the modem. Usually this is the same layer invoked by the AT commands sent through modem's serial interface.


Sending AT commands... from the vendor's API?

Of course it often happens that the library mentioned above provides just a subset of the functionalities usually exported with the AT commands set so, in order to "fill the gap", a further set of APIs is usually exported as well:

  • A set of functions that allow the simulation of AT commands sent to the modem's serial port. Sending them and parsering the responses they send in the vitual internal serial/USB interface allow the user to port in the internal user application area the the application they previously run on an external host processor (with obvious BOM benefits).

As an example, please check Telit Appzone here and here. It was the inspiration of my answer because I know it very well.

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
1

I don't know why you name the title that there's a relationship between AT command and Linux-C API.

Regarding AT command, you can take a look at this wiki article for general information.

Each module has a specified AT command sets. Normally, the module manufacture just offers AT command set and what return values are.

Is API a wrapper of AT command?

If you can use the API provided by the manufacturer, then yes, it's a wrapper of the AT command handler.

dustin2022
  • 182
  • 2
  • 18
1

My question is what's the relationship between them? Is the API a wrapper for the AT commands?

It is impossible to be sure without having any details of the device, but probably any C API for it wraps the AT command set, either by communicating with the device directly over an internal serial interface or by going through a device driver that uses AT commands to communicate with it.

However, it is at least conceivable, albeit unlikely, that the 4G device offers an alternative control path that the C API uses (definitely via a driver in this case).

I'm not quite sure what the point of the question is, though. If you are programming the device and its 4G component in C, and the manufacturer has provided a C API, then use it! If you are programming in some other language then at least consider using the C API, which you should be able to access from most other languages in some language-specific way. You should not expend effort on rolling your own without a compelling reason to reject the API already provided to you.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157