Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/master secret timeout #415

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## 2.2.0 - 2023-12-14
## 2.2.0 - unreleased

## Added

- Persist state of `show log` panel
- Master secret timeout configuration to tracing.

## 2.1.0 - 2023-12-07

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pc-nrfconnect-cellularmonitor",
"version": "2.1.1",
"version": "2.2.0",
"description": "Capture and analyze modem traces",
"displayName": "Cellular Monitor",
"homepage": "https://github.com/NordicSemiconductor/pc-nrfconnect-cellularmonitor",
Expand Down Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"@mdi/js": "^7.2.96",
"@mdi/react": "^1.6.1",
"@nordicsemiconductor/pc-nrfconnect-shared": "^143.0.0",
"@nordicsemiconductor/pc-nrfconnect-shared": "^145.0.0",
"@types/redux-mock-store": "^1.0.2",
"chart.js": "^4.1.2",
"check-disk-space": "^2.1.0",
Expand All @@ -58,13 +58,16 @@
"xterm-headless": "^5.1.0"
},
"dependencies": {
"@nordicsemiconductor/nrf-monitor-lib-js": "^0.8.4"
"@nordicsemiconductor/nrf-monitor-lib-js": "^0.8.5"
},
"eslintConfig": {
"extends": "./node_modules/@nordicsemiconductor/pc-nrfconnect-shared/config/eslintrc"
},
"prettier": "@nordicsemiconductor/pc-nrfconnect-shared/config/prettier.config.js",
"bundledDependencies": [
"@nordicsemiconductor/nrf-monitor-lib-js"
],
"bundleDependencies": [
"@nordicsemiconductor/nrf-monitor-lib-js"
]
}
30 changes: 29 additions & 1 deletion src/features/SidePanel/TraceOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
*/

import React from 'react';
import React, { useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import {
CollapsibleGroup,
NumberInputSliderWithUnit,
selectedDevice,
Toggle,
} from '@nordicsemiconductor/pc-nrfconnect-shared';

import { is9160DK } from '../programSample/programSample';
import {
getIsTracing,
getMasterSecretTimeout,
getRefreshOnStart,
getResetDevice,
getTraceFormats,
setMasterSecretTimeout,
setRefreshOnStart,
setResetDevice,
} from '../tracing/traceSlice';
Expand All @@ -38,6 +41,7 @@ export default () => {
<RefreshOnStart />
<TraceFormatSelector />
<TraceFileInformation />
<MasterSecretTimeout />
</CollapsibleGroup>
);
};
Expand Down Expand Up @@ -76,3 +80,27 @@ const RefreshOnStart = () => {
/>
);
};

const MasterSecretTimeout = () => {
const dispatch = useDispatch();
const masterSecretTimeout = useSelector(getMasterSecretTimeout);
const [localMasterSecretTimeout, setLocalMasterSecretTimeout] = useState(
masterSecretTimeout ?? 1500
);

return (
<div title="optional master secret timeout in ms, to detect if ip packets are received before master secret, typical value 500-1500ms">
<NumberInputSliderWithUnit
className="toggle-label"
label="Master secret timeout"
range={{ min: 0, max: 10_000, step: 1 }}
value={localMasterSecretTimeout}
onChange={setLocalMasterSecretTimeout}
onChangeComplete={value =>
dispatch(setMasterSecretTimeout(value))
}
unit="s"
/>
</div>
);
};
6 changes: 5 additions & 1 deletion src/features/tracing/nrfml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
} from './tracePacketEvents';
import {
getManualDbFilePath,
getMasterSecretTimeout,
getRefreshOnStart,
getResetDevice,
getTaskId,
Expand All @@ -62,7 +63,10 @@ const nrfmlConfig = (
source: SourceFormat,
sinks: TraceFormat[]
): Configuration => ({
config: { plugins_directory: getPluginsDir() },
config: {
plugins_directory: getPluginsDir(),
master_secret_timeout: getMasterSecretTimeout(state),
},
sources: [sourceConfig(state, source)],
sinks: sinks.map(format => sinkConfig(state, source, format)),
});
Expand Down
13 changes: 13 additions & 0 deletions src/features/tracing/traceSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface TraceState {
resetDevice: boolean;
refreshOnStart: boolean;
detectedTraceDbFailed: boolean;
masterSecretTimeout?: number;
}

const initialState = (): TraceState => ({
Expand All @@ -60,6 +61,7 @@ const initialState = (): TraceState => ({
resetDevice: restoreResetDevice(),
refreshOnStart: restoreRefreshOnStart(),
detectedTraceDbFailed: false,
masterSecretTimeout: 1500,
});

const traceSlice = createSlice({
Expand Down Expand Up @@ -153,6 +155,13 @@ const traceSlice = createSlice({
setDetectTraceDbFailed: (state, action: PayloadAction<boolean>) => {
state.detectedTraceDbFailed = action.payload;
},
setMasterSecretTimeout: (
state,
{ payload: masterSecretTimeout }: PayloadAction<number>
) => {
state.masterSecretTimeout =
masterSecretTimeout === 0 ? undefined : masterSecretTimeout;
},
},
});

Expand Down Expand Up @@ -202,6 +211,9 @@ export const getRefreshOnStart = (state: RootState) =>
export const getDetectTraceDbFailed = (state: RootState) =>
state.app.trace.detectedTraceDbFailed;

export const getMasterSecretTimeout = (state: RootState) =>
state.app.trace.masterSecretTimeout;

export const {
resetTraceInfo,
setTraceIsStarted,
Expand All @@ -221,6 +233,7 @@ export const {
setResetDevice,
setRefreshOnStart,
setDetectTraceDbFailed,
setMasterSecretTimeout,
} = traceSlice.actions;

export default traceSlice.reducer;