Compare commits
	
		
			10 commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2675f949a2 | |||
| d2ab7de012 | |||
| 449c7e34f4 | |||
| b1c1a0cb1f | |||
| 
							 | 
						a7623d0662 | ||
| 2da8828ef1 | |||
| 5dc2a12449 | |||
| 
							 | 
						326b3576ff | ||
| 
							 | 
						3f58a7d10d | ||
| 
							 | 
						7ebf206688 | 
					 28 changed files with 1450 additions and 316 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								.idea/caches/build_file_checksums.ser
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.idea/caches/build_file_checksums.ser
									
										
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								.idea/caches/gradle_models.ser
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.idea/caches/gradle_models.ser
									
										
									
										generated
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										116
									
								
								.idea/codeStyles/Project.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								.idea/codeStyles/Project.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,116 @@
 | 
				
			||||||
 | 
					<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>
 | 
				
			||||||
							
								
								
									
										8
									
								
								.idea/compiler.xml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								.idea/compiler.xml
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<project version="4">
 | 
					<project version="4">
 | 
				
			||||||
  <component name="CompilerConfiguration">
 | 
					  <component name="CompilerConfiguration">
 | 
				
			||||||
    <resourceExtensions />
 | 
					 | 
				
			||||||
    <wildcardResourcePatterns>
 | 
					    <wildcardResourcePatterns>
 | 
				
			||||||
      <entry name="!?*.java" />
 | 
					      <entry name="!?*.java" />
 | 
				
			||||||
      <entry name="!?*.form" />
 | 
					      <entry name="!?*.form" />
 | 
				
			||||||
| 
						 | 
					@ -12,11 +11,6 @@
 | 
				
			||||||
      <entry name="!?*.kt" />
 | 
					      <entry name="!?*.kt" />
 | 
				
			||||||
      <entry name="!?*.clj" />
 | 
					      <entry name="!?*.clj" />
 | 
				
			||||||
    </wildcardResourcePatterns>
 | 
					    </wildcardResourcePatterns>
 | 
				
			||||||
    <annotationProcessing>
 | 
					    <bytecodeTargetLevel target="1.8" />
 | 
				
			||||||
      <profile default="true" name="Default" enabled="false">
 | 
					 | 
				
			||||||
        <processorPath useClasspath="true" />
 | 
					 | 
				
			||||||
      </profile>
 | 
					 | 
				
			||||||
    </annotationProcessing>
 | 
					 | 
				
			||||||
    <bytecodeTargetLevel target="1.7" />
 | 
					 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										5
									
								
								.idea/gradle.xml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								.idea/gradle.xml
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -1,17 +1,22 @@
 | 
				
			||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<project version="4">
 | 
					<project version="4">
 | 
				
			||||||
 | 
					  <component name="GradleMigrationSettings" migrationVersion="1" />
 | 
				
			||||||
  <component name="GradleSettings">
 | 
					  <component name="GradleSettings">
 | 
				
			||||||
    <option name="linkedExternalProjectsSettings">
 | 
					    <option name="linkedExternalProjectsSettings">
 | 
				
			||||||
      <GradleProjectSettings>
 | 
					      <GradleProjectSettings>
 | 
				
			||||||
 | 
					        <option name="delegatedBuild" value="true" />
 | 
				
			||||||
 | 
					        <option name="testRunner" value="PLATFORM" />
 | 
				
			||||||
        <option name="distributionType" value="DEFAULT_WRAPPED" />
 | 
					        <option name="distributionType" value="DEFAULT_WRAPPED" />
 | 
				
			||||||
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
 | 
					        <option name="externalProjectPath" value="$PROJECT_DIR$" />
 | 
				
			||||||
        <option name="modules">
 | 
					        <option name="modules">
 | 
				
			||||||
          <set>
 | 
					          <set>
 | 
				
			||||||
            <option value="$PROJECT_DIR$" />
 | 
					            <option value="$PROJECT_DIR$" />
 | 
				
			||||||
            <option value="$PROJECT_DIR$/Application" />
 | 
					            <option value="$PROJECT_DIR$/Application" />
 | 
				
			||||||
 | 
					            <option value="$PROJECT_DIR$/android_antlib_4-14" />
 | 
				
			||||||
          </set>
 | 
					          </set>
 | 
				
			||||||
        </option>
 | 
					        </option>
 | 
				
			||||||
        <option name="resolveModulePerSourceSet" value="false" />
 | 
					        <option name="resolveModulePerSourceSet" value="false" />
 | 
				
			||||||
 | 
					        <option name="useQualifiedModuleNames" value="true" />
 | 
				
			||||||
      </GradleProjectSettings>
 | 
					      </GradleProjectSettings>
 | 
				
			||||||
    </option>
 | 
					    </option>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										30
									
								
								.idea/jarRepositories.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								.idea/jarRepositories.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,30 @@
 | 
				
			||||||
 | 
					<?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>
 | 
				
			||||||
							
								
								
									
										27
									
								
								.idea/misc.xml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										27
									
								
								.idea/misc.xml
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -5,26 +5,47 @@
 | 
				
			||||||
    <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
 | 
					    <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
 | 
				
			||||||
    <option name="myNullables">
 | 
					    <option name="myNullables">
 | 
				
			||||||
      <value>
 | 
					      <value>
 | 
				
			||||||
        <list size="4">
 | 
					        <list size="15">
 | 
				
			||||||
          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
 | 
					          <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="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="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="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>
 | 
					        </list>
 | 
				
			||||||
      </value>
 | 
					      </value>
 | 
				
			||||||
    </option>
 | 
					    </option>
 | 
				
			||||||
    <option name="myNotNulls">
 | 
					    <option name="myNotNulls">
 | 
				
			||||||
      <value>
 | 
					      <value>
 | 
				
			||||||
        <list size="4">
 | 
					        <list size="14">
 | 
				
			||||||
          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
 | 
					          <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="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="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="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>
 | 
					        </list>
 | 
				
			||||||
      </value>
 | 
					      </value>
 | 
				
			||||||
    </option>
 | 
					    </option>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
 | 
					  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
 | 
				
			||||||
    <output url="file://$PROJECT_DIR$/build/classes" />
 | 
					    <output url="file://$PROJECT_DIR$/build/classes" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="ProjectType">
 | 
					  <component name="ProjectType">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								.idea/modules.xml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								.idea/modules.xml
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -2,8 +2,9 @@
 | 
				
			||||||
<project version="4">
 | 
					<project version="4">
 | 
				
			||||||
  <component name="ProjectModuleManager">
 | 
					  <component name="ProjectModuleManager">
 | 
				
			||||||
    <modules>
 | 
					    <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$/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>
 | 
					    </modules>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										83
									
								
								.idea/modules/Application/iconsole-android.Application.iml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								.idea/modules/Application/iconsole-android.Application.iml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,83 @@
 | 
				
			||||||
 | 
					<?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>
 | 
				
			||||||
							
								
								
									
										28
									
								
								.idea/modules/android_antlib_4-14/iconsole-android.android_antlib_4-14.iml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.idea/modules/android_antlib_4-14/iconsole-android.android_antlib_4-14.iml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					<?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>
 | 
				
			||||||
| 
						 | 
					@ -1,134 +0,0 @@
 | 
				
			||||||
<?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,10 +6,11 @@ buildscript {
 | 
				
			||||||
            url 'https://maven.google.com/'
 | 
					            url 'https://maven.google.com/'
 | 
				
			||||||
            name 'Google'
 | 
					            name 'Google'
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        google()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dependencies {
 | 
					    dependencies {
 | 
				
			||||||
        classpath 'com.android.tools.build:gradle:3.1.3'
 | 
					        classpath 'com.android.tools.build:gradle:4.1.3'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,13 +25,15 @@ repositories {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dependencies {
 | 
					dependencies {
 | 
				
			||||||
    implementation "com.android.support:gridlayout-v7:27.1.1"
 | 
					    implementation "com.android.support:gridlayout-v7:28.0.0"
 | 
				
			||||||
    implementation "com.android.support:cardview-v7:27.1.1"
 | 
					    implementation "com.android.support:cardview-v7:28.0.0"
 | 
				
			||||||
    implementation "com.android.support:appcompat-v7:27.1.1"
 | 
					    implementation "com.android.support:appcompat-v7:28.0.0"
 | 
				
			||||||
    implementation 'com.android.support:support-v13:27.1.1'
 | 
					    implementation 'com.android.support:support-v13:28.0.0'
 | 
				
			||||||
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
 | 
					    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
 | 
				
			||||||
 | 
					    implementation project(':android_antlib_4-14')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// The sample build uses multiple directories to
 | 
					// The sample build uses multiple directories to
 | 
				
			||||||
// keep boilerplate and common code separate from
 | 
					// keep boilerplate and common code separate from
 | 
				
			||||||
// the main sample code.
 | 
					// the main sample code.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,15 +34,18 @@
 | 
				
			||||||
        >
 | 
					        >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <activity
 | 
					        <activity
 | 
				
			||||||
            android:name=".MainActivity"
 | 
					            android:name="org.surfsite.iconsole.MainActivity"
 | 
				
			||||||
            android:configChanges="orientation|keyboardHidden"
 | 
					            android:configChanges="orientation|keyboardHidden"
 | 
				
			||||||
            android:label="@string/app_name" android:launchMode="singleTop">
 | 
					            android:label="@string/app_name" android:launchMode="singleTop">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <intent-filter>
 | 
					            <intent-filter>
 | 
				
			||||||
                <action android:name="android.intent.action.MAIN"/>
 | 
					                <action android:name="android.intent.action.MAIN" />
 | 
				
			||||||
                <category android:name="android.intent.category.LAUNCHER"/>
 | 
					
 | 
				
			||||||
 | 
					                <category android:name="android.intent.category.LAUNCHER" />
 | 
				
			||||||
            </intent-filter>
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        </activity>
 | 
					        </activity>
 | 
				
			||||||
 | 
					                <service android:name=".ChannelService"></service>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <activity
 | 
					        <activity
 | 
				
			||||||
            android:name=".DeviceListActivity"
 | 
					            android:name=".DeviceListActivity"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,40 @@
 | 
				
			||||||
 | 
					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,6 +32,7 @@ import android.os.Message;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
import android.support.v4.app.Fragment;
 | 
					import android.support.v4.app.Fragment;
 | 
				
			||||||
import android.support.v4.app.FragmentActivity;
 | 
					import android.support.v4.app.FragmentActivity;
 | 
				
			||||||
 | 
					import android.util.Log;
 | 
				
			||||||
import android.view.LayoutInflater;
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
import android.view.Menu;
 | 
					import android.view.Menu;
 | 
				
			||||||
import android.view.MenuInflater;
 | 
					import android.view.MenuInflater;
 | 
				
			||||||
| 
						 | 
					@ -42,12 +43,105 @@ import android.widget.Button;
 | 
				
			||||||
import android.widget.NumberPicker;
 | 
					import android.widget.NumberPicker;
 | 
				
			||||||
import android.widget.TextView;
 | 
					import android.widget.TextView;
 | 
				
			||||||
import android.widget.Toast;
 | 
					import android.widget.Toast;
 | 
				
			||||||
import android.util.Log;
 | 
					
 | 
				
			||||||
 | 
					import java.lang.ref.WeakReference;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This fragment controls Bluetooth to communicate with other devices.
 | 
					 * This fragment controls Bluetooth to communicate with other devices.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class BluetoothChatFragment extends Fragment {
 | 
					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";
 | 
					    private static final String TAG = "BluetoothChatFragment";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +169,7 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Array adapter for the conversation thread
 | 
					     * Array adapter for the conversation thread
 | 
				
			||||||
    private ArrayAdapter<String> mConversationArrayAdapter;
 | 
					     private ArrayAdapter<String> mConversationArrayAdapter;
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
| 
						 | 
					@ -88,6 +182,53 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private BluetoothChatService mChatService = null;
 | 
					    private BluetoothChatService mChatService = null;
 | 
				
			||||||
    private boolean mIsBound;
 | 
					    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
 | 
					    @Override
 | 
				
			||||||
    public void onCreate(Bundle savedInstanceState) {
 | 
					    public void onCreate(Bundle savedInstanceState) {
 | 
				
			||||||
| 
						 | 
					@ -104,7 +245,6 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onStart() {
 | 
					    public void onStart() {
 | 
				
			||||||
        super.onStart();
 | 
					        super.onStart();
 | 
				
			||||||
| 
						 | 
					@ -117,6 +257,8 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        } else if (mChatService == null) {
 | 
					        } else if (mChatService == null) {
 | 
				
			||||||
            setupChat();
 | 
					            setupChat();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (!mChannelServiceBound) doBindChannelService();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
| 
						 | 
					@ -126,6 +268,9 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Log.d(TAG, "onDestroy()");
 | 
					        Log.d(TAG, "onDestroy()");
 | 
				
			||||||
        doUnbindService();
 | 
					        doUnbindService();
 | 
				
			||||||
 | 
					        doUnbindChannelService();
 | 
				
			||||||
 | 
					        mChannelServiceConnection = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        super.onDestroy();
 | 
					        super.onDestroy();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,28 +317,6 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        mTimeText = (TextView) view.findViewById(R.id.Time);
 | 
					        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() {
 | 
					    void doBindService() {
 | 
				
			||||||
        Log.d(TAG, "doBindService()");
 | 
					        Log.d(TAG, "doBindService()");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -201,7 +324,7 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        // class name because we want a specific service implementation that
 | 
					        // class name because we want a specific service implementation that
 | 
				
			||||||
        // we know will be running in our own process (and thus won't be
 | 
					        // we know will be running in our own process (and thus won't be
 | 
				
			||||||
        // supporting component replacement by other applications).
 | 
					        // supporting component replacement by other applications).
 | 
				
			||||||
        getActivity().bindService(new Intent(getActivity(), BluetoothChatService.class), mConnection , Context.BIND_AUTO_CREATE);
 | 
					        getActivity().bindService(new Intent(getActivity(), BluetoothChatService.class), mConnection, Context.BIND_AUTO_CREATE);
 | 
				
			||||||
        mIsBound = true;
 | 
					        mIsBound = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -213,6 +336,33 @@ 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.
 | 
					     * Set up the UI and background operations for chat.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -287,7 +437,7 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        if (mChatService == null)
 | 
					        if (mChatService == null)
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Check that we're actually connected before trying anything
 | 
					        // Check that we're actually connected before trying anything
 | 
				
			||||||
        if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {
 | 
					        if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {
 | 
				
			||||||
            Toast.makeText(getActivity(), R.string.not_connected, Toast.LENGTH_SHORT).show();
 | 
					            Toast.makeText(getActivity(), R.string.not_connected, Toast.LENGTH_SHORT).show();
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
| 
						 | 
					@ -330,86 +480,6 @@ public class BluetoothChatFragment extends Fragment {
 | 
				
			||||||
        actionBar.setSubtitle(subTitle);
 | 
					        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) {
 | 
					    public void onActivityResult(int requestCode, int resultCode, Intent data) {
 | 
				
			||||||
        switch (requestCode) {
 | 
					        switch (requestCode) {
 | 
				
			||||||
            case REQUEST_CONNECT_DEVICE_SECURE:
 | 
					            case REQUEST_CONNECT_DEVICE_SECURE:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,14 +23,12 @@ import android.app.Service;
 | 
				
			||||||
import android.bluetooth.BluetoothAdapter;
 | 
					import android.bluetooth.BluetoothAdapter;
 | 
				
			||||||
import android.bluetooth.BluetoothDevice;
 | 
					import android.bluetooth.BluetoothDevice;
 | 
				
			||||||
import android.bluetooth.BluetoothSocket;
 | 
					import android.bluetooth.BluetoothSocket;
 | 
				
			||||||
import android.content.Context;
 | 
					 | 
				
			||||||
import android.content.Intent;
 | 
					import android.content.Intent;
 | 
				
			||||||
import android.os.Binder;
 | 
					import android.os.Binder;
 | 
				
			||||||
import android.os.Bundle;
 | 
					import android.os.Bundle;
 | 
				
			||||||
import android.os.Handler;
 | 
					import android.os.Handler;
 | 
				
			||||||
import android.os.IBinder;
 | 
					import android.os.IBinder;
 | 
				
			||||||
import android.os.Message;
 | 
					import android.os.Message;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import android.util.Log;
 | 
					import android.util.Log;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
| 
						 | 
					@ -45,32 +43,32 @@ import java.util.UUID;
 | 
				
			||||||
 * thread for performing data transmissions when connected.
 | 
					 * thread for performing data transmissions when connected.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class BluetoothChatService extends Service {
 | 
					public class BluetoothChatService extends Service {
 | 
				
			||||||
    // 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;
 | 
					 | 
				
			||||||
    private Handler mHandler;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private ConnectThread mConnectThread;
 | 
					 | 
				
			||||||
    private ConnectedThread mConnectedThread;
 | 
					 | 
				
			||||||
    private int mState;
 | 
					 | 
				
			||||||
    private int mNewState;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Constants that indicate the current connection state
 | 
					    // Constants that indicate the current connection state
 | 
				
			||||||
    public static final int STATE_NONE = 0;       // we're doing nothing
 | 
					    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_LISTEN = 1;     // now listening for incoming connections
 | 
				
			||||||
    public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
 | 
					    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
 | 
					    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 NotificationManager mNM;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private int NOTIFICATION = R.string.local_service_started;
 | 
					    private int NOTIFICATION = R.string.local_service_started;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public BluetoothChatService() {
 | 
					    public BluetoothChatService() {
 | 
				
			||||||
        super();
 | 
					        super();
 | 
				
			||||||
        mAdapter = BluetoothAdapter.getDefaultAdapter();
 | 
					        mAdapter = BluetoothAdapter.getDefaultAdapter();
 | 
				
			||||||
| 
						 | 
					@ -78,21 +76,11 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        mNewState = mState;
 | 
					        mNewState = mState;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public class BluetoothChatServiceI extends Binder {
 | 
					 | 
				
			||||||
        BluetoothChatService getService() {
 | 
					 | 
				
			||||||
            return BluetoothChatService.this;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        void setHandler(Handler handler) {
 | 
					 | 
				
			||||||
            mHandler = handler;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onCreate() {
 | 
					    public void onCreate() {
 | 
				
			||||||
        super.onCreate();
 | 
					        super.onCreate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
 | 
					        mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,11 +132,6 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        return mBinder;
 | 
					        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
 | 
					     * Update UI title according to the current state of the chat connection
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -158,6 +141,7 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        mNewState = mState;
 | 
					        mNewState = mState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Give the new state to the Handler so the UI Activity can update
 | 
					        // 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();
 | 
					        mHandler.obtainMessage(Constants.MESSAGE_STATE_CHANGE, mNewState, -1).sendToTarget();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -186,6 +170,7 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        super.onDestroy();
 | 
					        super.onDestroy();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Show a notification while this service is running.
 | 
					     * Show a notification while this service is running.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -288,7 +273,6 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        updateUserInterfaceTitle();
 | 
					        updateUserInterfaceTitle();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Indicate that the connection attempt failed and notify the UI Activity.
 | 
					     * Indicate that the connection attempt failed and notify the UI Activity.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
| 
						 | 
					@ -327,12 +311,22 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        BluetoothChatService.this.startBT();
 | 
					        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
 | 
					     * This thread runs while attempting to make an outgoing connection
 | 
				
			||||||
     * with a device. It runs straight through; the connection either
 | 
					     * with a device. It runs straight through; the connection either
 | 
				
			||||||
     * succeeds or fails.
 | 
					     * succeeds or fails.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
     class ConnectThread extends Thread {
 | 
					    class ConnectThread extends Thread {
 | 
				
			||||||
        private final BluetoothSocket mmSocket;
 | 
					        private final BluetoothSocket mmSocket;
 | 
				
			||||||
        private final BluetoothDevice mmDevice;
 | 
					        private final BluetoothDevice mmDevice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -481,9 +475,17 @@ public class BluetoothChatService extends Service {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public boolean setLevel(int level) { return mmIConsole.setLevel(level); }
 | 
					        public boolean setLevel(int level) {
 | 
				
			||||||
        public boolean startIConsole() { return mmIConsole.start(); }
 | 
					            return mmIConsole.setLevel(level);
 | 
				
			||||||
        public boolean stopIConsole() { return mmIConsole.stop(); }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public boolean startIConsole() {
 | 
				
			||||||
 | 
					            return mmIConsole.start();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public boolean stopIConsole() {
 | 
				
			||||||
 | 
					            return mmIConsole.stop();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void cancel() {
 | 
					        public void cancel() {
 | 
				
			||||||
            mmIConsole.stop();
 | 
					            mmIConsole.stop();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,264 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * 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,8 +30,10 @@ import android.util.Log;
 | 
				
			||||||
import android.view.Menu;
 | 
					import android.view.Menu;
 | 
				
			||||||
import android.view.MenuItem;
 | 
					import android.view.MenuItem;
 | 
				
			||||||
import android.view.WindowManager;
 | 
					import android.view.WindowManager;
 | 
				
			||||||
 | 
					import android.widget.Button;
 | 
				
			||||||
import android.widget.ViewAnimator;
 | 
					import android.widget.ViewAnimator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.surfsite.iconsole.ChannelService.ChannelServiceComm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -70,8 +72,16 @@ public class MainActivity extends FragmentActivity {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void onDestroy() {
 | 
					    protected void onDestroy() {
 | 
				
			||||||
        stopService(new Intent(this, BluetoothChatService.class));
 | 
					
 | 
				
			||||||
 | 
					        if(isFinishing())
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            stopService(new Intent(this, BluetoothChatService.class));
 | 
				
			||||||
 | 
					            stopService(new Intent(this, ChannelService.class));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        super.onDestroy();
 | 
					        super.onDestroy();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,292 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * 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;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,306 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * 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_marginLeft="16dp"
 | 
				
			||||||
        android:layout_marginRight="16dp"
 | 
					        android:layout_marginRight="16dp"
 | 
				
			||||||
        android:layout_marginTop="16dp"
 | 
					        android:layout_marginTop="16dp"
 | 
				
			||||||
        android:text="Power"
 | 
					        android:text="Power corr"
 | 
				
			||||||
        app:layout_constraintBottom_toTopOf="@+id/Power"
 | 
					        app:layout_constraintBottom_toTopOf="@+id/Power"
 | 
				
			||||||
        app:layout_constraintLeft_toLeftOf="parent"
 | 
					        app:layout_constraintLeft_toLeftOf="parent"
 | 
				
			||||||
        app:layout_constraintRight_toLeftOf="@+id/guidelineleft"
 | 
					        app:layout_constraintRight_toLeftOf="@+id/guidelineleft"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@
 | 
				
			||||||
    <string name="power_n0_0_w">0.0</string>
 | 
					    <string name="power_n0_0_w">0.0</string>
 | 
				
			||||||
    <string name="level">Level</string>
 | 
					    <string name="level">Level</string>
 | 
				
			||||||
    <string name="local_service_started">OpeniConsole Bluetooth active</string>
 | 
					    <string name="local_service_started">OpeniConsole Bluetooth active</string>
 | 
				
			||||||
    <string name="local_service_label">OpeniConsole</string>
 | 
					    <string name="local_service_label">OpeniConsole - TEST</string>
 | 
				
			||||||
    <string name="secure_connect">Connect to iConsole</string>
 | 
					    <string name="secure_connect">Connect to iConsole</string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</resources>
 | 
					</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 recording to FIT/TCX/GPX
 | 
				
			||||||
- workout profiles
 | 
					- workout profiles
 | 
				
			||||||
- Google street view cycling
 | 
					- Google street view cycling
 | 
				
			||||||
- sensor data broadcasting via ANT
 | 
					- sensor data broadcasting via ANT (works, message me for a howto or look [here](https://github.com/haraldh/iconsole-android/issues/4))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
See also my [python prototype](https://github.com/haraldh/iconsole) for the bluetooth protocol reverse engineering and sensor broadcasting.
 | 
					See also my [python prototype](https://github.com/haraldh/iconsole) for the bluetooth protocol reverse engineering and sensor broadcasting.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								android_antlib_4-14/build.gradle
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								android_antlib_4-14/build.gradle
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					configurations.maybeCreate("default")
 | 
				
			||||||
 | 
					artifacts.add("default", file('android_antlib_4-14-0.jar'))
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@ buildscript {
 | 
				
			||||||
        google()
 | 
					        google()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    dependencies {
 | 
					    dependencies {
 | 
				
			||||||
        classpath 'com.android.tools.build:gradle:3.1.3'
 | 
					        classpath 'com.android.tools.build:gradle:4.1.3'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // NOTE: Do not place your application dependencies here; they belong
 | 
					        // NOTE: Do not place your application dependencies here; they belong
 | 
				
			||||||
        // in the individual module build.gradle files
 | 
					        // 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 @@
 | 
				
			||||||
#Fri Jul 06 15:08:55 CEST 2018
 | 
					#Mon Apr 12 12:52:47 CEST 2021
 | 
				
			||||||
distributionBase=GRADLE_USER_HOME
 | 
					distributionBase=GRADLE_USER_HOME
 | 
				
			||||||
distributionPath=wrapper/dists
 | 
					distributionPath=wrapper/dists
 | 
				
			||||||
zipStoreBase=GRADLE_USER_HOME
 | 
					zipStoreBase=GRADLE_USER_HOME
 | 
				
			||||||
zipStorePath=wrapper/dists
 | 
					zipStorePath=wrapper/dists
 | 
				
			||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
 | 
					distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?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" 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" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
 | 
				
			||||||
  <component name="FacetManager">
 | 
					  <component name="FacetManager">
 | 
				
			||||||
    <facet type="java-gradle" name="Java-Gradle">
 | 
					    <facet type="java-gradle" name="Java-Gradle">
 | 
				
			||||||
      <configuration>
 | 
					      <configuration>
 | 
				
			||||||
| 
						 | 
					@ -8,11 +8,12 @@
 | 
				
			||||||
      </configuration>
 | 
					      </configuration>
 | 
				
			||||||
    </facet>
 | 
					    </facet>
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
 | 
					  <component name="NewModuleRootManager" inherit-compiler-output="true">
 | 
				
			||||||
    <content url="file://$MODULE_DIR$">
 | 
					    <content url="file://$MODULE_DIR$">
 | 
				
			||||||
      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
 | 
					      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
 | 
				
			||||||
 | 
					      <excludeFolder url="file://$MODULE_DIR$/build" />
 | 
				
			||||||
    </content>
 | 
					    </content>
 | 
				
			||||||
    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
 | 
					    <orderEntry type="inheritedJdk" />
 | 
				
			||||||
    <orderEntry type="sourceFolder" forTests="false" />
 | 
					    <orderEntry type="sourceFolder" forTests="false" />
 | 
				
			||||||
  </component>
 | 
					  </component>
 | 
				
			||||||
</module>
 | 
					</module>
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1 @@
 | 
				
			||||||
 | 
					include 'Application', ':android_antlib_4-14'
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
include 'Application'
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue