@nordicsemiconductor/pc-nrfconnect-shared 186.0.0 → 187.0.0
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/Changelog.md
CHANGED
|
@@ -7,6 +7,12 @@ This project does _not_ adhere to
|
|
|
7
7
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
|
|
8
8
|
every new version is a new major version.
|
|
9
9
|
|
|
10
|
+
## 187.0.0 - 2024-10-04
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Auto connecting from CLI for device that has persisted data.
|
|
15
|
+
|
|
10
16
|
## 186.0.0 - 2024-10-03
|
|
11
17
|
|
|
12
18
|
### Changed
|
package/package.json
CHANGED
|
@@ -11,6 +11,11 @@ import logger from '../logging';
|
|
|
11
11
|
import type { AppThunk, RootState } from '../store';
|
|
12
12
|
import simplifyDevice from '../telemetry/simplifyDevice';
|
|
13
13
|
import telemetry from '../telemetry/telemetry';
|
|
14
|
+
import {
|
|
15
|
+
getPersistedIsFavorite,
|
|
16
|
+
getPersistedNickname,
|
|
17
|
+
getPersistedSerialPortSettings,
|
|
18
|
+
} from '../utils/persistentStore';
|
|
14
19
|
import {
|
|
15
20
|
clearWaitForDevice,
|
|
16
21
|
clearWaitForDeviceTimeout,
|
|
@@ -161,6 +166,36 @@ const removeDeviceFromList =
|
|
|
161
166
|
* library for available traits. Whenever devices are attached/detached, this
|
|
162
167
|
* will dispatch AddDevice or removeDevice and trigger events.
|
|
163
168
|
*/
|
|
169
|
+
|
|
170
|
+
const setPersistedData = (device: Device) => {
|
|
171
|
+
if (device.serialNumber) {
|
|
172
|
+
const newDevice = { ...device };
|
|
173
|
+
newDevice.favorite = getPersistedIsFavorite(device.serialNumber);
|
|
174
|
+
newDevice.nickname = getPersistedNickname(device.serialNumber);
|
|
175
|
+
|
|
176
|
+
const persistedSerialPortSettings = getPersistedSerialPortSettings(
|
|
177
|
+
device.serialNumber
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
if (persistedSerialPortSettings) {
|
|
181
|
+
const path =
|
|
182
|
+
newDevice.serialPorts?.[persistedSerialPortSettings.vComIndex]
|
|
183
|
+
?.comName;
|
|
184
|
+
|
|
185
|
+
if (path) {
|
|
186
|
+
newDevice.persistedSerialPortOptions = {
|
|
187
|
+
...persistedSerialPortSettings.serialPortOptions,
|
|
188
|
+
path,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return newDevice;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return device;
|
|
197
|
+
};
|
|
198
|
+
|
|
164
199
|
export const startWatchingDevices =
|
|
165
200
|
(
|
|
166
201
|
deviceListing: DeviceTraits,
|
|
@@ -404,13 +439,20 @@ export const startWatchingDevices =
|
|
|
404
439
|
const operation = await NrfutilDeviceLib.list(
|
|
405
440
|
deviceListing,
|
|
406
441
|
d => {
|
|
442
|
+
d = d.map(setPersistedData);
|
|
407
443
|
d.forEach(onDeviceArrived);
|
|
408
444
|
autoSelectDeviceCLI(d, doSelectDevice);
|
|
409
445
|
},
|
|
410
446
|
error => {
|
|
411
447
|
logger.error(error);
|
|
412
448
|
},
|
|
413
|
-
{
|
|
449
|
+
{
|
|
450
|
+
onDeviceArrived: d => {
|
|
451
|
+
d = setPersistedData(d);
|
|
452
|
+
onDeviceArrived(d);
|
|
453
|
+
},
|
|
454
|
+
onDeviceLeft,
|
|
455
|
+
}
|
|
414
456
|
);
|
|
415
457
|
|
|
416
458
|
stopNrfutilDevice = (callback?: () => void) => {
|
|
@@ -12,9 +12,6 @@ import { DeviceInfo } from '../../nrfutil/device';
|
|
|
12
12
|
import { NrfutilDevice } from '../../nrfutil/device/common';
|
|
13
13
|
import type { RootState } from '../store';
|
|
14
14
|
import {
|
|
15
|
-
getPersistedIsFavorite,
|
|
16
|
-
getPersistedNickname,
|
|
17
|
-
getPersistedSerialPortSettings,
|
|
18
15
|
persistIsFavorite,
|
|
19
16
|
persistNickname,
|
|
20
17
|
persistSerialPortSettings as persistSerialPortSettingsToStore,
|
|
@@ -69,35 +66,6 @@ const initialState: DeviceState = {
|
|
|
69
66
|
devices: [],
|
|
70
67
|
};
|
|
71
68
|
|
|
72
|
-
const setPersistedData = (device: Device) => {
|
|
73
|
-
if (device.serialNumber) {
|
|
74
|
-
const newDevice = { ...device };
|
|
75
|
-
newDevice.favorite = getPersistedIsFavorite(device.serialNumber);
|
|
76
|
-
newDevice.nickname = getPersistedNickname(device.serialNumber);
|
|
77
|
-
|
|
78
|
-
const persistedSerialPortSettings = getPersistedSerialPortSettings(
|
|
79
|
-
device.serialNumber
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
if (persistedSerialPortSettings) {
|
|
83
|
-
const path =
|
|
84
|
-
newDevice.serialPorts?.[persistedSerialPortSettings.vComIndex]
|
|
85
|
-
?.comName;
|
|
86
|
-
|
|
87
|
-
if (path) {
|
|
88
|
-
newDevice.persistedSerialPortOptions = {
|
|
89
|
-
...persistedSerialPortSettings.serialPortOptions,
|
|
90
|
-
path,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return newDevice;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return device;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
69
|
const slice = createSlice({
|
|
102
70
|
name: 'device',
|
|
103
71
|
initialState,
|
|
@@ -130,12 +98,10 @@ const slice = createSlice({
|
|
|
130
98
|
item.serialNumber === action.payload.serialNumber ||
|
|
131
99
|
item.id === action.payload.id
|
|
132
100
|
);
|
|
133
|
-
|
|
134
|
-
const device = setPersistedData(action.payload);
|
|
135
101
|
if (index !== -1) {
|
|
136
|
-
state.devices[index] =
|
|
102
|
+
state.devices[index] = action.payload;
|
|
137
103
|
} else {
|
|
138
|
-
state.devices.push(
|
|
104
|
+
state.devices.push(action.payload);
|
|
139
105
|
}
|
|
140
106
|
},
|
|
141
107
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceLister.d.ts","sourceRoot":"","sources":["../../../../src/Device/deviceLister.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAiB,MAAM,6BAA6B,CAAC;AAG1E,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"deviceLister.d.ts","sourceRoot":"","sources":["../../../../src/Device/deviceLister.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAiB,MAAM,6BAA6B,CAAC;AAG1E,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAmBpD,OAAO,EAEH,MAAM,EAIT,MAAM,eAAe,CAAC;AAsDvB,eAAO,MAAM,QAAQ,WAAY,MAAM,eAAe,UAAU,YAI3D,CAAC;AA8BN,eAAO,MAAM,oBAAoB,iBACf,YAAY,kBACV,YAAY,YAS3B,CAAC;AAgEN,eAAO,MAAM,oBAAoB,kBAEV,YAAY,8BACC,MAAM,KAAK,IAAI,iCACZ,MAAM,KAAK,IAAI,sBAC1B,MAAM,IAAI,2BACL,MAAM,kBAAkB,OAAO,KAAK,IAAI,KAClE,SAAS,SAAS,EAAE,IAAI,CAkQ1B,CAAC;AAqDN,eAAO,MAAM,mBAAmB,cAAe,MAAM,IAAI,SAGxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceSlice.d.ts","sourceRoot":"","sources":["../../../../src/Device/deviceSlice.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,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