nerves-networking / vintage_net_mobile

Mobile networking for VintageNet
Apache License 2.0
27 stars 11 forks source link

Add signal strength monitoring #9

Closed mattludwigs closed 4 years ago

mattludwigs commented 4 years ago

Add support to monitor the signal strength in both dBm and percent. This uses VintageNet.PropertyTable from consuming applications to subscribe to the changes in the signal strength over time.

mattludwigs commented 4 years ago

@fhunleth the more I look into signal strength and the different connection types it starting to seem like this might be modem specific information.

I have coded only to the Huawei spec currently, I think some of this will need to be pulled out when we start pulling out specific configurations.

The main reason is that both Huawei and Quectel have an AT command that will give us both the connection type, LTE, GSM, etc... and the values to calculate signal strength. What we have in this PR is only for 2G and 3G connections.

These AT commands and their responses are similar nature: AT+HCSQ and AT+QCSQ where the H is Huawei and the Q is Quectel, but the differences are enough to make generalizing a bit of a challenge. In the response both support different connection types and depending on the connection types the numbers that come with the report will need to be understood differently.

Another interesting note is that for both these, the modems are set to report them on their own (which can be disabled as well), so we don't have to do any polling.

It seems these are also non-standard and part of each specific modem's extended AT commands.

I am trying to research more about this, but the AT+CSQ command, which is standard but the connection we are on will make the calculation different at the very least.

https://en.wikipedia.org/wiki/Mobile_phone_signal#ASU

I can imagine some of this going into the configuration like: %{type: VintageNetLTE, modem: Huawei} where can provide a modem behaviour. However, this might be getting ahead of myself.

fhunleth commented 4 years ago

Sounds like we might have to push signal strength values to users without any help in interpreting them. As discussed, let's put this on the backburner as others try out vintage_net_lte on their LTE modems. Maybe someone else will have opinions so that we're not spinning on figuring how how this should be exposed in a "generic" API.