-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Background** We need protobuf for BLE **Changes** - Add protobuf package and set up as java module
- Loading branch information
Showing
58 changed files
with
219 additions
and
112 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,3 @@ | ||
[submodule "components/bridge/protobuf/flipperzero-protobuf"] | ||
path = components/bridge/protobuf/flipperzero-protobuf | ||
url = [email protected]:flipperdevices/flipperzero-protobuf.git |
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
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
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
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,17 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
id("kotlin-parcelize") | ||
} | ||
apply<com.flipper.gradle.ConfigurationPlugin>() | ||
|
||
dependencies { | ||
implementation(project(":components:core")) | ||
|
||
implementation(Libs.KOTLIN_COROUTINES) | ||
implementation(Libs.NORDIC_BLE_COMMON) | ||
implementation(Libs.NORDIC_BLE_SCAN) | ||
implementation(Libs.NORDIC_BLE_KTX) | ||
|
||
implementation(Libs.APPCOMPAT) | ||
} |
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,5 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.flipper.bridge.api"> | ||
|
||
<uses-permission android:name="android.permission.BLUETOOTH" /> | ||
</manifest> |
2 changes: 1 addition & 1 deletion
2
...per/bridge/api/device/FlipperDeviceApi.kt → ...per/bridge/api/device/FlipperDeviceApi.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
9 changes: 9 additions & 0 deletions
9
...onents/bridge/api/src/main/java/com/flipper/bridge/api/di/FlipperBleComponentInterface.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,9 @@ | ||
package com.flipper.bridge.api.di | ||
|
||
import com.flipper.bridge.api.pair.FlipperPairApi | ||
import com.flipper.bridge.api.scanner.FlipperScanner | ||
|
||
interface FlipperBleComponentInterface { | ||
val flipperScanner: FlipperScanner | ||
val flipperPairApi: FlipperPairApi | ||
} |
16 changes: 16 additions & 0 deletions
16
components/bridge/api/src/main/java/com/flipper/bridge/api/manager/FlipperBleManager.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,16 @@ | ||
package com.flipper.bridge.api.manager | ||
|
||
import android.bluetooth.BluetoothDevice | ||
import com.flipper.bridge.api.model.FlipperGATTInformation | ||
import kotlinx.coroutines.flow.StateFlow | ||
import no.nordicsemi.android.ble.ktx.state.ConnectionState | ||
|
||
interface FlipperBleManager { | ||
val isDeviceConnected: Boolean | ||
fun getInformationStateFlow(): StateFlow<FlipperGATTInformation> | ||
fun getEchoStateFlow(): StateFlow<ByteArray> | ||
fun sendEcho(text: String) | ||
fun getConnectionStateFlow(): StateFlow<ConnectionState> | ||
fun connectToDevice(device: BluetoothDevice) | ||
fun disconnectDevice() | ||
} |
2 changes: 1 addition & 1 deletion
2
...er/bridge/model/FlipperGATTInformation.kt → ...ridge/api/model/FlipperGATTInformation.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ava/com/flipper/bridge/utils/Constants.kt → ...com/flipper/bridge/api/utils/Constants.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
2 changes: 1 addition & 1 deletion
2
...ipper/bridge/utils/DeviceFeatureHelper.kt → ...r/bridge/api/utils/DeviceFeatureHelper.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
2 changes: 1 addition & 1 deletion
2
.../flipper/bridge/utils/PermissionHelper.kt → ...pper/bridge/api/utils/PermissionHelper.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
Empty file.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
8 changes: 1 addition & 7 deletions
8
.../flipper/bridge/di/FlipperBleComponent.kt → .../flipper/bridge/di/FlipperBleComponent.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 |
---|---|---|
@@ -1,15 +1,9 @@ | ||
package com.flipper.bridge.di | ||
|
||
import com.flipper.bridge.api.pair.FlipperPairApi | ||
import com.flipper.bridge.api.scanner.FlipperScanner | ||
import com.flipper.bridge.api.di.FlipperBleComponentInterface | ||
import dagger.Component | ||
import javax.inject.Singleton | ||
|
||
interface FlipperBleComponentInterface { | ||
val flipperScanner: FlipperScanner | ||
val flipperPairApi: FlipperPairApi | ||
} | ||
|
||
@Singleton | ||
@Component(modules = [NordicBleModule::class, FlipperBleModule::class, AndroidBleModule::class]) | ||
interface FlipperBleComponent : FlipperBleComponentInterface |
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
components/bridge/impl/src/main/java/com/flipper/bridge/impl/device/FlipperDeviceApiImpl.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,13 @@ | ||
package com.flipper.bridge.impl.device | ||
|
||
import com.flipper.bridge.api.device.FlipperDeviceApi | ||
import com.flipper.bridge.impl.manager.FlipperBleManagerImpl | ||
|
||
class FlipperDeviceApiImpl( | ||
private val bleManagerImpl: FlipperBleManagerImpl, | ||
override val address: String | ||
) : FlipperDeviceApi { | ||
override fun getBleManager(): FlipperBleManagerImpl { | ||
return bleManagerImpl | ||
} | ||
} |
File renamed without changes.
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
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
This file was deleted.
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,41 @@ | ||
import com.google.protobuf.gradle.generateProtoTasks | ||
import com.google.protobuf.gradle.id | ||
import com.google.protobuf.gradle.proto | ||
import com.google.protobuf.gradle.protobuf | ||
import com.google.protobuf.gradle.protoc | ||
|
||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
id("com.google.protobuf") | ||
} | ||
apply<com.flipper.gradle.ConfigurationPlugin>() | ||
|
||
dependencies { | ||
implementation(project(":components:core")) | ||
api(Libs.PROTOBUF_JAVA) | ||
} | ||
|
||
protobuf { | ||
protoc { | ||
artifact = Libs.PROTOBUF_PROTOC | ||
} | ||
|
||
generateProtoTasks { | ||
all().forEach { | ||
it.builtins { | ||
id("java") { | ||
option("lite") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
sourceSets { | ||
(getByName("main") as com.android.build.gradle.api.AndroidSourceSet).proto { | ||
srcDir("$projectDir/flipperzero-protobuf") | ||
} | ||
} | ||
} |
Submodule flipperzero-protobuf
added at
c05b20
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 @@ | ||
<manifest package="com.flipper.bridge.protobuf" /> |
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,10 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
} | ||
apply<com.flipper.gradle.ConfigurationPlugin>() | ||
|
||
dependencies { | ||
api(project(":components:bridge:api")) | ||
implementation(project(":components:bridge:impl")) | ||
} |
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 @@ | ||
<manifest package="com.flipper.bridge.provider" /> |
8 changes: 8 additions & 0 deletions
8
components/bridge/provider/src/main/java/com/flipper/bridge/provider/FlipperApi.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,8 @@ | ||
package com.flipper.bridge.provider | ||
|
||
import com.flipper.bridge.api.di.FlipperBleComponentInterface | ||
|
||
/** | ||
* Entry point for Flipper Api | ||
*/ | ||
object FlipperApi : FlipperBleComponentInterface by FlipperBleComponentProvider.component |
Oops, something went wrong.