Initial commit

This commit is contained in:
Patrick Moessler 2019-10-16 23:21:46 +02:00
commit c217ba26b1
45 changed files with 2343 additions and 0 deletions

14
.gitignore vendored Normal file
View file

@ -0,0 +1,14 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

View file

@ -0,0 +1,127 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="RIGHT_MARGIN" value="160" />
<option name="SOFT_MARGINS" value="100,160" />
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<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>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

19
.idea/gradle.xml Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</component>
</project>

9
.idea/misc.xml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

1
app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

60
app/build.gradle Normal file
View file

@ -0,0 +1,60 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "de.asaril.bletail"
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.protobuf:protobuf-lite:3.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.android.material:material:1.0.0'
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.plugins {
javalite {}
}
}
}
}

21
app/proguard-rules.pro vendored Normal file
View file

@ -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

View file

@ -0,0 +1,24 @@
package de.asaril.bletail
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.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.getInstrumentation().targetContext
assertEquals("de.asaril.bletail", appContext.packageName)
}
}

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="de.asaril.bletail">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<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/Theme.AppCompat.NoActionBar"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -0,0 +1,231 @@
package de.asaril.bletail
import android.bluetooth.*
import android.bluetooth.le.ScanCallback
import android.bluetooth.le.ScanResult
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import java.util.*
const val END: Byte = 0xC0.toByte()
const val ESC: Byte = 0xDB.toByte()
const val ESC_END: Byte = 0xDC.toByte()
const val ESC_ESC: Byte = 0xDD.toByte()
class MainActivity : AppCompatActivity() {
private val LED_COUNT: Int = 40
private val requestEnableBt: Int = 1
//private var bleTailDevice:BluetoothDevice? = null
private val uartUUID = UUID.fromString("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")
private val rxUUID = UUID.fromString("6E400002-B5A3-F393-E0A9-E50E24DCCA9E")
private val txUUID = UUID.fromString("6E400003-B5A3-F393-E0A9-E50E24DCCA9E")
private val cccdUUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
var bleTailGatt: BluetoothGatt? = null
var rxChar: BluetoothGattCharacteristic? = null
var txChar: BluetoothGattCharacteristic? = null
var segments: MutableList<SegmentCardView>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
val bluetoothManager: BluetoothManager =
getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
val bluetoothAdapter: BluetoothAdapter = bluetoothManager.adapter
if (!bluetoothAdapter.isEnabled) {
val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
startActivityForResult(enableIntent, requestEnableBt)
}
bluetoothAdapter.bluetoothLeScanner.startScan(object : ScanCallback() {
override fun onScanResult(callbackType: Int, result: ScanResult) {
super.onScanResult(callbackType, result)
Log.i("BLEtail", "Remote device name: " + result.device.name)
if (result.device.name == "Bluefruit52") {
bluetoothAdapter.bluetoothLeScanner.stopScan(this)
result.device.connectGatt(
applicationContext,
true,
object : BluetoothGattCallback() {
override fun onConnectionStateChange(
gatt: BluetoothGatt?,
status: Int,
newState: Int
) {
super.onConnectionStateChange(gatt, status, newState)
if (newState == BluetoothGatt.STATE_CONNECTED) {
gatt!!.discoverServices()
bleTailGatt = gatt
}
}
override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
super.onServicesDiscovered(gatt, status)
rxChar = gatt!!.getService(uartUUID).getCharacteristic(rxUUID)
if (rxChar == null) {
Log.e("bleTail", "Rx characteristic not found!")
}
txChar = gatt.getService(uartUUID).getCharacteristic(txUUID)
if (txChar == null) {
Log.e("bleTail", "Tx characteristic not found!")
} else {
gatt.setCharacteristicNotification(txChar, true)
val descriptor = txChar!!.getDescriptor(cccdUUID)
descriptor.value =
BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
gatt.writeDescriptor(descriptor)
onConnected()
}
}
override fun onCharacteristicRead(
gatt: BluetoothGatt,
characteristic: BluetoothGattCharacteristic,
status: Int
) {
if (status == BluetoothGatt.GATT_SUCCESS) {
handleUpdate(characteristic)
}
}
override fun onCharacteristicChanged(
gatt: BluetoothGatt,
characteristic: BluetoothGattCharacteristic
) {
handleUpdate(characteristic)
}
fun handleUpdate(characteristic: BluetoothGattCharacteristic) {
if (characteristic.uuid == txUUID) {
Log.d("bleTail", "Received TX: %d${characteristic.value}")
}
}
})
}
}
})
}
private fun onConnected() {
segments = MutableList<SegmentCardView>(5, init = {
SegmentCardView(this, it, 0, LED_COUNT - 1, fx.Fx.Mode.THEATER_CHASE_RAINBOW, Color(), Color(), Color(), 0x0800, false)
})
for (s in segments!!) {
s.sendCallback = this::sendToBleUart
}
}
override fun onDestroy() {
segments = null
bleTailGatt?.disconnect()
super.onDestroy()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.main_menu, menu)
return true
}
private fun updateSegmentCards(count: Int) {
val r: fx.Fx.Root.Builder = fx.Fx.Root.newBuilder()
val m = fx.Fx.setNumSegments_msg.newBuilder()
m.numSegments = count
r.setNumSegments = m.build()
sendToBleUart(r.build().toByteArray())
val segLength: Int = LED_COUNT / count
val segmentListLayout = findViewById<LinearLayout>(R.id.segmentList)
for (i in 0 until count) {
segments!![i].start = segLength * i
segments!![i].end = if (i == count - 1) {
LED_COUNT - 1
} else {
(segLength * (i + 1) - 1)
}
segments!![i].sendSetSegment()
}
while (segmentListLayout.childCount > count) {
val ind = segmentListLayout.childCount - 1
segmentListLayout.removeViewAt(ind)
}
while (segmentListLayout.childCount < count) {
val ind = segmentListLayout.childCount
segmentListLayout.addView(segments!![ind], ind)
}
}
private fun encodeSlip(payload: ByteArray): ByteArray {
var output = ByteArray(0)
for (b in payload) {
when (b) {
END -> {
output += ESC
output += ESC_END
}
ESC -> {
output += ESC
output += ESC_ESC
}
else -> output += b
}
}
output += END
return output
}
fun powerOffClick(item: MenuItem) {
val r: fx.Fx.Root.Builder = fx.Fx.Root.newBuilder()
r.halt = fx.Fx.halt_msg.newBuilder().build()
val msgRaw = r.build().toByteArray()
sendToBleUart(msgRaw)
}
fun segCountClick(item: MenuItem) {
updateSegmentCards(
when (item.itemId) {
R.id.segCount1 -> 1
R.id.segCount2 -> 2
R.id.segCount3 -> 3
R.id.segCount5 -> 5
else -> 1
}
)
}
fun sendToBleUart(msgRaw: ByteArray) {
val arr: ByteArray = encodeSlip(msgRaw)
fun ByteArray.toHexString() = joinToString("") { "%02x".format(it) }
Log.i("BLEtail", "tx:" + arr.toHexString())
this.rxChar!!.value = arr
Log.i("bleTail", this.bleTailGatt!!.writeCharacteristic(this.rxChar!!).toString())
}
}

View file

@ -0,0 +1,196 @@
package de.asaril.bletail
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.*
import androidx.cardview.widget.CardView
import fx.Fx
/**
* TODO: document your custom view class.
*/
class SegmentCardView : CardView {
private var viewText: TextView? = null
private var viewMode: Spinner? = null
private var viewCol0: ImageButton? = null
private var viewCol1: ImageButton? = null
private var viewCol2: ImageButton? = null
private var viewGuideline: androidx.constraintlayout.widget.Guideline? = null
private var viewSpeed: SeekBar? = null
private var viewReverse: ToggleButton? = null
var index: Int = 0
var start: Int = 0
var end: Int = 0
var mode: Fx.Mode = Fx.Mode.STATIC
var color1: Color = Color.valueOf(Color.RED)
var color2: Color = Color.valueOf(Color.BLACK)
var color3: Color = Color.valueOf(Color.BLACK)
var speed: Int = 0
var reverse: Boolean = false
var sendCallback: ((ByteArray) -> Unit)? = null
private fun Color.toWrgb() = toArgb().and(0x00FFFFFF)
private var ctx:Context? = null
fun sendSetSegment() {
val r = Fx.Root.newBuilder()
val m = Fx.setSegment_msg.newBuilder()
m.segment = this.index
m.start = this.start
m.end = this.end
m.mode = this.mode
val mc = Fx.MultiColor.newBuilder()
mc.col1 = this.color1.toWrgb()
mc.col2 = this.color2.toWrgb()
mc.col3 = this.color3.toWrgb()
val c = Fx.ColorType.newBuilder()
c.multiColor = mc.build()
m.color = c.build()
m.speed = this.speed
val o = Fx.Options.newBuilder()
o.reverse = this.reverse
o.fadeRate = Fx.FadeRate.FADE_RATE_MEDIUM
o.gammaCorrect = false
o.size = Fx.Size.SIZE_SMALL
m.options = o.build()
r.setSegment = m.build()
sendCallback!!(r.build().toByteArray())
}
fun sendSetMode() {
val r = Fx.Root.newBuilder()
val m = Fx.setMode_msg.newBuilder()
m.segment = this.index
m.mode = this.mode
r.setMode = m.build()
sendCallback!!(r.build().toByteArray())
}
fun sendSetSpeed() {
val r = Fx.Root.newBuilder()
val m = Fx.setSpeed_msg.newBuilder()
m.segment = this.index
m.speed = this.speed
r.setSpeed = m.build()
sendCallback!!(r.build().toByteArray())
}
fun sendSetColor() {
val r = Fx.Root.newBuilder()
val m = Fx.setColor_msg.newBuilder()
m.segment = this.index
val mc = Fx.MultiColor.newBuilder()
mc.col1 = this.color1.toWrgb()
mc.col2 = this.color2.toWrgb()
mc.col3 = this.color3.toWrgb()
val c = Fx.ColorType.newBuilder()
c.multiColor = mc.build()
m.color = c.build()
r.setColor = m.build()
sendCallback!!(r.build().toByteArray())
}
constructor(
context: Context,
index: Int,
start: Int,
end: Int,
mode: Fx.Mode,
color1: Color,
color2: Color,
color3: Color,
speed: Int,
reverse: Boolean
) : super(context) {
this.start = start
this.index = index
this.start = start
this.end = end
this.mode = mode
this.color1 = color1
this.color2 = color2
this.color3 = color3
this.speed = speed
this.reverse = reverse
init(context, null, 0)
}
constructor(context: Context) : super(context) {
init(context, null, 0)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init(context, attrs, 0)
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
init(context, attrs, defStyle)
}
private fun init(context: Context, attrs: AttributeSet?, defStyle: Int) {
ctx=context
// Load attributes
val a = context.obtainStyledAttributes(
attrs, R.styleable.SegmentCardView, defStyle, 0
)
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
inflater.inflate(R.layout.segment_card_view, this)
a.recycle()
}
override fun onFinishInflate() {
super.onFinishInflate()
viewText = this.findViewById(R.id.segText)
viewMode = this.findViewById(R.id.segMode)
viewCol0 = this.findViewById(R.id.segCol0)
viewCol1 = this.findViewById(R.id.segCol1)
viewCol2 = this.findViewById(R.id.segCol2)
viewGuideline = this.findViewById(R.id.segGuide)
viewSpeed = this.findViewById(R.id.segSpeed)
viewReverse = this.findViewById(R.id.segReverse)
viewText!!.text = String.format(resources.getString(R.string.segment), index)
viewMode!!.adapter = ArrayAdapter<Fx.Mode>(ctx!!, android.R.layout.simple_spinner_item, Fx.Mode.values())
viewMode!!.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {
return
}
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
mode = parent!!.getItemAtPosition(position) as Fx.Mode
sendSetMode()
}
}
viewSpeed!!.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(var1: SeekBar, var2: Int, var3: Boolean) {
speed = var2
sendSetSpeed()
}
override fun onStartTrackingTouch(var1: SeekBar) {
return
}
override fun onStopTrackingTouch(var1: SeekBar) {
return
}
})
}
}

315
app/src/main/proto/fx.proto Normal file
View file

@ -0,0 +1,315 @@
syntax = "proto2";
package fx;
// ENUMS
enum Mode {
STATIC = 0;
BLINK = 1;
BREATH = 2;
COLOR_WIPE = 3;
COLOR_WIPE_INV = 4;
COLOR_WIPE_REV = 5;
COLOR_WIPE_REV_INV = 6;
COLOR_WIPE_RANDOM = 7;
RANDOM_COLOR = 8;
SINGLE_DYNAMIC = 9;
MULTI_DYNAMIC = 10;
RAINBOW = 11;
RAINBOW_CYCLE = 12;
SCAN = 13;
DUAL_SCAN = 14;
FADE = 15;
THEATER_CHASE = 16;
THEATER_CHASE_RAINBOW = 17;
RUNNING_LIGHTS = 18;
TWINKLE = 19;
TWINKLE_RANDOM = 20;
TWINKLE_FADE = 21;
TWINKLE_FADE_RANDOM = 22;
SPARKLE = 23;
FLASH_SPARKLE = 24;
HYPER_SPARKLE = 25;
STROBE = 26;
STROBE_RAINBOW = 27;
MULTI_STROBE = 28;
BLINK_RAINBOW = 29;
CHASE_WHITE = 30;
CHASE_COLOR = 31;
CHASE_RANDOM = 32;
CHASE_RAINBOW = 33;
CHASE_FLASH = 34;
CHASE_FLASH_RANDOM = 35;
CHASE_RAINBOW_WHITE = 36;
CHASE_BLACKOUT = 37;
CHASE_BLACKOUT_RAINBOW = 38;
COLOR_SWEEP_RANDOM = 39;
RUNNING_COLOR = 40;
RUNNING_RED_BLUE = 41;
RUNNING_RANDOM = 42;
LARSON_SCANNER = 43;
COMET = 44;
FIREWORKS = 45;
FIREWORKS_RANDOM = 46;
MERRY_CHRISTMAS = 47;
FIRE_FLICKER = 48;
FIRE_FLICKER_SOFT = 49;
FIRE_FLICKER_INTENSE = 50;
CIRCUS_COMBUSTUS = 51;
HALLOWEEN = 52;
BICOLOR_CHASE = 53;
TRICOLOR_CHASE = 54;
ICU = 55;
CUSTOM_0 = 56;
CUSTOM_1 = 57;
CUSTOM_2 = 58;
CUSTOM_3 = 59;
}
enum FadeRate {
FADE_RATE_XFAST = 1;
FADE_RATE_FAST = 2;
FADE_RATE_MEDIUM = 3;
FADE_RATE_SLOW = 4;
FADE_RATE_XSLOW = 5;
FADE_RATE_XXSLOW = 6;
FADE_RATE_GLACIAL = 7;
}
enum Size {
SIZE_SMALL = 0;
SIZE_MEDIUM = 1;
SIZE_LARGE = 2;
SIZE_XLARGE = 3;
}
// TYPES
message RGB {
required uint32 r = 1;
required uint32 g = 2;
required uint32 b = 3;
}
message RGBW {
required uint32 r = 1;
required uint32 g = 2;
required uint32 b = 3;
required uint32 w = 4;
}
message MultiColor {
required fixed32 col1 = 1;
required fixed32 col2 = 2;
required fixed32 col3 = 3;
}
message ColorType {
oneof colorTypes {
RGB rgb = 1;
RGBW rgbw = 2;
fixed32 color = 3;
MultiColor multiColor = 4;
}
}
message Options {
required bool reverse = 1;
required FadeRate fadeRate = 2;
required bool gammaCorrect = 3;
required Size size = 4;
}
// MESSAGES
message init_msg {
//(void),
}
message service_msg {
//(void),
}
message start_msg {
//(void),
}
message stop_msg {
//(void),
}
message pause_msg {
//(void),
}
message resume_msg {
//(void),
}
message strip_off_msg {
//(void),
}
message fade_out_msg {
optional uint32 fadeTime = 1;
}
message setMode_msg {
optional uint32 segment = 1;
required Mode mode = 2;
}
message setOptions_msg {
required uint32 segment = 1;
required Options options = 2;
}
message setSpeed_msg {
optional uint32 segment = 1;
required uint32 speed = 2;
}
message increaseSpeed_msg {
required uint32 step = 1;
}
message decreaseSpeed_msg {
required uint32 step = 1;
}
message setColor_msg {
optional uint32 segment = 1;
required ColorType color = 2;
}
message setBrightness_msg {
required uint32 brightness = 1;
}
message increaseBrightness_msg {
required uint32 step = 1;
}
message decreaseBrightness_msg {
required uint32 step = 1;
}
message setLength_msg {
required uint32 numPixels = 1;
}
message increaseLength_msg {
required uint32 step = 1;
}
message decreaseLength_msg {
required uint32 step = 1;
}
message trigger_msg {
//(void),
}
message setNumSegments_msg {
required uint32 numSegments = 1;
}
message setSegment_msg {
required uint32 segment = 1;
required uint32 start = 2;
required uint32 end = 3;
required Mode mode = 4;
required ColorType color = 5;
required uint32 speed = 6;
required Options options = 7;
}
message resetSegments_msg {
//(),
}
message resetSegmentRuntimes_msg {
//(),
}
message resetSegmentRuntime_msg {
required uint32 segment = 1;
}
message setPixelColor_msg {
required uint32 offset = 1;
required ColorType color = 2;
}
message copyPixels_msg {
required uint32 destination = 1;
required uint32 source = 2;
required uint32 count = 3;
}
message display_msg {
required uint32 offset = 1;
repeated fixed32 color = 2;
}
message show_msg {
//(void);
}
message halt_msg {
//(void);
}
// MAIN MESSAGE
message Root {
oneof msg {
init_msg init = 1;
start_msg start = 2;
stop_msg stop = 3;
pause_msg pause = 4;
resume_msg resume = 5;
strip_off_msg strip_off = 6;
fade_out_msg fade_out = 7;
setMode_msg setMode = 8;
setOptions_msg setOptions = 9;
setSpeed_msg setSpeed = 10;
increaseSpeed_msg increaseSpeed = 11;
decreaseSpeed_msg decreaseSpeed = 12;
setColor_msg setColor = 13;
setBrightness_msg setBrightness = 14;
increaseBrightness_msg increaseBrightness = 15;
decreaseBrightness_msg decreaseBrightness = 16;
setLength_msg setLength = 17;
increaseLength_msg increaseLength = 18;
decreaseLength_msg decreaseLength = 19;
trigger_msg trigger = 20;
setNumSegments_msg setNumSegments = 21;
setSegment_msg setSegment = 22;
resetSegments_msg resetSegments = 23;
resetSegmentRuntimes_msg resetSegmentRuntimes = 24;
resetSegmentRuntime_msg resetSegmentRuntime = 25;
setPixelColor_msg setPixelColor = 26;
copyPixels_msg copyPixels = 27;
display_msg display = 28;
show_msg show = 29;
halt_msg halt = 30;
}
}
//ORG
// init(void),
// service(void),
// start(void),
// stop(void),
// pause(void),
// resume(void),
// strip_off(void),
// fade_out(void),
// fade_out(uint32_t),
// setMode(uint8_t m),
// setMode(uint8_t seg, uint8_t m),
// setOptions(uint8_t seg, uint8_t o),
// setCustomMode(uint16_t (*p)()),
// setCustomShow(void (*p)()),
// setSpeed(uint16_t s),
// setSpeed(uint8_t seg, uint16_t s),
// increaseSpeed(uint8_t s),
// decreaseSpeed(uint8_t s),
// setColor(uint8_t r, uint8_t g, uint8_t b),
// setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t w),
// setColor(uint32_t c),
// setColor(uint8_t seg, uint32_t c),
// setColors(uint8_t seg, uint32_t* c),
// setBrightness(uint8_t b),
// increaseBrightness(uint8_t s),
// decreaseBrightness(uint8_t s),
// setLength(uint16_t b),
// increaseLength(uint16_t s),
// decreaseLength(uint16_t s),
// trigger(void),
// setNumSegments(uint8_t n),
// setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, uint32_t color, uint16_t speed, bool reverse),
// setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, uint32_t color, uint16_t speed, uint8_t options),
// setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, const uint32_t colors[], uint16_t speed, bool reverse),
// setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t mode, const uint32_t colors[], uint16_t speed, uint8_t options),
// resetSegments(),
// resetSegmentRuntimes(),
// resetSegmentRuntime(uint8_t),
// setPixelColor(uint16_t n, uint32_t c),
// setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b),
// setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w),
// copyPixels(uint16_t d, uint16_t s, uint16_t c),
// show(void);

View file

@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View file

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View file

@ -0,0 +1,536 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/PopupOverlay"
app:title="@string/app_name"/>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/segmentList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/numberSegmentsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/number_of_segments"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnSegmentNum5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/seg5"
app:layout_constraintLeft_toRightOf="@id/btnSegmentNum3"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/numberSegmentsText" />
<Button
android:id="@+id/btnSegmentNum3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/seg3"
app:layout_constraintLeft_toRightOf="@id/btnSegmentNum2"
app:layout_constraintRight_toLeftOf="@id/btnSegmentNum5"
app:layout_constraintTop_toBottomOf="@id/numberSegmentsText" />
<Button
android:id="@+id/btnSegmentNum2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/seg2"
app:layout_constraintLeft_toRightOf="@id/btnSegmentNum1"
app:layout_constraintRight_toLeftOf="@id/btnSegmentNum3"
app:layout_constraintTop_toBottomOf="@id/numberSegmentsText" />
<Button
android:id="@+id/btnSegmentNum1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/seg1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/btnSegmentNum2"
app:layout_constraintTop_toBottomOf="@id/numberSegmentsText" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/seg0Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/segment_0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/seg0Mode"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/seg0Guide"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg0Col0"
app:layout_constraintTop_toBottomOf="@id/seg0Text" />
<ImageButton
android:id="@+id/seg0Col0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_0_color_0"
app:layout_constraintBottom_toTopOf="@id/seg0Guide"
app:layout_constraintRight_toLeftOf="@id/seg0Col1"
app:layout_constraintTop_toBottomOf="@id/seg0Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg0Col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_0_color_1"
app:layout_constraintBottom_toTopOf="@id/seg0Guide"
app:layout_constraintRight_toLeftOf="@id/seg0Col2"
app:layout_constraintTop_toBottomOf="@id/seg0Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg0Col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_0_color_2"
app:layout_constraintBottom_toTopOf="@id/seg0Guide"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg0Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/seg0Guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
<SeekBar
android:id="@+id/seg0Speed"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg0Reverse"
app:layout_constraintTop_toBottomOf="@id/seg0Guide" />
<ToggleButton
android:id="@+id/seg0Reverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg0Guide" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/seg1Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/segment_1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/seg1Mode"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/seg1Guide"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg1Col0"
app:layout_constraintTop_toBottomOf="@id/seg1Text" />
<ImageButton
android:id="@+id/seg1Col0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_1_color_0"
app:layout_constraintBottom_toTopOf="@id/seg1Guide"
app:layout_constraintRight_toLeftOf="@id/seg1Col1"
app:layout_constraintTop_toBottomOf="@id/seg1Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg1Col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_1_color_1"
app:layout_constraintBottom_toTopOf="@id/seg1Guide"
app:layout_constraintRight_toLeftOf="@id/seg1Col2"
app:layout_constraintTop_toBottomOf="@id/seg1Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg1Col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_1_color_2"
app:layout_constraintBottom_toTopOf="@id/seg1Guide"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg1Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/seg1Guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
<SeekBar
android:id="@+id/seg1Speed"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg1Reverse"
app:layout_constraintTop_toBottomOf="@id/seg1Guide" />
<ToggleButton
android:id="@+id/seg1Reverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg1Guide" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/seg2Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/segment_2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/seg2Mode"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/seg2Guide"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg2Col0"
app:layout_constraintTop_toBottomOf="@id/seg2Text" />
<ImageButton
android:id="@+id/seg2Col0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_2_color_0"
app:layout_constraintBottom_toTopOf="@id/seg2Guide"
app:layout_constraintRight_toLeftOf="@id/seg2Col1"
app:layout_constraintTop_toBottomOf="@id/seg2Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg2Col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_2_color_1"
app:layout_constraintBottom_toTopOf="@id/seg2Guide"
app:layout_constraintRight_toLeftOf="@id/seg2Col2"
app:layout_constraintTop_toBottomOf="@id/seg2Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg2Col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_2_color_2"
app:layout_constraintBottom_toTopOf="@id/seg2Guide"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg2Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/seg2Guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
<SeekBar
android:id="@+id/seg2Speed"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg2Reverse"
app:layout_constraintTop_toBottomOf="@id/seg2Guide" />
<ToggleButton
android:id="@+id/seg2Reverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg2Guide" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/seg3Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/segment_3"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/seg3Mode"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/seg3Guide"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg3Col0"
app:layout_constraintTop_toBottomOf="@id/seg3Text" />
<ImageButton
android:id="@+id/seg3Col0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_3_color_0"
app:layout_constraintBottom_toTopOf="@id/seg3Guide"
app:layout_constraintRight_toLeftOf="@id/seg3Col1"
app:layout_constraintTop_toBottomOf="@id/seg3Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg3Col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_3_color_1"
app:layout_constraintBottom_toTopOf="@id/seg3Guide"
app:layout_constraintRight_toLeftOf="@id/seg3Col2"
app:layout_constraintTop_toBottomOf="@id/seg3Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg3Col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_3_color_2"
app:layout_constraintBottom_toTopOf="@id/seg3Guide"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg3Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/seg3Guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
<SeekBar
android:id="@+id/seg3Speed"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg3Reverse"
app:layout_constraintTop_toBottomOf="@id/seg3Guide" />
<ToggleButton
android:id="@+id/seg3Reverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg3Guide" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/seg4Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/segment_4"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/seg4Mode"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/seg4Guide"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg4Col0"
app:layout_constraintTop_toBottomOf="@id/seg4Text" />
<ImageButton
android:id="@+id/seg4Col0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_4_color_0"
app:layout_constraintBottom_toTopOf="@id/seg4Guide"
app:layout_constraintRight_toLeftOf="@id/seg4Col1"
app:layout_constraintTop_toBottomOf="@id/seg4Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg4Col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_4_color_1"
app:layout_constraintBottom_toTopOf="@id/seg4Guide"
app:layout_constraintRight_toLeftOf="@id/seg4Col2"
app:layout_constraintTop_toBottomOf="@id/seg4Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/seg4Col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_4_color_2"
app:layout_constraintBottom_toTopOf="@id/seg4Guide"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg4Text"
app:srcCompat="@android:drawable/ic_menu_edit" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/seg4Guide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
<SeekBar
android:id="@+id/seg4Speed"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/seg4Reverse"
app:layout_constraintTop_toBottomOf="@id/seg4Guide" />
<ToggleButton
android:id="@+id/seg4Reverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/seg4Guide" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
-->
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -0,0 +1,16 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<de.asaril.bletail.SegmentCardView
android:layout_width="300dp"
android:layout_height="300dp"
android:background="#ccc"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:paddingBottom="40dp">
</de.asaril.bletail.SegmentCardView>
</FrameLayout>

View file

@ -0,0 +1,84 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/segText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/segment"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/segMode"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/segGuide"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/segCol0"
app:layout_constraintTop_toBottomOf="@id/segText" />
<ImageButton
android:id="@+id/segCol0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_color_0"
app:layout_constraintBottom_toTopOf="@id/segGuide"
app:layout_constraintRight_toLeftOf="@id/segCol1"
app:layout_constraintTop_toBottomOf="@id/segText"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/segCol1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_color_1"
app:layout_constraintBottom_toTopOf="@id/segGuide"
app:layout_constraintRight_toLeftOf="@id/segCol2"
app:layout_constraintTop_toBottomOf="@id/segText"
app:srcCompat="@android:drawable/ic_menu_edit" />
<ImageButton
android:id="@+id/segCol2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/segment_color_2"
app:layout_constraintBottom_toTopOf="@id/segGuide"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/segText"
app:srcCompat="@android:drawable/ic_menu_edit" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/segGuide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
<SeekBar
android:id="@+id/segSpeed"
android:layout_width="0dp"
android:layout_height="0dp"
android:min="1"
android:max="8192"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/segReverse"
app:layout_constraintTop_toBottomOf="@id/segGuide" />
<ToggleButton
android:id="@+id/segReverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/segGuide" />
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>

View file

@ -0,0 +1,42 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="de.asaril.bletail.MainActivity">
<!-- "Mark Favorite", should appear as action button if possible -->
<item
android:id="@+id/action_halt"
android:icon="@android:drawable/ic_lock_power_off"
android:onClick="powerOffClick"
android:title="@string/action_halt"
app:showAsAction="ifRoom" />
<item
android:id="@+id/segCount1"
android:title="@string/seg1"
app:showAsAction="never|withText"
android:onClick="segCountClick"/>
<item
android:id="@+id/segCount2"
android:title="@string/seg2"
app:showAsAction="never|withText"
android:onClick="segCountClick"/>
<item
android:id="@+id/segCount3"
android:title="@string/seg3"
app:showAsAction="never|withText"
android:onClick="segCountClick"/>
<item
android:id="@+id/segCount5"
android:title="@string/seg5"
app:showAsAction="never|withText"
android:onClick="segCountClick"/>
<!-- Settings, should always be in the overflow -->
<!--<item
android:id="@+id/action_settings"
android:title="@string/action_settings"
app:showAsAction="never" />-->
</menu>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,13 @@
<resources>
<declare-styleable name="SegmentCardView">
<attr name="index" format="integer"/>
<attr name="start" format="integer"/>
<attr name="end" format="integer" />
<attr name="mode" format="enum" />
<attr name="color1" format="color" />
<attr name="color2" format="color" />
<attr name="color3" format="color" />
<attr name="speed" format="integer" />
<attr name="reverse" format="boolean" />
</declare-styleable>
</resources>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>

View file

@ -0,0 +1,5 @@
<resources>
<dimen name="app_bar_height">180dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="text_margin">16dp</dimen>
</resources>

View file

@ -0,0 +1,14 @@
<resources>
<string name="app_name">BLEtail</string>
<string name="action_halt">Halt</string>
<string name="action_settings">Settings</string>
<string name="seg3">3</string>
<string name="seg5">5</string>
<string name="seg2">2</string>
<string name="seg1">1</string>
<string name="number_of_segments">Number of segments</string>
<string name="segment">Segment %1$d</string>
<string name="segment_color_2">Segment Color 2</string>
<string name="segment_color_1">Segment Color 1</string>
<string name="segment_color_0">Segment Color 0</string>
</resources>

View file

@ -0,0 +1,20 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="NoActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

View file

@ -0,0 +1,17 @@
package de.asaril.bletail
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

30
build.gradle Normal file
View file

@ -0,0 +1,30 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

21
gradle.properties Normal file
View file

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,6 @@
#Sun Oct 13 23:14:35 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

172
gradlew vendored Normal file
View file

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View file

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

2
settings.gradle Normal file
View file

@ -0,0 +1,2 @@
include ':app'
rootProject.name='BLEtail'