Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d034731b0 | |||
| 6b309798b8 | |||
| abced7d982 | |||
| c329ce9279 | |||
| b583bb29f9 |
@@ -1,9 +1,15 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/app/build
|
|
||||||
/app/release
|
|
||||||
/captures
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AndroidProjectSystem">
|
||||||
|
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="21" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetSelector">
|
||||||
|
<selectionStates>
|
||||||
|
<SelectionState runConfigName="app">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
</selectionStates>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectMigrations">
|
||||||
|
<option name="MigrateToGradleLocalJavaHome">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
kotlin version: 2.0.21
|
||||||
|
error message: Failed connecting to the daemon in 4 retries
|
||||||
|
|
||||||
|
error message: Daemon compilation failed: Could not connect to Kotlin compile daemon
|
||||||
|
java.lang.RuntimeException: Could not connect to Kotlin compile daemon
|
||||||
|
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:214)
|
||||||
|
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:159)
|
||||||
|
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:111)
|
||||||
|
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:76)
|
||||||
|
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
|
||||||
|
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
|
||||||
|
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
|
||||||
|
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
|
||||||
|
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
|
||||||
|
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
|
||||||
|
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:210)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:205)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:67)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:60)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:167)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:60)
|
||||||
|
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:54)
|
||||||
|
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
|
||||||
|
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
|
||||||
|
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:174)
|
||||||
|
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
|
||||||
|
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:194)
|
||||||
|
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:127)
|
||||||
|
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:169)
|
||||||
|
at org.gradle.internal.Factories$1.create(Factories.java:31)
|
||||||
|
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:263)
|
||||||
|
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:127)
|
||||||
|
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:132)
|
||||||
|
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
|
||||||
|
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:133)
|
||||||
|
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
|
||||||
|
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
|
||||||
|
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
|
||||||
|
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
|
||||||
|
at java.base/java.lang.Thread.run(Unknown Source)
|
||||||
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
language: android
|
|
||||||
sudo: true
|
|
||||||
|
|
||||||
install:
|
|
||||||
- echo y | android update sdk -u -a -t tools
|
|
||||||
- echo y | android update sdk -u -a -t platform-tools
|
|
||||||
- echo y | android update sdk -u -a -t build-tools-26.0.2
|
|
||||||
- echo y | android update sdk -u -a -t android-25
|
|
||||||
- echo y | android update sdk -u -a -t extra-google-m2repository
|
|
||||||
- echo y | android update sdk -u -a -t extra-android-m2repository
|
|
||||||
|
|
||||||
script: ./gradlew assembleRelease testReleaseUnitTest lintRelease
|
|
||||||
|
|
||||||
after_failure:
|
|
||||||
- cat app/build/reports/tests/debug/index.html
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[main]
|
|
||||||
host = https://www.transifex.com
|
|
||||||
|
|
||||||
[child-monitor.stringsxml]
|
|
||||||
file_filter = app/src/main/res/values-<lang>/strings.xml
|
|
||||||
minimum_perc = 0
|
|
||||||
source_file = app/src/main/res/values/strings.xml
|
|
||||||
source_lang = en
|
|
||||||
type = ANDROID
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Branden Archer:
|
|
||||||
Initial concept and implementation
|
|
||||||
Naofumi Fukue:
|
|
||||||
Added Japanese translation
|
|
||||||
Enguerrand de Rochefort
|
|
||||||
Continuation of implementation
|
|
||||||
|
|
||||||
Anybody who has contributed code to Child Monitor (or Protect Baby Monitor) is considered
|
|
||||||
an author. Send pull requests to this project for additions to this file.
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
How to Submit Patches to the Child Monitor Project
|
|
||||||
===============================================================================
|
|
||||||
https://github.com/enguerrand/child-monitor
|
|
||||||
|
|
||||||
This document is intended to act as a guide to help you contribute to the
|
|
||||||
Child Monitor project. It is not perfect, and there will always be exceptions
|
|
||||||
to the rules described here, but by following the instructions below you
|
|
||||||
should have a much easier time getting your work merged with the upstream
|
|
||||||
project.
|
|
||||||
|
|
||||||
## Test Your Code
|
|
||||||
|
|
||||||
There are four possible tests you can run to verify your code. The first
|
|
||||||
is unit tests, which check the basic functionality of the application, and
|
|
||||||
can be run by gradle using:
|
|
||||||
|
|
||||||
# ./gradlew testReleaseUnitTest
|
|
||||||
|
|
||||||
The second check for common problems uses static analysis.
|
|
||||||
This is the Android lint checker, run using:
|
|
||||||
|
|
||||||
# ./gradlew lintRelease
|
|
||||||
|
|
||||||
|
|
||||||
The final check is by testing the application on a live device and verifying
|
|
||||||
the basic functionality works as expected.
|
|
||||||
|
|
||||||
## Explain Your Work
|
|
||||||
|
|
||||||
At the top of every patch you should include a description of the problem you
|
|
||||||
are trying to solve, how you solved it, and why you chose the solution you
|
|
||||||
implemented. If you are submitting a bug fix, it is also incredibly helpful
|
|
||||||
if you can describe/include a reproducer for the problem in the description as
|
|
||||||
well as instructions on how to test for the bug and verify that it has been
|
|
||||||
fixed.
|
|
||||||
|
|
||||||
## Sign Your Work
|
|
||||||
|
|
||||||
The sign-off is a simple line at the end of the patch description, which
|
|
||||||
certifies that you wrote it or otherwise have the right to pass it on as an
|
|
||||||
open-source patch. The "Developer's Certificate of Origin" pledge is taken
|
|
||||||
from the Linux Kernel and the rules are pretty simple:
|
|
||||||
|
|
||||||
Developer's Certificate of Origin 1.1
|
|
||||||
|
|
||||||
By making a contribution to this project, I certify that:
|
|
||||||
|
|
||||||
(a) The contribution was created in whole or in part by me and I
|
|
||||||
have the right to submit it under the open source license
|
|
||||||
indicated in the file; or
|
|
||||||
|
|
||||||
(b) The contribution is based upon previous work that, to the best
|
|
||||||
of my knowledge, is covered under an appropriate open source
|
|
||||||
license and I have the right under that license to submit that
|
|
||||||
work with modifications, whether created in whole or in part
|
|
||||||
by me, under the same open source license (unless I am
|
|
||||||
permitted to submit under a different license), as indicated
|
|
||||||
in the file; or
|
|
||||||
|
|
||||||
(c) The contribution was provided directly to me by some other
|
|
||||||
person who certified (a), (b) or (c) and I have not modified
|
|
||||||
it.
|
|
||||||
|
|
||||||
(d) I understand and agree that this project and the contribution
|
|
||||||
are public and that a record of the contribution (including all
|
|
||||||
personal information I submit with it, including my sign-off) is
|
|
||||||
maintained indefinitely and may be redistributed consistent with
|
|
||||||
this project or the open source license(s) involved.
|
|
||||||
|
|
||||||
... then you just add a line to the bottom of your patch description, with
|
|
||||||
your real name, saying:
|
|
||||||
|
|
||||||
Signed-off-by: Random J Developer <random@developer.example.org>
|
|
||||||
|
|
||||||
## Submit Patch(es) for Review
|
|
||||||
|
|
||||||
Finally, you will need to submit your patches so that they can be reviewed
|
|
||||||
and potentially merged into the main Child Monitor repository. The preferred
|
|
||||||
way to do this is to submit a Pull Request to the Child Monitor project.
|
|
||||||
Changes need to apply cleanly onto the master branch and pass all
|
|
||||||
unit tests and produce no errors during static analysis.
|
|
||||||
@@ -1,675 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
{one line to give the program's name and a brief idea of what it does.}
|
|
||||||
Copyright (C) {year} {name of author}
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
{project} Copyright (C) {year} {fullname}
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
Sun Jan 3, 2016: Release 0.2
|
|
||||||
|
|
||||||
* Improve and simplify audio playback to reduce dropped
|
|
||||||
audio samples
|
|
||||||
|
|
||||||
* A parent device may pair with a child device by entering
|
|
||||||
the child's IP address and port.
|
|
||||||
|
|
||||||
* Japanese translation
|
|
||||||
|
|
||||||
|
|
||||||
Mon Dec 28, 2015: Release 0.1
|
|
||||||
|
|
||||||
* Initial release
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
# Child Monitor
|
|
||||||
An Open Source Child Monitor for Android
|
|
||||||
|
|
||||||
_Child Monitor_ allows two Android devices to act as a baby monitor. The first device,
|
|
||||||
left in the room with the baby, will advertise itself on the network and stream audio
|
|
||||||
to a connected client. The second device, with the parent, will connect to the monitoring
|
|
||||||
device and receive an audio stream.
|
|
||||||
|
|
||||||
The project is a fork of _Protect Baby Monitor_ which is declared as "on hiatus" by its developer.
|
|
||||||
|
|
||||||
_Child Monitor_ works on Android 5.0 (Lollipop) and newer, i.e. Android SDK 21.
|
|
||||||
|
|
||||||
The current version of _Child Monitor_ is rudimentary at best. It is capable
|
|
||||||
of successfully advertising itself on the network, allows clients to connect,
|
|
||||||
and streams audio. Room for improvement includes:
|
|
||||||
|
|
||||||
1. Robust usage of the AudioTrack API
|
|
||||||
2. Handle dropped packets gracefully
|
|
||||||
3. Use of GSM when no internet connectivity is available
|
|
||||||
|
|
||||||
At the time this project was forked from _Protect Baby Monitor_ there was no obvious open source solution for a
|
|
||||||
baby monitor for Android in F-Droid.
|
|
||||||
|
|
||||||
# License information
|
|
||||||
_Child Monitor_ is licensed under the GPLv3. The Ulaw encoding / decoding code is licensed under the Apache License, Version 2.0 and taken from the Android Open Source Project.
|
|
||||||
|
|
||||||
# Thanks
|
|
||||||
Audio file originals from [freesound](https://freesound.org).
|
|
||||||
This whole project originally created by [brarcher](https://github.com/brarcher/protect-baby-monitor).
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'org.jetbrains.kotlin.android'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdk 34
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "de.rochefort.childmonitor"
|
|
||||||
minSdkVersion 21
|
|
||||||
targetSdkVersion 34
|
|
||||||
versionCode 13
|
|
||||||
versionName "1.3"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
namespace 'de.rochefort.childmonitor'
|
|
||||||
lint {
|
|
||||||
abortOnError true
|
|
||||||
warning 'MissingTranslation'
|
|
||||||
}
|
|
||||||
compileOptions {
|
|
||||||
// Sets Java compatibility to Java 21
|
|
||||||
sourceCompatibility JavaVersion.VERSION_21
|
|
||||||
targetCompatibility JavaVersion.VERSION_21
|
|
||||||
}
|
|
||||||
kotlin {
|
|
||||||
jvmToolchain(21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation 'androidx.core:core:1.12.0'
|
|
||||||
implementation 'androidx.core:core-ktx:1.12.0'
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "com.example.babyphone"
|
||||||
|
compileSdk {
|
||||||
|
version = release(36)
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "com.example.babyphone"
|
||||||
|
minSdk = 21
|
||||||
|
targetSdk = 36
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
|
implementation(libs.androidx.activity.compose)
|
||||||
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
|
implementation(libs.androidx.compose.ui)
|
||||||
|
implementation(libs.androidx.compose.ui.graphics)
|
||||||
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
||||||
|
implementation(libs.androidx.compose.material3)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||||
|
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
|
||||||
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
||||||
|
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
||||||
|
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.example.babyphone
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("com.example.babyphone", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,69 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:versionCode="2"
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
android:versionName="0.2">
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.ACCESS_NETWORK_STATE"
|
|
||||||
android:required="true" />
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.INTERNET"
|
|
||||||
android:required="true" />
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.RECORD_AUDIO"
|
|
||||||
android:required="true" />
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.ACCESS_WIFI_STATE"
|
|
||||||
android:required="true" />
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"
|
|
||||||
android:required="true" />
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.FOREGROUND_SERVICE"/>
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
|
|
||||||
<uses-permission
|
|
||||||
android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@android:style/Theme.Holo">
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
<service
|
<activity android:name=".MainActivity"
|
||||||
android:name=".ListenService"
|
android:exported="true"
|
||||||
android:enabled="true"
|
android:theme="@style/AppTheme">
|
||||||
android:foregroundServiceType="mediaPlayback"
|
|
||||||
android:exported="false"/>
|
|
||||||
<service
|
|
||||||
android:name=".MonitorService"
|
|
||||||
android:enabled="true"
|
|
||||||
android:foregroundServiceType="microphone"
|
|
||||||
android:exported="false"/>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".StartActivity"
|
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".MonitorActivity"
|
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:parentActivityName=".StartActivity" />
|
|
||||||
<activity
|
|
||||||
android:name=".DiscoverActivity"
|
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:parentActivityName=".StartActivity"
|
|
||||||
android:windowSoftInputMode="adjustPan" />
|
|
||||||
<activity
|
|
||||||
android:name=".ListenActivity"
|
|
||||||
android:configChanges="orientation|screenSize"
|
|
||||||
android:parentActivityName=".DiscoverActivity" />
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
package com.example.babyphone;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.media.AudioFormat;
|
||||||
|
import android.media.AudioRecord;
|
||||||
|
import android.media.MediaRecorder;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private static final int SAMPLE_RATE = 8000;
|
||||||
|
private static final int PORT = 50005;
|
||||||
|
private boolean isStreaming = false;
|
||||||
|
private Thread recordingThread;
|
||||||
|
private Thread clientListenerThread;
|
||||||
|
private ServerSocket serverSocket;
|
||||||
|
|
||||||
|
private final List<Socket> clients = new ArrayList<>();
|
||||||
|
|
||||||
|
private String getLocalIpAddress() {
|
||||||
|
try {
|
||||||
|
for (java.util.Enumeration<java.net.NetworkInterface> en = java.net.NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
|
||||||
|
java.net.NetworkInterface intf = en.nextElement();
|
||||||
|
for (java.util.Enumeration<java.net.InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
|
||||||
|
java.net.InetAddress inetAddress = enumIpAddr.nextElement();
|
||||||
|
if (!inetAddress.isLoopbackAddress() && inetAddress instanceof java.net.Inet4Address) {
|
||||||
|
return inetAddress.getHostAddress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return "unbekannt";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
TextView ipAddressText = findViewById(R.id.ipAddressText);
|
||||||
|
String ip = getLocalIpAddress();
|
||||||
|
ipAddressText.setText("Sever(Kinder)-IP-Adresse: " + ip);
|
||||||
|
|
||||||
|
Button startStreamButton = findViewById(R.id.startStreamButton);
|
||||||
|
|
||||||
|
startStreamButton.setOnClickListener(v -> {
|
||||||
|
if (!isStreaming) {
|
||||||
|
if (checkPermissions()) {
|
||||||
|
startStreaming();
|
||||||
|
startStreamButton.setText("Stop Streaming");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stopStreaming();
|
||||||
|
startStreamButton.setText("Start Streaming");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkPermissions() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
if (checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(this,
|
||||||
|
new String[]{Manifest.permission.RECORD_AUDIO}, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startStreaming() {
|
||||||
|
isStreaming = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
serverSocket = new ServerSocket(PORT);
|
||||||
|
showToast("Server gestartet auf Port " + PORT);
|
||||||
|
} catch (IOException e) {
|
||||||
|
showToast("Fehler beim Start des Servers: " + e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Thread: Neue Clients annehmen
|
||||||
|
clientListenerThread = new Thread(() -> {
|
||||||
|
while (isStreaming) {
|
||||||
|
try {
|
||||||
|
Socket client = serverSocket.accept();
|
||||||
|
synchronized (clients) {
|
||||||
|
clients.add(client);
|
||||||
|
}
|
||||||
|
showToast("Neuer Client: " + client.getInetAddress());
|
||||||
|
} catch (IOException e) {
|
||||||
|
if (isStreaming) {
|
||||||
|
showToast("Fehler beim Client-Connect: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
clientListenerThread.start();
|
||||||
|
|
||||||
|
// Thread: Audio aufnehmen und an alle Clients senden (mit µ-law)
|
||||||
|
// Thread: Audio aufnehmen und an alle Clients senden (µ-Law, 8kHz)
|
||||||
|
recordingThread = new Thread(() -> {
|
||||||
|
int minBufferSize = AudioRecord.getMinBufferSize(8000, // neue Sample-Rate
|
||||||
|
AudioFormat.CHANNEL_IN_MONO,
|
||||||
|
AudioFormat.ENCODING_PCM_16BIT);
|
||||||
|
|
||||||
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(this,
|
||||||
|
new String[]{Manifest.permission.RECORD_AUDIO},
|
||||||
|
1001);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioRecord recorder = null;
|
||||||
|
try {
|
||||||
|
recorder = new AudioRecord(
|
||||||
|
MediaRecorder.AudioSource.MIC,
|
||||||
|
44100, // Aufnahme weiterhin mit nativer Rate
|
||||||
|
AudioFormat.CHANNEL_IN_MONO,
|
||||||
|
AudioFormat.ENCODING_PCM_16BIT,
|
||||||
|
minBufferSize
|
||||||
|
);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] pcmBuffer = new byte[minBufferSize];
|
||||||
|
recorder.startRecording();
|
||||||
|
|
||||||
|
// Buffer für Resampling
|
||||||
|
short[] pcmSamples = new short[minBufferSize / 2];
|
||||||
|
|
||||||
|
while (isStreaming) {
|
||||||
|
int read = recorder.read(pcmBuffer, 0, pcmBuffer.length);
|
||||||
|
if (read > 0) {
|
||||||
|
// PCM Byte-Array → short[]
|
||||||
|
ByteBuffer.wrap(pcmBuffer, 0, read).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(pcmSamples, 0, read / 2);
|
||||||
|
|
||||||
|
// Resample 44.1kHz -> 8kHz (einfaches Downsampling, z.B. jede 5.5. Probe nehmen)
|
||||||
|
short[] downsampled = new short[(int) (pcmSamples.length * 8000f / 44100f)];
|
||||||
|
for (int i = 0; i < downsampled.length; i++) {
|
||||||
|
downsampled[i] = pcmSamples[(int) (i * 44100f / 8000f)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// PCM → µ-Law
|
||||||
|
byte[] muLawData = new byte[downsampled.length];
|
||||||
|
for (int i = 0; i < downsampled.length; i++) {
|
||||||
|
muLawData[i] = linearToMuLawSample(downsampled[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Senden an alle Clients
|
||||||
|
synchronized (clients) {
|
||||||
|
Iterator<Socket> iterator = clients.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Socket client = iterator.next();
|
||||||
|
try {
|
||||||
|
OutputStream out = client.getOutputStream();
|
||||||
|
out.write(muLawData);
|
||||||
|
} catch (IOException e) {
|
||||||
|
try { client.close(); } catch (IOException ignored) {}
|
||||||
|
iterator.remove();
|
||||||
|
showToast("Client getrennt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recorder.stop();
|
||||||
|
recorder.release();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
recordingThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopStreaming() {
|
||||||
|
isStreaming = false;
|
||||||
|
|
||||||
|
// Schließe alle Clients
|
||||||
|
synchronized (clients) {
|
||||||
|
for (Socket client : clients) {
|
||||||
|
try {
|
||||||
|
client.close();
|
||||||
|
} catch (IOException ignored) {}
|
||||||
|
}
|
||||||
|
clients.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server stoppen
|
||||||
|
try {
|
||||||
|
if (serverSocket != null) {
|
||||||
|
serverSocket.close();
|
||||||
|
}
|
||||||
|
} catch (IOException ignored) {}
|
||||||
|
|
||||||
|
showToast("Streaming gestoppt");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showToast(String msg) {
|
||||||
|
runOnUiThread(() -> Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ========================
|
||||||
|
// PCM16 → µ-Law Umwandlung
|
||||||
|
// ========================
|
||||||
|
private static byte linearToMuLawSample(short sample) {
|
||||||
|
final int MU = 255;
|
||||||
|
int sign = (sample >> 8) & 0x80;
|
||||||
|
if (sign != 0) sample = (short) -sample;
|
||||||
|
if (sample > 32635) sample = 32635;
|
||||||
|
sample = (short) (sample + 132);
|
||||||
|
int exponent = 7;
|
||||||
|
for (int expMask = 0x4000; (sample & expMask) == 0 && exponent > 0; exponent--, expMask >>= 1) {}
|
||||||
|
int mantissa = (sample >> ((exponent == 0) ? 4 : (exponent + 3))) & 0x0F;
|
||||||
|
int muLawByte = ~(sign | (exponent << 4) | mantissa);
|
||||||
|
return (byte) muLawByte;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte[] pcm16ToMuLaw(byte[] pcmData, int length) {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(length / 2);
|
||||||
|
ByteBuffer bb = ByteBuffer.wrap(pcmData, 0, length).order(ByteOrder.LITTLE_ENDIAN);
|
||||||
|
while (bb.remaining() > 1) {
|
||||||
|
short sample = bb.getShort();
|
||||||
|
baos.write(linearToMuLawSample(sample));
|
||||||
|
}
|
||||||
|
return baos.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.babyphone.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650a4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
|
val Pink40 = Color(0xFF7D5260)
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.example.babyphone.ui.theme
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.darkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
|
import androidx.compose.material3.lightColorScheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
|
private val DarkColorScheme = darkColorScheme(
|
||||||
|
primary = Purple80,
|
||||||
|
secondary = PurpleGrey80,
|
||||||
|
tertiary = Pink80
|
||||||
|
)
|
||||||
|
|
||||||
|
private val LightColorScheme = lightColorScheme(
|
||||||
|
primary = Purple40,
|
||||||
|
secondary = PurpleGrey40,
|
||||||
|
tertiary = Pink40
|
||||||
|
|
||||||
|
/* Other default colors to override
|
||||||
|
background = Color(0xFFFFFBFE),
|
||||||
|
surface = Color(0xFFFFFBFE),
|
||||||
|
onPrimary = Color.White,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
onBackground = Color(0xFF1C1B1F),
|
||||||
|
onSurface = Color(0xFF1C1B1F),
|
||||||
|
*/
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BabyphoneTheme(
|
||||||
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
|
// Dynamic color is available on Android 12+
|
||||||
|
dynamicColor: Boolean = true,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||||
|
val context = LocalContext.current
|
||||||
|
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
darkTheme -> DarkColorScheme
|
||||||
|
else -> LightColorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.example.babyphone.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
// Set of Material typography styles to start with
|
||||||
|
val Typography = Typography(
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
/* Other default text styles to override
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
lineHeight = 28.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
*/
|
||||||
|
)
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.media.AudioFormat
|
|
||||||
import de.rochefort.childmonitor.audio.G711UCodec
|
|
||||||
|
|
||||||
object AudioCodecDefines {
|
|
||||||
const val FREQUENCY = 8000
|
|
||||||
const val ENCODING = AudioFormat.ENCODING_PCM_16BIT
|
|
||||||
val CODEC = G711UCodec()
|
|
||||||
const val CHANNEL_CONFIGURATION_IN = AudioFormat.CHANNEL_IN_MONO
|
|
||||||
const val CHANNEL_CONFIGURATION_OUT = AudioFormat.CHANNEL_OUT_MONO
|
|
||||||
}
|
|
||||||
@@ -1,235 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Intent
|
|
||||||
import android.net.nsd.NsdManager
|
|
||||||
import android.net.nsd.NsdManager.DiscoveryListener
|
|
||||||
import android.net.nsd.NsdServiceInfo
|
|
||||||
import android.net.wifi.WifiManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.AdapterView
|
|
||||||
import android.widget.AdapterView.OnItemClickListener
|
|
||||||
import android.widget.ArrayAdapter
|
|
||||||
import android.widget.Button
|
|
||||||
import android.widget.EditText
|
|
||||||
import android.widget.ListView
|
|
||||||
import android.widget.Toast
|
|
||||||
|
|
||||||
class DiscoverActivity : Activity() {
|
|
||||||
private lateinit var nsdManager: NsdManager
|
|
||||||
private var discoveryListener: DiscoveryListener? = null
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
Log.i(TAG, "ChildMonitor start")
|
|
||||||
this.nsdManager = this.getSystemService(NSD_SERVICE) as NsdManager
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_discover)
|
|
||||||
val discoverChildButton = findViewById<Button>(R.id.discoverChildButton)
|
|
||||||
discoverChildButton.setOnClickListener { _: View? -> loadDiscoveryViaMdns() }
|
|
||||||
val enterChildAddressButton = findViewById<Button>(R.id.enterChildAddressButton)
|
|
||||||
enterChildAddressButton.setOnClickListener { _: View? -> loadDiscoveryViaAddress() }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadDiscoveryViaMdns() {
|
|
||||||
setContentView(R.layout.activity_discover_mdns)
|
|
||||||
startServiceDiscovery("_childmonitor._tcp.")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadDiscoveryViaAddress() {
|
|
||||||
setContentView(R.layout.activity_discover_address)
|
|
||||||
val connectButton = findViewById<Button>(R.id.connectViaAddressButton)
|
|
||||||
val addressField = findViewById<EditText>(R.id.ipAddressField)
|
|
||||||
val portField = findViewById<EditText>(R.id.portField)
|
|
||||||
val preferredAddress = getPreferences(MODE_PRIVATE).getString(PREF_KEY_CHILD_DEVICE_ADDRESS, null)
|
|
||||||
if (!preferredAddress.isNullOrEmpty()) {
|
|
||||||
addressField.setText(preferredAddress)
|
|
||||||
}
|
|
||||||
val preferredPort = getPreferences(MODE_PRIVATE).getInt(PREF_KEY_CHILD_DEVICE_PORT, -1)
|
|
||||||
if (preferredPort > 0) {
|
|
||||||
portField.setText(preferredPort.toString())
|
|
||||||
} else {
|
|
||||||
portField.setText("10000")
|
|
||||||
}
|
|
||||||
connectButton.setOnClickListener { _: View? ->
|
|
||||||
Log.i(TAG, "Connecting to child device via address")
|
|
||||||
val addressString = addressField.text.toString()
|
|
||||||
val portString = portField.text.toString()
|
|
||||||
if (addressString.isEmpty()) {
|
|
||||||
Toast.makeText(this@DiscoverActivity, R.string.invalidAddress, Toast.LENGTH_LONG).show()
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
val port: Int = try {
|
|
||||||
portString.toInt()
|
|
||||||
} catch (e: NumberFormatException) {
|
|
||||||
Toast.makeText(this@DiscoverActivity, R.string.invalidPort, Toast.LENGTH_LONG).show()
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
val preferencesEditor = getPreferences(MODE_PRIVATE).edit()
|
|
||||||
preferencesEditor.putString(PREF_KEY_CHILD_DEVICE_ADDRESS, addressString)
|
|
||||||
preferencesEditor.putInt(PREF_KEY_CHILD_DEVICE_PORT, port)
|
|
||||||
preferencesEditor.apply()
|
|
||||||
connectToChild(addressString, port, addressString)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
Log.i(TAG, "ChildMonitoring stop")
|
|
||||||
this.discoveryListener?.let {
|
|
||||||
this.discoveryListener = null
|
|
||||||
Log.i(TAG, "Unregistering monitoring service")
|
|
||||||
this.nsdManager.stopServiceDiscovery(it)
|
|
||||||
}
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startServiceDiscovery(serviceType: String) {
|
|
||||||
val nsdManager = this.getSystemService(NSD_SERVICE) as NsdManager
|
|
||||||
val wifi = this.applicationContext.getSystemService(WIFI_SERVICE) as WifiManager
|
|
||||||
val multicastLock = wifi.createMulticastLock("multicastLock")
|
|
||||||
multicastLock.setReferenceCounted(true)
|
|
||||||
multicastLock.acquire()
|
|
||||||
val multicastReleaser = {
|
|
||||||
try {
|
|
||||||
multicastLock.release()
|
|
||||||
} catch (ignored: Exception) {
|
|
||||||
// don't really care
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val serviceTable = findViewById<ListView>(R.id.ServiceTable)
|
|
||||||
val availableServicesAdapter = ArrayAdapter<ServiceInfoWrapper>(this,
|
|
||||||
R.layout.available_children_list)
|
|
||||||
serviceTable.adapter = availableServicesAdapter
|
|
||||||
serviceTable.onItemClickListener = OnItemClickListener { parent: AdapterView<*>, _: View?, position: Int, _: Long ->
|
|
||||||
val info = parent.getItemAtPosition(position) as ServiceInfoWrapper
|
|
||||||
info.address?.let {
|
|
||||||
connectToChild(it, info.port, info.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Instantiate a new DiscoveryListener
|
|
||||||
this.discoveryListener = object : DiscoveryListener {
|
|
||||||
// Called as soon as service discovery begins.
|
|
||||||
override fun onDiscoveryStarted(regType: String) {
|
|
||||||
Log.d(TAG, "Service discovery started")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceFound(service: NsdServiceInfo) {
|
|
||||||
// A service was found! Do something with it.
|
|
||||||
Log.d(TAG, "Service discovery success: $service")
|
|
||||||
if (service.serviceType != serviceType) {
|
|
||||||
// Service type is the string containing the protocol and
|
|
||||||
// transport layer for this service.
|
|
||||||
Log.d(TAG, "Unknown Service Type: " + service.serviceType)
|
|
||||||
} else if (service.serviceName.contains("ChildMonitor")) {
|
|
||||||
val resolver: NsdManager.ResolveListener = object : NsdManager.ResolveListener {
|
|
||||||
override fun onResolveFailed(serviceInfo: NsdServiceInfo, errorCode: Int) {
|
|
||||||
// Called when the resolve fails. Use the error code to debug.
|
|
||||||
Log.e(TAG, "Resolve failed: error $errorCode for service: $serviceInfo")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceResolved(serviceInfo: NsdServiceInfo) {
|
|
||||||
Log.i(TAG, "Resolve Succeeded: $serviceInfo")
|
|
||||||
runOnUiThread {
|
|
||||||
for (index in 0 until availableServicesAdapter.count) {
|
|
||||||
val item = availableServicesAdapter.getItem(index)
|
|
||||||
if (item != null && item.matches(serviceInfo)) {
|
|
||||||
// Prevent inserting duplicates
|
|
||||||
return@runOnUiThread
|
|
||||||
}
|
|
||||||
}
|
|
||||||
availableServicesAdapter.add(ServiceInfoWrapper(serviceInfo))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this@DiscoverActivity.nsdManager.resolveService(service, resolver)
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Unknown Service name: " + service.serviceName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceLost(service: NsdServiceInfo) {
|
|
||||||
// When the network service is no longer available.
|
|
||||||
// Internal bookkeeping code goes here.
|
|
||||||
Log.e(TAG, "Service lost: $service")
|
|
||||||
multicastReleaser()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDiscoveryStopped(serviceType: String) {
|
|
||||||
Log.i(TAG, "Discovery stopped: $serviceType")
|
|
||||||
multicastReleaser()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStartDiscoveryFailed(serviceType: String, errorCode: Int) {
|
|
||||||
Log.e(TAG, "Discovery failed: Error code: $errorCode")
|
|
||||||
nsdManager.stopServiceDiscovery(this)
|
|
||||||
multicastReleaser()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStopDiscoveryFailed(serviceType: String, errorCode: Int) {
|
|
||||||
Log.e(TAG, "Discovery failed: Error code: $errorCode")
|
|
||||||
nsdManager.stopServiceDiscovery(this)
|
|
||||||
multicastReleaser()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nsdManager.discoverServices(
|
|
||||||
serviceType, NsdManager.PROTOCOL_DNS_SD, discoveryListener
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun connectToChild(address: String, port: Int, name: String) {
|
|
||||||
val i = Intent(applicationContext, ListenActivity::class.java)
|
|
||||||
val b = Bundle()
|
|
||||||
b.putString("address", address)
|
|
||||||
b.putInt("port", port)
|
|
||||||
b.putString("name", name)
|
|
||||||
i.putExtras(b)
|
|
||||||
startActivity(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "ChildMonitor"
|
|
||||||
private const val PREF_KEY_CHILD_DEVICE_ADDRESS = "childDeviceAddress"
|
|
||||||
private const val PREF_KEY_CHILD_DEVICE_PORT = "childDevicePort"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class ServiceInfoWrapper(private val info: NsdServiceInfo) {
|
|
||||||
fun matches(other: NsdServiceInfo): Boolean {
|
|
||||||
return info.host == other.host && info.port == other.port
|
|
||||||
}
|
|
||||||
|
|
||||||
val address: String?
|
|
||||||
get() = info.host.hostAddress
|
|
||||||
val port: Int
|
|
||||||
get() = info.port
|
|
||||||
// If there is more than one service with the same name on the network, it will
|
|
||||||
// have a number at the end, but will appear as the following:
|
|
||||||
// "ChildMonitor\\032(number)
|
|
||||||
// or
|
|
||||||
// "ChildMonitor\032(number)
|
|
||||||
// Replace \\032 and \032 with a " "
|
|
||||||
val name: String = info.serviceName
|
|
||||||
.replace("\\\\032", " ")
|
|
||||||
.replace("\\032", " ")
|
|
||||||
|
|
||||||
override fun toString(): String {
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.ServiceConnection
|
|
||||||
import android.media.AudioManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.os.IBinder
|
|
||||||
import android.util.Log
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import de.rochefort.childmonitor.ListenService.ListenBinder
|
|
||||||
|
|
||||||
class ListenActivity : Activity() {
|
|
||||||
// Don't attempt to unbind from the service unless the client has received some
|
|
||||||
// information about the service's state.
|
|
||||||
private var shouldUnbind = false
|
|
||||||
private val connection: ServiceConnection = object : ServiceConnection {
|
|
||||||
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
|
||||||
// This is called when the connection with the service has been
|
|
||||||
// established, giving us the service object we can use to
|
|
||||||
// interact with the service. Because we have bound to a explicit
|
|
||||||
// service that we know is running in our own process, we can
|
|
||||||
// cast its IBinder to a concrete class and directly access it.
|
|
||||||
val bs = (service as ListenBinder).service
|
|
||||||
Toast.makeText(this@ListenActivity, R.string.connect,
|
|
||||||
Toast.LENGTH_SHORT).show()
|
|
||||||
val connectedText = findViewById<TextView>(R.id.connectedTo)
|
|
||||||
connectedText.text = bs.childDeviceName
|
|
||||||
val volumeView = findViewById<VolumeView>(R.id.volume)
|
|
||||||
volumeView.volumeHistory = bs.volumeHistory
|
|
||||||
bs.onUpdate = { volumeView.postInvalidate() }
|
|
||||||
bs.onError = { postErrorMessage() }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceDisconnected(className: ComponentName) {
|
|
||||||
// This is called when the connection with the service has been
|
|
||||||
// unexpectedly disconnected -- that is, its process crashed.
|
|
||||||
// Because it is running in our same process, we should never
|
|
||||||
// see this happen.
|
|
||||||
Toast.makeText(this@ListenActivity, R.string.disconnected,
|
|
||||||
Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun ensureServiceRunningAndBind(bundle: Bundle?) {
|
|
||||||
val context: Context = this
|
|
||||||
val intent = Intent(context, ListenService::class.java)
|
|
||||||
bundle?.let {
|
|
||||||
intent.putExtra("name", it.getString("name"))
|
|
||||||
intent.putExtra("address", it.getString("address"))
|
|
||||||
intent.putExtra("port", it.getInt("port"))
|
|
||||||
ContextCompat.startForegroundService(context, intent)
|
|
||||||
}
|
|
||||||
// Attempts to establish a connection with the service. We use an
|
|
||||||
// explicit class name because we want a specific service
|
|
||||||
// implementation that we know will be running in our own process
|
|
||||||
// (and thus won't be supporting component replacement by other
|
|
||||||
// applications).
|
|
||||||
if (bindService(intent, connection, BIND_AUTO_CREATE)) {
|
|
||||||
this.shouldUnbind = true
|
|
||||||
Log.i(TAG, "Bound listen service")
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Error: The requested service doesn't " +
|
|
||||||
"exist, or this client isn't allowed access to it.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun doUnbindAndStopService() {
|
|
||||||
if (this.shouldUnbind) {
|
|
||||||
// Release information about the service's state.
|
|
||||||
unbindService(connection)
|
|
||||||
this.shouldUnbind = false
|
|
||||||
}
|
|
||||||
val context: Context = this
|
|
||||||
val intent = Intent(context, ListenService::class.java)
|
|
||||||
context.stopService(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun postErrorMessage() {
|
|
||||||
val status = findViewById<TextView>(R.id.textStatus)
|
|
||||||
status.post { status.setText(R.string.disconnected) }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
val bundle = this.intent.extras
|
|
||||||
ensureServiceRunningAndBind(bundle)
|
|
||||||
this.volumeControlStream = AudioManager.STREAM_MUSIC
|
|
||||||
setContentView(R.layout.activity_listen)
|
|
||||||
val statusText = findViewById<TextView>(R.id.textStatus)
|
|
||||||
statusText.setText(R.string.listening)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onDestroy() {
|
|
||||||
doUnbindAndStopService()
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "ListenActivity"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.app.Notification
|
|
||||||
import android.app.NotificationChannel
|
|
||||||
import android.app.NotificationManager
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.app.Service
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.pm.ServiceInfo
|
|
||||||
import android.media.AudioManager
|
|
||||||
import android.media.AudioTrack
|
|
||||||
import android.media.MediaPlayer
|
|
||||||
import android.os.Binder
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.IBinder
|
|
||||||
import android.util.Log
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.app.NotificationCompat
|
|
||||||
import androidx.core.app.ServiceCompat
|
|
||||||
import java.io.IOException
|
|
||||||
import java.net.Socket
|
|
||||||
|
|
||||||
class ListenService : Service() {
|
|
||||||
private val frequency: Int = AudioCodecDefines.FREQUENCY
|
|
||||||
private val channelConfiguration: Int = AudioCodecDefines.CHANNEL_CONFIGURATION_OUT
|
|
||||||
private val audioEncoding: Int = AudioCodecDefines.ENCODING
|
|
||||||
private val bufferSize = AudioTrack.getMinBufferSize(frequency, channelConfiguration, audioEncoding)
|
|
||||||
private val byteBufferSize = bufferSize * 2
|
|
||||||
private val binder: IBinder = ListenBinder()
|
|
||||||
private lateinit var notificationManager: NotificationManager
|
|
||||||
private var listenThread: Thread? = null
|
|
||||||
val volumeHistory = VolumeHistory(16384)
|
|
||||||
var childDeviceName: String? = null
|
|
||||||
private set
|
|
||||||
|
|
||||||
override fun onCreate() {
|
|
||||||
super.onCreate()
|
|
||||||
this.notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
|
||||||
Log.i(TAG, "Received start id $startId: $intent")
|
|
||||||
// Display a notification about us starting. We put an icon in the status bar.
|
|
||||||
createNotificationChannel()
|
|
||||||
intent.extras?.let {
|
|
||||||
val name = it.getString("name")
|
|
||||||
childDeviceName = name
|
|
||||||
val n = buildNotification(name)
|
|
||||||
val foregroundServiceType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK else 0 // Keep the linter happy
|
|
||||||
ServiceCompat.startForeground(this, ID, n, foregroundServiceType)
|
|
||||||
val address = it.getString("address")
|
|
||||||
val port = it.getInt("port")
|
|
||||||
doListen(address, port)
|
|
||||||
}
|
|
||||||
return START_REDELIVER_INTENT
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
this.listenThread?.interrupt()
|
|
||||||
this.listenThread = null
|
|
||||||
|
|
||||||
// Cancel the persistent notification.
|
|
||||||
notificationManager.cancel(R.string.listening)
|
|
||||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
|
||||||
// Tell the user we stopped.
|
|
||||||
Toast.makeText(this, R.string.stopped, Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBind(intent: Intent): IBinder {
|
|
||||||
return binder
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun buildNotification(name: String?): Notification {
|
|
||||||
// In this sample, we'll use the same text for the ticker and the expanded notification
|
|
||||||
val text = getText(R.string.listening)
|
|
||||||
|
|
||||||
// The PendingIntent to launch our activity if the user selects this notification
|
|
||||||
val contentIntent = PendingIntent.getActivity(this, 0,
|
|
||||||
Intent(this, ListenActivity::class.java), PendingIntent.FLAG_IMMUTABLE)
|
|
||||||
|
|
||||||
// Set the info for the views that show in the notification panel.
|
|
||||||
val b = NotificationCompat.Builder(this, CHANNEL_ID)
|
|
||||||
b.setSmallIcon(R.drawable.listening_notification) // the status icon
|
|
||||||
.setOngoing(true)
|
|
||||||
.setTicker(text) // the status text
|
|
||||||
.setContentTitle(text) // the label of the entry
|
|
||||||
.setContentText(name) // the contents of the entry
|
|
||||||
.setContentIntent(contentIntent)
|
|
||||||
return b.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createNotificationChannel() {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
val serviceChannel = NotificationChannel(
|
|
||||||
CHANNEL_ID,
|
|
||||||
"Foreground Service Channel",
|
|
||||||
NotificationManager.IMPORTANCE_DEFAULT
|
|
||||||
)
|
|
||||||
notificationManager.createNotificationChannel(serviceChannel)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inner class ListenBinder : Binder() {
|
|
||||||
val service: ListenService
|
|
||||||
get() = this@ListenService
|
|
||||||
}
|
|
||||||
|
|
||||||
var onError: (() -> Unit)? = null
|
|
||||||
var onUpdate: (() -> Unit)? = null
|
|
||||||
private fun doListen(address: String?, port: Int) {
|
|
||||||
val lt = Thread {
|
|
||||||
try {
|
|
||||||
val socket = Socket(address, port)
|
|
||||||
socket.soTimeout = 30_000
|
|
||||||
val success = streamAudio(socket)
|
|
||||||
if (!success) {
|
|
||||||
playAlert()
|
|
||||||
onError?.invoke()
|
|
||||||
}
|
|
||||||
} catch (e : IOException) {
|
|
||||||
Log.e(TAG, "Error opening socket to $address on port $port", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.listenThread = lt
|
|
||||||
lt.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun streamAudio(socket: Socket): Boolean {
|
|
||||||
Log.i(TAG, "Setting up stream")
|
|
||||||
val audioTrack = AudioTrack(AudioManager.STREAM_MUSIC,
|
|
||||||
frequency,
|
|
||||||
channelConfiguration,
|
|
||||||
audioEncoding,
|
|
||||||
bufferSize,
|
|
||||||
AudioTrack.MODE_STREAM)
|
|
||||||
try {
|
|
||||||
audioTrack.play()
|
|
||||||
} catch (e : java.lang.IllegalStateException) {
|
|
||||||
Log.e(TAG, "Failed to play streamed audio audio for other reason", e)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
val inputStream = try {
|
|
||||||
socket.getInputStream()
|
|
||||||
} catch (e: IOException) {
|
|
||||||
Log.e(TAG, "Failed to read audio audio for socket", e)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
val readBuffer = ByteArray(byteBufferSize)
|
|
||||||
val decodedBuffer = ShortArray(byteBufferSize * 2)
|
|
||||||
try {
|
|
||||||
while (!Thread.currentThread().isInterrupted) {
|
|
||||||
val len = inputStream.read(readBuffer)
|
|
||||||
if (len < 0) {
|
|
||||||
// If the current thread was not interrupted this means the remote stopped streaming
|
|
||||||
return Thread.currentThread().isInterrupted
|
|
||||||
}
|
|
||||||
val decoded: Int = AudioCodecDefines.CODEC.decode(decodedBuffer, readBuffer, len, 0)
|
|
||||||
if (decoded > 0) {
|
|
||||||
audioTrack.write(decodedBuffer, 0, decoded)
|
|
||||||
val decodedBytes = ShortArray(decoded)
|
|
||||||
System.arraycopy(decodedBuffer, 0, decodedBytes, 0, decoded)
|
|
||||||
volumeHistory.onAudioData(decodedBytes)
|
|
||||||
onUpdate?.invoke()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "Connection failed", e)
|
|
||||||
return false
|
|
||||||
} finally {
|
|
||||||
audioTrack.stop()
|
|
||||||
socket.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun playAlert() {
|
|
||||||
val mp = MediaPlayer.create(this, R.raw.upward_beep_chromatic_fifths)
|
|
||||||
if (mp != null) {
|
|
||||||
Log.i(TAG, "Playing alert")
|
|
||||||
mp.setOnCompletionListener { obj: MediaPlayer -> obj.release() }
|
|
||||||
mp.start()
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Failed to play alert")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val TAG = "ListenService"
|
|
||||||
const val CHANNEL_ID = TAG
|
|
||||||
const val ID = 902938409
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.ComponentName
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.ServiceConnection
|
|
||||||
import android.net.ConnectivityManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.os.IBinder
|
|
||||||
import android.util.Log
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import de.rochefort.childmonitor.MonitorService.MonitorBinder
|
|
||||||
|
|
||||||
class MonitorActivity : Activity() {
|
|
||||||
private val connection: ServiceConnection = object : ServiceConnection {
|
|
||||||
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
|
||||||
// This is called when the connection with the service has been
|
|
||||||
// established, giving us the service object we can use to
|
|
||||||
// interact with the service. Because we have bound to an explicit
|
|
||||||
// service that we know is running in our own process, we can
|
|
||||||
// cast its IBinder to a concrete class and directly access it.
|
|
||||||
val bs = (service as MonitorBinder).service
|
|
||||||
bs.monitorActivity = this@MonitorActivity
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceDisconnected(className: ComponentName) {
|
|
||||||
// This is called when the connection with the service has been
|
|
||||||
// unexpectedly disconnected -- that is, its process crashed.
|
|
||||||
// Because it is running in our same process, we should never
|
|
||||||
// see this happen.
|
|
||||||
Toast.makeText(this@MonitorActivity, R.string.disconnected,
|
|
||||||
Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private var shouldUnbind = false
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
Log.i(TAG, "ChildMonitor start")
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_monitor)
|
|
||||||
val addressText = findViewById<TextView>(R.id.address)
|
|
||||||
val listenAddresses = listenAddresses
|
|
||||||
if (listenAddresses.isNotEmpty()) {
|
|
||||||
val sb = StringBuilder()
|
|
||||||
for (i in listenAddresses.indices) {
|
|
||||||
val listenAddress = listenAddresses[i]
|
|
||||||
sb.append(listenAddress)
|
|
||||||
if (i != listenAddresses.size - 1) {
|
|
||||||
sb.append("\n\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addressText.text = sb.toString()
|
|
||||||
} else {
|
|
||||||
addressText.setText(R.string.notConnected)
|
|
||||||
}
|
|
||||||
ensureServiceRunningAndBind()
|
|
||||||
}
|
|
||||||
|
|
||||||
private val listenAddresses: List<String>
|
|
||||||
get() {
|
|
||||||
val cm = getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager
|
|
||||||
val listenAddresses: MutableList<String> = ArrayList()
|
|
||||||
for (network in cm.allNetworks) {
|
|
||||||
val networkInfo = cm.getNetworkInfo(network)
|
|
||||||
val connected = networkInfo!!.isConnected
|
|
||||||
if (connected) {
|
|
||||||
val linkAddresses = cm.getLinkProperties(network)!!.linkAddresses
|
|
||||||
for (linkAddress in linkAddresses) {
|
|
||||||
val address = linkAddress.address
|
|
||||||
val hostAddress = address.hostAddress
|
|
||||||
if (!address.isLinkLocalAddress && !address.isLoopbackAddress && hostAddress != null) {
|
|
||||||
listenAddresses.add(hostAddress + " (" + networkInfo.typeName + ")")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return listenAddresses
|
|
||||||
}
|
|
||||||
|
|
||||||
public override fun onDestroy() {
|
|
||||||
doUnbindAndStopService()
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun ensureServiceRunningAndBind() {
|
|
||||||
val context: Context = this
|
|
||||||
val intent = Intent(context, MonitorService::class.java)
|
|
||||||
ContextCompat.startForegroundService(context, intent)
|
|
||||||
// Attempts to establish a connection with the service. We use an
|
|
||||||
// explicit class name because we want a specific service
|
|
||||||
// implementation that we know will be running in our own process
|
|
||||||
// (and thus won't be supporting component replacement by other
|
|
||||||
// applications).
|
|
||||||
if (bindService(intent, connection, BIND_AUTO_CREATE)) {
|
|
||||||
this.shouldUnbind = true
|
|
||||||
Log.i(TAG, "Bound monitor service")
|
|
||||||
} else {
|
|
||||||
Log.e(TAG, "Error: The requested service doesn't " +
|
|
||||||
"exist, or this client isn't allowed access to it.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun doUnbindAndStopService() {
|
|
||||||
if (this.shouldUnbind) {
|
|
||||||
this.shouldUnbind = false
|
|
||||||
// Release information about the service's state.
|
|
||||||
unbindService(connection)
|
|
||||||
}
|
|
||||||
val context: Context = this
|
|
||||||
val intent = Intent(context, MonitorService::class.java)
|
|
||||||
context.stopService(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "ChildMonitor"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.app.Notification
|
|
||||||
import android.app.NotificationChannel
|
|
||||||
import android.app.NotificationManager
|
|
||||||
import android.app.Service
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.pm.ServiceInfo
|
|
||||||
import android.media.AudioRecord
|
|
||||||
import android.media.MediaRecorder
|
|
||||||
import android.net.nsd.NsdManager
|
|
||||||
import android.net.nsd.NsdManager.RegistrationListener
|
|
||||||
import android.net.nsd.NsdServiceInfo
|
|
||||||
import android.os.Binder
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.IBinder
|
|
||||||
import android.util.Log
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.app.NotificationCompat
|
|
||||||
import androidx.core.app.ServiceCompat
|
|
||||||
import java.io.IOException
|
|
||||||
import java.net.ServerSocket
|
|
||||||
import java.net.Socket
|
|
||||||
|
|
||||||
class MonitorService : Service() {
|
|
||||||
private val binder: IBinder = MonitorBinder()
|
|
||||||
private lateinit var nsdManager: NsdManager
|
|
||||||
private var registrationListener: RegistrationListener? = null
|
|
||||||
private var currentSocket: ServerSocket? = null
|
|
||||||
private var connectionToken: Any? = null
|
|
||||||
private var currentPort = 0
|
|
||||||
private lateinit var notificationManager: NotificationManager
|
|
||||||
private var monitorThread: Thread? = null
|
|
||||||
var monitorActivity: MonitorActivity? = null
|
|
||||||
|
|
||||||
private fun serviceConnection(socket: Socket) {
|
|
||||||
val ma = this.monitorActivity
|
|
||||||
ma?.runOnUiThread {
|
|
||||||
val statusText = ma.findViewById<TextView>(R.id.textStatus)
|
|
||||||
statusText.setText(R.string.streaming)
|
|
||||||
}
|
|
||||||
val frequency: Int = AudioCodecDefines.FREQUENCY
|
|
||||||
val channelConfiguration: Int = AudioCodecDefines.CHANNEL_CONFIGURATION_IN
|
|
||||||
val audioEncoding: Int = AudioCodecDefines.ENCODING
|
|
||||||
val bufferSize = AudioRecord.getMinBufferSize(frequency, channelConfiguration, audioEncoding)
|
|
||||||
val audioRecord: AudioRecord = try {
|
|
||||||
AudioRecord(
|
|
||||||
MediaRecorder.AudioSource.MIC,
|
|
||||||
frequency,
|
|
||||||
channelConfiguration,
|
|
||||||
audioEncoding,
|
|
||||||
bufferSize
|
|
||||||
)
|
|
||||||
} catch (e: SecurityException) {
|
|
||||||
// This should never happen, we asked for permission before
|
|
||||||
throw RuntimeException(e)
|
|
||||||
}
|
|
||||||
val pcmBufferSize = bufferSize * 2
|
|
||||||
val pcmBuffer = ShortArray(pcmBufferSize)
|
|
||||||
val ulawBuffer = ByteArray(pcmBufferSize)
|
|
||||||
try {
|
|
||||||
audioRecord.startRecording()
|
|
||||||
val out = socket.getOutputStream()
|
|
||||||
socket.sendBufferSize = pcmBufferSize
|
|
||||||
Log.d(TAG, "Socket send buffer size: " + socket.sendBufferSize)
|
|
||||||
while (socket.isConnected && (this.currentSocket != null) && !Thread.currentThread().isInterrupted) {
|
|
||||||
val read = audioRecord.read(pcmBuffer, 0, bufferSize)
|
|
||||||
val encoded: Int = AudioCodecDefines.CODEC.encode(pcmBuffer, read, ulawBuffer, 0)
|
|
||||||
out.write(ulawBuffer, 0, encoded)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "Connection failed", e)
|
|
||||||
} finally {
|
|
||||||
audioRecord.stop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate() {
|
|
||||||
Log.i(TAG, "ChildMonitor start")
|
|
||||||
super.onCreate()
|
|
||||||
this.notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
|
||||||
this.nsdManager = this.getSystemService(NSD_SERVICE) as NsdManager
|
|
||||||
this.currentPort = 10000
|
|
||||||
this.currentSocket = null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
|
||||||
Log.i(TAG, "Received start id $startId: $intent")
|
|
||||||
// Display a notification about us starting. We put an icon in the status bar.
|
|
||||||
createNotificationChannel()
|
|
||||||
val n = buildNotification()
|
|
||||||
val foregroundServiceType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE else 0 // Keep the linter happy
|
|
||||||
ServiceCompat.startForeground(this, ID, n, foregroundServiceType)
|
|
||||||
ensureMonitorThread()
|
|
||||||
return START_REDELIVER_INTENT
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun ensureMonitorThread() {
|
|
||||||
var mt = this.monitorThread
|
|
||||||
if (mt != null && mt.isAlive) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val currentToken = Any()
|
|
||||||
this.connectionToken = currentToken
|
|
||||||
mt = Thread {
|
|
||||||
while (this.connectionToken == currentToken) {
|
|
||||||
try {
|
|
||||||
ServerSocket(this.currentPort).use { serverSocket ->
|
|
||||||
this.currentSocket = serverSocket
|
|
||||||
// Store the chosen port.
|
|
||||||
val localPort = serverSocket.localPort
|
|
||||||
|
|
||||||
// Register the service so that parent devices can
|
|
||||||
// locate the child device
|
|
||||||
registerService(localPort)
|
|
||||||
serverSocket.accept().use { socket ->
|
|
||||||
Log.i(TAG, "Connection from parent device received")
|
|
||||||
|
|
||||||
// We now have a client connection.
|
|
||||||
// Unregister so no other clients will
|
|
||||||
// attempt to connect
|
|
||||||
unregisterService()
|
|
||||||
serviceConnection(socket)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
if (this.connectionToken == currentToken) {
|
|
||||||
// Just in case
|
|
||||||
this.currentPort++
|
|
||||||
Log.e(TAG, "Failed to open server socket. Port increased to $currentPort", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.monitorThread = mt
|
|
||||||
mt.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun registerService(port: Int) {
|
|
||||||
val serviceInfo = NsdServiceInfo()
|
|
||||||
serviceInfo.serviceName = "ChildMonitor on " + Build.MODEL
|
|
||||||
serviceInfo.serviceType = "_childmonitor._tcp."
|
|
||||||
serviceInfo.port = port
|
|
||||||
this.registrationListener = object : RegistrationListener {
|
|
||||||
override fun onServiceRegistered(nsdServiceInfo: NsdServiceInfo) {
|
|
||||||
// Save the service name. Android may have changed it in order to
|
|
||||||
// resolve a conflict, so update the name you initially requested
|
|
||||||
// with the name Android actually used.
|
|
||||||
nsdServiceInfo.serviceName.let { serviceName ->
|
|
||||||
Log.i(TAG, "Service name: $serviceName")
|
|
||||||
monitorActivity?.let { ma ->
|
|
||||||
ma.runOnUiThread {
|
|
||||||
val statusText = ma.findViewById<TextView>(R.id.textStatus)
|
|
||||||
statusText.setText(R.string.waitingForParent)
|
|
||||||
val serviceText = ma.findViewById<TextView>(R.id.textService)
|
|
||||||
serviceText.text = serviceName
|
|
||||||
val portText = ma.findViewById<TextView>(R.id.port)
|
|
||||||
portText.text = port.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRegistrationFailed(serviceInfo: NsdServiceInfo, errorCode: Int) {
|
|
||||||
// Registration failed! Put debugging code here to determine why.
|
|
||||||
Log.e(TAG, "Registration failed: $errorCode")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServiceUnregistered(arg0: NsdServiceInfo) {
|
|
||||||
// Service has been unregistered. This only happens when you call
|
|
||||||
// NsdManager.unregisterService() and pass in this listener.
|
|
||||||
Log.i(TAG, "Unregistering service")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onUnregistrationFailed(serviceInfo: NsdServiceInfo, errorCode: Int) {
|
|
||||||
// Unregistration failed. Put debugging code here to determine why.
|
|
||||||
Log.e(TAG, "Unregistration failed: $errorCode")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nsdManager.registerService(
|
|
||||||
serviceInfo, NsdManager.PROTOCOL_DNS_SD, registrationListener)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun unregisterService() {
|
|
||||||
this.registrationListener?.let {
|
|
||||||
this.registrationListener = null
|
|
||||||
Log.i(TAG, "Unregistering monitoring service")
|
|
||||||
this.nsdManager.unregisterService(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun createNotificationChannel() {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
val serviceChannel = NotificationChannel(
|
|
||||||
CHANNEL_ID,
|
|
||||||
"Foreground Service Channel",
|
|
||||||
NotificationManager.IMPORTANCE_DEFAULT
|
|
||||||
)
|
|
||||||
this.notificationManager.createNotificationChannel(serviceChannel)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun buildNotification(): Notification {
|
|
||||||
val text: CharSequence = "Child Device"
|
|
||||||
// Set the info for the views that show in the notification panel.
|
|
||||||
val b = NotificationCompat.Builder(this, CHANNEL_ID)
|
|
||||||
b.setSmallIcon(R.drawable.listening_notification) // the status icon
|
|
||||||
.setOngoing(true)
|
|
||||||
.setTicker(text) // the status text
|
|
||||||
.setContentTitle(text) // the label of the entry
|
|
||||||
return b.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
this.monitorThread?.let {
|
|
||||||
this.monitorThread = null
|
|
||||||
it.interrupt()
|
|
||||||
}
|
|
||||||
unregisterService()
|
|
||||||
this.connectionToken = null
|
|
||||||
this.currentSocket?.let {
|
|
||||||
try {
|
|
||||||
it.close()
|
|
||||||
} catch (e: IOException) {
|
|
||||||
Log.e(TAG, "Failed to close active socket on port $currentPort")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.currentSocket = null
|
|
||||||
|
|
||||||
// Cancel the persistent notification.
|
|
||||||
this.notificationManager.cancel(R.string.listening)
|
|
||||||
ServiceCompat.stopForeground(this, ServiceCompat.STOP_FOREGROUND_REMOVE)
|
|
||||||
// Tell the user we stopped.
|
|
||||||
Toast.makeText(this, R.string.stopped, Toast.LENGTH_SHORT).show()
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBind(intent: Intent): IBinder {
|
|
||||||
return binder
|
|
||||||
}
|
|
||||||
|
|
||||||
inner class MonitorBinder : Binder() {
|
|
||||||
val service: MonitorService
|
|
||||||
get() = this@MonitorService
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "MonitorService"
|
|
||||||
const val CHANNEL_ID = TAG
|
|
||||||
const val ID = 1338
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
|
||||||
import android.widget.Button
|
|
||||||
import androidx.core.app.ActivityCompat
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
|
|
||||||
class StartActivity : Activity() {
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
Log.i(TAG, "ChildMonitor launched")
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.activity_start)
|
|
||||||
val monitorButton = findViewById<Button>(R.id.useChildDevice)
|
|
||||||
monitorButton.setOnClickListener { _: View? ->
|
|
||||||
Log.i(TAG, "Starting up monitor")
|
|
||||||
if (isAudioRecordingPermissionGranted) {
|
|
||||||
startActivity(Intent(applicationContext, MonitorActivity::class.java))
|
|
||||||
} else {
|
|
||||||
requestAudioPermission()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val connectButton = findViewById<Button>(R.id.useParentDevice)
|
|
||||||
connectButton.setOnClickListener { _: View? ->
|
|
||||||
Log.i(TAG, "Starting connection activity")
|
|
||||||
if (isMulticastPermissionGranted) {
|
|
||||||
val i = Intent(applicationContext, DiscoverActivity::class.java)
|
|
||||||
startActivity(i)
|
|
||||||
} else {
|
|
||||||
requestMulticastPermission()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val isMulticastPermissionGranted: Boolean
|
|
||||||
get() = (ContextCompat.checkSelfPermission(this@StartActivity, Manifest.permission.CHANGE_WIFI_MULTICAST_STATE)
|
|
||||||
== PackageManager.PERMISSION_GRANTED)
|
|
||||||
private val isAudioRecordingPermissionGranted: Boolean
|
|
||||||
get() = (ContextCompat.checkSelfPermission(this@StartActivity, Manifest.permission.RECORD_AUDIO)
|
|
||||||
== PackageManager.PERMISSION_GRANTED)
|
|
||||||
|
|
||||||
private fun requestAudioPermission() {
|
|
||||||
ActivityCompat.requestPermissions(this@StartActivity, arrayOf(Manifest.permission.RECORD_AUDIO),
|
|
||||||
PERMISSIONS_REQUEST_RECORD_AUDIO)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun requestMulticastPermission() {
|
|
||||||
ActivityCompat.requestPermissions(this@StartActivity, arrayOf(Manifest.permission.CHANGE_WIFI_MULTICAST_STATE),
|
|
||||||
PERMISSIONS_REQUEST_MULTICAST)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
|
|
||||||
if (requestCode == PERMISSIONS_REQUEST_RECORD_AUDIO && grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
||||||
startActivity(Intent(applicationContext, MonitorActivity::class.java))
|
|
||||||
} else if (requestCode == PERMISSIONS_REQUEST_MULTICAST) {
|
|
||||||
// its okay if the permission was denied... the user will have to type the address manually
|
|
||||||
startActivity(Intent(applicationContext, DiscoverActivity::class.java))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val TAG = "ChildMonitor"
|
|
||||||
private const val PERMISSIONS_REQUEST_RECORD_AUDIO = 298349824
|
|
||||||
private const val PERMISSIONS_REQUEST_MULTICAST = 298349825
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import androidx.collection.CircularArray
|
|
||||||
|
|
||||||
class VolumeHistory internal constructor(private val maxHistory: Int) {
|
|
||||||
private var maxVolume = 0.25
|
|
||||||
var volumeNorm = 1.0 / this.maxVolume
|
|
||||||
private set
|
|
||||||
private val historyData: CircularArray<Double> = CircularArray(maxHistory)
|
|
||||||
private val uiHandler: Handler = Handler(Looper.getMainLooper())
|
|
||||||
|
|
||||||
operator fun get(i: Int): Double {
|
|
||||||
return historyData[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
fun size(): Int {
|
|
||||||
return historyData.size()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addLast(volume: Double) {
|
|
||||||
// schedule editing of member vars on the ui event loop to avoid concurrency problems
|
|
||||||
uiHandler.post {
|
|
||||||
if (volume > this.maxVolume) {
|
|
||||||
this.maxVolume = volume
|
|
||||||
this.volumeNorm = 1.0 / volume
|
|
||||||
}
|
|
||||||
historyData.addLast(volume)
|
|
||||||
historyData.removeFromStart(historyData.size() - maxHistory)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun onAudioData(data: ShortArray) {
|
|
||||||
if (data.isEmpty()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val scale = 1.0 / 128.0
|
|
||||||
var sum = 0.0
|
|
||||||
for (datum in data) {
|
|
||||||
val rel = datum * scale
|
|
||||||
sum += rel * rel
|
|
||||||
}
|
|
||||||
val volume = sum / data.size
|
|
||||||
addLast(volume)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Child Monitor.
|
|
||||||
*
|
|
||||||
* Child Monitor is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Child Monitor is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Child Monitor. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.Paint
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.View
|
|
||||||
import kotlin.math.min
|
|
||||||
|
|
||||||
class VolumeView : View {
|
|
||||||
private val paint: Paint
|
|
||||||
var volumeHistory: VolumeHistory? = null
|
|
||||||
|
|
||||||
constructor(context: Context?) : super(context) {
|
|
||||||
paint = initPaint()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
|
|
||||||
paint = initPaint()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
||||||
paint = initPaint()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initPaint(): Paint {
|
|
||||||
val paint = Paint()
|
|
||||||
paint.color = Color.rgb(255, 127, 0)
|
|
||||||
return paint
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDraw(canvas: Canvas) {
|
|
||||||
val volumeHistory = this.volumeHistory ?: return
|
|
||||||
val height = height
|
|
||||||
val width = width
|
|
||||||
val size = volumeHistory.size() // Size is at most width
|
|
||||||
val volumeNorm = volumeHistory.volumeNorm
|
|
||||||
val minBrightness = 0.3
|
|
||||||
val relativeBrightness: Double = if (size > 0) {
|
|
||||||
(volumeNorm * volumeHistory[size - 1]).coerceAtLeast(minBrightness)
|
|
||||||
} else {
|
|
||||||
minBrightness
|
|
||||||
}
|
|
||||||
val blue: Int
|
|
||||||
val rest: Int
|
|
||||||
if (relativeBrightness > 0.5) {
|
|
||||||
blue = 255
|
|
||||||
rest = (2 * 255 * (relativeBrightness - 0.5)).toInt()
|
|
||||||
} else {
|
|
||||||
blue = (255 * (relativeBrightness - 0.2) / 0.3).toInt()
|
|
||||||
rest = 0
|
|
||||||
}
|
|
||||||
val rgb = Color.rgb(rest, rest, blue)
|
|
||||||
canvas.drawColor(rgb)
|
|
||||||
if (size == 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val margins = height * 0.1
|
|
||||||
val graphHeight = height - 2.0 * margins
|
|
||||||
val leftMost = (volumeHistory.size() - width).coerceAtLeast(0)
|
|
||||||
val graphScale = graphHeight * volumeNorm
|
|
||||||
var xPrev = 0
|
|
||||||
var yPrev = (margins + graphHeight - volumeHistory[leftMost] * graphScale).toInt()
|
|
||||||
val length = min(size, width)
|
|
||||||
for (xNext in 1 until length - 1) {
|
|
||||||
val yNext = (margins + graphHeight - volumeHistory[leftMost + xNext] * graphScale).toInt()
|
|
||||||
canvas.drawLine(xPrev.toFloat(), yPrev.toFloat(), xNext.toFloat(), yNext.toFloat(), paint)
|
|
||||||
xPrev = xNext
|
|
||||||
yPrev = yNext
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2009 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*
|
|
||||||
* Taken from https://android.googlesource.com/platform/external/nist-sip/+/6f95fdeab4481188b6260041b41d1db12b101266/src/com/android/sip/media/G711UCodec.java
|
|
||||||
* Adopted to the needs of the Child Monitor project.
|
|
||||||
*/
|
|
||||||
package de.rochefort.childmonitor.audio
|
|
||||||
|
|
||||||
/**
|
|
||||||
* G.711 codec. This class provides u-law conversion.
|
|
||||||
*/
|
|
||||||
class G711UCodec {
|
|
||||||
fun decode(b16: ShortArray, ulaw: ByteArray, count: Int, offset: Int): Int {
|
|
||||||
var i = 0
|
|
||||||
var j = offset
|
|
||||||
while (i < count) {
|
|
||||||
b16[i] = table8to16[ulaw[j].toInt() and 0xFF]
|
|
||||||
i++
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
return count
|
|
||||||
}
|
|
||||||
|
|
||||||
fun encode(b16: ShortArray, count: Int, b8: ByteArray, offset: Int): Int {
|
|
||||||
var i = 0
|
|
||||||
var j = offset
|
|
||||||
while (i < count) {
|
|
||||||
b8[j] = table13to8[b16[i].toInt() shr 4 and 0x1FFF]
|
|
||||||
i++
|
|
||||||
j++
|
|
||||||
}
|
|
||||||
return count
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
// s00000001wxyz...s000wxyz
|
|
||||||
// s0000001wxyza...s001wxyz
|
|
||||||
// s000001wxyzab...s010wxyz
|
|
||||||
// s00001wxyzabc...s011wxyz
|
|
||||||
// s0001wxyzabcd...s100wxyz
|
|
||||||
// s001wxyzabcde...s101wxyz
|
|
||||||
// s01wxyzabcdef...s110wxyz
|
|
||||||
// s1wxyzabcdefg...s111wxyz
|
|
||||||
private val table13to8 = ByteArray(8192)
|
|
||||||
private val table8to16 = ShortArray(256)
|
|
||||||
|
|
||||||
init {
|
|
||||||
// b13 --> b8
|
|
||||||
var p = 1
|
|
||||||
var q = 0
|
|
||||||
while (p <= 0x80) {
|
|
||||||
var i = 0
|
|
||||||
var j = (p shl 4) - 0x10
|
|
||||||
while (i < 16) {
|
|
||||||
val v = i + q xor 0x7F
|
|
||||||
val value1 = v.toByte()
|
|
||||||
val value2 = (v + 128).toByte()
|
|
||||||
var m = j
|
|
||||||
val e = j + p
|
|
||||||
while (m < e) {
|
|
||||||
table13to8[m] = value1
|
|
||||||
table13to8[8191 - m] = value2
|
|
||||||
m++
|
|
||||||
}
|
|
||||||
i++
|
|
||||||
j += p
|
|
||||||
}
|
|
||||||
p = p shl 1
|
|
||||||
q += 0x10
|
|
||||||
}
|
|
||||||
// b8 --> b16
|
|
||||||
for (r in 0..7) {
|
|
||||||
var i = 0
|
|
||||||
var m = r shl 4
|
|
||||||
while (i < 16) {
|
|
||||||
val v = (i + 0x10 shl r) - 0x10 shl 3
|
|
||||||
table8to16[m xor 0x7F] = v.toShort()
|
|
||||||
table8to16[(m xor 0x7F) + 128] = (65536 - v).toShort()
|
|
||||||
i++
|
|
||||||
m++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 626 B |
|
Before Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 854 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,74 +1,170 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<vector
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:height="108dp"
|
|
||||||
android:width="108dp"
|
android:width="108dp"
|
||||||
android:viewportHeight="108"
|
android:height="108dp"
|
||||||
android:viewportWidth="108"
|
android:viewportWidth="108"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
android:viewportHeight="108">
|
||||||
<path android:fillColor="#3DDC84"
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
android:pathData="M9,0L9,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M19,0L19,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
android:pathData="M29,0L29,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M39,0L39,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
android:pathData="M49,0L49,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M59,0L59,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
android:pathData="M69,0L69,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M79,0L79,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
android:pathData="M89,0L89,108"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M99,0L99,108"
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
android:pathData="M0,9L108,9"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
android:strokeColor="#33FFFFFF" />
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
<path
|
||||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
android:fillColor="#00000000"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:pathData="M0,19L108,19"
|
||||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
android:strokeWidth="0.8"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeColor="#33FFFFFF" />
|
||||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
<path
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:fillColor="#00000000"
|
||||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
android:pathData="M0,29L108,29"
|
||||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="de.rochefort.childmonitor.MonitorActivity" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/parentDeviceTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/parentDevice"
|
|
||||||
android:textSize="25sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/discoverChildButton"
|
|
||||||
style="?android:attr/buttonStyleSmall"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/discoverChild"
|
|
||||||
android:textSize="17sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/discoverChildDescription"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/discoverChildDescription"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/enterChildAddressButton"
|
|
||||||
style="?android:attr/buttonStyleSmall"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/enterChildAddress"
|
|
||||||
android:textSize="17sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/enterChildAddressDescription"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/enterChildAddressDescription"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="de.rochefort.childmonitor.MonitorActivity" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/parentDeviceTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/parentDevice"
|
|
||||||
android:textSize="25sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/enterAddressInstructions"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/enterAddressInstructions" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/ipAddressTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:text="@string/addressTitle" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/ipAddressField"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ems="10"
|
|
||||||
android:hint="@string/exampleAddress"
|
|
||||||
android:inputType="textUri"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:nextFocusForward="@+id/portField" >
|
|
||||||
|
|
||||||
</EditText>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/portTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:text="@string/portTitle" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/portField"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:ems="10"
|
|
||||||
android:inputType="number"
|
|
||||||
android:maxLength="5"
|
|
||||||
android:hint="@string/examplePort"
|
|
||||||
android:nextFocusForward="@+id/connectViaAddressButton"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/connectViaAddressButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:text="@string/connect" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="de.rochefort.childmonitor.MonitorActivity" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/parentDeviceTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/parentDevice"
|
|
||||||
android:textSize="25sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/selectChildDeviceTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/selectChildDevice"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/ServiceTable"
|
|
||||||
android:scrollbars="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="0.32"
|
|
||||||
android:padding="10dp" >
|
|
||||||
</ListView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:keepScreenOn="true"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="de.rochefort.childmonitor.MonitorActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@id/parentDeviceTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/parentDevice"
|
|
||||||
android:textSize="25sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/connectedToTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/connectedTo"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/connectedTo"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/status"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/status"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textStatus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<de.rochefort.childmonitor.VolumeView
|
|
||||||
android:id="@+id/volume"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="24dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/startStreamButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Start Streaming"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/ipAddressText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="IP-Adresse: wird geladen..."
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@android:color/black" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/PortText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:text="Port zu wählen: 50005"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@android:color/black" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
android:keepScreenOn="true"
|
|
||||||
tools:context="de.rochefort.childmonitor.MonitorActivity" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/childDeviceTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/childDevice"
|
|
||||||
android:textSize="25sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:fillViewport="true">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/LinearLayout2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:keepScreenOn="true"
|
|
||||||
tools:context="de.rochefort.childmonitor.MonitorActivity" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/serviceTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/serviceTitle"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textService"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/loading"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/serviceDescription"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/serviceDescription" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/portTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/portTitle"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/port"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/loading"
|
|
||||||
android:textSize="20sp"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/addressTitle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/addressTitle"
|
|
||||||
android:textSize="20sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/address"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="15sp"/>
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textStatus"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="20sp" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="de.rochefort.childmonitor.StartActivity" >
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/useChildDevice"
|
|
||||||
style="?android:attr/buttonStyleSmall"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/useAsChildDevice"
|
|
||||||
android:textSize="17sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/childDescription"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/childDescription"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="15dip" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/useParentDevice"
|
|
||||||
style="?android:attr/buttonStyleSmall"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/useAsParentDevice"
|
|
||||||
android:textSize="17sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/parentDescription"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/parentDescription" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/availableChildrenList"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeightSmall" />
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
<background android:drawable="@drawable/ic_launcher_background" />
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
Before Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">Child Monitor</string>
|
|
||||||
<string name="action_settings">Einstellungen</string>
|
|
||||||
<string name="useAsParentDevice">Als Eltern-Gerät benutzen</string>
|
|
||||||
<string name="useAsChildDevice">Als Kind-Gerät benutzen</string>
|
|
||||||
<string name="childDescription">Gerät ist beim Kind platziert und sendet Tonsignale zum Eltern-Gerät</string>
|
|
||||||
<string name="parentDescription">Gekoppelt mit Kind-Gerät und gibt empfangene Tonsignale wieder.</string>
|
|
||||||
<string name="childDevice">Kind-Gerät</string>
|
|
||||||
<string name="serviceTitle">Dienst:</string>
|
|
||||||
<string name="serviceDescription">Name des Diensten, mit dem sich die Eltern verbinden müssen.</string>
|
|
||||||
<string name="loading">Lade...</string>
|
|
||||||
<string name="stopped">Angehalten</string>
|
|
||||||
<string name="streaming">Streaming...</string>
|
|
||||||
<string name="waitingForParent">Warte auf Eltern</string>
|
|
||||||
<string name="parentDevice">Eltern-Gerät</string>
|
|
||||||
<string name="selectChildDevice">Wähle Kind-Gerät</string>
|
|
||||||
<string name="status">Status:</string>
|
|
||||||
<string name="connectedTo">Verbunden mit:</string>
|
|
||||||
<string name="disconnected">Getrennt</string>
|
|
||||||
<string name="listening">Lausche...</string>
|
|
||||||
<string name="addressTitle">Adressen:</string>
|
|
||||||
<string name="portTitle">Port:</string>
|
|
||||||
<string name="notConnected">Mit keinem Netzwerk verbunden</string>
|
|
||||||
<string name="enterAddressInstructions">Gib die IP-Adresse und den Port des Kind-Gerätes ein und klicke auf Verbinden</string>
|
|
||||||
<string name="connect">Verbinden</string>
|
|
||||||
<string name="exampleAddress">192.168.1.2</string>
|
|
||||||
<string name="examplePort">10000</string>
|
|
||||||
<string name="invalidPort">Entweder wurde kein Port eingegeben oder er ist ungültig</string>
|
|
||||||
<string name="invalidAddress">Das Adressfeld muss ausgefüllt sein</string>
|
|
||||||
<string name="discoverChild">Suche Kind im Netzwerk</string>
|
|
||||||
<string name="discoverChildDescription">Wähle ein Kind aus einer Liste der erkannten Kinder im Netzwerk</string>
|
|
||||||
<string name="enterChildAddress">Wähle Kind durch Adresse</string>
|
|
||||||
<string name="enterChildAddressDescription">Gib die Adresse und den Port des Kind ein</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">子モニター</string>
|
|
||||||
<string name="action_settings">設定</string>
|
|
||||||
<string name="useAsParentDevice">親機として使用する</string>
|
|
||||||
<string name="useAsChildDevice">子機として使用する</string>
|
|
||||||
<string name="childDescription">端末をベビーの横に置くと、音声が親機に送られます</string>
|
|
||||||
<string name="parentDescription">子機とペアにして、受信した音声を再生します</string>
|
|
||||||
<string name="childDevice">子機</string>
|
|
||||||
<string name="serviceTitle">サービス:</string>
|
|
||||||
<string name="serviceDescription">親機がペアにするサービスの名前</string>
|
|
||||||
<string name="loading">読み込み中...</string>
|
|
||||||
<string name="stopped">停止しました</string>
|
|
||||||
<string name="streaming">ストリーム中...</string>
|
|
||||||
<string name="waitingForParent">親機を待機中...</string>
|
|
||||||
<string name="parentDevice">親機</string>
|
|
||||||
<string name="selectChildDevice">子機を選択:</string>
|
|
||||||
<string name="status">ステータス:</string>
|
|
||||||
<string name="connectedTo">接続しました:</string>
|
|
||||||
<string name="disconnected">切断しました</string>
|
|
||||||
<string name="listening">リスニング中...</string>
|
|
||||||
<string name="addressTitle">アドレス:</string>
|
|
||||||
<string name="portTitle">ポート:</string>
|
|
||||||
<string name="notConnected">ネットワークに接続されていません</string>
|
|
||||||
<string name="enterAddressInstructions">子機の IP アドレスとポートを入力して、接続をクリックしてください</string>
|
|
||||||
<string name="connect">接続</string>
|
|
||||||
<string name="exampleAddress">192.168.1.2</string>
|
|
||||||
<string name="examplePort">10000</string>
|
|
||||||
<string name="invalidPort">ポートが入力されていないか正しくありません</string>
|
|
||||||
<string name="invalidAddress">アドレスフィールドを入力してください</string>
|
|
||||||
<string name="discoverChild">ネットワークで子機を探索</string>
|
|
||||||
<string name="discoverChildDescription">ネットワークで検出した子機を選択します</string>
|
|
||||||
<string name="enterChildAddress">子機をアドレスで選択</string>
|
|
||||||
<string name="enterChildAddressDescription">子機のアドレスとポートを入力します</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">ChildMonitor</string>
|
|
||||||
<string name="action_settings">Instellingen</string>
|
|
||||||
<string name="useAsParentDevice">Gebruiken als ouderapparaat</string>
|
|
||||||
<string name="useAsChildDevice">Gebruiken als kindapparaat</string>
|
|
||||||
<string name="childDescription">Het apparaat wordt bij de baby geplaatst en verstuurt audio naar een gekoppeld ouderapparaat.</string>
|
|
||||||
<string name="parentDescription">Verbindt met kindapparaat en speelt ontvangen audio af</string>
|
|
||||||
<string name="childDevice">Kindapparaat</string>
|
|
||||||
<string name="serviceTitle">Dienst:</string>
|
|
||||||
<string name="serviceDescription">Naam van de dienst waar de ouder mee moet verbinden</string>
|
|
||||||
<string name="loading">Bezig met laden...</string>
|
|
||||||
<string name="stopped">Gestopt</string>
|
|
||||||
<string name="streaming">Bezig met uitzenden...</string>
|
|
||||||
<string name="waitingForParent">Bezig met wachten op ouderapparaat...</string>
|
|
||||||
<string name="parentDevice">Ouderapparaat</string>
|
|
||||||
<string name="selectChildDevice">Selecteer kindapparaat:</string>
|
|
||||||
<string name="status">Status:</string>
|
|
||||||
<string name="connectedTo">Verbonden met:</string>
|
|
||||||
<string name="disconnected">Verbinding verbroken</string>
|
|
||||||
<string name="listening">Bezig met luisteren...</string>
|
|
||||||
<string name="addressTitle">Adressen:</string>
|
|
||||||
<string name="portTitle">Poort:</string>
|
|
||||||
<string name="notConnected">Niet verbonden met een netwerk</string>
|
|
||||||
<string name="enterAddressInstructions">Voer het IP-adres en de poort van een kindapparaat in en druk op Verbinden</string>
|
|
||||||
<string name="connect">Verbinden</string>
|
|
||||||
<string name="exampleAddress">192.168.1.2</string>
|
|
||||||
<string name="examplePort">10000</string>
|
|
||||||
<string name="invalidPort">Er is geen of een ongeldig poortnummer ingevoerd</string>
|
|
||||||
<string name="invalidAddress">Het adresveld moet worden ingevuld</string>
|
|
||||||
<string name="discoverChild">Kindapparaat ontdekken op netwerk</string>
|
|
||||||
<string name="discoverChildDescription">Selecteer het kindapparaat uit een lijst van ontdekte apparaten op het netwerk</string>
|
|
||||||
<string name="enterChildAddress">Selecteer kindapparaat middels adres</string>
|
|
||||||
<string name="enterChildAddressDescription">Voer het adres en de poort in van een kindapparaat</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">Monitor para crianças</string>
|
|
||||||
<string name="action_settings">Configurações</string>
|
|
||||||
<string name="useAsParentDevice">Usar como Dispositivo de Pais</string>
|
|
||||||
<string name="useAsChildDevice">Usar como Dispositivo para Crianças</string>
|
|
||||||
<string name="childDescription">O dispositivo é colocado com o bebê para enviar áudio a um Dispositivo de Pais conectado</string>
|
|
||||||
<string name="parentDescription">Conecta com o Dispositivo para Crianças e reproduz o áudio recebido</string>
|
|
||||||
<string name="childDevice">Dispositivo para Crianças</string>
|
|
||||||
<string name="serviceTitle">Serviço:</string>
|
|
||||||
<string name="serviceDescription">Nome do serviço ao qual os pais devem se conectar</string>
|
|
||||||
<string name="loading">Carregando...</string>
|
|
||||||
<string name="stopped">Parado</string>
|
|
||||||
<string name="streaming">Transmitindo...</string>
|
|
||||||
<string name="waitingForParent">Esperando os Pais...</string>
|
|
||||||
<string name="parentDevice">Dispositivo de Pais</string>
|
|
||||||
<string name="selectChildDevice">Selecione o Dispositivo para Crianças:</string>
|
|
||||||
<string name="status">Status:</string>
|
|
||||||
<string name="connectedTo">Conectado a:</string>
|
|
||||||
<string name="disconnected">Desconectado</string>
|
|
||||||
<string name="listening">Ouvindo...</string>
|
|
||||||
<string name="addressTitle">Endereços:</string>
|
|
||||||
<string name="portTitle">Porta:</string>
|
|
||||||
<string name="notConnected">Não conectado a nenhuma rede</string>
|
|
||||||
<string name="enterAddressInstructions">Digite o endereço IP e a Porta de Dispositivo para Criança e clique em Conectar</string>
|
|
||||||
<string name="connect">Conectar</string>
|
|
||||||
<string name="exampleAddress">192.168.1.2</string>
|
|
||||||
<string name="examplePort">10000</string>
|
|
||||||
<string name="invalidPort">Ou não foi digitada nenhuma Porta ou é inválida</string>
|
|
||||||
<string name="invalidAddress">O campo de endereço precisa ser preenchido</string>
|
|
||||||
<string name="discoverChild">Descubra o Dispositivo para Criança na Rede</string>
|
|
||||||
<string name="discoverChildDescription">Selecione um Dispositivo para Criança de uma lista que foi encontrada na rede</string>
|
|
||||||
<string name="enterChildAddress">Selecione Dispositivo para Criança por Endereço</string>
|
|
||||||
<string name="enterChildAddressDescription">Digite o endereço e a Porta de Dispositivo para Criança</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Base application theme for API 11+. This theme completely replaces
|
|
||||||
AppBaseTheme from res/values/styles.xml on API 11+ devices.
|
|
||||||
-->
|
|
||||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
|
|
||||||
<!-- API 11 theme customizations can go here. -->
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Base application theme for API 14+. This theme completely replaces
|
|
||||||
AppBaseTheme from BOTH res/values/styles.xml and
|
|
||||||
res/values-v11/styles.xml on API 14+ devices.
|
|
||||||
-->
|
|
||||||
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
|
||||||
<!-- API 14 theme customizations can go here. -->
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Example customization of dimensions originally defined in res/values/dimens.xml
|
|
||||||
(such as screen margins) for screens with more than 820dp of available width. This
|
|
||||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
|
|
||||||
-->
|
|
||||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
</resources>
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,36 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="app_name">Babyphone</string>
|
||||||
<string name="app_name">Child Monitor</string>
|
|
||||||
<string name="action_settings">Settings</string>
|
|
||||||
<string name="useAsParentDevice">Use as Parent Device</string>
|
|
||||||
<string name="useAsChildDevice">Use as Child Device</string>
|
|
||||||
<string name="childDescription">Device is placed with baby, and sends audio to a paired parent device</string>
|
|
||||||
<string name="parentDescription">Pairs with child device and plays received audio</string>
|
|
||||||
<string name="childDevice">Child Device</string>
|
|
||||||
<string name="serviceTitle">Service:</string>
|
|
||||||
<string name="serviceDescription">Name of the service that parent must pair to</string>
|
|
||||||
<string name="loading">Loading...</string>
|
|
||||||
<string name="stopped">Stopped</string>
|
|
||||||
<string name="streaming">Streaming...</string>
|
|
||||||
<string name="waitingForParent">Waiting for Parent...</string>
|
|
||||||
<string name="parentDevice">Parent Device</string>
|
|
||||||
<string name="selectChildDevice">Select Child Device:</string>
|
|
||||||
<string name="status">Status:</string>
|
|
||||||
<string name="connectedTo">Connected To:</string>
|
|
||||||
<string name="disconnected">Disconnected</string>
|
|
||||||
<string name="listening">Listening...</string>
|
|
||||||
<string name="addressTitle">Addresses:</string>
|
|
||||||
<string name="portTitle">Port:</string>
|
|
||||||
<string name="notConnected">Not connected to any network</string>
|
|
||||||
<string name="enterAddressInstructions">Enter the IP Address and port of a child and click Connect</string>
|
|
||||||
<string name="connect">Connect</string>
|
|
||||||
<string name="exampleAddress">192.168.1.2</string>
|
|
||||||
<string name="examplePort">10000</string>
|
|
||||||
<string name="invalidPort">Either no port was entered or it is invalid</string>
|
|
||||||
<string name="invalidAddress">The address field needs to be filled out</string>
|
|
||||||
<string name="discoverChild">Discover Child on Network</string>
|
|
||||||
<string name="discoverChildDescription">Select child from a list of discovered children on the network</string>
|
|
||||||
<string name="enterChildAddress">Select Child by Address</string>
|
|
||||||
<string name="enterChildAddressDescription">Enter the address and port of the child</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
|
<!-- res/values/styles.xml -->
|
||||||
<resources>
|
<resources>
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!--
|
<!-- Customize your theme here -->
|
||||||
Base application theme, dependent on API level. This theme is replaced
|
<item name="colorPrimary">@color/purple_500</item>
|
||||||
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
|
<item name="colorPrimaryDark">@color/purple_700</item>
|
||||||
-->
|
<item name="colorAccent">@color/teal_200</item>
|
||||||
|
</style>
|
||||||
<!-- Application theme. -->
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.Babyphone" parent="android:Theme.Material.Light.NoActionBar" />
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older than API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.example.babyphone
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
buildscript {
|
|
||||||
ext {
|
|
||||||
kotlin_version = '1.9.22'
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
google()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:8.2.2'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
google()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<p>Ein quelloffenes Babyfon für Android</p>
|
|
||||||
<p>Child Monitor lässt zwei Androidgeräte als Babyfon fungieren. Das erste Gerät bleibt im Kinderzimmer. Das zweite Gerät kann sich über das Netzwerk mit ihm verbinden und einen Audiostream empfangen.</p>
|
|
||||||
<p>Dieses Projekt ist ein Fork von Protect Baby Monitor, welches von seinem Entwickler als "on hiatus" (pausiert) gekennzeichnet wurde.</p>
|
|
||||||
<p>Child Monitor funktioniert auf Android 5.0 (Lollipop) und neuer, d.h. ab Android SDK 21.</p>
|
|
||||||
<p>Achtung: Diese Version von Child Monitor ist inkompatibel zu älteren Versionen als 1.0!</p>
|
|
||||||
<p>Fehlerbehebung in dieser Version: Das Elterngerät erkennt jetzt, wenn das Kindgerät keine Daten mehr schickt
|
|
||||||
(z.B. aufgrund von Netzwerkproblemen), trennt die Verbindung und spielt den Warnton ab.</p>
|
|
||||||