-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Commit for the open source Sure-Fi app.
- Loading branch information
Sure-Fi Inc
authored and
Sure-Fi Inc
committed
Jan 31, 2018
0 parents
commit 19b8ca8
Showing
91 changed files
with
2,158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
apply plugin: 'kotlin-android' | ||
|
||
apply plugin: 'kotlin-android-extensions' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
defaultConfig { | ||
applicationId "suer_fi.developmentkitapp" | ||
minSdkVersion 21 | ||
targetSdkVersion 26 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" | ||
implementation 'com.android.support:appcompat-v7:26.1.0' | ||
implementation 'com.android.support.constraint:constraint-layout:1.0.2' | ||
implementation 'com.android.support:design:26.1.0' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.1' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' | ||
compile "org.jetbrains.anko:anko:$anko_version" | ||
compile "org.jetbrains.anko:anko-commons:$anko_version" | ||
compile "org.jetbrains.anko:anko-design:$anko_version" // For SnackBars | ||
compile "com.android.support:recyclerview-v7:26.1.0" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/suer_fi/developmentkitapp/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package suer_fi.developmentkitapp | ||
|
||
import android.support.test.InstrumentationRegistry | ||
import android.support.test.runner.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getTargetContext() | ||
assertEquals("suer_fi.developmentkitapp", appContext.packageName) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="suer_fi.developmentkitapp"> | ||
|
||
<uses-permission android:name="android.permission.BLUETOOTH" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
|
||
<uses-feature | ||
android:name="android.hardware.bluetooth_le" | ||
android:required="true" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<meta-data | ||
android:name="preloaded_fonts" | ||
android:resource="@array/preloaded_fonts" /> | ||
|
||
<activity | ||
android:name=".Devices" | ||
android:parentActivityName=".MainActivity" /> | ||
<activity | ||
android:name=".ModuleInterface" | ||
android:label="@string/title_activity_module_interface" | ||
android:theme="@style/AppTheme.NoActionBar"></activity> | ||
</application> | ||
|
||
</manifest> |
71 changes: 71 additions & 0 deletions
71
app/src/main/java/suer_fi/developmentkitapp/BluetoothPeripheral.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package suer_fi.developmentkitapp | ||
|
||
import android.bluetooth.BluetoothDevice | ||
import android.os.Parcel | ||
import android.os.Parcelable | ||
|
||
/** | ||
* Created by sure-fi on 1/23/18. | ||
*/ | ||
|
||
|
||
|
||
|
||
open class BluetoothPeripheral( | ||
val address: String, | ||
val name: String, | ||
val device_id: String, | ||
val hardware_type: String, | ||
val device_status: String, | ||
val firmware_version: String? = null, | ||
val paired_id: String? = null, | ||
val security_string : String? = null, | ||
val manufacturer_data : String? = null, | ||
var bluetooth_device : BluetoothDevice? = null | ||
|
||
): Parcelable { | ||
|
||
constructor(parcel: Parcel) : this( | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readString(), | ||
parcel.readParcelable(BluetoothDevice::class.java.classLoader)) {} | ||
|
||
|
||
override fun writeToParcel(parcel: Parcel, flags: Int) { | ||
parcel.writeString(address) | ||
parcel.writeString(name) | ||
parcel.writeString(device_id) | ||
parcel.writeString(hardware_type) | ||
parcel.writeString(device_status) | ||
parcel.writeString(firmware_version) | ||
parcel.writeString(paired_id) | ||
parcel.writeString(security_string) | ||
parcel.writeString(manufacturer_data) | ||
parcel.writeParcelable(bluetooth_device, flags) | ||
} | ||
|
||
|
||
private fun calculateSecurityString() : ByteArray { | ||
|
||
var peripheralRXUUID = this.device_id.toUpperCase().reversed() | ||
var peripheralTXUUID = this.paired_id?.toUpperCase() + "x~sW5-C\"6fu>!!~X" | ||
var final_string = peripheralRXUUID + peripheralTXUUID | ||
|
||
return final_string.md5().toByteArray() | ||
} | ||
|
||
companion object { | ||
@JvmField @Suppress("unused") | ||
val CREATOR = createParcel{BluetoothPeripheral(it)} | ||
} | ||
|
||
override fun describeContents() = 0 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package suer_fi.developmentkitapp | ||
|
||
/** | ||
* Created by sure-fi on 1/25/18. | ||
*/ | ||
class Constants { | ||
companion object { | ||
val MODULE_TYPE = "00" | ||
val WIEGAND_TYPE = "01" | ||
val REMOTE_TYPE = "02" | ||
val HVAC_THERMOSTAT_TYPE = "03" | ||
val HVAC_EQUIPMENT_TYPE = "04" | ||
val SERIAL_DATA__CENTRAL_TYPE = "05" | ||
val SERIAL_DATA_REMOTE_TYPE = "06" | ||
} | ||
} |
Oops, something went wrong.