@nordicsemiconductor/pc-nrfconnect-shared 60.0.0-pre1 → 60.0.0-pre2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap.css +8951 -0
- package/dist/index.css +1451 -0
- package/dist/index.js +122119 -0
- package/{src/Logo/nordic-logo-blue-icon-only.png → dist/nordic-logo-blue-icon-only-H7BABN6D.png} +0 -0
- package/{src/Logo/nordic-logo-gray-icon-only.png → dist/nordic-logo-gray-icon-only-GATOTR3L.png} +0 -0
- package/package.json +12 -3
- package/typings/generated/src/Device/deviceInfo/deviceInfo.d.ts +1 -2
- package/.github/ISSUE_TEMPLATE/custom.md +0 -10
- package/.husky/pre-push +0 -3
- package/.renovaterc.json +0 -10
- package/Changelog.md +0 -2973
- package/azure-pipelines.yml +0 -34
- package/config/eslintrc.js +0 -190
- package/config/jest.config.js +0 -41
- package/config/prettier.config.js +0 -13
- package/config/tsconfig.json +0 -15
- package/fw/bootloader/graviton_bootloader_v1.0.1-[nRF5_SDK_15.0.1-1.alpha_f76d012].zip +0 -0
- package/jest.config.js +0 -7
- package/main/index.ts +0 -32
- package/mocks/deviceLibMock.ts +0 -21
- package/mocks/electronMock.ts +0 -15
- package/mocks/electronStoreMock.ts +0 -19
- package/mocks/emptyMock.ts +0 -7
- package/mocks/fileMock.ts +0 -13
- package/mocks/gaMock.ts +0 -9
- package/mocks/mockTests.test.ts +0 -15
- package/mocks/packageJsonMock.ts +0 -10
- package/mocks/remoteMock.ts +0 -17
- package/scripts/esbuild-bootstrap.js +0 -15
- package/scripts/esbuild-renderer.js +0 -131
- package/scripts/installHusky.ts +0 -17
- package/scripts/prepare-shared-release.ts +0 -122
- package/scripts/release-shared.test.ts +0 -132
- package/scripts/release-shared.ts +0 -207
- package/src/About/About.tsx +0 -25
- package/src/About/AboutButton.tsx +0 -28
- package/src/About/ApplicationCard.tsx +0 -83
- package/src/About/DeviceCard.tsx +0 -74
- package/src/About/DocumentationCard.tsx +0 -18
- package/src/About/DocumentationSection.tsx +0 -24
- package/src/About/Section.tsx +0 -21
- package/src/About/ShortcutButton.tsx +0 -41
- package/src/About/SupportCard.tsx +0 -97
- package/src/About/about.scss +0 -40
- package/src/About/documentationSlice.ts +0 -41
- package/src/About/section.scss +0 -15
- package/src/About/shortcutSlice.ts +0 -52
- package/src/Alert/Alert.module.scss +0 -29
- package/src/Alert/Alert.tsx +0 -37
- package/src/App/App.test.tsx +0 -47
- package/src/App/App.tsx +0 -227
- package/src/App/ConnectedToStore.tsx +0 -19
- package/src/App/VisibilityBar.tsx +0 -103
- package/src/App/app.scss +0 -83
- package/src/App/appLayout.ts +0 -95
- package/src/App/shared.scss +0 -49
- package/src/App/visibility-bar.scss +0 -55
- package/src/Button/Button.tsx +0 -66
- package/src/Button/button.module.scss +0 -154
- package/src/Card/Card.tsx +0 -26
- package/src/Card/card.module.scss +0 -28
- package/src/Device/BrokenDeviceDialog/BrokenDeviceDialog.tsx +0 -58
- package/src/Device/BrokenDeviceDialog/broken-device-dialog.scss +0 -18
- package/src/Device/BrokenDeviceDialog/brokenDeviceDialogSlice.tsx +0 -48
- package/src/Device/DeviceSelector/BasicDeviceInfo.tsx +0 -115
- package/src/Device/DeviceSelector/DeviceIcon.tsx +0 -27
- package/src/Device/DeviceSelector/DeviceList/AnimatedList.tsx +0 -62
- package/src/Device/DeviceSelector/DeviceList/BrokenDevice.tsx +0 -34
- package/src/Device/DeviceSelector/DeviceList/Device.tsx +0 -84
- package/src/Device/DeviceSelector/DeviceList/DeviceList.tsx +0 -113
- package/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.tsx +0 -28
- package/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.tsx +0 -65
- package/src/Device/DeviceSelector/DeviceList/RenameDevice.tsx +0 -22
- package/src/Device/DeviceSelector/DeviceList/broken-device.scss +0 -32
- package/src/Device/DeviceSelector/DeviceList/device-list.scss +0 -64
- package/src/Device/DeviceSelector/DeviceList/device.scss +0 -28
- package/src/Device/DeviceSelector/DeviceList/edit-device-buttons.scss +0 -31
- package/src/Device/DeviceSelector/DeviceList/more-device-info.scss +0 -33
- package/src/Device/DeviceSelector/DeviceList/rename-device.scss +0 -13
- package/src/Device/DeviceSelector/DeviceSelector.test.tsx +0 -342
- package/src/Device/DeviceSelector/DeviceSelector.tsx +0 -173
- package/src/Device/DeviceSelector/Favorite.tsx +0 -49
- package/src/Device/DeviceSelector/SelectDevice.tsx +0 -36
- package/src/Device/DeviceSelector/SelectedDevice.tsx +0 -65
- package/src/Device/DeviceSelector/arrow-down.svg +0 -1
- package/src/Device/DeviceSelector/basic-device-info.scss +0 -62
- package/src/Device/DeviceSelector/device-icon.scss +0 -27
- package/src/Device/DeviceSelector/favorite.scss +0 -17
- package/src/Device/DeviceSelector/select-device.scss +0 -38
- package/src/Device/DeviceSelector/selected-device.scss +0 -57
- package/src/Device/DeviceSetup/DeviceSetupView.tsx +0 -102
- package/src/Device/deviceAutoSelectSlice.ts +0 -144
- package/src/Device/deviceInfo/deviceInfo.ts +0 -254
- package/src/Device/deviceInfo/nRF51-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/nRF52-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/nRF53-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/nRF70-Series_no-background_RGB.svg +0 -36
- package/src/Device/deviceInfo/nRF91-Series-logo.svg +0 -1
- package/src/Device/deviceInfo/ppk-logo.svg +0 -1
- package/src/Device/deviceInfo/unknown-logo.svg +0 -30
- package/src/Device/deviceInfo/unknown-nordic-logo.svg +0 -25
- package/src/Device/deviceLibWrapper.test.ts +0 -97
- package/src/Device/deviceLibWrapper.ts +0 -133
- package/src/Device/deviceLister.test.ts +0 -89
- package/src/Device/deviceLister.ts +0 -396
- package/src/Device/deviceSetup.ts +0 -264
- package/src/Device/deviceSetupSlice.ts +0 -94
- package/src/Device/deviceSlice.ts +0 -248
- package/src/Device/dfu-cc.ts +0 -162
- package/src/Device/initPacket.ts +0 -402
- package/src/Device/jprogOperations.ts +0 -206
- package/src/Device/sdfuOperations.ts +0 -601
- package/src/Dialog/Dialog.test.tsx +0 -134
- package/src/Dialog/Dialog.tsx +0 -236
- package/src/Dialog/dialog.scss +0 -60
- package/src/Dropdown/Dropdown.module.scss +0 -83
- package/src/Dropdown/Dropdown.test.tsx +0 -62
- package/src/Dropdown/Dropdown.tsx +0 -106
- package/src/ErrorBoundary/ErrorBoundary.test.tsx +0 -105
- package/src/ErrorBoundary/ErrorBoundary.tsx +0 -186
- package/src/ErrorBoundary/bug.svg +0 -1
- package/src/ErrorBoundary/error-boundary.scss +0 -102
- package/src/ErrorDialog/ErrorDialog.test.tsx +0 -70
- package/src/ErrorDialog/ErrorDialog.tsx +0 -94
- package/src/ErrorDialog/error.scss +0 -14
- package/src/ErrorDialog/errorDialogSlice.test.ts +0 -64
- package/src/ErrorDialog/errorDialogSlice.ts +0 -80
- package/src/FactoryReset/FactoryResetButton.test.tsx +0 -46
- package/src/FactoryReset/FactoryResetButton.tsx +0 -81
- package/src/InlineInput/InlineInput.tsx +0 -170
- package/src/InlineInput/NumberInlineInput.tsx +0 -107
- package/src/InlineInput/inline-input.scss +0 -38
- package/src/InlineInput/number-inline-input.scss +0 -15
- package/src/Log/LogEntry.tsx +0 -62
- package/src/Log/LogViewer.tsx +0 -54
- package/src/Log/log-entry.scss +0 -30
- package/src/Log/log-viewer.scss +0 -24
- package/src/Log/logSlice.ts +0 -73
- package/src/Log/syncLogToStore.ts +0 -36
- package/src/Logo/Logo.tsx +0 -48
- package/src/Logo/logo.scss +0 -11
- package/src/Main/Main.tsx +0 -13
- package/src/Main/main.scss +0 -13
- package/src/MasonryLayout/MasonryLayout.tsx +0 -234
- package/src/MasonryLayout/masonryLayout.module.scss +0 -46
- package/src/NavBar/NavBar.tsx +0 -22
- package/src/NavBar/NavMenu.test.tsx +0 -41
- package/src/NavBar/NavMenu.tsx +0 -53
- package/src/NavBar/NavMenuItem.tsx +0 -41
- package/src/NavBar/nav-bar.scss +0 -26
- package/src/NavBar/nav-menu-item.scss +0 -34
- package/src/OpenApp/openApp.ts +0 -18
- package/src/Panes/FeedbackPane.tsx +0 -149
- package/src/PseudoButton/PseudoButton.tsx +0 -56
- package/src/PseudoButton/pseudo-button.scss +0 -11
- package/src/SerialPort/ConflictingSettingsDialog.tsx +0 -242
- package/src/SerialPort/SerialPort.test.ts +0 -54
- package/src/SerialPort/SerialPort.ts +0 -202
- package/src/Shortcuts/Shortcut-item.scss +0 -33
- package/src/Shortcuts/Shortcut-modal.scss +0 -20
- package/src/Shortcuts/ShortcutItem.tsx +0 -48
- package/src/Shortcuts/ShortcutModal.tsx +0 -67
- package/src/SidePanel/Group.tsx +0 -106
- package/src/SidePanel/SidePanel.tsx +0 -19
- package/src/SidePanel/group.scss +0 -42
- package/src/SidePanel/sidepanel.scss +0 -20
- package/src/Slider/Bar.tsx +0 -24
- package/src/Slider/Factor.test.ts +0 -48
- package/src/Slider/Handle.tsx +0 -121
- package/src/Slider/Slider.test.tsx +0 -25
- package/src/Slider/Slider.tsx +0 -91
- package/src/Slider/Ticks.tsx +0 -54
- package/src/Slider/__snapshots__/Slider.test.tsx.snap +0 -50
- package/src/Slider/bar.scss +0 -24
- package/src/Slider/factor.ts +0 -24
- package/src/Slider/handle.scss +0 -32
- package/src/Slider/percentage.ts +0 -67
- package/src/Slider/range.ts +0 -92
- package/src/Slider/slider.scss +0 -14
- package/src/Slider/ticks.scss +0 -28
- package/src/Slider/variables.scss +0 -16
- package/src/StartStopButton/StartStopButton.tsx +0 -60
- package/src/StartStopButton/play-circle.svg +0 -1
- package/src/StartStopButton/start-stop-button.scss +0 -47
- package/src/StartStopButton/stop-circle.svg +0 -1
- package/src/StateSelector/StateSelector.tsx +0 -64
- package/src/StateSelector/state-selector.scss +0 -38
- package/src/Stepper/Stepper.tsx +0 -139
- package/src/Stepper/stepper.scss +0 -127
- package/src/Toggle/Toggle.tsx +0 -120
- package/src/Toggle/toggle.scss +0 -109
- package/src/bootstrap.scss +0 -14
- package/src/index.ts +0 -146
- package/src/logging/appTransport.test.ts +0 -78
- package/src/logging/appTransport.ts +0 -41
- package/src/logging/describeError.test.ts +0 -38
- package/src/logging/describeError.ts +0 -56
- package/src/logging/index.ts +0 -103
- package/src/logging/logBuffer.test.ts +0 -41
- package/src/logging/logBuffer.ts +0 -24
- package/src/logging/sendInitialLogMessages.ts +0 -64
- package/src/store.ts +0 -60
- package/src/svg.d.ts +0 -15
- package/src/utils/AppTypes.ts +0 -60
- package/src/utils/appDirs.ts +0 -78
- package/src/utils/bleChannels.ts +0 -16
- package/src/utils/classNames.test.ts +0 -29
- package/src/utils/classNames.ts +0 -25
- package/src/utils/colors.scss +0 -46
- package/src/utils/colors.ts +0 -38
- package/src/utils/describeVersion.ts +0 -21
- package/src/utils/environment.ts +0 -6
- package/src/utils/logLibVersions.ts +0 -103
- package/src/utils/open.ts +0 -46
- package/src/utils/packageJson.ts +0 -60
- package/src/utils/persistentStore.ts +0 -144
- package/src/utils/systemReport.ts +0 -160
- package/src/utils/truncateMiddle.test.ts +0 -21
- package/src/utils/truncateMiddle.ts +0 -20
- package/src/utils/usageData.ts +0 -189
- package/src/utils/useHotKey.ts +0 -62
- package/src/utils/useStopwatch.test.tsx +0 -311
- package/src/utils/useStopwatch.ts +0 -140
- package/src/variables.scss +0 -820
- package/styles.scss +0 -88
- package/test/dispatchTo.ts +0 -23
- package/test/index.ts +0 -7
- package/test/jestResolver.js +0 -28
- package/test/setupTests.ts +0 -27
- package/test/testUtil.ts +0 -20
- package/test/testrenderer.tsx +0 -39
- /package/{src/Logo/nordic-logo-white-icon-only.png → dist/nordic-logo-white-icon-only-XIZBW537.png} +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
@import '../variables';
|
|
8
|
-
|
|
9
|
-
.core19-nav-menu-item {
|
|
10
|
-
margin-left: 29px;
|
|
11
|
-
border: none;
|
|
12
|
-
background: none;
|
|
13
|
-
|
|
14
|
-
&.first {
|
|
15
|
-
margin-left: 20px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
padding: 0;
|
|
19
|
-
|
|
20
|
-
font-size: 14px;
|
|
21
|
-
font-weight: $font-weight-light;
|
|
22
|
-
color: $gray-700;
|
|
23
|
-
text-transform: uppercase;
|
|
24
|
-
|
|
25
|
-
&.selected {
|
|
26
|
-
font-weight: $font-weight-bold;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:focus,
|
|
30
|
-
&:hover {
|
|
31
|
-
text-decoration: none;
|
|
32
|
-
color: inherit;
|
|
33
|
-
}
|
|
34
|
-
}
|
package/src/OpenApp/openApp.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ipcRenderer } from 'electron';
|
|
8
|
-
|
|
9
|
-
import type { OpenAppOptions } from '../../main';
|
|
10
|
-
|
|
11
|
-
type AppSpec = { name: string; source: string };
|
|
12
|
-
|
|
13
|
-
export const openAppWindow = (
|
|
14
|
-
app: AppSpec,
|
|
15
|
-
openAppOptions?: OpenAppOptions
|
|
16
|
-
) => {
|
|
17
|
-
ipcRenderer.send('open:app', app, openAppOptions);
|
|
18
|
-
};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import Button from '../Button/Button';
|
|
10
|
-
import logger from '../logging';
|
|
11
|
-
import { isDevelopment } from '../utils/environment';
|
|
12
|
-
import packageJson from '../utils/packageJson';
|
|
13
|
-
|
|
14
|
-
export default () => {
|
|
15
|
-
const [feedback, setFeedback] = useState('');
|
|
16
|
-
const [sayThankYou, setSayThankYou] = useState(false);
|
|
17
|
-
|
|
18
|
-
if (sayThankYou === true) {
|
|
19
|
-
return (
|
|
20
|
-
<div className="w-100 d-flex justify-content-center">
|
|
21
|
-
<div className="d-flex flex-column justify-content-center align-items-start bg-white px-3 py-4">
|
|
22
|
-
<b className="mb-3">Thank you!</b>
|
|
23
|
-
<section>
|
|
24
|
-
<p>
|
|
25
|
-
We value your feedback and any ideas you may have
|
|
26
|
-
for improving our applications.
|
|
27
|
-
</p>
|
|
28
|
-
<p>
|
|
29
|
-
Click the button below in order to send more
|
|
30
|
-
feedback.
|
|
31
|
-
</p>
|
|
32
|
-
</section>
|
|
33
|
-
<Button
|
|
34
|
-
large
|
|
35
|
-
className="align-self-end"
|
|
36
|
-
onClick={() => {
|
|
37
|
-
setSayThankYou(false);
|
|
38
|
-
setFeedback('');
|
|
39
|
-
}}
|
|
40
|
-
variant="secondary"
|
|
41
|
-
>
|
|
42
|
-
Give more feedback
|
|
43
|
-
</Button>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div className="w-100 d-flex justify-content-center">
|
|
51
|
-
<div className="d-flex flex-column justify-content-center align-items-start bg-white px-3 py-4">
|
|
52
|
-
<b className="mb-3">Give Feedback</b>
|
|
53
|
-
<section>
|
|
54
|
-
<p>
|
|
55
|
-
We value your feedback and any ideas you may have for
|
|
56
|
-
improving our applications. Please use the form below to
|
|
57
|
-
give feedback.
|
|
58
|
-
</p>
|
|
59
|
-
<p>
|
|
60
|
-
Note: this is not a support channel, and you will not
|
|
61
|
-
receive a response. For help and support, visit the{' '}
|
|
62
|
-
<a
|
|
63
|
-
href="https://devzone.nordicsemi.com/"
|
|
64
|
-
target="_blank"
|
|
65
|
-
rel="noreferrer noopener"
|
|
66
|
-
>
|
|
67
|
-
Nordic DevZone
|
|
68
|
-
</a>
|
|
69
|
-
.
|
|
70
|
-
</p>
|
|
71
|
-
</section>
|
|
72
|
-
<form className="d-flex flex-column w-100">
|
|
73
|
-
<label htmlFor="feedback-text">
|
|
74
|
-
<b>What is your feedback?</b>
|
|
75
|
-
<textarea
|
|
76
|
-
name="feedback-text"
|
|
77
|
-
className="w-100 mb-3"
|
|
78
|
-
style={{ height: '8rem' }}
|
|
79
|
-
required
|
|
80
|
-
value={feedback}
|
|
81
|
-
onChange={e => setFeedback(e.target.value)}
|
|
82
|
-
/>
|
|
83
|
-
</label>
|
|
84
|
-
</form>
|
|
85
|
-
<section>
|
|
86
|
-
<p>
|
|
87
|
-
We only collect this information when you send feedback:
|
|
88
|
-
</p>
|
|
89
|
-
<ul>
|
|
90
|
-
<li>Application name</li>
|
|
91
|
-
<li>Your feedback</li>
|
|
92
|
-
<li>Operating system</li>
|
|
93
|
-
</ul>
|
|
94
|
-
</section>
|
|
95
|
-
<Button
|
|
96
|
-
large
|
|
97
|
-
className="align-self-end"
|
|
98
|
-
variant="primary"
|
|
99
|
-
onClick={() => handleFormData(feedback, setSayThankYou)}
|
|
100
|
-
disabled={feedback === ''}
|
|
101
|
-
>
|
|
102
|
-
Send Feedback
|
|
103
|
-
</Button>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const formURL =
|
|
110
|
-
isDevelopment === true
|
|
111
|
-
? 'https://formkeep.com/f/8deb409a565'
|
|
112
|
-
: 'https://formkeep.com/f/36b394b92851';
|
|
113
|
-
|
|
114
|
-
const handleFormData = async (
|
|
115
|
-
feedback: string,
|
|
116
|
-
setResponse: (response: boolean) => void
|
|
117
|
-
) => {
|
|
118
|
-
const data = {
|
|
119
|
-
name: getAppName(),
|
|
120
|
-
feedback,
|
|
121
|
-
platform: process.platform,
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
const response = await fetch(formURL, {
|
|
126
|
-
method: 'POST',
|
|
127
|
-
body: JSON.stringify(data),
|
|
128
|
-
headers: {
|
|
129
|
-
'Content-Type': 'application/json',
|
|
130
|
-
enctype: 'multipart/form-data',
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
if (response.ok) {
|
|
135
|
-
setResponse(true);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
logger.error(
|
|
140
|
-
`FeedbackForm: Server responded with status code ${response.status}`
|
|
141
|
-
);
|
|
142
|
-
} catch (error: unknown) {
|
|
143
|
-
logger.error(
|
|
144
|
-
`FeedbackForm: Could not send feedback. ${JSON.stringify(error)}`
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const getAppName = () => packageJson().name;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2015 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import './pseudo-button.scss';
|
|
10
|
-
|
|
11
|
-
const invokeIfSpaceOrEnterPressed =
|
|
12
|
-
(onClick: React.KeyboardEventHandler<Element>) =>
|
|
13
|
-
(event: React.KeyboardEvent) => {
|
|
14
|
-
event.stopPropagation();
|
|
15
|
-
if (event.key === ' ' || event.key === 'Enter') {
|
|
16
|
-
onClick(event);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const blurAndInvoke =
|
|
21
|
-
(
|
|
22
|
-
onClick: React.MouseEventHandler<HTMLElement>
|
|
23
|
-
): React.MouseEventHandler<HTMLElement> =>
|
|
24
|
-
(event: React.MouseEvent<HTMLElement>) => {
|
|
25
|
-
event.stopPropagation();
|
|
26
|
-
event.currentTarget.blur();
|
|
27
|
-
onClick(event);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Motivation for this class: A normal button in HTML must not contain divs or other buttons,
|
|
31
|
-
// but we do have things that behave like buttons and at the same time should contain such things
|
|
32
|
-
export default ({
|
|
33
|
-
onClick = () => {},
|
|
34
|
-
className = '',
|
|
35
|
-
children,
|
|
36
|
-
title,
|
|
37
|
-
testId,
|
|
38
|
-
}: {
|
|
39
|
-
onClick?: React.EventHandler<React.SyntheticEvent>;
|
|
40
|
-
className?: string;
|
|
41
|
-
children?: React.ReactNode;
|
|
42
|
-
title?: string;
|
|
43
|
-
testId?: string;
|
|
44
|
-
}) => (
|
|
45
|
-
<div
|
|
46
|
-
role="button"
|
|
47
|
-
className={`core19-pseudo-button ${className}`}
|
|
48
|
-
tabIndex={0}
|
|
49
|
-
onClick={blurAndInvoke(onClick)}
|
|
50
|
-
onKeyUp={invokeIfSpaceOrEnterPressed(onClick)}
|
|
51
|
-
title={title}
|
|
52
|
-
data-testid={testId}
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React, { useEffect, useState } from 'react';
|
|
8
|
-
import type { AutoDetectTypes } from '@serialport/bindings-cpp';
|
|
9
|
-
import { SerialPortOpenOptions } from 'serialport';
|
|
10
|
-
|
|
11
|
-
import { ConfirmationDialog } from '../Dialog/Dialog';
|
|
12
|
-
import logger from '../logging';
|
|
13
|
-
import {
|
|
14
|
-
createSerialPort,
|
|
15
|
-
getSerialPortOptions,
|
|
16
|
-
SerialPort,
|
|
17
|
-
} from './SerialPort';
|
|
18
|
-
|
|
19
|
-
const getCurrentOptions = async (
|
|
20
|
-
portPath: string,
|
|
21
|
-
setSettings: (options: SerialPortOpenOptions<AutoDetectTypes>) => void
|
|
22
|
-
) => {
|
|
23
|
-
try {
|
|
24
|
-
const options = await getSerialPortOptions(portPath);
|
|
25
|
-
if (options) {
|
|
26
|
-
setSettings(options);
|
|
27
|
-
}
|
|
28
|
-
} catch (err) {
|
|
29
|
-
console.error(err);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
interface ConflictingSettingsDialog {
|
|
34
|
-
isVisible: boolean;
|
|
35
|
-
onOverwrite: () => void;
|
|
36
|
-
onCancel: () => void;
|
|
37
|
-
localSettings: SerialPortOpenOptions<AutoDetectTypes>;
|
|
38
|
-
setSerialPortCallback: (serialPort: SerialPort) => void;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const ConflictingSettingsDialog = ({
|
|
42
|
-
isVisible,
|
|
43
|
-
onOverwrite,
|
|
44
|
-
onCancel,
|
|
45
|
-
localSettings,
|
|
46
|
-
setSerialPortCallback,
|
|
47
|
-
}: ConflictingSettingsDialog) => {
|
|
48
|
-
const [activeSettings, setSettings] =
|
|
49
|
-
useState<SerialPortOpenOptions<AutoDetectTypes>>();
|
|
50
|
-
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (!activeSettings) {
|
|
53
|
-
getCurrentOptions(localSettings.path, setSettings);
|
|
54
|
-
}
|
|
55
|
-
}, [isVisible, activeSettings, localSettings.path]);
|
|
56
|
-
|
|
57
|
-
const connectToSelectedSerialPort = async (
|
|
58
|
-
overwrite: boolean,
|
|
59
|
-
newSettings: SerialPortOpenOptions<AutoDetectTypes>
|
|
60
|
-
) => {
|
|
61
|
-
try {
|
|
62
|
-
const port = await createSerialPort(newSettings, {
|
|
63
|
-
overwrite,
|
|
64
|
-
settingsLocked: false,
|
|
65
|
-
});
|
|
66
|
-
setSerialPortCallback(port);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
const msg = (error as Error).message;
|
|
69
|
-
if (msg.includes('FAILED_DIFFERENT_SETTINGS')) {
|
|
70
|
-
onCancel();
|
|
71
|
-
} else {
|
|
72
|
-
console.error(
|
|
73
|
-
'Port could not be opened. Verify it is not used by some other applications'
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<ConfirmationDialog
|
|
81
|
-
title={`Conflicting Serial Settings for ${localSettings.path}`}
|
|
82
|
-
isVisible={isVisible}
|
|
83
|
-
size="lg"
|
|
84
|
-
onCancel={onCancel}
|
|
85
|
-
optionalLabel="Overwrite with Selected"
|
|
86
|
-
onOptional={onOverwrite}
|
|
87
|
-
confirmLabel="Continue with Active"
|
|
88
|
-
onConfirm={() => {
|
|
89
|
-
onCancel();
|
|
90
|
-
if (activeSettings) {
|
|
91
|
-
connectToSelectedSerialPort(true, activeSettings);
|
|
92
|
-
} else {
|
|
93
|
-
logger.error(
|
|
94
|
-
'Could not get the active serial port settings.'
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
<p>
|
|
100
|
-
You are about to connect to <code>{localSettings.path}</code>.
|
|
101
|
-
This port is already active with different serial settings -
|
|
102
|
-
most likely it is opened by another nRF Connect app running on
|
|
103
|
-
your computer.
|
|
104
|
-
</p>
|
|
105
|
-
<p>
|
|
106
|
-
You may continue with the active serial port settings or choose
|
|
107
|
-
to overwrite these with the settings you have selected. If you
|
|
108
|
-
choose to overwrite the active settings, the port will be closed
|
|
109
|
-
and reopened with the new settings. Alternatively, you can close
|
|
110
|
-
the port in the other app and try again.
|
|
111
|
-
</p>
|
|
112
|
-
<p>
|
|
113
|
-
The serial settings depend on the attached device and it's
|
|
114
|
-
embedded application, and normally the serial port settings for
|
|
115
|
-
all nRF Connect apps should be the same for a given serial port.
|
|
116
|
-
</p>
|
|
117
|
-
|
|
118
|
-
<DisplayConflictingSettings
|
|
119
|
-
activeSettings={activeSettings}
|
|
120
|
-
localSettings={localSettings}
|
|
121
|
-
/>
|
|
122
|
-
</ConfirmationDialog>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
type DisplayConflictingSettings = {
|
|
127
|
-
activeSettings?: SerialPortOpenOptions<AutoDetectTypes>;
|
|
128
|
-
localSettings: SerialPortOpenOptions<AutoDetectTypes>;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const DisplayConflictingSettings = ({
|
|
132
|
-
activeSettings,
|
|
133
|
-
localSettings,
|
|
134
|
-
}: DisplayConflictingSettings) => {
|
|
135
|
-
const allKeys = Object.keys(localSettings);
|
|
136
|
-
if (activeSettings) {
|
|
137
|
-
Object.keys(activeSettings).forEach(key => {
|
|
138
|
-
if (!allKeys.includes(key)) {
|
|
139
|
-
allKeys.push(key);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const conflictingSettings = activeSettings
|
|
145
|
-
? allKeys.filter(
|
|
146
|
-
key =>
|
|
147
|
-
activeSettings[key as keyof typeof activeSettings] !==
|
|
148
|
-
localSettings[key as keyof typeof localSettings]
|
|
149
|
-
)
|
|
150
|
-
: [];
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<div
|
|
154
|
-
style={{
|
|
155
|
-
width: '100%',
|
|
156
|
-
display: 'flex',
|
|
157
|
-
justifyContent: 'flex-start',
|
|
158
|
-
margin: '32px 0',
|
|
159
|
-
}}
|
|
160
|
-
>
|
|
161
|
-
<div style={{ marginRight: '128px' }}>
|
|
162
|
-
<b>Active settings</b>
|
|
163
|
-
{activeSettings ? (
|
|
164
|
-
<ul style={listStyle}>
|
|
165
|
-
{allKeys.map(key => (
|
|
166
|
-
<li
|
|
167
|
-
key={key}
|
|
168
|
-
style={{
|
|
169
|
-
...listItemStyle,
|
|
170
|
-
backgroundColor:
|
|
171
|
-
conflictingSettings.includes(key)
|
|
172
|
-
? '#FFCDD2'
|
|
173
|
-
: undefined,
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
{key}:
|
|
177
|
-
{prettifyValue(
|
|
178
|
-
activeSettings[
|
|
179
|
-
key as keyof typeof activeSettings
|
|
180
|
-
]
|
|
181
|
-
)}
|
|
182
|
-
</li>
|
|
183
|
-
))}
|
|
184
|
-
</ul>
|
|
185
|
-
) : (
|
|
186
|
-
<p>Could not retrieve the current settings</p>
|
|
187
|
-
)}
|
|
188
|
-
</div>
|
|
189
|
-
<div>
|
|
190
|
-
<b>Selected settings</b>
|
|
191
|
-
<ul style={listStyle}>
|
|
192
|
-
{allKeys.map(key => (
|
|
193
|
-
<li
|
|
194
|
-
key={key}
|
|
195
|
-
style={{
|
|
196
|
-
...listItemStyle,
|
|
197
|
-
backgroundColor: conflictingSettings.includes(
|
|
198
|
-
key
|
|
199
|
-
)
|
|
200
|
-
? '#FFCDD2'
|
|
201
|
-
: undefined,
|
|
202
|
-
}}
|
|
203
|
-
>
|
|
204
|
-
{key}:
|
|
205
|
-
{prettifyValue(
|
|
206
|
-
localSettings[key as keyof typeof localSettings]
|
|
207
|
-
)}
|
|
208
|
-
</li>
|
|
209
|
-
))}
|
|
210
|
-
</ul>
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
const prettifyValue = (value: unknown) => {
|
|
217
|
-
if (typeof value === 'boolean') {
|
|
218
|
-
return value ? 'on' : 'off';
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
222
|
-
return value;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (value == null) {
|
|
226
|
-
return 'N/A';
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return JSON.stringify(value);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export default ConflictingSettingsDialog;
|
|
233
|
-
|
|
234
|
-
const listStyle: React.CSSProperties = {
|
|
235
|
-
listStyleType: 'none',
|
|
236
|
-
margin: 0,
|
|
237
|
-
padding: 0,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const listItemStyle: React.CSSProperties = {
|
|
241
|
-
padding: '4px 0',
|
|
242
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Nordic Semiconductor ASA
|
|
3
|
-
*
|
|
4
|
-
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ipcRenderer } from 'electron';
|
|
8
|
-
|
|
9
|
-
import { OverwriteOptions, SERIALPORT_CHANNEL } from '../../main';
|
|
10
|
-
import { createSerialPort } from './SerialPort';
|
|
11
|
-
|
|
12
|
-
jest.mock('electron', () => ({
|
|
13
|
-
ipcRenderer: { invoke: jest.fn(), on: jest.fn(), send: jest.fn() },
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
const defaultOptions = { path: '/dev/ROBOT', baudRate: 115200 };
|
|
17
|
-
|
|
18
|
-
test('SerialPort is initialized with the correct setup', async () => {
|
|
19
|
-
const port = await createSerialPort(defaultOptions);
|
|
20
|
-
|
|
21
|
-
expect(ipcRenderer.invoke).toHaveBeenCalledWith(
|
|
22
|
-
SERIALPORT_CHANNEL.OPEN,
|
|
23
|
-
defaultOptions,
|
|
24
|
-
{ overwrite: false, settingsLocked: false }
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
expect(port.path).toBe(defaultOptions.path);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('SerialPort may be initialized with overwrite and settingsLocked', async () => {
|
|
31
|
-
let overwriteOptions: OverwriteOptions = { overwrite: true };
|
|
32
|
-
await createSerialPort(defaultOptions, overwriteOptions);
|
|
33
|
-
expect(ipcRenderer.invoke).toHaveBeenCalledWith(
|
|
34
|
-
SERIALPORT_CHANNEL.OPEN,
|
|
35
|
-
defaultOptions,
|
|
36
|
-
overwriteOptions
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
overwriteOptions = { settingsLocked: true };
|
|
40
|
-
await createSerialPort(defaultOptions, overwriteOptions);
|
|
41
|
-
expect(ipcRenderer.invoke).toHaveBeenCalledWith(
|
|
42
|
-
SERIALPORT_CHANNEL.OPEN,
|
|
43
|
-
defaultOptions,
|
|
44
|
-
overwriteOptions
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
overwriteOptions = { settingsLocked: true, overwrite: true };
|
|
48
|
-
await createSerialPort(defaultOptions, overwriteOptions);
|
|
49
|
-
expect(ipcRenderer.invoke).toHaveBeenCalledWith(
|
|
50
|
-
SERIALPORT_CHANNEL.OPEN,
|
|
51
|
-
defaultOptions,
|
|
52
|
-
overwriteOptions
|
|
53
|
-
);
|
|
54
|
-
});
|