├── .gitignore ├── .idea ├── .name ├── androidTestResultsUserPreferences.xml ├── codeStyles │ └── Project.xml ├── compiler.xml ├── copyright │ └── GPLv2.xml ├── deploymentTargetSelector.xml ├── gradle.xml ├── migrations.xml ├── misc.xml ├── other.xml └── vcs.xml ├── COPYING ├── README.md ├── app ├── .gitignore ├── app-release.apk ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── info │ │ └── martinmarinov │ │ └── dvbdriver │ │ ├── DataHandler.java │ │ ├── DeviceController.java │ │ ├── DvbFrontendActivity.java │ │ ├── ExceptionDialog.java │ │ ├── GplLicenseActivity.java │ │ └── WelcomeActivity.java │ └── res │ ├── layout │ ├── activity_dvb_frontend.xml │ ├── activity_gpl_license.xml │ └── activity_welcome.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── raw │ └── copying │ ├── values-nb │ └── strings.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── arrays.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── drivers ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── info │ │ │ └── martinmarinov │ │ │ └── drivers │ │ │ ├── DeliverySystem.java │ │ │ ├── DeviceFilter.java │ │ │ ├── DvbCapabilities.java │ │ │ ├── DvbDemux.java │ │ │ ├── DvbDevice.java │ │ │ ├── DvbException.java │ │ │ ├── DvbStatus.java │ │ │ ├── file │ │ │ ├── DvbFileDevice.java │ │ │ └── FileDeviceFilter.java │ │ │ ├── tools │ │ │ ├── AsyncFuture.java │ │ │ ├── BitReverse.java │ │ │ ├── Check.java │ │ │ ├── CompletedFuture.java │ │ │ ├── DeviceFilterMatcher.java │ │ │ ├── DvbMath.java │ │ │ ├── FastIntFilter.java │ │ │ ├── I2cAdapter.java │ │ │ ├── RegMap.java │ │ │ ├── Retry.java │ │ │ ├── SetUtils.java │ │ │ ├── SleepUtils.java │ │ │ ├── ThrowingCallable.java │ │ │ ├── ThrowingRunnable.java │ │ │ ├── UsbPermissionObtainer.java │ │ │ └── io │ │ │ │ ├── NativePipe.java │ │ │ │ └── ThrottledTsSource.java │ │ │ └── usb │ │ │ ├── DvbFrontend.java │ │ │ ├── DvbTuner.java │ │ │ ├── DvbUsbDevice.java │ │ │ ├── DvbUsbDeviceRegistry.java │ │ │ ├── DvbUsbIds.java │ │ │ ├── af9035 │ │ │ ├── Af9033Config.java │ │ │ ├── Af9033Data.java │ │ │ ├── Af9033Frontend.java │ │ │ ├── Af9035Data.java │ │ │ ├── Af9035DvbDevice.java │ │ │ ├── Af9035DvbDeviceCreator.java │ │ │ └── It913x.java │ │ │ ├── cxusb │ │ │ ├── CxUsbDvbDevice.java │ │ │ ├── CxUsbDvbDeviceCreator.java │ │ │ ├── MygicaT230.java │ │ │ └── MygicaT230C.java │ │ │ ├── generic │ │ │ └── AbstractGenericDvbUsbDevice.java │ │ │ ├── rtl28xx │ │ │ ├── Cxd2841er.java │ │ │ ├── E4000Tuner.java │ │ │ ├── E4000TunerData.java │ │ │ ├── FC0012Tuner.java │ │ │ ├── FC0013Tuner.java │ │ │ ├── Mn88472.java │ │ │ ├── Mn88473.java │ │ │ ├── Mn8847X.java │ │ │ ├── R820tTuner.java │ │ │ ├── R820tTunerData.java │ │ │ ├── Rtl2832DvbDevice.java │ │ │ ├── Rtl2832Frontend.java │ │ │ ├── Rtl2832FrontendData.java │ │ │ ├── Rtl2832pFrontend.java │ │ │ ├── Rtl28xxConst.java │ │ │ ├── Rtl28xxDvbDevice.java │ │ │ ├── Rtl28xxSlaveType.java │ │ │ ├── Rtl28xxTunerType.java │ │ │ └── Rtl2xx2DvbDeviceCreator.java │ │ │ └── silabs │ │ │ ├── Si2157.java │ │ │ ├── Si2168.java │ │ │ └── Si2168Data.java │ └── res │ │ ├── raw │ │ ├── dvbdemodsi2168a2001fw │ │ ├── dvbdemodsi2168a3001fw │ │ ├── dvbdemodsi2168b4001fw │ │ ├── dvbdemodsi2168d6001fw │ │ ├── dvbtunersi2141a1001fw │ │ ├── dvbtunersi2158a2001fw │ │ ├── dvbusbaf903502fw │ │ ├── dvbusbit913501fw │ │ ├── dvbusbit913502fw │ │ ├── dvbusbit930301fw │ │ ├── mn8847202fw │ │ └── mn8847301fw │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── info │ └── martinmarinov │ └── drivers │ ├── DeviceFilterMatcherTest.java │ └── tools │ ├── BitReverseTest.java │ ├── ConvertCStringToJavaArrayTool.java │ ├── DvbMathTest.java │ ├── FastIntFilterTest.java │ └── RegMapTest.java ├── dvbservice ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── info │ │ └── martinmarinov │ │ └── dvbservice │ │ └── DeviceFilterXmlEquivalenceTester.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── info │ │ │ └── martinmarinov │ │ │ └── dvbservice │ │ │ ├── DeviceChooserActivity.java │ │ │ ├── DvbServer.java │ │ │ ├── DvbServerPorts.java │ │ │ ├── DvbService.java │ │ │ ├── Request.java │ │ │ ├── Response.java │ │ │ ├── TransferThread.java │ │ │ ├── UsbDelegate.java │ │ │ ├── dialogs │ │ │ ├── ListPickerFragmentDialog.java │ │ │ └── ShowOneInstanceFragmentDialog.java │ │ │ └── tools │ │ │ ├── InetAddressTools.java │ │ │ ├── StackTraceSerializer.java │ │ │ └── TsDumpFileUtils.java │ └── res │ │ ├── drawable │ │ └── ic_notification.png │ │ ├── layout │ │ └── progress.xml │ │ ├── values │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── device_filter.xml │ └── test │ └── java │ └── info │ └── martinmarinov │ └── dvbservice │ ├── RequestTest.java │ └── tools │ ├── StackTraceSerializerTest.java │ └── TsDumpFileUtilsTest.java ├── feature_graphic.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── icon_amazon.png ├── icon_web.png ├── settings.gradle └── usbxfer ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── main ├── AndroidManifest.xml ├── cpp │ ├── CMakeLists.txt │ ├── isorequest.c │ └── usbhispdbulk.c ├── java │ └── info │ │ └── martinmarinov │ │ └── usbxfer │ │ ├── AlternateUsbInterface.java │ │ ├── ByteSink.java │ │ ├── ByteSource.java │ │ ├── IoctlUtils.java │ │ ├── IsoRequest.java │ │ ├── UsbBulkSource.java │ │ └── UsbHiSpeedBulk.java └── res │ └── values │ └── strings.xml └── test └── java └── info └── martinmarinov └── usbxfer └── AlternateUsbInterfaceTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.ser 3 | .gradle 4 | local.properties 5 | .idea/caches/ 6 | .idea/libraries 7 | .idea/modules.xml 8 | .idea/workspace.xml 9 | .idea/navEditor.xml 10 | .idea/assetWizardSettings.xml 11 | .DS_Store 12 | build/ 13 | captures/ 14 | .externalNativeBuild 15 | .cxx 16 | *.apk 17 | *.aab 18 | CMakeLists.txt.user 19 | CMakeCache.txt 20 | CMakeFiles 21 | CMakeScripts 22 | Testing 23 | Makefile 24 | cmake_install.cmake 25 | install_manifest.txt 26 | compile_commands.json 27 | CTestTestfile.cmake 28 | _deps 29 | *.d 30 | *.slo 31 | *.lo 32 | *.o 33 | *.obj 34 | *.gch 35 | *.pch 36 | *.so 37 | *.dylib 38 | *.dll 39 | *.mod 40 | *.smod 41 | *.lai 42 | *.la 43 | *.a 44 | *.lib 45 | *.exe 46 | *.out 47 | *.app 48 | *.ko 49 | *.elf 50 | *.ilk 51 | *.map 52 | *.exp 53 | *.so.* 54 | *.i*86 55 | *.x86_64 56 | *.hex 57 | *.dSYM/ 58 | *.su 59 | *.idb 60 | *.pdb 61 | *.mod* 62 | *.cmd 63 | .tmp_versions/ 64 | modules.order 65 | Module.symvers 66 | Mkfile.old 67 | dkms.conf 68 | .vscode/* 69 | !.vscode/settings.json 70 | !.vscode/tasks.json 71 | !.vscode/launch.json 72 | !.vscode/extensions.json 73 | *.code-workspace 74 | .ninja_deps 75 | .ninja_log 76 | 77 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | DVBDriver -------------------------------------------------------------------------------- /.idea/androidTestResultsUserPreferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 34 | 35 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/GPLv2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/deploymentTargetSelector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![App Icon](app/src/main/res/mipmap-xxxhdpi/ic_launcher.png) 2 | 3 | # Android DVB-T Driver 4 | 5 | This driver provides a simple TCP based API that allows 6 | controlling USB DVB-T/DVB-T2 tuners on Android. It gives other apps access to 7 | the raw DVB MPEG-2 TS stream. 8 | 9 | The driver is a simplified user space port of a subset of 10 | the V4L2 Linux kernel drivers. Under the hood it uses Android USB Host API 11 | with a small helper library that allows fast kernel controlled USB bulk transfers. 12 | 13 | # Download 14 | 15 | * [Download DVB-T Driver on Google Play](https://play.google.com/store/apps/details?id=info.martinmarinov.dvbdriver) 16 | * [Download DVB-T Driver on Amazon](https://www.amazon.com/gp/mas/dl/android?p=info.martinmarinov.dvbdriver) 17 | * Download latest pre-compiled APK from GitHub: [app-release.apk](https://github.com/martinmarinov/AndroidDvbDriver/releases/latest) 18 | 19 | # Usage 20 | 21 | The driver has an Activity that demonstrates direct connection to hardware 22 | and allows dumping the raw DVB-T/T2 transport stream to a file. 23 | 24 | A socket interface is built on top of that functionality to allow the driver 25 | to be used by third party apps over TCP. If you want to use the driver via the 26 | exposed TCP interface, you have to do the following steps from your own app: 27 | 28 | 1. Launch an android intent 29 | ```java 30 | startActivityForResult(new Intent(Intent.ACTION_VIEW) 31 | .setData(new Uri.Builder().scheme("dtvdriver").build()), SOME_CODE); 32 | ``` 33 | 1. If the activity returns successfully, you will receive two TCP port numbers to bind to. 34 | One of them is the control port where you can send commands and receive responses. 35 | The other port will provide the raw TS stream. 36 | 1. You can then start sending commands over the control port and process the TS stream. 37 | 38 | For actual details on the protocol, take a look at the `dvbservice` module. There 39 | are no official docs provided, if you would like to volunteer to write one get in touch with me. 40 | 41 | There is also a handy "debug" mode that allows the driver to play the pre-recorded TS dumps 42 | as if they are coming from a real device. This mode is extremely useful during development. 43 | 44 | Note that this driver does not provide channel/programme scanning/playback capabilities or any transport stream processing. 45 | If you would like to write an app for DVB playback, you have to implement all of these yourself. 46 | 47 | # Auto start 48 | 49 | The driver will emmit `info.martinmarinov.dvbdriver.DVB_DEVICE_ATTACHED` action when a compatible USB tuner has 50 | been connected to the Android device. You can use this intent to launch your application automatically. 51 | 52 | # Supported hardware 53 | 54 | Currently: 55 | * RTL2832 with tuner chip R820t 56 | * RTL2832 with tuner chip E4000 57 | * RTL2832 with tuner chip R828D (DVB-T2 support for MN88473, MN88472, CXD2837ER & CXD2841ER devices) 58 | * RTL2832 with tuner chip FC0012 59 | * RTL2832 with tuner chip FC0013 60 | * MyGica T230 61 | * MyGica (Geniatech) T230C DVB-T/T2/C 62 | * MyGica Pad TV Tuner PT360 63 | * EVOLVEO XtraTV stick (Some unbranded Android DVB-T sticks) 64 | * PCTV AndroiDTV (78e) 65 | * Potentially other AF9035 dongles. If your dongle works let me know and I will add it to this list. 66 | 67 | The driver is not limited to these devices only. If a device has a Linux kernel driver, then it probably could be ported. 68 | If you have ported a driver for a device, get in touch with me so we can add it to the main driver. 69 | 70 | # Apps that use the driver 71 | 72 | * [Aerial TV](http://aerialtv.eu/) 73 | * [DVBTTelevizor](https://play.google.com/store/apps/details?id=net.petrjanousek.DVBTTelevizor) 74 | 75 | If you would like your app to appear here, open a GitHub issue and I will be happy to add it! 76 | 77 | # Important advice 78 | 79 | Google Play has very strict rules about apps that can be used to access any TV content. Make sure not to include any TV sceenshots or anything that looks like TV screenshots in your app listing. The description of your app should be very clear that your app does not bundle any content and content is provided by the end user. 80 | 81 | Please keep in mind that even if you follow all of the above, your app may still get suspended. The above is just a friendly sugggestion from a developer that has already gone through the worst of this process. This is not official or legal advice. -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/signalwareltd/AndroidDvbDriver/f68f5e28cc4c854c0e66cca80fe0d1418e53638e/app/app-release.apk -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an Android user space port of DVB-T Linux kernel modules. 3 | * 4 | * Copyright (C) 2022 by Signalware Ltd 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | plugins { 22 | id 'com.android.application' 23 | } 24 | 25 | android { 26 | namespace 'info.martinmarinov.dvbdriver' 27 | compileSdk 34 28 | 29 | defaultConfig { 30 | applicationId "info.martinmarinov.dvbdriver" 31 | minSdk 21 32 | targetSdk 34 33 | versionCode 29 34 | versionName "1.43" 35 | 36 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 37 | } 38 | 39 | buildTypes { 40 | release { 41 | minifyEnabled false 42 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 43 | } 44 | } 45 | compileOptions { 46 | sourceCompatibility JavaVersion.VERSION_1_8 47 | targetCompatibility JavaVersion.VERSION_1_8 48 | } 49 | } 50 | 51 | dependencies { 52 | implementation 'androidx.appcompat:appcompat:1.5.1' 53 | implementation 'com.google.android.material:material:1.7.0' 54 | testImplementation 'junit:junit:4.13.2' 55 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 56 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 57 | implementation project(path: ':drivers') 58 | implementation project(path: ':dvbservice') 59 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/martinmarinov/Android/Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/info/martinmarinov/dvbdriver/DataHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an Android user space port of DVB-T Linux kernel modules. 3 | * 4 | * Copyright (C) 2022 by Signalware Ltd 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | package info.martinmarinov.dvbdriver; 22 | 23 | import java.io.File; 24 | import java.io.FileNotFoundException; 25 | import java.io.FileOutputStream; 26 | import java.io.IOException; 27 | import java.io.InputStream; 28 | import java.util.Date; 29 | 30 | import info.martinmarinov.dvbservice.tools.TsDumpFileUtils; 31 | 32 | class DataHandler extends Thread { 33 | private final DvbFrontendActivity dvbFrontendActivity; 34 | private final Object recordingLock = new Object(); 35 | private final InputStream is; 36 | 37 | private boolean recording = false; 38 | private File file; 39 | private FileOutputStream fos; 40 | private int recordedSize = 0; 41 | 42 | private long readB = 0; 43 | private long currFreq; 44 | private long currBandwidth; 45 | 46 | DataHandler(DvbFrontendActivity dvbFrontendActivity, InputStream is) { 47 | this.dvbFrontendActivity = dvbFrontendActivity; 48 | this.is = is; 49 | } 50 | 51 | void reset() { 52 | readB = 0; 53 | } 54 | 55 | void setFreqAndBandwidth(long freq, long bandwidth) { 56 | this.currFreq = freq; 57 | this.currBandwidth = bandwidth; 58 | } 59 | 60 | @Override 61 | public void interrupt() { 62 | super.interrupt(); 63 | try { 64 | is.close(); 65 | } catch (IOException ignored) {} 66 | } 67 | 68 | @Override 69 | public void run() { 70 | try { 71 | long nextUpdate = System.currentTimeMillis() + 1_000; 72 | byte[] b = new byte[1024]; 73 | while (!isInterrupted()) { 74 | 75 | int read = is.read(b); 76 | if (read > 0) { 77 | synchronized (recordingLock) { 78 | if (recording) { 79 | fos.write(b, 0, read); 80 | recordedSize += read; 81 | } 82 | } 83 | 84 | readB += b.length; 85 | } else { 86 | try { 87 | Thread.sleep(100); 88 | } catch (InterruptedException e) { 89 | interrupt(); 90 | } 91 | continue; 92 | } 93 | 94 | if (System.currentTimeMillis() > nextUpdate) { 95 | nextUpdate = System.currentTimeMillis() + 1_000; 96 | if (recording) { 97 | dvbFrontendActivity.announceRecorded(file, recordedSize); 98 | } else { 99 | dvbFrontendActivity.announceBitRate(readB); 100 | } 101 | readB = 0; 102 | } 103 | } 104 | } catch (IOException e) { 105 | if (!isInterrupted()) { 106 | throw new RuntimeException(e); 107 | } 108 | } finally { 109 | try { 110 | if (fos != null) fos.close(); 111 | } catch (IOException ignored) { 112 | } 113 | } 114 | } 115 | 116 | boolean isRecording() { 117 | return recording; 118 | } 119 | 120 | void startRecording() throws FileNotFoundException { 121 | synchronized (recordingLock) { 122 | file = TsDumpFileUtils.getFor(dvbFrontendActivity.getApplicationContext(), currFreq, currBandwidth, new Date()); 123 | fos = new FileOutputStream(file, false); 124 | recordedSize = 0; 125 | recording = true; 126 | } 127 | } 128 | 129 | void stopRecording() throws IOException { 130 | synchronized (recordingLock) { 131 | recording = false; 132 | fos.close(); 133 | fos = null; 134 | file = null; 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /app/src/main/java/info/martinmarinov/dvbdriver/GplLicenseActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an Android user space port of DVB-T Linux kernel modules. 3 | * 4 | * Copyright (C) 2022 by Signalware Ltd 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | package info.martinmarinov.dvbdriver; 22 | 23 | import android.os.Bundle; 24 | import android.app.Activity; 25 | import android.view.View; 26 | import android.widget.TextView; 27 | 28 | import java.io.Closeable; 29 | import java.io.IOException; 30 | import java.io.InputStream; 31 | import java.util.Scanner; 32 | 33 | public class GplLicenseActivity extends Activity { 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_gpl_license); 39 | 40 | findViewById(R.id.license_btnOk).setOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View v) { 43 | finish(); 44 | } 45 | }); 46 | 47 | ((TextView) findViewById(R.id.license_Txt)).setText(readToText(getResources().openRawResource(R.raw.copying))); 48 | } 49 | 50 | private String readToText(InputStream inputStream) { 51 | try { 52 | Scanner s = new Scanner(inputStream, "UTF-8").useDelimiter("\\A"); 53 | return s.next(); 54 | } finally { 55 | closeOrDie(inputStream); 56 | } 57 | } 58 | 59 | private static void closeOrDie(Closeable c) { 60 | try { 61 | c.close(); 62 | } catch (IOException e) { 63 | throw new RuntimeException(e); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/info/martinmarinov/dvbdriver/WelcomeActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an Android user space port of DVB-T Linux kernel modules. 3 | * 4 | * Copyright (C) 2022 by Signalware Ltd 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | package info.martinmarinov.dvbdriver; 22 | 23 | import android.content.Intent; 24 | import android.net.Uri; 25 | import android.os.Bundle; 26 | import android.app.Activity; 27 | import android.view.View; 28 | 29 | public class WelcomeActivity extends Activity { 30 | private final static Uri SOURCE_URL = Uri.parse("https://github.com/signalwareltd/AndroidDvbDriver"); 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.activity_welcome); 36 | 37 | findViewById(R.id.btn_close).setOnClickListener(v -> finish()); 38 | 39 | findViewById(R.id.btn_advanced_mode).setOnClickListener(v -> startActivity(new Intent(WelcomeActivity.this, DvbFrontendActivity.class))); 40 | 41 | findViewById(R.id.btn_source_code).setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, SOURCE_URL))); 42 | 43 | findViewById(R.id.btn_license).setOnClickListener(v -> startActivity(new Intent(WelcomeActivity.this, GplLicenseActivity.class))); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_gpl_license.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 29 | 30 | 34 | 35 | 38 | 39 | 45 | 46 | 47 | 48 | 49 | 50 |