Skip to content

Commit

Permalink
First Commit for the open source Sure-Fi app.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sure-Fi Inc authored and Sure-Fi Inc committed Jan 31, 2018
0 parents commit 19b8ca8
Show file tree
Hide file tree
Showing 91 changed files with 2,158 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
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
18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions app/build.gradle
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"

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
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
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)
}
}
Binary file added app/src/drawable-hdpi/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/drawable-ldpi/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/drawable-mdpi/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/drawable-xhdpi/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/drawable-xxhdpi/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/drawable-xxxhdpi/bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions app/src/main/AndroidManifest.xml
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 app/src/main/java/suer_fi/developmentkitapp/BluetoothPeripheral.kt
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
}

16 changes: 16 additions & 0 deletions app/src/main/java/suer_fi/developmentkitapp/Constants.kt
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"
}
}
Loading

0 comments on commit 19b8ca8

Please sign in to comment.