New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ACM MVP #2689
ACM MVP #2689
Conversation
How are the interfaces encoded for this output? IF#1 is cellular and IF#2 WiFi?
|
These are
ie Note these are different than the LWIP internal indexes for the interfaces. |
Cellular + Wifi connection binding works as expected. I can use the test app to bind to either and I can see the cloud traffic goes through the bound interface. Swapping between the two works fine with the cloud connection Ethernet binding is much less reliable, but I think that is due to the current issues with ethernet + cloud connection in general with p2/msom platform |
03739dd
to
acb1028
Compare
e1e2be8
to
5fe67ab
Compare
Refactored to use
|
@@ -62,6 +62,11 @@ void spark_cloud_udp_port_set(uint16_t port) | |||
cloud_udp_port = port; | |||
} | |||
|
|||
uint16_t spark_cloud_udp_port_get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more authoritative source for the cloud connection port to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloud_udp_port
is it, so I think you are good. Do you want to update port = cloud_udp_port;
to port = spark_cloud_udp_port_get()
as well? If we are not planning on using spark_cloud_udp_port_set()
, we could remove it.
45d7d9a
to
108a4ea
Compare
108a4ea
to
73a5f67
Compare
21e73fa
to
36d256d
Compare
|
||
const uint8_t REACHABILITY_TEST_MSG = 252; | ||
const unsigned REACHABILITY_MAX_PAYLOAD_SIZE = 256; | ||
const unsigned REACHABILITY_TEST_DURATION_MS = 5000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is arbitrary, what should this be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we said maybe this should be changed so it doesn't blindly run for 5s, but maybe try to run 5 times and timeout after 5 seconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently its a tradeoff of how much traffic do we want to generate vs how long do we want to block the system task, as the connection tester is done on the system thread currently.
We should probably lower the test time, or run the test on its own thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that there is a more reliable amount of data used for this tester, a predetermined count of packets seems reasonable? If you do it based on time alone, you will have more or less packets depending on how fast the networks are at that given time, but more packets than a certain amount will likely not contribute to a better test value. Still though you might have some really slow networks and a timeout will be required.
36d256d
to
5f05700
Compare
snprintf(tmpserv, sizeof(tmpserv), "%u", tmpport); | ||
LOG(TRACE, "Resolving %s#%s", tmphost, tmpserv); | ||
// TODO: get addrinfo/server IP from DNS lookup using the specific interface? | ||
r = netdb_getaddrinfo(tmphost, tmpserv, &hints, &info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is becoming a problem when different interfaces DNS servers resolve the device service hostname to different IPs and we try to use the same IP to try to connect with all the interfaces.
IE Some situations im seeing are wifi+ethernet sockets will connect but cellular doesnt and vice versa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example
Cellular + WIFI DNS servers:
[2023-11-28 11:45:14.380] 0000204617 [app] INFO: DNS IP 8.8.4.4
[2023-11-28 11:45:14.380] 0000204621 [app] INFO: DNS IP 8.8.8.8
[2023-11-28 11:45:14.385] 0000204624 [app] INFO: DNS IP 192.168.1.1
Server IP Resolves to 3.222.143.118#5684
Ethernet + Cellular + WIFI DNS servers:
[2023-11-28 11:45:51.616] 0000241854 [app] INFO: DNS IP 192.168.0.1
[2023-11-28 11:45:51.622] 0000241858 [app] INFO: DNS IP 8.8.4.4
[2023-11-28 11:45:51.622] 0000241861 [app] INFO: DNS IP 8.8.8.8
[2023-11-28 11:45:51.627] 0000241865 [app] INFO: DNS IP 192.168.1.1
Server IP resolves to a different address 3.215.122.234#5684
For whatever reason, cellular sometimes cannot reach this IP, or the traffic is much slower than with its own resolved IP
d53d078
to
08b5d6f
Compare
Problem
MSoM hardware needs support for basic ACM. This PR adds that support
Solution
ACM MVP consists of a number of specific items:
system_connection_manager
to manage thepreferred
network interface as well as the connection tester logic. The connection tester will test all of the ready network interfaces and collect metrics on their latencycellular_device_info()
is called. When the modem is on, cache the response to the AT commands. Return the cached data ifcellular_device_info()
is called when the modem is offParticle.connect(WiFi)
to force the cloud connection over the specified network. This will bind the cloud socket to that interface, even if that network is not ready/up/routable.Network.preferred()
/Network.isPreferred()
. This will prioritize the specified network, and assuming it is up and ready when opening the cloud connection, that network will be bound to the socket.Particle.connectionInterface()
to return which network is in use for the current cloud connection.signal
structure. Analternate
signal structure will be sent with the other interfaces statistics. This needs server side work to support. Currently the alternate signal data is sent as application diagnostics and are parsed as raw integers.Steps to Test
Run example app, bring up any number of network interfaces, use the
1
command to test the interface, then2
to print some stats about the test diagnostics.p
to force a publish and see the combined vitals signal dataExample App
See
blank/application.cpp
Example output:
Running internet test by pressing
1
, with all 3 interfaces configured and connected:Example combined vitals:
vital_44
is the cloud connection enum: