Compare commits
No commits in common. "master" and "no-ant" have entirely different histories.
Binary file not shown.
Binary file not shown.
|
@ -1,116 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_ATTRIBUTE />
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
|
@ -11,6 +12,11 @@
|
|||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.7" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,22 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/Application" />
|
||||
<option value="$PROJECT_DIR$/android_antlib_4-14" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google2" />
|
||||
<option name="name" value="Google2" />
|
||||
<option name="url" value="https://maven.google.com/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -5,47 +5,26 @@
|
|||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="15">
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||
<item index="4" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||
<item index="6" class="java.lang.String" itemvalue="android.annotation.Nullable" />
|
||||
<item index="7" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
|
||||
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
|
||||
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
|
||||
<item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
|
||||
<item index="13" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
|
||||
<item index="14" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="14">
|
||||
<list size="4">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||
<item index="5" class="java.lang.String" itemvalue="android.annotation.NonNull" />
|
||||
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
|
||||
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
|
||||
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
|
||||
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
|
||||
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
|
||||
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Application/Application.iml" filepath="$PROJECT_DIR$/Application/Application.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/iconsole-android.iml" filepath="$PROJECT_DIR$/iconsole-android.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Application/iconsole-android.Application.iml" filepath="$PROJECT_DIR$/.idea/modules/Application/iconsole-android.Application.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android_antlib_4-14/iconsole-android.android_antlib_4-14.iml" filepath="$PROJECT_DIR$/.idea/modules/android_antlib_4-14/iconsole-android.android_antlib_4-14.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,83 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":Application" external.linked.project.path="$MODULE_DIR$/../../../Application" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="iconsole-android" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":Application" />
|
||||
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="4.1.3" />
|
||||
<option name="LAST_KNOWN_AGP_VERSION" value="4.1.3" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../Application/src/main/res;file://$MODULE_DIR$/../../../Application/src/common/res;file://$MODULE_DIR$/../../../Application/src/template/res;file://$MODULE_DIR$/../../../Application/src/debug/res;file://$MODULE_DIR$/../../../Application/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../Application/build/generated/res/resValues/debug" />
|
||||
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../Application/tests/res;file://$MODULE_DIR$/../../../Application/src/androidTestDebug/res;file://$MODULE_DIR$/../../../Application/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../Application/build/generated/res/resValues/androidTest/debug" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||
<output url="file://$MODULE_DIR$/../../../Application/build/intermediates/javac/debug/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/../../../Application/build/intermediates/javac/debugUnitTest/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../../Application">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../../Application/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../../Application/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../../Application/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../../Application/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../../Application/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../../Application/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../Application/.gradle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../Application/build" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:collections:28.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:common:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:28.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:2.0.4" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:gridlayout-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout:2.0.4@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v13:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v4:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:viewpager:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:coordinatorlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:drawerlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:slidingpanelayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:customview:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:loader:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:cardview-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:versionedparcelable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:cursoradapter:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:interpolator:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:documentfile:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:print:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:runtime:1.1.1@aar" level="project" />
|
||||
<orderEntry type="module" module-name="iconsole-android.android_antlib_4-14" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":android_antlib_4-14" external.linked.project.path="$MODULE_DIR$/../../../android_antlib_4-14" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="iconsole-android" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":android_antlib_4-14" />
|
||||
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
|
||||
<option name="LAST_KNOWN_AGP_VERSION" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/../../../android_antlib_4-14/build" />
|
||||
<option name="BUILDABLE" value="false" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../../android_antlib_4-14">
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../android_antlib_4-14/.gradle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../../android_antlib_4-14/build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="Gradle: iconsole-android.android_antlib_4-14.android_antlib_4-14-0" level="project" />
|
||||
</component>
|
||||
</module>
|
134
Application/Application.iml
Normal file
134
Application/Application.iml
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":Application" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":Application" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/common/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/template/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/common/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/template/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/src" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:cardview-v7-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:runtime-1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel-1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core-1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-1.1.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:common:1.1.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:gridlayout-v7-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v13-27.1.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.1.0" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -6,11 +6,10 @@ buildscript {
|
|||
url 'https://maven.google.com/'
|
||||
name 'Google'
|
||||
}
|
||||
google()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,15 +24,13 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.android.support:gridlayout-v7:28.0.0"
|
||||
implementation "com.android.support:cardview-v7:28.0.0"
|
||||
implementation "com.android.support:appcompat-v7:28.0.0"
|
||||
implementation 'com.android.support:support-v13:28.0.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
|
||||
implementation project(':android_antlib_4-14')
|
||||
implementation "com.android.support:gridlayout-v7:27.1.1"
|
||||
implementation "com.android.support:cardview-v7:27.1.1"
|
||||
implementation "com.android.support:appcompat-v7:27.1.1"
|
||||
implementation 'com.android.support:support-v13:27.1.1'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
}
|
||||
|
||||
|
||||
// The sample build uses multiple directories to
|
||||
// keep boilerplate and common code separate from
|
||||
// the main sample code.
|
||||
|
|
|
@ -34,18 +34,15 @@
|
|||
>
|
||||
|
||||
<activity
|
||||
android:name="org.surfsite.iconsole.MainActivity"
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:label="@string/app_name" android:launchMode="singleTop">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<service android:name=".ChannelService"></service>
|
||||
|
||||
<activity
|
||||
android:name=".DeviceListActivity"
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package com.dsi.ant.channel;
|
||||
|
||||
/**
|
||||
* Created by harald on 24.04.17.
|
||||
*/
|
||||
|
||||
public enum PredefinedNetwork {
|
||||
INVALID(-1),
|
||||
PUBLIC(0),
|
||||
ANT_PLUS_1(1),
|
||||
ANT_FS(2);
|
||||
|
||||
private final int mRawValue;
|
||||
private static final PredefinedNetwork[] sValues = values();
|
||||
|
||||
private PredefinedNetwork(int rawValue) {
|
||||
this.mRawValue = rawValue;
|
||||
}
|
||||
|
||||
int getRawValue() {
|
||||
return this.mRawValue;
|
||||
}
|
||||
|
||||
private boolean equals(int rawValue) {
|
||||
return rawValue == this.mRawValue;
|
||||
}
|
||||
|
||||
static PredefinedNetwork create(int rawValue) {
|
||||
PredefinedNetwork code = INVALID;
|
||||
|
||||
for(int i = 0; i < sValues.length; ++i) {
|
||||
if(sValues[i].equals(rawValue)) {
|
||||
code = sValues[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
|
@ -32,7 +32,6 @@ import android.os.Message;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -43,105 +42,12 @@ import android.widget.Button;
|
|||
import android.widget.NumberPicker;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* This fragment controls Bluetooth to communicate with other devices.
|
||||
*/
|
||||
public class BluetoothChatFragment extends Fragment {
|
||||
static class MyInnerHandler extends Handler{
|
||||
WeakReference<BluetoothChatFragment> mFrag;
|
||||
|
||||
MyInnerHandler(BluetoothChatFragment aFragment) {
|
||||
mFrag = new WeakReference<BluetoothChatFragment>(aFragment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
BluetoothChatFragment theFrag = mFrag.get();
|
||||
if (theFrag == null) {
|
||||
return;
|
||||
}
|
||||
FragmentActivity activity = theFrag.getActivity();
|
||||
|
||||
switch (msg.what) {
|
||||
case Constants.MESSAGE_STATE_CHANGE:
|
||||
switch (msg.arg1) {
|
||||
case BluetoothChatService.STATE_CONNECTED:
|
||||
theFrag.setStatus(theFrag.getString(R.string.title_connected_to, theFrag.mConnectedDeviceName));
|
||||
//mConversationArrayAdapter.clear();
|
||||
theFrag.mStartButton.setEnabled(true);
|
||||
theFrag.mStopButton.setEnabled(true);
|
||||
theFrag.mDisconnectButton.setEnabled(true);
|
||||
theFrag.mLevel.setEnabled(true);
|
||||
theFrag.mLevel.setValue(1);
|
||||
break;
|
||||
case BluetoothChatService.STATE_CONNECTING:
|
||||
theFrag.setStatus(R.string.title_connecting);
|
||||
theFrag.mStartButton.setEnabled(false);
|
||||
theFrag.mStopButton.setEnabled(false);
|
||||
theFrag.mDisconnectButton.setEnabled(false);
|
||||
theFrag.mLevel.setEnabled(false);
|
||||
break;
|
||||
case BluetoothChatService.STATE_LISTEN:
|
||||
case BluetoothChatService.STATE_NONE:
|
||||
theFrag.setStatus(R.string.title_not_connected);
|
||||
theFrag.mStartButton.setEnabled(false);
|
||||
theFrag.mStopButton.setEnabled(false);
|
||||
theFrag.mDisconnectButton.setEnabled(false);
|
||||
theFrag.mLevel.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Constants.MESSAGE_DATA:
|
||||
if (!(msg.obj instanceof IConsole.Data))
|
||||
return;
|
||||
IConsole.Data data = (IConsole.Data) msg.obj;
|
||||
theFrag.mChannelService.setSpeed(data.mSpeed10 / 10.0);
|
||||
theFrag.mChannelService.setPower(data.mPower10 / 10);
|
||||
theFrag.mChannelService.setCadence(data.mRPM);
|
||||
|
||||
theFrag.mSpeedText.setText(String.format("% 3.1f", data.mSpeed10 / 10.0));
|
||||
theFrag.mPowerText.setText(String.format("% 3.1f", data.mPower10 / 10.0));
|
||||
theFrag.mRPMText.setText(String.format("%d", data.mRPM));
|
||||
theFrag.mDistanceText.setText(String.format("% 3.1f", data.mDistance10 / 10.0));
|
||||
theFrag.mCaloriesText.setText(String.format("% 3d", data.mCalories));
|
||||
theFrag.mHFText.setText(String.format("%d", data.mHF));
|
||||
theFrag.mTimeText.setText(String.format("%s", data.getTimeStr()));
|
||||
//mLevel.setValue(data.mLevel);
|
||||
break;
|
||||
case Constants.MESSAGE_WRITE:
|
||||
//byte[] writeBuf = (byte[]) msg.obj;
|
||||
// construct a string from the buffer
|
||||
//String writeMessage = new String(writeBuf);
|
||||
//mConversationArrayAdapter.add("Me: " + writeMessage);
|
||||
break;
|
||||
case Constants.MESSAGE_READ:
|
||||
//byte[] readBuf = (byte[]) msg.obj;
|
||||
// construct a string from the valid bytes in the buffer
|
||||
//String readMessage = new String(readBuf, 0, msg.arg1);
|
||||
//mConversationArrayAdapter.add(mConnectedDeviceName + ": " + readMessage);
|
||||
break;
|
||||
case Constants.MESSAGE_DEVICE_NAME:
|
||||
// save the connected device's name
|
||||
theFrag.mConnectedDeviceName = msg.getData().getString(Constants.DEVICE_NAME);
|
||||
if (null != activity) {
|
||||
Toast.makeText(activity, "Connected to "
|
||||
+ theFrag.mConnectedDeviceName, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case Constants.MESSAGE_TOAST:
|
||||
if (null != activity) {
|
||||
Toast.makeText(activity, msg.getData().getString(Constants.TOAST),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Handler mHandler = new MyInnerHandler(this);
|
||||
|
||||
private static final String TAG = "BluetoothChatFragment";
|
||||
|
||||
|
@ -182,53 +88,6 @@ public class BluetoothChatFragment extends Fragment {
|
|||
*/
|
||||
private BluetoothChatService mChatService = null;
|
||||
private boolean mIsBound;
|
||||
private ChannelService.ChannelServiceComm mChannelService;
|
||||
/**
|
||||
* The Handler that gets information back from the BluetoothChatService
|
||||
*/
|
||||
private boolean mChannelServiceBound = false;
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
// This is called when the connection with the service has been
|
||||
// established, giving us the service object we can use to
|
||||
// interact with the service. Because we have bound to a explicit
|
||||
// service that we know is running in our own process, we can
|
||||
// cast its IBinder to a concrete class and directly access it.
|
||||
mChatService = ((BluetoothChatService.BluetoothChatServiceI) service).getService();
|
||||
((BluetoothChatService.BluetoothChatServiceI) service).setHandler(mHandler);
|
||||
Log.d(TAG, "onServiceConnected()");
|
||||
}
|
||||
|
||||
public void onServiceDisconnected(ComponentName className) {
|
||||
// This is called when the connection with the service has been
|
||||
// unexpectedly disconnected -- that is, its process crashed.
|
||||
// Because it is running in our same process, we should never
|
||||
// see this happen.
|
||||
mChatService = null;
|
||||
|
||||
}
|
||||
};
|
||||
private ServiceConnection mChannelServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder serviceBinder) {
|
||||
Log.v(TAG, "mChannelServiceConnection.onServiceConnected...");
|
||||
|
||||
mChannelService = (ChannelService.ChannelServiceComm) serviceBinder;
|
||||
|
||||
|
||||
Log.v(TAG, "...mChannelServiceConnection.onServiceConnected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName arg0) {
|
||||
Log.v(TAG, "mChannelServiceConnection.onServiceDisconnected...");
|
||||
|
||||
// Clearing and disabling when disconnecting from ChannelService
|
||||
mChannelService = null;
|
||||
|
||||
Log.v(TAG, "...mChannelServiceConnection.onServiceDisconnected");
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -245,6 +104,7 @@ public class BluetoothChatFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
@ -257,8 +117,6 @@ public class BluetoothChatFragment extends Fragment {
|
|||
} else if (mChatService == null) {
|
||||
setupChat();
|
||||
}
|
||||
if (!mChannelServiceBound) doBindChannelService();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -268,9 +126,6 @@ public class BluetoothChatFragment extends Fragment {
|
|||
}
|
||||
Log.d(TAG, "onDestroy()");
|
||||
doUnbindService();
|
||||
doUnbindChannelService();
|
||||
mChannelServiceConnection = null;
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
@ -317,6 +172,28 @@ public class BluetoothChatFragment extends Fragment {
|
|||
mTimeText = (TextView) view.findViewById(R.id.Time);
|
||||
}
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
||||
// This is called when the connection with the service has been
|
||||
// established, giving us the service object we can use to
|
||||
// interact with the service. Because we have bound to a explicit
|
||||
// service that we know is running in our own process, we can
|
||||
// cast its IBinder to a concrete class and directly access it.
|
||||
mChatService = ((BluetoothChatService.BluetoothChatServiceI)service).getService();
|
||||
((BluetoothChatService.BluetoothChatServiceI)service).setHandler(mHandler);
|
||||
Log.d(TAG, "onServiceConnected()");
|
||||
}
|
||||
|
||||
public void onServiceDisconnected(ComponentName className) {
|
||||
// This is called when the connection with the service has been
|
||||
// unexpectedly disconnected -- that is, its process crashed.
|
||||
// Because it is running in our same process, we should never
|
||||
// see this happen.
|
||||
mChatService = null;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
void doBindService() {
|
||||
Log.d(TAG, "doBindService()");
|
||||
|
||||
|
@ -336,33 +213,6 @@ public class BluetoothChatFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void doBindChannelService() {
|
||||
Log.v(TAG, "doBindChannelService...");
|
||||
|
||||
// Binds to ChannelService. ChannelService binds and manages connection between the
|
||||
// app and the ANT Radio Service
|
||||
mChannelServiceBound = getActivity().bindService(new Intent(getActivity(), ChannelService.class), mChannelServiceConnection, Context.BIND_AUTO_CREATE);
|
||||
|
||||
if (!mChannelServiceBound) //If the bind returns false, run the unbind method to update the GUI
|
||||
doUnbindChannelService();
|
||||
|
||||
Log.i(TAG, " Channel Service binding = " + mChannelServiceBound);
|
||||
|
||||
Log.v(TAG, "...doBindChannelService");
|
||||
}
|
||||
|
||||
private void doUnbindChannelService() {
|
||||
Log.v(TAG, "doUnbindChannelService...");
|
||||
|
||||
if (mChannelServiceBound) {
|
||||
getActivity().unbindService(mChannelServiceConnection);
|
||||
|
||||
mChannelServiceBound = false;
|
||||
}
|
||||
|
||||
Log.v(TAG, "...doUnbindChannelService");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the UI and background operations for chat.
|
||||
*/
|
||||
|
@ -480,6 +330,86 @@ public class BluetoothChatFragment extends Fragment {
|
|||
actionBar.setSubtitle(subTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Handler that gets information back from the BluetoothChatService
|
||||
*/
|
||||
private final Handler mHandler = new Handler() {
|
||||
@SuppressLint("DefaultLocale")
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
FragmentActivity activity = getActivity();
|
||||
switch (msg.what) {
|
||||
case Constants.MESSAGE_STATE_CHANGE:
|
||||
switch (msg.arg1) {
|
||||
case BluetoothChatService.STATE_CONNECTED:
|
||||
setStatus(getString(R.string.title_connected_to, mConnectedDeviceName));
|
||||
//mConversationArrayAdapter.clear();
|
||||
mStartButton.setEnabled(true);
|
||||
mStopButton.setEnabled(true);
|
||||
mDisconnectButton.setEnabled(true);
|
||||
mLevel.setEnabled(true);
|
||||
mLevel.setValue(1);
|
||||
break;
|
||||
case BluetoothChatService.STATE_CONNECTING:
|
||||
setStatus(R.string.title_connecting);
|
||||
mStartButton.setEnabled(false);
|
||||
mStopButton.setEnabled(false);
|
||||
mDisconnectButton.setEnabled(false);
|
||||
mLevel.setEnabled(false);
|
||||
break;
|
||||
case BluetoothChatService.STATE_LISTEN:
|
||||
case BluetoothChatService.STATE_NONE:
|
||||
setStatus(R.string.title_not_connected);
|
||||
mStartButton.setEnabled(false);
|
||||
mStopButton.setEnabled(false);
|
||||
mDisconnectButton.setEnabled(false);
|
||||
mLevel.setEnabled(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Constants.MESSAGE_DATA:
|
||||
if (!(msg.obj instanceof IConsole.Data))
|
||||
return;
|
||||
IConsole.Data data = (IConsole.Data) msg.obj;
|
||||
mSpeedText.setText(String.format("% 3.1f", data.mSpeed10 / 10.0));
|
||||
mPowerText.setText(String.format("% 3.1f", data.mPower10 / 10.0));
|
||||
mRPMText.setText(String.format("%d", data.mRPM));
|
||||
mDistanceText.setText(String.format("% 3.1f", data.mDistance10 / 10.0));
|
||||
mCaloriesText.setText(String.format("% 3d", data.mCalories));
|
||||
mHFText.setText(String.format("%d", data.mHF));
|
||||
mTimeText.setText(String.format("%s",data.getTimeStr()));
|
||||
//mLevel.setValue(data.mLevel);
|
||||
break;
|
||||
case Constants.MESSAGE_WRITE:
|
||||
//byte[] writeBuf = (byte[]) msg.obj;
|
||||
// construct a string from the buffer
|
||||
//String writeMessage = new String(writeBuf);
|
||||
//mConversationArrayAdapter.add("Me: " + writeMessage);
|
||||
break;
|
||||
case Constants.MESSAGE_READ:
|
||||
//byte[] readBuf = (byte[]) msg.obj;
|
||||
// construct a string from the valid bytes in the buffer
|
||||
//String readMessage = new String(readBuf, 0, msg.arg1);
|
||||
//mConversationArrayAdapter.add(mConnectedDeviceName + ": " + readMessage);
|
||||
break;
|
||||
case Constants.MESSAGE_DEVICE_NAME:
|
||||
// save the connected device's name
|
||||
mConnectedDeviceName = msg.getData().getString(Constants.DEVICE_NAME);
|
||||
if (null != activity) {
|
||||
Toast.makeText(activity, "Connected to "
|
||||
+ mConnectedDeviceName, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case Constants.MESSAGE_TOAST:
|
||||
if (null != activity) {
|
||||
Toast.makeText(activity, msg.getData().getString(Constants.TOAST),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_CONNECT_DEVICE_SECURE:
|
||||
|
|
|
@ -23,12 +23,14 @@ import android.app.Service;
|
|||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -43,31 +45,31 @@ import java.util.UUID;
|
|||
* thread for performing data transmissions when connected.
|
||||
*/
|
||||
public class BluetoothChatService extends Service {
|
||||
// Constants that indicate the current connection state
|
||||
public static final int STATE_NONE = 0; // we're doing nothing
|
||||
public static final int STATE_LISTEN = 1; // now listening for incoming connections
|
||||
public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
|
||||
public static final int STATE_CONNECTED = 3; // now connected to a remote device
|
||||
// Debugging
|
||||
private static final String TAG = "BluetoothChatService";
|
||||
// Name for the SDP record when creating server socket
|
||||
private static final String NAME_SECURE = "BluetoothChatSecure";
|
||||
private static final String NAME_INSECURE = "BluetoothChatInsecure";
|
||||
|
||||
// Unique UUID for this application
|
||||
private static final UUID SERIAL_PORT_CLASS = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
||||
// Member fields
|
||||
private final BluetoothAdapter mAdapter;
|
||||
// This is the object that receives interactions from clients. See
|
||||
// RemoteService for a more complete example.
|
||||
private final IBinder mBinder = new BluetoothChatServiceI();
|
||||
private Handler mHandler;
|
||||
|
||||
private ConnectThread mConnectThread;
|
||||
private ConnectedThread mConnectedThread;
|
||||
private int mState;
|
||||
private int mNewState;
|
||||
private NotificationManager mNM;
|
||||
private int NOTIFICATION = R.string.local_service_started;
|
||||
|
||||
// Constants that indicate the current connection state
|
||||
public static final int STATE_NONE = 0; // we're doing nothing
|
||||
public static final int STATE_LISTEN = 1; // now listening for incoming connections
|
||||
public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
|
||||
public static final int STATE_CONNECTED = 3; // now connected to a remote device
|
||||
private NotificationManager mNM;
|
||||
|
||||
private int NOTIFICATION = R.string.local_service_started;
|
||||
|
||||
public BluetoothChatService() {
|
||||
super();
|
||||
|
@ -76,6 +78,16 @@ public class BluetoothChatService extends Service {
|
|||
mNewState = mState;
|
||||
}
|
||||
|
||||
|
||||
public class BluetoothChatServiceI extends Binder {
|
||||
BluetoothChatService getService() {
|
||||
return BluetoothChatService.this;
|
||||
}
|
||||
void setHandler(Handler handler) {
|
||||
mHandler = handler;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
@ -132,6 +144,11 @@ public class BluetoothChatService extends Service {
|
|||
return mBinder;
|
||||
}
|
||||
|
||||
|
||||
// This is the object that receives interactions from clients. See
|
||||
// RemoteService for a more complete example.
|
||||
private final IBinder mBinder = new BluetoothChatServiceI();
|
||||
|
||||
/**
|
||||
* Update UI title according to the current state of the chat connection
|
||||
*/
|
||||
|
@ -141,7 +158,6 @@ public class BluetoothChatService extends Service {
|
|||
mNewState = mState;
|
||||
|
||||
// Give the new state to the Handler so the UI Activity can update
|
||||
if (mHandler != null)
|
||||
mHandler.obtainMessage(Constants.MESSAGE_STATE_CHANGE, mNewState, -1).sendToTarget();
|
||||
}
|
||||
|
||||
|
@ -170,7 +186,6 @@ public class BluetoothChatService extends Service {
|
|||
super.onDestroy();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a notification while this service is running.
|
||||
*/
|
||||
|
@ -273,6 +288,7 @@ public class BluetoothChatService extends Service {
|
|||
updateUserInterfaceTitle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicate that the connection attempt failed and notify the UI Activity.
|
||||
*/
|
||||
|
@ -311,16 +327,6 @@ public class BluetoothChatService extends Service {
|
|||
BluetoothChatService.this.startBT();
|
||||
}
|
||||
|
||||
public class BluetoothChatServiceI extends Binder {
|
||||
BluetoothChatService getService() {
|
||||
return BluetoothChatService.this;
|
||||
}
|
||||
|
||||
void setHandler(Handler handler) {
|
||||
mHandler = handler;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This thread runs while attempting to make an outgoing connection
|
||||
* with a device. It runs straight through; the connection either
|
||||
|
@ -475,17 +481,9 @@ public class BluetoothChatService extends Service {
|
|||
}
|
||||
|
||||
|
||||
public boolean setLevel(int level) {
|
||||
return mmIConsole.setLevel(level);
|
||||
}
|
||||
|
||||
public boolean startIConsole() {
|
||||
return mmIConsole.start();
|
||||
}
|
||||
|
||||
public boolean stopIConsole() {
|
||||
return mmIConsole.stop();
|
||||
}
|
||||
public boolean setLevel(int level) { return mmIConsole.setLevel(level); }
|
||||
public boolean startIConsole() { return mmIConsole.start(); }
|
||||
public boolean stopIConsole() { return mmIConsole.stop(); }
|
||||
|
||||
public void cancel() {
|
||||
mmIConsole.stop();
|
||||
|
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 Dynastream Innovations Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.surfsite.iconsole;
|
||||
|
||||
import com.dsi.ant.AntService;
|
||||
import com.dsi.ant.channel.AntChannel;
|
||||
import com.dsi.ant.channel.AntChannelProvider;
|
||||
import com.dsi.ant.channel.ChannelNotAvailableException;
|
||||
import com.dsi.ant.channel.PredefinedNetwork;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ChannelService extends Service {
|
||||
private static final String TAG = "ChannelService";
|
||||
|
||||
private boolean mAntRadioServiceBound;
|
||||
private AntService mAntRadioService = null;
|
||||
private AntChannelProvider mAntChannelProvider = null;
|
||||
private boolean mAllowAddChannel = false;
|
||||
PowerChannelController powerChannelController = null;
|
||||
SpeedChannelController speedChannelController = null;
|
||||
|
||||
private ServiceConnection mAntRadioServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
// Must pass in the received IBinder object to correctly construct an AntService object
|
||||
mAntRadioService = new AntService(service);
|
||||
|
||||
try {
|
||||
// Getting a channel provider in order to acquire channels
|
||||
mAntChannelProvider = mAntRadioService.getChannelProvider();
|
||||
|
||||
// Initial check for number of channels available
|
||||
boolean mChannelAvailable = mAntChannelProvider.getNumChannelsAvailable() > 0;
|
||||
// Initial check for if legacy interface is in use. If the
|
||||
// legacy interface is in use, applications can free the ANT
|
||||
// radio by attempting to acquire a channel.
|
||||
boolean legacyInterfaceInUse = mAntChannelProvider.isLegacyInterfaceInUse();
|
||||
|
||||
// If there are channels OR legacy interface in use, allow adding channels
|
||||
if (mChannelAvailable || legacyInterfaceInUse) {
|
||||
mAllowAddChannel = true;
|
||||
} else {
|
||||
// If no channels available AND legacy interface is not in use, disallow adding channels
|
||||
mAllowAddChannel = false;
|
||||
}
|
||||
|
||||
|
||||
} catch (RemoteException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
die("Binder Died");
|
||||
|
||||
mAntChannelProvider = null;
|
||||
mAntRadioService = null;
|
||||
|
||||
mAllowAddChannel = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* The interface used to communicate with the ChannelService
|
||||
*/
|
||||
public class ChannelServiceComm extends Binder {
|
||||
|
||||
void setSpeed(double speed) {
|
||||
if (null != speedChannelController) {
|
||||
speedChannelController.speed = speed;
|
||||
}
|
||||
}
|
||||
|
||||
void setPower(int power) {
|
||||
if (null != powerChannelController) {
|
||||
powerChannelController.power = power;
|
||||
}
|
||||
}
|
||||
|
||||
void setCadence(int cadence) {
|
||||
if (null != powerChannelController) {
|
||||
powerChannelController.cadence = cadence;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all channels currently added.
|
||||
*/
|
||||
void clearAllChannels() {
|
||||
closeAllChannels();
|
||||
}
|
||||
}
|
||||
|
||||
public void openAllChannels() throws ChannelNotAvailableException {
|
||||
powerChannelController = new PowerChannelController(acquireChannel());
|
||||
speedChannelController = new SpeedChannelController(acquireChannel());
|
||||
}
|
||||
|
||||
private void closeAllChannels() {
|
||||
if (powerChannelController != null)
|
||||
powerChannelController.close();
|
||||
if (speedChannelController != null)
|
||||
speedChannelController.close();
|
||||
powerChannelController = null;
|
||||
speedChannelController = null;
|
||||
}
|
||||
|
||||
AntChannel acquireChannel() throws ChannelNotAvailableException {
|
||||
AntChannel mAntChannel = null;
|
||||
if (null != mAntChannelProvider) {
|
||||
try {
|
||||
/*
|
||||
* If applications require a channel with specific capabilities
|
||||
* (event buffering, background scanning etc.), a Capabilities
|
||||
* object should be created and then the specific capabilities
|
||||
* required set to true. Applications can specify both required
|
||||
* and desired Capabilities with both being passed in
|
||||
* acquireChannel(context, PredefinedNetwork,
|
||||
* requiredCapabilities, desiredCapabilities).
|
||||
*/
|
||||
mAntChannel = mAntChannelProvider.acquireChannel(this, PredefinedNetwork.ANT_PLUS_1);
|
||||
/*
|
||||
NetworkKey mNK = new NetworkKey(new byte[] { (byte)0xb9, (byte)0xa5, (byte)0x21, (byte)0xfb,
|
||||
(byte)0xbd, (byte)0x72, (byte)0xc3, (byte)0x45 });
|
||||
Log.v(TAG, mNK.toString());
|
||||
mAntChannel = mAntChannelProvider.acquireChannelOnPrivateNetwork(this, mNK);
|
||||
*/
|
||||
} catch (RemoteException e) {
|
||||
die("ACP Remote Ex");
|
||||
}
|
||||
}
|
||||
return mAntChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent arg0) {
|
||||
return new ChannelServiceComm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives AntChannelProvider state changes being sent from ANT Radio Service
|
||||
*/
|
||||
private final BroadcastReceiver mChannelProviderStateChangedReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (AntChannelProvider.ACTION_CHANNEL_PROVIDER_STATE_CHANGED.equals(intent.getAction())) {
|
||||
boolean update = false;
|
||||
// Retrieving the data contained in the intent
|
||||
int numChannels = intent.getIntExtra(AntChannelProvider.NUM_CHANNELS_AVAILABLE, 0);
|
||||
boolean legacyInterfaceInUse = intent.getBooleanExtra(AntChannelProvider.LEGACY_INTERFACE_IN_USE, false);
|
||||
|
||||
if (mAllowAddChannel) {
|
||||
// Was a acquire channel allowed
|
||||
// If no channels available AND legacy interface is not in use, disallow acquiring of channels
|
||||
if (0 == numChannels && !legacyInterfaceInUse) {
|
||||
mAllowAddChannel = false;
|
||||
update = true;
|
||||
closeAllChannels();
|
||||
}
|
||||
} else {
|
||||
// Acquire channels not allowed
|
||||
// If there are channels OR legacy interface in use, allow acquiring of channels
|
||||
if (numChannels > 0 || legacyInterfaceInUse) {
|
||||
mAllowAddChannel = true;
|
||||
update = true;
|
||||
try {
|
||||
openAllChannels();
|
||||
} catch (ChannelNotAvailableException exception) {
|
||||
Log.e(TAG, "Channel not available!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void doBindAntRadioService() {
|
||||
if (BuildConfig.DEBUG) Log.v(TAG, "doBindAntRadioService");
|
||||
|
||||
// Start listing for channel available intents
|
||||
registerReceiver(mChannelProviderStateChangedReceiver, new IntentFilter(AntChannelProvider.ACTION_CHANNEL_PROVIDER_STATE_CHANGED));
|
||||
|
||||
// Creating the intent and calling context.bindService() is handled by
|
||||
// the static bindService() method in AntService
|
||||
mAntRadioServiceBound = AntService.bindService(this, mAntRadioServiceConnection);
|
||||
}
|
||||
|
||||
private void doUnbindAntRadioService() {
|
||||
if (BuildConfig.DEBUG) Log.v(TAG, "doUnbindAntRadioService");
|
||||
|
||||
// Stop listing for channel available intents
|
||||
try {
|
||||
unregisterReceiver(mChannelProviderStateChangedReceiver);
|
||||
} catch (IllegalArgumentException exception) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Log.d(TAG, "Attempting to unregister a never registered Channel Provider State Changed receiver.");
|
||||
}
|
||||
|
||||
if (mAntRadioServiceBound) {
|
||||
try {
|
||||
unbindService(mAntRadioServiceConnection);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Not bound, that's what we want anyway
|
||||
}
|
||||
|
||||
mAntRadioServiceBound = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
mAntRadioServiceBound = false;
|
||||
|
||||
doBindAntRadioService();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
closeAllChannels();
|
||||
|
||||
doUnbindAntRadioService();
|
||||
mAntChannelProvider = null;
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
static void die(String error) {
|
||||
Log.e(TAG, "DIE: " + error);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,10 +30,8 @@ import android.util.Log;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
import org.surfsite.iconsole.ChannelService.ChannelServiceComm;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -72,16 +70,8 @@ public class MainActivity extends FragmentActivity {
|
|||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
|
||||
if(isFinishing())
|
||||
{
|
||||
stopService(new Intent(this, BluetoothChatService.class));
|
||||
stopService(new Intent(this, ChannelService.class));
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,292 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 Dynastream Innovations Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.surfsite.iconsole;
|
||||
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.dsi.ant.channel.AntChannel;
|
||||
import com.dsi.ant.channel.AntCommandFailedException;
|
||||
import com.dsi.ant.channel.IAntChannelEventHandler;
|
||||
import com.dsi.ant.message.ChannelId;
|
||||
import com.dsi.ant.message.ChannelType;
|
||||
import com.dsi.ant.message.EventCode;
|
||||
import com.dsi.ant.message.fromant.AcknowledgedDataMessage;
|
||||
import com.dsi.ant.message.fromant.ChannelEventMessage;
|
||||
import com.dsi.ant.message.fromant.MessageFromAntType;
|
||||
import com.dsi.ant.message.ipc.AntMessageParcel;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PowerChannelController {
|
||||
public static final int POWER_SENSOR_ID = 0x9e3d4b66;
|
||||
// The device type and transmission type to be part of the channel ID message
|
||||
private static final int CHANNEL_POWER_DEVICE_TYPE = 0x0B;
|
||||
private static final int CHANNEL_POWER_TRANSMISSION_TYPE = 5;
|
||||
// The period and frequency values the channel will be configured to
|
||||
private static final int CHANNEL_POWER_PERIOD = 8182; // 1 Hz
|
||||
private static final int CHANNEL_POWER_FREQUENCY = 57;
|
||||
private static final String TAG = PowerChannelController.class.getSimpleName();
|
||||
private static Random randGen = new Random();
|
||||
int power = 0;
|
||||
int cadence = 0;
|
||||
private AntChannel mAntChannel;
|
||||
private ChannelEventCallback mChannelEventCallback = new ChannelEventCallback();
|
||||
private boolean mIsOpen;
|
||||
|
||||
public PowerChannelController(AntChannel antChannel) {
|
||||
mAntChannel = antChannel;
|
||||
openChannel();
|
||||
}
|
||||
|
||||
boolean openChannel() {
|
||||
if (null != mAntChannel) {
|
||||
if (mIsOpen) {
|
||||
Log.w(TAG, "Channel was already open");
|
||||
} else {
|
||||
// Channel ID message contains device number, type and transmission type. In
|
||||
// order for master (TX) channels and slave (RX) channels to connect, they
|
||||
// must have the same channel ID, or wildcard (0) is used.
|
||||
ChannelId channelId = new ChannelId(POWER_SENSOR_ID & 0xFFFF,
|
||||
CHANNEL_POWER_DEVICE_TYPE, CHANNEL_POWER_TRANSMISSION_TYPE);
|
||||
|
||||
try {
|
||||
// Setting the channel event handler so that we can receive messages from ANT
|
||||
mAntChannel.setChannelEventHandler(mChannelEventCallback);
|
||||
|
||||
// Performs channel assignment by assigning the type to the channel. Additional
|
||||
// features (such as, background scanning and frequency agility) can be enabled
|
||||
// by passing an ExtendedAssignment object to assign(ChannelType, ExtendedAssignment).
|
||||
mAntChannel.assign(ChannelType.BIDIRECTIONAL_MASTER);
|
||||
|
||||
/*
|
||||
* Configures the channel ID, messaging period and rf frequency after assigning,
|
||||
* then opening the channel.
|
||||
*
|
||||
* For any additional ANT features such as proximity search or background scanning, refer to
|
||||
* the ANT Protocol Doc found at:
|
||||
* http://www.thisisant.com/resources/ant-message-protocol-and-usage/
|
||||
*/
|
||||
mAntChannel.setChannelId(channelId);
|
||||
mAntChannel.setPeriod(CHANNEL_POWER_PERIOD);
|
||||
mAntChannel.setRfFrequency(CHANNEL_POWER_FREQUENCY);
|
||||
mAntChannel.open();
|
||||
mIsOpen = true;
|
||||
|
||||
Log.d(TAG, "Opened channel with device number: " + POWER_SENSOR_ID);
|
||||
} catch (RemoteException e) {
|
||||
channelError(e);
|
||||
} catch (AntCommandFailedException e) {
|
||||
// This will release, and therefore unassign if required
|
||||
channelError("Open failed", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "No channel available");
|
||||
}
|
||||
|
||||
return mIsOpen;
|
||||
}
|
||||
|
||||
|
||||
void channelError(RemoteException e) {
|
||||
String logString = "Remote service communication failed.";
|
||||
|
||||
Log.e(TAG, logString);
|
||||
|
||||
}
|
||||
|
||||
void channelError(String error, AntCommandFailedException e) {
|
||||
StringBuilder logString;
|
||||
|
||||
if (e.getResponseMessage() != null) {
|
||||
String initiatingMessageId = "0x" + Integer.toHexString(
|
||||
e.getResponseMessage().getInitiatingMessageId());
|
||||
String rawResponseCode = "0x" + Integer.toHexString(
|
||||
e.getResponseMessage().getRawResponseCode());
|
||||
|
||||
logString = new StringBuilder(error)
|
||||
.append(". Command ")
|
||||
.append(initiatingMessageId)
|
||||
.append(" failed with code ")
|
||||
.append(rawResponseCode);
|
||||
} else {
|
||||
String attemptedMessageId = "0x" + Integer.toHexString(
|
||||
e.getAttemptedMessageType().getMessageId());
|
||||
String failureReason = e.getFailureReason().toString();
|
||||
|
||||
logString = new StringBuilder(error)
|
||||
.append(". Command ")
|
||||
.append(attemptedMessageId)
|
||||
.append(" failed with reason ")
|
||||
.append(failureReason);
|
||||
}
|
||||
|
||||
Log.e(TAG, logString.toString());
|
||||
|
||||
mAntChannel.release();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
// TODO kill all our resources
|
||||
if (null != mAntChannel) {
|
||||
mIsOpen = false;
|
||||
|
||||
// Releasing the channel to make it available for others.
|
||||
// After releasing, the AntChannel instance cannot be reused.
|
||||
mAntChannel.release();
|
||||
mAntChannel = null;
|
||||
}
|
||||
|
||||
Log.e(TAG, "Channel Closed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements the Channel Event Handler Interface so that messages can be
|
||||
* received and channel death events can be handled.
|
||||
*/
|
||||
public class ChannelEventCallback implements IAntChannelEventHandler {
|
||||
|
||||
int cnt = 0;
|
||||
int eventCount = 0;
|
||||
int cumulativePower = 0;
|
||||
|
||||
@Override
|
||||
public void onChannelDeath() {
|
||||
// Display channel death message when channel dies
|
||||
Log.e(TAG, "Channel Death");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveMessage(MessageFromAntType messageType, AntMessageParcel antParcel) {
|
||||
Log.d(TAG, "Rx: " + antParcel);
|
||||
Log.d(TAG, "Message Type: " + messageType);
|
||||
byte[] payload = new byte[8];
|
||||
|
||||
// Switching on message type to handle different types of messages
|
||||
switch (messageType) {
|
||||
// If data message, construct from parcel and update channel data
|
||||
case BROADCAST_DATA:
|
||||
// Rx Data
|
||||
//updateData(new BroadcastDataMessage(antParcel).getPayload());
|
||||
break;
|
||||
case ACKNOWLEDGED_DATA:
|
||||
// Rx Data
|
||||
//updateData(new AcknowledgedDataMessage(antParcel).getPayload());
|
||||
payload = new AcknowledgedDataMessage(antParcel).getPayload();
|
||||
Log.d(TAG, "AcknowledgedDataMessage: " + payload);
|
||||
|
||||
if ((payload[0] == 0) && (payload[1] == 1) && (payload[2] == (byte)0xAA)) {
|
||||
payload[0] = (byte) 0x01;
|
||||
payload[1] = (byte) 0xAC;
|
||||
payload[2] = (byte) 0xFF;
|
||||
payload[3] = (byte) 0xFF;
|
||||
payload[4] = (byte) 0xFF;
|
||||
payload[5] = (byte) 0xFF;
|
||||
payload[6] = (byte) 0x00;
|
||||
payload[7] = (byte) 0x00;
|
||||
try {
|
||||
// Setting the data to be broadcast on the next channel period
|
||||
mAntChannel.setBroadcastData(payload);
|
||||
} catch (RemoteException e) {
|
||||
channelError(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHANNEL_EVENT:
|
||||
// Constructing channel event message from parcel
|
||||
ChannelEventMessage eventMessage = new ChannelEventMessage(antParcel);
|
||||
EventCode code = eventMessage.getEventCode();
|
||||
Log.d(TAG, "Event Code: " + code);
|
||||
|
||||
// Switching on event code to handle the different types of channel events
|
||||
switch (code) {
|
||||
case TX:
|
||||
cnt += 1;
|
||||
|
||||
if (cnt % 61 == 15) {
|
||||
payload[0] = (byte) 0x50;
|
||||
payload[1] = (byte) 0xFF;
|
||||
payload[2] = (byte) 0xFF;
|
||||
payload[3] = (byte) 0x01;
|
||||
payload[4] = (byte) 0xFF;
|
||||
payload[5] = (byte) 0x00;
|
||||
payload[6] = (byte) 0x01;
|
||||
payload[7] = (byte) 0x00;
|
||||
} else if (cnt % 61 == 30) {
|
||||
payload[0] = (byte) 0x51;
|
||||
payload[1] = (byte) 0xFF;
|
||||
payload[2] = (byte) 0xFF;
|
||||
payload[3] = (byte) 0x01;
|
||||
payload[4] = (byte) ((POWER_SENSOR_ID) & 0xFF);
|
||||
payload[5] = (byte) ((POWER_SENSOR_ID >> 8) & 0xFF);
|
||||
payload[6] = (byte) ((POWER_SENSOR_ID >> 16) & 0xFF);
|
||||
payload[7] = (byte) ((POWER_SENSOR_ID >> 24) & 0xFF);
|
||||
} else {
|
||||
eventCount = (eventCount + 1) & 0xFF;
|
||||
cumulativePower = (cumulativePower + power) & 0xFFFF;
|
||||
payload[0] = (byte) 0x10;
|
||||
payload[1] = (byte) eventCount;
|
||||
payload[2] = (byte) 0xFF;
|
||||
payload[3] = (byte) cadence;
|
||||
payload[4] = (byte) ((cumulativePower) & 0xFF);
|
||||
payload[5] = (byte) ((cumulativePower >> 8) & 0xFF);
|
||||
payload[6] = (byte) ((power) & 0xFF);
|
||||
payload[7] = (byte) ((power >> 8) & 0xFF);
|
||||
}
|
||||
|
||||
if (mIsOpen) {
|
||||
try {
|
||||
// Setting the data to be broadcast on the next channel period
|
||||
mAntChannel.setBroadcastData(payload);
|
||||
} catch (RemoteException e) {
|
||||
channelError(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHANNEL_COLLISION:
|
||||
cnt += 1;
|
||||
break;
|
||||
case RX_SEARCH_TIMEOUT:
|
||||
// TODO May want to keep searching
|
||||
Log.e(TAG, "No Device Found");
|
||||
break;
|
||||
case CHANNEL_CLOSED:
|
||||
case RX_FAIL:
|
||||
case RX_FAIL_GO_TO_SEARCH:
|
||||
case TRANSFER_RX_FAILED:
|
||||
case TRANSFER_TX_COMPLETED:
|
||||
case TRANSFER_TX_FAILED:
|
||||
case TRANSFER_TX_START:
|
||||
case UNKNOWN:
|
||||
// TODO More complex communication will need to handle these events
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ANT_VERSION:
|
||||
case BURST_TRANSFER_DATA:
|
||||
case CAPABILITIES:
|
||||
case CHANNEL_ID:
|
||||
case CHANNEL_RESPONSE:
|
||||
case CHANNEL_STATUS:
|
||||
case SERIAL_NUMBER:
|
||||
case OTHER:
|
||||
// TODO More complex communication will need to handle these message types
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,306 +0,0 @@
|
|||
/*
|
||||
* Copyright 2012 Dynastream Innovations Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package org.surfsite.iconsole;
|
||||
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.dsi.ant.channel.AntChannel;
|
||||
import com.dsi.ant.channel.AntCommandFailedException;
|
||||
import com.dsi.ant.channel.IAntChannelEventHandler;
|
||||
import com.dsi.ant.message.ChannelId;
|
||||
import com.dsi.ant.message.ChannelType;
|
||||
import com.dsi.ant.message.EventCode;
|
||||
import com.dsi.ant.message.fromant.ChannelEventMessage;
|
||||
import com.dsi.ant.message.fromant.MessageFromAntType;
|
||||
import com.dsi.ant.message.ipc.AntMessageParcel;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class SpeedChannelController {
|
||||
// The device type and transmission type to be part of the channel ID message
|
||||
private static final int CHANNEL_SPEED_DEVICE_TYPE = 0x7B;
|
||||
private static final int CHANNEL_SPEED_TRANSMISSION_TYPE = 1;
|
||||
|
||||
// The period and frequency values the channel will be configured to
|
||||
private static final int CHANNEL_SPEED_PERIOD = 8118; // 1 Hz
|
||||
private static final int CHANNEL_SPEED_FREQUENCY = 57;
|
||||
|
||||
private static final String TAG = SpeedChannelController.class.getSimpleName();
|
||||
public static final int SPEED_SENSOR_ID = 0x9e3d4b65;
|
||||
|
||||
private static Random randGen = new Random();
|
||||
|
||||
private AntChannel mAntChannel;
|
||||
|
||||
private ChannelEventCallback mChannelEventCallback = new ChannelEventCallback();
|
||||
|
||||
|
||||
private boolean mIsOpen;
|
||||
double speed = 0.0;
|
||||
|
||||
public SpeedChannelController(AntChannel antChannel) {
|
||||
mAntChannel = antChannel;
|
||||
openChannel();
|
||||
}
|
||||
|
||||
boolean openChannel() {
|
||||
if (null != mAntChannel) {
|
||||
if (mIsOpen) {
|
||||
Log.w(TAG, "Channel was already open");
|
||||
} else {
|
||||
// Channel ID message contains device number, type and transmission type. In
|
||||
// order for master (TX) channels and slave (RX) channels to connect, they
|
||||
// must have the same channel ID, or wildcard (0) is used.
|
||||
ChannelId channelId = new ChannelId(SPEED_SENSOR_ID & 0xFFFF,
|
||||
CHANNEL_SPEED_DEVICE_TYPE, CHANNEL_SPEED_TRANSMISSION_TYPE);
|
||||
|
||||
try {
|
||||
// Setting the channel event handler so that we can receive messages from ANT
|
||||
mAntChannel.setChannelEventHandler(mChannelEventCallback);
|
||||
|
||||
// Performs channel assignment by assigning the type to the channel. Additional
|
||||
// features (such as, background scanning and frequency agility) can be enabled
|
||||
// by passing an ExtendedAssignment object to assign(ChannelType, ExtendedAssignment).
|
||||
mAntChannel.assign(ChannelType.BIDIRECTIONAL_MASTER);
|
||||
|
||||
/*
|
||||
* Configures the channel ID, messaging period and rf frequency after assigning,
|
||||
* then opening the channel.
|
||||
*
|
||||
* For any additional ANT features such as proximity search or background scanning, refer to
|
||||
* the ANT Protocol Doc found at:
|
||||
* http://www.thisisant.com/resources/ant-message-protocol-and-usage/
|
||||
*/
|
||||
mAntChannel.setChannelId(channelId);
|
||||
mAntChannel.setPeriod(CHANNEL_SPEED_PERIOD);
|
||||
mAntChannel.setRfFrequency(CHANNEL_SPEED_FREQUENCY);
|
||||
mAntChannel.open();
|
||||
mIsOpen = true;
|
||||
|
||||
Log.d(TAG, "Opened channel with device number: " + SPEED_SENSOR_ID);
|
||||
} catch (RemoteException e) {
|
||||
channelError(e);
|
||||
} catch (AntCommandFailedException e) {
|
||||
// This will release, and therefore unassign if required
|
||||
channelError("Open failed", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "No channel available");
|
||||
}
|
||||
|
||||
return mIsOpen;
|
||||
}
|
||||
|
||||
void channelError(RemoteException e) {
|
||||
String logString = "Remote service communication failed.";
|
||||
|
||||
Log.e(TAG, logString);
|
||||
}
|
||||
|
||||
void channelError(String error, AntCommandFailedException e) {
|
||||
StringBuilder logString;
|
||||
|
||||
if (e.getResponseMessage() != null) {
|
||||
String initiatingMessageId = "0x" + Integer.toHexString(
|
||||
e.getResponseMessage().getInitiatingMessageId());
|
||||
String rawResponseCode = "0x" + Integer.toHexString(
|
||||
e.getResponseMessage().getRawResponseCode());
|
||||
|
||||
logString = new StringBuilder(error)
|
||||
.append(". Command ")
|
||||
.append(initiatingMessageId)
|
||||
.append(" failed with code ")
|
||||
.append(rawResponseCode);
|
||||
} else {
|
||||
String attemptedMessageId = "0x" + Integer.toHexString(
|
||||
e.getAttemptedMessageType().getMessageId());
|
||||
String failureReason = e.getFailureReason().toString();
|
||||
|
||||
logString = new StringBuilder(error)
|
||||
.append(". Command ")
|
||||
.append(attemptedMessageId)
|
||||
.append(" failed with reason ")
|
||||
.append(failureReason);
|
||||
}
|
||||
|
||||
Log.e(TAG, logString.toString());
|
||||
|
||||
mAntChannel.release();
|
||||
|
||||
Log.e(TAG, "ANT Command Failed");
|
||||
}
|
||||
|
||||
public void close() {
|
||||
// TODO kill all our resources
|
||||
if (null != mAntChannel) {
|
||||
mIsOpen = false;
|
||||
|
||||
// Releasing the channel to make it available for others.
|
||||
// After releasing, the AntChannel instance cannot be reused.
|
||||
mAntChannel.release();
|
||||
mAntChannel = null;
|
||||
}
|
||||
|
||||
Log.e(TAG, "Channel Closed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements the Channel Event Handler Interface so that messages can be
|
||||
* received and channel death events can be handled.
|
||||
*/
|
||||
public class ChannelEventCallback implements IAntChannelEventHandler {
|
||||
int revCounts = 0;
|
||||
int ucMessageCount = 0;
|
||||
byte ucPageChange = 0;
|
||||
byte ucExtMesgType = 1;
|
||||
long lastTime = 0;
|
||||
double way;
|
||||
int rev;
|
||||
double remWay;
|
||||
double wheel = 0.1;
|
||||
|
||||
@Override
|
||||
public void onChannelDeath() {
|
||||
// Display channel death message when channel dies
|
||||
Log.e(TAG, "Channel Death");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveMessage(MessageFromAntType messageType, AntMessageParcel antParcel) {
|
||||
Log.d(TAG, "Rx: " + antParcel);
|
||||
Log.d(TAG, "Message Type: " + messageType);
|
||||
|
||||
// Switching on message type to handle different types of messages
|
||||
switch (messageType) {
|
||||
// If data message, construct from parcel and update channel data
|
||||
case BROADCAST_DATA:
|
||||
// Rx Data
|
||||
//updateData(new BroadcastDataMessage(antParcel).getPayload());
|
||||
break;
|
||||
case ACKNOWLEDGED_DATA:
|
||||
// Rx Data
|
||||
//updateData(new AcknowledgedDataMessage(antParcel).getPayload());
|
||||
break;
|
||||
case CHANNEL_EVENT:
|
||||
// Constructing channel event message from parcel
|
||||
ChannelEventMessage eventMessage = new ChannelEventMessage(antParcel);
|
||||
EventCode code = eventMessage.getEventCode();
|
||||
Log.d(TAG, "Event Code: " + code);
|
||||
|
||||
// Switching on event code to handle the different types of channel events
|
||||
switch (code) {
|
||||
case TX:
|
||||
long unixTime = System.currentTimeMillis() / 1000L;
|
||||
|
||||
if (lastTime != 0) {
|
||||
way = speed * (unixTime - lastTime) / 3.6 + remWay;
|
||||
rev = (int)(way / wheel + 0.5);
|
||||
remWay = way - rev * wheel;
|
||||
revCounts += rev;
|
||||
}
|
||||
lastTime = unixTime;
|
||||
|
||||
ucPageChange += 0x20;
|
||||
ucPageChange &= 0xF0;
|
||||
ucMessageCount += 1;
|
||||
byte[] payload = new byte[8];
|
||||
|
||||
if (ucMessageCount >= 65) {
|
||||
if (ucExtMesgType >= 4)
|
||||
ucExtMesgType = 1;
|
||||
|
||||
if (ucExtMesgType == 1) {
|
||||
int halfunixTime = (int) (unixTime / 2L);
|
||||
payload[0] = (byte) ((byte) 0x01 | (byte) (ucPageChange & (byte) 0x80));
|
||||
payload[1] = (byte) (halfunixTime & 0xFF);
|
||||
payload[2] = (byte) ((halfunixTime >> 8) & 0xFF);
|
||||
payload[3] = (byte) ((halfunixTime >> 16) & 0xFF);
|
||||
}
|
||||
else if (ucExtMesgType == 2) {
|
||||
payload[0] = (byte) ((byte) 0x02 | (byte) (ucPageChange & (byte) 0x80));
|
||||
payload[1] = (byte) 0xFF;
|
||||
payload[2] = (byte) ((SPEED_SENSOR_ID >> 16) & 0xFF);
|
||||
payload[3] = (byte) ((SPEED_SENSOR_ID >> 24) & 0xFF);
|
||||
}
|
||||
else if (ucExtMesgType == 3) {
|
||||
payload[0] = (byte) ((byte) 0x03 | (byte) (ucPageChange & (byte) 0x80));
|
||||
payload[1] = (byte) 0x01;
|
||||
payload[2] = (byte) 0x01;
|
||||
payload[3] = (byte) 0x01;
|
||||
}
|
||||
if (ucMessageCount >= 68) {
|
||||
ucMessageCount = 0;
|
||||
ucExtMesgType += 1;
|
||||
}
|
||||
} else {
|
||||
payload[0] = (byte) (ucPageChange & 0x80);
|
||||
payload[1] = (byte) 0xFF;
|
||||
payload[2] = (byte) 0xFF;
|
||||
payload[3] = (byte) 0xFF;
|
||||
}
|
||||
|
||||
int unixTime1024 = (int) (unixTime * 1024);
|
||||
payload[4] = (byte) (unixTime1024 & 0xFF);
|
||||
payload[5] = (byte) ((unixTime1024 >> 8) & 0xFF);
|
||||
payload[6] = (byte) (revCounts & 0xFF);
|
||||
payload[7] = (byte) ((revCounts >> 8) & 0xFF);
|
||||
|
||||
if (mIsOpen) {
|
||||
try {
|
||||
// Setting the data to be broadcast on the next channel period
|
||||
mAntChannel.setBroadcastData(payload);
|
||||
} catch (RemoteException e) {
|
||||
channelError(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CHANNEL_COLLISION:
|
||||
ucPageChange += 0x20;
|
||||
ucPageChange &= 0xF0;
|
||||
ucMessageCount += 1;
|
||||
break;
|
||||
case RX_SEARCH_TIMEOUT:
|
||||
// TODO May want to keep searching
|
||||
Log.e(TAG, "No Device Found");
|
||||
break;
|
||||
case CHANNEL_CLOSED:
|
||||
case RX_FAIL:
|
||||
case RX_FAIL_GO_TO_SEARCH:
|
||||
case TRANSFER_RX_FAILED:
|
||||
case TRANSFER_TX_COMPLETED:
|
||||
case TRANSFER_TX_FAILED:
|
||||
case TRANSFER_TX_START:
|
||||
case UNKNOWN:
|
||||
// TODO More complex communication will need to handle these events
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ANT_VERSION:
|
||||
case BURST_TRANSFER_DATA:
|
||||
case CAPABILITIES:
|
||||
case CHANNEL_ID:
|
||||
case CHANNEL_RESPONSE:
|
||||
case CHANNEL_STATUS:
|
||||
case SERIAL_NUMBER:
|
||||
case OTHER:
|
||||
// TODO More complex communication will need to handle these message types
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -101,7 +101,7 @@
|
|||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Power corr"
|
||||
android:text="Power"
|
||||
app:layout_constraintBottom_toTopOf="@+id/Power"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/guidelineleft"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<string name="power_n0_0_w">0.0</string>
|
||||
<string name="level">Level</string>
|
||||
<string name="local_service_started">OpeniConsole Bluetooth active</string>
|
||||
<string name="local_service_label">OpeniConsole - TEST</string>
|
||||
<string name="local_service_label">OpeniConsole</string>
|
||||
<string name="secure_connect">Connect to iConsole</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -24,6 +24,6 @@ Contribute via pull requests. If you want to do major contributions, drop me a m
|
|||
- workout recording to FIT/TCX/GPX
|
||||
- workout profiles
|
||||
- Google street view cycling
|
||||
- sensor data broadcasting via ANT (works, message me for a howto or look [here](https://github.com/haraldh/iconsole-android/issues/4))
|
||||
- sensor data broadcasting via ANT
|
||||
|
||||
See also my [python prototype](https://github.com/haraldh/iconsole) for the bluetooth protocol reverse engineering and sensor broadcasting.
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
configurations.maybeCreate("default")
|
||||
artifacts.add("default", file('android_antlib_4-14-0.jar'))
|
|
@ -6,7 +6,7 @@ buildscript {
|
|||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Mon Apr 12 12:52:47 CEST 2021
|
||||
#Fri Jul 06 15:08:55 CEST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="iconsole-android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id="iconsole-android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
|
@ -8,12 +8,11 @@
|
|||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1 +1,4 @@
|
|||
include 'Application', ':android_antlib_4-14'
|
||||
|
||||
|
||||
|
||||
include 'Application'
|
||||
|
|
Loading…
Reference in a new issue