Skip to content

Commit be54b12

Browse files
authored
Merge pull request #31 from NordicSemiconductor/improvement/ui
Home screen improvements
2 parents 1502c86 + df81839 commit be54b12

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

app/src/main/java/no/nordicsemi/memfault/home/HomeScreen.kt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import androidx.compose.ui.text.LinkAnnotation
6565
import androidx.compose.ui.text.SpanStyle
6666
import androidx.compose.ui.text.TextLinkStyles
6767
import androidx.compose.ui.text.buildAnnotatedString
68+
import androidx.compose.ui.text.style.TextAlign
6869
import androidx.compose.ui.text.withLink
6970
import androidx.compose.ui.tooling.preview.Preview
7071
import androidx.compose.ui.unit.dp
@@ -127,6 +128,9 @@ private fun OnePane(
127128
Spacer(modifier = Modifier.weight(0.3f))
128129

129130
Content(
131+
modifier = Modifier
132+
.padding(horizontal = 16.dp)
133+
.widthIn(max = 600.dp),
130134
onStart = onStart
131135
)
132136

@@ -153,7 +157,9 @@ private fun TwoPane(
153157
modifier = Modifier
154158
.weight(0.7f)
155159
.verticalScroll(rememberScrollState())
156-
.padding(vertical = 16.dp),
160+
.padding(vertical = 16.dp)
161+
.padding(end = 16.dp)
162+
.widthIn(max = 600.dp),
157163
onStart = onStart
158164
)
159165
}
@@ -181,6 +187,14 @@ private fun Content(
181187
modifier = modifier,
182188
horizontalAlignment = Alignment.CenterHorizontally,
183189
) {
190+
Text(
191+
text = stringResource(R.string.app_info_header),
192+
style = MaterialTheme.typography.titleLarge,
193+
textAlign = TextAlign.Center,
194+
)
195+
196+
Spacer(modifier = Modifier.size(32.dp))
197+
184198
Text(
185199
text = buildAnnotatedString {
186200
append(stringResource(id = R.string.app_info))
@@ -197,7 +211,7 @@ private fun Content(
197211
append(" ")
198212
withLink(
199213
LinkAnnotation.Url(
200-
url = "https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/bluetooth/services/mds.html",
214+
url = "https://docs.memfault.com/docs/mcu/mds",
201215
styles = TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.secondary)),
202216
)
203217
) {
@@ -206,9 +220,6 @@ private fun Content(
206220
append(stringResource(id = R.string.app_info_3))
207221
},
208222
style = MaterialTheme.typography.bodyLarge,
209-
modifier = Modifier
210-
.widthIn(max = 600.dp)
211-
.padding(horizontal = 16.dp)
212223
)
213224

214225
Spacer(modifier = Modifier.size(32.dp))
@@ -223,7 +234,10 @@ private fun Content(
223234
@Composable
224235
private fun OnePanePreview() {
225236
OnePane(
226-
modifier = Modifier.fillMaxSize(),
237+
modifier = Modifier
238+
.fillMaxSize()
239+
.padding(vertical = 16.dp)
240+
.widthIn(max = 600.dp),
227241
onStart = { }
228242
)
229243
}
@@ -232,7 +246,10 @@ private fun OnePanePreview() {
232246
@Composable
233247
private fun TwoPanePreview() {
234248
TwoPane(
235-
modifier = Modifier.fillMaxSize(),
249+
modifier = Modifier
250+
.fillMaxSize()
251+
.padding(vertical = 16.dp)
252+
.widthIn(max = 600.dp),
236253
onStart = { }
237254
)
238255
}

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@
7777
<string name="chunk_number">#%d</string>
7878
<string name="bytes_count">%d bytes</string>
7979

80-
<string name="app_info">nRF Memfault forwards diagnostic data collected by firmware through a
81-
Bluetooth LE gateway to the</string>
80+
<string name="app_info_header">Fix defects before your customers find them.</string>
81+
<string name="app_info">nRF Memfault app forwards diagnostic data collected from embedded device using Bluetooth LE to</string>
8282
<string name="app_info_memfault_console">Memfault console</string>
8383
<string name="app_info_2">.\n\nThe device should support</string>
84-
<string name="app_info_gatt">Memfault Diagnostics Service (MDS)</string>
84+
<string name="app_info_gatt">Memfault Monitoring &amp; Diagnostics Service (MDS)</string>
8585
<string name="app_info_3">.</string>
8686
</resources>

lib/observability/src/main/java/no/nordicsemi/memfault/observability/MemfaultDiagnosticsManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ import no.nordicsemi.memfault.observability.internal.MemfaultScope
4343

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

lib/observability/src/main/java/no/nordicsemi/memfault/observability/bluetooth/MemfaultDiagnosticsService.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import kotlin.uuid.ExperimentalUuidApi
7373
import kotlin.uuid.Uuid
7474

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

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

254-
// Disconnected state is emitted when the connection is lost when the device
255+
// Disconnected state is emitted when the connection is lost, when the device
255256
// is not supported (disconnect() method called), or the connection was cancelled
256257
// by the user.
257258
is ConnectionState.Disconnected -> {
@@ -316,7 +317,7 @@ class MemfaultDiagnosticsService {
316317

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

321322
_state.emit(value = DeviceState.Initializing)
322323

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

331-
logger.info("Memfault Diagnostics Service started successfully")
332+
logger.info("Monitoring & Diagnostics Service started successfully")
332333
}
333334
.catch { throwable ->
334335
logger.error(throwable.message)

0 commit comments

Comments
 (0)