Get signal strength from modem
# help
r
Hello, I would like to get the rssi from my toit device running with sequans modem. I can see the function
signal_strength -> float?:
from cellular package
cellular/src/base/base.toit
line 119 does exactly what I want. My problem is I can't find a way to get the value from the monarch container, and use it in a different container. In the
cellular/src/base/service.toit
file I can call the function using
driver.signal_strength
and get the value I expect. But I can only print it out on serial log. I've tried to save the service when opening the network, but this is
CellularServiceClient
and I need
CellularServiceProvider
. Have I missed the simple way of getting the signal strength from modem, or is it supposed to be difficult to get hands on the uart connected to modem?
k
The function needs to be part of the cellular service API and it isn't right now. I can help with that. I'm going to add it to https://github.com/toitlang/toit/blob/master/lib/system/api/cellular.toit and then we'll let the cellular providers implement it. It will take a few days to pipe through. In the mean time, you could save it in RTC memory using a storage.Bucket in the cellular provider and then fetch it from the same bucket in the client.
r
Okay thanks, I thought it was fully implemented when I saw the function 🙂 no need to rush, I just wanted to know if it was me missing something obvious
So far the modem implementation is very stable. I havent seen it go offline yet
Hello, will the api to get the signal strength and other values, be a part of the new service design/update?
k
I will look at this today! Do you have time for a quick chat here on Discord if I have questions on your requirements?
r
Sure 🙂
k
I am thinking two floats in the range [0,1] representing signal strength and quality respectively.
r
That is fine, i will write a few words about all the things we have planned
k
Do you need the information to be available when the connection is closed?
r
What we really need from the simcard is a few values: IMEI with
AT+CGSN=1
giving us OK and the IMEI itself. Ive tested it and we can easily print it in the cellular/internet service. It would be amazing if we could get info on connection closed yes
I can see theres already function to get the APN, but I havent played around with it yet.
Any news on this? If not then I have to look at the RTC save in memory method 😉
k
I'm struggling a little bit with getting the API in place. The challenge is that we'd like to support getting the signal quality when the modem is turned on, but before we've been able to connect. We don't really model that state yet, so I'm trying to find out how we want to do it (long term), so the API can work well in the future too.
r
Okay, we put modem on the side for now 🙂 Our own module for modem connectivity is a bit delayed so we need to plan out our next step
k
I think I have a plan to move this forward, so we should have something ready for you within a week or two.
r
That would be cool 😄 should have the module ready by then
We run the monarch container as a
spawn
now, because this gives us the opportunity to use wifi or cellular. We were unable to open wifi before, because we use the generic
net.open
calls etc to match our preferred internet connection type. I haven't found any problems with spawning yet, but perhaps I will find some soon 😄 I hope the API work is going well, I know you guys have much on your plate right now
Any news?
k
@Rikke Still on my list, but now at the top. We will ship an updated SDK next week that has some solution to this problem.
The first attempt requires you to import the cellular package and use it like this:
Copy code
import cellular.signal

main:
  quality := signal.quality
  print "power = $quality.power"
https://pkg.toit.io/package/github.com%2Ftoitware%2Fcellular@v2.0.4 <-- you can give it a try with v2.0.4 🙂
r
I will look at it tomorrow 🙂