Skip to content

Commit

Permalink
Displays the band number next to the EARFCN on the cellular details s…
Browse files Browse the repository at this point in the history
…creen
  • Loading branch information
christianrowlands committed Nov 10, 2023
1 parent 3c0b2fa commit 1441b5b
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/android-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ jobs:
commit: ${{ github.sha }}
body: "The regular-release apk is the same as what can be found on the Google Play Store. The cdr-release apk is the same as the regular-release apk, but with the full CDR support (See README.md for more details) and it also does not contain any tracking libraries such as Google Analytics."
generateReleaseNotes: true
draft: true

- name: Release app to internal track
uses: r0adkll/upload-google-play@v1
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.14](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.14) - 2023-11-09

* Added support for logging Cellular, Wi-Fi, Bluetooth, and GNSS surveys to CSV files.
* Added a help dialog explaining the difference between file logging and MQTT.
* Added links to the user manual and NS Messaging API docs in the Nav menu.
* Allow for horizontal display (landscape mode).
* Updates for Android 14.

## [1.13](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.13) - 2023-06-29

* The speed (in meters per second) is now included in all messages.
Expand All @@ -24,7 +32,8 @@

* Adds support for logging Call Detail Record (CDR) events to a CSV file.
* Caches the Bluetooth UI results so the results are still visible when switching between tabs.
* Adds a connection toggle switch and direct link to the MQTT Connection Fragment from the Dashboard.
* Adds a connection toggle switch and direct link to the MQTT Connection Fragment from the
Dashboard.
* Changes the default location provider to Fused, which should improve battery life.

## [1.10.0](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.10.0) - 2023-01-24
Expand Down
2 changes: 1 addition & 1 deletion networksurvey/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdkVersion 26
targetSdkVersion 34
versionCode 52
versionName "1.14"
versionName "1.15-SNAPSHOT"
setProperty("archivesBaseName", "$applicationName-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.craxiom.networksurvey.model.CellularProtocol;
import com.craxiom.networksurvey.model.CellularRecordWrapper;
import com.craxiom.networksurvey.services.NetworkSurveyService;
import com.craxiom.networksurvey.util.CellularUtils;
import com.craxiom.networksurvey.util.ColorUtils;
import com.craxiom.networksurvey.util.MathUtils;
import com.craxiom.networksurvey.util.ParserUtils;
Expand Down Expand Up @@ -442,7 +443,7 @@ private void updateServingCellProtocol(CellularProtocol protocol)
binding.tacLabel.setText(R.string.tac_label);
binding.enbIdGroup.setVisibility(View.VISIBLE);
binding.sectorIdGroup.setVisibility(View.VISIBLE);
binding.earfcnLabel.setText(R.string.earfcn_label);
binding.earfcnLabel.setText(R.string.earfcn_band_label);
binding.pciLabel.setText(R.string.pci_label);
binding.bandwidthGroup.setVisibility(View.VISIBLE);
binding.taGroup.setVisibility(View.VISIBLE);
Expand Down Expand Up @@ -612,7 +613,16 @@ private void processLteServingCell(LteRecordData data)
viewModel.setMnc(data.hasMnc() ? String.valueOf(data.getMnc().getValue()) : "");
viewModel.setAreaCode(data.hasTac() ? String.valueOf(data.getTac().getValue()) : "");
viewModel.setCellId(data.hasEci() ? (long) data.getEci().getValue() : null);
viewModel.setChannelNumber(data.hasEarfcn() ? String.valueOf(data.getEarfcn().getValue()) : "");

if (data.hasEarfcn())
{
int earfcn = data.getEarfcn().getValue();
int band = CellularUtils.downlinkEarfcnToBand(earfcn);
viewModel.setChannelNumber(earfcn + " / " + (band == -1 ? "?" : band));
} else
{
viewModel.setChannelNumber("");
}

if (data.hasPci())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
package com.craxiom.networksurvey.util;

/**
* Helper methods for working with cellular networks.
*/
public class CellularUtils
{
/**
* From 3GPP TS 36.101, Table E-UTRA Operating Bands
*/
private static final int[][] DOWNLINK_LTE_BANDS = {
// Band, Lower bound of EARFCN, Upper bound of EARFCN
{1, 0, 599},
{2, 600, 1199},
{3, 1200, 1949},
{4, 1950, 2399},
{5, 2400, 2649},
{6, 2650, 2749},
{7, 2750, 3449},
{8, 3450, 3799},
{9, 3800, 4149},
{10, 4150, 4749},
{11, 4750, 4949},
{12, 5010, 5179},
{13, 5180, 5279},
{14, 5280, 5379},
{17, 5730, 5849},
{18, 5850, 5999},
{19, 6000, 6149},
{20, 6150, 6449},
{21, 6450, 6599},
{22, 6600, 7399},
{23, 7500, 7699},
{24, 7700, 8039},
{25, 8040, 8689},
{26, 8690, 9039},
{27, 9040, 9209},
{28, 9210, 9659},
{29, 9660, 9769},
{30, 9770, 9869},
{31, 9870, 9919},
{32, 9920, 10359},
{33, 36000, 36199},
{34, 36200, 36349},
{35, 36350, 36949},
{36, 36950, 37549},
{37, 37550, 37749},
{38, 37750, 38249},
{39, 38250, 38649},
{40, 38650, 39649},
{41, 39650, 41589},
{42, 41590, 43589},
{43, 43590, 45589},
{44, 45590, 46589},
{45, 46590, 46789},
{46, 46790, 54539},
{47, 54540, 55239},
{48, 55240, 56739},
{49, 56740, 58239},
{50, 58240, 59089},
{51, 59090, 59139},
{52, 59140, 60139},
{64, -1, -1}, // Reserved band
{65, 65536, 66435},
{66, 66436, 67335},
{67, 67336, 67535},
{68, 67536, 67835},
{69, 67836, 68335},
{70, 68336, 68585},
{71, 68586, 68935},
{72, 68936, 68985},
{73, 68986, 69035},
{74, 69036, 69465},
{75, 69466, 70315},
{76, 70316, 70365},
{85, 70366, 70545},
{87, 70546, 70595},
{88, 70596, 70645},
{103, 70646, 70655},
{106, 70656, 70705},
};

/**
* Returns the LTE band for a given EARFCN.
*
* @param earfcn The EARFCN to get the band for.
* @return The LTE band for the given EARFCN, or -1 if the EARFCN is not in a known band.
*/
public static int downlinkEarfcnToBand(int earfcn)
{
for (int[] band : DOWNLINK_LTE_BANDS)
{
if (earfcn >= band[1] && earfcn <= band[2])
{
return band[0];
}
}

return -1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
style="@style/SmallLabelText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/earfcn_label"
android:text="@string/earfcn_band_label"
app:layout_constraintBottom_toBottomOf="@id/earfcn_group" />

</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
1 change: 1 addition & 0 deletions networksurvey/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ but work independently, so you have full control over how you handle your data.<
<string name="cid_label">CID</string>
<string name="enb_id_label">eNB ID</string>
<string name="sector_id_label">Sector ID</string>
<string name="earfcn_band_label">EARFCN/Band</string>
<string name="earfcn_label">EARFCN</string>
<string name="pci_label">PCI</string>
<string name="bandwidth_label">Bandwidth</string>
Expand Down

0 comments on commit 1441b5b

Please sign in to comment.