Migration to new BLEK library (#143)

* Changed view.

* Clear messages.

* Clear messages.

* Add or delete configuration.

* Fixed configuration picker.

* Edit configuration.

* Create new macro.

* removed unnecessary resource files.

* Fixed running macro command.

* Delete macro

* Edit macro

* Changed to peripheral name.

* Show peripheral name.

* Fixed Eol tab design.

* Removed icon resource

* String changes

* Removed any permission from home view.

* Clear device after disconnection.

* 1 line app bar

* Changed missing services text.

* Throughput service view changes.

* Throughput service fixes.

* Removed unused resources.

* Fixed Health temperature profile.

* Show heart rate.

* Fixed hrs view.

* Show heart rate data from left to right in the chart.

* Changed chart color, solid, and scroll to see history.

* Horizontal grid hidden, in case needed.

* HTS view update

* Changed padding.

* Removed circular icon background.

* Updated Battery level view.

* Updated hrs body sensor location.

* Moved ui mappers into view.

* Updated gls view.

* Changed focus color.

* Fixed issue with job.

* Fixed bps.

* Added Blood pressure feature uuid.

* Added blood pressure feature data.

* Added rscs feature data.

* Fixed cscs view.

* Show supported features.

* Fixed ui

* Suspend the service discovery for GLS and CGMS until bonding is completed.

* Added suspend on the function level.

* Bonding state check only to cgms service

* Removed stacktrace print.

* Make cgms record available within a scrollable box

* Changed to gray color.

* removed padding

* Fix height for output section.

* onExpand click event.

* Added todo for 9th item.

* Removed unused code block.

* When in focus, reduce the hint text alpha value.

* Show empty text error.

* Clear focus on tap outside.

* Add border when focused.

* Propagate focus changes.

* CGM graph

* Added sample of one to many uart configuration database.

* Added device and configuration entities.

* Fixed issue with only showing last item from the list.

* Changed configuration database irrespective of device address.

* File rename.

* Added last configuration datastore.

* Check if configuration name is unique

* Removed Macro text.

* Included x and y axis data points.

* Added channel sounding service uuid.

* Upgraded agp version to 2.7.

* Added channel sounding manager.

* Downgraded datastore preference to 1.1.4.

* Changed to nordic colors.

* Added ranging permission.

* channel sounding repository

* channel sounding service data

* channel sounding profile

* channel sounding profile in viewmodel

* channel sounding manager class

* channel sounding testing

* CS service characteristics

* Create bonding before channel sounding connection.

* Clean up.

* Added LBS profile

* Read/write data to LBS

* LBS ui events

* LBS service

* LBS profile

* LBS ui

* Agp upgrade

* Fixed LBS profile

* Removed focus

* Changed macro size to 9

* Changed macro color

* Show macro in bottom sheet

* View refactoring

* Added Blek dependency

* Added utils dependency

* rename

* Removed unused event

* reorganization

* uart macro view update

* background color update

* different color for input and output message type

* Changed to uart event

* removed duplicate

* rename

* auto scroll to new record

* removed unused dependency

* Fixed crash with ChannelSoundingManager injection.

* Require bonding only if it has bonding information

* Changed disconnection

* CGMS graph

* changes in the home view

* Home view fixes

* changed color

* Show MacroEol character in the input message.

* Home view icon fixes.

* Cadence data parser fixes

* Fixed CSC settings view.

* Fixed rscs view

* hiding graphs until its finished

* Removed duplicate

* Fixed RSCS view

* Fixed notification icon

* fixed csc module name

* Fixed icon cutoff

* Fixed CSCDataParser

* Fixed CGMS profile

* Fixed GLS view

* Fixed GLS strings

* Fixed HTS view

* Fixed HTS view

* title change

* Added hts timestamp

* Deleted verbose text

* UART: changed macro/configuration to preset

* UART: fixed input text field

* UART: removed expandable/collapsable preset

* UART: added extra warning to delete action

* UART: don't trim message end.

* UART: message section

* UART: configuration fixed

* UART: configuration fixed

* Fix crash when disconnecting before MTU change completes

* Disabled incomplete PRX profile

* Moved non-composable lambdas to parameters

* refactoring display text

* Fixed channel sounding screen

* Disconnect on missing services before navigation

* Fixed label name

* Tailored disconnection message.

* Tailored disconnection message.

* Moved profile file to utils

* App analytics events and modes

* Integrated analytics with the profile actions.

* Show only first non-battery service if multiple services are present.

* Fixed window insets for camera notch.

* Fixed glucose measurement context.

* Fixed glucose concentration unit.

* Fixed duplicate analytics update.

* rename

* refactoring text

* Handled disconnecting event.

* Replaced with LazyColumn

* Fixed window insets

* Replaced TitleAppBar with NordicAppBar

* Show device address

* Show multiple service names if available.

* Fixed padding

* BPS: Fixed waiting for measurement view.

* BPS: view

* GLS: Fixed padding

* Ui: Fixed dialog

* RSCS: fixed distance formatting error

* CGMS: ui consistency

* DFS: ui fixes

* Replaced local scanner with common library scanner.

* Fixed padding

* reorganization

* Removed previous uart module

* Text with animated three dots

* HTS: text fixes

* formatting texts

* changed text style

* fixed string

* Fixed HRS, not completed

* DFS: fixed ui

* HRS: graph fixes

* UART: scroll up when keyboard is visible

* Uart input: Add focus

* Uart fix: input text field

* UART: created rememberImeState

* HRS: heart rate ui fixes

* profile view scrollable fix

* DFS: ui fixes

* Fixed logger

* Check if the battery characteristics supports NOTIFY or INDICATE property

* Dependency update

* Changed background color

* cleanup

* Fixed distance measurement data update.

* Filtered devices with testing address

* Added preview data

* Fixed section view

* Fixed elevation view

* Removed duplicate views

* Fixes control points

* String fixes

* Elevation view fixes

* Range slider view update

* Fixed DFS views

* Fixed DFS ui

* Fixed DFS views

* Separated views

* Separated profile viewmodel into individual profile view models.

* AGP upgrade

* Job canceled and make jobs null on clear

* Profile name update

* Request maximum MTU size only if it is not already set.

* Fixed null pointer exception

* Battery characteristics read property check

* Fixed early mtu request

* Removed garbage states

* Removed logs

* Removed multiple vertical scroll

* Fixed padding

* Ui fixes

* File reorganization

* Fixed previous configuration not loading on reconnection

* Removed unused files

* Dependency update

* Renamed module name

* Removed unused dependencies

* Added param

* Removed unused code block

* Code optimization

* Removed unused file

* Readme update

* Hide Channel sounding until implementation is complete

* Handled initial state closed

* revert changes

* Added library as module placeholder

* Fixed multiple flows for the same peripheral

* Request mtu size only when needed

* Readme update
This commit is contained in:
Himali Aryal
2025-07-30 14:51:02 +02:00
committed by GitHub
parent 9a71e66c10
commit b67abd60e6
513 changed files with 19164 additions and 14446 deletions

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest/>

View File

@@ -0,0 +1,20 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.bps.BloodPressureFeatureData
import no.nordicsemi.android.toolbox.profile.parser.bps.BloodPressureMeasurementData
import no.nordicsemi.android.toolbox.profile.parser.bps.IntermediateCuffPressureData
import no.nordicsemi.android.toolbox.lib.utils.Profile
/**
* BPS service data class that holds the blood pressure measurement and intermediate cuff pressure data.
*
* @param profile The profile.
* @param bloodPressureMeasurement The blood pressure measurement data.
* @param intermediateCuffPressure The intermediate cuff pressure data.
*/
data class BPSServiceData(
override val profile: Profile = Profile.BPS,
val bloodPressureMeasurement: BloodPressureMeasurementData? = null,
val intermediateCuffPressure: IntermediateCuffPressureData? = null,
val bloodPressureFeature: BloodPressureFeatureData? = null
) : ProfileServiceData()

View File

@@ -0,0 +1,14 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.lib.utils.Profile
/**
* Battery Service data class that holds the battery level.
*
* @param profile The profile.
* @param batteryLevel The battery level.
*/
data class BatteryServiceData(
override val profile: Profile = Profile.BATTERY,
val batteryLevel: Int? = null,
) : ProfileServiceData()

View File

@@ -0,0 +1,19 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.cgms.data.CGMRecord
import no.nordicsemi.android.toolbox.profile.parser.common.WorkingMode
import no.nordicsemi.android.toolbox.profile.parser.gls.data.RequestStatus
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class CGMServiceData(
override val profile: Profile = Profile.CGM,
val records: List<CGMRecordWithSequenceNumber> = emptyList(),
val requestStatus: RequestStatus = RequestStatus.IDLE,
val workingMode: WorkingMode? = null,
) : ProfileServiceData()
data class CGMRecordWithSequenceNumber(
val sequenceNumber: Int,
val record: CGMRecord,
val timestamp: Long
)

View File

@@ -0,0 +1,11 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.csc.CSCData
import no.nordicsemi.android.toolbox.profile.parser.csc.SpeedUnit
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class CSCServiceData(
override val profile: Profile = Profile.CSC,
val data: CSCData = CSCData(),
val speedUnit: SpeedUnit = SpeedUnit.M_S,
) : ProfileServiceData()

View File

@@ -0,0 +1,7 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class ChannelSoundingServiceData(
override val profile: Profile = Profile.CHANNEL_SOUNDING
) : ProfileServiceData()

View File

@@ -0,0 +1,58 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.PeripheralBluetoothAddress
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.azimuthal.AzimuthMeasurementData
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.ddf.DDFData
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.distance.DistanceMode
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.distance.McpdMeasurementData
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.distance.RttMeasurementData
import no.nordicsemi.android.toolbox.profile.parser.directionFinder.elevation.ElevationMeasurementData
import no.nordicsemi.android.toolbox.profile.parser.gls.data.RequestStatus
import no.nordicsemi.android.toolbox.lib.utils.Profile
import no.nordicsemi.android.toolbox.profile.data.directionFinder.MeasurementSection
import no.nordicsemi.android.toolbox.profile.data.directionFinder.Range
private const val MAX_STORED_ITEMS = 5
data class DFSServiceData(
override val profile: Profile = Profile.DFS,
val requestStatus: RequestStatus = RequestStatus.IDLE,
val data: Map<PeripheralBluetoothAddress, SensorData> = emptyMap(),
val ddfFeature: DDFData? = null,
val selectedDevice: PeripheralBluetoothAddress? = null,
val distanceRange: Range = Range(0, 50),
) : ProfileServiceData() {
private val isMcpdAvailable = ddfFeature?.isMcpdAvailable
private val isRttAvailable = ddfFeature?.isRttAvailable
fun isDistanceAvailable(): Boolean {
return isMcpdAvailable == true || isRttAvailable == true
}
fun isDistanceAvailabilityChecked(): Boolean {
return isMcpdAvailable != null || isRttAvailable != null
}
fun isDoubleModeAvailable(): Boolean {
return isMcpdAvailable == true && isRttAvailable == true
}
}
data class SensorData(
val azimuth: SensorValue<AzimuthMeasurementData>? = null,
val elevation: SensorValue<ElevationMeasurementData>? = null,
val mcpdDistance: SensorValue<McpdMeasurementData>? = null,
val rttDistance: SensorValue<RttMeasurementData>? = null,
val distanceMode: DistanceMode? = null,
val selectedMeasurementSection: MeasurementSection? = null
)
data class SensorValue<T>(
val values: List<T> = emptyList(),
val maxItems: Int = MAX_STORED_ITEMS
) {
fun copyWithNewValue(value: T): SensorValue<T> {
return SensorValue(values.takeLast(maxItems - 1) + value)
}
}

View File

@@ -0,0 +1,14 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.common.WorkingMode
import no.nordicsemi.android.toolbox.profile.parser.gls.data.GLSMeasurementContext
import no.nordicsemi.android.toolbox.profile.parser.gls.data.GLSRecord
import no.nordicsemi.android.toolbox.profile.parser.gls.data.RequestStatus
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class GLSServiceData(
override val profile: Profile = Profile.GLS,
val records: Map<GLSRecord, GLSMeasurementContext?> = mapOf(),
val requestStatus: RequestStatus = RequestStatus.IDLE,
val workingMode: WorkingMode? = null,
) : ProfileServiceData()

View File

@@ -0,0 +1,22 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.hrs.HRSData
import no.nordicsemi.android.toolbox.lib.utils.Profile
/**
* Heart Rate Service data.
*
* @param profile the profile.
* @param data the list of heart rate data.
* @param bodySensorLocation the body sensor location.
* @param zoomIn true if the chart is zoomed in.
*/
data class HRSServiceData(
override val profile: Profile = Profile.HRS,
val heartRate: Int? = null,
val data: List<HRSData> = emptyList(),
val bodySensorLocation: Int? = null,
val zoomIn: Boolean = false,
) : ProfileServiceData() {
val heartRates = data.map { it.heartRate }
}

View File

@@ -0,0 +1,18 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.hts.HTSData
import no.nordicsemi.android.toolbox.lib.utils.Profile
import no.nordicsemi.android.toolbox.profile.data.uiMapper.TemperatureUnit
/**
* HTS service data class that holds the HTS data.
*
* @param profile The profile.
* @param data The HTS data.
* @param temperatureUnit The temperature unit.
*/
data class HTSServiceData(
override val profile: Profile = Profile.HTS,
val data: HTSData? = null,
val temperatureUnit: TemperatureUnit = TemperatureUnit.CELSIUS,
) : ProfileServiceData()

View File

@@ -0,0 +1,16 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class LBSServiceData(
override val profile: Profile = Profile.LBS,
val data: LBSData = LBSData(
ledState = false,
buttonState = false,
),
) : ProfileServiceData()
data class LBSData(
val ledState: Boolean,
val buttonState: Boolean,
)

View File

@@ -0,0 +1,10 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.lib.utils.Profile
/**
* Profile service data class that holds the profile and the service data.
*/
sealed class ProfileServiceData {
abstract val profile: Profile
}

View File

@@ -0,0 +1,13 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.rscs.RSCFeatureData
import no.nordicsemi.android.toolbox.profile.parser.rscs.RSCSData
import no.nordicsemi.android.toolbox.profile.parser.rscs.RSCSSettingsUnit
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class RSCSServiceData(
override val profile: Profile = Profile.RSCS,
val data: RSCSData = RSCSData(),
val unit: RSCSSettingsUnit? = RSCSSettingsUnit.UNIT_M,
val feature: RSCFeatureData? = null,
) : ProfileServiceData()

View File

@@ -0,0 +1,37 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.profile.parser.throughput.ThroughputMetrics
import no.nordicsemi.android.toolbox.lib.utils.Profile
data class ThroughputServiceData(
override val profile: Profile = Profile.THROUGHPUT,
val throughputData: ThroughputMetrics = ThroughputMetrics(),
val writingStatus: WritingStatus = WritingStatus.IDEAL,
val maxWriteValueLength: Int? = null
) : ProfileServiceData()
sealed interface ThroughputInputType
data class NumberOfBytes(
val numberOfBytes: Int
) : ThroughputInputType {
companion object {
private const val DISPLAY_NAME = "Test in size (in kB) "
fun getString(): String = DISPLAY_NAME
}
}
data class NumberOfSeconds(
val numberOfSeconds: Int
) : ThroughputInputType {
companion object {
private const val DISPLAY_NAME = "Test in time (seconds)"
fun getString(): String = DISPLAY_NAME
}
}
enum class WritingStatus {
IDEAL, IN_PROGRESS, COMPLETED
}

View File

@@ -0,0 +1,42 @@
package no.nordicsemi.android.toolbox.profile.data
import no.nordicsemi.android.toolbox.lib.utils.Profile
import no.nordicsemi.android.toolbox.profile.data.uart.UARTConfiguration
import no.nordicsemi.android.toolbox.profile.data.uart.UARTMacro
data class UARTServiceData(
override val profile: Profile = Profile.UART,
val messages: List<UARTRecord> = emptyList(),
val command: String? = null,
val maxWriteLength: Int = 20,
val uartViewState: UARTViewState = UARTViewState()
) : ProfileServiceData()
data class UARTRecord(
val text: String,
val type: UARTRecordType,
val timestamp: Long = System.currentTimeMillis()
)
enum class UARTRecordType {
INPUT, OUTPUT
}
data class UARTViewState(
val editedPosition: Int? = null,
val selectedConfigurationName: String? = null,
val isConfigurationEdited: Boolean = false,
val configurations: List<UARTConfiguration> = emptyList(),
val isInputVisible: Boolean = true
) {
val showEditDialog: Boolean = editedPosition != null
val selectedConfiguration: UARTConfiguration? =
configurations.find { selectedConfigurationName == it.name }
val selectedMacro: UARTMacro? = selectedConfiguration?.let { configuration ->
editedPosition?.let {
configuration.macros.getOrNull(it)
}
}
}

View File

@@ -0,0 +1,85 @@
package no.nordicsemi.android.toolbox.profile.data.directionFinder
import no.nordicsemi.android.toolbox.profile.data.SensorData
import no.nordicsemi.android.toolbox.profile.data.SensorValue
fun <T, R> SensorValue<T>?.mapValues(selector: (T) -> R): List<R>? =
this?.values?.map(selector)
fun <T, R : Comparable<R>> SensorValue<T>?.medianValue(selector: (T) -> R): R? =
this?.values?.map(selector)?.sorted()?.let { it.getOrNull(it.size / 2) }
fun SensorData.azimuthValues() = azimuth.mapValues { it.azimuth }
fun SensorData.elevationValues() = elevation.mapValues { it.elevation }
fun SensorData.ifftValues() = mcpdDistance.mapValues { it.mcpd.ifft }
fun SensorData.phaseSlopeValues() = mcpdDistance.mapValues { it.mcpd.phaseSlope }
fun SensorData.rssiValues() = mcpdDistance.mapValues { it.mcpd.rssi }
fun SensorData.bestEffortValues() = mcpdDistance.mapValues { it.mcpd.best }
fun SensorData.rttValues() = rttDistance.mapValues { it.rtt.value }
fun SensorData.azimuthValue() = azimuth.medianValue { it.azimuth }
fun SensorData.elevationValue() = elevation.medianValue { it.elevation }
fun SensorData.ifftValue() = mcpdDistance.medianValue { it.mcpd.ifft }
fun SensorData.phaseSlopeValue() = mcpdDistance.medianValue { it.mcpd.phaseSlope }
fun SensorData.rssiValue() = mcpdDistance.medianValue { it.mcpd.rssi }
fun SensorData.bestEffortValue() = mcpdDistance.medianValue { it.mcpd.best }
fun SensorData.rttValue() = rttDistance.medianValue { it.rtt.value }
fun SensorData.distanceValue() = bestEffortValue() ?: rttValue()
fun SensorData.displayAzimuth() = azimuthValue()?.let { "$it°" }
fun SensorData.displayDistance() = distanceValue()?.let { "${it}dm" }
fun SensorData.displayElevation() = elevationValue()?.let { "$it°" }
fun SensorData.isDistanceSettingsAvailable() = mcpdDistance != null || rttDistance != null
fun SensorData.isMcpdSectionAvailable() =
rttValue() != null || rssiValue() != null || phaseSlopeValue() != null || bestEffortValue() != null
enum class MeasurementSection(val displayName: String) {
DISTANCE_RTT("Round-Trip Time (RTT)"),
DISTANCE_MCPD_IFFT("Inverse Fast Fourier Transform (IFFT)"),
DISTANCE_MCPD_PHASE_SLOPE("Phase slope"),
DISTANCE_MCPD_RSSI("Rssi"),
DISTANCE_MCPD_BEST("Best effort distance estimate");
override fun toString(): String = displayName
}
fun SensorData.availableSections(): List<MeasurementSection> = listOfNotNull(
this.rttValue()?.let { MeasurementSection.DISTANCE_RTT },
this.rssiValue()?.let { MeasurementSection.DISTANCE_MCPD_RSSI },
this.ifftValue()?.let { MeasurementSection.DISTANCE_MCPD_IFFT },
this.phaseSlopeValue()?.let { MeasurementSection.DISTANCE_MCPD_PHASE_SLOPE },
this.bestEffortValue()?.let { MeasurementSection.DISTANCE_MCPD_BEST },
)
// Direction Finder Profile Events
data class Range(
val from: Int,
val to: Int
)
fun SensorData.selectedMeasurementSectionValues(): List<Int>? =
when (this.selectedMeasurementSection) {
MeasurementSection.DISTANCE_RTT -> this.rttValues()
MeasurementSection.DISTANCE_MCPD_IFFT -> this.ifftValues()
MeasurementSection.DISTANCE_MCPD_PHASE_SLOPE -> this.phaseSlopeValues()
MeasurementSection.DISTANCE_MCPD_RSSI -> this.rssiValues()
MeasurementSection.DISTANCE_MCPD_BEST -> this.bestEffortValues()
null -> this.bestEffortValues()
}

View File

@@ -0,0 +1,31 @@
package no.nordicsemi.android.toolbox.profile.data.uart
enum class MacroEol {
LF,
CR,
CR_LF;
override fun toString(): String {
return when (this) {
LF -> "LF"
CR -> "CR"
CR_LF -> "CR+LF"
}
}
}
fun String.parseWithNewLineChar(newLineChar: MacroEol): String {
return when (newLineChar) {
MacroEol.LF -> this
MacroEol.CR_LF -> this.replace("\n", "\r\n")
MacroEol.CR -> this.replace("\n", "\r")
}
}
fun String.toMacroEolUnicodeCharDisplay(newLineChar: MacroEol): String {
return when (newLineChar) {
MacroEol.CR -> this.replace("\n", "\u240D\r\n")
MacroEol.LF -> this + "\u240A"
MacroEol.CR_LF -> this.replace("\n", "\u240A\u240D\r")
}
}

View File

@@ -0,0 +1,31 @@
package no.nordicsemi.android.toolbox.profile.data.uart
enum class MacroIcon(val index: Int) {
LEFT(0),
UP(1),
RIGHT(2),
DOWN(3),
SETTINGS(4),
REW(5),
PLAY(6),
PAUSE(7),
STOP(8),
FWD(9),
INFO(10),
NUMBER_1(11),
NUMBER_2(12),
NUMBER_3(13),
NUMBER_4(14),
NUMBER_5(15),
NUMBER_6(16),
NUMBER_7(17),
NUMBER_8(18),
NUMBER_9(19);
companion object {
fun create(index: Int): MacroIcon {
return entries.firstOrNull { it.index == index }
?: throw IllegalArgumentException("Cannot create MacroIcon for index: $index")
}
}
}

View File

@@ -0,0 +1,16 @@
package no.nordicsemi.android.toolbox.profile.data.uart
private const val MACROS_SIZES = 9
data class UARTConfiguration(
val id: Int?,
val name: String,
val macros: List<UARTMacro?> = List<UARTMacro?>(MACROS_SIZES) { null }
) {
init {
if (macros.size < MACROS_SIZES) {
throw IllegalArgumentException("Macros should always have $MACROS_SIZES positions.")
}
}
}

View File

@@ -0,0 +1,7 @@
package no.nordicsemi.android.toolbox.profile.data.uart
data class UARTMacro(
val icon: MacroIcon,
val command: String?,
val newLineChar: MacroEol
)

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022, Nordic Semiconductor
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package no.nordicsemi.android.toolbox.profile.data.uiMapper
enum class TemperatureUnit {
CELSIUS,
FAHRENHEIT,
KELVIN;
override fun toString(): String {
return when (this) {
CELSIUS -> "Celsius"
FAHRENHEIT -> "Fahrenheit"
KELVIN -> "Kelvin"
}
}
}