@nordicsemiconductor/pc-nrfconnect-shared 141.0.0 → 143.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,24 @@ 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
+ ## 143.0.0 - 2023-12-14
11
+
12
+ ### Changed
13
+
14
+ - Run eslint or prettier on all Markdown (.md) files except the ones in
15
+ `doc/docs` folder.
16
+
17
+ ### Fixed
18
+
19
+ - `NRF9160` and `NRF9161` now show modem trait as true when using external
20
+ jLink
21
+
22
+ ## 142.0.0 - 2023-12-13
23
+
24
+ ### Fixed
25
+
26
+ - `UsageData` sends common app metadata
27
+
10
28
  ## 141.0.0 - 2023-12-12
11
29
 
12
30
  ### Added
@@ -23,7 +23,7 @@ module.exports = {
23
23
  'prettier',
24
24
  ],
25
25
  ignorePatterns: [
26
- 'docs/',
26
+ 'doc/docs/',
27
27
  'package-lock.json',
28
28
  'scripts/nordic-publish.js',
29
29
  'typings/generated',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "141.0.0",
3
+ "version": "143.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import React from 'react';
8
- import { fireEvent, screen, waitFor } from '@testing-library/react';
8
+ import { act, fireEvent, screen, waitFor } from '@testing-library/react';
9
9
 
10
10
  import render from '../../../test/testrenderer';
11
11
  import { addDevice, Device, removeDevice } from '../deviceSlice';
@@ -168,7 +168,7 @@ describe('DeviceSelector', () => {
168
168
  expect(screen.getAllByText(/COM/)).toHaveLength(2);
169
169
  });
170
170
 
171
- it('can select connected devices', () => {
171
+ it('can select connected devices', async () => {
172
172
  render(
173
173
  <DeviceSelector
174
174
  deviceListing={{
@@ -182,7 +182,11 @@ describe('DeviceSelector', () => {
182
182
  );
183
183
 
184
184
  fireEvent.click(screen.getByText('Select device'));
185
- fireEvent.click(screen.getByText(DEVICE_SERIAL_NUMBER));
185
+ // eslint-disable-next-line testing-library/no-unnecessary-act
186
+ await act(async () => {
187
+ await fireEvent.click(screen.getByText(DEVICE_SERIAL_NUMBER));
188
+ });
189
+
186
190
  expect(screen.getAllByText(DEVICE_SERIAL_NUMBER)).toHaveLength(2);
187
191
  });
188
192
 
@@ -206,7 +210,7 @@ describe('DeviceSelector', () => {
206
210
  expect(screen.getByText('Select device')).toBeInTheDocument();
207
211
  });
208
212
 
209
- it('should allow device selection when custom devices are enabled and no valid firmware is defined', () => {
213
+ it('should allow device selection when custom devices are enabled and no valid firmware is defined', async () => {
210
214
  render(
211
215
  <DeviceSelector
212
216
  deviceListing={{
@@ -232,7 +236,11 @@ describe('DeviceSelector', () => {
232
236
  [addDevice(testDevice)]
233
237
  );
234
238
  fireEvent.click(screen.getByText('Select device'));
235
- fireEvent.click(screen.getByText(DEVICE_SERIAL_NUMBER));
239
+
240
+ // eslint-disable-next-line testing-library/no-unnecessary-act
241
+ await act(async () => {
242
+ await fireEvent.click(screen.getByText(DEVICE_SERIAL_NUMBER));
243
+ });
236
244
 
237
245
  expect(screen.queryByText('OK')).toBeNull();
238
246
  expect(screen.getAllByText(DEVICE_SERIAL_NUMBER)).toHaveLength(2);
@@ -18,7 +18,11 @@ import {
18
18
  getWaitingToAutoReselect,
19
19
  setAutoSelectDevice,
20
20
  } from '../deviceAutoSelectSlice';
21
- import { startWatchingDevices, stopWatchingDevices } from '../deviceLister';
21
+ import {
22
+ hasModem,
23
+ startWatchingDevices,
24
+ stopWatchingDevices,
25
+ } from '../deviceLister';
22
26
  import { DeviceSetupConfig, setupDevice } from '../deviceSetup';
23
27
  import DeviceSetupView from '../DeviceSetup/DeviceSetupView';
24
28
  import {
@@ -102,6 +106,17 @@ export default ({
102
106
  abortController.current
103
107
  );
104
108
  abortController.current = undefined;
109
+
110
+ // Modem might be set to false when using external jLink or custom PCBs
111
+ if (!device.traits.modem && hasModem(device, deviceInfo)) {
112
+ const newDevice = {
113
+ ...device,
114
+ traits: { ...device.traits, modem: true },
115
+ };
116
+ dispatch(selectDevice(newDevice));
117
+ dispatch(setAutoSelectDevice(newDevice));
118
+ }
119
+
105
120
  dispatch(setSelectedDeviceInfo(deviceInfo));
106
121
  onDeviceSelected(device, autoReselected);
107
122
 
@@ -4,6 +4,7 @@
4
4
  * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
5
  */
6
6
 
7
+ import { DeviceInfo } from '../../nrfutil';
7
8
  import { DeviceTraits, NrfutilDevice } from '../../nrfutil/device/common';
8
9
  import NrfutilDeviceLib from '../../nrfutil/device/device';
9
10
  import logger from '../logging';
@@ -81,6 +82,13 @@ const shouldAutoReselect = (
81
82
  return globalAutoReselect;
82
83
  };
83
84
 
85
+ export const hasModem = (device: Device, deviceInfo?: DeviceInfo) =>
86
+ !!(
87
+ device.traits.modem ||
88
+ deviceInfo?.jlink?.deviceVersion?.toUpperCase().includes('NRF9160') ||
89
+ deviceInfo?.jlink?.deviceVersion?.toUpperCase().includes('NRF9161')
90
+ );
91
+
84
92
  const initAutoReconnectTimeout =
85
93
  (onTimeout: () => void, waitForDevice: WaitForDevice): AppThunk =>
86
94
  dispatch => {
@@ -298,6 +306,23 @@ export const startWatchingDevices =
298
306
  device
299
307
  );
300
308
  dispatch(setSelectedDeviceInfo(deviceInfo));
309
+
310
+ // Modem might be set to false when using external jLink or custom PCBs
311
+ if (
312
+ !deviceWithPersistedData.traits.modem &&
313
+ hasModem(
314
+ deviceWithPersistedData,
315
+ deviceInfo
316
+ )
317
+ ) {
318
+ deviceWithPersistedData.traits.modem =
319
+ true;
320
+ dispatch(
321
+ selectDevice(
322
+ deviceWithPersistedData
323
+ )
324
+ );
325
+ }
301
326
  }
302
327
 
303
328
  if (waitForDevice.onSuccess)
@@ -52,12 +52,14 @@ const init = () => {
52
52
  envelope.data.baseData = { name: envelope.data?.baseData.name };
53
53
  } else {
54
54
  envelope.tags['ai.cloud.roleInstance'] = undefined; // remove PC name
55
- envelope.data.baseData = {
56
- applicationName,
57
- applicationVersion,
58
- isDevelopment,
59
- ...envelope.data.baseData,
60
- };
55
+ if (envelope.data.baseData) {
56
+ envelope.data.baseData.properties = {
57
+ applicationName,
58
+ applicationVersion,
59
+ isDevelopment,
60
+ ...envelope.data.baseData.properties,
61
+ };
62
+ }
61
63
  }
62
64
 
63
65
  return true;
@@ -66,12 +66,12 @@ const init = async () => {
66
66
  name: applicationName,
67
67
  };
68
68
  envelope.ext = { ...envelope.ext, trace };
69
- envelope.baseData = {
69
+ envelope.data = {
70
+ ...envelope.data,
70
71
  applicationName,
71
72
  applicationVersion,
72
73
  isDevelopment,
73
74
  source,
74
- ...envelope.baseData,
75
75
  };
76
76
  }
77
77
  });
@@ -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;AAW9D,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,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACrE,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,wBA8JE"}
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,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACrE,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,wBAyKE"}
@@ -1,6 +1,8 @@
1
+ import { DeviceInfo } from '../../nrfutil';
1
2
  import { DeviceTraits } from '../../nrfutil/device/common';
2
3
  import type { AppThunk, RootState } from '../store';
3
4
  import { Device } from './deviceSlice';
5
+ export declare const hasModem: (device: Device, deviceInfo?: DeviceInfo) => boolean;
4
6
  export declare const hasValidDeviceTraits: (deviceTraits: DeviceTraits, requiredTraits: DeviceTraits) => boolean;
5
7
  export declare const startWatchingDevices: (deviceListing: DeviceTraits, onDeviceConnected: (device: Device) => void, onDeviceDisconnected: (device: Device) => void, onDeviceDeselected: () => void, doSelectDevice: (device: Device, autoReselected: boolean) => void) => AppThunk<RootState, void>;
6
8
  export declare const stopWatchingDevices: (callback?: () => void) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"deviceLister.d.ts","sourceRoot":"","sources":["../../../../src/Device/deviceLister.ts"],"names":[],"mappings":"AAMA,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;AAkFvB,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,CAyO1B,CAAC;AAwDN,eAAO,MAAM,mBAAmB,cAAe,MAAM,IAAI,SAGxD,CAAC"}
1
+ {"version":3,"file":"deviceLister.d.ts","sourceRoot":"","sources":["../../../../src/Device/deviceLister.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,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,YAK3D,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,CA0P1B,CAAC;AAwDN,eAAO,MAAM,mBAAmB,cAAe,MAAM,IAAI,SAGxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"usageDataMain.d.ts","sourceRoot":"","sources":["../../../../src/utils/usageDataMain.ts"],"names":[],"mappings":"AAUA,OAAwB,EAEpB,QAAQ,EACX,MAAM,mBAAmB,CAAC;;;;;;;;AAiG3B,wBAME"}
1
+ {"version":3,"file":"usageDataMain.d.ts","sourceRoot":"","sources":["../../../../src/utils/usageDataMain.ts"],"names":[],"mappings":"AAUA,OAAwB,EAEpB,QAAQ,EACX,MAAM,mBAAmB,CAAC;;;;;;;;AAmG3B,wBAME"}