kopia lustrzana https://github.com/rt-bishop/Look4Sat
v3.1.4 - Fixed leap year bug, various other minor fixes
rodzic
b1562b4796
commit
04da45e278
|
@ -3,20 +3,20 @@ name: Look4Sat CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- v**
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout latest commit
|
- name: Checkout Latest Commit
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup java environment
|
- name: Setup java environment
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '17'
|
||||||
|
|
||||||
- name: Assemble APK and Bundle
|
- name: Assemble APK and Bundle
|
||||||
run: |
|
run: |
|
||||||
|
@ -34,7 +34,7 @@ jobs:
|
||||||
alias: ${{ secrets.KEY_ALIAS }}
|
alias: ${{ secrets.KEY_ALIAS }}
|
||||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||||
env:
|
env:
|
||||||
BUILD_TOOLS_VERSION: "33.0.0"
|
BUILD_TOOLS_VERSION: "34.0.0"
|
||||||
|
|
||||||
- name: Sign Bundle
|
- name: Sign Bundle
|
||||||
uses: r0adkll/sign-android-release@v1
|
uses: r0adkll/sign-android-release@v1
|
||||||
|
@ -46,25 +46,25 @@ jobs:
|
||||||
alias: ${{ secrets.KEY_ALIAS }}
|
alias: ${{ secrets.KEY_ALIAS }}
|
||||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||||
env:
|
env:
|
||||||
BUILD_TOOLS_VERSION: "33.0.0"
|
BUILD_TOOLS_VERSION: "34.0.0"
|
||||||
|
|
||||||
- name: Rename APK
|
- name: Rename APK and Bundle
|
||||||
run: |
|
run: |
|
||||||
mv ${{steps.sign_apk.outputs.signedReleaseFile}} app/build/outputs/apk/release/look4sat.apk
|
mv ${{steps.sign_apk.outputs.signedReleaseFile}} app/build/outputs/apk/release/look4sat.apk
|
||||||
|
mv ${{steps.sign_bundle.outputs.signedReleaseFile}} app/build/outputs/apk/release/look4sat.aab
|
||||||
|
|
||||||
- name: Deploy Bundle to Play Store
|
- name: Deploy Bundle to Play Store
|
||||||
uses: r0adkll/upload-google-play@v1.0.17
|
uses: r0adkll/upload-google-play@v1
|
||||||
with:
|
with:
|
||||||
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
|
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
|
||||||
packageName: com.rtbishop.look4sat
|
packageName: com.rtbishop.look4sat
|
||||||
|
releaseFiles: app/build/outputs/apk/release/look4sat.aab
|
||||||
track: production
|
track: production
|
||||||
mappingFile: app/build/outputs/mapping/release/mapping.txt
|
|
||||||
whatsNewDirectory: fastlane/metadata/android/en-US/whatsnew
|
whatsNewDirectory: fastlane/metadata/android/en-US/whatsnew
|
||||||
releaseFiles: ${{steps.sign_bundle.outputs.signedReleaseFile}}
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
artifacts: app/build/outputs/apk/release/look4sat.apk
|
artifacts: "app/build/outputs/apk/release/look4sat.apk,app/build/outputs/apk/release/look4sat.aab"
|
||||||
bodyFile: fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US
|
bodyFile: fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US
|
||||||
token: ${{ secrets.RELEASE_TOKEN }}
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
|
@ -7,16 +7,14 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 33
|
|
||||||
buildToolsVersion '33.0.0'
|
|
||||||
namespace 'com.rtbishop.look4sat'
|
namespace 'com.rtbishop.look4sat'
|
||||||
|
compileSdk 34
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.rtbishop.look4sat"
|
applicationId "com.rtbishop.look4sat"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 33
|
targetSdk 34
|
||||||
versionCode 313
|
versionCode 314
|
||||||
versionName '3.1.3'
|
versionName '3.1.4'
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
@ -43,11 +41,11 @@ android {
|
||||||
kotlinCompilerExtensionVersion compose_compiler_version
|
kotlinCompilerExtensionVersion compose_compiler_version
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||||
}
|
}
|
||||||
testOptions {
|
testOptions {
|
||||||
animationsDisabled true
|
animationsDisabled true
|
||||||
|
@ -56,7 +54,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain(11)
|
jvmToolchain(17)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Please add these rules to your existing keep rules in order to suppress warnings.
|
||||||
|
# This is generated automatically by the Android Gradle plugin.
|
||||||
|
-dontwarn org.bouncycastle.jsse.BCSSLParameters
|
||||||
|
-dontwarn org.bouncycastle.jsse.BCSSLSocket
|
||||||
|
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
|
||||||
|
-dontwarn org.conscrypt.Conscrypt$Version
|
||||||
|
-dontwarn org.conscrypt.Conscrypt
|
||||||
|
-dontwarn org.conscrypt.ConscryptHostnameVerifier
|
||||||
|
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
|
||||||
|
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
|
||||||
|
-dontwarn org.openjsse.net.ssl.OpenJSSE
|
|
@ -17,10 +17,10 @@
|
||||||
*/
|
*/
|
||||||
package com.rtbishop.look4sat.framework.data
|
package com.rtbishop.look4sat.framework.data
|
||||||
|
|
||||||
import com.rtbishop.look4sat.domain.data.ILocalRadioSource
|
|
||||||
import com.rtbishop.look4sat.framework.data.dao.RadiosDao
|
|
||||||
import com.rtbishop.look4sat.domain.model.SatRadio as DomainRadio
|
import com.rtbishop.look4sat.domain.model.SatRadio as DomainRadio
|
||||||
import com.rtbishop.look4sat.framework.model.SatRadio as FrameworkRadio
|
import com.rtbishop.look4sat.framework.model.SatRadio as FrameworkRadio
|
||||||
|
import com.rtbishop.look4sat.domain.data.ILocalRadioSource
|
||||||
|
import com.rtbishop.look4sat.framework.data.dao.RadiosDao
|
||||||
|
|
||||||
class LocalRadioSource(private val radiosDao: RadiosDao) : ILocalRadioSource {
|
class LocalRadioSource(private val radiosDao: RadiosDao) : ILocalRadioSource {
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ class LocalRadioSource(private val radiosDao: RadiosDao) : ILocalRadioSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun insertRadios(radios: List<DomainRadio>) {
|
override suspend fun insertRadios(radios: List<DomainRadio>) {
|
||||||
|
radiosDao.deleteRadios()
|
||||||
radiosDao.insertRadios(radios.toFrameworkRadios())
|
radiosDao.insertRadios(radios.toFrameworkRadios())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,12 @@ import com.rtbishop.look4sat.domain.data.DataRepository
|
||||||
import com.rtbishop.look4sat.domain.predict.SatelliteManager
|
import com.rtbishop.look4sat.domain.predict.SatelliteManager
|
||||||
import com.rtbishop.look4sat.framework.LocationManager
|
import com.rtbishop.look4sat.framework.LocationManager
|
||||||
import com.rtbishop.look4sat.framework.SettingsManager
|
import com.rtbishop.look4sat.framework.SettingsManager
|
||||||
import com.rtbishop.look4sat.framework.data.*
|
import com.rtbishop.look4sat.framework.data.FileDataSource
|
||||||
|
import com.rtbishop.look4sat.framework.data.LocalDatabase
|
||||||
|
import com.rtbishop.look4sat.framework.data.LocalEntrySource
|
||||||
|
import com.rtbishop.look4sat.framework.data.LocalRadioSource
|
||||||
|
import com.rtbishop.look4sat.framework.data.MIGRATION_1_2
|
||||||
|
import com.rtbishop.look4sat.framework.data.RemoteDataSource
|
||||||
import com.rtbishop.look4sat.presentation.radarScreen.BTReporter
|
import com.rtbishop.look4sat.presentation.radarScreen.BTReporter
|
||||||
import com.rtbishop.look4sat.utility.DataParser
|
import com.rtbishop.look4sat.utility.DataParser
|
||||||
import com.rtbishop.look4sat.utility.DataReporter
|
import com.rtbishop.look4sat.utility.DataReporter
|
||||||
|
@ -37,11 +42,11 @@ import dagger.Provides
|
||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import javax.inject.Singleton
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
|
|
|
@ -19,7 +19,11 @@ package com.rtbishop.look4sat.presentation.radarScreen
|
||||||
|
|
||||||
import android.hardware.GeomagneticField
|
import android.hardware.GeomagneticField
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.lifecycle.*
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.liveData
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.rtbishop.look4sat.domain.IDataRepository
|
import com.rtbishop.look4sat.domain.IDataRepository
|
||||||
import com.rtbishop.look4sat.domain.ISatelliteManager
|
import com.rtbishop.look4sat.domain.ISatelliteManager
|
||||||
import com.rtbishop.look4sat.domain.ISettingsManager
|
import com.rtbishop.look4sat.domain.ISettingsManager
|
||||||
|
@ -33,10 +37,10 @@ import com.rtbishop.look4sat.utility.DataReporter
|
||||||
import com.rtbishop.look4sat.utility.round
|
import com.rtbishop.look4sat.utility.round
|
||||||
import com.rtbishop.look4sat.utility.toDegrees
|
import com.rtbishop.look4sat.utility.toDegrees
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.isActive
|
import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class RadarViewModel @Inject constructor(
|
class RadarViewModel @Inject constructor(
|
||||||
|
@ -107,8 +111,8 @@ class RadarViewModel @Inject constructor(
|
||||||
if (settings.getRotatorEnabled()) {
|
if (settings.getRotatorEnabled()) {
|
||||||
val server = settings.getRotatorServer()
|
val server = settings.getRotatorServer()
|
||||||
val port = settings.getRotatorPort().toInt()
|
val port = settings.getRotatorPort().toInt()
|
||||||
val azimuth = satPos.azimuth.toDegrees().round(1)
|
val azimuth = satPos.azimuth.toDegrees().round(2)
|
||||||
val elevation = satPos.elevation.toDegrees().round(1)
|
val elevation = satPos.elevation.toDegrees().round(2)
|
||||||
reporter.reportRotation(server, port, azimuth, elevation)
|
reporter.reportRotation(server, port, azimuth, elevation)
|
||||||
}
|
}
|
||||||
_passData.postValue(RadarData(satPos, track))
|
_passData.postValue(RadarData(satPos, track))
|
||||||
|
|
|
@ -69,12 +69,12 @@
|
||||||
<string name="pass_satName">%s</string>
|
<string name="pass_satName">%s</string>
|
||||||
<string name="pass_satId">Id:%d</string>
|
<string name="pass_satId">Id:%d</string>
|
||||||
<string name="pass_aosAz">AOS - %.1f°</string>
|
<string name="pass_aosAz">AOS - %.1f°</string>
|
||||||
<string name="pass_elevation">Elevation: %.1f°</string>
|
<string name="pass_elevation">ELEV: %.1f°</string>
|
||||||
<string name="pass_los">%.1f° - LOS</string>
|
<string name="pass_los">%.1f° - LOS</string>
|
||||||
<string name="pass_altitude">Altitude: %.0f km</string>
|
<string name="pass_altitude">ALT: %.0f km</string>
|
||||||
<string name="pass_placeholder"> - - : - - </string>
|
<string name="pass_placeholder"> - - : - - </string>
|
||||||
<string name="pass_startTime">HH:mm:ss - EEE</string>
|
<string name="pass_startTime">HH:mm:ss - MMM dd</string>
|
||||||
<string name="pass_endTime">EEE - HH:mm:ss</string>
|
<string name="pass_endTime">dd MMM - HH:mm:ss</string>
|
||||||
|
|
||||||
<string name="radar_az_text">Azimuth</string>
|
<string name="radar_az_text">Azimuth</string>
|
||||||
<string name="radar_az_value">%.1f°</string>
|
<string name="radar_az_value">%.1f°</string>
|
||||||
|
|
|
@ -3,7 +3,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain(11)
|
jvmToolchain(17)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.io.InputStream
|
||||||
|
|
||||||
interface IRemoteDataSource {
|
interface IRemoteDataSource {
|
||||||
|
|
||||||
val radioApi: String get() = "https://db.satnogs.org/api/transmitters/?format=json"
|
val radioApi: String get() = "https://db.satnogs.org/api/transmitters/?format=json&status=active"
|
||||||
|
|
||||||
suspend fun getDataStream(url: String): InputStream?
|
suspend fun getDataStream(url: String): InputStream?
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,48 +19,46 @@ package com.rtbishop.look4sat.utility
|
||||||
|
|
||||||
import com.rtbishop.look4sat.domain.model.SatRadio
|
import com.rtbishop.look4sat.domain.model.SatRadio
|
||||||
import com.rtbishop.look4sat.domain.predict.OrbitalData
|
import com.rtbishop.look4sat.domain.predict.OrbitalData
|
||||||
|
import java.io.InputStream
|
||||||
|
import kotlin.math.pow
|
||||||
import kotlinx.coroutines.CoroutineDispatcher
|
import kotlinx.coroutines.CoroutineDispatcher
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.InputStream
|
|
||||||
import kotlin.math.pow
|
|
||||||
|
|
||||||
class DataParser(private val defaultDispatcher: CoroutineDispatcher) {
|
class DataParser(private val defaultDispatcher: CoroutineDispatcher) {
|
||||||
|
|
||||||
suspend fun parseCSVStream(csvStream: InputStream): List<OrbitalData> =
|
suspend fun parseCSVStream(csvStream: InputStream): List<OrbitalData> = withContext(defaultDispatcher) {
|
||||||
withContext(defaultDispatcher) {
|
val parsedItems = mutableListOf<OrbitalData>()
|
||||||
val parsedItems = mutableListOf<OrbitalData>()
|
csvStream.bufferedReader().useLines { lines ->
|
||||||
csvStream.bufferedReader().useLines { lines ->
|
lines.forEachIndexed { index, line ->
|
||||||
lines.forEachIndexed { index, line ->
|
if (index != 0) {
|
||||||
if (index != 0) {
|
val values = line.split(",")
|
||||||
val values = line.split(",")
|
parseCSV(values)?.let { tle -> parsedItems.add(tle) }
|
||||||
parseCSV(values)?.let { tle -> parsedItems.add(tle) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return@withContext parsedItems
|
|
||||||
}
|
}
|
||||||
|
return@withContext parsedItems
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun parseTLEStream(tleStream: InputStream): List<OrbitalData> =
|
suspend fun parseTLEStream(tleStream: InputStream): List<OrbitalData> = withContext(defaultDispatcher) {
|
||||||
withContext(defaultDispatcher) {
|
val tleStrings = mutableListOf(String(), String(), String())
|
||||||
val tleStrings = mutableListOf(String(), String(), String())
|
val parsedItems = mutableListOf<OrbitalData>()
|
||||||
val parsedItems = mutableListOf<OrbitalData>()
|
var lineIndex = 0
|
||||||
var lineIndex = 0
|
tleStream.bufferedReader().forEachLine { line ->
|
||||||
tleStream.bufferedReader().forEachLine { line ->
|
tleStrings[lineIndex] = line
|
||||||
tleStrings[lineIndex] = line
|
if (lineIndex < 2) {
|
||||||
if (lineIndex < 2) {
|
lineIndex++
|
||||||
lineIndex++
|
} else {
|
||||||
} else {
|
val isLineOneValid = tleStrings[1].substring(0, 1) == "1"
|
||||||
val isLineOneValid = tleStrings[1].substring(0, 1) == "1"
|
val isLineTwoValid = tleStrings[2].substring(0, 1) == "2"
|
||||||
val isLineTwoValid = tleStrings[2].substring(0, 1) == "2"
|
if (!isLineOneValid && !isLineTwoValid) return@forEachLine
|
||||||
if (!isLineOneValid && !isLineTwoValid) return@forEachLine
|
parseTLE(tleStrings)?.let { tle -> parsedItems.add(tle) }
|
||||||
parseTLE(tleStrings)?.let { tle -> parsedItems.add(tle) }
|
lineIndex = 0
|
||||||
lineIndex = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return@withContext parsedItems
|
|
||||||
}
|
}
|
||||||
|
return@withContext parsedItems
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun parseJSONStream(jsonStream: InputStream): List<SatRadio> {
|
suspend fun parseJSONStream(jsonStream: InputStream): List<SatRadio> {
|
||||||
return withContext(defaultDispatcher) {
|
return withContext(defaultDispatcher) {
|
||||||
|
@ -78,6 +76,10 @@ class DataParser(private val defaultDispatcher: CoroutineDispatcher) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isLeapYear(year: Int): Boolean {
|
||||||
|
return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)
|
||||||
|
}
|
||||||
|
|
||||||
private fun parseCSV(values: List<String>): OrbitalData? {
|
private fun parseCSV(values: List<String>): OrbitalData? {
|
||||||
try {
|
try {
|
||||||
val name = values[0]
|
val name = values[0]
|
||||||
|
@ -120,8 +122,8 @@ class DataParser(private val defaultDispatcher: CoroutineDispatcher) {
|
||||||
val argper: Double = tle[2].substring(34, 42).toDouble()
|
val argper: Double = tle[2].substring(34, 42).toDouble()
|
||||||
val meanan: Double = tle[2].substring(43, 51).toDouble()
|
val meanan: Double = tle[2].substring(43, 51).toDouble()
|
||||||
val catnum: Int = tle[1].substring(2, 7).trim().toInt()
|
val catnum: Int = tle[1].substring(2, 7).trim().toInt()
|
||||||
val bstar: Double = 1.0e-5 * tle[1].substring(53, 59).toDouble() /
|
val bstar: Double =
|
||||||
10.0.pow(tle[1].substring(60, 61).toDouble())
|
1.0e-5 * tle[1].substring(53, 59).toDouble() / 10.0.pow(tle[1].substring(60, 61).toDouble())
|
||||||
return OrbitalData(name, epoch, meanmo, eccn, incl, raan, argper, meanan, catnum, bstar)
|
return OrbitalData(name, epoch, meanmo, eccn, incl, raan, argper, meanan, catnum, bstar)
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
return null
|
return null
|
||||||
|
@ -153,8 +155,10 @@ class DataParser(private val defaultDispatcher: CoroutineDispatcher) {
|
||||||
val daysArray = arrayOf(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
|
val daysArray = arrayOf(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
|
||||||
var dayOfYear = dayOfMonth
|
var dayOfYear = dayOfMonth
|
||||||
// If leap year increment Feb days
|
// If leap year increment Feb days
|
||||||
if (((year / 4 == 0) && (year / 100 != 0)) || (year / 400 == 0)) daysArray[1]++
|
if (isLeapYear(year)) daysArray[1]++
|
||||||
for (i in 0 until month - 1) { dayOfYear += daysArray[i] }
|
for (i in 0 until month - 1) {
|
||||||
|
dayOfYear += daysArray[i]
|
||||||
|
}
|
||||||
return dayOfYear
|
return dayOfYear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
*/
|
*/
|
||||||
package com.rtbishop.look4sat.utility
|
package com.rtbishop.look4sat.utility
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress
|
||||||
|
import java.nio.ByteBuffer
|
||||||
|
import java.nio.channels.SocketChannel
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.cancelAndJoin
|
import kotlinx.coroutines.cancelAndJoin
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.nio.ByteBuffer
|
|
||||||
import java.nio.channels.SocketChannel
|
|
||||||
|
|
||||||
class DataReporter(private val reporterScope: CoroutineScope) {
|
class DataReporter(private val reporterScope: CoroutineScope) {
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class DataReporter(private val reporterScope: CoroutineScope) {
|
||||||
if (rotationSocketChannel == null) {
|
if (rotationSocketChannel == null) {
|
||||||
rotationSocketChannel = SocketChannel.open(InetSocketAddress(server, port))
|
rotationSocketChannel = SocketChannel.open(InetSocketAddress(server, port))
|
||||||
} else {
|
} else {
|
||||||
val buffer = ByteBuffer.wrap("\\set_pos $azimuth $elevation\n".toByteArray())
|
val buffer = ByteBuffer.wrap("\\P $azimuth $elevation\n".toByteArray())
|
||||||
rotationSocketChannel?.write(buffer)
|
rotationSocketChannel?.write(buffer)
|
||||||
}
|
}
|
||||||
}.onFailure { error ->
|
}.onFailure { error ->
|
||||||
|
|
|
@ -31,6 +31,7 @@ class DataParserTest {
|
||||||
private val validCSVStream = """
|
private val validCSVStream = """
|
||||||
OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,EPHEMERIS_TYPE,CLASSIFICATION_TYPE,NORAD_CAT_ID,ELEMENT_SET_NO,REV_AT_EPOCH,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT
|
OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,EPHEMERIS_TYPE,CLASSIFICATION_TYPE,NORAD_CAT_ID,ELEMENT_SET_NO,REV_AT_EPOCH,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT
|
||||||
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
|
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
|
||||||
|
ISS (ZARYA),1998-067A,2024-03-09T05:45:04.737024,15.49756209,.0005741,51.6418,90.7424,343.9724,92.8274,0,U,25544,999,44305,.25016E-3,.1373E-3,0
|
||||||
FLTSATCOM 8 (USA 46),1989-077A,2022-01-07T11:37:38.074080,1.00273350,.0001114,12.9044,1.3272,91.5769,260.4200,0,U,20253,999,24434,0,-.85E-6,0
|
FLTSATCOM 8 (USA 46),1989-077A,2022-01-07T11:37:38.074080,1.00273350,.0001114,12.9044,1.3272,91.5769,260.4200,0,U,20253,999,24434,0,-.85E-6,0
|
||||||
""".trimIndent().byteInputStream()
|
""".trimIndent().byteInputStream()
|
||||||
private val invalidCSVStream = """
|
private val invalidCSVStream = """
|
||||||
|
@ -41,6 +42,9 @@ class DataParserTest {
|
||||||
ISS (ZARYA)
|
ISS (ZARYA)
|
||||||
1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990
|
1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990
|
||||||
2 25544 51.6447 309.4881 0004694 203.6966 299.8876 15.48582035312205
|
2 25544 51.6447 309.4881 0004694 203.6966 299.8876 15.48582035312205
|
||||||
|
ISS (ZARYA)
|
||||||
|
1 25544U 98067A 24069.23963816 .00013730 00000+0 25016-3 0 9999
|
||||||
|
2 25544 51.6418 90.7424 0005741 343.9724 92.8274 15.49756209443058
|
||||||
FLTSATCOM 8 (USA 46)
|
FLTSATCOM 8 (USA 46)
|
||||||
1 20253U 89077A 22007.48446845 -.00000085 00000+0 00000+0 0 9999
|
1 20253U 89077A 22007.48446845 -.00000085 00000+0 00000+0 0 9999
|
||||||
2 20253 12.9044 1.3272 0001114 91.5769 260.4200 1.00273350244345
|
2 20253 12.9044 1.3272 0001114 91.5769 260.4200 1.00273350244345
|
||||||
|
@ -60,6 +64,7 @@ class DataParserTest {
|
||||||
fun `Given valid CSV stream returns valid data`() = runTest(testDispatcher) {
|
fun `Given valid CSV stream returns valid data`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseCSVStream(validCSVStream)
|
val parsedList = dataParser.parseCSVStream(validCSVStream)
|
||||||
assert(parsedList[0].epoch == 21320.51955234)
|
assert(parsedList[0].epoch == 21320.51955234)
|
||||||
|
assert(parsedList[1].epoch == 24069.23963816)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -72,6 +77,7 @@ class DataParserTest {
|
||||||
fun `Given valid TLE stream returns valid data`() = runTest(testDispatcher) {
|
fun `Given valid TLE stream returns valid data`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseTLEStream(validTLEStream)
|
val parsedList = dataParser.parseTLEStream(validTLEStream)
|
||||||
assert(parsedList[0].epoch == 21320.51955234)
|
assert(parsedList[0].epoch == 21320.51955234)
|
||||||
|
assert(parsedList[1].epoch == 24069.23963816)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -98,4 +104,12 @@ class DataParserTest {
|
||||||
val parsedList = dataParser.parseJSONStream(invalidJSONStream)
|
val parsedList = dataParser.parseJSONStream(invalidJSONStream)
|
||||||
assert(parsedList.isEmpty())
|
assert(parsedList.isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `Function isLeapYear returns correct data`() = runTest(testDispatcher) {
|
||||||
|
val years = listOf(1900, 1984, 1994, 2016, 2022, 2024, 2042, 2048)
|
||||||
|
val answers = listOf(false, true, false, true, false, true, false, true)
|
||||||
|
val results = years.map { dataParser.isLeapYear(it) }
|
||||||
|
assert(results == answers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
hilt_version = '2.44.2'
|
hilt_version = '2.44.2'
|
||||||
application_version = '7.4.0'
|
application_version = '8.3.0'
|
||||||
library_version = '7.1.2'
|
library_version = '7.1.2'
|
||||||
kotlin_android_version = '1.8.0'
|
kotlin_android_version = '1.8.0'
|
||||||
core_ktx_version = '1.9.0'
|
core_ktx_version = '1.9.0'
|
||||||
core_splashscreen_version = '1.0.0'
|
core_splashscreen_version = '1.0.1'
|
||||||
constraint_version = '2.1.4'
|
constraint_version = '2.1.4'
|
||||||
lifecycle_version = '2.5.1'
|
lifecycle_version = '2.5.1'
|
||||||
navigation_version = '2.5.3'
|
navigation_version = '2.5.3'
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Aligned ROTCTL command with Gpredict #121
|
||||||
|
Added ingoring inactive transmitters #125
|
||||||
|
Fixed the satellite predictions bug #126
|
||||||
|
Added date to a satellite pass ENG #127
|
|
@ -1 +1,4 @@
|
||||||
Fixed the satellite data update bug #108
|
Aligned ROTCTL command with Gpredict #121
|
||||||
|
Added ingoring inactive transmitters #125
|
||||||
|
Fixed the satellite predictions bug #126
|
||||||
|
Added date to a satellite pass ENG #127
|
|
@ -21,3 +21,5 @@ kotlin.code.style=official
|
||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
|
android.nonFinalResIds=false
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Fri Jan 27 13:22:02 GMT 2023
|
#Fri Jan 27 13:22:02 GMT 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
Ładowanie…
Reference in New Issue