File tree Expand file tree Collapse file tree 7 files changed +55
-1
lines changed
app/src/main/java/com/lcl/lclmeasurementtool Expand file tree Collapse file tree 7 files changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public void onCellularNetworkChanged(boolean isConnected) {
98
98
Log .e (TAG , "on connection lost" );
99
99
if (!isConnected ) {
100
100
updateSignalStrengthTexts (SignalStrengthLevel .NONE , 0 );
101
- updateFAB (isConnected );
101
+ updateFAB (false );
102
102
}
103
103
}
104
104
});
Original file line number Diff line number Diff line change 2
2
3
3
import com .lcl .lclmeasurementtool .Utils .SignalStrengthLevel ;
4
4
5
+ /**
6
+ * Listen to the cellular network changes from the device.
7
+ */
5
8
public interface CellularChangeListener {
9
+
10
+ /**
11
+ * Callback function when the cellular network changes.
12
+ * @param level the Signal Strength level.
13
+ * @param dBm the signal strength in dBm.
14
+ */
6
15
void onChange (SignalStrengthLevel level , int dBm );
7
16
}
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ public void getLastLocation() {
91
91
if (task .isSuccessful () && task .getResult () != null ) {
92
92
mLastLocation = task .getResult ();
93
93
94
+ // TODO: log the location latitude and longitude
94
95
Log .i (TAG , String .valueOf (mLastLocation .getLatitude ()));
95
96
Log .i (TAG , String .valueOf (mLastLocation .getLongitude ()));
96
97
} else {
Original file line number Diff line number Diff line change 1
1
package com .lcl .lclmeasurementtool .Managers ;
2
2
3
+ /**
4
+ * An interface that listens to the changes in the network status.
5
+ */
3
6
public interface NetworkChangeListener {
7
+
8
+ /**
9
+ * callback function when the cellular network becomes available.
10
+ */
4
11
void onAvailable ();
12
+
13
+ /**
14
+ * callback function when the cellular network becomes unavailable.
15
+ */
5
16
void onUnavailable ();
17
+
18
+ /**
19
+ * callback function when the cellular network gets lost.
20
+ */
6
21
void onLost ();
22
+
23
+ /**
24
+ * callback function when the cellular network status gets changed.
25
+ *
26
+ * @param isConnected boolean parameter indicating whether there is cellular connection.
27
+ */
7
28
void onCellularNetworkChanged (boolean isConnected );
8
29
}
Original file line number Diff line number Diff line change @@ -141,6 +141,11 @@ public boolean isCellularConnected() {
141
141
this .capabilities .hasTransport (NetworkCapabilities .TRANSPORT_CELLULAR );
142
142
}
143
143
144
+ /**
145
+ * Retrieve the downstream bandwidth in Kbps
146
+ *
147
+ * @return the downstream bandwidth in Kbps as an integer. If no cellular capability, return 0.
148
+ */
144
149
public int getLinkDownstreamBandwidthKbps () {
145
150
if (this .capabilities != null ) {
146
151
return this .capabilities .getLinkDownstreamBandwidthKbps ();
@@ -149,6 +154,11 @@ public int getLinkDownstreamBandwidthKbps() {
149
154
return 0 ;
150
155
}
151
156
157
+ /**
158
+ * Retrieve the upstream bandwidth in Kbps
159
+ *
160
+ * @return the upstream bandwidth in Kbps as an integer. If no cellular capability, return 0.
161
+ */
152
162
public int getLinkUpstreamBandwidthKbps () {
153
163
if (this .capabilities != null ) {
154
164
return this .capabilities .getLinkUpstreamBandwidthKbps ();
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ public String toString() {
62
62
"levelCode=" + levelCode ;
63
63
}
64
64
65
+ /**
66
+ * Retrieve the name of the signal strength.
67
+ *
68
+ * @return the string representation of the signal strength level.
69
+ */
65
70
public String getName () {
66
71
switch (this ) {
67
72
case NONE :
@@ -81,6 +86,11 @@ public String getName() {
81
86
return "" ;
82
87
}
83
88
89
+ /**
90
+ * Retrieve the color representation of the signal strength.
91
+ * @param context the context of the application/activity
92
+ * @return the color representation of the signal strength.
93
+ */
84
94
public int getColor (Context context ) {
85
95
switch (this ) {
86
96
case GREAT :
Original file line number Diff line number Diff line change 5
5
*/
6
6
public class UnitUtils {
7
7
8
+ /** the signal strength unit */
8
9
public static final String SIGNAL_STRENGTH_UNIT = "dBm" ;
10
+
11
+ /** the ping test unit */
9
12
public static final String PING_UNIT = "ms" ;
10
13
}
You can’t perform that action at this time.
0 commit comments