Compare commits
499 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1779916d97 | |||
| c7f0d4e8b3 | |||
| e39e1b462d | |||
| 9d41856854 | |||
| c26c769108 | |||
| ac97ca8068 | |||
| c96a00333b | |||
| 21a672acf4 | |||
| be7b6cc2d6 | |||
| 6cec337db1 | |||
| 8ee7ed0ef2 | |||
| 3e60e55f16 | |||
| bec5a3098b | |||
| 96635381f4 | |||
| 12d3c80ba8 | |||
| 17026db07e | |||
| f68ec9a8e9 | |||
| aa3c3d05e1 | |||
| 3d883e0674 | |||
| 22e6400369 | |||
| 60024dc915 | |||
| d049e524d5 | |||
| cc0b50f288 | |||
| a980bc4946 | |||
| 3ef524accd | |||
| 34e6843d91 | |||
| b7ee6b16dc | |||
| e4707c2493 | |||
| f3cbda43d1 | |||
| ce73bd70fe | |||
| 784844b85f | |||
| c145056e5e | |||
| e39f282abf | |||
| 1d8b26998a | |||
| 98c48e595f | |||
| 7d64788154 | |||
| c4cb9ff458 | |||
| 2e924d2882 | |||
| e6de5e4576 | |||
| 183e14733c | |||
| 7935dd5c93 | |||
| 9fe699b40d | |||
| 0b84b5aea4 | |||
| 2af860f694 | |||
| 47f730b76e | |||
| c27f1030b6 | |||
| 99a61f8ca3 | |||
| 78b7484403 | |||
| eb24b32952 | |||
| c818d5bcc7 | |||
| 8a5267b0f8 | |||
| 54a9fcedf8 | |||
| 198c681333 | |||
| ec4cbc1e7c | |||
| 7ea6f8b3e4 | |||
| a52de9ccb7 | |||
| dc4f54be4b | |||
| f7f590a77e | |||
| a4745cdccd | |||
| a68980a6b3 | |||
| cdb66470b5 | |||
| 1875160f6f | |||
| dd0cc96d58 | |||
| 2d2a79470d | |||
| cfcebca5a0 | |||
| 4d473573db | |||
| 6acf0ad031 | |||
| 070aeb35d7 | |||
| b710626ad0 | |||
| 16604f7fdb | |||
| 6e4e7fba4a | |||
| 234125bc35 | |||
| a89b418350 | |||
| 2dec5c1a05 | |||
| 926c3e2af2 | |||
| bda3f270af | |||
| aff64c354c | |||
| 425012517c | |||
| 13b8dc95db | |||
| 1dec30e2fa | |||
| 7747a10959 | |||
| ed04554a4a | |||
| 2ee0e775be | |||
| b80991280a | |||
| fb7f43ed23 | |||
| d8a1b66738 | |||
| 94485b5633 | |||
| 628c89b1d1 | |||
| 7a90189927 | |||
| b5ac492414 | |||
| 0efa7320e3 | |||
| 253208b6f9 | |||
| b80ca96a73 | |||
| fa28d7e3d7 | |||
| 4dfba22914 | |||
| 100123e716 | |||
| ef365f360c | |||
| 95ff5b81c0 | |||
| 7cf6849e5d | |||
| 53e9f08272 | |||
| 6b92172d74 | |||
| 2501831a59 | |||
| 3a278b0ca6 | |||
| 78e2edd4e9 | |||
| a8fe102bb8 | |||
| e88250196e | |||
| 57ef44c450 | |||
| 931669bf53 | |||
| c01367e422 | |||
| b91f006d8b | |||
| b65a9f0bd3 | |||
| d91556681b | |||
| 242d3addef | |||
| 81b7d7e930 | |||
| 5dae45bb0b | |||
| fa78d02778 | |||
| 370fecaa8a | |||
| b6a0e39ac3 | |||
| 433b3ee002 | |||
| 58894924a5 | |||
| 3edea58f8c | |||
| dc200294be | |||
| 4d1922d088 | |||
| c9227fd8ac | |||
| 0b029f68e3 | |||
| c46aab31e9 | |||
| 184fdc14d1 | |||
| 940016f44a | |||
| af39f2c94b | |||
| 9c74043172 | |||
| 7cf816c903 | |||
| 342368bd77 | |||
| bc35492cee | |||
| d7605da60f | |||
| bfd895112d | |||
| b4f6f15055 | |||
| 1b93608d2a | |||
| 987dab9079 | |||
| f2dfe7a88f | |||
| 28ff89d07f | |||
| 20228d9e79 | |||
| b2d96b34b1 | |||
| 6cb0a2ddf0 | |||
| b94b33ecf1 | |||
| f27f7e4c81 | |||
| 48a139cdd5 | |||
| ce0f6ebd7c | |||
| d00a13bb50 | |||
| 1cbb44f714 | |||
| f5f3730281 | |||
| 102d8aa266 | |||
| b1db199beb | |||
| 41357ed8dd | |||
| 4339239c33 | |||
| 08fd1b6edd | |||
| 02f9d4fcb7 | |||
| 17337e39ba | |||
| b30248d973 | |||
| 41dfcd0e4f | |||
| 870d9cbbab | |||
| fa80fbc114 | |||
| 2d30b9451b | |||
| e863797030 | |||
| f4b9d46077 | |||
| 2d1e6f8f50 | |||
| 378d00b83e | |||
| 8c369ed2e8 | |||
| 9e58387ef7 | |||
| 5e31cea660 | |||
| ed04b687ed | |||
| 0cf4909df4 | |||
| b700fdd8dd | |||
| a21ac02333 | |||
| 17438db7a2 | |||
| 870be06255 | |||
| ee89eeb39d | |||
| 291c4cb42a | |||
| 68c7755e7e | |||
| 48a62d819a | |||
| ac27882ad1 | |||
| c197606204 | |||
| d9ce3af5aa | |||
| e8270d4027 | |||
| 2dc35e212b | |||
| e57d62471b | |||
| 5e3b103815 | |||
| e1b2494835 | |||
| c27556500e | |||
| 696cca0087 | |||
| 9e6172caeb | |||
| 68054ebf4f | |||
| 203bb67f7f | |||
| 4dfa80c17f | |||
| 3cd96cfc82 | |||
| bcc4133a31 | |||
| d6fc1390fd | |||
| 55ceb0bf34 | |||
| 6a81f5de16 | |||
| aea0d9bab1 | |||
| 52273e1ebe | |||
| 902d87a9c5 | |||
| 81dc81a1ae | |||
| 94bfbbd664 | |||
| 53d471c0aa | |||
| 8d9896f8b4 | |||
| 3a49b15dea | |||
| 1adaf8bc46 | |||
| 267054e4ba | |||
| a80a1c5cdc | |||
| 6656882859 | |||
| e662f7e29d | |||
| cf795be35f | |||
| 1cc834f089 | |||
| 132bd3b29d | |||
| d68c3cae54 | |||
| e1618604c9 | |||
| 6109f66ea0 | |||
| 5716584772 | |||
| edaa23f0f6 | |||
| 5a1be3c2e4 | |||
| c7e286f51e | |||
| 7e8938c38c | |||
| 8d51526481 | |||
| c0188cd5cc | |||
| 28bc108921 | |||
| 0a1ce4fe60 | |||
| 1e0ec282ca | |||
| 6f39d31d5d | |||
| 41b2eb6b07 | |||
| 9ad529d9eb | |||
| da3ba116da | |||
| 65581f13d5 | |||
| 326d773741 | |||
| 3b949b13f7 | |||
| 6214c01157 | |||
| 4499824965 | |||
| 48e0c065b6 | |||
| e59d65fac0 | |||
| 3dbd626aee | |||
| ee485c4466 | |||
| b60a7af9cd | |||
| 1c0340b9cf | |||
| dd1cc00c9d | |||
| 4f0398260b | |||
| 49318f3191 | |||
| 490655fb02 | |||
| 907e8ee498 | |||
| d7a14a4899 | |||
| a968c1a91e | |||
| f4515f86c8 | |||
| 7f22b2dee2 | |||
| fc37d158c5 | |||
| c6f90c42af | |||
| 1b83d4180b | |||
| e54b53c974 | |||
| fee3fd81a0 | |||
| ccc99033cd | |||
| 03ae4329bc | |||
| baaeddb9fb | |||
| e0c464416d | |||
| 43892798ef | |||
| 64f2f598df | |||
| b405f0b191 | |||
| ded778fd11 | |||
| f1da2c5a4d | |||
| 9a44631a96 | |||
| 8fad681f01 | |||
| 0ca8bcab43 | |||
| 51fa28bddf | |||
| 4a31b474c5 | |||
| 9bca47d566 | |||
| 0632804bd4 | |||
| 8362585b7b | |||
| 67801e0c91 | |||
| a49cb55b93 | |||
| da36be0862 | |||
| 5612a5e039 | |||
| d003727113 | |||
| c4968633ed | |||
| 12a6c1d31b | |||
| c3731ca4b4 | |||
| 467a5ff068 | |||
| d759ebcd77 | |||
| 267eda7afd | |||
| b065d1136e | |||
| 47afc78ee4 | |||
| fccc6a3609 | |||
| c7583d9d6f | |||
| dc829b9487 | |||
| b3f28c8276 | |||
| 14c925d480 | |||
| 3f94756fa8 | |||
| b7eab6e3d0 | |||
| eb63ff0a51 | |||
| edd5d0d083 | |||
| fc11ae264f | |||
| 4f7476bb84 | |||
| cf3c922fa2 | |||
| 584760b6ba | |||
| cb9838181f | |||
| bc9d598bfe | |||
| 659d5ea0d2 | |||
| 2242401977 | |||
| c3f2b91d72 | |||
| e5cd72ec2d | |||
|
|
e777d4e3bf | ||
|
|
d12c378b4f | ||
|
|
b7c7913c92 | ||
| 04864434a1 | |||
| 78189c8881 | |||
| 09ae1b2667 | |||
| 81a85320a2 | |||
| 4c4a96b5e5 | |||
|
|
1b4f558e8d | ||
|
|
a8ed1ef5a9 | ||
|
|
86cab179a8 | ||
|
|
efebd4c5ec | ||
|
|
5d21a0cc05 | ||
|
|
9de2ee1e3c | ||
|
|
cff5685a61 | ||
|
|
40b232422e | ||
|
|
b18becabad | ||
|
|
7777972d97 | ||
|
|
12673437da | ||
| 2f3dbf462e | |||
| 6a15640aea | |||
| 8526e5157d | |||
| c1c923a2fc | |||
| b3c2d195b5 | |||
| 6f6a764f97 | |||
| 52a2cb207f | |||
| 88d2b2cebf | |||
| a3a7409808 | |||
| 93a237ad17 | |||
| 208655b465 | |||
| 68e695da67 | |||
| 02aaf46f2b | |||
| ca42cb71b9 | |||
| 60e5131850 | |||
| 89d4291168 | |||
| d33ebbfd25 | |||
| b8b0a1e62b | |||
| 99c5608a1e | |||
| eab6c72800 | |||
| 26ed8584c8 | |||
| 279c19272e | |||
| 6e41f357b0 | |||
| 9ccdee277c | |||
| ca3de56e60 | |||
| 04dec80d9a | |||
| 9d698fa2bc | |||
| 27abb20728 | |||
| da290e570f | |||
| efdbc56859 | |||
| c897c5ba60 | |||
| fa3b6f35f5 | |||
| 017b690437 | |||
| 84ba74b656 | |||
| 052571a226 | |||
| 1f7889e4f1 | |||
| f069aa69e6 | |||
| c438882f74 | |||
| 3329695671 | |||
| 5b67dde4e4 | |||
| cc703e5091 | |||
| 160c437430 | |||
| 9abf7c0952 | |||
| dd163a797e | |||
| 2b5182b56a | |||
| 5a222ba051 | |||
| f0137b2161 | |||
| 6b13f3527a | |||
| b688217ad0 | |||
| 09651491e3 | |||
| 18b15569d6 | |||
| 9687f28eb0 | |||
| fddaa34c30 | |||
| b5024a063d | |||
| 9af96a7cb2 | |||
| a020ec6668 | |||
| da219e2105 | |||
| 52357fd589 | |||
| 0c14bbb6a3 | |||
| 25b15e3fd2 | |||
| 74bdd33a9c | |||
| 2608ad0bfd | |||
| 0a77d3f400 | |||
| 1338f20624 | |||
| 90c1dd7e37 | |||
| 655de59490 | |||
| 2c5026cdac | |||
| 65e396a472 | |||
| 1265c38d82 | |||
| 5170a151c8 | |||
| 36f2509d94 | |||
| 9fa687081a | |||
| df9b41a843 | |||
| a1cb12f6ce | |||
| 8d9354d845 | |||
| 115bf6efac | |||
| 5814b2537f | |||
| 1688a8b2e5 | |||
| 33de44b166 | |||
| 0b41bbc446 | |||
| c384a46863 | |||
| 4b24615f4f | |||
| 44d5fa0227 | |||
| f2e940cda1 | |||
| 274b708089 | |||
| dd1bb75192 | |||
| 6a8040b529 | |||
| 893122e111 | |||
| 89c65fb61f | |||
| 814c40afca | |||
| 9eff27dbab | |||
| d799e0a487 | |||
| 172975d792 | |||
| 9e59b53546 | |||
| 909c8ea2b3 | |||
| d26a9d0018 | |||
| 92f402a07b | |||
| 969f089a9e | |||
| 9fd00f227a | |||
| 0d0f0a4044 | |||
| beff7da576 | |||
| 5b2eabcfd3 | |||
| dfa07de6c8 | |||
| a55064846f | |||
| d90bc0f59f | |||
| 0fac8b29f8 | |||
| 5a7d1042de | |||
| dd22551e65 | |||
| 5de797cd8d | |||
| d795c27911 | |||
| 26e38ed704 | |||
| 45eabe2845 | |||
| 23f0645581 | |||
| bf303604bd | |||
| 5df0bd1f28 | |||
| 32a48a753a | |||
| 49ec412fff | |||
| e4ceb609be | |||
| b30fcba967 | |||
| e7b3c4ba5a | |||
| ffe721ab97 | |||
| 0a9bca2804 | |||
| 990db6a74a | |||
| 173d01a275 | |||
| c5ce7df958 | |||
| 0c64d4d1ad | |||
| d099a76ca5 | |||
| 2cef2053a1 | |||
| 6e745acaa5 | |||
| 726fc3e955 | |||
| b9d684fbbc | |||
| 1a6025de6d | |||
| 6839ad1a53 | |||
| b21a28e3a4 | |||
| 6cf1415285 | |||
| 2b9be4f09c | |||
| b6e902feb6 | |||
| 69544b4552 | |||
| 30530c0648 | |||
| 41c15c68c8 | |||
| beac1c34c4 | |||
| d3cd7287d5 | |||
| c0e2fccce5 | |||
| 5351e56be7 | |||
| 3574f7a433 | |||
| 439be77a8b | |||
| 68265759ba | |||
| 197d554bee | |||
| 889f9fc85f | |||
| 3cb72a1d17 | |||
| 72bd17569d | |||
| e7655b380e | |||
| d622648bab | |||
| 23df77f898 | |||
| 73a36dfcca | |||
| fa9f7aed2b | |||
| d91d5c5b81 | |||
| 3fd3b0430f | |||
| c50e50305f | |||
| cee57cba93 | |||
| 95240dd392 | |||
| 6b4b565a62 | |||
| 253e359483 | |||
| b405c12293 | |||
| aeef862ab4 | |||
| d692c30bd9 | |||
| 3a8bb12bab | |||
| a9b8799f21 | |||
| 3bdb4ea043 | |||
| 52afc53660 | |||
| 1526e58b06 | |||
| bd54762bac | |||
| 21ab281ec6 | |||
| 2c1ccb8b57 | |||
| 5f230a921d |
887 changed files with 98162 additions and 368455 deletions
44
.classpath
44
.classpath
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="lib" path="external/marytts-5.1.2/lib/icu4j-54.1.1.jar"/>
|
||||
<classpathentry kind="lib" path="external/marytts-5.1.2/lib/marytts-client-5.1.2-jar-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="external/marytts-5.1.2/lib/marytts-lang-en-5.1.2.jar"/>
|
||||
<classpathentry kind="lib" path="external/marytts-5.1.2/lib/marytts-lang-sv-5.1.2.jar"/>
|
||||
<classpathentry kind="lib" path="external/marytts-5.1.2/lib/marytts-runtime-5.1.2-jar-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="external/marytts-5.1.2/lib/voice-cmu-slt-hsmm-5.1.2.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Ab.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-math3-3.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/marytts-client-5.1.2-jar-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="lib/marytts-runtime-5.1.2-jar-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
|
||||
<classpathentry kind="lib" path="lib/java-speech-api-master.jar"/>
|
||||
<classpathentry kind="lib" path="lib/sphinx4-core.jar"/>
|
||||
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.8.11.2_HACKED_FOR_RPI.jar"/>
|
||||
<classpathentry kind="lib" path="lib/jSerialComm-1.3.10.jar"/>
|
||||
<classpathentry kind="lib" path="lib/pi4j-core-1.1-SNAPSHOT.jar" sourcepath="external/pi4j-1.1/pi4j-core-sources-1.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="jar:platform:/resource/hal/external/pi4j-1.1/pi4j-core-javadoc-1.1-SNAPSHOT.jar!/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/pi4j-device-1.1-SNAPSHOT.jar" sourcepath="external/pi4j-1.1/pi4j-device-sources-1.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="jar:platform:/resource/hal/external/pi4j-1.1/pi4j-device-javadoc-1.1-SNAPSHOT.jar!/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/pi4j-gpio-extension-1.1-SNAPSHOT.jar" sourcepath="external/pi4j-1.1/pi4j-gpio-extension-sources-1.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="jar:platform:/resource/hal/external/pi4j-1.1/pi4j-gpio-extension-javadoc-1.1-SNAPSHOT.jar!/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/pi4j-service-1.1-SNAPSHOT.jar" sourcepath="external/pi4j-1.1/pi4j-service-sources-1.1-SNAPSHOT.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="jar:platform:/resource/hal/external/pi4j-1.1/pi4j-service-javadoc-1.1-SNAPSHOT.jar!/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/zutil-java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="output" path="build"/>
|
||||
</classpath>
|
||||
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Github language stats file
|
||||
external/* linguist-vendored
|
||||
lib/* linguist-vendored
|
||||
*.css linguist-vendored
|
||||
*.js linguist-vendored
|
||||
15
.gitignore
vendored
Executable file → Normal file
15
.gitignore
vendored
Executable file → Normal file
|
|
@ -1,5 +1,14 @@
|
|||
/screenlog.0
|
||||
# Configuration and dependencies
|
||||
/hal.conf
|
||||
/hal.db*
|
||||
/build/
|
||||
/lib/Zutil.jar
|
||||
/lib/zutil-*
|
||||
/recordings/
|
||||
|
||||
# Runtime files
|
||||
/screenlog.0*
|
||||
/OZW_Log.txt
|
||||
|
||||
# Build and Ide files
|
||||
build
|
||||
.gradle
|
||||
.idea
|
||||
17
.project
17
.project
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>hal</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
39
Hal.iml
39
Hal.iml
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resource" type="java-resource" relativeOutputPath="resource" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library" exported="">
|
||||
<library name="lib">
|
||||
<CLASSES>
|
||||
<root url="file://$MODULE_DIR$/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<NATIVE>
|
||||
<root url="file://$MODULE_DIR$/lib" />
|
||||
</NATIVE>
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.ideaLibSources/jSerialComm-1.3.10-sources.jar!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$MODULE_DIR$/lib" recursive="false" />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="Zutil" exported="" />
|
||||
<orderEntry type="module-library" scope="TEST">
|
||||
<library name="JUnit4">
|
||||
<CLASSES>
|
||||
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.12.jar!/" />
|
||||
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
||||
35
Jenkinsfile
vendored
Normal file
35
Jenkinsfile
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// Jenkinsfile (Pipeline Script)
|
||||
node {
|
||||
// Configure environment
|
||||
env.JAVA_HOME = tool name: 'jdk-11'
|
||||
env.REPO_URL = "repo.koc.se/hal.git" //scm.getUserRemoteConfigs()[0].getUrl()
|
||||
env.BUILD_NAME = "BUILD-${env.BUILD_ID}"
|
||||
|
||||
|
||||
checkout scm
|
||||
|
||||
stage('Build') {
|
||||
sh './gradlew clean'
|
||||
sh './gradlew build'
|
||||
}
|
||||
|
||||
stage('Test') {
|
||||
try {
|
||||
sh './gradlew test'
|
||||
} finally {
|
||||
junit testResults: '**/build/test-results/test/*.xml'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Package') {
|
||||
sh './gradlew distZip'
|
||||
archiveArtifacts artifacts: 'build/distributions/Hal.zip', fingerprint: true
|
||||
|
||||
// Tag artifact
|
||||
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491',
|
||||
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
|
||||
sh "git tag ${env.BUILD_NAME}"
|
||||
sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
2
LICENSE.txt
Executable file → Normal file
2
LICENSE.txt
Executable file → Normal file
|
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Daniel Collin, Ziver Koc
|
||||
Copyright (c) 2016-2025 Daniel Collin, Ziver Koc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
104
README.md
Normal file
104
README.md
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# Hal
|
||||
|
||||
Hal is a home automation hub with sensor statistics with the functionality to
|
||||
share that data between friends. It has been developed to be very extensible so future
|
||||
Sensors and other input devices can be supported.
|
||||
|
||||
Features:
|
||||
- **Map**, Set up a house map with sensors and events mapped on a floorplan
|
||||
- **Triggers and Actions**, IFTTT type functionality
|
||||
- **Power;Challenge**, Sync power or sensor usage between friends to challenge each other to lower the power usage
|
||||
- **[Google Assistant Integration](plugins/hal-assistant-google/READNME.md)**
|
||||
|
||||
Currently supported devices:
|
||||
- **Network Scanner**, IP scanner to detect devices on local network
|
||||
- **NUT**, Linux UPS daemon
|
||||
- **Tellstick**, Supported devices:
|
||||
- NexaSelfLearning
|
||||
- Oregon0x1A2D
|
||||
- **Raspberry Pi**, GPIO connected sensors
|
||||
- **[Zigbee](plugins/hal-zigbee/README.md)**
|
||||
- Temperature Sensors
|
||||
- Humidity Sensors
|
||||
- Pressure Sensors
|
||||
- OnnOff Devices
|
||||
- **Google Assistant**
|
||||
- **MQTT Devices**
|
||||
|
||||
Under development (Not ready to be used yet)
|
||||
- **Z-Wave**
|
||||
|
||||
|
||||
The project is currently in alpha state, and as such things will change and break continuously.
|
||||
|
||||
### Screenshots
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Installing
|
||||
|
||||
To run the Hal server you first need to clone the git repository and then run the
|
||||
gradle command to build and run the server:
|
||||
|
||||
```
|
||||
./gradlew run
|
||||
```
|
||||
|
||||
Check `hal.conf.example` for available configuration options.
|
||||
By default, HAL server will be listening to http://localhost:8080.
|
||||
|
||||
## Running the tests
|
||||
|
||||
The current test coverage is greatly lacking, but to run the available JUnit
|
||||
test-cases run:
|
||||
|
||||
```
|
||||
./gradlew test
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
HalAbstractControlerManager
|
||||
|
|
||||
| HalAbstractController
|
||||
| |
|
||||
| | HalAbstractDevice
|
||||
| | |
|
||||
.-----------. .------------. .--------.
|
||||
| | | | | |
|
||||
| | | | ----> | Device |
|
||||
| | | | | |
|
||||
| | ----> | Controller | '--------'
|
||||
| | | | .--------.
|
||||
| | | | | |
|
||||
| Manager | | | ----> | Device |
|
||||
| | | | | |
|
||||
| | '------------' '--------'
|
||||
| | .------------. .--------.
|
||||
| | | | | |
|
||||
| | ----> | Controller | ----> | Device |
|
||||
| | | | | |
|
||||
'-----------' '------------' '--------'
|
||||
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
* **Daniel Collin**
|
||||
* **Ziver Koc**
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the
|
||||
[LICENSE.txt](LICENSE.txt) file for details
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
* Tellstick, for open-sourcing their code
|
||||
|
|
@ -59,28 +59,28 @@ bool parseArctechSelfLearning(uint8_t* bufStartP, uint8_t* bufEndP) { //start
|
|||
uint64_t data = 0;
|
||||
bool dimValuePresent;
|
||||
uint8_t b1,b2,b3,b4;
|
||||
|
||||
|
||||
//parse preamp
|
||||
|
||||
b1 = *bufStartP;
|
||||
stepBufferPointer(&bufStartP);
|
||||
b2 = *bufStartP;
|
||||
stepBufferPointer(&bufStartP);
|
||||
if(!IS_PREAMP(b1, b2)){
|
||||
if (!IS_PREAMP(b1, b2)){
|
||||
return false;
|
||||
}
|
||||
|
||||
//parse data
|
||||
|
||||
|
||||
uint16_t dataBitsInBuffer = (calculateBufferPointerDistance(bufStartP, bufEndP)-2) / 4; //each bit is representd by 4 high/low
|
||||
if (dataBitsInBuffer == 32) {
|
||||
dimValuePresent = false;
|
||||
}else if(dataBitsInBuffer == 36){
|
||||
} else if (dataBitsInBuffer == 36){
|
||||
dimValuePresent = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
for (uint8_t i = 0; i < dataBitsInBuffer; ++i) {
|
||||
b1 = *bufStartP; //no of high
|
||||
stepBufferPointer(&bufStartP);
|
||||
|
|
@ -103,7 +103,7 @@ bool parseArctechSelfLearning(uint8_t* bufStartP, uint8_t* bufEndP) { //start
|
|||
}
|
||||
|
||||
//data parsed - send event over serial
|
||||
|
||||
|
||||
Serial.print(F("+Wclass:command;protocol:arctech;model:selflearning;data:0x"));
|
||||
uint8_t hexToSend = (dimValuePresent ? 9 : 8);
|
||||
for (int8_t i = hexToSend - 1; i >= 0; --i) {
|
||||
|
|
|
|||
|
|
@ -17,29 +17,29 @@ void parseRadioRXBuffer() {
|
|||
bool parse = false;
|
||||
while (bufferReadP != bufferWriteP) { //stop if the read pointer is pointing to where the writing is currently performed
|
||||
uint8_t sampleCount = *bufferReadP;
|
||||
|
||||
|
||||
if ( (((uintptr_t)bufferReadP) & 0x1) == 1 ) { //buffer pointer is odd (stores highs)
|
||||
//Serial.print("high:"); Serial.println(sampleCount);
|
||||
if (prevValue >= SILENCE_LENGTH) {
|
||||
startDataP = bufferReadP; //some new data must start here since this is the first "high" after a silent period
|
||||
}
|
||||
|
||||
|
||||
//stream data to stream parsers
|
||||
parseOregonStream(HIGH, sampleCount);
|
||||
|
||||
|
||||
} else { //buffer pointer is even (stores lows)
|
||||
//Serial.print("low:"); Serial.println(sampleCount);
|
||||
if (sampleCount >= SILENCE_LENGTH) { //evaluate if it is time to parse the curernt data
|
||||
endDataP = bufferReadP; //this is a silient period and must be the end of a data
|
||||
if(startDataP != 0){
|
||||
if (startDataP != 0){
|
||||
parse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//stream data to stream parsers
|
||||
parseOregonStream(LOW, sampleCount);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//step the read pointer one step
|
||||
|
|
@ -74,11 +74,11 @@ void parseRadioRXBuffer() {
|
|||
//Let all available parsers parse the data set now.
|
||||
parseArctechSelfLearning(startDataP, endDataP);
|
||||
//TODO: add more parsers here
|
||||
|
||||
|
||||
//reset the data pointers since the data have been parsed at this point
|
||||
startDataP = 0;
|
||||
endDataP = 0;
|
||||
|
||||
|
||||
}; //end radioTask
|
||||
|
||||
void sendTCodedData(uint8_t* data, uint8_t T_long, uint8_t* timings, uint8_t repeat, uint8_t pause) {
|
||||
|
|
@ -88,7 +88,7 @@ void sendTCodedData(uint8_t* data, uint8_t T_long, uint8_t* timings, uint8_t rep
|
|||
for (int i = 0; i < T_long; ++i) {
|
||||
uint8_t timeIndex = (data[i / 4] >> (6 - (2 * (i % 4)))) & 0x03;
|
||||
if (timings[timeIndex] > 0 || i == T_long - 1) {
|
||||
if(nextPinState){
|
||||
if (nextPinState){
|
||||
TX_PIN_HIGH();
|
||||
}else{
|
||||
TX_PIN_LOW();
|
||||
|
|
@ -111,7 +111,7 @@ void sendSCodedData(uint8_t* data, uint8_t pulseCount, uint8_t repeat, uint8_t p
|
|||
bool nextPinState = HIGH;
|
||||
for (int i = 0; i < pulseCount; ++i) {
|
||||
if (data[i] > 0 || i == pulseCount - 1) {
|
||||
if(nextPinState){
|
||||
if (nextPinState){
|
||||
TX_PIN_HIGH();
|
||||
}else{
|
||||
TX_PIN_LOW();
|
||||
|
|
|
|||
11
arduino/HalMultiSensor/HalConfiguration.h
Executable file → Normal file
11
arduino/HalMultiSensor/HalConfiguration.h
Executable file → Normal file
|
|
@ -6,24 +6,25 @@
|
|||
|
||||
#define TIMER_MILLISECOND 60000 // poling in minutes
|
||||
#define INDICATOR_PIN 13 // diode
|
||||
#define DEVICE_BASE_ID 20
|
||||
#define TX_PIN 11
|
||||
#define DEVICE_BASE_ID 99
|
||||
|
||||
// POWER CONSUMPTION SENSOR
|
||||
//#define POWERCON_ENABLED // comment out to disable sensor
|
||||
#define POWERCON_SENSOR SensorPhotocell()
|
||||
#define POWERCON_PROTOCOL ProtocolOregon(11, DEVICE_BASE_ID + 1)
|
||||
#define POWERCON_PROTOCOL ProtocolOregon(TX_PIN, DEVICE_BASE_ID + 0)
|
||||
#define POWER_TIMER_MULTIPLIER 1
|
||||
|
||||
// TEMPERATURE SENSOR
|
||||
#define TEMPERATURE_ENABLED // comment out to disable sensor
|
||||
#define TEMPERATURE_SENSOR SensorDHT(DHT11, 10)
|
||||
#define TEMPERATURE_PROTOCOL ProtocolOregon(11, DEVICE_BASE_ID + 2)
|
||||
#define TEMPERATURE_PROTOCOL ProtocolOregon(TX_PIN, DEVICE_BASE_ID + 1)
|
||||
#define TEMPERATURE_TIMER_MULTIPLIER 10
|
||||
|
||||
// LIGHT SENSOR
|
||||
#define LIGHT_ENABLED // comment out to disable sensor
|
||||
//#define LIGHT_ENABLED // comment out to disable sensor
|
||||
#define LIGHT_SENSOR SensorBH1750()
|
||||
#define LIGHT_PROTOCOL ProtocolOregon(11, DEVICE_BASE_ID + 3)
|
||||
#define LIGHT_PROTOCOL ProtocolOregon(TX_PIN, DEVICE_BASE_ID + 2)
|
||||
#define LIGHT_TIMER_MULTIPLIER 10
|
||||
|
||||
|
||||
|
|
|
|||
0
arduino/HalMultiSensor/HalInclude.h
Executable file → Normal file
0
arduino/HalMultiSensor/HalInclude.h
Executable file → Normal file
0
arduino/HalMultiSensor/HalInterfaces.h
Executable file → Normal file
0
arduino/HalMultiSensor/HalInterfaces.h
Executable file → Normal file
15
arduino/HalMultiSensor/HalMultiSensor.ino
Executable file → Normal file
15
arduino/HalMultiSensor/HalMultiSensor.ino
Executable file → Normal file
|
|
@ -10,6 +10,15 @@ the data to a central location.
|
|||
#include "Interrupt.h"
|
||||
|
||||
|
||||
#ifndef POWERCON_ENABLED
|
||||
#define POWER_TIMER_MULTIPLIER 1
|
||||
#endif
|
||||
#ifndef TEMPERATURE_ENABLED
|
||||
#define TEMPERATURE_TIMER_MULTIPLIER 1
|
||||
#endif
|
||||
#ifndef LIGHT_ENABLED
|
||||
#define LIGHT_TIMER_MULTIPLIER 1
|
||||
#endif
|
||||
#define TIMER_MULTIPLIER_MAX \
|
||||
POWER_TIMER_MULTIPLIER * TEMPERATURE_TIMER_MULTIPLIER * LIGHT_TIMER_MULTIPLIER
|
||||
unsigned int timerMultiplier = 0;
|
||||
|
|
@ -83,7 +92,7 @@ void loop()
|
|||
|
||||
// Send power consumption
|
||||
#ifdef POWERCON_ENABLED
|
||||
if(timerMultiplier % POWER_TIMER_MULTIPLIER == 0)
|
||||
if (timerMultiplier % POWER_TIMER_MULTIPLIER == 0)
|
||||
{
|
||||
static PowerData powerData;
|
||||
powerSensor->read(powerData); // not needed, only here for future use
|
||||
|
|
@ -94,7 +103,7 @@ void loop()
|
|||
|
||||
// Handle temperature sensor
|
||||
#ifdef TEMPERATURE_ENABLED
|
||||
if(timerMultiplier % TEMPERATURE_TIMER_MULTIPLIER == 0)
|
||||
if (timerMultiplier % TEMPERATURE_TIMER_MULTIPLIER == 0)
|
||||
{
|
||||
static TemperatureData tempData;
|
||||
tempSensor->read(tempData);
|
||||
|
|
@ -105,7 +114,7 @@ void loop()
|
|||
|
||||
// Handle light sensor
|
||||
#ifdef LIGHT_ENABLED
|
||||
if(timerMultiplier % LIGHT_TIMER_MULTIPLIER == 0)
|
||||
if (timerMultiplier % LIGHT_TIMER_MULTIPLIER == 0)
|
||||
{
|
||||
static LightData lightData;
|
||||
lightSensor->read(lightData);
|
||||
|
|
|
|||
0
arduino/HalMultiSensor/HalMultiSensorEnclosure.FCStd
Executable file → Normal file
0
arduino/HalMultiSensor/HalMultiSensorEnclosure.FCStd
Executable file → Normal file
0
arduino/HalMultiSensor/HalMultiSensorEnclosure_bottom.stl
Executable file → Normal file
0
arduino/HalMultiSensor/HalMultiSensorEnclosure_bottom.stl
Executable file → Normal file
0
arduino/HalMultiSensor/HalMultiSensorEnclosure_top.stl
Executable file → Normal file
0
arduino/HalMultiSensor/HalMultiSensorEnclosure_top.stl
Executable file → Normal file
25
arduino/HalMultiSensor/Interrupt.cpp
Executable file → Normal file
25
arduino/HalMultiSensor/Interrupt.cpp
Executable file → Normal file
|
|
@ -35,14 +35,16 @@ void Interrupt::sleep()
|
|||
|
||||
sleep_enable(); // enables the sleep bit in the mcucr register
|
||||
// so sleep is possible. just a safety pin
|
||||
/*
|
||||
power_adc_disable();
|
||||
power_spi_disable();
|
||||
power_timer0_disable();
|
||||
power_timer1_disable();
|
||||
power_timer2_disable();
|
||||
power_twi_disable();
|
||||
*/
|
||||
|
||||
//power_adc_disable();
|
||||
//power_spi_disable();
|
||||
//power_usart0_disable();
|
||||
//power_timer0_disable();
|
||||
//power_timer1_disable();
|
||||
//power_timer2_disable();
|
||||
//power_twi_disable();
|
||||
//power_all_disable();
|
||||
|
||||
while( ! Interrupt::wakeUpNow)
|
||||
{
|
||||
sleep_mode(); // here the device is actually put to sleep!!
|
||||
|
|
@ -51,6 +53,13 @@ void Interrupt::sleep()
|
|||
sleep_disable(); // first thing after waking from sleep:
|
||||
// disable sleep...
|
||||
|
||||
//power_adc_enable();
|
||||
//power_spi_enable();
|
||||
//power_usart0_enable();
|
||||
//power_timer0_enable();
|
||||
//power_timer1_enable();
|
||||
//power_timer2_enable();
|
||||
//power_twi_enable();
|
||||
//power_all_enable(); // during normal running time.
|
||||
}
|
||||
|
||||
|
|
|
|||
0
arduino/HalMultiSensor/Interrupt.h
Executable file → Normal file
0
arduino/HalMultiSensor/Interrupt.h
Executable file → Normal file
0
arduino/HalMultiSensor/ProtocolNexa.cpp
Executable file → Normal file
0
arduino/HalMultiSensor/ProtocolNexa.cpp
Executable file → Normal file
0
arduino/HalMultiSensor/ProtocolNexa.h
Executable file → Normal file
0
arduino/HalMultiSensor/ProtocolNexa.h
Executable file → Normal file
8
arduino/HalMultiSensor/ProtocolOregon.cpp
Executable file → Normal file
8
arduino/HalMultiSensor/ProtocolOregon.cpp
Executable file → Normal file
|
|
@ -83,14 +83,14 @@ inline void ProtocolOregon::setId(byte data[], byte id)
|
|||
*/
|
||||
inline void ProtocolOregon::setBatteryLevel(byte data[], bool level)
|
||||
{
|
||||
if(!level) data[4] = 0x0C;
|
||||
if (!level) data[4] = 0x0C;
|
||||
else data[4] = 0x00;
|
||||
}
|
||||
|
||||
inline void ProtocolOregon::setTemperature(byte data[], float temp)
|
||||
{
|
||||
// Set temperature sign
|
||||
if(temp < 0)
|
||||
if (temp < 0)
|
||||
{
|
||||
data[6] = 0x08;
|
||||
temp *= -1;
|
||||
|
|
@ -127,9 +127,9 @@ inline void ProtocolOregon::calculateAndSetChecksum(byte data[])
|
|||
for(byte i = 0; i<8;i++)
|
||||
{
|
||||
sum += (data[i]&0xF0) >> 4;
|
||||
sum += (data[i]&0xF);
|
||||
sum += (data[i]&0x0F);
|
||||
}
|
||||
data[8] = ((sum - 0xa) & 0xFF);
|
||||
data[8] = ((sum - 0x0A) & 0xFF);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
0
arduino/HalMultiSensor/ProtocolOregon.h
Executable file → Normal file
0
arduino/HalMultiSensor/ProtocolOregon.h
Executable file → Normal file
19
arduino/HalMultiSensor/SensorBH1750.cpp
Executable file → Normal file
19
arduino/HalMultiSensor/SensorBH1750.cpp
Executable file → Normal file
|
|
@ -51,7 +51,7 @@ based on Christopher Laws, March, 2013 code.
|
|||
|
||||
void SensorBH1750::setup() {
|
||||
Wire.begin();
|
||||
configure(BH1750_ONE_TIME_HIGH_RES_MODE);
|
||||
//configure(BH1750_ONE_TIME_HIGH_RES_MODE);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,15 +78,16 @@ void SensorBH1750::configure(uint8_t mode) {
|
|||
|
||||
|
||||
void SensorBH1750::read(LightData& data) {
|
||||
uint16_t level;
|
||||
configure(BH1750_ONE_TIME_HIGH_RES_MODE);
|
||||
_delay_ms(200); // Wait for measurement
|
||||
|
||||
Wire.beginTransmission(BH1750_I2CADDR);
|
||||
Wire.requestFrom(BH1750_I2CADDR, 2);
|
||||
level = Wire.read();
|
||||
level <<= 8;
|
||||
level |= Wire.read();
|
||||
Wire.endTransmission();
|
||||
Wire.beginTransmission(BH1750_I2CADDR);
|
||||
Wire.requestFrom(BH1750_I2CADDR, 2);
|
||||
uint16_t level = Wire.read();
|
||||
level <<= 8;
|
||||
level |= Wire.read();
|
||||
Wire.endTransmission();
|
||||
|
||||
data.lumen = level/1.2; // convert to lux
|
||||
data.lumen = level/1.2; // convert to lux
|
||||
}
|
||||
|
||||
|
|
|
|||
0
arduino/HalMultiSensor/SensorBH1750.h
Executable file → Normal file
0
arduino/HalMultiSensor/SensorBH1750.h
Executable file → Normal file
0
arduino/HalMultiSensor/SensorDHT.cpp
Executable file → Normal file
0
arduino/HalMultiSensor/SensorDHT.cpp
Executable file → Normal file
0
arduino/HalMultiSensor/SensorDHT.h
Executable file → Normal file
0
arduino/HalMultiSensor/SensorDHT.h
Executable file → Normal file
0
arduino/HalMultiSensor/SensorPhotocell.cpp
Executable file → Normal file
0
arduino/HalMultiSensor/SensorPhotocell.cpp
Executable file → Normal file
0
arduino/HalMultiSensor/SensorPhotocell.h
Executable file → Normal file
0
arduino/HalMultiSensor/SensorPhotocell.h
Executable file → Normal file
|
|
@ -1,76 +0,0 @@
|
|||
#include "BH1750FVI.h"
|
||||
|
||||
BH1750FVI::BH1750FVI(){ }
|
||||
|
||||
void BH1750FVI::begin(void){
|
||||
Wire.begin();
|
||||
I2CWriteTo(Power_On ); //Turn it On
|
||||
pinMode(AddrPin,OUTPUT);
|
||||
digitalWrite(AddrPin,HIGH);
|
||||
|
||||
}
|
||||
void BH1750FVI::Sleep(void){
|
||||
I2CWriteTo(Power_Down ); //Turn it off , Reset operator won't work in this mode
|
||||
}
|
||||
void BH1750FVI::Reset(void){
|
||||
I2CWriteTo(Power_On ); //Turn it on again
|
||||
I2CWriteTo(reset ); //Reset
|
||||
}
|
||||
|
||||
void BH1750FVI::SetAddress(uint8_t add){
|
||||
switch (add){
|
||||
case Device_Address_L:
|
||||
address_value=Device_Address_L;
|
||||
digitalWrite(AddrPin,LOW);
|
||||
state=false;
|
||||
break;
|
||||
case Device_Address_H:
|
||||
address_value=Device_Address_H;
|
||||
digitalWrite(AddrPin,HIGH);
|
||||
state=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BH1750FVI::SetMode(uint8_t MODE){
|
||||
switch(MODE){
|
||||
case Continuous_H_resolution_Mode:
|
||||
break;
|
||||
case Continuous_H_resolution_Mode2:
|
||||
break;
|
||||
case Continuous_L_resolution_Mode:
|
||||
break;
|
||||
case OneTime_H_resolution_Mode:
|
||||
break;
|
||||
case OneTime_H_resolution_Mode2:
|
||||
break;
|
||||
case OneTime_L_resolution_Mode:
|
||||
break;
|
||||
}
|
||||
delay(10);
|
||||
I2CWriteTo(MODE);
|
||||
}
|
||||
|
||||
uint16_t BH1750FVI::GetLightIntensity(void){
|
||||
uint16_t Intensity_value;
|
||||
if(state ==true){
|
||||
Wire.beginTransmission(Device_Address_H);
|
||||
Wire.requestFrom(Device_Address_H, 2);
|
||||
}
|
||||
if(state ==false){
|
||||
Wire.beginTransmission(Device_Address_L);
|
||||
Wire.requestFrom(Device_Address_L, 2);
|
||||
}
|
||||
Intensity_value = Wire.read();
|
||||
Intensity_value <<= 8;
|
||||
Intensity_value |= Wire.read();
|
||||
Wire.endTransmission();
|
||||
Intensity_value=Intensity_value/1.2;
|
||||
return Intensity_value;
|
||||
}
|
||||
|
||||
void BH1750FVI::I2CWriteTo(uint8_t DataToSend){
|
||||
Wire.beginTransmission(address_value);
|
||||
Wire.write(DataToSend);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
|
||||
|
||||
/* This library for Digital Light sensor BH1750FVI
|
||||
|
||||
use I2C Communication protocal , SDA,SCL Are required
|
||||
|
||||
to interface with this sensor
|
||||
|
||||
pin configuration :
|
||||
|
||||
VCC >>> 3.3V
|
||||
SDA >>> A4
|
||||
SCL >>> A5
|
||||
ADDR >> A3 "Optional"
|
||||
GND >>> gnd
|
||||
|
||||
written By : Mohannad Rawashdeh
|
||||
www.genotronex.com
|
||||
*/
|
||||
|
||||
#ifndef BH1750FVI_h
|
||||
#define BH1750FVI_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define Device_Address_L 0x23 // Device address when address pin LOW
|
||||
#define Device_Address_H 0x5C // Device address when address pin LOW
|
||||
//all command here taken from Data sheet OPECODE Table page 5
|
||||
#define Power_Down 0x00
|
||||
|
||||
#define Power_On 0x01
|
||||
|
||||
#define reset 0x07
|
||||
|
||||
#define Continuous_H_resolution_Mode 0x10
|
||||
|
||||
#define Continuous_H_resolution_Mode2 0x11
|
||||
|
||||
#define Continuous_L_resolution_Mode 0x13
|
||||
|
||||
#define OneTime_H_resolution_Mode 0x20
|
||||
|
||||
#define OneTime_H_resolution_Mode2 0x21
|
||||
|
||||
#define OneTime_L_resolution_Mode 0x23//As well as address value
|
||||
|
||||
#define AddrPin 17 // Address pin enable
|
||||
|
||||
|
||||
class BH1750FVI {
|
||||
public:
|
||||
BH1750FVI();
|
||||
void begin(void);
|
||||
void Sleep(void);
|
||||
void SetMode(uint8_t MODE);
|
||||
void Reset(void);
|
||||
void SetAddress(uint8_t add);
|
||||
uint16_t GetLightIntensity(void);
|
||||
|
||||
private:
|
||||
void I2CWriteTo(uint8_t DataToSend);
|
||||
byte address_value;
|
||||
boolean state;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,289 +0,0 @@
|
|||
/*
|
||||
* Protocol: Oregon V2.1
|
||||
* Emulating sensor: THGR2228N
|
||||
*/
|
||||
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
#define TEMP_SENSOR_PIN 9
|
||||
OneWire oneWire(TEMP_SENSOR_PIN);
|
||||
DallasTemperature tempSensors(&oneWire);
|
||||
|
||||
const byte TX_PIN = 10;
|
||||
const byte LED_PIN = 13;
|
||||
const unsigned long TIME = 512;
|
||||
const unsigned long TWOTIME = TIME*2;
|
||||
#define SEND_HIGH() digitalWrite(TX_PIN, HIGH)
|
||||
#define SEND_LOW() digitalWrite(TX_PIN, LOW)
|
||||
byte OregonMessageBuffer[9];
|
||||
unsigned long previousTime = 0;
|
||||
unsigned long currentTime = millis();
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
|
||||
pinMode(TX_PIN, OUTPUT);
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
SEND_LOW();
|
||||
byte ID[] = { 0x1A,0x2D }; //temperature/humidity sensor (THGR2228N)
|
||||
setType(OregonMessageBuffer, ID);
|
||||
setChannel(OregonMessageBuffer, 0x20);
|
||||
|
||||
tempSensors.begin();
|
||||
}
|
||||
|
||||
|
||||
boolean light = false;
|
||||
void loop()
|
||||
{
|
||||
currentTime = millis();
|
||||
if(currentTime - previousTime > 5000) {
|
||||
previousTime = currentTime;
|
||||
|
||||
tempSensors.requestTemperatures();
|
||||
float temp = tempSensors.getTempCByIndex(0);
|
||||
Serial.print("temp = ");
|
||||
Serial.println(temp);
|
||||
|
||||
send433(temp,0,0xBB);
|
||||
delay(500);
|
||||
}
|
||||
}
|
||||
|
||||
void send433(float temperature, byte humidity, byte Identitet)
|
||||
{
|
||||
digitalWrite(LED_PIN, HIGH);
|
||||
setId(OregonMessageBuffer, Identitet); //set id of the sensor, BB=187
|
||||
setBatteryLevel(OregonMessageBuffer, 1); // 0 : low, 1 : high
|
||||
setTemperature(OregonMessageBuffer, temperature); //org setTemperature(OregonMessageBuffer, 55.5);
|
||||
setHumidity(OregonMessageBuffer, humidity);
|
||||
calculateAndSetChecksum(OregonMessageBuffer);
|
||||
|
||||
// Show the Oregon Message
|
||||
for (byte i = 0; i < sizeof(OregonMessageBuffer); ++i) {
|
||||
Serial.print(OregonMessageBuffer[i] >> 4, HEX);
|
||||
Serial.print(OregonMessageBuffer[i] & 0x0F, HEX);
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
// Send the Message over RF
|
||||
sendOregon(OregonMessageBuffer, sizeof(OregonMessageBuffer));
|
||||
// Send a "pause"
|
||||
SEND_LOW();
|
||||
delayMicroseconds(TWOTIME*8);
|
||||
// Send a copie of the first message. The v2.1 protocol send the message two time
|
||||
sendOregon(OregonMessageBuffer, sizeof(OregonMessageBuffer));
|
||||
SEND_LOW();
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
}
|
||||
|
||||
inline void setId(byte *data, byte ID)
|
||||
{
|
||||
data[3] = ID;
|
||||
}
|
||||
|
||||
void setBatteryLevel(byte *data, byte level)
|
||||
{
|
||||
if(!level) data[4] = 0x0C;
|
||||
else data[4] = 0x00;
|
||||
}
|
||||
|
||||
void setTemperature(byte *data, float temp)
|
||||
{
|
||||
// Set temperature sign
|
||||
if(temp < 0)
|
||||
{
|
||||
data[6] = 0x08;
|
||||
temp *= -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
data[6] = 0x00;
|
||||
}
|
||||
|
||||
// Determine decimal and float part
|
||||
int tempInt = (int)temp;
|
||||
int td = (int)(tempInt / 10);
|
||||
int tf = (int)round((float)((float)tempInt/10 - (float)td) * 10);
|
||||
|
||||
int tempFloat = (int)round((float)(temp - (float)tempInt) * 10);
|
||||
|
||||
// Set temperature decimal part
|
||||
data[5] = (td << 4);
|
||||
data[5] |= tf;
|
||||
|
||||
// Set temperature float part
|
||||
data[4] |= (tempFloat << 4);
|
||||
}
|
||||
|
||||
void setHumidity(byte* data, byte hum)
|
||||
{
|
||||
data[7] = (hum/10);
|
||||
data[6] |= (hum - data[7]*10) << 4;
|
||||
}
|
||||
|
||||
void calculateAndSetChecksum(byte* data)
|
||||
{
|
||||
int sum = 0;
|
||||
for(byte i = 0; i<8;i++)
|
||||
{
|
||||
sum += (data[i]&0xF0) >> 4;
|
||||
sum += (data[i]&0xF);
|
||||
}
|
||||
data[8] = ((sum - 0xa) & 0xFF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//*********************************************************************************************************
|
||||
|
||||
|
||||
/**
|
||||
* \brief Send logical "0" over RF
|
||||
* \details azero bit be represented by an off-to-on transition
|
||||
* \ of the RF signal at the middle of a clock period.
|
||||
* \ Remenber, the Oregon v2.1 protocol add an inverted bit first
|
||||
*/
|
||||
inline void sendZero(void)
|
||||
{
|
||||
SEND_HIGH();
|
||||
delayMicroseconds(TIME);
|
||||
SEND_LOW();
|
||||
delayMicroseconds(TWOTIME);
|
||||
SEND_HIGH();
|
||||
delayMicroseconds(TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send logical "1" over RF
|
||||
* \details a one bit be represented by an on-to-off transition
|
||||
* \ of the RF signal at the middle of a clock period.
|
||||
* \ Remenber, the Oregon v2.1 protocol add an inverted bit first
|
||||
*/
|
||||
inline void sendOne(void)
|
||||
{
|
||||
SEND_LOW();
|
||||
delayMicroseconds(TIME);
|
||||
SEND_HIGH();
|
||||
delayMicroseconds(TWOTIME);
|
||||
SEND_LOW();
|
||||
delayMicroseconds(TIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send a bits quarter (4 bits = MSB from 8 bits value) over RF
|
||||
* \param data Data to send
|
||||
*/
|
||||
inline void sendQuarterMSB(const byte data)
|
||||
{
|
||||
(bitRead(data, 4)) ? sendOne() : sendZero();
|
||||
(bitRead(data, 5)) ? sendOne() : sendZero();
|
||||
(bitRead(data, 6)) ? sendOne() : sendZero();
|
||||
(bitRead(data, 7)) ? sendOne() : sendZero();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send a bits quarter (4 bits = LSB from 8 bits value) over RF
|
||||
* \param data Data to send
|
||||
*/
|
||||
inline void sendQuarterLSB(const byte data)
|
||||
{
|
||||
(bitRead(data, 0)) ? sendOne() : sendZero();
|
||||
(bitRead(data, 1)) ? sendOne() : sendZero();
|
||||
(bitRead(data, 2)) ? sendOne() : sendZero();
|
||||
(bitRead(data, 3)) ? sendOne() : sendZero();
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
|
||||
/**
|
||||
* \brief Send a buffer over RF
|
||||
* \param data Data to send
|
||||
* \param size size of data to send
|
||||
*/
|
||||
void sendData(byte *data, byte size)
|
||||
{
|
||||
for(byte i = 0; i < size; ++i)
|
||||
{
|
||||
sendQuarterLSB(data[i]);
|
||||
sendQuarterMSB(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send an Oregon message
|
||||
* \param data The Oregon message
|
||||
*/
|
||||
void sendOregon(byte *data, byte size)
|
||||
{
|
||||
sendPreamble();
|
||||
//sendSync();
|
||||
sendData(data, size);
|
||||
sendPostamble();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send preamble
|
||||
* \details The preamble consists of 16 "1" bits
|
||||
*/
|
||||
inline void sendPreamble(void)
|
||||
{
|
||||
byte PREAMBLE[]={
|
||||
0xFF,0xFF };
|
||||
sendData(PREAMBLE, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send postamble
|
||||
* \details The postamble consists of 8 "0" bits
|
||||
*/
|
||||
inline void sendPostamble(void)
|
||||
{
|
||||
byte POSTAMBLE[]={
|
||||
0x00 };
|
||||
sendData(POSTAMBLE, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send sync nibble
|
||||
* \details The sync is 0xA. It is not use in this version since the sync nibble
|
||||
* \ is include in the Oregon message to send.
|
||||
*/
|
||||
inline void sendSync(void)
|
||||
{
|
||||
sendQuarterLSB(0xA);
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
/******************************************************************/
|
||||
|
||||
/**
|
||||
* \brief Set the sensor type
|
||||
* \param data Oregon message
|
||||
* \param type Sensor type
|
||||
*/
|
||||
inline void setType(byte *data, byte* type)
|
||||
{
|
||||
data[0] = type[0];
|
||||
data[1] = type[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the sensor channel
|
||||
* \param data Oregon message
|
||||
* \param channel Sensor channel (0x10, 0x20, 0x30)
|
||||
*/
|
||||
inline void setChannel(byte *data, byte channel)
|
||||
{
|
||||
data[2] = channel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
#include "BH1750FVI.h"
|
||||
#include "Arduino.h"
|
||||
|
||||
BH1750FVI::BH1750FVI(){
|
||||
|
||||
}
|
||||
|
||||
void BH1750FVI::begin(void){
|
||||
Wire.begin();
|
||||
I2CWriteTo(Power_On ); //Turn it On
|
||||
pinMode(AddrPin,OUTPUT);
|
||||
digitalWrite(AddrPin,HIGH);
|
||||
|
||||
}
|
||||
void BH1750FVI::Sleep(void){
|
||||
I2CWriteTo(Power_Down ); //Turn it off , Reset operator won't work in this mode
|
||||
}
|
||||
void BH1750FVI::Reset(void){
|
||||
I2CWriteTo(Power_On ); //Turn it on again
|
||||
I2CWriteTo(reset ); //Reset
|
||||
|
||||
}
|
||||
void BH1750FVI::SetAddress(uint8_t add){
|
||||
switch (add){
|
||||
case Device_Address_L:
|
||||
address_value=Device_Address_L;
|
||||
digitalWrite(AddrPin,LOW);
|
||||
state=false;
|
||||
break;
|
||||
case Device_Address_H:
|
||||
address_value=Device_Address_H;
|
||||
digitalWrite(AddrPin,HIGH);
|
||||
state=true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
void BH1750FVI::SetMode(uint8_t MODE){
|
||||
switch(MODE){
|
||||
case Continuous_H_resolution_Mode:
|
||||
break;
|
||||
case Continuous_H_resolution_Mode2:
|
||||
break;
|
||||
case Continuous_L_resolution_Mode:
|
||||
break;
|
||||
case OneTime_H_resolution_Mode:
|
||||
break;
|
||||
case OneTime_H_resolution_Mode2:
|
||||
break;
|
||||
case OneTime_L_resolution_Mode:
|
||||
break;
|
||||
}
|
||||
delay(10);
|
||||
I2CWriteTo(MODE);
|
||||
}
|
||||
|
||||
uint16_t BH1750FVI::GetLightIntensity(void){
|
||||
uint16_t Intensity_value;
|
||||
if(state ==true){
|
||||
Wire.beginTransmission(Device_Address_H);
|
||||
Wire.requestFrom(Device_Address_H, 2);
|
||||
}
|
||||
if(state ==false){
|
||||
Wire.beginTransmission(Device_Address_L);
|
||||
Wire.requestFrom(Device_Address_L, 2);
|
||||
}
|
||||
Intensity_value = Wire.read();
|
||||
Intensity_value <<= 8;
|
||||
Intensity_value |= Wire.read();
|
||||
Wire.endTransmission();
|
||||
Intensity_value=Intensity_value/1.2;
|
||||
return Intensity_value;
|
||||
|
||||
}
|
||||
|
||||
void BH1750FVI::I2CWriteTo(uint8_t DataToSend){
|
||||
Wire.beginTransmission(address_value);
|
||||
Wire.write(DataToSend);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
|
||||
/* This library for Digital Light sensor BH1750FVI
|
||||
|
||||
use I2C Communication protocal , SDA,SCL Are required
|
||||
|
||||
to interface with this sensor
|
||||
|
||||
pin configuration :
|
||||
|
||||
VCC >>> 3.3V
|
||||
SDA >>> A4
|
||||
SCL >>> A5
|
||||
ADDR >> A3 "Optional"
|
||||
GND >>> gnd
|
||||
|
||||
written By : Mohannad Rawashdeh
|
||||
www.genotronex.com
|
||||
*/
|
||||
|
||||
#ifndef BH1750FVI_h
|
||||
#define BH1750FVI_h
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#include "Wire.h"
|
||||
|
||||
#define Device_Address_L 0x23 // Device address when address pin LOW
|
||||
#define Device_Address_H 0x5C // Device address when address pin LOW
|
||||
//all command here taken from Data sheet OPECODE Table page 5
|
||||
#define Power_Down 0x00
|
||||
|
||||
#define Power_On 0x01
|
||||
|
||||
#define reset 0x07
|
||||
|
||||
#define Continuous_H_resolution_Mode 0x10
|
||||
|
||||
#define Continuous_H_resolution_Mode2 0x11
|
||||
|
||||
#define Continuous_L_resolution_Mode 0x13
|
||||
|
||||
#define OneTime_H_resolution_Mode 0x20
|
||||
|
||||
#define OneTime_H_resolution_Mode2 0x21
|
||||
|
||||
#define OneTime_L_resolution_Mode 0x23//As well as address value
|
||||
|
||||
#define AddrPin 17 // Address pin enable
|
||||
class BH1750FVI {
|
||||
public:
|
||||
BH1750FVI();
|
||||
void begin(void);
|
||||
void Sleep(void);
|
||||
void SetMode(uint8_t MODE);
|
||||
void Reset(void);
|
||||
void SetAddress(uint8_t add);
|
||||
uint16_t GetLightIntensity(void);
|
||||
|
||||
private:
|
||||
void I2CWriteTo(uint8_t DataToSend);
|
||||
byte address_value;
|
||||
boolean state;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
This is a simple code to test BH1750FVI Light senosr
|
||||
communicate using I2C Protocol
|
||||
this library enable 2 slave device address
|
||||
Main address 0x23
|
||||
secondary address 0x5C
|
||||
connect this sensor as following :
|
||||
VCC >>> 3.3V
|
||||
SDA >>> A4
|
||||
SCL >>> A5
|
||||
addr >> A3
|
||||
Gnd >>>Gnd
|
||||
|
||||
Written By : Mohannad Rawashdeh
|
||||
|
||||
*/
|
||||
|
||||
// First define the library :
|
||||
#include <BH1750FVI.h> // Sensor Library
|
||||
#include <Wire.h> // I2C Library
|
||||
#include <LiquidCrystal.h>
|
||||
|
||||
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
|
||||
uint16_t Light_Intensity=0;
|
||||
// Call the function
|
||||
|
||||
BH1750FVI LightSensor;
|
||||
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
lcd.begin(16, 2);
|
||||
|
||||
// call begin Function so turn the sensor On .
|
||||
LightSensor.begin();
|
||||
LightSensor.SetAddress(Device_Address_H); //Address 0x5C
|
||||
LightSensor.SetMode(Continuous_H_resolution_Mode);
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("BH1750 Sensor");
|
||||
lcd.setCursor(1, 1);
|
||||
lcd.print("Please wait...");
|
||||
delay(3000);
|
||||
lcd.clear();
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(" Intensity = ");
|
||||
lcd.setCursor(5, 1);
|
||||
Light_Intensity = LightSensor.GetLightIntensity();
|
||||
lcd.print(Light_Intensity);
|
||||
lcd.print(" Lux");
|
||||
delay(2000);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
This is a simple code to test BH1750FVI Light senosr
|
||||
communicate using I2C Protocol
|
||||
this library enable 2 slave device address
|
||||
Main address 0x23
|
||||
secondary address 0x5C
|
||||
connect this sensor as following :
|
||||
VCC >>> 3.3V
|
||||
SDA >>> A4
|
||||
SCL >>> A5
|
||||
addr >> A3
|
||||
Gnd >>>Gnd
|
||||
|
||||
Written By : Mohannad Rawashdeh
|
||||
|
||||
*/
|
||||
|
||||
// First define the library :
|
||||
#include <BH1750FVI.h> // Sensor Library
|
||||
#include <Wire.h> // I2C Library
|
||||
|
||||
uint16_t Light_Intensity=0;
|
||||
// Call the function
|
||||
#define LedPin 9 // led connecting to pin D9
|
||||
BH1750FVI LightSensor;
|
||||
|
||||
int SensorValue =0;
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
// call begin Function so turn the sensor On .
|
||||
LightSensor.begin();
|
||||
/*
|
||||
Set the address for this sensor
|
||||
you can use 2 different address
|
||||
Device_Address_H "0x5C"
|
||||
Device_Address_L "0x23"
|
||||
you must connect Addr pin to A3 .
|
||||
*/
|
||||
LightSensor.SetAddress(Device_Address_H); //Address 0x5C
|
||||
// To adjust the slave on other address , uncomment this line
|
||||
// lightMeter.SetAddress(Device_Address_L); //Address 0x5C
|
||||
//-----------------------------------------------
|
||||
/*
|
||||
set the Working Mode for this sensor
|
||||
Select the following Mode:
|
||||
Continuous_H_resolution_Mode
|
||||
Continuous_H_resolution_Mode2
|
||||
Continuous_L_resolution_Mode
|
||||
OneTime_H_resolution_Mode
|
||||
OneTime_H_resolution_Mode2
|
||||
OneTime_L_resolution_Mode
|
||||
|
||||
The data sheet recommanded To use Continuous_H_resolution_Mode
|
||||
*/
|
||||
LightSensor.SetMode(Continuous_H_resolution_Mode);
|
||||
pinMode(9,OUTPUT) // Connect LED With 100ohm resistor
|
||||
// to pin D9
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
// call GetLightIntensity() Function , so the sensor read
|
||||
//the Intensity Value and send it
|
||||
Light_Intensity=LightSensor.GetLightIntensity();
|
||||
delay(50);
|
||||
|
||||
SensorValue=map(Light_Intensity,0,2000,255,0);
|
||||
SensorValue=constrain(SensorValue,255,0);
|
||||
digitalWrite(LedPin,SensorValue);
|
||||
// ready to another reading .
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
|
||||
/*
|
||||
This is a simple code to test BH1750FVI Light senosr
|
||||
communicate using I2C Protocol
|
||||
this library enable 2 slave device address
|
||||
Main address 0x23
|
||||
secondary address 0x5C
|
||||
connect this sensor as following :
|
||||
VCC >>> 3.3V
|
||||
SDA >>> A4
|
||||
SCL >>> A5
|
||||
addr >> A3
|
||||
Gnd >>>Gnd
|
||||
|
||||
Written By : Mohannad Rawashdeh
|
||||
|
||||
*/
|
||||
|
||||
// First define the library :
|
||||
|
||||
#include <Wire.h>
|
||||
#include <BH1750FVI.h>
|
||||
|
||||
|
||||
BH1750FVI LightSensor;
|
||||
|
||||
|
||||
void setup() { // put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
LightSensor.begin();
|
||||
/*
|
||||
Set the address for this sensor
|
||||
you can use 2 different address
|
||||
Device_Address_H "0x5C"
|
||||
Device_Address_L "0x23"
|
||||
you must connect Addr pin to A3 .
|
||||
*/
|
||||
LightSensor.SetAddress(Device_Address_H);//Address 0x5C
|
||||
// To adjust the slave on other address , uncomment this line
|
||||
// lightMeter.SetAddress(Device_Address_L); //Address 0x5C
|
||||
//-----------------------------------------------
|
||||
/*
|
||||
set the Working Mode for this sensor
|
||||
Select the following Mode:
|
||||
Continuous_H_resolution_Mode
|
||||
Continuous_H_resolution_Mode2
|
||||
Continuous_L_resolution_Mode
|
||||
OneTime_H_resolution_Mode
|
||||
OneTime_H_resolution_Mode2
|
||||
OneTime_L_resolution_Mode
|
||||
|
||||
The data sheet recommanded To use Continuous_H_resolution_Mode
|
||||
*/
|
||||
|
||||
LightSensor.SetMode(Continuous_H_resolution_Mode);
|
||||
|
||||
Serial.println("Running...");
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
uint16_t lux = LightSensor.GetLightIntensity();// Get Lux value
|
||||
Serial.print("Light: ");
|
||||
Serial.print(lux);
|
||||
Serial.println(" lux");
|
||||
delay(1000);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#######################################
|
||||
# Syntax Coloring Map For BH1750FVI
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
# Datatypes (KEYWORD1)
|
||||
#######################################
|
||||
|
||||
KEYWORD1
|
||||
BH1750FVI KEYWORD1
|
||||
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
|
||||
KEYWORD2
|
||||
begin KEYWORD2
|
||||
Sleep KEYWORD2SetMode KEYWORD2Reset KEYWORD2GetLightIntensity KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
||||
|
||||
|
|
@ -1,738 +0,0 @@
|
|||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
// Version 3.7.2 modified on Dec 6, 2011 to support Arduino 1.0
|
||||
// See Includes...
|
||||
// Modified by Jordan Hochenbaum
|
||||
|
||||
#include "DallasTemperature.h"
|
||||
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
extern "C" {
|
||||
#include "WConstants.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
DallasTemperature::DallasTemperature(OneWire* _oneWire)
|
||||
#if REQUIRESALARMS
|
||||
: _AlarmHandler(&defaultAlarmHandler)
|
||||
#endif
|
||||
{
|
||||
_wire = _oneWire;
|
||||
devices = 0;
|
||||
parasite = false;
|
||||
bitResolution = 9;
|
||||
waitForConversion = true;
|
||||
checkForConversion = true;
|
||||
}
|
||||
|
||||
// initialise the bus
|
||||
void DallasTemperature::begin(void)
|
||||
{
|
||||
DeviceAddress deviceAddress;
|
||||
|
||||
_wire->reset_search();
|
||||
devices = 0; // Reset the number of devices when we enumerate wire devices
|
||||
|
||||
while (_wire->search(deviceAddress))
|
||||
{
|
||||
if (validAddress(deviceAddress))
|
||||
{
|
||||
if (!parasite && readPowerSupply(deviceAddress)) parasite = true;
|
||||
|
||||
ScratchPad scratchPad;
|
||||
|
||||
readScratchPad(deviceAddress, scratchPad);
|
||||
|
||||
bitResolution = max(bitResolution, getResolution(deviceAddress));
|
||||
|
||||
devices++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returns the number of devices found on the bus
|
||||
uint8_t DallasTemperature::getDeviceCount(void)
|
||||
{
|
||||
return devices;
|
||||
}
|
||||
|
||||
// returns true if address is valid
|
||||
bool DallasTemperature::validAddress(uint8_t* deviceAddress)
|
||||
{
|
||||
return (_wire->crc8(deviceAddress, 7) == deviceAddress[7]);
|
||||
}
|
||||
|
||||
// finds an address at a given index on the bus
|
||||
// returns true if the device was found
|
||||
bool DallasTemperature::getAddress(uint8_t* deviceAddress, uint8_t index)
|
||||
{
|
||||
uint8_t depth = 0;
|
||||
|
||||
_wire->reset_search();
|
||||
|
||||
while (depth <= index && _wire->search(deviceAddress))
|
||||
{
|
||||
if (depth == index && validAddress(deviceAddress)) return true;
|
||||
depth++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// attempt to determine if the device at the given address is connected to the bus
|
||||
bool DallasTemperature::isConnected(uint8_t* deviceAddress)
|
||||
{
|
||||
ScratchPad scratchPad;
|
||||
return isConnected(deviceAddress, scratchPad);
|
||||
}
|
||||
|
||||
// attempt to determine if the device at the given address is connected to the bus
|
||||
// also allows for updating the read scratchpad
|
||||
bool DallasTemperature::isConnected(uint8_t* deviceAddress, uint8_t* scratchPad)
|
||||
{
|
||||
readScratchPad(deviceAddress, scratchPad);
|
||||
return (_wire->crc8(scratchPad, 8) == scratchPad[SCRATCHPAD_CRC]);
|
||||
}
|
||||
|
||||
// read device's scratch pad
|
||||
void DallasTemperature::readScratchPad(uint8_t* deviceAddress, uint8_t* scratchPad)
|
||||
{
|
||||
// send the command
|
||||
_wire->reset();
|
||||
_wire->select(deviceAddress);
|
||||
_wire->write(READSCRATCH);
|
||||
|
||||
// TODO => collect all comments & use simple loop
|
||||
// byte 0: temperature LSB
|
||||
// byte 1: temperature MSB
|
||||
// byte 2: high alarm temp
|
||||
// byte 3: low alarm temp
|
||||
// byte 4: DS18S20: store for crc
|
||||
// DS18B20 & DS1822: configuration register
|
||||
// byte 5: internal use & crc
|
||||
// byte 6: DS18S20: COUNT_REMAIN
|
||||
// DS18B20 & DS1822: store for crc
|
||||
// byte 7: DS18S20: COUNT_PER_C
|
||||
// DS18B20 & DS1822: store for crc
|
||||
// byte 8: SCRATCHPAD_CRC
|
||||
//
|
||||
// for(int i=0; i<9; i++)
|
||||
// {
|
||||
// scratchPad[i] = _wire->read();
|
||||
// }
|
||||
|
||||
|
||||
// read the response
|
||||
|
||||
// byte 0: temperature LSB
|
||||
scratchPad[TEMP_LSB] = _wire->read();
|
||||
|
||||
// byte 1: temperature MSB
|
||||
scratchPad[TEMP_MSB] = _wire->read();
|
||||
|
||||
// byte 2: high alarm temp
|
||||
scratchPad[HIGH_ALARM_TEMP] = _wire->read();
|
||||
|
||||
// byte 3: low alarm temp
|
||||
scratchPad[LOW_ALARM_TEMP] = _wire->read();
|
||||
|
||||
// byte 4:
|
||||
// DS18S20: store for crc
|
||||
// DS18B20 & DS1822: configuration register
|
||||
scratchPad[CONFIGURATION] = _wire->read();
|
||||
|
||||
// byte 5:
|
||||
// internal use & crc
|
||||
scratchPad[INTERNAL_BYTE] = _wire->read();
|
||||
|
||||
// byte 6:
|
||||
// DS18S20: COUNT_REMAIN
|
||||
// DS18B20 & DS1822: store for crc
|
||||
scratchPad[COUNT_REMAIN] = _wire->read();
|
||||
|
||||
// byte 7:
|
||||
// DS18S20: COUNT_PER_C
|
||||
// DS18B20 & DS1822: store for crc
|
||||
scratchPad[COUNT_PER_C] = _wire->read();
|
||||
|
||||
// byte 8:
|
||||
// SCTRACHPAD_CRC
|
||||
scratchPad[SCRATCHPAD_CRC] = _wire->read();
|
||||
|
||||
_wire->reset();
|
||||
}
|
||||
|
||||
// writes device's scratch pad
|
||||
void DallasTemperature::writeScratchPad(uint8_t* deviceAddress, const uint8_t* scratchPad)
|
||||
{
|
||||
_wire->reset();
|
||||
_wire->select(deviceAddress);
|
||||
_wire->write(WRITESCRATCH);
|
||||
_wire->write(scratchPad[HIGH_ALARM_TEMP]); // high alarm temp
|
||||
_wire->write(scratchPad[LOW_ALARM_TEMP]); // low alarm temp
|
||||
// DS18S20 does not use the configuration register
|
||||
if (deviceAddress[0] != DS18S20MODEL) _wire->write(scratchPad[CONFIGURATION]); // configuration
|
||||
_wire->reset();
|
||||
// save the newly written values to eeprom
|
||||
_wire->write(COPYSCRATCH, parasite);
|
||||
if (parasite) delay(10); // 10ms delay
|
||||
_wire->reset();
|
||||
}
|
||||
|
||||
// reads the device's power requirements
|
||||
bool DallasTemperature::readPowerSupply(uint8_t* deviceAddress)
|
||||
{
|
||||
bool ret = false;
|
||||
_wire->reset();
|
||||
_wire->select(deviceAddress);
|
||||
_wire->write(READPOWERSUPPLY);
|
||||
if (_wire->read_bit() == 0) ret = true;
|
||||
_wire->reset();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// set resolution of all devices to 9, 10, 11, or 12 bits
|
||||
// if new resolution is out of range, it is constrained.
|
||||
void DallasTemperature::setResolution(uint8_t newResolution)
|
||||
{
|
||||
bitResolution = constrain(newResolution, 9, 12);
|
||||
DeviceAddress deviceAddress;
|
||||
for (int i=0; i<devices; i++)
|
||||
{
|
||||
getAddress(deviceAddress, i);
|
||||
setResolution(deviceAddress, bitResolution);
|
||||
}
|
||||
}
|
||||
|
||||
// set resolution of a device to 9, 10, 11, or 12 bits
|
||||
// if new resolution is out of range, 9 bits is used.
|
||||
bool DallasTemperature::setResolution(uint8_t* deviceAddress, uint8_t newResolution)
|
||||
{
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad))
|
||||
{
|
||||
// DS18S20 has a fixed 9-bit resolution
|
||||
if (deviceAddress[0] != DS18S20MODEL)
|
||||
{
|
||||
switch (newResolution)
|
||||
{
|
||||
case 12:
|
||||
scratchPad[CONFIGURATION] = TEMP_12_BIT;
|
||||
break;
|
||||
case 11:
|
||||
scratchPad[CONFIGURATION] = TEMP_11_BIT;
|
||||
break;
|
||||
case 10:
|
||||
scratchPad[CONFIGURATION] = TEMP_10_BIT;
|
||||
break;
|
||||
case 9:
|
||||
default:
|
||||
scratchPad[CONFIGURATION] = TEMP_9_BIT;
|
||||
break;
|
||||
}
|
||||
writeScratchPad(deviceAddress, scratchPad);
|
||||
}
|
||||
return true; // new value set
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns the global resolution
|
||||
uint8_t DallasTemperature::getResolution()
|
||||
{
|
||||
return bitResolution;
|
||||
}
|
||||
|
||||
// returns the current resolution of the device, 9-12
|
||||
// returns 0 if device not found
|
||||
uint8_t DallasTemperature::getResolution(uint8_t* deviceAddress)
|
||||
{
|
||||
if (deviceAddress[0] == DS18S20MODEL) return 9; // this model has a fixed resolution
|
||||
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad))
|
||||
{
|
||||
switch (scratchPad[CONFIGURATION])
|
||||
{
|
||||
case TEMP_12_BIT:
|
||||
return 12;
|
||||
|
||||
case TEMP_11_BIT:
|
||||
return 11;
|
||||
|
||||
case TEMP_10_BIT:
|
||||
return 10;
|
||||
|
||||
case TEMP_9_BIT:
|
||||
return 9;
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// sets the value of the waitForConversion flag
|
||||
// TRUE : function requestTemperature() etc returns when conversion is ready
|
||||
// FALSE: function requestTemperature() etc returns immediately (USE WITH CARE!!)
|
||||
// (1) programmer has to check if the needed delay has passed
|
||||
// (2) but the application can do meaningful things in that time
|
||||
void DallasTemperature::setWaitForConversion(bool flag)
|
||||
{
|
||||
waitForConversion = flag;
|
||||
}
|
||||
|
||||
// gets the value of the waitForConversion flag
|
||||
bool DallasTemperature::getWaitForConversion()
|
||||
{
|
||||
return waitForConversion;
|
||||
}
|
||||
|
||||
|
||||
// sets the value of the checkForConversion flag
|
||||
// TRUE : function requestTemperature() etc will 'listen' to an IC to determine whether a conversion is complete
|
||||
// FALSE: function requestTemperature() etc will wait a set time (worst case scenario) for a conversion to complete
|
||||
void DallasTemperature::setCheckForConversion(bool flag)
|
||||
{
|
||||
checkForConversion = flag;
|
||||
}
|
||||
|
||||
// gets the value of the waitForConversion flag
|
||||
bool DallasTemperature::getCheckForConversion()
|
||||
{
|
||||
return checkForConversion;
|
||||
}
|
||||
|
||||
bool DallasTemperature::isConversionAvailable(uint8_t* deviceAddress)
|
||||
{
|
||||
// Check if the clock has been raised indicating the conversion is complete
|
||||
ScratchPad scratchPad;
|
||||
readScratchPad(deviceAddress, scratchPad);
|
||||
return scratchPad[0];
|
||||
}
|
||||
|
||||
|
||||
// sends command for all devices on the bus to perform a temperature conversion
|
||||
void DallasTemperature::requestTemperatures()
|
||||
{
|
||||
_wire->reset();
|
||||
_wire->skip();
|
||||
_wire->write(STARTCONVO, parasite);
|
||||
|
||||
// ASYNC mode?
|
||||
if (!waitForConversion) return;
|
||||
blockTillConversionComplete(&bitResolution, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// sends command for one device to perform a temperature by address
|
||||
// returns FALSE if device is disconnected
|
||||
// returns TRUE otherwise
|
||||
bool DallasTemperature::requestTemperaturesByAddress(uint8_t* deviceAddress)
|
||||
{
|
||||
|
||||
_wire->reset();
|
||||
_wire->select(deviceAddress);
|
||||
_wire->write(STARTCONVO, parasite);
|
||||
|
||||
// check device
|
||||
ScratchPad scratchPad;
|
||||
if (!isConnected(deviceAddress, scratchPad)) return false;
|
||||
|
||||
|
||||
// ASYNC mode?
|
||||
if (!waitForConversion) return true;
|
||||
uint8_t bitResolution = getResolution(deviceAddress);
|
||||
blockTillConversionComplete(&bitResolution, deviceAddress);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DallasTemperature::blockTillConversionComplete(uint8_t* bitResolution, uint8_t* deviceAddress)
|
||||
{
|
||||
if(deviceAddress != 0 && checkForConversion && !parasite)
|
||||
{
|
||||
// Continue to check if the IC has responded with a temperature
|
||||
// NB: Could cause issues with multiple devices (one device may respond faster)
|
||||
unsigned long start = millis();
|
||||
while(!isConversionAvailable(0) && ((millis() - start) < 750));
|
||||
}
|
||||
|
||||
// Wait a fix number of cycles till conversion is complete (based on IC datasheet)
|
||||
switch (*bitResolution)
|
||||
{
|
||||
case 9:
|
||||
delay(94);
|
||||
break;
|
||||
case 10:
|
||||
delay(188);
|
||||
break;
|
||||
case 11:
|
||||
delay(375);
|
||||
break;
|
||||
case 12:
|
||||
default:
|
||||
delay(750);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// sends command for one device to perform a temp conversion by index
|
||||
bool DallasTemperature::requestTemperaturesByIndex(uint8_t deviceIndex)
|
||||
{
|
||||
DeviceAddress deviceAddress;
|
||||
getAddress(deviceAddress, deviceIndex);
|
||||
return requestTemperaturesByAddress(deviceAddress);
|
||||
}
|
||||
|
||||
// Fetch temperature for device index
|
||||
float DallasTemperature::getTempCByIndex(uint8_t deviceIndex)
|
||||
{
|
||||
DeviceAddress deviceAddress;
|
||||
getAddress(deviceAddress, deviceIndex);
|
||||
return getTempC((uint8_t*)deviceAddress);
|
||||
}
|
||||
|
||||
// Fetch temperature for device index
|
||||
float DallasTemperature::getTempFByIndex(uint8_t deviceIndex)
|
||||
{
|
||||
return toFahrenheit(getTempCByIndex(deviceIndex));
|
||||
}
|
||||
|
||||
// reads scratchpad and returns the temperature in degrees C
|
||||
float DallasTemperature::calculateTemperature(uint8_t* deviceAddress, uint8_t* scratchPad)
|
||||
{
|
||||
int16_t rawTemperature = (((int16_t)scratchPad[TEMP_MSB]) << 8) | scratchPad[TEMP_LSB];
|
||||
|
||||
switch (deviceAddress[0])
|
||||
{
|
||||
case DS18B20MODEL:
|
||||
case DS1822MODEL:
|
||||
switch (scratchPad[CONFIGURATION])
|
||||
{
|
||||
case TEMP_12_BIT:
|
||||
return (float)rawTemperature * 0.0625;
|
||||
break;
|
||||
case TEMP_11_BIT:
|
||||
return (float)(rawTemperature >> 1) * 0.125;
|
||||
break;
|
||||
case TEMP_10_BIT:
|
||||
return (float)(rawTemperature >> 2) * 0.25;
|
||||
break;
|
||||
case TEMP_9_BIT:
|
||||
return (float)(rawTemperature >> 3) * 0.5;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DS18S20MODEL:
|
||||
/*
|
||||
|
||||
Resolutions greater than 9 bits can be calculated using the data from
|
||||
the temperature, COUNT REMAIN and COUNT PER <EFBFBD>C registers in the
|
||||
scratchpad. Note that the COUNT PER <EFBFBD>C register is hard-wired to 16
|
||||
(10h). After reading the scratchpad, the TEMP_READ value is obtained
|
||||
by truncating the 0.5<EFBFBD>C bit (bit 0) from the temperature data. The
|
||||
extended resolution temperature can then be calculated using the
|
||||
following equation:
|
||||
|
||||
COUNT_PER_C - COUNT_REMAIN
|
||||
TEMPERATURE = TEMP_READ - 0.25 + --------------------------
|
||||
COUNT_PER_C
|
||||
*/
|
||||
|
||||
// Good spot. Thanks Nic Johns for your contribution
|
||||
return (float)(rawTemperature >> 1) - 0.25 +((float)(scratchPad[COUNT_PER_C] - scratchPad[COUNT_REMAIN]) / (float)scratchPad[COUNT_PER_C] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// returns temperature in degrees C or DEVICE_DISCONNECTED if the
|
||||
// device's scratch pad cannot be read successfully.
|
||||
// the numeric value of DEVICE_DISCONNECTED is defined in
|
||||
// DallasTemperature.h. It is a large negative number outside the
|
||||
// operating range of the device
|
||||
float DallasTemperature::getTempC(uint8_t* deviceAddress)
|
||||
{
|
||||
// TODO: Multiple devices (up to 64) on the same bus may take
|
||||
// some time to negotiate a response
|
||||
// What happens in case of collision?
|
||||
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad)) return calculateTemperature(deviceAddress, scratchPad);
|
||||
return DEVICE_DISCONNECTED;
|
||||
}
|
||||
|
||||
// returns temperature in degrees F
|
||||
// TODO: - when getTempC returns DEVICE_DISCONNECTED
|
||||
// -127 gets converted to -196.6 F
|
||||
float DallasTemperature::getTempF(uint8_t* deviceAddress)
|
||||
{
|
||||
return toFahrenheit(getTempC(deviceAddress));
|
||||
}
|
||||
|
||||
// returns true if the bus requires parasite power
|
||||
bool DallasTemperature::isParasitePowerMode(void)
|
||||
{
|
||||
return parasite;
|
||||
}
|
||||
|
||||
#if REQUIRESALARMS
|
||||
|
||||
/*
|
||||
|
||||
ALARMS:
|
||||
|
||||
TH and TL Register Format
|
||||
|
||||
BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
|
||||
S 2^6 2^5 2^4 2^3 2^2 2^1 2^0
|
||||
|
||||
Only bits 11 through 4 of the temperature register are used
|
||||
in the TH and TL comparison since TH and TL are 8-bit
|
||||
registers. If the measured temperature is lower than or equal
|
||||
to TL or higher than or equal to TH, an alarm condition exists
|
||||
and an alarm flag is set inside the DS18B20. This flag is
|
||||
updated after every temperature measurement; therefore, if the
|
||||
alarm condition goes away, the flag will be turned off after
|
||||
the next temperature conversion.
|
||||
|
||||
*/
|
||||
|
||||
// sets the high alarm temperature for a device in degrees celsius
|
||||
// accepts a float, but the alarm resolution will ignore anything
|
||||
// after a decimal point. valid range is -55C - 125C
|
||||
void DallasTemperature::setHighAlarmTemp(uint8_t* deviceAddress, char celsius)
|
||||
{
|
||||
// make sure the alarm temperature is within the device's range
|
||||
if (celsius > 125) celsius = 125;
|
||||
else if (celsius < -55) celsius = -55;
|
||||
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad))
|
||||
{
|
||||
scratchPad[HIGH_ALARM_TEMP] = (uint8_t)celsius;
|
||||
writeScratchPad(deviceAddress, scratchPad);
|
||||
}
|
||||
}
|
||||
|
||||
// sets the low alarm temperature for a device in degreed celsius
|
||||
// accepts a float, but the alarm resolution will ignore anything
|
||||
// after a decimal point. valid range is -55C - 125C
|
||||
void DallasTemperature::setLowAlarmTemp(uint8_t* deviceAddress, char celsius)
|
||||
{
|
||||
// make sure the alarm temperature is within the device's range
|
||||
if (celsius > 125) celsius = 125;
|
||||
else if (celsius < -55) celsius = -55;
|
||||
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad))
|
||||
{
|
||||
scratchPad[LOW_ALARM_TEMP] = (uint8_t)celsius;
|
||||
writeScratchPad(deviceAddress, scratchPad);
|
||||
}
|
||||
}
|
||||
|
||||
// returns a char with the current high alarm temperature or
|
||||
// DEVICE_DISCONNECTED for an address
|
||||
char DallasTemperature::getHighAlarmTemp(uint8_t* deviceAddress)
|
||||
{
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad)) return (char)scratchPad[HIGH_ALARM_TEMP];
|
||||
return DEVICE_DISCONNECTED;
|
||||
}
|
||||
|
||||
// returns a char with the current low alarm temperature or
|
||||
// DEVICE_DISCONNECTED for an address
|
||||
char DallasTemperature::getLowAlarmTemp(uint8_t* deviceAddress)
|
||||
{
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad)) return (char)scratchPad[LOW_ALARM_TEMP];
|
||||
return DEVICE_DISCONNECTED;
|
||||
}
|
||||
|
||||
// resets internal variables used for the alarm search
|
||||
void DallasTemperature::resetAlarmSearch()
|
||||
{
|
||||
alarmSearchJunction = -1;
|
||||
alarmSearchExhausted = 0;
|
||||
for(uint8_t i = 0; i < 7; i++)
|
||||
alarmSearchAddress[i] = 0;
|
||||
}
|
||||
|
||||
// This is a modified version of the OneWire::search method.
|
||||
//
|
||||
// Also added the OneWire search fix documented here:
|
||||
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238032295
|
||||
//
|
||||
// Perform an alarm search. If this function returns a '1' then it has
|
||||
// enumerated the next device and you may retrieve the ROM from the
|
||||
// OneWire::address variable. If there are no devices, no further
|
||||
// devices, or something horrible happens in the middle of the
|
||||
// enumeration then a 0 is returned. If a new device is found then
|
||||
// its address is copied to newAddr. Use
|
||||
// DallasTemperature::resetAlarmSearch() to start over.
|
||||
bool DallasTemperature::alarmSearch(uint8_t* newAddr)
|
||||
{
|
||||
uint8_t i;
|
||||
char lastJunction = -1;
|
||||
uint8_t done = 1;
|
||||
|
||||
if (alarmSearchExhausted) return false;
|
||||
if (!_wire->reset()) return false;
|
||||
|
||||
// send the alarm search command
|
||||
_wire->write(0xEC, 0);
|
||||
|
||||
for(i = 0; i < 64; i++)
|
||||
{
|
||||
uint8_t a = _wire->read_bit( );
|
||||
uint8_t nota = _wire->read_bit( );
|
||||
uint8_t ibyte = i / 8;
|
||||
uint8_t ibit = 1 << (i & 7);
|
||||
|
||||
// I don't think this should happen, this means nothing responded, but maybe if
|
||||
// something vanishes during the search it will come up.
|
||||
if (a && nota) return false;
|
||||
|
||||
if (!a && !nota)
|
||||
{
|
||||
if (i == alarmSearchJunction)
|
||||
{
|
||||
// this is our time to decide differently, we went zero last time, go one.
|
||||
a = 1;
|
||||
alarmSearchJunction = lastJunction;
|
||||
}
|
||||
else if (i < alarmSearchJunction)
|
||||
{
|
||||
// take whatever we took last time, look in address
|
||||
if (alarmSearchAddress[ibyte] & ibit) a = 1;
|
||||
else
|
||||
{
|
||||
// Only 0s count as pending junctions, we've already exhasuted the 0 side of 1s
|
||||
a = 0;
|
||||
done = 0;
|
||||
lastJunction = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we are blazing new tree, take the 0
|
||||
a = 0;
|
||||
alarmSearchJunction = i;
|
||||
done = 0;
|
||||
}
|
||||
// OneWire search fix
|
||||
// See: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238032295
|
||||
}
|
||||
|
||||
if (a) alarmSearchAddress[ibyte] |= ibit;
|
||||
else alarmSearchAddress[ibyte] &= ~ibit;
|
||||
|
||||
_wire->write_bit(a);
|
||||
}
|
||||
|
||||
if (done) alarmSearchExhausted = 1;
|
||||
for (i = 0; i < 8; i++) newAddr[i] = alarmSearchAddress[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns true if device address has an alarm condition
|
||||
// TODO: can this be done with only TEMP_MSB REGISTER (faster)
|
||||
// if ((char) scratchPad[TEMP_MSB] <= (char) scratchPad[LOW_ALARM_TEMP]) return true;
|
||||
// if ((char) scratchPad[TEMP_MSB] >= (char) scratchPad[HIGH_ALARM_TEMP]) return true;
|
||||
bool DallasTemperature::hasAlarm(uint8_t* deviceAddress)
|
||||
{
|
||||
ScratchPad scratchPad;
|
||||
if (isConnected(deviceAddress, scratchPad))
|
||||
{
|
||||
float temp = calculateTemperature(deviceAddress, scratchPad);
|
||||
|
||||
// check low alarm
|
||||
if ((char)temp <= (char)scratchPad[LOW_ALARM_TEMP]) return true;
|
||||
|
||||
// check high alarm
|
||||
if ((char)temp >= (char)scratchPad[HIGH_ALARM_TEMP]) return true;
|
||||
}
|
||||
|
||||
// no alarm
|
||||
return false;
|
||||
}
|
||||
|
||||
// returns true if any device is reporting an alarm condition on the bus
|
||||
bool DallasTemperature::hasAlarm(void)
|
||||
{
|
||||
DeviceAddress deviceAddress;
|
||||
resetAlarmSearch();
|
||||
return alarmSearch(deviceAddress);
|
||||
}
|
||||
|
||||
// runs the alarm handler for all devices returned by alarmSearch()
|
||||
void DallasTemperature::processAlarms(void)
|
||||
{
|
||||
resetAlarmSearch();
|
||||
DeviceAddress alarmAddr;
|
||||
|
||||
while (alarmSearch(alarmAddr))
|
||||
{
|
||||
if (validAddress(alarmAddr))
|
||||
_AlarmHandler(alarmAddr);
|
||||
}
|
||||
}
|
||||
|
||||
// sets the alarm handler
|
||||
void DallasTemperature::setAlarmHandler(AlarmHandler *handler)
|
||||
{
|
||||
_AlarmHandler = handler;
|
||||
}
|
||||
|
||||
// The default alarm handler
|
||||
void DallasTemperature::defaultAlarmHandler(uint8_t* deviceAddress)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Convert float celsius to fahrenheit
|
||||
float DallasTemperature::toFahrenheit(float celsius)
|
||||
{
|
||||
return (celsius * 1.8) + 32;
|
||||
}
|
||||
|
||||
// Convert float fahrenheit to celsius
|
||||
float DallasTemperature::toCelsius(float fahrenheit)
|
||||
{
|
||||
return (fahrenheit - 32) / 1.8;
|
||||
}
|
||||
|
||||
#if REQUIRESNEW
|
||||
|
||||
// MnetCS - Allocates memory for DallasTemperature. Allows us to instance a new object
|
||||
void* DallasTemperature::operator new(unsigned int size) // Implicit NSS obj size
|
||||
{
|
||||
void * p; // void pointer
|
||||
p = malloc(size); // Allocate memory
|
||||
memset((DallasTemperature*)p,0,size); // Initalise memory
|
||||
|
||||
//!!! CANT EXPLICITLY CALL CONSTRUCTOR - workaround by using an init() methodR - workaround by using an init() method
|
||||
return (DallasTemperature*) p; // Cast blank region to NSS pointer
|
||||
}
|
||||
|
||||
// MnetCS 2009 - Unallocates the memory used by this instance
|
||||
void DallasTemperature::operator delete(void* p)
|
||||
{
|
||||
DallasTemperature* pNss = (DallasTemperature*) p; // Cast to NSS pointer
|
||||
pNss->~DallasTemperature(); // Destruct the object
|
||||
|
||||
free(p); // Free the memory
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
#ifndef DallasTemperature_h
|
||||
#define DallasTemperature_h
|
||||
|
||||
#define DALLASTEMPLIBVERSION "3.7.2"
|
||||
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
// set to true to include code for new and delete operators
|
||||
#ifndef REQUIRESNEW
|
||||
#define REQUIRESNEW false
|
||||
#endif
|
||||
|
||||
// set to true to include code implementing alarm search functions
|
||||
#ifndef REQUIRESALARMS
|
||||
#define REQUIRESALARMS true
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <OneWire.h>
|
||||
|
||||
// Model IDs
|
||||
#define DS18S20MODEL 0x10
|
||||
#define DS18B20MODEL 0x28
|
||||
#define DS1822MODEL 0x22
|
||||
|
||||
// OneWire commands
|
||||
#define STARTCONVO 0x44 // Tells device to take a temperature reading and put it on the scratchpad
|
||||
#define COPYSCRATCH 0x48 // Copy EEPROM
|
||||
#define READSCRATCH 0xBE // Read EEPROM
|
||||
#define WRITESCRATCH 0x4E // Write to EEPROM
|
||||
#define RECALLSCRATCH 0xB8 // Reload from last known
|
||||
#define READPOWERSUPPLY 0xB4 // Determine if device needs parasite power
|
||||
#define ALARMSEARCH 0xEC // Query bus for devices with an alarm condition
|
||||
|
||||
// Scratchpad locations
|
||||
#define TEMP_LSB 0
|
||||
#define TEMP_MSB 1
|
||||
#define HIGH_ALARM_TEMP 2
|
||||
#define LOW_ALARM_TEMP 3
|
||||
#define CONFIGURATION 4
|
||||
#define INTERNAL_BYTE 5
|
||||
#define COUNT_REMAIN 6
|
||||
#define COUNT_PER_C 7
|
||||
#define SCRATCHPAD_CRC 8
|
||||
|
||||
// Device resolution
|
||||
#define TEMP_9_BIT 0x1F // 9 bit
|
||||
#define TEMP_10_BIT 0x3F // 10 bit
|
||||
#define TEMP_11_BIT 0x5F // 11 bit
|
||||
#define TEMP_12_BIT 0x7F // 12 bit
|
||||
|
||||
// Error Codes
|
||||
#define DEVICE_DISCONNECTED -127
|
||||
|
||||
typedef uint8_t DeviceAddress[8];
|
||||
|
||||
class DallasTemperature
|
||||
{
|
||||
public:
|
||||
|
||||
DallasTemperature(OneWire*);
|
||||
|
||||
// initalise bus
|
||||
void begin(void);
|
||||
|
||||
// returns the number of devices found on the bus
|
||||
uint8_t getDeviceCount(void);
|
||||
|
||||
// Is a conversion complete on the wire?
|
||||
bool isConversionComplete(void);
|
||||
|
||||
// returns true if address is valid
|
||||
bool validAddress(uint8_t*);
|
||||
|
||||
// finds an address at a given index on the bus
|
||||
bool getAddress(uint8_t*, const uint8_t);
|
||||
|
||||
// attempt to determine if the device at the given address is connected to the bus
|
||||
bool isConnected(uint8_t*);
|
||||
|
||||
// attempt to determine if the device at the given address is connected to the bus
|
||||
// also allows for updating the read scratchpad
|
||||
bool isConnected(uint8_t*, uint8_t*);
|
||||
|
||||
// read device's scratchpad
|
||||
void readScratchPad(uint8_t*, uint8_t*);
|
||||
|
||||
// write device's scratchpad
|
||||
void writeScratchPad(uint8_t*, const uint8_t*);
|
||||
|
||||
// read device's power requirements
|
||||
bool readPowerSupply(uint8_t*);
|
||||
|
||||
// get global resolution
|
||||
uint8_t getResolution();
|
||||
|
||||
// set global resolution to 9, 10, 11, or 12 bits
|
||||
void setResolution(uint8_t);
|
||||
|
||||
// returns the device resolution, 9-12
|
||||
uint8_t getResolution(uint8_t*);
|
||||
|
||||
// set resolution of a device to 9, 10, 11, or 12 bits
|
||||
bool setResolution(uint8_t*, uint8_t);
|
||||
|
||||
// sets/gets the waitForConversion flag
|
||||
void setWaitForConversion(bool);
|
||||
bool getWaitForConversion(void);
|
||||
|
||||
// sets/gets the checkForConversion flag
|
||||
void setCheckForConversion(bool);
|
||||
bool getCheckForConversion(void);
|
||||
|
||||
// sends command for all devices on the bus to perform a temperature conversion
|
||||
void requestTemperatures(void);
|
||||
|
||||
// sends command for one device to perform a temperature conversion by address
|
||||
bool requestTemperaturesByAddress(uint8_t*);
|
||||
|
||||
// sends command for one device to perform a temperature conversion by index
|
||||
bool requestTemperaturesByIndex(uint8_t);
|
||||
|
||||
// returns temperature in degrees C
|
||||
float getTempC(uint8_t*);
|
||||
|
||||
// returns temperature in degrees F
|
||||
float getTempF(uint8_t*);
|
||||
|
||||
// Get temperature for device index (slow)
|
||||
float getTempCByIndex(uint8_t);
|
||||
|
||||
// Get temperature for device index (slow)
|
||||
float getTempFByIndex(uint8_t);
|
||||
|
||||
// returns true if the bus requires parasite power
|
||||
bool isParasitePowerMode(void);
|
||||
|
||||
bool isConversionAvailable(uint8_t*);
|
||||
|
||||
#if REQUIRESALARMS
|
||||
|
||||
typedef void AlarmHandler(uint8_t*);
|
||||
|
||||
// sets the high alarm temperature for a device
|
||||
// accepts a char. valid range is -55C - 125C
|
||||
void setHighAlarmTemp(uint8_t*, const char);
|
||||
|
||||
// sets the low alarm temperature for a device
|
||||
// accepts a char. valid range is -55C - 125C
|
||||
void setLowAlarmTemp(uint8_t*, const char);
|
||||
|
||||
// returns a signed char with the current high alarm temperature for a device
|
||||
// in the range -55C - 125C
|
||||
char getHighAlarmTemp(uint8_t*);
|
||||
|
||||
// returns a signed char with the current low alarm temperature for a device
|
||||
// in the range -55C - 125C
|
||||
char getLowAlarmTemp(uint8_t*);
|
||||
|
||||
// resets internal variables used for the alarm search
|
||||
void resetAlarmSearch(void);
|
||||
|
||||
// search the wire for devices with active alarms
|
||||
bool alarmSearch(uint8_t*);
|
||||
|
||||
// returns true if ia specific device has an alarm
|
||||
bool hasAlarm(uint8_t*);
|
||||
|
||||
// returns true if any device is reporting an alarm on the bus
|
||||
bool hasAlarm(void);
|
||||
|
||||
// runs the alarm handler for all devices returned by alarmSearch()
|
||||
void processAlarms(void);
|
||||
|
||||
// sets the alarm handler
|
||||
void setAlarmHandler(AlarmHandler *);
|
||||
|
||||
// The default alarm handler
|
||||
static void defaultAlarmHandler(uint8_t*);
|
||||
|
||||
#endif
|
||||
|
||||
// convert from celcius to farenheit
|
||||
static float toFahrenheit(const float);
|
||||
|
||||
// convert from farenheit to celsius
|
||||
static float toCelsius(const float);
|
||||
|
||||
#if REQUIRESNEW
|
||||
|
||||
// initalize memory area
|
||||
void* operator new (unsigned int);
|
||||
|
||||
// delete memory reference
|
||||
void operator delete(void*);
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
typedef uint8_t ScratchPad[9];
|
||||
|
||||
// parasite power on or off
|
||||
bool parasite;
|
||||
|
||||
// used to determine the delay amount needed to allow for the
|
||||
// temperature conversion to take place
|
||||
uint8_t bitResolution;
|
||||
|
||||
// used to requestTemperature with or without delay
|
||||
bool waitForConversion;
|
||||
|
||||
// used to requestTemperature to dynamically check if a conversion is complete
|
||||
bool checkForConversion;
|
||||
|
||||
// count of devices on the bus
|
||||
uint8_t devices;
|
||||
|
||||
// Take a pointer to one wire instance
|
||||
OneWire* _wire;
|
||||
|
||||
// reads scratchpad and returns the temperature in degrees C
|
||||
float calculateTemperature(uint8_t*, uint8_t*);
|
||||
|
||||
void blockTillConversionComplete(uint8_t*,uint8_t*);
|
||||
|
||||
#if REQUIRESALARMS
|
||||
|
||||
// required for alarmSearch
|
||||
uint8_t alarmSearchAddress[8];
|
||||
char alarmSearchJunction;
|
||||
uint8_t alarmSearchExhausted;
|
||||
|
||||
// the alarm handler function pointer
|
||||
AlarmHandler *_AlarmHandler;
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
// Data wire is plugged into port 2 on the Arduino
|
||||
#define ONE_WIRE_BUS 2
|
||||
#define TEMPERATURE_PRECISION 9
|
||||
|
||||
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
|
||||
// Pass our oneWire reference to Dallas Temperature.
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
// arrays to hold device addresses
|
||||
DeviceAddress insideThermometer, outsideThermometer, middleThermometer;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// start serial port
|
||||
Serial.begin(9600);
|
||||
Serial.println("Dallas Temperature IC Control Library Demo");
|
||||
|
||||
// Start up the library
|
||||
sensors.begin();
|
||||
|
||||
// locate devices on the bus
|
||||
Serial.print("Locating devices...");
|
||||
Serial.print("Found ");
|
||||
Serial.print(sensors.getDeviceCount(), DEC);
|
||||
Serial.println(" devices.");
|
||||
|
||||
// report parasite power requirements
|
||||
Serial.print("Parasite power is: ");
|
||||
if (sensors.isParasitePowerMode()) Serial.println("ON");
|
||||
else Serial.println("OFF");
|
||||
|
||||
// assign address manually. the addresses below will beed to be changed
|
||||
// to valid device addresses on your bus. device address can be retrieved
|
||||
// by using either oneWire.search(deviceAddress) or individually via
|
||||
// sensors.getAddress(deviceAddress, index)
|
||||
//insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
|
||||
//outsideThermometer = { 0x28, 0x3F, 0x1C, 0x31, 0x2, 0x0, 0x0, 0x2 };
|
||||
|
||||
// search for devices on the bus and assign based on an index. ideally,
|
||||
// you would do this to initially discover addresses on the bus and then
|
||||
// use those addresses and manually assign them (see above) once you know
|
||||
// the devices on your bus (and assuming they don't change).
|
||||
//
|
||||
// method 1: by index
|
||||
if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
|
||||
if (!sensors.getAddress(outsideThermometer, 1)) Serial.println("Unable to find address for Device 1");
|
||||
if (!sensors.getAddress(middleThermometer, 2)) Serial.println("Unable to find address for Device 2");
|
||||
|
||||
// method 2: search()
|
||||
// search() looks for the next device. Returns 1 if a new address has been
|
||||
// returned. A zero might mean that the bus is shorted, there are no devices,
|
||||
// or you have already retrieved all of them. It might be a good idea to
|
||||
// check the CRC to make sure you didn't get garbage. The order is
|
||||
// deterministic. You will always get the same devices in the same order
|
||||
//
|
||||
// Must be called before search()
|
||||
//oneWire.reset_search();
|
||||
// assigns the first address found to insideThermometer
|
||||
//if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer");
|
||||
// assigns the seconds address found to outsideThermometer
|
||||
//if (!oneWire.search(outsideThermometer)) Serial.println("Unable to find address for outsideThermometer");
|
||||
|
||||
// show the addresses we found on the bus
|
||||
Serial.print("Device 0 Address: ");
|
||||
printAddress(insideThermometer);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Device 1 Address: ");
|
||||
printAddress(outsideThermometer);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Device 2 Address: ");
|
||||
printAddress(middleThermometer);
|
||||
Serial.println();
|
||||
|
||||
// set the resolution to 9 bit
|
||||
sensors.setResolution(insideThermometer, TEMPERATURE_PRECISION);
|
||||
sensors.setResolution(outsideThermometer, TEMPERATURE_PRECISION);
|
||||
sensors.setResolution(middleThermometer, TEMPERATURE_PRECISION);
|
||||
|
||||
Serial.print("Device 0 Resolution: ");
|
||||
Serial.print(sensors.getResolution(insideThermometer), DEC);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Device 1 Resolution: ");
|
||||
Serial.print(sensors.getResolution(outsideThermometer), DEC);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Device 2 Resolution: ");
|
||||
Serial.print(sensors.getResolution(middleThermometer), DEC);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// function to print a device address
|
||||
void printAddress(DeviceAddress deviceAddress)
|
||||
{
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
// zero pad the address if necessary
|
||||
if (deviceAddress[i] < 16) Serial.print("0");
|
||||
Serial.print(deviceAddress[i], HEX);
|
||||
}
|
||||
}
|
||||
|
||||
// function to print the temperature for a device
|
||||
void printTemperature(DeviceAddress deviceAddress)
|
||||
{
|
||||
float tempC = sensors.getTempC(deviceAddress);
|
||||
Serial.print("Temp C: ");
|
||||
Serial.print(tempC);
|
||||
Serial.print(" Temp F: ");
|
||||
Serial.print(DallasTemperature::toFahrenheit(tempC));
|
||||
}
|
||||
|
||||
// function to print a device's resolution
|
||||
void printResolution(DeviceAddress deviceAddress)
|
||||
{
|
||||
Serial.print("Resolution: ");
|
||||
Serial.print(sensors.getResolution(deviceAddress));
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// main function to print information about a device
|
||||
void printData(DeviceAddress deviceAddress)
|
||||
{
|
||||
Serial.print("Device Address: ");
|
||||
printAddress(deviceAddress);
|
||||
Serial.print(" ");
|
||||
printTemperature(deviceAddress);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
// call sensors.requestTemperatures() to issue a global temperature
|
||||
// request to all devices on the bus
|
||||
Serial.print("Requesting temperatures...");
|
||||
sensors.requestTemperatures();
|
||||
Serial.println("DONE");
|
||||
|
||||
// print the device information
|
||||
printData(insideThermometer);
|
||||
printData(outsideThermometer);
|
||||
printData(middleThermometer);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
Arduino Library for Dallas Temperature ICs
|
||||
==========================================
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
This library supports the following devices:
|
||||
DS18B20
|
||||
DS18S20 - Please note there appears to be an issue with this series.
|
||||
DS1822
|
||||
|
||||
You will need a pull-up resistor of about 5 KOhm between the 1-Wire data line
|
||||
and your 5V power. If you are using the DS18B20, ground pins 1 and 3. The
|
||||
centre pin is the data line '1-wire'.
|
||||
|
||||
We have included a "REQUIRESNEW" and "REQUIRESALARMS" definition. If you
|
||||
want to slim down the code feel free to use either of these by including
|
||||
#define REQUIRESNEW or #define REQUIRESALARMS a the top of DallasTemperature.h
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
The OneWire code has been derived from
|
||||
http://www.arduino.cc/playground/Learning/OneWire.
|
||||
Miles Burton <miles@mnetcs.com> originally developed this library.
|
||||
Tim Newsome <nuisance@casualhacker.net> added support for multiple sensors on
|
||||
the same bus.
|
||||
Guil Barros [gfbarros@bappos.com] added getTempByAddress (v3.5)
|
||||
Rob Tillaart [rob.tillaart@gmail.com] added async modus (v3.7.0)
|
||||
|
||||
|
||||
Website
|
||||
-------
|
||||
|
||||
You can find the latest version of the library at
|
||||
http://milesburton.com/index.php?title=Dallas_Temperature_Control_Library
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
|
||||
This file contains the change history of the Dallas Temperature Control Library.
|
||||
|
||||
VERSION 3.7.2 BETA
|
||||
===================
|
||||
DATE: 6 DEC 2011
|
||||
|
||||
- Jordan Hochenbaum [jhochenbaum@gmail.com] updated library for compatibility with Arduino 1.0.
|
||||
|
||||
VERSION 3.7.0 BETA
|
||||
===================
|
||||
DATE: 11 JAN 2011
|
||||
|
||||
- Rob Tillaart [rob.tillaart@gmail.com] added async modus (v3.7.0)
|
||||
The library is backwards compatible with version 3.6.0
|
||||
|
||||
MAJOR: async modus
|
||||
------------------
|
||||
- Added - private bool waitForConversion.
|
||||
This boolean is default set to true in the Constructor to keep the library backwards compatible. If this flag is true calls to requestTemperatures(), requestTemperaturesByAddress() et al, will be blocking with the appropiate time specified (in datasheet) for the resolution used. If the flag is set to false, requestTemperatures() et al, will return immediately after the conversion command is send over the 1-wire interface. The programmer is responsible to wait long enough before reading the temperature values. This enables the application to do other things while waiting for a new reading, like calculations, update LCD, read/write other IO lines etc. See examples.
|
||||
|
||||
- Added - void setWaitForConversion(bool);
|
||||
To set the flag to true or false, depending on the modus needed.
|
||||
|
||||
- Added - bool getWaitForConversion(void);
|
||||
To get the current value of the flag.
|
||||
|
||||
- Changed - void requestTemperatures(void);
|
||||
Added a test (false == waitForConversion) to return immediately after the conversion command instead of waiting until the conversion is ready.
|
||||
|
||||
- Changed - bool requestTemperaturesByAddress(uint8_t*);
|
||||
Added a test (false == waitForConversion) to return immediately after the conversion command instead of waiting until the conversion is ready.
|
||||
|
||||
|
||||
MINOR version number
|
||||
--------------------
|
||||
- Added - #define DALLASTEMPLIBVERSION "3.7.0"
|
||||
To indicate the version number in .h file
|
||||
|
||||
|
||||
MINOR internal var bitResolution
|
||||
----------------------------
|
||||
- Changed - private int conversionDelay - is renamed to - private int bitResolution
|
||||
As this variable holds the resolution. The delay for the conversion is derived from it.
|
||||
|
||||
- Changed - uint8_t getResolution(uint8_t* deviceAddress);
|
||||
If the device is not connected, it returns 0, otherwise it returns the resolution of the device.
|
||||
|
||||
- Changed - bool setResolution(uint8_t* deviceAddress, uint8_t newResolution);
|
||||
If the device is not connected, it returns FALSE (fail), otherwise it returns TRUE (succes).
|
||||
|
||||
- Added - uint8_t getResolution();
|
||||
Returns bitResolution.
|
||||
|
||||
- Added - void setResolution(uint8_t newResolution)
|
||||
Sets the internal variable bitResolution, and all devices to this value
|
||||
|
||||
|
||||
MINOR check connected state
|
||||
----------------------------
|
||||
- Changed - bool requestTemperaturesByIndex(deviceIndex)
|
||||
Changed return type from void to bool. The function returns false if the device identified with [deviceIndex] is not found on the bus and true otherwise.
|
||||
|
||||
- Changed - bool requestTemperaturesByAddress(deviceAddress)
|
||||
Changed return type from void to bool. The function returns false if the device identified with [deviceAddress] is not found on the bus and true otherwise.
|
||||
Added code to handle the DS18S20 which has a 9 bit resolution separately.
|
||||
Changed code so the blocking delay matches the bitResolution set in the device with deviceAddress.
|
||||
|
||||
- Changed - bool requestTemperaturesByIndex(uint8_t deviceIndex)
|
||||
Changed return type from void to bool. The function returns false if the device identified with [deviceIndex] is not found on the bus and true otherwise.
|
||||
|
||||
|
||||
|
||||
VERSION 3.6.0
|
||||
==============
|
||||
DATE: 2010-10-10
|
||||
|
||||
- no detailed change history known except:
|
||||
|
||||
- The OneWire code has been derived from
|
||||
http://www.arduino.cc/playground/Learning/OneWire.
|
||||
- Miles Burton <miles@mnetcs.com> originally developed this library.
|
||||
- Tim Newsome <nuisance@casualhacker.net> added support for multiple sensors on
|
||||
the same bus.
|
||||
- Guil Barros [gfbarros@bappos.com] added getTempByAddress (v3.5)
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
// Data wire is plugged into port 2 on the Arduino
|
||||
#define ONE_WIRE_BUS 2
|
||||
#define TEMPERATURE_PRECISION 12
|
||||
|
||||
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
|
||||
// Pass our oneWire reference to Dallas Temperature.
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
// arrays to hold device addresses
|
||||
DeviceAddress insideThermometer, outsideThermometer;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// start serial port
|
||||
Serial.begin(9600);
|
||||
Serial.println("Dallas Temperature IC Control Library Demo");
|
||||
|
||||
// Start up the library
|
||||
sensors.begin();
|
||||
|
||||
// locate devices on the bus
|
||||
Serial.print("Locating devices...");
|
||||
Serial.print("Found ");
|
||||
Serial.print(sensors.getDeviceCount(), DEC);
|
||||
Serial.println(" devices.");
|
||||
|
||||
// report parasite power requirements
|
||||
Serial.print("Parasite power is: ");
|
||||
if (sensors.isParasitePowerMode()) Serial.println("ON");
|
||||
else Serial.println("OFF");
|
||||
|
||||
// assign address manually. the addresses below will beed to be changed
|
||||
// to valid device addresses on your bus. device address can be retrieved
|
||||
// by using either oneWire.search(deviceAddress) or individually via
|
||||
// sensors.getAddress(deviceAddress, index)
|
||||
//insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
|
||||
//outsideThermometer = { 0x28, 0x3F, 0x1C, 0x31, 0x2, 0x0, 0x0, 0x2 };
|
||||
|
||||
// search for devices on the bus and assign based on an index. ideally,
|
||||
// you would do this to initially discover addresses on the bus and then
|
||||
// use those addresses and manually assign them (see above) once you know
|
||||
// the devices on your bus (and assuming they don't change).
|
||||
//
|
||||
// method 1: by index
|
||||
if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
|
||||
if (!sensors.getAddress(outsideThermometer, 1)) Serial.println("Unable to find address for Device 1");
|
||||
|
||||
// method 2: search()
|
||||
// search() looks for the next device. Returns 1 if a new address has been
|
||||
// returned. A zero might mean that the bus is shorted, there are no devices,
|
||||
// or you have already retrieved all of them. It might be a good idea to
|
||||
// check the CRC to make sure you didn't get garbage. The order is
|
||||
// deterministic. You will always get the same devices in the same order
|
||||
//
|
||||
// Must be called before search()
|
||||
//oneWire.reset_search();
|
||||
// assigns the first address found to insideThermometer
|
||||
//if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer");
|
||||
// assigns the seconds address found to outsideThermometer
|
||||
//if (!oneWire.search(outsideThermometer)) Serial.println("Unable to find address for outsideThermometer");
|
||||
|
||||
// show the addresses we found on the bus
|
||||
Serial.print("Device 0 Address: ");
|
||||
printAddress(insideThermometer);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Device 1 Address: ");
|
||||
printAddress(outsideThermometer);
|
||||
Serial.println();
|
||||
|
||||
// set the resolution
|
||||
sensors.setResolution(insideThermometer, TEMPERATURE_PRECISION);
|
||||
sensors.setResolution(outsideThermometer, TEMPERATURE_PRECISION);
|
||||
|
||||
Serial.print("Device 0 Resolution: ");
|
||||
Serial.print(sensors.getResolution(insideThermometer), DEC);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Device 1 Resolution: ");
|
||||
Serial.print(sensors.getResolution(outsideThermometer), DEC);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// function to print a device address
|
||||
void printAddress(DeviceAddress deviceAddress)
|
||||
{
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
// zero pad the address if necessary
|
||||
if (deviceAddress[i] < 16) Serial.print("0");
|
||||
Serial.print(deviceAddress[i], HEX);
|
||||
}
|
||||
}
|
||||
|
||||
// function to print the temperature for a device
|
||||
void printTemperature(DeviceAddress deviceAddress)
|
||||
{
|
||||
float tempC = sensors.getTempC(deviceAddress);
|
||||
Serial.print("Temp C: ");
|
||||
Serial.print(tempC);
|
||||
Serial.print(" Temp F: ");
|
||||
Serial.print(DallasTemperature::toFahrenheit(tempC));
|
||||
}
|
||||
|
||||
// function to print a device's resolution
|
||||
void printResolution(DeviceAddress deviceAddress)
|
||||
{
|
||||
Serial.print("Resolution: ");
|
||||
Serial.print(sensors.getResolution(deviceAddress));
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// main function to print information about a device
|
||||
void printData(DeviceAddress deviceAddress)
|
||||
{
|
||||
Serial.print("Device Address: ");
|
||||
printAddress(deviceAddress);
|
||||
Serial.print(" ");
|
||||
printTemperature(deviceAddress);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
// call sensors.requestTemperatures() to issue a global temperature
|
||||
// request to all devices on the bus
|
||||
Serial.print("Requesting temperatures...");
|
||||
sensors.requestTemperatures();
|
||||
Serial.println("DONE");
|
||||
|
||||
// print the device information
|
||||
printData(insideThermometer);
|
||||
printData(outsideThermometer);
|
||||
}
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
// Data wire is plugged into port 2 on the Arduino
|
||||
#define ONE_WIRE_BUS 2
|
||||
|
||||
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
|
||||
// Pass our oneWire reference to Dallas Temperature.
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// start serial port
|
||||
Serial.begin(9600);
|
||||
Serial.println("Dallas Temperature IC Control Library Demo");
|
||||
|
||||
// Start up the library
|
||||
sensors.begin();
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
// call sensors.requestTemperatures() to issue a global temperature
|
||||
// request to all devices on the bus
|
||||
Serial.print("Requesting temperatures...");
|
||||
sensors.requestTemperatures(); // Send the command to get temperatures
|
||||
Serial.println("DONE");
|
||||
|
||||
Serial.print("Temperature for the device 1 (index 0) is: ");
|
||||
Serial.println(sensors.getTempCByIndex(0));
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
// Data wire is plugged into port 2 on the Arduino
|
||||
#define ONE_WIRE_BUS 2
|
||||
|
||||
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
|
||||
// Pass our oneWire reference to Dallas Temperature.
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
// arrays to hold device address
|
||||
DeviceAddress insideThermometer;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// start serial port
|
||||
Serial.begin(9600);
|
||||
Serial.println("Dallas Temperature IC Control Library Demo");
|
||||
|
||||
// locate devices on the bus
|
||||
Serial.print("Locating devices...");
|
||||
sensors.begin();
|
||||
Serial.print("Found ");
|
||||
Serial.print(sensors.getDeviceCount(), DEC);
|
||||
Serial.println(" devices.");
|
||||
|
||||
// report parasite power requirements
|
||||
Serial.print("Parasite power is: ");
|
||||
if (sensors.isParasitePowerMode()) Serial.println("ON");
|
||||
else Serial.println("OFF");
|
||||
|
||||
// assign address manually. the addresses below will beed to be changed
|
||||
// to valid device addresses on your bus. device address can be retrieved
|
||||
// by using either oneWire.search(deviceAddress) or individually via
|
||||
// sensors.getAddress(deviceAddress, index)
|
||||
//insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };
|
||||
|
||||
// Method 1:
|
||||
// search for devices on the bus and assign based on an index. ideally,
|
||||
// you would do this to initially discover addresses on the bus and then
|
||||
// use those addresses and manually assign them (see above) once you know
|
||||
// the devices on your bus (and assuming they don't change).
|
||||
if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
|
||||
|
||||
// method 2: search()
|
||||
// search() looks for the next device. Returns 1 if a new address has been
|
||||
// returned. A zero might mean that the bus is shorted, there are no devices,
|
||||
// or you have already retrieved all of them. It might be a good idea to
|
||||
// check the CRC to make sure you didn't get garbage. The order is
|
||||
// deterministic. You will always get the same devices in the same order
|
||||
//
|
||||
// Must be called before search()
|
||||
//oneWire.reset_search();
|
||||
// assigns the first address found to insideThermometer
|
||||
//if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer");
|
||||
|
||||
// show the addresses we found on the bus
|
||||
Serial.print("Device 0 Address: ");
|
||||
printAddress(insideThermometer);
|
||||
Serial.println();
|
||||
|
||||
// set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
|
||||
sensors.setResolution(insideThermometer, 9);
|
||||
|
||||
Serial.print("Device 0 Resolution: ");
|
||||
Serial.print(sensors.getResolution(insideThermometer), DEC);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// function to print the temperature for a device
|
||||
void printTemperature(DeviceAddress deviceAddress)
|
||||
{
|
||||
// method 1 - slower
|
||||
//Serial.print("Temp C: ");
|
||||
//Serial.print(sensors.getTempC(deviceAddress));
|
||||
//Serial.print(" Temp F: ");
|
||||
//Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit
|
||||
|
||||
// method 2 - faster
|
||||
float tempC = sensors.getTempC(deviceAddress);
|
||||
Serial.print("Temp C: ");
|
||||
Serial.print(tempC);
|
||||
Serial.print(" Temp F: ");
|
||||
Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
// call sensors.requestTemperatures() to issue a global temperature
|
||||
// request to all devices on the bus
|
||||
Serial.print("Requesting temperatures...");
|
||||
sensors.requestTemperatures(); // Send the command to get temperatures
|
||||
Serial.println("DONE");
|
||||
|
||||
// It responds almost immediately. Let's print out the data
|
||||
printTemperature(insideThermometer); // Use a simple function to print out the data
|
||||
}
|
||||
|
||||
// function to print a device address
|
||||
void printAddress(DeviceAddress deviceAddress)
|
||||
{
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
if (deviceAddress[i] < 16) Serial.print("0");
|
||||
Serial.print(deviceAddress[i], HEX);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
// Data wire is plugged into port 2 on the Arduino
|
||||
#define ONE_WIRE_BUS 2
|
||||
#define TEMPERATURE_PRECISION 9
|
||||
|
||||
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
|
||||
// Pass our oneWire reference to Dallas Temperature.
|
||||
DallasTemperature sensors(&oneWire);
|
||||
|
||||
int numberOfDevices; // Number of temperature devices found
|
||||
|
||||
DeviceAddress tempDeviceAddress; // We'll use this variable to store a found device address
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
// start serial port
|
||||
Serial.begin(9600);
|
||||
Serial.println("Dallas Temperature IC Control Library Demo");
|
||||
|
||||
// Start up the library
|
||||
sensors.begin();
|
||||
|
||||
// Grab a count of devices on the wire
|
||||
numberOfDevices = sensors.getDeviceCount();
|
||||
|
||||
// locate devices on the bus
|
||||
Serial.print("Locating devices...");
|
||||
|
||||
Serial.print("Found ");
|
||||
Serial.print(numberOfDevices, DEC);
|
||||
Serial.println(" devices.");
|
||||
|
||||
// report parasite power requirements
|
||||
Serial.print("Parasite power is: ");
|
||||
if (sensors.isParasitePowerMode()) Serial.println("ON");
|
||||
else Serial.println("OFF");
|
||||
|
||||
// Loop through each device, print out address
|
||||
for(int i=0;i<numberOfDevices; i++)
|
||||
{
|
||||
// Search the wire for address
|
||||
if(sensors.getAddress(tempDeviceAddress, i))
|
||||
{
|
||||
Serial.print("Found device ");
|
||||
Serial.print(i, DEC);
|
||||
Serial.print(" with address: ");
|
||||
printAddress(tempDeviceAddress);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("Setting resolution to ");
|
||||
Serial.println(TEMPERATURE_PRECISION, DEC);
|
||||
|
||||
// set the resolution to TEMPERATURE_PRECISION bit (Each Dallas/Maxim device is capable of several different resolutions)
|
||||
sensors.setResolution(tempDeviceAddress, TEMPERATURE_PRECISION);
|
||||
|
||||
Serial.print("Resolution actually set to: ");
|
||||
Serial.print(sensors.getResolution(tempDeviceAddress), DEC);
|
||||
Serial.println();
|
||||
}else{
|
||||
Serial.print("Found ghost device at ");
|
||||
Serial.print(i, DEC);
|
||||
Serial.print(" but could not detect address. Check power and cabling");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// function to print the temperature for a device
|
||||
void printTemperature(DeviceAddress deviceAddress)
|
||||
{
|
||||
// method 1 - slower
|
||||
//Serial.print("Temp C: ");
|
||||
//Serial.print(sensors.getTempC(deviceAddress));
|
||||
//Serial.print(" Temp F: ");
|
||||
//Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit
|
||||
|
||||
// method 2 - faster
|
||||
float tempC = sensors.getTempC(deviceAddress);
|
||||
Serial.print("Temp C: ");
|
||||
Serial.print(tempC);
|
||||
Serial.print(" Temp F: ");
|
||||
Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
// call sensors.requestTemperatures() to issue a global temperature
|
||||
// request to all devices on the bus
|
||||
Serial.print("Requesting temperatures...");
|
||||
sensors.requestTemperatures(); // Send the command to get temperatures
|
||||
Serial.println("DONE");
|
||||
|
||||
|
||||
// Loop through each device, print out temperature data
|
||||
for(int i=0;i<numberOfDevices; i++)
|
||||
{
|
||||
// Search the wire for address
|
||||
if(sensors.getAddress(tempDeviceAddress, i))
|
||||
{
|
||||
// Output the device ID
|
||||
Serial.print("Temperature for device: ");
|
||||
Serial.println(i,DEC);
|
||||
|
||||
// It responds almost immediately. Let's print out the data
|
||||
printTemperature(tempDeviceAddress); // Use a simple function to print out the data
|
||||
}
|
||||
//else ghost device! Check your power requirements and cabling
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// function to print a device address
|
||||
void printAddress(DeviceAddress deviceAddress)
|
||||
{
|
||||
for (uint8_t i = 0; i < 8; i++)
|
||||
{
|
||||
if (deviceAddress[i] < 16) Serial.print("0");
|
||||
Serial.print(deviceAddress[i], HEX);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
// This sketch looks for 1-wire devices and
|
||||
// prints their addresses (serial number) to
|
||||
// the UART, in a format that is useful in Arduino sketches
|
||||
// Tutorial:
|
||||
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
|
||||
|
||||
#include <OneWire.h>
|
||||
|
||||
OneWire ds(2); // Connect your 1-wire device to pin 2
|
||||
|
||||
void setup(void) {
|
||||
Serial.begin(9600);
|
||||
discoverOneWireDevices();
|
||||
}
|
||||
|
||||
void discoverOneWireDevices(void) {
|
||||
byte i;
|
||||
byte present = 0;
|
||||
byte data[12];
|
||||
byte addr[8];
|
||||
|
||||
Serial.print("Looking for 1-Wire devices...\n\r");
|
||||
while(ds.search(addr)) {
|
||||
Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");
|
||||
for( i = 0; i < 8; i++) {
|
||||
Serial.print("0x");
|
||||
if (addr[i] < 16) {
|
||||
Serial.print('0');
|
||||
}
|
||||
Serial.print(addr[i], HEX);
|
||||
if (i < 7) {
|
||||
Serial.print(", ");
|
||||
}
|
||||
}
|
||||
if ( OneWire::crc8( addr, 7) != addr[7]) {
|
||||
Serial.print("CRC is not valid!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Serial.print("\n\r\n\rThat's it.\r\n");
|
||||
ds.reset_search();
|
||||
return;
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// nothing to see here
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#######################################
|
||||
# Syntax Coloring Map For Ultrasound
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
# Datatypes (KEYWORD1)
|
||||
#######################################
|
||||
DallasTemperature KEYWORD1
|
||||
OneWire KEYWORD1
|
||||
AlarmHandler KEYWORD1
|
||||
DeviceAddress KEYWORD1
|
||||
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
setResolution KEYWORD2
|
||||
getResolution KEYWORD2
|
||||
getTempC KEYWORD2
|
||||
toFahrenheit KEYWORD2
|
||||
getTempF KEYWORD2
|
||||
getTempCByIndex KEYWORD2
|
||||
getTempFByIndex KEYWORD2
|
||||
setWaitForConversion KEYWORD2
|
||||
getWaitForConversion KEYWORD2
|
||||
requestTemperatures KEYWORD2
|
||||
requestTemperaturesByAddress KEYWORD2
|
||||
requestTemperaturesByIndex KEYWORD2
|
||||
isParasitePowerMode KEYWORD2
|
||||
begin KEYWORD2
|
||||
getDeviceCount KEYWORD2
|
||||
getAddress KEYWORD2
|
||||
validAddress KEYWORD2
|
||||
isConnected KEYWORD2
|
||||
readScratchPad KEYWORD2
|
||||
writeScratchPad KEYWORD2
|
||||
readPowerSupply KEYWORD2
|
||||
setHighAlarmTemp KEYWORD2
|
||||
setLowAlarmTemp KEYWORD2
|
||||
getHighAlarmTemp KEYWORD2
|
||||
getLowAlarmTemp KEYWORD2
|
||||
resetAlarmSearch KEYWORD2
|
||||
alarmSearch KEYWORD2
|
||||
hasAlarm KEYWORD2
|
||||
toCelsius KEYWORD2
|
||||
processAlarmss KEYWORD2
|
||||
setAlarmHandlers KEYWORD2
|
||||
defaultAlarmHandler KEYWORD2
|
||||
calculateTemperature KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
||||
|
||||
126
build.gradle
Normal file
126
build.gradle
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'application'
|
||||
}
|
||||
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ziver Koc
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// ------------------------------------
|
||||
// Hal common configuration
|
||||
// ------------------------------------
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java-library'
|
||||
|
||||
dependencies {
|
||||
//implementation 'se.koc:zutil:1.0.314'
|
||||
implementation 'se.koc:zutil:1.0.0-SNAPSHOT'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation 'org.hamcrest:hamcrest-core:2.2'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs 'src'
|
||||
}
|
||||
// We do not want the resource folder to be included in the jar file
|
||||
//resources {
|
||||
// srcDir 'resource'
|
||||
//}
|
||||
}
|
||||
test {
|
||||
java {
|
||||
srcDirs 'test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << "-Xlint:deprecation"
|
||||
//options.compilerArgs << "-Xlint:unchecked"
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Hal general configuration
|
||||
// ------------------------------------
|
||||
|
||||
dependencies {
|
||||
project.subprojects.each { subProject ->
|
||||
runtimeOnly subProject
|
||||
}
|
||||
}
|
||||
|
||||
distributions {
|
||||
main {
|
||||
contents {
|
||||
// from root project
|
||||
from 'hal.conf.example'
|
||||
from 'logging.properties'
|
||||
from 'run.sh'
|
||||
|
||||
// from subprojects
|
||||
project.subprojects.each { subProject ->
|
||||
into('bin') {
|
||||
from "${subProject.projectDir}/resources/bin"
|
||||
}
|
||||
into('web') {
|
||||
from "${subProject.projectDir}/resources/web"
|
||||
}
|
||||
into('resources') {
|
||||
from ("${subProject.projectDir}/resources") {
|
||||
exclude 'bin'
|
||||
exclude 'web'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
distTar.enabled = false
|
||||
distZip.enabled = false
|
||||
assemble.dependsOn(installDist)
|
||||
|
||||
project.gradle.startParameter.taskNames.each { taskName ->
|
||||
if (taskName == 'distZip') {
|
||||
distZip.enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass = 'se.hal.HalServer'
|
||||
}
|
||||
|
||||
startScripts.enabled = false
|
||||
138
build.xml
138
build.xml
|
|
@ -1,138 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Hal" >
|
||||
|
||||
<!-- ________________________ PROPERTIES AND SETTINGS ________________________ -->
|
||||
|
||||
<!--common properties-->
|
||||
<property name="gitRoot" value="." />
|
||||
<property name="srcDir" value="${gitRoot}/src" />
|
||||
<property name="testDir" value="${gitRoot}/test" />
|
||||
<property name="libDir" value="${gitRoot}/lib" />
|
||||
<property name="buildRoot" value="${gitRoot}/build" />
|
||||
<property name="buildDir" value="${buildRoot}/production" />
|
||||
<property name="buildTestDir" value="${buildRoot}/test" />
|
||||
<property name="releaseDir" value="${buildRoot}/release" />
|
||||
<property name="reportsDir" value="${buildRoot}/reports" />
|
||||
|
||||
<!--define standard arduments for javac-->
|
||||
<presetdef name="javac">
|
||||
<javac includeantruntime="false" />
|
||||
</presetdef>
|
||||
|
||||
<!-- ________________________ CLASSPATHS ________________________ -->
|
||||
|
||||
<!--classpath included when building-->
|
||||
<path id="classpath.build">
|
||||
<fileset dir="${libDir}">
|
||||
<include name="**/*.jar"/>
|
||||
</fileset>
|
||||
<pathelement location="${buildDir}" />
|
||||
</path>
|
||||
|
||||
<path id="classpath.test">
|
||||
<pathelement location="${buildTestDir}" />
|
||||
<!--include libraries used for building-->
|
||||
<path refid="classpath.build"/>
|
||||
</path>
|
||||
|
||||
<!-- ________________________ EXECUTION TARGETS ________________________ -->
|
||||
|
||||
<target name="run" depends="release">
|
||||
<java fork="true" failonerror="true" classname="se.hal.HalServer">
|
||||
<classpath>
|
||||
<pathelement path="${releaseDir}/hal.jar"/>
|
||||
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="remote-debug" depends="release">
|
||||
<java fork="true" failonerror="true" classname="se.hal.HalServer">
|
||||
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" />
|
||||
<classpath>
|
||||
<pathelement path="${releaseDir}/hal.jar"/>
|
||||
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="build-test">
|
||||
<mkdir dir="${reportsDir}" />
|
||||
<junit printsummary="yes" haltonfailure="false" fork="true">
|
||||
<classpath refid="classpath.test" />
|
||||
<formatter type="plain" usefile="false" /> <!-- to screen -->
|
||||
<formatter type="xml" /> <!-- to file -->
|
||||
|
||||
<batchtest todir="${reportsDir}" skipNonTests="true">
|
||||
<fileset dir="${buildTestDir}" includes="**/*Test*.class" />
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<!-- ________________________ BUILD TARGETS ________________________ -->
|
||||
|
||||
<!--clean all build paths-->
|
||||
<target name="clean">
|
||||
<delete includeemptydirs="true" failonerror="false">
|
||||
<fileset dir="${buildRoot}" includes="**/*"/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!--build product code-->
|
||||
<target name="release" depends="build">
|
||||
<copy file="${gitRoot}/hal.conf.example" todir="${releaseDir}" />
|
||||
<copy file="${gitRoot}/hal-default.db" todir="${releaseDir}" />
|
||||
<copy file="${gitRoot}/logging.properties" todir="${releaseDir}" />
|
||||
<copy file="${gitRoot}/run.sh" todir="${releaseDir}" />
|
||||
<copydir src="${libDir}" dest="${releaseDir}/lib"
|
||||
excludes="junit-*.jar,hamcrest-*.jar" />
|
||||
<copydir src="resource/web" dest="${releaseDir}/resource/web" />
|
||||
<jar destfile="${releaseDir}/hal.jar" basedir="${buildDir}" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="build-dependencies">
|
||||
<mkdir dir="${buildDir}" />
|
||||
<javac srcdir="${srcDir}" destdir="${buildDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
|
||||
<classpath refid="classpath.build" />
|
||||
<include name="**/*.java" />
|
||||
<exclude name="se/hal/tts/GoogleTTSClient.java" />
|
||||
</javac>
|
||||
<copy todir="${buildDir}">
|
||||
<fileset dir="${srcDir}"
|
||||
excludes="**/*.java" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="build-dependencies">
|
||||
<mkdir dir="${buildDir}" />
|
||||
<get src="http://ci.koc.se/jenkins/job/Zutil/lastSuccessfulBuild/artifact/build/release/Zutil.jar" dest="${libDir}" verbose="true" usetimestamp="true"/>
|
||||
</target>
|
||||
|
||||
<target name="build-test" depends="build">
|
||||
<mkdir dir="${buildTestDir}" />
|
||||
<javac srcdir="${testDir}" destdir="${buildTestDir}" debug="yes" debugLevel="lines,vars,source" fork="yes">
|
||||
<classpath refid="classpath.test" />
|
||||
<include name="**/*.java" />
|
||||
<exclude name="se/hal/test/JarvisSyntersizerTest.java" />
|
||||
</javac>
|
||||
<copy todir="${buildTestDir}">
|
||||
<fileset dir="${testDir}"
|
||||
excludes="**/*.java" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ________________________ UTILITY TARGETS ________________________ -->
|
||||
|
||||
<target name="clear-aggr-data-from-db" depends="">
|
||||
<exec executable="sqlite3">
|
||||
<arg line="hal.db 'DELETE FROM sensor_data_aggr'" />
|
||||
</exec>
|
||||
|
||||
<!-- update all internal sensors aggregation version to indicate for peers that they need to re-sync all data -->
|
||||
<exec executable="sqlite3">
|
||||
<arg line="hal.db 'UPDATE sensor SET aggr_version = (aggr_version+1) WHERE id = (SELECT sensor.id FROM user, sensor WHERE user.external == 0 AND sensor.user_id = user.id)'" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
BIN
external/Z-Stick_Gen5_Drivers.zip
vendored
Normal file
BIN
external/Z-Stick_Gen5_Drivers.zip
vendored
Normal file
Binary file not shown.
74
external/marytts-5.1.2/LICENSE.txt
vendored
74
external/marytts-5.1.2/LICENSE.txt
vendored
|
|
@ -1,74 +0,0 @@
|
|||
MARY Software User Agreement
|
||||
11 April 2011
|
||||
|
||||
MARY is licensed under the following terms.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
|
||||
Applicable Licenses
|
||||
|
||||
MARY is built upon a number of other open source technologies and products.
|
||||
Here is a list of those products with links to their licenses.
|
||||
|
||||
hts_engine: the HMM-based speech synthesis code in MARY TTS is based on HTS, ported to Java by DFKI. The original HTS can be obtained from
|
||||
http://hts-engine.sourceforge.net/ -- it is released under the New and
|
||||
Simplified BSD License.
|
||||
|
||||
freetts: MARY uses code from FreeTTS (http://freetts.sf.net) for various
|
||||
processing modules and as the source of one method for waveform synthesis.
|
||||
FreeTTS is licensed under the (BSD-style) FreeTTS license, see
|
||||
doc/licenses/freetts-license.txt.
|
||||
|
||||
JTok: The JTok tokenizer from http://heartofgold.dfki.de is distributed
|
||||
under the GNU Lesser General Public License, see http://www.gnu.org or
|
||||
doc/licenses/LGPL.txt.
|
||||
|
||||
jsresources.jar: A few utility classes from http://www.jsresources.org
|
||||
are distributed under the terms of the jsresources license, see
|
||||
doc/licenses/jsresources-license.txt.
|
||||
|
||||
log4j: MARY uses log4j (http://logging.apache.org/log4j) as a logging
|
||||
mechanism. log4j is distributed under the Apache Software License, see
|
||||
http://www.apache.org or doc/licenses/apache-software-license.txt
|
||||
|
||||
JUnit: For unit testing of the java source, mary uses JUnit
|
||||
(http://junit.org). JUnit is licensed under the Common Public License, see
|
||||
http://junit.org or doc/licenses/CPL.txt.
|
||||
|
||||
java-diff: A java diff implementation from http://www.incava.org/projects/java-diff for input-output-comparisons in the
|
||||
Mary Expert Interface. java-diff is licensed under the GNU Lesser General
|
||||
Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
|
||||
|
||||
fast-md5: A fast md5 checksum implementation from http://www.twmacinta.com/myjava/fast_md5.php
|
||||
used for computing checksums after downloading voices. fast-md5 is licensed under
|
||||
the GNU Lesser General Public License, see http://www.gnu.org or doc/licenses/LGPL.txt.
|
||||
|
||||
JavaOpenAIR: MARY can optionally be used as an OpenAIR component,
|
||||
building on the JavaOpenAIR reference implementation from
|
||||
http://www.mindmakers.org, which is licensed under the
|
||||
(BSD-style) JavaOpenAIR license, see doc/licenses/JavaOpenAIR-license.txt
|
||||
(files concerned: JavaOpenAIR.jar)
|
||||
|
||||
mwdumper: A tool for extracting sets of pages from a MediaWiki dump file.
|
||||
mwdumper is MIT-style like licensed, see http://www.mediawiki.org/wiki/Mwdumper
|
||||
and for the license http://en.wikipedia.org/wiki/MIT_License.
|
||||
(files concerned: mwdumper-2008-04-13.jar)
|
||||
|
||||
|
||||
sgt: The Scientific Graphics Toolkit (sgt) is provided by the NOAA/PMEL/EPIC group (see http://www.epic.noaa.gov/java/sgt/) under the BSD-style EPIC license, see doc/licenses/epic-license.txt.
|
||||
|
||||
IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS
|
||||
AND CONDITIONS PRIOR TO USE OF THIS CONTENT.
|
||||
10
external/marytts-5.1.2/bin/marytts-client
vendored
10
external/marytts-5.1.2/bin/marytts-client
vendored
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
##########################################################################
|
||||
# MARY TTS client
|
||||
##########################################################################
|
||||
|
||||
# Set the Mary base installation directory in an environment variable:
|
||||
BINDIR="`dirname "$0"`"
|
||||
export MARY_BASE="`(cd "$BINDIR"/.. ; pwd)`"
|
||||
|
||||
java -showversion -ea -Dserver.host=localhost -Dserver.port=59125 -jar "$MARY_BASE/lib/marytts-client-5.1.2-jar-with-dependencies.jar"
|
||||
10
external/marytts-5.1.2/bin/marytts-client.bat
vendored
10
external/marytts-5.1.2/bin/marytts-client.bat
vendored
|
|
@ -1,10 +0,0 @@
|
|||
@echo off
|
||||
set BINDIR=%~dp0
|
||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||
|
||||
java -showversion -ea -Dserver.host=localhost -Dserver.port=59125 -jar "%MARY_BASE%\lib\marytts-client-5.1.2-jar-with-dependencies.jar"
|
||||
goto :EOF
|
||||
|
||||
:RESOLVE
|
||||
set %2=%~f1
|
||||
goto :EOF
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
BINDIR="`dirname "$0"`"
|
||||
export MARY_BASE="`(cd "$BINDIR"/.. ; pwd)`"
|
||||
java -showversion -ea -Dmary.base="$MARY_BASE" $* -cp "$MARY_BASE/lib/*" marytts.tools.install.InstallerGUI
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
@echo off
|
||||
set BINDIR=%~dp0
|
||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||
java -showversion -ea -Dmary.base="%MARY_BASE%" -cp ".;%MARY_BASE%\lib\*" marytts.tools.install.InstallerGUI
|
||||
goto :EOF
|
||||
|
||||
:RESOLVE
|
||||
set %2=%~f1
|
||||
goto :EOF
|
||||
11
external/marytts-5.1.2/bin/marytts-server
vendored
11
external/marytts-5.1.2/bin/marytts-server
vendored
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
##########################################################################
|
||||
# MARY TTS server
|
||||
##########################################################################
|
||||
|
||||
# Set the Mary base installation directory in an environment variable:
|
||||
BINDIR="`dirname "$0"`"
|
||||
export MARY_BASE="`(cd "$BINDIR"/.. ; pwd)`"
|
||||
|
||||
|
||||
java -showversion -ea -Xms40m -Xmx1g -cp "$MARY_BASE/lib/*" -Dmary.base="$MARY_BASE" $* marytts.server.Mary
|
||||
14
external/marytts-5.1.2/bin/marytts-server.bat
vendored
14
external/marytts-5.1.2/bin/marytts-server.bat
vendored
|
|
@ -1,14 +0,0 @@
|
|||
@echo off
|
||||
|
||||
rem Set the Mary base installation directory in an environment variable:
|
||||
set BINDIR=%~dp0
|
||||
|
||||
call :RESOLVE "%BINDIR%\.." MARY_BASE
|
||||
|
||||
set CLASSPATH=".;%MARY_BASE%\lib\*"
|
||||
java -showversion -ea -Xms40m -Xmx1g -cp %CLASSPATH% "-Dmary.base=%MARY_BASE%" marytts.server.Mary
|
||||
goto :EOF
|
||||
|
||||
:RESOLVE
|
||||
set %2=%~f1
|
||||
goto :EOF
|
||||
|
|
@ -1,367 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import socket, sys, types, getopt
|
||||
|
||||
|
||||
languageNames = {'de':'German',
|
||||
'en':'English',
|
||||
'en_US':'US English',
|
||||
'tib':'Tibetan'}
|
||||
|
||||
class MaryClient:
|
||||
specificationVersion = "0.1"
|
||||
|
||||
"""Python implementation of a MARY TTS client"""
|
||||
def __init__( self, host="cling.dfki.uni-sb.de", port=59125, profile=False, quiet=False ):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.profile = profile
|
||||
self.quiet = quiet
|
||||
self.allVoices = None # array of Voice objects
|
||||
self.voicesByLocaleMap = {} # Map locale strings to arrays of Voice objects
|
||||
self.allDataTypes = None # array of DataType objects
|
||||
self.inputDataTypes = None # array of DataType objects
|
||||
self.outputDataTypes = None # array of DataType objects
|
||||
self.serverExampleTexts = {}
|
||||
self.voiceExampleTexts = {}
|
||||
self.serverVersionInfo = u''
|
||||
|
||||
if not self.quiet:
|
||||
sys.stderr.write( "MARY TTS Python Client %s\n" % ( self.specificationVersion ) )
|
||||
try:
|
||||
info = self.getServerVersionInfo()
|
||||
except:
|
||||
sys.stderr.write( "Problem connecting to mary server at %s:%i\n" % ( self.host, self.port ) )
|
||||
raise
|
||||
sys.stderr.write( "Connected to %s:%i, " % ( self.host, self.port ) )
|
||||
sys.stderr.write( info )
|
||||
sys.stderr.write( '\n' )
|
||||
|
||||
def __getServerInfo( self, request="", marySocket=None ):
|
||||
"""Get answer to request from mary server. Returns a list of unicode strings,
|
||||
each representing a line without the line break.
|
||||
"""
|
||||
closeSocket = False
|
||||
if marySocket is None:
|
||||
closeSocket = True
|
||||
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||
marySocket.connect( ( self.host, self.port ) )
|
||||
assert isinstance(marySocket, socket.SocketType)
|
||||
maryFile = marySocket.makefile( 'rwb', 1 ) # read-write, line-buffered
|
||||
maryFile.write( unicode( request+"\n" ).encode( 'utf-8' ) )
|
||||
result = []
|
||||
while True:
|
||||
got = unicode( maryFile.readline().strip(), 'utf-8' )
|
||||
# read until end of file or an empty line is read:
|
||||
if not got: break
|
||||
result.append(got)
|
||||
if closeSocket:
|
||||
marySocket.close()
|
||||
return result
|
||||
|
||||
def getServerVersionInfo( self ):
|
||||
"Get version info from server. Returns a unicode string"
|
||||
if self.serverVersionInfo == u'':
|
||||
# need to get it from server
|
||||
self.serverVersionInfo = u'\n'.join(self.__getServerInfo("MARY VERSION"))
|
||||
return self.serverVersionInfo
|
||||
|
||||
def getAllDataTypes(self, locale=None):
|
||||
"""Obtain a list of all data types known to the server. If the information is not
|
||||
yet available, the server is queried. This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities.
|
||||
Returns an array of DataType objects
|
||||
"""
|
||||
if self.allDataTypes is None:
|
||||
self.__fillDataTypes()
|
||||
assert self.allDataTypes is not None and len( self.allDataTypes ) > 0
|
||||
if locale is None:
|
||||
return self.allDataTypes
|
||||
else:
|
||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||
return [d for d in self.allDataTypes if d.locale is None or d.locale == locale]
|
||||
|
||||
def getInputDataTypes(self,locale=None):
|
||||
"""Obtain a list of input data types known to the server. If the information is not
|
||||
yet available, the server is queried. This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities.
|
||||
Returns an arry of DataType objects
|
||||
"""
|
||||
if self.inputDataTypes is None:
|
||||
self.__fillDataTypes()
|
||||
assert self.inputDataTypes is not None and len( self.inputDataTypes ) > 0
|
||||
if locale is None:
|
||||
return self.inputDataTypes
|
||||
else:
|
||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||
return [d for d in self.inputDataTypes if d.locale is None or d.locale == locale]
|
||||
|
||||
def getOutputDataTypes(self, locale=None):
|
||||
"""Obtain a list of output data types known to the server. If the information is not
|
||||
yet available, the server is queried. This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities.
|
||||
Returns an arry of DataType objects
|
||||
"""
|
||||
if self.outputDataTypes is None:
|
||||
self.__fillDataTypes()
|
||||
assert self.outputDataTypes is not None and len( self.outputDataTypes ) > 0
|
||||
if locale is None:
|
||||
return self.outputDataTypes
|
||||
else:
|
||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||
return [d for d in self.outputDataTypes if d.locale is None or d.locale == locale]
|
||||
|
||||
|
||||
def __fillDataTypes( self ):
|
||||
self.allDataTypes = []
|
||||
self.inputDataTypes = []
|
||||
self.outputDataTypes = []
|
||||
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||
marySocket.connect( ( self.host, self.port ) )
|
||||
# Expect a variable number of lines of the kind
|
||||
# RAWMARYXML INPUT OUTPUT
|
||||
# TEXT_DE LOCALE=de INPUT
|
||||
# AUDIO OUTPUT
|
||||
typeStrings = self.__getServerInfo( "MARY LIST DATATYPES", marySocket )
|
||||
if not typeStrings or len(typeStrings) == 0:
|
||||
raise IOError( "Could not get list of data types from Mary server" )
|
||||
marySocket.close()
|
||||
for typeString in typeStrings:
|
||||
parts = typeString.split()
|
||||
if len( parts ) == 0:
|
||||
continue
|
||||
name = parts[0]
|
||||
isInputType = False
|
||||
isOutputType = False
|
||||
locale = None
|
||||
for part in parts[1:]:
|
||||
if part[:7] == "LOCALE=":
|
||||
locale = part[7:]
|
||||
elif part == "INPUT":
|
||||
isInputType = True
|
||||
elif part == "OUTPUT":
|
||||
isOutputType = True
|
||||
dt = DataType( name, locale, isInputType, isOutputType )
|
||||
self.allDataTypes.append( dt )
|
||||
if dt.isInputType:
|
||||
self.inputDataTypes.append( dt )
|
||||
if dt.isOutputType:
|
||||
self.outputDataTypes.append( dt )
|
||||
|
||||
def getVoices( self, locale=None ):
|
||||
"""Obtain a list of voices known to the server. If the information is not
|
||||
yet available, the server is queried. This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities.
|
||||
Returns an array of Voice objects
|
||||
"""
|
||||
if self.allVoices is None:
|
||||
self.__fillVoices()
|
||||
assert self.allVoices is not None and len( self.allVoices ) > 0
|
||||
if locale is None:
|
||||
return self.allVoices
|
||||
else:
|
||||
assert isinstance(locale, types.UnicodeType), "Unexpected type for locale: '%s'" % (type(locale))
|
||||
if self.voicesByLocaleMap.has_key(locale):
|
||||
return self.voicesByLocaleMap[locale]
|
||||
else:
|
||||
raise Exception("No voices for locale '%s'" % (locale))
|
||||
|
||||
def __fillVoices( self ):
|
||||
self.allVoices = []
|
||||
self.voicesByLocaleMap = {}
|
||||
marySocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||
marySocket.connect( ( self.host, self.port ) )
|
||||
# Expect a variable number of lines of the kind
|
||||
# de7 de female
|
||||
# us2 en male
|
||||
# dfki-stadium-emo de male limited
|
||||
voiceStrings = self.__getServerInfo( "MARY LIST VOICES", marySocket )
|
||||
if not voiceStrings or len(voiceStrings) == 0:
|
||||
raise IOError( "Could not get list of voices from Mary server" )
|
||||
marySocket.close()
|
||||
for voiceString in voiceStrings:
|
||||
parts = voiceString.split()
|
||||
if len( parts ) < 3:
|
||||
continue
|
||||
name = parts[0]
|
||||
locale = parts[1]
|
||||
gender = parts[2]
|
||||
domain = None
|
||||
if len( parts ) > 3:
|
||||
domain = parts[3]
|
||||
voice = Voice( name, locale, gender, domain )
|
||||
self.allVoices.append( voice )
|
||||
localeVoices = None
|
||||
if self.voicesByLocaleMap.has_key( locale ):
|
||||
localeVoices = self.voicesByLocaleMap[locale]
|
||||
else:
|
||||
localeVoices = []
|
||||
self.voicesByLocaleMap[locale] = localeVoices
|
||||
localeVoices.append( voice )
|
||||
|
||||
def getGeneralDomainVoices( self, locale=None ):
|
||||
"""Obtain a list of general domain voices known to the server. If the information is not
|
||||
yet available, the server is queried. This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities.
|
||||
Returns an array of Voice objects
|
||||
"""
|
||||
return [v for v in self.getVoices( locale ) if not v.isLimitedDomain]
|
||||
|
||||
def getLimitedDomainVoices( self, locale=None ):
|
||||
"""Obtain a list of limited domain voices known to the server. If the information is not
|
||||
yet available, the server is queried. This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities.
|
||||
Returns an array of Voice objects
|
||||
"""
|
||||
return [v for v in self.getVoices( locale ) if v.isLimitedDomain]
|
||||
|
||||
def getAvailableLanguages(self):
|
||||
""" Check available voices and return a list of tuples (abbrev, name)
|
||||
representing the available languages -- e.g. [('en', 'English'),('de', 'German')].
|
||||
"""
|
||||
if self.allVoices is None:
|
||||
self.__fillVoices()
|
||||
assert self.allVoices is not None and len( self.allVoices ) > 0
|
||||
languages = []
|
||||
for l in self.voicesByLocaleMap.keys():
|
||||
if languageNames.has_key(l):
|
||||
languages.append((l,languageNames[l]))
|
||||
else:
|
||||
languages.append((l, l))
|
||||
return languages
|
||||
|
||||
def getServerExampleText( self, dataType ):
|
||||
"""Request an example text for a given data type from the server.
|
||||
dataType the string representation of the data type,
|
||||
e.g. "RAWMARYXML". This is optional information
|
||||
which is not required for the normal operation of the client, but
|
||||
may help to avoid incompatibilities."""
|
||||
if not self.serverExampleTexts.has_key( dataType ):
|
||||
exampleTexts = self.__getServerInfo( "MARY EXAMPLETEXT %s" % ( dataType ) )
|
||||
if not exampleTexts or len(exampleTexts) == 0:
|
||||
raise IOError( "Could not get example text for type '%s' from Mary server" % (dataType))
|
||||
exampleText = u'\n'.join(exampleTexts)
|
||||
self.serverExampleTexts[dataType] = exampleText
|
||||
return self.serverExampleTexts[dataType]
|
||||
|
||||
def process( self, input, inputType, outputType, audioType=None, defaultVoiceName=None, output=sys.stdout ):
|
||||
assert type( input ) in types.StringTypes
|
||||
assert type( inputType ) in types.StringTypes
|
||||
assert type( outputType ) in types.StringTypes
|
||||
assert audioType is None or type( audioType ) in types.StringTypes
|
||||
assert defaultVoiceName is None or type( defaultVoiceName ) in types.StringTypes
|
||||
assert callable( getattr( output, 'write' ) )
|
||||
if type( input ) != types.UnicodeType:
|
||||
input = unicode( input, 'utf-8' )
|
||||
maryInfoSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||
maryInfoSocket.connect( ( self.host, self.port ) )
|
||||
assert type( maryInfoSocket ) is socket.SocketType
|
||||
maryInfo = maryInfoSocket.makefile( 'rwb', 1 ) # read-write, line-buffered
|
||||
maryInfo.write( unicode( "MARY IN=%s OUT=%s" % ( inputType, outputType ), 'utf-8' ) )
|
||||
if audioType:
|
||||
maryInfo.write( unicode( " AUDIO=%s" % ( audioType ), 'utf-8' ) )
|
||||
if defaultVoiceName:
|
||||
maryInfo.write( unicode( " VOICE=%s" % ( defaultVoiceName ), 'utf-8' ) )
|
||||
maryInfo.write( "\r\n" )
|
||||
# Receive a request ID:
|
||||
id = maryInfo.readline()
|
||||
maryDataSocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
|
||||
maryDataSocket.connect( ( self.host, self.port ) )
|
||||
assert type( maryDataSocket ) is socket.SocketType
|
||||
maryDataSocket.sendall( id ) # includes newline
|
||||
maryDataSocket.sendall( input.encode( 'utf-8' ) )
|
||||
maryDataSocket.shutdown( 1 ) # shutdown writing
|
||||
# Set mary info socket to non-blocking, so we only read somthing
|
||||
# if there is something to read:
|
||||
maryInfoSocket.setblocking( 0 )
|
||||
while True:
|
||||
try:
|
||||
err = maryInfoSocket.recv( 8192 )
|
||||
if err: sys.stderr.write( err )
|
||||
except:
|
||||
pass
|
||||
got = maryDataSocket.recv( 8192 )
|
||||
if not got: break
|
||||
output.write( got )
|
||||
maryInfoSocket.setblocking( 1 )
|
||||
while True:
|
||||
err = maryInfoSocket.recv( 8192 )
|
||||
if not err: break
|
||||
sys.stderr.write( err )
|
||||
|
||||
|
||||
|
||||
################ data representation classes ##################
|
||||
|
||||
class DataType:
|
||||
def __init__( self, name, locale=None, isInputType=False, isOutputType=False ):
|
||||
self.name = name
|
||||
self.locale = locale
|
||||
self.isInputType = isInputType
|
||||
self.isOutputType = isOutputType
|
||||
|
||||
def isTextType( self ):
|
||||
return self.name != "AUDIO"
|
||||
|
||||
class Voice:
|
||||
|
||||
def __init__( self, name, locale, gender, domain="general" ):
|
||||
self.name = name
|
||||
self.locale = locale
|
||||
self.gender = gender
|
||||
self.domain = domain
|
||||
if not domain or domain == "general":
|
||||
self.isLimitedDomain = False
|
||||
else:
|
||||
self.isLimitedDomain = True
|
||||
|
||||
def __str__(self):
|
||||
if languageNames.has_key(self.locale):
|
||||
langName = languageNames[self.locale]
|
||||
else:
|
||||
langName = self.locale
|
||||
if self.isLimitedDomain:
|
||||
return "%s (%s, %s %s)" % (self.name, self.domain, langName, self.gender)
|
||||
else:
|
||||
return "%s (%s %s)" % (self.name, langName, self.gender)
|
||||
|
||||
##################### Main #########################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
serverHost = "cling.dfki.uni-sb.de"
|
||||
serverPort = 59125
|
||||
inputType = "TEXT"
|
||||
outputType = "AUDIO"
|
||||
audioType = "WAVE"
|
||||
defaultVoice = None
|
||||
inputEncoding = 'utf-8'
|
||||
( options, rest ) = getopt.getopt( sys.argv[1:], '', \
|
||||
['server.host=', 'server.port=', 'input.type=', 'output.type=', \
|
||||
'audio.type=', 'voice.default=', 'input.encoding='] )
|
||||
for ( option, value ) in options:
|
||||
if option == '--server.host': serverHost = value
|
||||
elif option == '--server.port': serverPort = int( value )
|
||||
elif option == '--input.type': inputType = value
|
||||
elif option == '--output.type': outputType = value
|
||||
elif option == '--audio.type': audioType = value
|
||||
elif option == '--voice.default': defaultVoice = value
|
||||
elif option == '--input.encoding': inputEncoding = value
|
||||
if len( rest )>0: # have input file
|
||||
inputFile = file( rest[0] )
|
||||
else:
|
||||
inputFile = sys.stdin
|
||||
input = unicode( ''.join( inputFile.readlines() ), inputEncoding )
|
||||
if len( rest )>1: # also have output file
|
||||
outputFile = file( rest[1] )
|
||||
else:
|
||||
outputFile = sys.stdout
|
||||
|
||||
maryClient = MaryClient( serverHost, serverPort )
|
||||
maryClient.process( input, inputType, outputType, audioType, defaultVoice, outputFile )
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/**
|
||||
* Copyright 2000-2006 DFKI GmbH.
|
||||
* All Rights Reserved. Use is subject to license terms.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to use and distribute
|
||||
* this software and its documentation without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of this work, and to
|
||||
* permit persons to whom this work is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Any modifications must be clearly marked as such.
|
||||
* 3. Original authors' names are not deleted.
|
||||
* 4. The authors' names are not used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
import marytts.client.MaryClient;
|
||||
import marytts.util.data.audio.AudioPlayer;
|
||||
import marytts.util.http.Address;
|
||||
|
||||
import javax.sound.sampled.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* A demo class illustrating how to use the MaryClient class.
|
||||
* This will connect to a MARY server, version 4.x.
|
||||
* It requires maryclient.jar from MARY 4.0.
|
||||
* This works transparently with MARY servers in both http and socket server mode.
|
||||
*
|
||||
* Compile this as follows:
|
||||
* <code>javac -cp maryclient.jar MaryClientUser.java</code>
|
||||
*
|
||||
* And run as:
|
||||
* <code>java -cp .:maryclient.jar MaryClientUser</code>
|
||||
*
|
||||
* @author marc
|
||||
*
|
||||
*/
|
||||
|
||||
public class MaryClientUser {
|
||||
|
||||
public static void main(String[] args)
|
||||
throws IOException, UnknownHostException, UnsupportedAudioFileException,
|
||||
InterruptedException
|
||||
{
|
||||
String serverHost = System.getProperty("server.host", "cling.dfki.uni-sb.de");
|
||||
int serverPort = Integer.getInteger("server.port", 59125).intValue();
|
||||
MaryClient mary = MaryClient.getMaryClient(new Address(serverHost, serverPort));
|
||||
String text = "Willkommen in der Welt der Sprachsynthese!";
|
||||
// If the given locale is not supported by the server, it returns
|
||||
// an ambigous exception: "Problem processing the data."
|
||||
String locale = "de"; // or US English (en-US), Telugu (te), Turkish (tr), ...
|
||||
String inputType = "TEXT";
|
||||
String outputType = "AUDIO";
|
||||
String audioType = "WAVE";
|
||||
String defaultVoiceName = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
mary.process(text, inputType, outputType, locale, audioType, defaultVoiceName, baos);
|
||||
// The byte array constitutes a full wave file, including the headers.
|
||||
// And now, play the audio data:
|
||||
AudioInputStream ais = AudioSystem.getAudioInputStream(
|
||||
new ByteArrayInputStream(baos.toByteArray()));
|
||||
LineListener lineListener = new LineListener() {
|
||||
public void update(LineEvent event) {
|
||||
if (event.getType() == LineEvent.Type.START) {
|
||||
System.err.println("Audio started playing.");
|
||||
} else if (event.getType() == LineEvent.Type.STOP) {
|
||||
System.err.println("Audio stopped playing.");
|
||||
} else if (event.getType() == LineEvent.Type.OPEN) {
|
||||
System.err.println("Audio line opened.");
|
||||
} else if (event.getType() == LineEvent.Type.CLOSE) {
|
||||
System.err.println("Audio line closed.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AudioPlayer ap = new AudioPlayer(ais, lineListener);
|
||||
ap.start();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
##########################################################################
|
||||
# Copyright (C) 2000-2006 DFKI GmbH.
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to use and distribute
|
||||
# this software and its documentation without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of this work, and to
|
||||
# permit persons to whom this work is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# 1. The code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
# 2. Any modifications must be clearly marked as such.
|
||||
# 3. Original authors' names are not deleted.
|
||||
# 4. The authors' names are not used to endorse or promote products
|
||||
# derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
# THIS SOFTWARE.
|
||||
##########################################################################
|
||||
|
||||
CC=g++
|
||||
CFLAGS=-Wall -w -O3 -g
|
||||
ICUDIR=/usr/local/icu
|
||||
ICULIBS=-Wl,-R,$(ICUDIR)/lib -L$(ICUDIR)/lib -licuuc -licui18n -ldl
|
||||
|
||||
all: MaryDemo
|
||||
|
||||
MaryDemo: MaryClient.o MaryDemo.o
|
||||
$(CC) $(CFLAGS) *.o -o MaryDemo $(LIBS)
|
||||
|
||||
%.o: %.cc
|
||||
$(CC) $(CFLAGS) $(RFLAGS) -o $@ -c $<
|
||||
|
||||
clean:
|
||||
rm -rf *.o ./MaryDemo
|
||||
|
||||
|
|
@ -1,277 +0,0 @@
|
|||
/**
|
||||
* Copyright 2000-2006 DFKI GmbH.
|
||||
* All Rights Reserved. Use is subject to license terms.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to use and distribute
|
||||
* this software and its documentation without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of this work, and to
|
||||
* permit persons to whom this work is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Any modifications must be clearly marked as such.
|
||||
* 3. Original authors' names are not deleted.
|
||||
* 4. The authors' names are not used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
#include <netdb.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
#include "MaryClient.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* A C++ implementation of a simple client to the MARY TTS system.
|
||||
* result: an empty string serving as the container for the output.
|
||||
* It will return text or audio data; text data will be encoded as UTF-8.
|
||||
* inputText: the UTF-8 encoded text (or XML document) to send as a request
|
||||
* maryInFormat: the input type of the data in inputText, e.g. TEXT
|
||||
* maryOutFormat: the output type to produce, e.g. MBROLA, AUDIO
|
||||
* locale: the language of the input, e.g. EN-US, DE
|
||||
* audioType: for AUDIO output, the type of audio data to produce,
|
||||
* e.g. WAVE or MP3.
|
||||
* voice: the voice to be used, e.g. cmu-slt-hsmm, bits3.
|
||||
* effects: the list of effects to be generated.
|
||||
* return value: 0 on success, negative on failure.
|
||||
*/
|
||||
int
|
||||
MaryClient::maryQuery( int server_port,
|
||||
string server_host,
|
||||
string& result,
|
||||
string inputText,
|
||||
string maryInFormat,
|
||||
string maryOutFormat,
|
||||
string locale,
|
||||
string audioType,
|
||||
string voice,
|
||||
string effects ) {
|
||||
|
||||
// prepare the request
|
||||
string query = "MARY";
|
||||
query += " IN=" + maryInFormat;
|
||||
query += " OUT=" + maryOutFormat;
|
||||
query += " LOCALE=" + locale; // remove this line, if using an older version than MARY 4.0
|
||||
query += " AUDIO=" + audioType;
|
||||
query += " VOICE=" + voice;
|
||||
if (effects != "") {
|
||||
query += " EFFECTS=" + effects;
|
||||
}
|
||||
query += "\012\015";
|
||||
|
||||
//cout << "Constructed query: " << query << endl;
|
||||
|
||||
// declare connection stuff
|
||||
struct sockaddr_in maryServer;
|
||||
struct sockaddr_in maryClient;
|
||||
struct hostent* hostInfo;
|
||||
|
||||
// declare variables
|
||||
int maryInfoSocket;
|
||||
int maryDataSocket;
|
||||
|
||||
// set configuration parameters
|
||||
|
||||
// get host information
|
||||
hostInfo = gethostbyname (server_host.c_str());
|
||||
|
||||
if (hostInfo == NULL)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
// create a tcp connection to the mary server
|
||||
maryInfoSocket = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
// verify that the socket could be opened successfully
|
||||
if (maryInfoSocket == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
// autoflush stdout, bind and connect
|
||||
{
|
||||
maryClient.sin_family = AF_INET;
|
||||
maryClient.sin_port = htons (0);
|
||||
maryClient.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
int status = bind (maryInfoSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
maryServer.sin_family = AF_INET;
|
||||
maryServer.sin_port = htons (server_port);
|
||||
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
|
||||
|
||||
status = connect (maryInfoSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
// send request to the Mary server
|
||||
if (send (maryInfoSocket, query.c_str (), query.size (), 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
// receive the request id
|
||||
char id [32] = "";
|
||||
|
||||
if (recv (maryInfoSocket, id, 32, 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
//cout << "Read id: " << id << endl;
|
||||
|
||||
// create a tcp connection to the mary server
|
||||
maryDataSocket = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
// verify that the socket could be opened successfully
|
||||
if (maryDataSocket == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
// autoflush stdout, bind and connect
|
||||
{
|
||||
maryClient.sin_family = AF_INET;
|
||||
maryClient.sin_port = htons (0);
|
||||
maryClient.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
int status = bind (maryDataSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
maryServer.sin_family = AF_INET;
|
||||
maryServer.sin_port = htons (server_port);
|
||||
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
|
||||
|
||||
status = connect (maryDataSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// send the request id to the Mary server
|
||||
if (send (maryDataSocket, id, strlen (id), 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
//cout << "Sending request: " << inputText << endl;
|
||||
|
||||
// send the query to the Mary server
|
||||
if (send (maryDataSocket, inputText.c_str (), inputText.size (), 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (send (maryDataSocket, "\012\015", 2, 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
// shutdown data socket
|
||||
shutdown (maryDataSocket, 1);
|
||||
|
||||
|
||||
//cout << "Reading result" << endl;
|
||||
|
||||
unsigned int total_bytes = 0;
|
||||
int recv_bytes = 0;
|
||||
char data [1024] = "";
|
||||
|
||||
result [0] = '\0';
|
||||
|
||||
// receive the request result
|
||||
do
|
||||
{
|
||||
data [0] = '\0';
|
||||
|
||||
recv_bytes = recv (maryDataSocket, data, 1024, 0);
|
||||
|
||||
if (recv_bytes == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else if (recv_bytes > 0)
|
||||
{
|
||||
//cout << "("<<recv_bytes<<")" << endl;
|
||||
total_bytes += recv_bytes;
|
||||
data [recv_bytes] = '\0';
|
||||
|
||||
if (maryOutFormat == "AUDIO")
|
||||
{
|
||||
for (unsigned int i=0; i<recv_bytes; i++)
|
||||
{
|
||||
result += data [i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += data;
|
||||
}
|
||||
}
|
||||
} while (recv_bytes != 0);
|
||||
|
||||
if (result.size () != total_bytes)
|
||||
{
|
||||
cerr << "error: total bytes received != result bytes!" << endl;
|
||||
cerr << " total bytes received = " << total_bytes << endl;
|
||||
cerr << " result bytes = " << result.size () << endl;
|
||||
}
|
||||
|
||||
// receive the request error
|
||||
do
|
||||
{
|
||||
data [0] = '\0';
|
||||
|
||||
recv_bytes = recv (maryInfoSocket, data, 1024, 0);
|
||||
|
||||
if (recv_bytes == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else if (recv_bytes > 0)
|
||||
{
|
||||
cerr << endl << "Mary error code: " << data << endl;
|
||||
return -3;
|
||||
}
|
||||
} while (recv_bytes != 0);
|
||||
|
||||
// close all open sockets
|
||||
close (maryInfoSocket);
|
||||
close (maryDataSocket);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,290 +0,0 @@
|
|||
/**
|
||||
* Copyright 2000-2006 DFKI GmbH.
|
||||
* All Rights Reserved. Use is subject to license terms.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to use and distribute
|
||||
* this software and its documentation without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of this work, and to
|
||||
* permit persons to whom this work is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Any modifications must be clearly marked as such.
|
||||
* 3. Original authors' names are not deleted.
|
||||
* 4. The authors' names are not used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
// use compiler option -L/<path to>/libwsock32.a
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
#include "MaryClient.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* A C++ implementation of a simple client to the MARY TTS system.
|
||||
* result: an empty string serving as the container for the output.
|
||||
* It will return text or audio data; text data will be encoded as UTF-8.
|
||||
* inputText: the UTF-8 encoded text (or XML document) to send as a request
|
||||
* maryInFormat: the input type of the data in inputText, e.g. TEXT
|
||||
* maryOutFormat: the output type to produce, e.g. MBROLA, AUDIO
|
||||
* locale: the language of the input, e.g. EN-US, DE
|
||||
* audioType: for AUDIO output, the type of audio data to produce,
|
||||
* e.g. WAVE or MP3.
|
||||
* voice: the voice to be used, e.g. cmu-slt-hsmm, bits3.
|
||||
* effects: the list of effects to be generated.
|
||||
* return value: 0 on success, negative on failure.
|
||||
*/
|
||||
int
|
||||
MaryClient::maryQuery( int server_port,
|
||||
string server_host,
|
||||
string& result,
|
||||
string inputText,
|
||||
string maryInFormat,
|
||||
string maryOutFormat,
|
||||
string locale,
|
||||
string audioType,
|
||||
string voice,
|
||||
string effects ) {
|
||||
|
||||
// prepare the request
|
||||
string query = "MARY";
|
||||
query += " IN=" + maryInFormat;
|
||||
query += " OUT=" + maryOutFormat;
|
||||
query += " LOCALE=" + locale; // remove this line, if using an older version than MARY 4.0
|
||||
query += " AUDIO=" + audioType;
|
||||
query += " VOICE=" + voice;
|
||||
if (effects != "") {
|
||||
query += " EFFECTS=" + effects;
|
||||
}
|
||||
query += "\012\015";
|
||||
|
||||
//cout << "Constructed query: " << query << endl;
|
||||
|
||||
// declare connection stuff
|
||||
struct sockaddr_in maryServer;
|
||||
struct sockaddr_in maryClient;
|
||||
struct hostent* hostInfo;
|
||||
|
||||
// declare variables
|
||||
int maryInfoSocket;
|
||||
int maryDataSocket;
|
||||
|
||||
// set configuration parameters
|
||||
|
||||
// get host information
|
||||
hostInfo = gethostbyname (server_host.c_str());
|
||||
|
||||
if (hostInfo == NULL)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
// create a tcp connection to the mary server
|
||||
maryInfoSocket = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
// verify that the socket could be opened successfully
|
||||
if (maryInfoSocket == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
// autoflush stdout, bind and connect
|
||||
{
|
||||
maryClient.sin_family = AF_INET;
|
||||
maryClient.sin_port = htons (0);
|
||||
maryClient.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
int status = bind (maryInfoSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
maryServer.sin_family = AF_INET;
|
||||
maryServer.sin_port = htons (server_port);
|
||||
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
|
||||
|
||||
status = connect (maryInfoSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
// send request to the Mary server
|
||||
if (send (maryInfoSocket, query.c_str (), query.size (), 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
// receive the request id
|
||||
char id [32] = "";
|
||||
|
||||
if (recv (maryInfoSocket, id, 32, 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
//cout << "Read id: " << id << endl;
|
||||
|
||||
// create a tcp connection to the mary server
|
||||
maryDataSocket = socket (AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
// verify that the socket could be opened successfully
|
||||
if (maryDataSocket == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else
|
||||
// autoflush stdout, bind and connect
|
||||
{
|
||||
maryClient.sin_family = AF_INET;
|
||||
maryClient.sin_port = htons (0);
|
||||
maryClient.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
int status = bind (maryDataSocket, (struct sockaddr*) &maryClient, sizeof (maryClient));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
maryServer.sin_family = AF_INET;
|
||||
maryServer.sin_port = htons (server_port);
|
||||
memcpy ((char*) &maryServer.sin_addr.s_addr, hostInfo->h_addr_list [0], hostInfo->h_length);
|
||||
|
||||
status = connect (maryDataSocket, (struct sockaddr*) &maryServer, sizeof (maryServer));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// send the request id to the Mary server
|
||||
if (send (maryDataSocket, id, strlen (id), 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
//cout << "Sending request: " << inputText << endl;
|
||||
|
||||
// send the query to the Mary server
|
||||
if (send (maryDataSocket, inputText.c_str (), inputText.size (), 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (send (maryDataSocket, "\012\015", 2, 0) == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
// shutdown data socket
|
||||
shutdown (maryDataSocket, 1);
|
||||
|
||||
|
||||
//cout << "Reading result" << endl;
|
||||
|
||||
unsigned int total_bytes = 0;
|
||||
int recv_bytes = 0;
|
||||
char data [1024] = "";
|
||||
|
||||
result [0] = '\0';
|
||||
|
||||
// receive the request result
|
||||
do
|
||||
{
|
||||
data [0] = '\0';
|
||||
|
||||
recv_bytes = recv (maryDataSocket, data, 1024, 0);
|
||||
|
||||
if (recv_bytes == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else if (recv_bytes > 0)
|
||||
{
|
||||
//cout << "("<<recv_bytes<<")" << endl;
|
||||
total_bytes += recv_bytes;
|
||||
data [recv_bytes] = '\0';
|
||||
|
||||
if (maryOutFormat == "AUDIO")
|
||||
{
|
||||
for (unsigned int i=0; i<recv_bytes; i++)
|
||||
{
|
||||
result += data [i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result += data;
|
||||
}
|
||||
}
|
||||
} while (recv_bytes != 0);
|
||||
|
||||
if (result.size () != total_bytes)
|
||||
{
|
||||
cerr << "error: total bytes received != result bytes!" << endl;
|
||||
cerr << " total bytes received = " << total_bytes << endl;
|
||||
cerr << " result bytes = " << result.size () << endl;
|
||||
}
|
||||
|
||||
// receive the request error
|
||||
do
|
||||
{
|
||||
data [0] = '\0';
|
||||
|
||||
recv_bytes = recv (maryInfoSocket, data, 1024, 0);
|
||||
|
||||
if (recv_bytes == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
else if (recv_bytes > 0)
|
||||
{
|
||||
cerr << endl << "Mary error code: " << data << endl;
|
||||
return -3;
|
||||
}
|
||||
} while (recv_bytes != 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
// close all open sockets Windows
|
||||
closesocket (maryInfoSocket);
|
||||
closesocket (maryDataSocket);
|
||||
#else
|
||||
// close all open sockets UNIX
|
||||
close (maryInfoSocket);
|
||||
close (maryDataSocket);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* Copyright 2000-2006 DFKI GmbH.
|
||||
* All Rights Reserved. Use is subject to license terms.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to use and distribute
|
||||
* this software and its documentation without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of this work, and to
|
||||
* permit persons to whom this work is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Any modifications must be clearly marked as such.
|
||||
* 3. Original authors' names are not deleted.
|
||||
* 4. The authors' names are not used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef __MARYCLIENT_H_
|
||||
#define __MARYCLIENT_H_
|
||||
|
||||
class MaryClient {
|
||||
|
||||
public:
|
||||
// send query to the MaryServer
|
||||
int maryQuery( int server_port,
|
||||
std::string server_host,
|
||||
std::string& result,
|
||||
std::string inputText,
|
||||
std::string maryInFormat,
|
||||
std::string maryOutFormat,
|
||||
std::string locale,
|
||||
std::string audioType,
|
||||
std::string voice,
|
||||
std::string effects = "" );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/**
|
||||
* Copyright 2000-2006 DFKI GmbH.
|
||||
* All Rights Reserved. Use is subject to license terms.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to use and distribute
|
||||
* this software and its documentation without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of this work, and to
|
||||
* permit persons to whom this work is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* 1. The code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Any modifications must be clearly marked as such.
|
||||
* 3. Original authors' names are not deleted.
|
||||
* 4. The authors' names are not used to endorse or promote products
|
||||
* derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
* REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
// This version, adapted to MARY 4.0, provided by Sebastian Ptock.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "MaryClient.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* Demonstration code for using the MaryClient.
|
||||
+ Call this as:
|
||||
* ./MaryDemo
|
||||
* or
|
||||
* ./MaryDemo > output.wav
|
||||
*/
|
||||
int main() {
|
||||
int server_port = 59125;
|
||||
string server_host = "localhost";
|
||||
string inputText = "Welcome to the world of speech synthesis!";
|
||||
string maryInFormat = "TEXT";
|
||||
string maryOutFormat = "AUDIO";
|
||||
//string maryOutFormat = "REALISED_DURATIONS";
|
||||
string locale = "en-US";
|
||||
string audioType = "WAV_FILE";
|
||||
string voice = "cmu-slt-hsmm";
|
||||
string effects;
|
||||
// effects += "Volume(amount:5.0;)+";
|
||||
// effects += "TractScaler(amount:1.5;)+";
|
||||
// effects += "F0Scale(f0Scale:2.0;)+";
|
||||
// effects += "F0Add(f0Add:50.0;)+";
|
||||
// effects += "Rate(durScale:1.5;)+";
|
||||
// effects += "Robot(amount:100.0;)+";
|
||||
// effects += "Whisper(amount:100.0;)+";
|
||||
// effects += "Stadium(amount:100.0)+";
|
||||
// effects += "Chorus(delay1:466;amp1:0.54;delay2:600;amp2:-0.10;delay3:250;amp3:0.30)+";
|
||||
// effects += "FIRFilter(type:3;fc1:500.0;fc2:2000.0)+";
|
||||
// effects += "JetPilot";
|
||||
string result;
|
||||
|
||||
MaryClient maryClient;
|
||||
maryClient.maryQuery( server_port, server_host, result, inputText, maryInFormat, maryOutFormat, locale, audioType, voice, effects);
|
||||
|
||||
if (maryOutFormat == "AUDIO") {
|
||||
// write result into a file
|
||||
const char *filename = "output.wav";
|
||||
ofstream file( filename );
|
||||
file << result;
|
||||
|
||||
// play output
|
||||
//system("play output.wav");
|
||||
} else {
|
||||
cout << "RESULT: " << endl << result << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
Start MARY as a socket server:
|
||||
|
||||
maryserver -Dserver=socket
|
||||
(or change entry 'server' in conf/marybase.config)
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
import httplib, urllib
|
||||
|
||||
# A basic mary client in Python,
|
||||
# kindly donated to the MARY TTS project
|
||||
# by Hugh Sasse. Thanks Hugh!
|
||||
|
||||
# A very basic Python class for accessing
|
||||
# the MARY TTS system using the modern
|
||||
# HTTP server.
|
||||
# Warning, this is probably ghastly Python,
|
||||
# most of my time of late has been with
|
||||
# other languages, so I'm not up to date
|
||||
# with all the stylistic conventions of
|
||||
# modern Python.
|
||||
# This does seem to work OK though.
|
||||
|
||||
class maryclient:
|
||||
"""A basic handler for MARY-TTS HTTP clients
|
||||
|
||||
At present, there is no checking for
|
||||
allowed voices, locales, and so on.
|
||||
Most of the useful parameters can be
|
||||
accessed by get_ and set_ methods.
|
||||
Relying on winsound, this is Windows
|
||||
specific.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""Set up useful defaults (for
|
||||
people in England, anyway)"""
|
||||
self.host = "127.0.0.1"
|
||||
self.port = 59125
|
||||
self.input_type = "TEXT"
|
||||
self.output_type = "AUDIO"
|
||||
self.audio = "WAVE_FILE"
|
||||
self.locale = "en_GB"
|
||||
self.voice = "dfki-prudence-hsmm"
|
||||
|
||||
def set_host(self, a_host):
|
||||
"""Set the host for the TTS server."""
|
||||
self.host = a_host
|
||||
|
||||
def get_host(self):
|
||||
"""Get the host for the TTS server."""
|
||||
self.host
|
||||
|
||||
def set_port(self, a_port):
|
||||
"""Set the port for the TTS server."""
|
||||
self.port = a_port
|
||||
|
||||
def get_port(self):
|
||||
"""Get the port for the TTS server."""
|
||||
self.port
|
||||
|
||||
def set_input_type(self, type):
|
||||
"""Set the type of input being
|
||||
supplied to the TTS server
|
||||
(such as 'TEXT')."""
|
||||
self.input_type = type
|
||||
|
||||
def get_input_type(self):
|
||||
"""Get the type of input being
|
||||
supplied to the TTS server
|
||||
(such as 'TEXT')."""
|
||||
self.input_type
|
||||
|
||||
def set_output_type(self, type):
|
||||
"""Set the type of input being
|
||||
supplied to the TTS server
|
||||
(such as 'AUDIO')."""
|
||||
self.output_type = type
|
||||
|
||||
def get_output_type(self):
|
||||
"""Get the type of input being
|
||||
supplied to the TTS server
|
||||
(such as "AUDIO")."""
|
||||
self.output_type
|
||||
|
||||
def set_locale(self, a_locale):
|
||||
"""Set the locale
|
||||
(such as "en_GB")."""
|
||||
self.locale = a_locale
|
||||
|
||||
def get_locale(self):
|
||||
"""Get the locale
|
||||
(such as "en_GB")."""
|
||||
self.locale
|
||||
|
||||
def set_audio(self, audio_type):
|
||||
"""Set the audio type for playback
|
||||
(such as "WAVE_FILE")."""
|
||||
self.audio = audio_type
|
||||
|
||||
def get_audio(self):
|
||||
"""Get the audio type for playback
|
||||
(such as "WAVE_FILE")."""
|
||||
self.audio
|
||||
|
||||
def set_voice(self, a_voice):
|
||||
"""Set the voice to speak with
|
||||
(such as "dfki-prudence-hsmm")."""
|
||||
self.voice = a_voice
|
||||
|
||||
def get_voice(self):
|
||||
"""Get the voice to speak with
|
||||
(such as "dfki-prudence-hsmm")."""
|
||||
self.voice
|
||||
|
||||
def generate(self, message):
|
||||
"""Given a message in message,
|
||||
return a response in the appropriate
|
||||
format."""
|
||||
raw_params = {"INPUT_TEXT": message,
|
||||
"INPUT_TYPE": self.input_type,
|
||||
"OUTPUT_TYPE": self.output_type,
|
||||
"LOCALE": self.locale,
|
||||
"AUDIO": self.audio,
|
||||
"VOICE": self.voice,
|
||||
}
|
||||
params = urllib.urlencode(raw_params)
|
||||
headers = {}
|
||||
|
||||
# Open connection to self.host, self.port.
|
||||
conn = httplib.HTTPConnection(self.host, self.port)
|
||||
|
||||
# conn.set_debuglevel(5)
|
||||
|
||||
conn.request("POST", "/process", params, headers)
|
||||
response = conn.getresponse()
|
||||
if response.status != 200:
|
||||
print response.getheaders()
|
||||
raise RuntimeError("{0}: {1}".format(response.status,
|
||||
response.reason))
|
||||
return response.read()
|
||||
|
||||
# If this is invoked as a program, just give
|
||||
# a greeting to show it is working.
|
||||
# The platform specific code is moved to this
|
||||
# part so that this file may be imported without
|
||||
# bringing platform specific code in.
|
||||
if __name__ == "__main__":
|
||||
|
||||
# For handling command line arguments:
|
||||
import sys
|
||||
import platform
|
||||
|
||||
# check we are on Windows:
|
||||
system = platform.system().lower()
|
||||
if (system == "windows"):
|
||||
|
||||
import winsound
|
||||
|
||||
class Player:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def play(self, a_sound):
|
||||
winsound.PlaySound(a_sound, winsound.SND_MEMORY)
|
||||
|
||||
#if ("cygwin" in system):
|
||||
else:
|
||||
# Not sure how to do audio on cygwin,
|
||||
# portably for python. So have a sound
|
||||
# player class that doesn't play sounds.
|
||||
# A null object, if you like.
|
||||
class Player:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def play(self, a_sound):
|
||||
print("Here I would play a sound if I knew how")
|
||||
pass
|
||||
|
||||
# Probably want to parse arguments to
|
||||
# set the voice, etc., here
|
||||
|
||||
client = maryclient()
|
||||
client.set_audio("WAVE_FILE") # for example
|
||||
|
||||
player = Player()
|
||||
the_sound = client.generate("hello from Mary Text to Speech, with Python.")
|
||||
if client.output_type == "AUDIO":
|
||||
player.play(the_sound)
|
||||
|
||||
# vi:set sw=4 et:
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
#!/usr/bin/perl -T
|
||||
# -*- Mode: Perl -*-
|
||||
# MARY Text-to-Speech System
|
||||
# CGI Script implementing a simple mary client,
|
||||
# can be used for web pages.
|
||||
##########################################################################
|
||||
# Copyright (C) 2000-2006 DFKI GmbH.
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to use and distribute
|
||||
# this software and its documentation without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of this work, and to
|
||||
# permit persons to whom this work is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# 1. The code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
# 2. Any modifications must be clearly marked as such.
|
||||
# 3. Original authors' names are not deleted.
|
||||
# 4. The authors' names are not used to endorse or promote products
|
||||
# derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
# THIS SOFTWARE.
|
||||
##########################################################################
|
||||
# Author: Marc Schroeder
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
use CGI;
|
||||
|
||||
# variables getting their values from form:
|
||||
my ($inputtext, $in, $out, $audiotype, $voice);
|
||||
|
||||
# little helpers:
|
||||
my ($var, $tmp);
|
||||
|
||||
# contacting the mary server:
|
||||
my ($host, $port, $maryInfoSocket, $maryDataSocket, $id);
|
||||
|
||||
# helping with audio output:
|
||||
my ($save_to_disk, $audiosubtype, $filename);
|
||||
|
||||
|
||||
my $cgi = new CGI;
|
||||
my @param = $cgi->param();
|
||||
$inputtext = $cgi->param('inputtext');
|
||||
$in = $cgi->param('in');
|
||||
$out = $cgi->param('out');
|
||||
$audiotype = $cgi->param('audiotype');
|
||||
$save_to_disk = $cgi->param('save_to_disk');
|
||||
$voice = $cgi->param('voice');
|
||||
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
||||
$year += 1900;
|
||||
printf STDERR "[%04i-%02i-%02i %02i:%02i:%02i] ", $year, $mon, $mday, $hour, $min, $sec;
|
||||
print STDERR "Request from ",$cgi->remote_user(),"@",$cgi->remote_host(),": \n";
|
||||
print STDERR " in=",$in;
|
||||
print STDERR " out=",$out;
|
||||
print STDERR " audiotype=",$audiotype;
|
||||
print STDERR " voice=",$voice;
|
||||
print STDERR " save_to_disk=",$save_to_disk,"\n";
|
||||
print STDERR " inputtext: ";
|
||||
print STDERR $inputtext,"\n";
|
||||
|
||||
|
||||
# Limit inputtext length to 5000 bytes:
|
||||
if (length $inputtext > 5000) {
|
||||
$inputtext = substr $inputtext, 0, 5000;
|
||||
}
|
||||
|
||||
|
||||
# set audio subtype
|
||||
if ($out eq "AUDIO") {
|
||||
if ($audiotype eq "AU") {
|
||||
$audiosubtype = "basic";
|
||||
$filename = "mary.au";
|
||||
} elsif ($audiotype eq "AIFF") {
|
||||
$audiosubtype = "x-aiff";
|
||||
$filename = "mary.aiff";
|
||||
} elsif ($audiotype eq "WAVE") {
|
||||
$audiosubtype = "x-wav";
|
||||
$filename = "mary.wav";
|
||||
} elsif ($audiotype eq "MP3") {
|
||||
$audiosubtype = "mp3";
|
||||
$filename = "mary.mp3";
|
||||
} else {
|
||||
$audiosubtype = "x-wav";
|
||||
$filename = "mary.wav";
|
||||
}
|
||||
}
|
||||
|
||||
# announce data type on stdout
|
||||
if ($save_to_disk) {
|
||||
print "Content-Type: application/octet-stream";
|
||||
} else {
|
||||
print "Content-Type: audio/$audiosubtype";
|
||||
}
|
||||
print "\nContent-Disposition: filename=\"$filename\"\n\n";
|
||||
|
||||
# contact mary server
|
||||
$host = "cling.dfki.uni-sb.de";
|
||||
$port = 59125;
|
||||
|
||||
# create a tcp connection to the specified host and port
|
||||
$maryInfoSocket = IO::Socket::INET->new(Proto => "tcp",
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port)
|
||||
or die "can't connect to port $port on $host: $!";
|
||||
|
||||
# avoid buffering when writing to server:
|
||||
$maryInfoSocket->autoflush(1); # so output gets there right away
|
||||
|
||||
########## Write input to server: ##########
|
||||
# formulate the request:
|
||||
print $maryInfoSocket "MARY IN=$in OUT=$out AUDIO=$audiotype";
|
||||
if ($voice && $voice ne 'v') { print $maryInfoSocket " VOICE=$voice"; }
|
||||
print $maryInfoSocket " LOG=\"REMOTE_HOST=$ENV{'REMOTE_HOST'}",
|
||||
", REMOTE_ADDR=$ENV{'REMOTE_ADDR'}\"";
|
||||
print $maryInfoSocket "\015\012";
|
||||
|
||||
# receive a request ID:
|
||||
$id = <$maryInfoSocket>;
|
||||
|
||||
# open second socket for the data:
|
||||
$maryDataSocket = IO::Socket::INET->new(Proto => "tcp",
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port)
|
||||
or die "can't connect to port $port on $host: $!";
|
||||
# identify with request number:
|
||||
print $maryDataSocket $id; # $id contains a newline character
|
||||
|
||||
# copy $inputtext to mary data socket
|
||||
print $maryDataSocket $inputtext;
|
||||
|
||||
# mark end-of-request:
|
||||
print $maryDataSocket "\015\012"; # that is a \n, actually
|
||||
$maryDataSocket->shutdown(1); # we have stopped writing data
|
||||
|
||||
########## Read output from server: ##########
|
||||
# copy the data socket to standard output
|
||||
if ($out ne "AUDIO") { # text output
|
||||
my $line;
|
||||
while (defined ($line = <$maryDataSocket>)) {
|
||||
print STDOUT $line;
|
||||
}
|
||||
} else { # audio data output
|
||||
my $nr; # number of bytes read
|
||||
my $buf; # buffer to read into
|
||||
my $outnr; # number of bytes written
|
||||
while($nr = read($maryDataSocket, $buf, 8192)) {
|
||||
# (read returns no. of bytes read, 0 at eof)
|
||||
print STDOUT $buf
|
||||
or die "Write error on stdout";
|
||||
} # while read something from socket
|
||||
} # audio output
|
||||
|
||||
### Read complaints from server:
|
||||
my $line;
|
||||
while (defined ($line = <$maryInfoSocket>)) {
|
||||
print STDERR $line;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
#
|
||||
# MARY Text-to-Speech System
|
||||
# Minimal Socket client (for demonstration)
|
||||
##########################################################################
|
||||
# Copyright (C) 2000-2006 DFKI GmbH.
|
||||
# All rights reserved. Use is subject to license terms.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to use and distribute
|
||||
# this software and its documentation without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of this work, and to
|
||||
# permit persons to whom this work is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# 1. The code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
# 2. Any modifications must be clearly marked as such.
|
||||
# 3. Original authors' names are not deleted.
|
||||
# 4. The authors' names are not used to endorse or promote products
|
||||
# derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
# THIS SOFTWARE.
|
||||
##########################################################################
|
||||
# Author: Marc Schroeder
|
||||
# This is a minimal version of a socket client for the mary TtS system.
|
||||
# It is intended to be used as a model for writing socket clients for
|
||||
# particular applications. All input verification, command line options,
|
||||
# and other luxury have been omitted.
|
||||
#
|
||||
# Usage:
|
||||
# maryclient.pl infile.txt > outfile.wav
|
||||
#
|
||||
# Input/output formats and other options must be set in the perl code directly.
|
||||
# See also Protocol.html for a description of the Protocol.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
|
||||
############################
|
||||
# Package-global variables #
|
||||
############################
|
||||
# global settings:
|
||||
my $maryInfoSocket; # handle to socket server
|
||||
my $maryDataSocket; # handle to socket server
|
||||
my $host; # string containing host address
|
||||
my $port; # socket port on which we listen
|
||||
my ($in, $out, $audiotype); # requested input / output format
|
||||
my $voice; # default voice
|
||||
my $id; # request ID
|
||||
|
||||
######################################################################
|
||||
################################ main ################################
|
||||
######################################################################
|
||||
|
||||
STDOUT->autoflush(1);
|
||||
|
||||
$host = "cling.dfki.uni-sb.de";
|
||||
$port = 59125;
|
||||
$in = "TEXT_DE";
|
||||
$out = "AUDIO";
|
||||
$audiotype = "MP3";
|
||||
#$audiotype = "WAVE";
|
||||
#$voice = "male";
|
||||
$voice = "de3";
|
||||
|
||||
# create a tcp connection to the specified host and port
|
||||
$maryInfoSocket = IO::Socket::INET->new(Proto => "tcp",
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port)
|
||||
or die "can't connect to port $port on $host: $!";
|
||||
|
||||
# avoid buffering when writing to server:
|
||||
$maryInfoSocket->autoflush(1); # so output gets there right away
|
||||
|
||||
########## Write input to server: ##########
|
||||
# formulate the request:
|
||||
print $maryInfoSocket "MARY IN=$in OUT=$out AUDIO=$audiotype";
|
||||
if ($voice) { print $maryInfoSocket " VOICE=$voice"; }
|
||||
print $maryInfoSocket "\015\012";
|
||||
|
||||
# receive a request ID:
|
||||
$id = <$maryInfoSocket>;
|
||||
chomp $id; chomp $id;
|
||||
|
||||
# open second socket for the data:
|
||||
$maryDataSocket = IO::Socket::INET->new(Proto => "tcp",
|
||||
PeerAddr => $host,
|
||||
PeerPort => $port)
|
||||
or die "can't connect to port $port on $host: $!";
|
||||
# identify with request number:
|
||||
print $maryDataSocket $id, "\015\012";
|
||||
|
||||
# copy standard input and/or files given on the command line to the socket
|
||||
while (defined (my $line = <>)) {
|
||||
print $maryDataSocket $line;
|
||||
}
|
||||
# mark end-of-request:
|
||||
print $maryDataSocket "\015\012"; # that is a \n, actually
|
||||
shutdown($maryDataSocket, 1); # we have stopped writing data
|
||||
|
||||
########## Read output from server: ##########
|
||||
# copy the data socket to standard output
|
||||
if ($out ne "AUDIO") { # text output
|
||||
my $line;
|
||||
while (defined ($line = <$maryDataSocket>)) {
|
||||
print STDOUT $line;
|
||||
}
|
||||
} else { # audio data output
|
||||
my $nr; # number of bytes read
|
||||
my $buf; # buffer to read into
|
||||
my $outnr; # number of bytes written
|
||||
while($nr = read($maryDataSocket, $buf, 100000)) {
|
||||
# (read returns no. of bytes read, 0 at eof)
|
||||
print STDOUT $buf
|
||||
or die "Write error on stdout";
|
||||
} # while read something from socket
|
||||
} # audio output
|
||||
|
||||
### Read complaints from server:
|
||||
my $line;
|
||||
while (defined ($line = <$maryInfoSocket>)) {
|
||||
print STDERR $line;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
#
|
||||
# A basic mary client in Ruby,
|
||||
# kindly donated to the MARY TTS project
|
||||
# by Hugh Sasse. Thanks Hugh!
|
||||
|
||||
|
||||
# Ruby client for the MARY TTS HTTP server.
|
||||
# This is for Windows only, and relies on
|
||||
# the Win32-Sound gem to access the audio.
|
||||
#
|
||||
#
|
||||
|
||||
require 'rubygems'
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
# A fairly minimal client class for the
|
||||
# MARY TTS system. This uses the modern
|
||||
# HTTP interface to access the server.
|
||||
# At present, this doesn't wrap the methods
|
||||
# which provide documentation or lists of
|
||||
# voices or features.
|
||||
class MaryClient
|
||||
attr_accessor :host, :port
|
||||
attr_accessor :input_type, :output_type
|
||||
attr_accessor :locale, :audio, :voice
|
||||
|
||||
# Set up the defaults for the MARY TTS
|
||||
# server, which is assumed to be running
|
||||
# on the local host, with British voices
|
||||
# installed. These may be modified with
|
||||
# the appropriate methods.
|
||||
# host = 127.0.0.1)
|
||||
# port = 59125
|
||||
# input_type = "TEXT"
|
||||
# output_type = "AUDIO"
|
||||
# audio = "WAVE_FILE"
|
||||
# locale = "en_GB"
|
||||
# voice = "dfki-prudence-hsmm"
|
||||
def initialize
|
||||
@host = "127.0.0.1" # The local machine
|
||||
@port = 59125
|
||||
@input_type = "TEXT"
|
||||
@output_type = "AUDIO"
|
||||
@locale = "en_GB"
|
||||
@audio = "WAVE_FILE"
|
||||
@voice = "dfki-prudence-hsmm"
|
||||
end
|
||||
|
||||
# Process a text message, which with a
|
||||
# new client, will return the audio.
|
||||
# This is so that platform dependent parts
|
||||
# are kept separate.
|
||||
def generate(message)
|
||||
raw_params = {"INPUT_TEXT" => message,
|
||||
"INPUT_TYPE" => @input_type,
|
||||
"OUTPUT_TYPE" => @output_type,
|
||||
"LOCALE" => @locale,
|
||||
"AUDIO" => @audio,
|
||||
"VOICE" => @voice,
|
||||
}
|
||||
res = Net::HTTP.post_form(URI.parse("http://#{@host}:#{@port}/process"), raw_params)
|
||||
res.value # Throw an exception on failure
|
||||
#puts res.body
|
||||
return res.body
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# If this invoked as a program with no
|
||||
# argumens, just give a greeting to show
|
||||
# that it is working. If arguments are
|
||||
# supplied, process options to work out
|
||||
# what to do with the arguments.
|
||||
if __FILE__ == $0
|
||||
|
||||
# These files are only loaded when this is
|
||||
# invoked as a program.
|
||||
require 'rbconfig'
|
||||
require 'getoptlong'
|
||||
|
||||
# PLATFORM SPECIFIC CODE.
|
||||
# Needs more work [!]
|
||||
case Config::CONFIG['host_os']
|
||||
when /darwin/i
|
||||
raise NotImplementedError.new("Don't know how to play audio on a Mac")
|
||||
when /linux/i
|
||||
raise NotImplementedError.new("Far too many ways to play audio on Linux, you'll need to choose something")
|
||||
when /sunos|solaris/i
|
||||
raise NotImplementedError.new("Have not played audio on Suns for too long to implement this.")
|
||||
when /java/i
|
||||
raise NotImplementedError.new("Don't know how to play audio from Java ")
|
||||
when /win32|cygwin|mingw32/i
|
||||
# The various things that can use the Win32
|
||||
# sound gem
|
||||
require 'win32/sound'
|
||||
# Create a player class that will play the
|
||||
# sound that the Mary TTS system returns
|
||||
class Player
|
||||
|
||||
# Play the audio passed in.
|
||||
# Possibly this should receive the audio
|
||||
# type so we can check that we can play it,
|
||||
# but at the moment that is the
|
||||
# responsibility of the user.
|
||||
def self.play(sound)
|
||||
Win32::Sound.play(sound, Win32::Sound::MEMORY)
|
||||
end
|
||||
end
|
||||
else
|
||||
raise NotImplementedError.new("Haven't thought how to support this OS yet")
|
||||
end
|
||||
|
||||
|
||||
client = nil
|
||||
split = ""
|
||||
|
||||
if ARGV.size.zero?
|
||||
client = MaryClient.new()
|
||||
sound = client.generate("Hello from Mary Text to Speech with Ruby.")
|
||||
Player.play(sound)
|
||||
else
|
||||
args_mode = :words
|
||||
stdout_mode = :absorb
|
||||
opts = GetoptLong::new(
|
||||
["--audio", "-a", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--echo", "-e", GetoptLong::NO_ARGUMENT],
|
||||
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
||||
["--host", "-H", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--input-type", "-i", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--locale", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--read", "-r", GetoptLong::NO_ARGUMENT],
|
||||
|
||||
["--split", "-s", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--output-type", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--port", "-P", GetoptLong::REQUIRED_ARGUMENT],
|
||||
["--tee", "-t", GetoptLong::NO_ARGUMENT],
|
||||
["--voice", "-v", GetoptLong::REQUIRED_ARGUMENT]
|
||||
)
|
||||
|
||||
opts.each do |opt, arg|
|
||||
unless ["--help", "-h"].include?(opt)
|
||||
# skip if we are only getting help
|
||||
client ||= MaryClient.new()
|
||||
end
|
||||
case opt
|
||||
when "--help", "-h"
|
||||
puts <<-EOHELP
|
||||
Usage: #{$0} [options] [arguments]
|
||||
--audio -a
|
||||
Audio format. Defualt: WAVE_FILE
|
||||
--echo -e
|
||||
Act as an echo command and send output
|
||||
arguments to the synthesizer only (not
|
||||
to standard output.
|
||||
Turns off --read|-r
|
||||
--help -h
|
||||
Print this help, then exit.
|
||||
--host -H
|
||||
The host which is the server.
|
||||
Default: 127.0.0.1
|
||||
--input-type -i
|
||||
The type of the input supplied to the
|
||||
TTS system. Default: TEXT
|
||||
--locale -l
|
||||
The locale of the input. Default: en_GB
|
||||
--output-type -o
|
||||
The output type from the TTS system.
|
||||
Default: AUDIO
|
||||
--port -P
|
||||
The port for the TTS server
|
||||
Default: 59125
|
||||
--read -r
|
||||
Read the files passed as arguments.
|
||||
Turns off --echo|-e
|
||||
--split -s (lines|paragraphs)
|
||||
When reading files, split the input
|
||||
into lines or paragraphs. Paragraphs
|
||||
mean reading up to the next double
|
||||
newline. Note, the argument is literally
|
||||
"lines" or "paragraphs" (or some
|
||||
abbreviation of those) without the
|
||||
quotes.
|
||||
Default is paragraphs.
|
||||
--tee -t
|
||||
Act as tee: send the output to the TTS
|
||||
system, and to standard output.
|
||||
--voice -v
|
||||
The voice to use.
|
||||
Default: dfki-prudence-hsmm
|
||||
EOHELP
|
||||
exit(0)
|
||||
when "--audio", "-a"
|
||||
client.audio = arg
|
||||
when "--echo", "-e"
|
||||
args_mode = :words
|
||||
when "--host", "-H"
|
||||
client.host = arg
|
||||
when "--input-type", "-i"
|
||||
client.input_type = arg
|
||||
when "--locale", "-l"
|
||||
client.locale = arg
|
||||
when "--output-type", "-o"
|
||||
client.output_type = arg
|
||||
when "--port", "-P"
|
||||
client.port = arg.to_i
|
||||
when "--read", "-r"
|
||||
args_mode = :files
|
||||
when "--split", "-s"
|
||||
case arg
|
||||
when /^p/i
|
||||
split = ""
|
||||
when /^l/i
|
||||
split = $/
|
||||
end
|
||||
when "--tee", "-t"
|
||||
stdout_mode = :emit
|
||||
when "--voice", "-v"
|
||||
client.voice = arg
|
||||
end
|
||||
end
|
||||
|
||||
client ||= MaryClient.new()
|
||||
case args_mode
|
||||
when :words
|
||||
input_text = ARGV.join(" ")
|
||||
unless input_text =~ /\A\s*\Z/m
|
||||
sound = client.generate(input_text)
|
||||
if client.output_type == "AUDIO"
|
||||
Player.play(sound)
|
||||
end
|
||||
end
|
||||
if stdout_mode == :emit
|
||||
puts input_text
|
||||
end
|
||||
when :files
|
||||
# Slurp in paragraphs so sentences
|
||||
# don't get broken in stupid places.
|
||||
$/ = split # paragraph mode
|
||||
ARGF.each do |paragraph|
|
||||
begin
|
||||
unless paragraph =~ /\A\s*\Z/m
|
||||
sound = client.generate(paragraph)
|
||||
if client.output_type == "AUDIO"
|
||||
# and client.audio == "WAVE_FILE"
|
||||
Player.play(sound)
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
puts "got error #{e} while trying to say #{paragraph.inspect}"
|
||||
raise
|
||||
end
|
||||
if stdout_mode == :emit
|
||||
puts paragraph
|
||||
end # end if
|
||||
end # end ARGF.each
|
||||
end # end case
|
||||
end # if ARGV.size.zero?
|
||||
end
|
||||
|
||||
|
|
@ -1,705 +0,0 @@
|
|||
# Tcl/Tk MARY TTS client.
|
||||
|
||||
# This has been tested on Windows, and because
|
||||
# of the use of sound there will be portability
|
||||
# issues. However, there should be enough here
|
||||
# for a reasonable start at a client, for any
|
||||
# platform that supports Tcl/Tk. The platform
|
||||
# specific code has, as far as possible, been
|
||||
# isolated in the part of the code that detects
|
||||
# whether this is being run as a program.
|
||||
|
||||
# Notes:
|
||||
# More work will need to be done with this,
|
||||
# in order to make the code clean. It should
|
||||
# probably be wrapped in a package, to solve
|
||||
# any namespace issues. There are a lot of
|
||||
# global variables. It seems that some of
|
||||
# these are necessary for the menus to work.
|
||||
# Handling of temporary files could be improved.
|
||||
|
||||
# TODO:
|
||||
# Create modifier sliders, for the effects.
|
||||
# Extend the query proc to make use of them.
|
||||
# Turn the Help menu into something more useful.
|
||||
# Debug the actions for the Edit menu.
|
||||
# Provide a means of getting example inputs
|
||||
# from the server.
|
||||
# Provide a means of re-loading all the
|
||||
# dynamically collected information when the
|
||||
# server is changed from the menu. This means
|
||||
# that we need to delete the existing menu
|
||||
# entries in order to add them correctly.
|
||||
# How do we ensure temporary files are removed
|
||||
# in the event of a problem? if {catch {}} ...?
|
||||
# Maybe leaving them around is diagnostic info?
|
||||
# Make that an option?
|
||||
# Add error handling code for network and disk
|
||||
# failures likely to beset such clients.
|
||||
# Add sensible defaults for things the user must
|
||||
# always set at startup, but these will be
|
||||
# platform spacific. Always default to Audio
|
||||
# output for example, or is it possible that
|
||||
# people have no voices installed?
|
||||
|
||||
|
||||
# This is a GUI, so:
|
||||
package require Tk
|
||||
|
||||
# We are communicating with the Mary server
|
||||
# with HTTP.
|
||||
package require http
|
||||
|
||||
# Use the local machine in preference to the
|
||||
# one in Germany.
|
||||
set mary_tts_default_host "127.0.0.1"
|
||||
set mary_tts_default_port 59125
|
||||
|
||||
# Actual host and port, and global old
|
||||
# copies to allow revert on cancel in the
|
||||
# dialogues. Apparently upvar #0 is the
|
||||
# norm for that sort of thing [Tcl Wiki]
|
||||
set mary_tts_host $mary_tts_default_host
|
||||
set old_mary_tts_host $mary_tts_host
|
||||
set mary_tts_port $mary_tts_default_port
|
||||
set old_mary_tts_port $mary_tts_port
|
||||
|
||||
# Informational URLs
|
||||
set informational_urls [ list \
|
||||
version datatypes voices \
|
||||
audioformats audioeffects ]
|
||||
|
||||
#######
|
||||
|
||||
# Obtain a static page from the server, i.e.
|
||||
# no parameters are needed to get it.
|
||||
proc get_page { relative_url } {
|
||||
global mary_tts_host mary_tts_port
|
||||
set url http://$mary_tts_host:$mary_tts_port/$relative_url
|
||||
set result [::http::geturl $url]
|
||||
return [::http::data $result]
|
||||
}
|
||||
|
||||
proc list_of_lines {str} {
|
||||
return [ split $str "\n" ]
|
||||
}
|
||||
|
||||
|
||||
# We will need to collect this information
|
||||
# when we have the server and port chosen.
|
||||
proc get_audioeffects {} {
|
||||
return [list_of_lines [get_page audioeffects] ]
|
||||
}
|
||||
|
||||
proc get_audioformats {} {
|
||||
return [list_of_lines [get_page audioformats] ]
|
||||
}
|
||||
|
||||
proc get_datatypes {} {
|
||||
return [ list_of_lines [get_page datatypes] ]
|
||||
}
|
||||
|
||||
|
||||
proc get_voices {} {
|
||||
return [list_of_lines [get_page voices] ]
|
||||
}
|
||||
|
||||
# Handling post queries.
|
||||
|
||||
# Submit the query to the server, using the
|
||||
# http POST method.
|
||||
proc make_query {url encoded_params} {
|
||||
set http [::http::geturl $url -query $encoded_params]
|
||||
set result [::http::data $http]
|
||||
return $result
|
||||
}
|
||||
|
||||
# Get the text from the input text area
|
||||
proc get_input_text {} {
|
||||
return [.io.inp.input_area get 1.0 end]
|
||||
}
|
||||
|
||||
# Get the text from the output text area
|
||||
proc get_output_text {} {
|
||||
return [.io.out.output_area get 1.0 end]
|
||||
}
|
||||
|
||||
# Collect the audio data from the server.
|
||||
proc collect_audio_data {text_to_process} {
|
||||
global mary_tts_host mary_tts_port
|
||||
global inputtype outputtype locales
|
||||
global audioformat voice
|
||||
set url "http://$mary_tts_host:$mary_tts_port/process"
|
||||
# ::http::formatQuery converts a list of
|
||||
# key value pairs into the correct format
|
||||
# for http POST.
|
||||
set params [::http::formatQuery INPUT_TEXT $text_to_process INPUT_TYPE $inputtype OUTPUT_TYPE $outputtype LOCALE $locales($voice) AUDIO $audioformat VOICE $voice ]
|
||||
set result [make_query $url $params]
|
||||
return $result
|
||||
}
|
||||
|
||||
# Pushes the query to the server and gets
|
||||
# the results back, displaying or playing
|
||||
# them.
|
||||
proc generate_output {text_to_process} {
|
||||
global outputtype
|
||||
set result [collect_audio_data $text_to_process]
|
||||
if {$outputtype eq "AUDIO"} {
|
||||
# call the platform dependent implementation.
|
||||
play $result
|
||||
} else {
|
||||
clear_output
|
||||
add_message $result
|
||||
}
|
||||
# Return the result so we can save it if
|
||||
# the user requires it.
|
||||
return $result
|
||||
}
|
||||
|
||||
|
||||
# These next procs are for handling the
|
||||
# lists of data one gets back from the server
|
||||
# which possibly have several words per line,
|
||||
# separated by spaces.
|
||||
|
||||
# If the first word of each listed line is
|
||||
# significant, extract the list of first words.
|
||||
proc collect_first_words_of_phrase_list {a_list} {
|
||||
for {set i 0} {$i < [llength $a_list]} {incr i} {
|
||||
set data [lindex $a_list $i ]
|
||||
set word [ lindex [split $data " "] 0 ]
|
||||
lappend words $word
|
||||
}
|
||||
return $words
|
||||
}
|
||||
|
||||
|
||||
# If the second word of each listed line is
|
||||
# significant, extract the list of second words.
|
||||
proc collect_second_words_of_phrase_list {a_list} {
|
||||
for {set i 0} {$i < [llength $a_list]} {incr i} {
|
||||
set data [lindex $a_list $i ]
|
||||
set word [ lindex [split $data " "] 1 ]
|
||||
lappend words $word
|
||||
}
|
||||
return $words
|
||||
}
|
||||
|
||||
|
||||
# The list of datatypes must be separated into
|
||||
# input data types and output data types so that
|
||||
# interactions with the server make sense.
|
||||
# This handles the inputs.
|
||||
proc collect_first_words_of_input_types {a_list} {
|
||||
for {set i 0} {$i < [llength $a_list]} {incr i} {
|
||||
set data [lindex $a_list $i ]
|
||||
if {[ string match -nocase "*input*" $data ]} {
|
||||
set word [ lindex [split $data " "] 0 ]
|
||||
lappend words $word
|
||||
}
|
||||
}
|
||||
return $words
|
||||
}
|
||||
|
||||
|
||||
# The list of datatypes must be separated into
|
||||
# input data types and output data types so that
|
||||
# interactions with the server make sense.
|
||||
# This handles the outputs.
|
||||
proc collect_first_words_of_output_types {a_list} {
|
||||
for {set i 0} {$i < [llength $a_list]} {incr i} {
|
||||
set data [lindex $a_list $i ]
|
||||
if {[string match -nocase "*output*" $data]} {
|
||||
set word [ lindex [split $data " "] 0 ]
|
||||
lappend words $word
|
||||
}
|
||||
}
|
||||
return $words
|
||||
}
|
||||
|
||||
# setup all the variables to hold voices,
|
||||
# audio options, etc., based on what the
|
||||
# server can do.
|
||||
proc setup_globals {} {
|
||||
global audioeffects audioformats voices
|
||||
global inputtypes outputtypes audioformat voice
|
||||
global inputtype outputtype locales
|
||||
|
||||
set audioeffects [get_audioeffects]
|
||||
set audioformats [get_audioformats]
|
||||
set audioformat [lindex $audioformats 0 ]
|
||||
set datatypes_data [get_datatypes]
|
||||
set inputtypes [collect_first_words_of_input_types $datatypes_data]
|
||||
set inputtype [lindex $inputtypes 0]
|
||||
set outputtypes [collect_first_words_of_output_types $datatypes_data]
|
||||
set outputtype [lindex $outputtypes 0]
|
||||
set voices_data [get_voices]
|
||||
set voices [collect_first_words_of_phrase_list $voices_data]
|
||||
set locales_list [collect_second_words_of_phrase_list $voices_data ]
|
||||
for {set i 0} {$i < [llength $voices]} {incr i} {
|
||||
set locales([lindex $voices $i]) [lindex $locales_list $i]
|
||||
}
|
||||
set voice [lindex $voices 0]
|
||||
}
|
||||
|
||||
# A general procedure for filling in the
|
||||
# elements of a listbox from a list.
|
||||
# At present this is unused, but it could
|
||||
# be useful later. [It took a while to
|
||||
# figure out so I'm not ready to kill it
|
||||
# with YAGNI.]
|
||||
proc add_listbox_items {a_var a_widget} {
|
||||
upvar $a_var var
|
||||
foreach item $var {
|
||||
$a_widget insert end $item
|
||||
}
|
||||
}
|
||||
|
||||
# Create the menubuttons along the top.
|
||||
# Usual File, Edit and Help menus plus
|
||||
# those to set attributes.
|
||||
proc create_menubuttons {} {
|
||||
set buttons [ list file File edit Edit \
|
||||
server "Server" \
|
||||
inputtype "Input type" outputtype "Output type" \
|
||||
voice Voice \
|
||||
audioformat "Audio format" \
|
||||
textstyle "Text style" help Help ]
|
||||
|
||||
set count 1
|
||||
foreach { menu_tag string_tag} $buttons {
|
||||
menubutton .menus.$menu_tag -text $string_tag \
|
||||
-menu .menus.${menu_tag}.menu -underline 0 -font ClientFont
|
||||
menu .menus.${menu_tag}.menu -tearoff true
|
||||
grid .menus.$menu_tag -in .menus -row 1 -column $count -sticky w
|
||||
incr count
|
||||
}
|
||||
}
|
||||
|
||||
# Get the contents of a text file for reading
|
||||
# or loading into a text widget, etc.
|
||||
proc text_file_contents {what_for} {
|
||||
set a_file [tk_getOpenFile -title $what_for ]
|
||||
set the_text ""
|
||||
|
||||
if {$a_file != ""} {
|
||||
set a_stream [open $a_file r ]
|
||||
set the_text [read $a_stream]
|
||||
close $a_stream
|
||||
}
|
||||
|
||||
return $the_text
|
||||
}
|
||||
|
||||
|
||||
# Save the_text to a text file specified
|
||||
# by the user, for the given reason (what_for).
|
||||
# At the moment there is no error handling
|
||||
# for this (disk full, write protected, etc).
|
||||
proc save_text_file {the_text what_for} {
|
||||
set a_file [tk_getSaveFile -title $what_for -parent .]
|
||||
if {$a_file != ""} {
|
||||
set a_stream [open $a_file w ]
|
||||
puts $a_stream $the_text
|
||||
close $a_stream
|
||||
}
|
||||
}
|
||||
|
||||
# Save the_data to a binary file specified
|
||||
# by the user, for the given reason (what_for),
|
||||
# a text string.
|
||||
# At the moment there is no error handling
|
||||
# for this (disk full, write protected, etc).
|
||||
proc save_binary_file {the_data what_for} {
|
||||
set a_file [tk_getSaveFile -title $what_for -parent .]
|
||||
if {$a_file != ""} {
|
||||
set a_stream [open $a_file w ]
|
||||
fconfigure $a_stream -translation binary
|
||||
puts -nonewline $a_stream $the_data
|
||||
close $a_stream
|
||||
}
|
||||
}
|
||||
|
||||
# Create the menu for File operations
|
||||
proc create_menu_file {} {
|
||||
set fmenu .menus.file.menu
|
||||
$fmenu add command -label "New" \
|
||||
-font ClientFont -command {
|
||||
.io.inp.input_area delete 1.0 end
|
||||
}
|
||||
# Replace the contents of the input text
|
||||
# widget by the data from the open file.
|
||||
# <FIXME>YAGNI, but is there any reason
|
||||
# to allow inserting a file, rather than
|
||||
# replacing the text with file contents?
|
||||
# </FIXME>
|
||||
$fmenu add command -label "Open" \
|
||||
-font ClientFont -command {
|
||||
set the_text [text_file_contents "File to load"]
|
||||
if {$the_text != ""} {
|
||||
.io.inp.input_area delete 1.0 end
|
||||
.io.inp.input_area insert end $the_text
|
||||
}
|
||||
}
|
||||
|
||||
$fmenu add command -label "Read" \
|
||||
-font ClientFont -command {
|
||||
generate_output [text_file_contents "File to read"]
|
||||
}
|
||||
# How to make these disabled for now?
|
||||
$fmenu add command -label "Save Input" \
|
||||
-font ClientFont -command {
|
||||
set the_text [get_input_text]
|
||||
save_text_file $the_text "Save Input"
|
||||
}
|
||||
$fmenu add command -label "Save Output" \
|
||||
-font ClientFont -command {
|
||||
set the_text [get_output_text]
|
||||
save_text_file $the_text "Save Output"
|
||||
}
|
||||
}
|
||||
|
||||
# Create the menu for edit operations
|
||||
proc create_menu_edit {} {
|
||||
set emenu .menus.edit.menu
|
||||
$emenu add command -label "Select All from Input Area" \
|
||||
-font ClientFont -command {
|
||||
# This code says copy the selection as well.
|
||||
# May be wrong for some platforms, but is
|
||||
# it more useful?
|
||||
.io.inp.input_area tag add sel 1.0 end
|
||||
event generate .io.inp.input_area <<copy>>
|
||||
}
|
||||
$emenu add command -label "Select All from Output Area" \
|
||||
-font ClientFont -command {
|
||||
# This code says copy the selection as well.
|
||||
# May be wrong for some platforms, but is
|
||||
# it more useful?
|
||||
.io.out.output_area tag add sel 1.0 end
|
||||
event generate .io.out.output_area <<Copy>>
|
||||
}
|
||||
$emenu add command -label "Copy from Input Area" \
|
||||
-font ClientFont -command {
|
||||
# this appears not to work. FIXME
|
||||
event generate .io.inp.input_area <<Copy>>
|
||||
}
|
||||
$emenu add command -label "Copy from Output Area" \
|
||||
-font ClientFont -command {
|
||||
# this appears not to work. FIXME
|
||||
event generate .io.out.output_area <<copy>>
|
||||
}
|
||||
$emenu add command -label "Paste into Input Area" \
|
||||
-font ClientFont -command {
|
||||
# this appears not to work. FIXME
|
||||
event generate .io.inp.input_area <<Paste>>
|
||||
}
|
||||
$emenu add command \
|
||||
-font ClientFont -label "Insert example text into Input Area"\
|
||||
-command {
|
||||
}
|
||||
# Add specific editing commands here later.
|
||||
# For example, we would like to be able to
|
||||
# add whole tags to the XML based formats,
|
||||
# wrap matching tags around selected text.
|
||||
# Also we need to find out what happens with
|
||||
# copy cut and paste, given that X Windows
|
||||
# is different from MS Windows.
|
||||
# Allow example text to be inserted.
|
||||
# However, my thinking is that this should not
|
||||
# overwrite as it is in the Java application,
|
||||
# because this rubs out edits when switching
|
||||
# voices, and this can be annoying when
|
||||
# exploring the system.
|
||||
}
|
||||
|
||||
# Set the server properties, mostly just
|
||||
# host and port. Maybe later protocol will
|
||||
# be possible for https connections?
|
||||
proc create_menu_server {} {
|
||||
set smenu .menus.server.menu
|
||||
$smenu add command -label "host" -font ClientFont -command {
|
||||
create_entry_dialog "MARY TTS server name" "hostname/IP Address" mary_tts_host
|
||||
}
|
||||
$smenu add command -label "port" -font ClientFont -command {
|
||||
create_entry_dialog "MARY TTS server port" "pott number" mary_tts_port
|
||||
}
|
||||
}
|
||||
|
||||
# setup the fonts for the various areas on the dipslay.
|
||||
proc setup_font {family size} {
|
||||
foreach win {.io .controls .entry.dialogue } {
|
||||
font configure ClientFont -family $family -size $size
|
||||
}
|
||||
}
|
||||
|
||||
# Create the menu for changing the text size.
|
||||
proc create_menu_textstyle {} {
|
||||
set tmenu .menus.textstyle.menu
|
||||
|
||||
$tmenu add cascade -label "Courier" -underline 0 -menu \
|
||||
$tmenu.courier -font ClientFont
|
||||
$tmenu add cascade -label "Times" -underline 0 -menu \
|
||||
$tmenu.times -font ClientFont
|
||||
$tmenu add cascade -label "Helvetica" -underline 0 -menu \
|
||||
$tmenu.helvetica -font ClientFont
|
||||
foreach {name family} [list $tmenu.courier Courier \
|
||||
$tmenu.times Times $tmenu.helvetica Helvetica ] {
|
||||
set m1 [menu $name]
|
||||
foreach pts {6 7 8 9 10 12 14 16 18 20 24 28 32 36} {
|
||||
$m1 add command -label "$pts" -font ClientFont\
|
||||
-command [list setup_font $family $pts ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Create the menu for Help
|
||||
proc create_menu_help {} {
|
||||
# This is all pretty much "wet paint"
|
||||
# Is there enough to merit separate menus?
|
||||
set hmenu .menus.help.menu
|
||||
$hmenu add command -label "Introduction" -font ClientFont\
|
||||
-command {
|
||||
tk_messageBox -message "This is a basic Tcl/Tk
|
||||
client for the MARY TTS system. Most of the options
|
||||
are reached through the menus on the top. Some
|
||||
facilities are presently lacking.
|
||||
|
||||
Most of the interface should be self-explanatory.
|
||||
In the File menu, Read will read a given file aloud
|
||||
(or at least take it as input for the present
|
||||
form of processing), whereas Open will load it
|
||||
into the input area. Save input and Save output
|
||||
refer to the contents of the text windows. The
|
||||
save button next to the play button will save
|
||||
the output to a file; this is assumed to be a
|
||||
text file, unless the output is audio, in which
|
||||
case it is a binary file.
|
||||
|
||||
The Edit menu has cut and paste facilities,
|
||||
but these don't seem to work reliably. The
|
||||
default key bindings for text areas should
|
||||
be useable.
|
||||
|
||||
You will need to set the input and output types
|
||||
and the audio format before pressing play.
|
||||
Code does not yet exist to figure out sensible
|
||||
defaults for your platform.
|
||||
|
||||
This does not have support for the effects, yet.
|
||||
|
||||
Contributions from developers welcome." -type ok
|
||||
}
|
||||
$hmenu add command -label "About" -command {} -font ClientFont
|
||||
}
|
||||
|
||||
# We need to create menus for the available
|
||||
# voices and audio formats, etc.
|
||||
# When we have the data for these menus from
|
||||
# the server, create them by using the global
|
||||
# lists of information.
|
||||
proc create_radio_menu_from_list {what} {
|
||||
global $what
|
||||
set plural "${what}s"
|
||||
upvar 1 $plural var
|
||||
foreach item $var {
|
||||
.menus.${what}.menu add radiobutton -label $item -variable $what \
|
||||
-value $item -font ClientFont
|
||||
}
|
||||
}
|
||||
|
||||
proc reset_entry_and_var {a_variable} {
|
||||
upvar #0 $a_variable var
|
||||
upvar #0 old_$a_variable old_var
|
||||
set var $old_var
|
||||
destroy .entry_dialogue
|
||||
}
|
||||
# Create the toplevel for choosing a host
|
||||
# or port, something taken from an entry.
|
||||
proc create_entry_dialog {a_message a_label a_variable} {
|
||||
upvar #0 $a_variable var
|
||||
upvar #0 old_$a_variable old_var
|
||||
toplevel .entry_dialogue
|
||||
label .entry_dialogue.the_message -text $a_message \
|
||||
-font ClientFont
|
||||
label .entry_dialogue.the_label -text $a_label -font ClientFont
|
||||
entry .entry_dialogue.the_entry -textvariable $a_variable \
|
||||
-font ClientFont
|
||||
button .entry_dialogue.ok -text "OK" -font ClientFont -command {
|
||||
destroy .entry_dialogue
|
||||
}
|
||||
button .entry_dialogue.cancel -text "Cancel" -font ClientFont \
|
||||
-command "reset_entry_and_var $a_variable"
|
||||
|
||||
grid .entry_dialogue.the_message -row 1 -column 1
|
||||
grid .entry_dialogue.the_label -row 2 -column 1
|
||||
grid .entry_dialogue.the_entry -row 2 -column 2
|
||||
grid .entry_dialogue.ok -row 3 -column 1
|
||||
grid .entry_dialogue.cancel -row 3 -column 2
|
||||
}
|
||||
|
||||
# Add a message to the end of the output
|
||||
# text widget.
|
||||
proc add_message {a_message} {
|
||||
.io.out.output_area configure -state normal
|
||||
.io.out.output_area insert end $a_message
|
||||
.io.out.output_area configure -state disabled
|
||||
}
|
||||
|
||||
|
||||
# Clear the text in the output text widget.
|
||||
proc clear_output {} {
|
||||
.io.out.output_area configure -state normal
|
||||
.io.out.output_area delete 1.0 end
|
||||
.io.out.output_area configure -state disabled
|
||||
}
|
||||
|
||||
# Sound generation is platform dependent.
|
||||
# This provides an "abstract" function to
|
||||
# be overridden by the platform dependent
|
||||
# code. In this case it alerts the user
|
||||
# in the output window that nothing is going
|
||||
# to happen.
|
||||
proc play {sound} {
|
||||
add_message \
|
||||
"play sound not implemented on this platform apparently"
|
||||
}
|
||||
|
||||
# Graphical stuff.
|
||||
|
||||
# In order to be able to scale the font, define a font.
|
||||
font create ClientFont -family [font actual TkDefaultFont -family] \
|
||||
-size [font actual TkDefaultFont -size]
|
||||
|
||||
frame .menus
|
||||
create_menubuttons
|
||||
create_menu_file
|
||||
create_menu_edit
|
||||
create_menu_server
|
||||
create_menu_textstyle
|
||||
create_menu_help
|
||||
# Fill in the other menus at runtime.
|
||||
|
||||
# .io communicates text with the user,
|
||||
# through an input and output window.
|
||||
frame .io
|
||||
frame .io.inp
|
||||
frame .io.out
|
||||
# .controls will hold the play button and
|
||||
# the effects controls.
|
||||
frame .controls
|
||||
|
||||
# Draw the controls in .io
|
||||
label .io.inp.input_label -text "Input Area" -font ClientFont
|
||||
text .io.inp.input_area -height 10 -width 40 \
|
||||
-xscrollcommand ".io.inp.input_x set" \
|
||||
-yscrollcommand ".io.inp.input_y set" -font ClientFont
|
||||
scrollbar .io.inp.input_x -orient horizontal \
|
||||
-command ".io.inp.input_area xview"
|
||||
scrollbar .io.inp.input_y -orient vertical \
|
||||
-command ".io.inp.input_area yview"
|
||||
|
||||
label .io.out.output_label -text "Output Area" -font ClientFont
|
||||
text .io.out.output_area -height 10 -width 40 -state disabled \
|
||||
-xscrollcommand ".io.out.output_x set" \
|
||||
-yscrollcommand ".io.out.output_y set" -font ClientFont
|
||||
scrollbar .io.out.output_x -orient horizontal \
|
||||
-command ".io.out.output_area xview"
|
||||
scrollbar .io.out.output_y -orient vertical \
|
||||
-command ".io.out.output_area yview"
|
||||
|
||||
grid .io.inp -in .io -row 1 -column 1
|
||||
grid .io.out -in .io -row 1 -column 2
|
||||
grid .io.inp.input_label -in .io.inp -row 1 -column 1
|
||||
grid .io.inp.input_area -in .io.inp -row 2 -column 1
|
||||
grid .io.inp.input_y -in .io.inp -row 2 -column 2 -sticky ns
|
||||
grid .io.inp.input_x -in .io.inp -row 3 -column 1 -sticky ew
|
||||
|
||||
grid .io.out.output_label -in .io.out -row 1 -column 1
|
||||
grid .io.out.output_area -in .io.out -row 2 -column 1
|
||||
grid .io.out.output_y -in .io.out -row 2 -column 2 -sticky ns
|
||||
grid .io.out.output_x -in .io.out -row 3 -column 1 -sticky ew
|
||||
|
||||
button .controls.play -text "play" -font ClientFont -command {
|
||||
generate_output [get_input_text]
|
||||
}
|
||||
grid .controls.play -in .controls -row 1 -column 1
|
||||
|
||||
button .controls.save -text "save" -font ClientFont -command {
|
||||
global outputtype
|
||||
set input_text [get_input_text]
|
||||
if { $outputtype eq "AUDIO" } {
|
||||
save_binary_file [collect_audio_data $input_text ] "Save audio file"
|
||||
} else {
|
||||
save_text_file [collect_audio_data $input_text ] "Save output to file"
|
||||
}
|
||||
}
|
||||
|
||||
grid .controls.save -in .controls -row 1 -column 2
|
||||
|
||||
pack .menus .io .controls -in . -side top
|
||||
|
||||
|
||||
|
||||
# Detect whether this is the main program
|
||||
# This test was taken from the Tcl Wiki, and
|
||||
# seems to work OK.
|
||||
|
||||
if {[info exists argv0] && [file tail [info script]] eq [file tail $argv0]} {
|
||||
|
||||
# Try to find the temporary files directory.
|
||||
catch { set tmpdir "/tmp" }
|
||||
catch { set tmpdir $::env(TRASH_FOLDER) }
|
||||
catch { set tmpdir $::env(TMP) }
|
||||
catch { set tmpdir $::env(TEMP) }
|
||||
# <FIXME>This needs better handling of
|
||||
# possible alternatives</FIXME>
|
||||
# This is needed for Windows sound only.
|
||||
|
||||
# Do the platform dependent things.
|
||||
if {$tcl_platform(platform) eq "windows"} {
|
||||
package require twapi
|
||||
|
||||
proc play {sound} {
|
||||
global tmpdir
|
||||
# Write sound to a temporary file
|
||||
set sndfile [file join $tmpdir "MARYTTS_sound.[pid].wav" ]
|
||||
set stream [open $sndfile w]
|
||||
# Make sure the file is binary:
|
||||
fconfigure $stream -translation binary
|
||||
puts -nonewline $stream $sound
|
||||
close $stream
|
||||
# Play the file.
|
||||
::twapi::play_sound $sndfile
|
||||
# Remove the file.
|
||||
file delete $sndfile
|
||||
}
|
||||
}
|
||||
# Put other platforms here.
|
||||
|
||||
# Setup the globals with reference to the
|
||||
# server, which is assumed to be working.
|
||||
# Since we have options to alter this with
|
||||
# menu items, there probably needs to be
|
||||
# some way to reload all this. But we need
|
||||
# to know how to delete the existing menu
|
||||
# entries to do that.
|
||||
setup_globals
|
||||
create_radio_menu_from_list inputtype
|
||||
create_radio_menu_from_list outputtype
|
||||
create_radio_menu_from_list voice
|
||||
create_radio_menu_from_list audioformat
|
||||
|
||||
# Note, at the moment voices holds locales,
|
||||
# gender, and voice type
|
||||
|
||||
# At the moment this is just diagnostic:
|
||||
## add_message [ join $voices "\n" ]
|
||||
# it tells us we have a basically working
|
||||
# system and the list of voices has been
|
||||
# picked up and manipulated correctly.
|
||||
# So it is commented out now.
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
<html>
|
||||
<!--
|
||||
Copyright 2000-2006 DFKI GmbH.
|
||||
All Rights Reserved. Use is subject to license terms.
|
||||
|
||||
Permission is hereby granted, free of charge, to use and distribute
|
||||
this software and its documentation without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of this work, and to
|
||||
permit persons to whom this work is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
1. The code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
2. Any modifications must be clearly marked as such.
|
||||
3. Original authors' names are not deleted.
|
||||
4. The authors' names are not used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
DFKI GMBH AND THE CONTRIBUTORS TO THIS WORK DISCLAIM ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DFKI GMBH NOR THE
|
||||
CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<link rel=stylesheet type="text/css" href="mary.css">
|
||||
<script type="text/javascript">
|
||||
</head>
|
||||
<body>
|
||||
<h1 align="center">The MARY Text-to-Speech System: Online Demo</h1>
|
||||
<div align="center">
|
||||
<p>Synthesise any text online (max. 5000 characters):
|
||||
</p>
|
||||
<form name="InputForm" method="get" action="maryclient.cgi">
|
||||
<!-- Set the language of your input here: TEXT_DE=German, TEXT_EN=English... -->
|
||||
<input type="hidden" name="in" value="TEXT"/>
|
||||
<input type="hidden" name="out" value="AUDIO"/>
|
||||
<p>Input text:</p>
|
||||
<textarea name="inputtext" rows=8 cols=50 wrap=virtual>
|
||||
Welcome to the world of speech synthesis!
|
||||
</textarea><br>
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td>
|
||||
Voice:
|
||||
<select name="voice">
|
||||
<option value="us1">us1 (American English, female)</option>
|
||||
<option value="us2">us2 (American English, male)</option>
|
||||
</select>
|
||||
</td><td>
|
||||
Audio format:
|
||||
<select name="audiotype">
|
||||
<option value="AU">Sun Audio, 16 bit</option>
|
||||
<option value="AIFF">AIFF, 16 bit</option>
|
||||
<option value="WAVE" selected>WAV, 16 bit</option>
|
||||
<option value="MP3">mp3</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<input type=submit value="Speak">
|
||||
</td><td align="left">
|
||||
<input type=reset value="Reset">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<input type=radio name="save_to_disk" value="0" checked>Hear directly
|
||||
|
||||
<input type=radio name="save_to_disk" value="1">Save to disk
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>EmoSpeak Applet</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H3><HR WIDTH="100%">EmoSpeak Applet<HR WIDTH="100%"></H3>
|
||||
|
||||
To properly run the emospeak applet, the following conditions must be fulfilled:
|
||||
<br>
|
||||
1. The emospeakapplet.jar and maryclient.jar files must be in the same directory as this html file.
|
||||
<br>
|
||||
2. On the server machine from which the html file is loaded, a MARY server with German voices must be running.
|
||||
<br>
|
||||
<P>
|
||||
<APPLET archive="emospeakapplet.jar, maryclient.jar" code="marytts.tools.emospeak.EmoSpeakApplet.class" width=550 height=600></APPLET>
|
||||
</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
#
|
||||
# marytts This init.d script is used to start a MARY TTS server.
|
||||
|
||||
# Run process as same user as this script:
|
||||
SUDO=""
|
||||
# Run process as user 'mary':
|
||||
#SUDO="sudo -u mary"
|
||||
JAVA=/usr/bin/java
|
||||
MARY_BASE="/usr/local/MARY TTS"
|
||||
MARY_PIDFILE=/var/run/marytts.pid
|
||||
|
||||
|
||||
|
||||
pidof_marytts() {
|
||||
PIDOF=`which pidof` || true
|
||||
if [ -x "$PIDOF" ]; then # command exists
|
||||
PIDS=`pidof java` || true
|
||||
else # no pidof command
|
||||
PIDS=`ps axc|awk "{if (\\$5==\\"java\\") print \\$1}"`
|
||||
fi
|
||||
|
||||
[ -e $MARY_PIDFILE ] && PIDS2=`cat $MARY_PIDFILE`
|
||||
|
||||
# if there is a pid we need to verify that belongs to MARY
|
||||
# for real
|
||||
for i in $PIDS; do
|
||||
if [ "$i" = "$PIDS2" ]; then
|
||||
# in this case the pid stored in the
|
||||
# pidfile matches one of the pidof java
|
||||
# so a simple kill will make it
|
||||
echo $i
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
marytts_start() {
|
||||
CLASSPATH="$MARY_BASE/java/mary-common.jar:$MARY_BASE/java/log4j-1.2.15.jar"
|
||||
$SUDO $JAVA -ea -Xms40m -Xmx1g -cp "$CLASSPATH" -Dmary.base="$MARY_BASE" marytts.server.Mary &
|
||||
PID="$!"
|
||||
echo $PID > $MARY_PIDFILE
|
||||
}
|
||||
|
||||
marytts_stop() {
|
||||
PID=$(pidof_marytts)
|
||||
if [ "${PID}" ]; then
|
||||
kill $PID
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
echo "Starting TTS server"
|
||||
if marytts_start; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping TTS server"
|
||||
if marytts_stop; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
echo "Restarting TTS server"
|
||||
marytts_stop
|
||||
sleep 10
|
||||
if marytts_start; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
PID=$(pidof_marytts) || true
|
||||
if [ "${PID}" ]; then
|
||||
echo "MARY TTS is running (pid $PID)"
|
||||
else
|
||||
echo "MARY TTS is not running"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/marytts {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><marytts-install xmlns="http://mary.dfki.de/installer">
|
||||
<voice locale="de" name="bits1-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>A female German hidden semi-Markov model voice, built from voice recordings provided by the BITS project at the Bavarian Archive of Speech Signals</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="69aeb40bc27492d887f7d60bd8afc2aa" filename="voice-bits1-hsmm-5.1.zip" size="1360761">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="de" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="de" name="bits3" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male German unit selection voice, built from voice recordings provided by the BITS project at the Bavarian Archive of Speech Signals</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="e11f0d1057dd80d5ab307eaf3c2a2e81" filename="voice-bits3-5.1.zip" size="278237075">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="de" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="de" name="bits3-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male German hidden semi-Markov model voice, built from voice recordings provided by the BITS project at the Bavarian Archive of Speech Signals</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="d535206d88da7f5b066a4624c321ee73" filename="voice-bits3-hsmm-5.1.zip" size="1557124">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="de" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="de" name="dfki-pavoque-neutral" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male German unit selection voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="b2067addeb337de0e31c1e0057ccaf93" filename="voice-dfki-pavoque-neutral-5.1.zip" size="446054145">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="de" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="de" name="dfki-pavoque-neutral-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male German hidden semi-Markov model voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="c064426f03689cc0681514818495b347" filename="voice-dfki-pavoque-neutral-hsmm-5.1.zip" size="2835023">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="de" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="de" name="dfki-pavoque-styles" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male German unit selection voice with expressive styles "happy", "sad", "angry", and "poker"</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="f497dd93f78fa4a2350adea1196ccd7a" filename="voice-dfki-pavoque-styles-5.1.zip" size="692113207">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="de" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-poppy" gender="female" type="unit selection" version="5.1">
|
||||
<description>A female British English expressive unit selection voice: Cheerful Poppy</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="8a9bd4c4c888e99f8c367cdac614af9c" filename="voice-dfki-poppy-5.1.zip" size="99318417">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-poppy-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>A female British English hidden semi-Markov model voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="04f1b36ee7113b13e01d3b131c6af75f" filename="voice-dfki-poppy-hsmm-5.1.zip" size="1015901">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-prudence" gender="female" type="unit selection" version="5.1">
|
||||
<description>A female British English expressive unit selection voice: Pragmatic Prudence</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="7c81cbc736450219ea1597b217ea9b8f" filename="voice-dfki-prudence-5.1.zip" size="250841190">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-prudence-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>A female British English hidden semi-Markov model voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="87a27d0ae3eed71d1d34bd3337f06501" filename="voice-dfki-prudence-hsmm-5.1.zip" size="1560473">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-obadiah" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male British English expressive unit selection voice: Gloomy Obadiah</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="dde06a7a4849b922bc45b123a5b7b504" filename="voice-dfki-obadiah-5.1.zip" size="146431509">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-obadiah-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male British English hidden semi-Markov model voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="eb9872af54a1f944f191b2b7237f8d25" filename="voice-dfki-obadiah-hsmm-5.1.zip" size="1216409">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-spike" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male British English expressive unit selection voice: Aggressive Spike</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="f1161fd1da6306cc65d054cd8ff75f4e" filename="voice-dfki-spike-5.1.zip" size="136165028">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_GB" name="dfki-spike-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male British English hidden semi-Markov model voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="a0bfd497423bf504dc3c985476b4e669" filename="voice-dfki-spike-hsmm-5.1.zip" size="1083544">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-GB" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_US" name="cmu-slt" gender="female" type="unit selection" version="5.1">
|
||||
<description>A female US English unit selection voice, built from recordings provided by Carnegie Mellon University</description>
|
||||
<license href="http://mary.dfki.de/download/arctic-license.html"/>
|
||||
<package md5sum="0fe2293ba1f9a0e373b54d79f0a701cc" filename="voice-cmu-slt-5.1.zip" size="105909149">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-US" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_US" name="cmu-bdl-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male US English hidden semi-Markov model voice, built from recordings provided by Carnegie Mellon University</description>
|
||||
<license href="http://mary.dfki.de/download/arctic-license.html"/>
|
||||
<package md5sum="b192a878fb782b48c2ea37deed769c28" filename="voice-cmu-bdl-hsmm-5.1.zip" size="1017477">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-US" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="en_US" name="cmu-rms-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male US English hidden semi-Markov model voice, built from recordings provided by Carnegie Mellon University</description>
|
||||
<license href="http://mary.dfki.de/download/arctic-license.html"/>
|
||||
<package md5sum="fc06214cf245ecba0c2ddf437149bd89" filename="voice-cmu-rms-hsmm-5.1.zip" size="1028060">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="en-US" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="enst-camille" gender="female" type="unit selection" version="5.1">
|
||||
<description>A female French unit selection voice, built at Télécom ParisTech (ENST) using data recorded by Camille Dianoux</description>
|
||||
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
|
||||
<package md5sum="ba18cb28526de107a9b6b8c76d5404ff" filename="voice-enst-camille-5.1.zip" size="183466604">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="enst-camille-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>A female French hidden semi-Markov model voice, built at Télécom ParisTech (ENST) using data recorded by Camille Dianoux</description>
|
||||
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
|
||||
<package md5sum="19cb43b7fed60b732aa1c2e0e86dff03" filename="voice-enst-camille-hsmm-5.1.zip" size="1518635">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="upmc-jessica" gender="female" type="unit selection" version="5.1">
|
||||
<description>A female French unit selection voice, built at ISIR (UPMC) using data recorded by Jessica Durand</description>
|
||||
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
|
||||
<package md5sum="ba2daa2a0c69164932ff833817fa4b0e" filename="voice-upmc-jessica-5.1.zip" size="126834351">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="upmc-jessica-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>A female French hidden semi-Markov model voice, built at ISIR (UPMC) using data recorded by Jessica Durand</description>
|
||||
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
|
||||
<package md5sum="0e95f86b9297f2c60fa6286432d20d84" filename="voice-upmc-jessica-hsmm-5.1.zip" size="1118972">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="enst-dennys-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male Québécois French hidden semi-Markov model voice, built at Télécom ParisTech (ENST)</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="ee95a5257ea4aba46591cfe7c4429d84" filename="voice-enst-dennys-hsmm-5.1.zip" size="1676376">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="upmc-pierre" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male French unit selection voice, built at ISIR (UPMC) using data recorded by Pierre Chauvin</description>
|
||||
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
|
||||
<package md5sum="3120b9dadfb56046e86e64c124d1fa82" filename="voice-upmc-pierre-5.1.zip" size="171764059">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="fr" name="upmc-pierre-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male French hidden semi-Markov model voice, built at ISIR (UPMC) using data recorded by Pierre Chauvin</description>
|
||||
<license href="http://mary.dfki.de/download/by-sa-3.0.html"/>
|
||||
<package md5sum="064e272e3e3283134b44df8eb768dd71" filename="voice-upmc-pierre-hsmm-5.1.zip" size="1557436">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="fr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="it" name="istc-lucia-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>Italian female Hidden semi-Markov model voice kindly made available by Fabio Tesser</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="68258f5b94c596ac961e9bc45be0e521" filename="voice-istc-lucia-hsmm-5.1.zip" size="1466943">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="it" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="ru" name="voxforge-ru-nsh" gender="male" type="unit selection" version="5.1">
|
||||
<description>Russian male voice kindly made available by Nickolay V. Shmyrev</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="b0ec23e41a2e9c2485b55e640ef32fb3" filename="voice-voxforge-ru-nsh-5.1.zip" size="175120753">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="ru" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="te" name="cmu-nk" gender="female" type="unit selection" version="5.1">
|
||||
<description>A female Telugu unit selection voice built from voice recordings provided by IIIT Hyderabad and Carnegie Mellon University</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="2fb7b6b6c9e9eb12ea2ebcba4f356505" filename="voice-cmu-nk-5.1.zip" size="495885808">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="te" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="te" name="cmu-nk-hsmm" gender="female" type="hsmm" version="5.1">
|
||||
<description>A female Telugu hidden semi-Markov model voice built from voice recordings provided by IIIT Hyderabad and Carnegie Mellon University</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="8dd7545a096dd87275b51028bc7623c3" filename="voice-cmu-nk-hsmm-5.1.zip" size="3397557">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="te" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="tr" name="dfki-ot" gender="male" type="unit selection" version="5.1">
|
||||
<description>A male Turkish unit selection voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="c9940e0a58578fc02113b61ac86a6ebf" filename="voice-dfki-ot-5.1.zip" size="157783972">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="tr" version="5.1"/>
|
||||
</voice>
|
||||
<voice locale="tr" name="dfki-ot-hsmm" gender="male" type="hsmm" version="5.1">
|
||||
<description>A male Turkish hidden semi-Markov model voice</description>
|
||||
<license href="http://mary.dfki.de/download/by-nd-3.0.html"/>
|
||||
<package md5sum="211f3d322f19295b5a7671020d76552e" filename="voice-dfki-ot-hsmm-5.1.zip" size="1366536">
|
||||
<location folder="true" href="http://mary.dfki.de/download/5.1/"/>
|
||||
</package>
|
||||
<depends language="tr" version="5.1"/>
|
||||
</voice>
|
||||
</marytts-install>
|
||||
675
external/marytts-5.1.2/gpl-3.0.txt
vendored
675
external/marytts-5.1.2/gpl-3.0.txt
vendored
|
|
@ -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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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,10 +0,0 @@
|
|||
<marytts-install xmlns="http://mary.dfki.de/installer">
|
||||
<language locale="en-US" name="en-US" version="5.1.2">
|
||||
<description>en-US language component</description>
|
||||
<license href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"/>
|
||||
<package filename="marytts-lang-en-US-5.1.2.zip" md5sum="dummy" size="0">
|
||||
<location href="http://mary.dfki.de/download/5.1.2/"/>
|
||||
</package>
|
||||
<files>lib/marytts-lang-en-US-5.1.2.jar</files>
|
||||
</language>
|
||||
</marytts-install>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<marytts-install xmlns="http://mary.dfki.de/installer">
|
||||
<language locale="sv" name="sv" version="5.1.2">
|
||||
<description>sv language component</description>
|
||||
<license href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"/>
|
||||
<package filename="marytts-lang-sv-5.1.2.zip" md5sum="dummy" size="0">
|
||||
<location href="http://mary.dfki.de/download/5.1.2/"/>
|
||||
</package>
|
||||
<files>lib/marytts-lang-sv-5.1.2.jar</files>
|
||||
</language>
|
||||
</marytts-install>
|
||||
166
external/marytts-5.1.2/lgpl-3.0.txt
vendored
166
external/marytts-5.1.2/lgpl-3.0.txt
vendored
|
|
@ -1,166 +0,0 @@
|
|||
GNU LESSER 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.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser 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
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
||||
BIN
external/marytts-5.1.2/lib/icu4j-54.1.1.jar
vendored
BIN
external/marytts-5.1.2/lib/icu4j-54.1.1.jar
vendored
Binary file not shown.
Binary file not shown.
BIN
external/marytts-5.1.2/lib/marytts-lang-en-5.1.2.jar
vendored
BIN
external/marytts-5.1.2/lib/marytts-lang-en-5.1.2.jar
vendored
Binary file not shown.
BIN
external/marytts-5.1.2/lib/marytts-lang-sv-5.1.2.jar
vendored
BIN
external/marytts-5.1.2/lib/marytts-lang-sv-5.1.2.jar
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,10 +0,0 @@
|
|||
Sathish | ' s A - t I S
|
||||
Eire | ' E - r @
|
||||
speech | ' s p i tS
|
||||
hasnt | ' h { z n t
|
||||
havent | ' h { v n t
|
||||
mustnt | ' m V s n t
|
||||
isnt | ' I z n t
|
||||
Greta | ' g r { - t A
|
||||
minute | ' m I - n I t
|
||||
does | ' d V z
|
||||
|
|
@ -1 +0,0 @@
|
|||
kyrka | C ,Y r - k %a
|
||||
BIN
external/pi4j-1.1/pi4j-core-javadoc-1.1-SNAPSHOT.jar
vendored
BIN
external/pi4j-1.1/pi4j-core-javadoc-1.1-SNAPSHOT.jar
vendored
Binary file not shown.
BIN
external/pi4j-1.1/pi4j-core-sources-1.1-SNAPSHOT.jar
vendored
BIN
external/pi4j-1.1/pi4j-core-sources-1.1-SNAPSHOT.jar
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
external/tellstick-core/AUTHORS.txt
vendored
Normal file
7
external/tellstick-core/AUTHORS.txt
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
telldus-core has been developed by :
|
||||
|
||||
Micke Prag <micke.prag@telldus.se>
|
||||
Fredrik Jacobsson <fredrik.jacobsson@telldus.se>
|
||||
Stefan Persson <stefan.persson@telldus.se>
|
||||
|
||||
The package is maintained by Micke Prag <micke.prag@telldus.se>
|
||||
502
external/tellstick-core/LICENSE.txt
vendored
Normal file
502
external/tellstick-core/LICENSE.txt
vendored
Normal file
|
|
@ -0,0 +1,502 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
18
external/tellstick-core/Protocol.cpp
vendored
Executable file → Normal file
18
external/tellstick-core/Protocol.cpp
vendored
Executable file → Normal file
|
|
@ -97,7 +97,7 @@ bool Protocol::checkBit(int data, int bitno) {
|
|||
|
||||
|
||||
Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) {
|
||||
if(TelldusCore::comparei(protocolname, L"arctech")) {
|
||||
if (TelldusCore::comparei(protocolname, L"arctech")) {
|
||||
return new ProtocolNexa();
|
||||
|
||||
} else if (TelldusCore::comparei(protocolname, L"brateck")) {
|
||||
|
|
@ -151,7 +151,7 @@ Protocol *Protocol::getProtocolInstance(const std::wstring &protocolname) {
|
|||
|
||||
std::list<std::string> Protocol::getParametersForProtocol(const std::wstring &protocolName) {
|
||||
std::list<std::string> parameters;
|
||||
if(TelldusCore::comparei(protocolName, L"arctech")) {
|
||||
if (TelldusCore::comparei(protocolName, L"arctech")) {
|
||||
parameters.push_back("house");
|
||||
parameters.push_back("unit");
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ std::list<std::string> Protocol::decodeData(const std::string &fullData) {
|
|||
std::string decoded = "";
|
||||
|
||||
ControllerMessage dataMsg(fullData);
|
||||
if( TelldusCore::comparei(dataMsg.protocol(), L"arctech") ) {
|
||||
if ( TelldusCore::comparei(dataMsg.protocol(), L"arctech") ) {
|
||||
decoded = ProtocolNexa::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
|
|
@ -231,32 +231,32 @@ std::list<std::string> Protocol::decodeData(const std::string &fullData) {
|
|||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
} else if(TelldusCore::comparei(dataMsg.protocol(), L"everflourish") ) {
|
||||
} else if (TelldusCore::comparei(dataMsg.protocol(), L"everflourish") ) {
|
||||
decoded = ProtocolEverflourish::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
} else if(TelldusCore::comparei(dataMsg.protocol(), L"fineoffset") ) {
|
||||
} else if (TelldusCore::comparei(dataMsg.protocol(), L"fineoffset") ) {
|
||||
decoded = ProtocolFineoffset::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
} else if(TelldusCore::comparei(dataMsg.protocol(), L"mandolyn") ) {
|
||||
} else if (TelldusCore::comparei(dataMsg.protocol(), L"mandolyn") ) {
|
||||
decoded = ProtocolMandolyn::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
} else if(TelldusCore::comparei(dataMsg.protocol(), L"oregon") ) {
|
||||
} else if (TelldusCore::comparei(dataMsg.protocol(), L"oregon") ) {
|
||||
decoded = ProtocolOregon::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
} else if(TelldusCore::comparei(dataMsg.protocol(), L"x10") ) {
|
||||
} else if (TelldusCore::comparei(dataMsg.protocol(), L"x10") ) {
|
||||
decoded = ProtocolX10::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
}
|
||||
} else if(TelldusCore::comparei(dataMsg.protocol(), L"hasta") ) {
|
||||
} else if (TelldusCore::comparei(dataMsg.protocol(), L"hasta") ) {
|
||||
decoded = ProtocolHasta::decodeData(dataMsg);
|
||||
if (decoded != "") {
|
||||
retval.push_back(decoded);
|
||||
|
|
|
|||
0
external/tellstick-core/Protocol.h
vendored
Executable file → Normal file
0
external/tellstick-core/Protocol.h
vendored
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue