@nordicsemiconductor/pc-nrfconnect-shared 137.0.0 → 139.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,26 @@ 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
+ ## 139.0.0 - 2023-12-05
11
+
12
+ ### Added
13
+
14
+ - Added command wrappers to interact with the Board Controller using
15
+ `nrfutil-device`. `boardController()` to write board controller config to
16
+ the DK. `getBoardControllerVersion()` to get the version information from
17
+ the Board Controller. (like firmware version and board hardware revision)
18
+
19
+ ### Fixed
20
+
21
+ - App freezes when telemetry events are not yet sent.
22
+
23
+ ## 138.0.0 - 2023-12-04
24
+
25
+ ### Fixed
26
+
27
+ - `nrfutil sandbox` `execCommand` did not escape executable path leading to
28
+ failure when path has whitespace
29
+
10
30
  ## 137.0.0 - 2023-12-04
11
31
 
12
32
  ### Added
@@ -89,6 +89,51 @@ export class Batch {
89
89
  return this;
90
90
  }
91
91
 
92
+ public boardController(data: object, callbacks?: Callbacks) {
93
+ // "operation: 2, command_id: 0" is the command to set the configuration for the board controller.
94
+ this.operationBatchGeneration.push(
95
+ new Promise<BatchOperationWrapperUnknown>(resolve => {
96
+ resolve({
97
+ operation: {
98
+ operation: {
99
+ type: 'smp',
100
+ operation: 2,
101
+ group_id: 64,
102
+ command_id: 0,
103
+ sequence_number: 0,
104
+ data,
105
+ },
106
+ },
107
+ ...callbacks,
108
+ } as BatchOperationWrapperUnknown);
109
+ })
110
+ );
111
+
112
+ return this;
113
+ }
114
+
115
+ public getBoardControllerVersion(callbacks?: Callbacks) {
116
+ // "operation: 0, command_id: 1" is the command to retrieve version information from the board controller.
117
+ this.operationBatchGeneration.push(
118
+ new Promise<BatchOperationWrapperUnknown>(resolve => {
119
+ resolve({
120
+ operation: {
121
+ operation: {
122
+ type: 'smp',
123
+ operation: 0,
124
+ group_id: 64,
125
+ command_id: 1,
126
+ sequence_number: 0,
127
+ },
128
+ },
129
+ ...callbacks,
130
+ } as BatchOperationWrapperUnknown);
131
+ })
132
+ );
133
+
134
+ return this;
135
+ }
136
+
92
137
  public firmwareRead(core: DeviceCore, callbacks?: Callbacks<Buffer>) {
93
138
  this.enqueueBatchOperationObject('fw-read', core, {
94
139
  ...callbacks,
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright (c) 2023 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import { Progress } from '../sandboxTypes';
8
+ import { deviceSingleTaskEndOperationVoid, NrfutilDevice } from './common';
9
+
10
+ export default (
11
+ device: NrfutilDevice,
12
+ data: object,
13
+ onProgress?: (progress: Progress) => void,
14
+ controller?: AbortController
15
+ ) => {
16
+ // "operation: 2, command_id: 0" is the command to set the configuration for the board controller.
17
+ const json = {
18
+ operations: [
19
+ {
20
+ operation: {
21
+ type: 'smp',
22
+ operation: 2,
23
+ group_id: 64,
24
+ command_id: 0,
25
+ sequence_number: 0,
26
+ data,
27
+ },
28
+ operationId: '1',
29
+ },
30
+ ],
31
+ };
32
+
33
+ return deviceSingleTaskEndOperationVoid(
34
+ device,
35
+ 'x-execute-batch',
36
+ onProgress,
37
+ controller,
38
+ ['--batch-json', JSON.stringify(json)]
39
+ );
40
+ };
@@ -6,10 +6,12 @@
6
6
 
7
7
  import { LogLevel, LogMessage } from '../sandboxTypes';
8
8
  import { Batch } from './batch';
9
+ import boardController from './boardController';
9
10
  import { getDeviceSandbox } from './common';
10
11
  import deviceInfo from './deviceInfo';
11
12
  import erase from './erase';
12
13
  import firmwareRead from './firmwareRead';
14
+ import getBoardControllerVersion from './getBoardControllerVersion';
13
15
  import getCoreInfo from './getCoreInfo';
14
16
  import getFwInfo from './getFwInfo';
15
17
  import getProtectionStatus from './getProtectionStatus';
@@ -59,5 +61,7 @@ export default {
59
61
  setLogLevel,
60
62
  setVerboseLogging,
61
63
  getModuleVersion,
64
+ boardController,
65
+ getBoardControllerVersion,
62
66
  batch: () => new Batch(),
63
67
  };
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright (c) 2023 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import { Progress } from '../sandboxTypes';
8
+ import { deviceSingleTaskEndOperation, NrfutilDevice } from './common';
9
+
10
+ export interface BoardControllerVersionResponse {
11
+ data: BoardControllerVersion;
12
+ }
13
+
14
+ export interface BoardControllerVersion {
15
+ bc_fw_ver: string;
16
+ device_id: string;
17
+ major_ver: number;
18
+ minor_ver: number;
19
+ patch_ver: number;
20
+ pca_num: number;
21
+ }
22
+
23
+ export default (
24
+ device: NrfutilDevice,
25
+ onProgress?: (progress: Progress) => void,
26
+ controller?: AbortController
27
+ ) => {
28
+ // "operation: 0, command_id: 1" is the command to retrieve version information from the board controller.
29
+ const json = {
30
+ operations: [
31
+ {
32
+ operation: {
33
+ type: 'smp',
34
+ operation: 0,
35
+ group_id: 64,
36
+ command_id: 1,
37
+ sequence_number: 0,
38
+ },
39
+ operationId: '1',
40
+ },
41
+ ],
42
+ };
43
+
44
+ return deviceSingleTaskEndOperation<BoardControllerVersionResponse>(
45
+ device,
46
+ 'x-execute-batch',
47
+ onProgress,
48
+ controller,
49
+ ['--batch-json', JSON.stringify(json)]
50
+ ).then(res => res.data);
51
+ };
@@ -517,7 +517,7 @@ export class NrfutilSandbox {
517
517
  exec: command,
518
518
  });
519
519
 
520
- const nrfutil = exec(`${command} ${args.join(' ')}`, {
520
+ const nrfutil = exec(`"${command}" ${args.join(' ')}`, {
521
521
  env: editEnv(this.env),
522
522
  });
523
523
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordicsemiconductor/pc-nrfconnect-shared",
3
- "version": "137.0.0",
3
+ "version": "139.0.0",
4
4
  "description": "Shared commodities for developing pc-nrfconnect-* packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,12 @@ const getInsights = async (forceSend?: boolean) => {
31
31
  return cachedInsights;
32
32
  };
33
33
 
34
+ // We experienced that apps sometimes freeze when closing the window
35
+ // until the telemetry events are sent.
36
+ window.addEventListener('beforeunload', async () => {
37
+ (await getInsights())?.flush();
38
+ });
39
+
34
40
  const init = async () => {
35
41
  const applicationName = packageJson().name;
36
42
  const applicationVersion = packageJson().version;
@@ -12,6 +12,8 @@ export declare class Batch {
12
12
  private enqueueBatchOperationObject;
13
13
  getDeviceInfo(core: DeviceCore, callbacks?: Callbacks<FWInfo>): this;
14
14
  erase(core: DeviceCore, callbacks?: Callbacks): this;
15
+ boardController(data: object, callbacks?: Callbacks): this;
16
+ getBoardControllerVersion(callbacks?: Callbacks): this;
15
17
  firmwareRead(core: DeviceCore, callbacks?: Callbacks<Buffer>): this;
16
18
  getCoreInfo(core: DeviceCore, callbacks?: Callbacks<DeviceCoreInfo>): this;
17
19
  getFwInfo(core: DeviceCore, callbacks?: Callbacks<FWInfo>): this;
@@ -1 +1 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../../nrfutil/device/batch.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAyB,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACH,UAAU,EACV,YAAY,EAGZ,aAAa,EACb,SAAS,EACZ,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EACH,YAAY,EACZ,kBAAkB,EAErB,MAAM,WAAW,CAAC;AAKnB,qBAAa,KAAK;IACd,OAAO,CAAC,wBAAwB,CACzB;IAEP,OAAO,CAAC,iB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ClB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,SAAS;IAU/C,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,SAAS;IAWhE,OAAO,CACV,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,IAAI;IAW7C,GAAG,CACZ,MAAM,EAAE,aAAa,EACrB,UAAU,CAAC,EAAE,eAAe,GAAG,SAAS,GACzC,OAAO,CAAC,OAAO,EAAE,CAAC;CAqGxB"}
@@ -0,0 +1,5 @@
1
+ import { Progress } from '../sandboxTypes';
2
+ import { NrfutilDevice } from './common';
3
+ declare const _default: (device: NrfutilDevice, data: object, onProgress?: ((progress: Progress) => void) | undefined, controller?: AbortController) => Promise<void>;
4
+ export default _default;
5
+ //# sourceMappingURL=boardController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boardController.d.ts","sourceRoot":"","sources":["../../../../nrfutil/device/boardController.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAoC,aAAa,EAAE,MAAM,UAAU,CAAC;iCAG/D,aAAa,QACf,MAAM,2BACY,QAAQ,KAAK,IAAI,4BAC5B,eAAe;AAJhC,wBA8BE"}
@@ -25,6 +25,8 @@ declare const _default: {
25
25
  setLogLevel: (level: LogLevel) => Promise<void>;
26
26
  setVerboseLogging: (verbose: boolean) => Promise<void>;
27
27
  getModuleVersion: () => Promise<import("../sandboxTypes").ModuleVersion>;
28
+ boardController: (device: import("./common").NrfutilDevice, data: object, onProgress?: ((progress: import("../sandboxTypes").Progress) => void) | undefined, controller?: AbortController | undefined) => Promise<void>;
29
+ getBoardControllerVersion: (device: import("./common").NrfutilDevice, onProgress?: ((progress: import("../sandboxTypes").Progress) => void) | undefined, controller?: AbortController | undefined) => Promise<import("./getBoardControllerVersion").BoardControllerVersion>;
28
30
  batch: () => Batch;
29
31
  };
30
32
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../nrfutil/device/device.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqChC,wBAkBE"}
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../../nrfutil/device/device.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuChC,wBAoBE"}
@@ -0,0 +1,16 @@
1
+ import { Progress } from '../sandboxTypes';
2
+ import { NrfutilDevice } from './common';
3
+ export interface BoardControllerVersionResponse {
4
+ data: BoardControllerVersion;
5
+ }
6
+ export interface BoardControllerVersion {
7
+ bc_fw_ver: string;
8
+ device_id: string;
9
+ major_ver: number;
10
+ minor_ver: number;
11
+ patch_ver: number;
12
+ pca_num: number;
13
+ }
14
+ declare const _default: (device: NrfutilDevice, onProgress?: ((progress: Progress) => void) | undefined, controller?: AbortController) => Promise<BoardControllerVersion>;
15
+ export default _default;
16
+ //# sourceMappingURL=getBoardControllerVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBoardControllerVersion.d.ts","sourceRoot":"","sources":["../../../../nrfutil/device/getBoardControllerVersion.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAgC,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvE,MAAM,WAAW,8BAA8B;IAC3C,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;iCAGW,aAAa,2BACG,QAAQ,KAAK,IAAI,4BAC5B,eAAe;AAHhC,wBA4BE"}
@@ -1 +1 @@
1
- {"version":3,"file":"usageDataRenderer.d.ts","sourceRoot":"","sources":["../../../../src/utils/usageDataRenderer.ts"],"names":[],"mappings":"AAYA,OAAwB,EAEpB,QAAQ,EACX,MAAM,mBAAmB,CAAC;;;;;;;;AAwG3B,wBAME"}
1
+ {"version":3,"file":"usageDataRenderer.d.ts","sourceRoot":"","sources":["../../../../src/utils/usageDataRenderer.ts"],"names":[],"mappings":"AAYA,OAAwB,EAEpB,QAAQ,EACX,MAAM,mBAAmB,CAAC;;;;;;;;AA8G3B,wBAME"}