dudewheresmycode / node-iridium-sbd

Node.js library for sending and receiving Iridium SBD (Short Burst Data)
14 stars 11 forks source link

Get rid of waitForNetwork function #8

Open alexose opened 2 years ago

alexose commented 2 years ago

Per the RockBlock documentation:

Iridium satellites move across the horizon in a matter of minutes. Your available horizon will likely not be spanning all the way to 180 degrees but instead may be obstructed by mountains, buildings or trees. The +CSQ command takes about 20 seconds to return a result. During this time, it is very possible that a satellite may have had an unobstructed view of your RockBLOCK, returned a 5 bar signal and then disappeared behind an obstruction or even the horizon itself. We recommend simply transmitting your data via the +SBDIX command - if a transmission error occurs, you can try again at a later time. Your account will be billed only the credits that pertain to a successful MO/MT transmission.

Skipping waitForNetwork definitely seems to work better in practice. Messages come through much quicker if we don't have to wait to read the signal strength beforehand.

brendon-stephens commented 2 years ago

I would be more inclined to keep it. I don't see how randomly firing off a message could be any better than waiting for a specified signal. According to the 9602 developer guide it is about two seconds to get a result, not 20s that Rock7 claim.

Note: A signal strength response may not be immediately available, but will usually be received within two seconds of issuing the command. If the 9602 is in the process of acquiring the system, a delay in response of up to 50 seconds may be experienced.

Also based on the iridium best practices guide it is recommended to check the signal before transmitting.

Before transmitting, check for good signal quality and network availability. If the session fails (e.g. code 32), implement a retry back off scheme starting with 60 seconds. Do not continuously retry.

For info I am working on a new 9602/9603 library for an internal project which is written in typescript and promises. I will seek approval to release it to the public. Also working on 9602/9603 emulator.

brendon-stephens commented 2 years ago

I just had a look at the code again. I think the sendMessage function should accept some kind of parameter specifying the minimal signal quality before invoking the SBD session. If the minimum signal quality is "NONE" then the waitForNetwork function could be skipped.

alexose commented 2 years ago

Ah, I was going off the RockBlock guide only. I didn't realize there was conflicting advice in the 9602 guide.

In that case, I agree. Best to leave it up to the developer as to whether or not to skip the network check.

Fantastic that you're working on a typescript driver! Hopefully this code is serving as a good starting point, and that you'll be able to release it when the time comes.