@nordicsemiconductor/pc-nrfconnect-shared 185.0.0 → 186.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,17 @@ 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
+ ## 186.0.0 - 2024-10-03
11
+
12
+ ### Changed
13
+
14
+ - DeviceSelector Abort controler now aborts on the onDisconnected event
15
+
16
+ ### Fixed
17
+
18
+ - Auto connecting from CLI when multple devices are connected now works as
19
+ expected.
20
+
10
21
  ## 185.0.0 - 2024-09-20
11
22
 
12
23
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "185.0.0",
3
+ "version": "186.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -72,8 +72,11 @@ export default ({
72
72
  const waitingToAutoReconnect = useSelector(getWaitingToAutoReselect);
73
73
  const showSelectedDevice = deviceIsSelected || waitingToAutoReconnect;
74
74
 
75
+ const abortController = useRef<AbortController>();
76
+
75
77
  const doDeselectDevice = useCallback(
76
78
  (device?: Device) => {
79
+ abortController.current?.abort();
77
80
  if (device) {
78
81
  telemetry.sendEvent(
79
82
  'device deselected ',
@@ -83,21 +86,21 @@ export default ({
83
86
 
84
87
  dispatch(clearWaitForDevice());
85
88
  dispatch(setAutoSelectDevice(undefined));
86
- logger.info(`Device deselected`);
89
+ logger.info(`Deselected device`);
87
90
  onDeviceDeselected();
88
91
  dispatch(deselectDevice());
89
92
  },
90
93
  [dispatch, onDeviceDeselected]
91
94
  );
92
95
 
93
- const abortController = useRef<AbortController>();
94
-
95
96
  // Ensure that useCallback is
96
97
  // not updated frequently as this
97
98
  // will have a side effect to stop and start the hotplug events
98
99
  const doSelectDevice = useCallback(
99
100
  async (device: Device, autoReselected: boolean) => {
100
- logger.info(`Selecting device SN: ${device.serialNumber}`);
101
+ logger.info(
102
+ `Selecting device with the serial number ${device.serialNumber}`
103
+ );
101
104
  abortController.current?.abort();
102
105
  const controller = new AbortController();
103
106
  abortController.current = controller;
@@ -126,7 +129,9 @@ export default ({
126
129
 
127
130
  if (!controller.signal.aborted) {
128
131
  dispatch(setSelectedDeviceInfo(deviceInfo));
129
- logger.info(`Selected device SN: ${device.serialNumber}`);
132
+ logger.info(
133
+ `Selected device with the serial number ${device.serialNumber}`
134
+ );
130
135
  onDeviceSelected(device, autoReselected, controller);
131
136
 
132
137
  telemetry.sendEvent('device selected', {
@@ -405,7 +405,7 @@ export const startWatchingDevices =
405
405
  deviceListing,
406
406
  d => {
407
407
  d.forEach(onDeviceArrived);
408
- dispatch(autoSelectDeviceCLI(doSelectDevice));
408
+ autoSelectDeviceCLI(d, doSelectDevice);
409
409
  },
410
410
  error => {
411
411
  logger.error(error);
@@ -459,21 +459,18 @@ const getAutoSelectDevice = (devices: Device[]) => {
459
459
  }
460
460
  };
461
461
 
462
- const autoSelectDeviceCLI =
463
- (
464
- doSelectDevice: (device: Device, autoReselected: boolean) => void
465
- ): AppThunk<RootState> =>
466
- (_, getState) => {
467
- if (!autoSelectDeviceCLISerialUsed) {
468
- const autoSelectDevice = getAutoSelectDevice(
469
- getState().device.devices
470
- );
462
+ const autoSelectDeviceCLI = (
463
+ devices: Device[],
464
+ doSelectDevice: (device: Device, autoReselected: boolean) => void
465
+ ) => {
466
+ if (!autoSelectDeviceCLISerialUsed) {
467
+ const autoSelectDevice = getAutoSelectDevice(devices);
471
468
 
472
- if (autoSelectDevice) doSelectDevice(autoSelectDevice, true);
469
+ if (autoSelectDevice) doSelectDevice(autoSelectDevice, true);
473
470
 
474
- autoSelectDeviceCLISerialUsed = true;
475
- }
476
- };
471
+ autoSelectDeviceCLISerialUsed = true;
472
+ }
473
+ };
477
474
 
478
475
  export const stopWatchingDevices = (callback?: () => void) => {
479
476
  if (stopNrfutilDevice) stopNrfutilDevice(callback);
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceSelector.d.ts","sourceRoot":"","sources":["../../../../../src/Device/DeviceSelector/DeviceSelector.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAe9D,OAAO,EAAE,iBAAiB,EAAe,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAEH,MAAM,EAMT,MAAM,gBAAgB,CAAC;AAKxB,MAAM,WAAW,KAAK;IAClB,aAAa,EAAE,YAAY,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,gBAAgB,CAAC,EAAE,CACf,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,eAAe,KAC/B,IAAI,CAAC;IACV,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C;8KAYE,KAAK;AATR,wBA+KE"}
1
+ {"version":3,"file":"DeviceSelector.d.ts","sourceRoot":"","sources":["../../../../../src/Device/DeviceSelector/DeviceSelector.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAe9D,OAAO,EAAE,iBAAiB,EAAe,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAEH,MAAM,EAMT,MAAM,gBAAgB,CAAC;AAKxB,MAAM,WAAW,KAAK;IAClB,aAAa,EAAE,YAAY,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,gBAAgB,CAAC,EAAE,CACf,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,eAAe,KAC/B,IAAI,CAAC;IACV,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C;8KAYE,KAAK;AATR,wBAoLE"}
@@ -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;AAcpD,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;AAkCN,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,CA2P1B,CAAC;AAwDN,eAAO,MAAM,mBAAmB,cAAe,MAAM,IAAI,SAGxD,CAAC"}
1
+ {"version":3,"file":"deviceLister.d.ts","sourceRoot":"","sources":["../../../../src/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