vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.93k stars 715 forks source link

Getting the #504

Closed FStefanni closed 3 years ago

FStefanni commented 3 years ago

[ x] I have read the Troubleshooting section of the ReadMe

What type of issues is this?

[ ] Request to support a new module

[ ] Bug or problem compiling the library [ ] Bug or issue with library functionality (ie, sending data over TCP/IP) [x ] Question or request for help

What are you working with?

Modem: sim800l, sim7000g, ublox sara u201 Main processor board: esp32 TinyGSM version: 0.10.9 Code:

Question

Hi,

I am trying to read some communication stats. I have seen the getSignalQuality() method (and related issue), and it is fine for me. I am only missing the kind of connection band now (lte, gprs, 2g, 3g, etc.). Is there a way to get this information by calling a pre-defined method? Or, if I would like to implement one by myself, do you have any hint? Or could this be a missing feature, worth to be implemented directly inside TynyGSM?

Thank you for the support, regards

SRGDamia1 commented 3 years ago

Yes, I think all three of the modules you listed can report their current connection type. In the case of the SIM7000, you can already get that using the getNetworkModes() function for GSM vs LTE and the getPreferredModes() for LTE-M vs NB-IoT. For the "standard" u-blox (inc U201) those functions don't exist, but I think you could copy them from the SIM7000 implementation, change to the appropriate AT commands from the u-blox manual (AT+URAT, I believe), and submit a PR once you've tested. For the SIM800, I can tell you the answer will always be "GPRS" because that's all it supports.

SRGDamia1 commented 3 years ago

Also, for what it's worth, GPRS != 2G and LTE isn't the same 4G though people use the terms like they are. The modules will generally tell you what type of technology it is using (ie, GPRS, EDGE, LTE) not the technology "generation" (ie, 2G, 3G, 4G).

FStefanni commented 3 years ago

Hi,

thank you for the quick reply. These are good news, so in the end I am going to implement something, and I'll let you know. Probably I'll implement something just for the SIM7000G, and I'll propose a pr.

Regards.

SRGDamia1 commented 3 years ago

It's already there for the SIM7000.

FStefanni commented 3 years ago

Hi,

yes, I have seen, but:

Regards