File: README.md

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (55 lines) | stat: -rw-r--r-- 3,194 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Network Events

Notifies clients of network events. [Design Doc]

This code is maintained by the [Network Health and Configuration] team. See also
documentation for [Network Diagnostic Routines] and [Network Health telemetry].

[TOC]

## Listening to network events

Clients interested in listening to network events may implement the
`NetworkEventsObserver` Mojo interface, defined in [network_health.mojom]. The
remote end of the `NetworkEventsObserver` interface must be added as an observer
to the `NetworkHealthService` Mojo interface, also defined in
[network_health.mojom]. Chrome clients can interact with the
`NetworkHealthService` Mojo interface by using the global
[NetworkHealthService] class. Note that Chrome OS clients may listen to
network events through the [cros_healthd] daemon by [adding] a
`NetworkEventsObserver` remote to cros_healthd. TODO(khegde): Replace CL with
source once this lands.

## Available network events

See NetworkEventsObserver in [network_health.mojom] for available events.

## Demo Run

The following is an example run that uses the cros-health-tool to listen for
network events.

1. Ensure the active network is online. Then, start cros-health-tool:\
`$cros-health-tool event --category=network --length_seconds=150`

2. Disconnect the active network. Output:\
`Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kNotConnected`

3. Reconnect the active network. Output:\
`Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kConnecting`\
`Network event received: Signal strength changed, Network guid: fake-guid, Signal strength: 60`\
`Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kConnected`\
`Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kOnline`

4. Move the device to a region with weaker signal strength. Output:\
`Network event received: Signal strength changed, Network guid: fake-guid, Signal strength: 48`

[Design Doc]: https://docs.google.com/document/d/18ehcBF2iC1rZDo9AV79-qJ5KUfSGIUeqX0bLDRD3XHI/edit?usp=sharing&resourcekey=0-1mYPArwll_OTBaKgQ1qeDw
[Network Health and Configuration]: https://docs.google.com/document/d/10DSy-jZXaRo9I9aq1UqERy76t7HkgGvInWk57pHEkzg
[Network Diagnostic Routines]: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ash/net/network_diagnostics/README.md
[Network Health telemetry]: https://source.chromium.org/chromium/chromium/src/+/main:chromeos/services/network_health/public/mojom/network_health.mojom
[network_health.mojom]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform2/diagnostics/mojo/network_health.mojom
[NetworkHealthService]: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ash/net/network_health/network_health_service.h
[cros_healthd]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform2/diagnostics/cros_healthd/
[adding]: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2627331/8/diagnostics/mojo/cros_healthd.mojom#465