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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions app/src/main/java/no/nordicsemi/memfault/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withLink
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -127,6 +128,9 @@ private fun OnePane(
Spacer(modifier = Modifier.weight(0.3f))

Content(
modifier = Modifier
.padding(horizontal = 16.dp)
.widthIn(max = 600.dp),
onStart = onStart
)

Expand All @@ -153,7 +157,9 @@ private fun TwoPane(
modifier = Modifier
.weight(0.7f)
.verticalScroll(rememberScrollState())
.padding(vertical = 16.dp),
.padding(vertical = 16.dp)
.padding(end = 16.dp)
.widthIn(max = 600.dp),
onStart = onStart
)
}
Expand Down Expand Up @@ -181,6 +187,14 @@ private fun Content(
modifier = modifier,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = stringResource(R.string.app_info_header),
style = MaterialTheme.typography.titleLarge,
textAlign = TextAlign.Center,
)

Spacer(modifier = Modifier.size(32.dp))

Text(
text = buildAnnotatedString {
append(stringResource(id = R.string.app_info))
Expand All @@ -197,7 +211,7 @@ private fun Content(
append(" ")
withLink(
LinkAnnotation.Url(
url = "https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/bluetooth/services/mds.html",
url = "https://docs.memfault.com/docs/mcu/mds",
styles = TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.secondary)),
)
) {
Expand All @@ -206,9 +220,6 @@ private fun Content(
append(stringResource(id = R.string.app_info_3))
},
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier
.widthIn(max = 600.dp)
.padding(horizontal = 16.dp)
)

Spacer(modifier = Modifier.size(32.dp))
Expand All @@ -223,7 +234,10 @@ private fun Content(
@Composable
private fun OnePanePreview() {
OnePane(
modifier = Modifier.fillMaxSize(),
modifier = Modifier
.fillMaxSize()
.padding(vertical = 16.dp)
.widthIn(max = 600.dp),
onStart = { }
)
}
Expand All @@ -232,7 +246,10 @@ private fun OnePanePreview() {
@Composable
private fun TwoPanePreview() {
TwoPane(
modifier = Modifier.fillMaxSize(),
modifier = Modifier
.fillMaxSize()
.padding(vertical = 16.dp)
.widthIn(max = 600.dp),
onStart = { }
)
}
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
<string name="chunk_number">#%d</string>
<string name="bytes_count">%d bytes</string>

<string name="app_info">nRF Memfault forwards diagnostic data collected by firmware through a
Bluetooth LE gateway to the</string>
<string name="app_info_header">Fix defects before your customers find them.</string>
<string name="app_info">nRF Memfault app forwards diagnostic data collected from embedded device using Bluetooth LE to</string>
<string name="app_info_memfault_console">Memfault console</string>
<string name="app_info_2">.\n\nThe device should support</string>
<string name="app_info_gatt">Memfault Diagnostics Service (MDS)</string>
<string name="app_info_gatt">Memfault Monitoring &amp; Diagnostics Service (MDS)</string>
<string name="app_info_3">.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ import no.nordicsemi.memfault.observability.internal.MemfaultScope

/**
* Class responsible for managing connection with the remote IoT device which supports
* Memfault Diagnostic Service.
* Memfault Monitoring & Diagnostic Service.
*
* The manager connects to the device and uploads all downloaded chunks to the cloud.
*
* Data can be emitted any time so the connection should be maintained as long as needed.
*
* @see <a href="https://app.memfault.com">Memfault console</a>
* @see <a href="https://memfault.notion.site/Memfault-Diagnostic-GATT-Service-MDS-ffd5a430062649cd9bf6edbf64e2563b">Memfault Diagnostic GATT Service</a>
* @see <a href="https://docs.memfault.com/docs/mcu/mds">Memfault Monitoring & Diagnostic GATT Service</a>
*/
interface MemfaultDiagnosticsManager {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

/**
* Memfault Diagnostics Service UUID.
* Memfault Monitoring & Diagnostics Service UUID.
*
* Find specification ih the [Documentation](https://docs.memfault.com/docs/mcu/mds).
*/
Expand All @@ -86,7 +86,8 @@ private val MDS_AUTHORISATION_CHARACTERISTIC_UUID = Uuid.parse("54220004-f6
private val MDS_DATA_EXPORT_CHARACTERISTIC_UUID = Uuid.parse("54220005-f6a5-4007-a371-722f4ebd8436")

/**
* A client implementation of Memfault Diagnostics Service (MDS) that streams data from the device.
* A client implementation of Memfault Monitoring & Diagnostics Service (MDS) that streams data
* from the device.
*
* This class connects to the device, discovers the MDS service, reads the configuration,
* and streams diagnostics [chunks] from the device.
Expand Down Expand Up @@ -251,7 +252,7 @@ class MemfaultDiagnosticsService {
// We may ignore it, as the observer already notified about the disconnection.
is ConnectionState.Closed -> return@onEach

// Disconnected state is emitted when the connection is lost when the device
// Disconnected state is emitted when the connection is lost, when the device
// is not supported (disconnect() method called), or the connection was cancelled
// by the user.
is ConnectionState.Disconnected -> {
Expand Down Expand Up @@ -316,7 +317,7 @@ class MemfaultDiagnosticsService {

// Check if the MDS service is supported.
// The exception will be caught in the catch block below.
checkNotNull(mds) { "Memfault Diagnostics Service not supported" }
checkNotNull(mds) { "Monitoring & Diagnostics Service not supported" }

_state.emit(value = DeviceState.Initializing)

Expand All @@ -328,7 +329,7 @@ class MemfaultDiagnosticsService {
// Make sure the chunks are enabled only after the state changed to Connected.
start(mds)

logger.info("Memfault Diagnostics Service started successfully")
logger.info("Monitoring & Diagnostics Service started successfully")
}
.catch { throwable ->
logger.error(throwable.message)
Expand Down