Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Simplicity Connect includes many demos to test sample apps in the Silicon Labs G
- **AWS Demo**: This Demo showcases a system where sensor data is sent to AWS IoT Core using the MQTT protocol. A mobile app subscribes to specific MQTT topics to receive this sensor data in real-time. The app can also publish messages to AWS IoT Core, which are then received by the sensor device's firmware, enabling two-way communication.
- **Smart Lock**: Add/commission smart lock and read/control it over Bluetooth and AWS IoT Cloud.
- **Channel Sounding**: Measure distance between your device and EFRxG24 devices using Bluetooth Channel Sounding with configurable parameters.
- **Energy Harvesting**:Monitor harvested voltage in real time.
- **Energy Harvesting**: Monitor harvested voltage in real time.

## Development Features
Simplicity Connect helps developers create and troubleshoot Bluetooth applications running on Silicon Labs’ BLE hardware. Here’s a rundown of some example functionalities.
Expand Down
32 changes: 21 additions & 11 deletions mobile/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.gradle.api.tasks.Copy

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
Expand All @@ -13,6 +15,17 @@ repositories {
mavenCentral()
}

// Registered Copy task (not assemble.doLast { copy { } }) keeps configuration cache working:
// doLast + copy { } resolves to project.copy() at execution time and captures Project.
tasks.register<Copy>("copySiConnectReleaseApkToBuilds") {
from(layout.buildDirectory.dir("outputs/apk/Si-Connect/release")) {
include("*.apk")
// Stable name for scripts (e.g. automation_scripts/launch_apk.sh)
rename { _ -> "mobile-Si-Connect-release.apk" }
}
into(layout.projectDirectory.dir("Builds"))
}

android {
compileSdk = 36
namespace = "com.siliconlabs.bledemo"
Expand Down Expand Up @@ -60,15 +73,6 @@ android {



applicationVariants.all{
assembleProvider.get().doLast{
copy{
from("Builds/${rootProject.name}/${project.name}/outputs/apk/Si-Connect/release/mobile-Si-Connect-release.apk")
into ("Builds")
}
}
}

lint {
checkReleaseBuilds = false
// Or, if you prefer, you can continue to check for errors in release builds,
Expand All @@ -83,8 +87,8 @@ android {
create("Si-Connect") {
dimension = versionDim
applicationId = "com.siliconlabs.bledemo"
versionCode = 76
versionName = "3.2.2"
versionCode = 82
versionName = "3.3.0"
}
}

Expand Down Expand Up @@ -118,9 +122,15 @@ android {
val apkName = "mobile-${name}-${versionName}.apk"
(this as? com.android.build.gradle.internal.api.BaseVariantOutputImpl)?.outputFileName = apkName
}
if (buildType.name == "release") {
assembleProvider.configure {
finalizedBy(tasks.named("copySiConnectReleaseApkToBuilds"))
}
}
}

}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Expand Down
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.
Binary file modified mobile/libs/AndroidPlatform.jar
Binary file not shown.
Binary file modified mobile/libs/CHIPClusterID.jar
Binary file not shown.
Binary file modified mobile/libs/CHIPClusters.jar
Binary file not shown.
Binary file modified mobile/libs/CHIPController.jar
Binary file not shown.
Binary file modified mobile/libs/CHIPInteractionModel.jar
Binary file not shown.
Binary file modified mobile/libs/OnboardingPayload.jar
Binary file not shown.
Binary file removed mobile/libs/gdx-1.9.6-SNAPSHOT.jar
Binary file not shown.
Binary file not shown.
Binary file modified mobile/libs/libMatterJson.jar
Binary file not shown.
Binary file modified mobile/libs/libMatterTlv.jar
Binary file not shown.
37 changes: 33 additions & 4 deletions mobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@
android:name=".application.SiliconLabsDemoApplication"
android:allowBackup="false"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/si_launcher_round"
android:icon="@mipmap/ic_launcher_rebranded"
android:roundIcon="@mipmap/ic_launcher_rebranded"
android:label="@string/app_name_simplicity_Connect"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/MainAppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup"
tools:targetApi="tiramisu">
<activity
android:name=".features.demo.energyharvesting.EnergyHarvestingActivity"
android:exported="false" />

<!-- MqttService -->
<service
android:name=".features.configure.advertiser.services.MqttForegroundService"
Expand Down Expand Up @@ -86,6 +85,11 @@
android:foregroundServiceType="location|dataSync">

</service>
<service
android:name=".features.demo.channel_sounding.services.ReflectorProximityForegroundService"
android:exported="false"
android:foregroundServiceType="connectedDevice"
tools:ignore="ForegroundServicePermission" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.siliconlabs.bledemo.provider"
Expand Down Expand Up @@ -248,6 +252,31 @@
android:screenOrientation="sensorPortrait"
android:theme="@style/MainAppTheme.NoActionBar"
tools:ignore="DiscouragedApi"/>

<!-- Channel Sounding Phase 2 - Reflector Mode Activities -->
<activity
android:name=".features.demo.channel_sounding.activities.ReflectorScanActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/MainAppTheme.NoActionBar"
tools:ignore="DiscouragedApi"/>

<activity
android:name=".features.demo.channel_sounding.activities.ReflectorPairingActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/MainAppTheme.NoActionBar"
tools:ignore="DiscouragedApi"/>

<activity
android:name=".features.demo.channel_sounding.activities.ReflectorDashboardActivity"
android:launchMode="singleTop"
android:screenOrientation="sensorPortrait"
android:theme="@style/MainAppTheme.NoActionBar"
tools:ignore="DiscouragedApi"/>
tools:ignore="DiscouragedApi"
tools:targetApi="36" />
<activity
android:name=".features.demo.energyharvesting.EnergyHarvestingActivity"
android:exported="false" />
</application>

</manifest>
Binary file not shown.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import android.util.Log
import androidx.core.util.isEmpty
import com.siliconlabs.bledemo.bluetooth.beacon_utils.BleFormat
import com.siliconlabs.bledemo.bluetooth.beacon_utils.BleFormat.Companion.getFormat
import java.util.*
import kotlin.math.min

class BluetoothDeviceInfo(var device: BluetoothDevice, var isFavorite: Boolean = false) : Cloneable {
class BluetoothDeviceInfo(var device: BluetoothDevice, var isFavorite: Boolean = false) :
Cloneable {

var connectionState = ConnectionState.DISCONNECTED
var isConnectable = false
Expand All @@ -23,7 +23,6 @@ class BluetoothDeviceInfo(var device: BluetoothDevice, var isFavorite: Boolean =
var timestampLast: Long = 0



public override fun clone(): BluetoothDeviceInfo {
val retVal: BluetoothDeviceInfo
try {
Expand Down Expand Up @@ -72,7 +71,8 @@ class BluetoothDeviceInfo(var device: BluetoothDevice, var isFavorite: Boolean =
this.intervalNanos = intervalNanos
else if (intervalNanos < this.intervalNanos + 3000000) {
val limitedCount = min(count, 10)
this.intervalNanos = (this.intervalNanos * (limitedCount - 1) + intervalNanos) / limitedCount
this.intervalNanos =
(this.intervalNanos * (limitedCount - 1) + intervalNanos) / limitedCount
} else if (intervalNanos < this.intervalNanos * 1.4) {
this.intervalNanos = (this.intervalNanos * 29 + intervalNanos) / 30
}
Expand Down Expand Up @@ -106,6 +106,7 @@ class BluetoothDeviceInfo(var device: BluetoothDevice, var isFavorite: Boolean =

val manufacturer: DeviceManufacturer
get() = scanInfo?.scanRecord?.manufacturerSpecificData?.let {
println("---------------MAnufacture:$it")
if (it.isEmpty()) DeviceManufacturer.UNKNOWN
else when (it.keyAt(0)) {
MANUFACTURER_VALUE_WINDOWS -> DeviceManufacturer.WINDOWS
Expand All @@ -115,6 +116,7 @@ class BluetoothDeviceInfo(var device: BluetoothDevice, var isFavorite: Boolean =

enum class DeviceManufacturer {
WINDOWS,
ANDROID,
UNKNOWN
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ class ScanResultCompat {

@SuppressLint("MissingPermission")
fun getDisplayName(): String {
return device?.name ?: "N/A"
// Priority: scan record device name > BluetoothDevice.name > fallback
return scanRecord?.deviceName
?: device?.name
?: "N/A"
}

override fun toString(): String {
Expand Down
Loading
Loading