Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Build Properties
#Sat Mar 08 09:09:08 EST 2025
version_build=5
#Tue Mar 11 02:41:10 CST 2025
version_build=12
version_major=3
version_minor=1
version_patch=4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ class WiFiChannelsGHZ6 : WiFiChannels(RANGE, SETS) {
if (inRange(frequency)) wiFiChannel(frequency, wiFiChannelPair) else WiFiChannel.UNKNOWN

companion object {
val SET1 = WiFiChannelPair(WiFiChannel(1, 5955), WiFiChannel(29, 6095))
val SET2 = WiFiChannelPair(WiFiChannel(33, 6115), WiFiChannel(61, 6255))
val SET3 = WiFiChannelPair(WiFiChannel(65, 6275), WiFiChannel(93, 6415))
val SET4 = WiFiChannelPair(WiFiChannel(97, 6435), WiFiChannel(125, 6575))
val SET5 = WiFiChannelPair(WiFiChannel(129, 6595), WiFiChannel(157, 6735))
val SET6 = WiFiChannelPair(WiFiChannel(161, 6755), WiFiChannel(189, 6895))
val SET7 = WiFiChannelPair(WiFiChannel(193, 6915), WiFiChannel(229, 7095))
val SETS = listOf(SET1, SET2, SET3, SET4, SET5, SET6, SET7)
val SET1 = WiFiChannelPair(WiFiChannel(1, 5955), WiFiChannel(65, 6275))
val SET2 = WiFiChannelPair(WiFiChannel(33, 6115), WiFiChannel(97, 6435))
val SET3 = WiFiChannelPair(WiFiChannel(65, 6275), WiFiChannel(129, 6595))
val SET4 = WiFiChannelPair(WiFiChannel(97, 6435), WiFiChannel(161, 6755))
val SET5 = WiFiChannelPair(WiFiChannel(129, 6595), WiFiChannel(189, 6895))
val SET6 = WiFiChannelPair(WiFiChannel(161, 6755), WiFiChannel(233, 7115))
Comment thread
hsinyu-chen marked this conversation as resolved.
Outdated
val SETS = listOf(SET1, SET2, SET3, SET4, SET5, SET6)
private val RANGE = WiFiRange(5925, 7125)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ internal val navigationGHZ6Lines = mapOf(
R.id.graphNavigationLine2 to mapOf(
R.id.graphNavigationSet4 to WiFiChannelsGHZ6.SET4,
R.id.graphNavigationSet5 to WiFiChannelsGHZ6.SET5,
R.id.graphNavigationSet6 to WiFiChannelsGHZ6.SET6,
R.id.graphNavigationSet7 to WiFiChannelsGHZ6.SET7
R.id.graphNavigationSet6 to WiFiChannelsGHZ6.SET6
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ internal fun makeGraphView(
wiFiChannelPair: WiFiChannelPair
): GraphView {
val resources = mainContext.resources
return GraphViewBuilder(wiFiChannelPair.numX(), graphMaximumY, themeStyle, true)
val gridView = GraphViewBuilder(wiFiChannelPair.numX(), graphMaximumY, themeStyle, true)
.setLabelFormatter(ChannelAxisLabel(wiFiBand, wiFiChannelPair))
.setVerticalTitle(resources.getString(R.string.graph_axis_y))
.setHorizontalTitle(resources.getString(R.string.graph_channel_axis_x))
.build(mainContext.context)
if(wiFiBand.ghz6) {
gridView.gridLabelRenderer.setHorizontalLabelsAngle(45)
}
return gridView;
}

internal fun makeDefaultSeries(frequencyEnd: Int, minX: Int): TitleLineGraphSeries<GraphDataPoint> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ import kotlin.math.abs

typealias ChannelWidth = Int

typealias CalculateCenter = (primary: Int, center: Int) -> Int
typealias CalculateCenter = (primary: Int, center: Int, center1: Int) -> Int

internal val calculateCenter20: CalculateCenter = { primary, _ -> primary }
internal val calculateCenter20: CalculateCenter = { primary, _ ,_ -> primary }

internal val calculateCenter40: CalculateCenter = { primary, center ->
internal val calculateCenter40: CalculateCenter = { primary, center, _ ->
if (abs(primary - center) >= WiFiWidth.MHZ_40.frequencyWidthHalf) {
(primary + center) / 2
} else {
center
}
}

internal val calculateCenter80: CalculateCenter = { _, center -> center }
internal val calculateCenter80: CalculateCenter = { _, center, _ -> center }

internal val calculateCenter160: CalculateCenter = { primary, center ->
internal val calculateCenter160: CalculateCenter = { primary, center, _ ->
when (primary) {
// 5GHz
in 5170..5330 -> 5250
Expand All @@ -53,13 +53,15 @@ internal val calculateCenter160: CalculateCenter = { primary, center ->
else -> center
}
}
internal val calculateCenter320: CalculateCenter = { _, _, center1 ->center1 }

enum class WiFiWidth(val channelWidth: ChannelWidth, val frequencyWidth: Int, val guardBand: Int, val calculateCenter: CalculateCenter) {
MHZ_20(ScanResult.CHANNEL_WIDTH_20MHZ, 20, 2, calculateCenter20),
MHZ_40(ScanResult.CHANNEL_WIDTH_40MHZ, 40, 3, calculateCenter40),
MHZ_80(ScanResult.CHANNEL_WIDTH_80MHZ, 80, 3, calculateCenter80),
MHZ_160(ScanResult.CHANNEL_WIDTH_160MHZ, 160, 3, calculateCenter160),
MHZ_80_PLUS(ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ, 80, 3, calculateCenter80);
MHZ_80_PLUS(ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ, 80, 3, calculateCenter80),
MHZ_320(ScanResult.CHANNEL_WIDTH_320MHZ, 320, 3, calculateCenter320);

val frequencyWidthHalf: Int = frequencyWidth / 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ internal class Transformer(private val cache: Cache) {

private fun transform(cacheResult: CacheResult): WiFiDetail {
val scanResult = cacheResult.scanResult

val wiFiWidth = WiFiWidth.findOne(scanResult.channelWidth)
val centerFrequency = wiFiWidth.calculateCenter(scanResult.frequency, scanResult.centerFreq0)
val centerFrequency = wiFiWidth.calculateCenter(scanResult.frequency, scanResult.centerFreq0, scanResult.centerFreq1)
val mc80211 = scanResult.is80211mcResponder
val wiFiStandard = WiFiStandard.findOne(scanResult)
val fastRoaming = FastRoaming.find(scanResult)
Expand Down
11 changes: 0 additions & 11 deletions app/src/main/res/layout/graph_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,6 @@
android:minHeight="0dp"
tools:text="600-699" />

<Button
style="?android:attr/buttonBarButtonStyle"
android:id="@+id/graphNavigationSet7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_vertical_half_margin"
android:layout_weight="1"
android:background="@null"
android:minWidth="0dp"
android:minHeight="0dp"
tools:text="700-799" />
</LinearLayout>
</LinearLayout>

Expand Down
Comment thread
VREMSoftwareDevelopment marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class WiFiChannelsGHZ6Test {
@Test
fun wiFiChannelByChannel() {
assertThat(fixture.wiFiChannelByChannel(1).frequency).isEqualTo(5955)
assertThat(fixture.wiFiChannelByChannel(93).frequency).isEqualTo(6415)
assertThat(fixture.wiFiChannelByChannel(97).frequency).isEqualTo(6435)
}

@Test
Expand All @@ -72,7 +72,7 @@ class WiFiChannelsGHZ6Test {

@Test
fun wiFiChannelLast() {
assertThat(fixture.wiFiChannelLast().channel).isEqualTo(229)
assertThat(fixture.wiFiChannelLast().channel).isEqualTo(233)
}

@Test
Expand All @@ -85,14 +85,13 @@ class WiFiChannelsGHZ6Test {
@Test
fun wiFiChannelPairs() {
val wiFiChannelPairs: List<WiFiChannelPair> = fixture.wiFiChannelPairs()
assertThat(wiFiChannelPairs).hasSize(7)
validatePair(1, 29, wiFiChannelPairs[0])
validatePair(33, 61, wiFiChannelPairs[1])
validatePair(65, 93, wiFiChannelPairs[2])
validatePair(97, 125, wiFiChannelPairs[3])
validatePair(129, 157, wiFiChannelPairs[4])
validatePair(161, 189, wiFiChannelPairs[5])
validatePair(193, 229, wiFiChannelPairs[6])
assertThat(wiFiChannelPairs).hasSize(6)
validatePair(1, 65, wiFiChannelPairs[0])
validatePair(33, 97, wiFiChannelPairs[1])
validatePair(65, 129, wiFiChannelPairs[2])
validatePair(97, 161, wiFiChannelPairs[3])
validatePair(129, 189, wiFiChannelPairs[4])
validatePair(161, 233, wiFiChannelPairs[5])
}

private fun validatePair(expectedFirst: Int, expectedSecond: Int, pair: WiFiChannelPair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ class ChannelGraphNavigationTest {
@Test
fun navigationGHZ6Line2() {
val line2 = navigationGHZ6Lines[R.id.graphNavigationLine2]!!
assertThat(line2).hasSize(4)
assertThat(line2).hasSize(3)
assertThat(WiFiChannelsGHZ6.SET4).isEqualTo(line2[R.id.graphNavigationSet4])
assertThat(WiFiChannelsGHZ6.SET5).isEqualTo(line2[R.id.graphNavigationSet5])
assertThat(WiFiChannelsGHZ6.SET6).isEqualTo(line2[R.id.graphNavigationSet6])
assertThat(WiFiChannelsGHZ6.SET7).isEqualTo(line2[R.id.graphNavigationSet7])
}

private fun whenLines(navigationLines: NavigationLines) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class WiFiWidthTest {

@Test
fun width() {
assertThat(WiFiWidth.entries.size).isEqualTo(5)
assertThat(WiFiWidth.entries.size).isEqualTo(6)
}

@Test
Expand All @@ -36,6 +36,7 @@ class WiFiWidthTest {
assertThat(WiFiWidth.MHZ_80.calculateCenter.javaClass.isInstance(calculateCenter80)).isTrue()
assertThat(WiFiWidth.MHZ_160.calculateCenter.javaClass.isInstance(calculateCenter160)).isTrue()
assertThat(WiFiWidth.MHZ_80_PLUS.calculateCenter.javaClass.isInstance(calculateCenter80)).isTrue()
assertThat(WiFiWidth.MHZ_320.calculateCenter.javaClass.isInstance(calculateCenter320)).isTrue()
}

@Test
Expand All @@ -45,6 +46,7 @@ class WiFiWidthTest {
assertThat(WiFiWidth.MHZ_80.frequencyWidth).isEqualTo(80)
assertThat(WiFiWidth.MHZ_160.frequencyWidth).isEqualTo(160)
assertThat(WiFiWidth.MHZ_80_PLUS.frequencyWidth).isEqualTo(80)
assertThat(WiFiWidth.MHZ_320.frequencyWidth).isEqualTo(320)
}

@Test
Expand All @@ -54,6 +56,7 @@ class WiFiWidthTest {
assertThat(WiFiWidth.MHZ_80.frequencyWidthHalf).isEqualTo(40)
assertThat(WiFiWidth.MHZ_160.frequencyWidthHalf).isEqualTo(80)
assertThat(WiFiWidth.MHZ_80_PLUS.frequencyWidthHalf).isEqualTo(40)
assertThat(WiFiWidth.MHZ_320.frequencyWidthHalf).isEqualTo(160)
}

@Test
Expand All @@ -63,6 +66,7 @@ class WiFiWidthTest {
assertThat(WiFiWidth.MHZ_80.guardBand).isEqualTo(3)
assertThat(WiFiWidth.MHZ_160.guardBand).isEqualTo(3)
assertThat(WiFiWidth.MHZ_80_PLUS.guardBand).isEqualTo(3)
assertThat(WiFiWidth.MHZ_320.guardBand).isEqualTo(3)
}

@Test
Expand All @@ -71,19 +75,20 @@ class WiFiWidthTest {
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_40MHZ)).isEqualTo(WiFiWidth.MHZ_40)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_80MHZ)).isEqualTo(WiFiWidth.MHZ_80)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_160MHZ)).isEqualTo(WiFiWidth.MHZ_160)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_320MHZ)).isEqualTo(WiFiWidth.MHZ_320)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ)).isEqualTo(WiFiWidth.MHZ_80_PLUS)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_20MHZ - 1)).isEqualTo(WiFiWidth.MHZ_20)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_80MHZ_PLUS_MHZ + 1)).isEqualTo(WiFiWidth.MHZ_20)
assertThat(WiFiWidth.findOne(ScanResult.CHANNEL_WIDTH_320MHZ + 1)).isEqualTo(WiFiWidth.MHZ_20)
}

@Test
fun calculateCenter20() {
// setup
val expected = 35
// execute & validate
assertThat(calculateCenter20(expected, Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter20(expected, 0)).isEqualTo(expected)
assertThat(calculateCenter20(expected, Int.MAX_VALUE)).isEqualTo(expected)
assertThat(calculateCenter20(expected, Int.MIN_VALUE,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter20(expected, 0,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter20(expected, Int.MAX_VALUE,Int.MIN_VALUE)).isEqualTo(expected)
}

@Test
Expand All @@ -92,8 +97,8 @@ class WiFiWidthTest {
val primary = 10
val center = primary + WiFiWidth.MHZ_40.frequencyWidthHalf - 1
// execute & validate
assertThat(calculateCenter40(primary, center)).isEqualTo(center)
assertThat(calculateCenter40(center, primary)).isEqualTo(primary)
assertThat(calculateCenter40(primary, center,Int.MIN_VALUE)).isEqualTo(center)
assertThat(calculateCenter40(center, primary,Int.MIN_VALUE)).isEqualTo(primary)
}

@Test
Expand All @@ -103,29 +108,29 @@ class WiFiWidthTest {
val center = primary + WiFiWidth.MHZ_40.frequencyWidthHalf
val expected = (primary + center) / 2
// execute & validate
assertThat(calculateCenter40(primary, center)).isEqualTo(expected)
assertThat(calculateCenter40(center, primary)).isEqualTo(expected)
assertThat(calculateCenter40(primary, center,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter40(center, primary,Int.MIN_VALUE)).isEqualTo(expected)
}

@Test
fun calculateCenter80() {
// setup
val expected = 35
// execute & validate
assertThat(calculateCenter80(Int.MIN_VALUE, expected)).isEqualTo(expected)
assertThat(calculateCenter80(0, expected)).isEqualTo(expected)
assertThat(calculateCenter80(Int.MAX_VALUE, expected)).isEqualTo(expected)
assertThat(calculateCenter80(Int.MIN_VALUE, expected,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter80(0, expected,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter80(Int.MAX_VALUE, expected,Int.MIN_VALUE)).isEqualTo(expected)
}

@Test
fun calculateCenter160Invalid() {
// execute & validate
assertThat(calculateCenter160(5169, Int.MIN_VALUE)).isEqualTo(Int.MIN_VALUE)
assertThat(calculateCenter160(5169, 0)).isEqualTo(0)
assertThat(calculateCenter160(5169, Int.MAX_VALUE)).isEqualTo(Int.MAX_VALUE)
assertThat(calculateCenter160(5896, Int.MIN_VALUE)).isEqualTo(Int.MIN_VALUE)
assertThat(calculateCenter160(5896, 0)).isEqualTo(0)
assertThat(calculateCenter160(5896, Int.MAX_VALUE)).isEqualTo(Int.MAX_VALUE)
assertThat(calculateCenter160(5169, Int.MIN_VALUE,Int.MIN_VALUE)).isEqualTo(Int.MIN_VALUE)
assertThat(calculateCenter160(5169, 0,Int.MIN_VALUE)).isEqualTo(0)
assertThat(calculateCenter160(5169, Int.MAX_VALUE,Int.MIN_VALUE)).isEqualTo(Int.MAX_VALUE)
assertThat(calculateCenter160(5896, Int.MIN_VALUE,Int.MIN_VALUE)).isEqualTo(Int.MIN_VALUE)
assertThat(calculateCenter160(5896, 0,Int.MIN_VALUE)).isEqualTo(0)
assertThat(calculateCenter160(5896, Int.MAX_VALUE,Int.MIN_VALUE)).isEqualTo(Int.MAX_VALUE)
}

@Test
Expand All @@ -136,12 +141,21 @@ class WiFiWidthTest {
}
}

@Test
fun calculateCenter320(){
// setup
val expected = 35
// execute & validate
assertThat(calculateCenter320(Int.MIN_VALUE,Int.MIN_VALUE, expected)).isEqualTo(expected)
assertThat(calculateCenter320(0,Int.MIN_VALUE, expected)).isEqualTo(expected)
assertThat(calculateCenter320(Int.MAX_VALUE,Int.MIN_VALUE, expected)).isEqualTo(expected)
}
private fun validate(expected: Int, start: Int, end: Int) {
// execute & validate
for (value in start..end) {
assertThat(calculateCenter160(value, Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter160(value, 0)).isEqualTo(expected)
assertThat(calculateCenter160(value, Int.MAX_VALUE)).isEqualTo(expected)
assertThat(calculateCenter160(value, Int.MIN_VALUE,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter160(value, 0,Int.MIN_VALUE)).isEqualTo(expected)
assertThat(calculateCenter160(value, Int.MAX_VALUE,Int.MIN_VALUE)).isEqualTo(expected)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ class TransformerTest {
WiFiWidth.MHZ_80 -> FREQUENCY + wiFiWidth.frequencyWidthHalf
WiFiWidth.MHZ_160 -> FREQUENCY + wiFiWidth.frequencyWidth
WiFiWidth.MHZ_80_PLUS -> FREQUENCY + wiFiWidth.frequencyWidthHalf
WiFiWidth.MHZ_320 -> FREQUENCY + wiFiWidth.frequencyWidthHalf
}
scanResult.centerFreq1 = when(wiFiWidth) {
WiFiWidth.MHZ_320 -> FREQUENCY + wiFiWidth.frequencyWidth
else -> -1
}
scanResult.level = LEVEL
scanResult.channelWidth = wiFiWidth.ordinal
Expand Down