@nordicsemiconductor/pc-nrfconnect-shared 60.0.0-pre1

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.
Files changed (367) hide show
  1. package/.github/ISSUE_TEMPLATE/custom.md +10 -0
  2. package/.husky/pre-push +3 -0
  3. package/.renovaterc.json +10 -0
  4. package/Changelog.md +2973 -0
  5. package/LICENSE +35 -0
  6. package/README.md +11 -0
  7. package/azure-pipelines.yml +34 -0
  8. package/config/eslintrc.js +190 -0
  9. package/config/jest.config.js +41 -0
  10. package/config/prettier.config.js +13 -0
  11. package/config/tsconfig.json +15 -0
  12. package/fw/bootloader/graviton_bootloader_v1.0.1-[nRF5_SDK_15.0.1-1.alpha_f76d012].zip +0 -0
  13. package/jest.config.js +7 -0
  14. package/main/index.ts +32 -0
  15. package/mocks/deviceLibMock.ts +21 -0
  16. package/mocks/electronMock.ts +15 -0
  17. package/mocks/electronStoreMock.ts +19 -0
  18. package/mocks/emptyMock.ts +7 -0
  19. package/mocks/fileMock.ts +13 -0
  20. package/mocks/gaMock.ts +9 -0
  21. package/mocks/mockTests.test.ts +15 -0
  22. package/mocks/packageJsonMock.ts +10 -0
  23. package/mocks/remoteMock.ts +17 -0
  24. package/package.json +132 -0
  25. package/scripts/check-app-properties.ts +197 -0
  26. package/scripts/check-for-typescript.ts +41 -0
  27. package/scripts/esbuild-bootstrap.js +15 -0
  28. package/scripts/esbuild-renderer.js +131 -0
  29. package/scripts/esbuild.js +57 -0
  30. package/scripts/installHusky.ts +17 -0
  31. package/scripts/nordic-publish.ts +485 -0
  32. package/scripts/nrfconnect-license.ts +277 -0
  33. package/scripts/prepare-shared-release.ts +122 -0
  34. package/scripts/release-shared.test.ts +132 -0
  35. package/scripts/release-shared.ts +207 -0
  36. package/src/About/About.tsx +25 -0
  37. package/src/About/AboutButton.tsx +28 -0
  38. package/src/About/ApplicationCard.tsx +83 -0
  39. package/src/About/DeviceCard.tsx +74 -0
  40. package/src/About/DocumentationCard.tsx +18 -0
  41. package/src/About/DocumentationSection.tsx +24 -0
  42. package/src/About/Section.tsx +21 -0
  43. package/src/About/ShortcutButton.tsx +41 -0
  44. package/src/About/SupportCard.tsx +97 -0
  45. package/src/About/about.scss +40 -0
  46. package/src/About/documentationSlice.ts +41 -0
  47. package/src/About/section.scss +15 -0
  48. package/src/About/shortcutSlice.ts +52 -0
  49. package/src/Alert/Alert.module.scss +29 -0
  50. package/src/Alert/Alert.tsx +37 -0
  51. package/src/App/App.test.tsx +47 -0
  52. package/src/App/App.tsx +227 -0
  53. package/src/App/ConnectedToStore.tsx +19 -0
  54. package/src/App/VisibilityBar.tsx +103 -0
  55. package/src/App/app.scss +83 -0
  56. package/src/App/appLayout.ts +95 -0
  57. package/src/App/shared.scss +49 -0
  58. package/src/App/visibility-bar.scss +55 -0
  59. package/src/Button/Button.tsx +66 -0
  60. package/src/Button/button.module.scss +154 -0
  61. package/src/Card/Card.tsx +26 -0
  62. package/src/Card/card.module.scss +28 -0
  63. package/src/Device/BrokenDeviceDialog/BrokenDeviceDialog.tsx +58 -0
  64. package/src/Device/BrokenDeviceDialog/broken-device-dialog.scss +18 -0
  65. package/src/Device/BrokenDeviceDialog/brokenDeviceDialogSlice.tsx +48 -0
  66. package/src/Device/DeviceSelector/BasicDeviceInfo.tsx +115 -0
  67. package/src/Device/DeviceSelector/DeviceIcon.tsx +27 -0
  68. package/src/Device/DeviceSelector/DeviceList/AnimatedList.tsx +62 -0
  69. package/src/Device/DeviceSelector/DeviceList/BrokenDevice.tsx +34 -0
  70. package/src/Device/DeviceSelector/DeviceList/Device.tsx +84 -0
  71. package/src/Device/DeviceSelector/DeviceList/DeviceList.tsx +113 -0
  72. package/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.tsx +28 -0
  73. package/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.tsx +65 -0
  74. package/src/Device/DeviceSelector/DeviceList/RenameDevice.tsx +22 -0
  75. package/src/Device/DeviceSelector/DeviceList/broken-device.scss +32 -0
  76. package/src/Device/DeviceSelector/DeviceList/device-list.scss +64 -0
  77. package/src/Device/DeviceSelector/DeviceList/device.scss +28 -0
  78. package/src/Device/DeviceSelector/DeviceList/edit-device-buttons.scss +31 -0
  79. package/src/Device/DeviceSelector/DeviceList/more-device-info.scss +33 -0
  80. package/src/Device/DeviceSelector/DeviceList/rename-device.scss +13 -0
  81. package/src/Device/DeviceSelector/DeviceSelector.test.tsx +342 -0
  82. package/src/Device/DeviceSelector/DeviceSelector.tsx +173 -0
  83. package/src/Device/DeviceSelector/Favorite.tsx +49 -0
  84. package/src/Device/DeviceSelector/SelectDevice.tsx +36 -0
  85. package/src/Device/DeviceSelector/SelectedDevice.tsx +65 -0
  86. package/src/Device/DeviceSelector/arrow-down.svg +1 -0
  87. package/src/Device/DeviceSelector/basic-device-info.scss +62 -0
  88. package/src/Device/DeviceSelector/device-icon.scss +27 -0
  89. package/src/Device/DeviceSelector/favorite.scss +17 -0
  90. package/src/Device/DeviceSelector/select-device.scss +38 -0
  91. package/src/Device/DeviceSelector/selected-device.scss +57 -0
  92. package/src/Device/DeviceSetup/DeviceSetupView.tsx +102 -0
  93. package/src/Device/deviceAutoSelectSlice.ts +144 -0
  94. package/src/Device/deviceInfo/deviceInfo.ts +254 -0
  95. package/src/Device/deviceInfo/nRF51-Series-logo.svg +1 -0
  96. package/src/Device/deviceInfo/nRF52-Series-logo.svg +1 -0
  97. package/src/Device/deviceInfo/nRF53-Series-logo.svg +1 -0
  98. package/src/Device/deviceInfo/nRF70-Series_no-background_RGB.svg +36 -0
  99. package/src/Device/deviceInfo/nRF91-Series-logo.svg +1 -0
  100. package/src/Device/deviceInfo/ppk-logo.svg +1 -0
  101. package/src/Device/deviceInfo/unknown-logo.svg +30 -0
  102. package/src/Device/deviceInfo/unknown-nordic-logo.svg +25 -0
  103. package/src/Device/deviceLibWrapper.test.ts +97 -0
  104. package/src/Device/deviceLibWrapper.ts +133 -0
  105. package/src/Device/deviceLister.test.ts +89 -0
  106. package/src/Device/deviceLister.ts +396 -0
  107. package/src/Device/deviceSetup.ts +264 -0
  108. package/src/Device/deviceSetupSlice.ts +94 -0
  109. package/src/Device/deviceSlice.ts +248 -0
  110. package/src/Device/dfu-cc.ts +162 -0
  111. package/src/Device/initPacket.ts +402 -0
  112. package/src/Device/jprogOperations.ts +206 -0
  113. package/src/Device/sdfuOperations.ts +601 -0
  114. package/src/Dialog/Dialog.test.tsx +134 -0
  115. package/src/Dialog/Dialog.tsx +236 -0
  116. package/src/Dialog/dialog.scss +60 -0
  117. package/src/Dropdown/Dropdown.module.scss +83 -0
  118. package/src/Dropdown/Dropdown.test.tsx +62 -0
  119. package/src/Dropdown/Dropdown.tsx +106 -0
  120. package/src/ErrorBoundary/ErrorBoundary.test.tsx +105 -0
  121. package/src/ErrorBoundary/ErrorBoundary.tsx +186 -0
  122. package/src/ErrorBoundary/bug.svg +1 -0
  123. package/src/ErrorBoundary/error-boundary.scss +102 -0
  124. package/src/ErrorDialog/ErrorDialog.test.tsx +70 -0
  125. package/src/ErrorDialog/ErrorDialog.tsx +94 -0
  126. package/src/ErrorDialog/error.scss +14 -0
  127. package/src/ErrorDialog/errorDialogSlice.test.ts +64 -0
  128. package/src/ErrorDialog/errorDialogSlice.ts +80 -0
  129. package/src/FactoryReset/FactoryResetButton.test.tsx +46 -0
  130. package/src/FactoryReset/FactoryResetButton.tsx +81 -0
  131. package/src/InlineInput/InlineInput.tsx +170 -0
  132. package/src/InlineInput/NumberInlineInput.tsx +107 -0
  133. package/src/InlineInput/inline-input.scss +38 -0
  134. package/src/InlineInput/number-inline-input.scss +15 -0
  135. package/src/Log/LogEntry.tsx +62 -0
  136. package/src/Log/LogViewer.tsx +54 -0
  137. package/src/Log/log-entry.scss +30 -0
  138. package/src/Log/log-viewer.scss +24 -0
  139. package/src/Log/logSlice.ts +73 -0
  140. package/src/Log/syncLogToStore.ts +36 -0
  141. package/src/Logo/Logo.tsx +48 -0
  142. package/src/Logo/logo.scss +11 -0
  143. package/src/Logo/nordic-logo-blue-icon-only.png +0 -0
  144. package/src/Logo/nordic-logo-gray-icon-only.png +0 -0
  145. package/src/Logo/nordic-logo-white-icon-only.png +0 -0
  146. package/src/Main/Main.tsx +13 -0
  147. package/src/Main/main.scss +13 -0
  148. package/src/MasonryLayout/MasonryLayout.tsx +234 -0
  149. package/src/MasonryLayout/masonryLayout.module.scss +46 -0
  150. package/src/NavBar/NavBar.tsx +22 -0
  151. package/src/NavBar/NavMenu.test.tsx +41 -0
  152. package/src/NavBar/NavMenu.tsx +53 -0
  153. package/src/NavBar/NavMenuItem.tsx +41 -0
  154. package/src/NavBar/nav-bar.scss +26 -0
  155. package/src/NavBar/nav-menu-item.scss +34 -0
  156. package/src/OpenApp/openApp.ts +18 -0
  157. package/src/Panes/FeedbackPane.tsx +149 -0
  158. package/src/PseudoButton/PseudoButton.tsx +56 -0
  159. package/src/PseudoButton/pseudo-button.scss +11 -0
  160. package/src/SerialPort/ConflictingSettingsDialog.tsx +242 -0
  161. package/src/SerialPort/SerialPort.test.ts +54 -0
  162. package/src/SerialPort/SerialPort.ts +202 -0
  163. package/src/Shortcuts/Shortcut-item.scss +33 -0
  164. package/src/Shortcuts/Shortcut-modal.scss +20 -0
  165. package/src/Shortcuts/ShortcutItem.tsx +48 -0
  166. package/src/Shortcuts/ShortcutModal.tsx +67 -0
  167. package/src/SidePanel/Group.tsx +106 -0
  168. package/src/SidePanel/SidePanel.tsx +19 -0
  169. package/src/SidePanel/group.scss +42 -0
  170. package/src/SidePanel/sidepanel.scss +20 -0
  171. package/src/Slider/Bar.tsx +24 -0
  172. package/src/Slider/Factor.test.ts +48 -0
  173. package/src/Slider/Handle.tsx +121 -0
  174. package/src/Slider/Slider.test.tsx +25 -0
  175. package/src/Slider/Slider.tsx +91 -0
  176. package/src/Slider/Ticks.tsx +54 -0
  177. package/src/Slider/__snapshots__/Slider.test.tsx.snap +50 -0
  178. package/src/Slider/bar.scss +24 -0
  179. package/src/Slider/factor.ts +24 -0
  180. package/src/Slider/handle.scss +32 -0
  181. package/src/Slider/percentage.ts +67 -0
  182. package/src/Slider/range.ts +92 -0
  183. package/src/Slider/slider.scss +14 -0
  184. package/src/Slider/ticks.scss +28 -0
  185. package/src/Slider/variables.scss +16 -0
  186. package/src/StartStopButton/StartStopButton.tsx +60 -0
  187. package/src/StartStopButton/play-circle.svg +1 -0
  188. package/src/StartStopButton/start-stop-button.scss +47 -0
  189. package/src/StartStopButton/stop-circle.svg +1 -0
  190. package/src/StateSelector/StateSelector.tsx +64 -0
  191. package/src/StateSelector/state-selector.scss +38 -0
  192. package/src/Stepper/Stepper.tsx +139 -0
  193. package/src/Stepper/stepper.scss +127 -0
  194. package/src/Toggle/Toggle.tsx +120 -0
  195. package/src/Toggle/toggle.scss +109 -0
  196. package/src/bootstrap.scss +14 -0
  197. package/src/index.ts +146 -0
  198. package/src/logging/appTransport.test.ts +78 -0
  199. package/src/logging/appTransport.ts +41 -0
  200. package/src/logging/describeError.test.ts +38 -0
  201. package/src/logging/describeError.ts +56 -0
  202. package/src/logging/index.ts +103 -0
  203. package/src/logging/logBuffer.test.ts +41 -0
  204. package/src/logging/logBuffer.ts +24 -0
  205. package/src/logging/sendInitialLogMessages.ts +64 -0
  206. package/src/store.ts +60 -0
  207. package/src/svg.d.ts +15 -0
  208. package/src/utils/AppTypes.ts +60 -0
  209. package/src/utils/appDirs.ts +78 -0
  210. package/src/utils/bleChannels.ts +16 -0
  211. package/src/utils/classNames.test.ts +29 -0
  212. package/src/utils/classNames.ts +25 -0
  213. package/src/utils/colors.scss +46 -0
  214. package/src/utils/colors.ts +38 -0
  215. package/src/utils/describeVersion.ts +21 -0
  216. package/src/utils/environment.ts +6 -0
  217. package/src/utils/logLibVersions.ts +103 -0
  218. package/src/utils/open.ts +46 -0
  219. package/src/utils/packageJson.ts +60 -0
  220. package/src/utils/persistentStore.ts +144 -0
  221. package/src/utils/systemReport.ts +160 -0
  222. package/src/utils/truncateMiddle.test.ts +21 -0
  223. package/src/utils/truncateMiddle.ts +20 -0
  224. package/src/utils/usageData.ts +189 -0
  225. package/src/utils/useHotKey.ts +62 -0
  226. package/src/utils/useStopwatch.test.tsx +311 -0
  227. package/src/utils/useStopwatch.ts +140 -0
  228. package/src/variables.scss +820 -0
  229. package/styles.scss +88 -0
  230. package/test/dispatchTo.ts +23 -0
  231. package/test/index.ts +7 -0
  232. package/test/jestResolver.js +28 -0
  233. package/test/setupTests.ts +27 -0
  234. package/test/testUtil.ts +20 -0
  235. package/test/testrenderer.tsx +39 -0
  236. package/tsconfig.json +9 -0
  237. package/typings/externals.d.ts +31 -0
  238. package/typings/generated/main/index.d.ts +25 -0
  239. package/typings/generated/src/About/About.d.ts +4 -0
  240. package/typings/generated/src/About/AboutButton.d.ts +8 -0
  241. package/typings/generated/src/About/ApplicationCard.d.ts +3 -0
  242. package/typings/generated/src/About/DeviceCard.d.ts +3 -0
  243. package/typings/generated/src/About/DocumentationCard.d.ts +3 -0
  244. package/typings/generated/src/About/DocumentationSection.d.ts +9 -0
  245. package/typings/generated/src/About/Section.d.ts +8 -0
  246. package/typings/generated/src/About/ShortcutButton.d.ts +6 -0
  247. package/typings/generated/src/About/SupportCard.d.ts +3 -0
  248. package/typings/generated/src/About/documentationSlice.d.ts +12 -0
  249. package/typings/generated/src/About/shortcutSlice.d.ts +11 -0
  250. package/typings/generated/src/Alert/Alert.d.ts +10 -0
  251. package/typings/generated/src/App/App.d.ts +27 -0
  252. package/typings/generated/src/App/App.test.d.ts +1 -0
  253. package/typings/generated/src/App/ConnectedToStore.d.ts +7 -0
  254. package/typings/generated/src/App/VisibilityBar.d.ts +6 -0
  255. package/typings/generated/src/App/appLayout.d.ts +17 -0
  256. package/typings/generated/src/Button/Button.d.ts +13 -0
  257. package/typings/generated/src/Card/Card.d.ts +7 -0
  258. package/typings/generated/src/Device/BrokenDeviceDialog/BrokenDeviceDialog.d.ts +4 -0
  259. package/typings/generated/src/Device/BrokenDeviceDialog/brokenDeviceDialogSlice.d.ts +12 -0
  260. package/typings/generated/src/Device/DeviceSelector/BasicDeviceInfo.d.ts +11 -0
  261. package/typings/generated/src/Device/DeviceSelector/DeviceIcon.d.ts +7 -0
  262. package/typings/generated/src/Device/DeviceSelector/DeviceList/AnimatedList.d.ts +10 -0
  263. package/typings/generated/src/Device/DeviceSelector/DeviceList/BrokenDevice.d.ts +7 -0
  264. package/typings/generated/src/Device/DeviceSelector/DeviceList/Device.d.ts +10 -0
  265. package/typings/generated/src/Device/DeviceSelector/DeviceList/DeviceList.d.ts +10 -0
  266. package/typings/generated/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.d.ts +9 -0
  267. package/typings/generated/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.d.ts +7 -0
  268. package/typings/generated/src/Device/DeviceSelector/DeviceList/RenameDevice.d.ts +6 -0
  269. package/typings/generated/src/Device/DeviceSelector/DeviceSelector.d.ts +20 -0
  270. package/typings/generated/src/Device/DeviceSelector/DeviceSelector.test.d.ts +1 -0
  271. package/typings/generated/src/Device/DeviceSelector/Favorite.d.ts +9 -0
  272. package/typings/generated/src/Device/DeviceSelector/SelectDevice.d.ts +8 -0
  273. package/typings/generated/src/Device/DeviceSelector/SelectedDevice.d.ts +7 -0
  274. package/typings/generated/src/Device/DeviceSetup/DeviceSetupView.d.ts +3 -0
  275. package/typings/generated/src/Device/deviceAutoSelectSlice.d.ts +28 -0
  276. package/typings/generated/src/Device/deviceInfo/deviceInfo.d.ts +18 -0
  277. package/typings/generated/src/Device/deviceLibWrapper.d.ts +8 -0
  278. package/typings/generated/src/Device/deviceLibWrapper.test.d.ts +1 -0
  279. package/typings/generated/src/Device/deviceLister.d.ts +25 -0
  280. package/typings/generated/src/Device/deviceLister.test.d.ts +2 -0
  281. package/typings/generated/src/Device/deviceSetup.d.ts +40 -0
  282. package/typings/generated/src/Device/deviceSetupSlice.d.ts +20 -0
  283. package/typings/generated/src/Device/deviceSlice.d.ts +30 -0
  284. package/typings/generated/src/Device/dfu-cc.d.ts +3 -0
  285. package/typings/generated/src/Device/initPacket.d.ts +109 -0
  286. package/typings/generated/src/Device/jprogOperations.d.ts +2 -0
  287. package/typings/generated/src/Device/sdfuOperations.d.ts +14 -0
  288. package/typings/generated/src/Dialog/Dialog.d.ts +64 -0
  289. package/typings/generated/src/Dialog/Dialog.test.d.ts +1 -0
  290. package/typings/generated/src/Dropdown/Dropdown.d.ts +16 -0
  291. package/typings/generated/src/Dropdown/Dropdown.test.d.ts +1 -0
  292. package/typings/generated/src/ErrorBoundary/ErrorBoundary.d.ts +26 -0
  293. package/typings/generated/src/ErrorBoundary/ErrorBoundary.test.d.ts +1 -0
  294. package/typings/generated/src/ErrorDialog/ErrorDialog.d.ts +4 -0
  295. package/typings/generated/src/ErrorDialog/ErrorDialog.test.d.ts +1 -0
  296. package/typings/generated/src/ErrorDialog/errorDialogSlice.d.ts +23 -0
  297. package/typings/generated/src/ErrorDialog/errorDialogSlice.test.d.ts +1 -0
  298. package/typings/generated/src/FactoryReset/FactoryResetButton.d.ts +12 -0
  299. package/typings/generated/src/FactoryReset/FactoryResetButton.test.d.ts +1 -0
  300. package/typings/generated/src/InlineInput/InlineInput.d.ts +14 -0
  301. package/typings/generated/src/InlineInput/NumberInlineInput.d.ts +12 -0
  302. package/typings/generated/src/Log/LogEntry.d.ts +7 -0
  303. package/typings/generated/src/Log/LogViewer.d.ts +5 -0
  304. package/typings/generated/src/Log/logSlice.d.ts +12 -0
  305. package/typings/generated/src/Log/syncLogToStore.d.ts +11 -0
  306. package/typings/generated/src/Logo/Logo.d.ts +6 -0
  307. package/typings/generated/src/Main/Main.d.ts +6 -0
  308. package/typings/generated/src/MasonryLayout/MasonryLayout.d.ts +14 -0
  309. package/typings/generated/src/NavBar/NavBar.d.ts +6 -0
  310. package/typings/generated/src/NavBar/NavMenu.d.ts +3 -0
  311. package/typings/generated/src/NavBar/NavMenu.test.d.ts +1 -0
  312. package/typings/generated/src/NavBar/NavMenuItem.d.ts +10 -0
  313. package/typings/generated/src/OpenApp/openApp.d.ts +7 -0
  314. package/typings/generated/src/Panes/FeedbackPane.d.ts +3 -0
  315. package/typings/generated/src/PseudoButton/PseudoButton.d.ts +10 -0
  316. package/typings/generated/src/SerialPort/ConflictingSettingsDialog.d.ts +13 -0
  317. package/typings/generated/src/SerialPort/SerialPort.d.ts +21 -0
  318. package/typings/generated/src/SerialPort/SerialPort.test.d.ts +1 -0
  319. package/typings/generated/src/Shortcuts/ShortcutItem.d.ts +8 -0
  320. package/typings/generated/src/Shortcuts/ShortcutModal.d.ts +8 -0
  321. package/typings/generated/src/SidePanel/Group.d.ts +16 -0
  322. package/typings/generated/src/SidePanel/SidePanel.d.ts +7 -0
  323. package/typings/generated/src/Slider/Bar.d.ts +7 -0
  324. package/typings/generated/src/Slider/Factor.test.d.ts +1 -0
  325. package/typings/generated/src/Slider/Handle.d.ts +13 -0
  326. package/typings/generated/src/Slider/Slider.d.ts +15 -0
  327. package/typings/generated/src/Slider/Slider.test.d.ts +1 -0
  328. package/typings/generated/src/Slider/Ticks.d.ts +12 -0
  329. package/typings/generated/src/Slider/factor.d.ts +1 -0
  330. package/typings/generated/src/Slider/percentage.d.ts +4 -0
  331. package/typings/generated/src/Slider/range.d.ts +13 -0
  332. package/typings/generated/src/StartStopButton/StartStopButton.d.ts +16 -0
  333. package/typings/generated/src/StateSelector/StateSelector.d.ts +15 -0
  334. package/typings/generated/src/Stepper/Stepper.d.ts +26 -0
  335. package/typings/generated/src/Toggle/Toggle.d.ts +19 -0
  336. package/typings/generated/src/index.d.ts +69 -0
  337. package/typings/generated/src/logging/appTransport.d.ts +12 -0
  338. package/typings/generated/src/logging/appTransport.test.d.ts +1 -0
  339. package/typings/generated/src/logging/describeError.d.ts +2 -0
  340. package/typings/generated/src/logging/describeError.test.d.ts +1 -0
  341. package/typings/generated/src/logging/index.d.ts +9 -0
  342. package/typings/generated/src/logging/logBuffer.d.ts +9 -0
  343. package/typings/generated/src/logging/logBuffer.test.d.ts +1 -0
  344. package/typings/generated/src/logging/sendInitialLogMessages.d.ts +2 -0
  345. package/typings/generated/src/store.d.ts +65 -0
  346. package/typings/generated/src/utils/AppTypes.d.ts +49 -0
  347. package/typings/generated/src/utils/appDirs.d.ts +35 -0
  348. package/typings/generated/src/utils/bleChannels.d.ts +6 -0
  349. package/typings/generated/src/utils/classNames.d.ts +17 -0
  350. package/typings/generated/src/utils/classNames.test.d.ts +1 -0
  351. package/typings/generated/src/utils/colors.d.ts +31 -0
  352. package/typings/generated/src/utils/describeVersion.d.ts +3 -0
  353. package/typings/generated/src/utils/environment.d.ts +1 -0
  354. package/typings/generated/src/utils/logLibVersions.d.ts +2 -0
  355. package/typings/generated/src/utils/open.d.ts +15 -0
  356. package/typings/generated/src/utils/packageJson.d.ts +4 -0
  357. package/typings/generated/src/utils/persistentStore.d.ts +35 -0
  358. package/typings/generated/src/utils/systemReport.d.ts +4 -0
  359. package/typings/generated/src/utils/truncateMiddle.d.ts +2 -0
  360. package/typings/generated/src/utils/truncateMiddle.test.d.ts +1 -0
  361. package/typings/generated/src/utils/usageData.d.ts +63 -0
  362. package/typings/generated/src/utils/useHotKey.d.ts +6 -0
  363. package/typings/generated/src/utils/useStopwatch.d.ts +22 -0
  364. package/typings/generated/src/utils/useStopwatch.test.d.ts +1 -0
  365. package/typings/generated/test/dispatchTo.d.ts +3 -0
  366. package/typings/generated/test/testrenderer.d.ts +5 -0
  367. package/typings/nrf-intel-hex.d.ts +58 -0
@@ -0,0 +1,162 @@
1
+ /*
2
+ * Copyright (c) 2021 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import * as $protobuf from 'protobufjs/light';
8
+
9
+ const $root = (
10
+ $protobuf.roots.default || ($protobuf.roots.default = new $protobuf.Root())
11
+ ).addJSON({
12
+ dfu: {
13
+ nested: {
14
+ OpCode: {
15
+ values: {
16
+ RESET: 0,
17
+ INIT: 1,
18
+ },
19
+ },
20
+ FwType: {
21
+ values: {
22
+ APPLICATION: 0,
23
+ SOFTDEVICE: 1,
24
+ BOOTLOADER: 2,
25
+ SOFTDEVICE_BOOTLOADER: 3,
26
+ },
27
+ },
28
+ HashType: {
29
+ values: {
30
+ NO_HASH: 0,
31
+ CRC: 1,
32
+ SHA128: 2,
33
+ SHA256: 3,
34
+ SHA512: 4,
35
+ },
36
+ },
37
+ Hash: {
38
+ fields: {
39
+ hashType: {
40
+ rule: 'required',
41
+ type: 'HashType',
42
+ id: 1,
43
+ },
44
+ hash: {
45
+ rule: 'required',
46
+ type: 'bytes',
47
+ id: 2,
48
+ },
49
+ },
50
+ },
51
+ InitCommand: {
52
+ fields: {
53
+ fwVersion: {
54
+ type: 'uint32',
55
+ id: 1,
56
+ },
57
+ hwVersion: {
58
+ type: 'uint32',
59
+ id: 2,
60
+ },
61
+ sdReq: {
62
+ rule: 'repeated',
63
+ type: 'uint32',
64
+ id: 3,
65
+ },
66
+ type: {
67
+ type: 'FwType',
68
+ id: 4,
69
+ },
70
+ sdSize: {
71
+ type: 'uint32',
72
+ id: 5,
73
+ },
74
+ blSize: {
75
+ type: 'uint32',
76
+ id: 6,
77
+ },
78
+ appSize: {
79
+ type: 'uint32',
80
+ id: 7,
81
+ },
82
+ hash: {
83
+ type: 'Hash',
84
+ id: 8,
85
+ },
86
+ isDebug: {
87
+ type: 'bool',
88
+ id: 9,
89
+ options: {
90
+ default: false,
91
+ },
92
+ },
93
+ },
94
+ },
95
+ ResetCommand: {
96
+ fields: {
97
+ timeout: {
98
+ rule: 'required',
99
+ type: 'uint32',
100
+ id: 1,
101
+ },
102
+ },
103
+ },
104
+ Command: {
105
+ fields: {
106
+ opCode: {
107
+ type: 'OpCode',
108
+ id: 1,
109
+ },
110
+ init: {
111
+ type: 'InitCommand',
112
+ id: 2,
113
+ },
114
+ reset: {
115
+ type: 'ResetCommand',
116
+ id: 3,
117
+ },
118
+ },
119
+ },
120
+ SignatureType: {
121
+ values: {
122
+ ECDSA_P256_SHA256: 0,
123
+ ED25519: 1,
124
+ },
125
+ },
126
+ SignedCommand: {
127
+ fields: {
128
+ command: {
129
+ rule: 'required',
130
+ type: 'Command',
131
+ id: 1,
132
+ },
133
+ signatureType: {
134
+ rule: 'required',
135
+ type: 'SignatureType',
136
+ id: 2,
137
+ },
138
+ signature: {
139
+ rule: 'required',
140
+ type: 'bytes',
141
+ id: 3,
142
+ },
143
+ },
144
+ },
145
+ Packet: {
146
+ fields: {
147
+ command: {
148
+ type: 'Command',
149
+ id: 1,
150
+ },
151
+ signedCommand: {
152
+ type: 'SignedCommand',
153
+ id: 2,
154
+ },
155
+ },
156
+ },
157
+ },
158
+ },
159
+ });
160
+
161
+ // export { $root as default };
162
+ export default $root;
@@ -0,0 +1,402 @@
1
+ /*
2
+ * Copyright (c) 2015 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ import protobuf from 'protobufjs';
8
+
9
+ import dfuCcProto from './dfu-cc';
10
+
11
+ const root = protobuf.Root.fromJSON(dfuCcProto);
12
+
13
+ export enum FwType {
14
+ APPLICATION,
15
+ SOFTDEVICE,
16
+ BOOTLOADER,
17
+ SOFTDEVICE_BOOTLOADER,
18
+ }
19
+
20
+ export enum HashType {
21
+ NO_HASH,
22
+ CRC,
23
+ SHA128,
24
+ SHA256,
25
+ SHA512,
26
+ }
27
+
28
+ export const OpCode = {
29
+ RESET: 0,
30
+ INIT: 1,
31
+ };
32
+
33
+ export const SignatureType = {
34
+ ECDSA_P256_SHA256: 0,
35
+ ED25519: 1,
36
+ };
37
+
38
+ export interface InitPacket {
39
+ fwVersion?: number;
40
+ hwVersion?: number;
41
+ sdReq?: number[];
42
+ fwType?: number;
43
+ sdSize: number;
44
+ blSize: number;
45
+ appSize: number;
46
+ hashType: number;
47
+ hash?: Buffer;
48
+ isDebug: boolean;
49
+ signatureType?: number;
50
+ signature?: [];
51
+ }
52
+
53
+ export const defaultInitPacket: InitPacket = {
54
+ fwVersion: 0xffffffff,
55
+ hwVersion: undefined,
56
+ sdReq: undefined,
57
+ fwType: undefined,
58
+ sdSize: 0,
59
+ blSize: 0,
60
+ appSize: 0,
61
+ hashType: HashType.NO_HASH,
62
+ hash: undefined,
63
+ isDebug: true,
64
+ signatureType: undefined,
65
+ signature: undefined,
66
+ };
67
+
68
+ export interface DfuImage {
69
+ name: string;
70
+ initPacket: InitPacket;
71
+ firmwareImage: Buffer;
72
+ }
73
+
74
+ // Create hash by using hash type and bytes
75
+ const createHash = (hashType: number, hashInput: Buffer): protobuf.Message => {
76
+ const hashMessage = root.lookupType('dfu.Hash');
77
+ const hashPayload = {
78
+ hashType,
79
+ hash: hashInput,
80
+ };
81
+ const hash = hashMessage.create(hashPayload);
82
+
83
+ return hash;
84
+ };
85
+
86
+ // Create reset command
87
+ const createResetCommand = (timeout: number): protobuf.Message => {
88
+ const resetCommandMessage = root.lookupType('dfu.ResetCommand');
89
+ const resetCommandPayload = {
90
+ timeout,
91
+ };
92
+ const resetCommand = resetCommandMessage.create(resetCommandPayload);
93
+
94
+ return resetCommand;
95
+ };
96
+
97
+ // Create init command
98
+ const createInitCommand = (
99
+ fwVersion: number | undefined,
100
+ hwVersion: number | undefined,
101
+ sdReq: number[] | undefined,
102
+ type: number | undefined,
103
+ sdSize: number | undefined,
104
+ blSize: number | undefined,
105
+ appSize: number | undefined,
106
+ hash: protobuf.Message | undefined,
107
+ isDebug = false
108
+ ): protobuf.Message => {
109
+ const initCommandMessage = root.lookupType('dfu.InitCommand');
110
+ const initCommandPayload = {
111
+ ...defaultInitPacket,
112
+ fwVersion,
113
+ hwVersion,
114
+ sdReq,
115
+ type: type || FwType.APPLICATION,
116
+ sdSize,
117
+ blSize,
118
+ appSize,
119
+ hash,
120
+ isDebug,
121
+ };
122
+
123
+ return initCommandMessage.create(initCommandPayload);
124
+ };
125
+
126
+ // Create command
127
+ const createCommand = (
128
+ opCode: number,
129
+ commandInput: protobuf.Message
130
+ ): protobuf.Message => {
131
+ const commandMessage = root.lookupType('dfu.Command');
132
+ const commandPayload = {
133
+ opCode,
134
+ [opCode === OpCode.INIT ? 'init' : 'reset']: commandInput,
135
+ };
136
+ const command = commandMessage.create(commandPayload);
137
+
138
+ return command;
139
+ };
140
+
141
+ // Create signed command
142
+ const createSignedCommand = (
143
+ command: protobuf.Message,
144
+ signatureType: number,
145
+ signature: []
146
+ ): protobuf.Message => {
147
+ const signedCommandMessage = root.lookupType('dfu.SignedCommand');
148
+ const signedCommandPayload = {
149
+ command,
150
+ signatureType,
151
+ signature,
152
+ };
153
+ const signedCommand = signedCommandMessage.create(signedCommandPayload);
154
+
155
+ return signedCommand;
156
+ };
157
+
158
+ // Create packet
159
+ const createPacket = (
160
+ command: protobuf.Message,
161
+ isSigned: boolean
162
+ ): protobuf.Message => {
163
+ const packetPayload = {
164
+ [isSigned ? 'signedCommand' : 'command']: command,
165
+ };
166
+ const packetMessage = root.lookupType('dfu.Packet');
167
+ const packet = packetMessage.create(packetPayload);
168
+
169
+ return packet;
170
+ };
171
+
172
+ // Convert protocol buffer message to buffer
173
+ const messageToBuffer = (type: string, message: protobuf.Message) => {
174
+ if (!message) {
175
+ throw Error('The message to be converted is undefined.');
176
+ }
177
+
178
+ const dfuMessage = root.lookup(`dfu.${type}`) as protobuf.Type;
179
+ if (!dfuMessage) {
180
+ throw Error('DFU type not found.');
181
+ }
182
+
183
+ const buffer = dfuMessage.encode(message).finish();
184
+
185
+ return buffer as Buffer;
186
+ };
187
+
188
+ /**
189
+ * Create reset command packet
190
+ *
191
+ * @param {Integer} timeout the timeout for reset
192
+ * @param {Integer} signatureType the type of signature
193
+ * @param {Array} signature the signature in bytes
194
+ *
195
+ * @returns {protobuf.Message | undefined} reset command packet
196
+ */
197
+ export const createResetPacket = (
198
+ timeout: number,
199
+ signatureType: number,
200
+ signature: []
201
+ ): protobuf.Message => {
202
+ // Check input parameters
203
+ if (timeout === undefined) {
204
+ throw new Error('Timeout is not set');
205
+ }
206
+
207
+ // It checks both null and undefined here
208
+ if (
209
+ (signatureType == null && signature != null) ||
210
+ (signatureType != null && signature == null)
211
+ ) {
212
+ throw new Error('Either signature type or signature is not set');
213
+ }
214
+
215
+ // Create reset command
216
+ const resetCommand = createResetCommand(timeout);
217
+ let isSigned = false;
218
+ let command = createCommand(OpCode.RESET, resetCommand);
219
+
220
+ // Create signed command if it is signed
221
+ // It checks both null and undefined here
222
+ if (signatureType != null && signature != null) {
223
+ isSigned = true;
224
+ command = createSignedCommand(command, signatureType, signature);
225
+ }
226
+
227
+ // Create packet
228
+ const packet = createPacket(command, isSigned);
229
+
230
+ return packet;
231
+ };
232
+
233
+ /**
234
+ * Create reset command buffer
235
+ *
236
+ * @param {Integer} timeout the timeout for reset
237
+ * @param {Integer} signatureType the type of signature
238
+ * @param {Array} signature the signature in bytes
239
+ *
240
+ * @returns {Uint8Array} converted from reset command packet
241
+ */
242
+ export const createResetPacketBuffer = (
243
+ timeout: number,
244
+ signatureType: number,
245
+ signature: []
246
+ ): Uint8Array => {
247
+ const packet = createResetPacket(timeout, signatureType, signature);
248
+ const buffer = messageToBuffer('Packet', packet);
249
+
250
+ return buffer;
251
+ };
252
+
253
+ /**
254
+ * Create init command packet
255
+ *
256
+ * @param {Integer} fwVersion the firmware version
257
+ * @param {Integer} hwVersion the hardware version
258
+ * @param {Array} sdReq the softdevice requirements
259
+ * @param {FwType} fwType the firmware type
260
+ * @param {Integer} sdSize the size of softDevice
261
+ * @param {Integer} blSize the size of bootloader
262
+ * @param {Integer} appSize the size of application
263
+ * @param {HashType} hashType the type of hash
264
+ * @param {Array} hash the hash in bytes
265
+ * @param {Boolean} isDebug whether it is in debug mode or not
266
+ * @param {SignatureType} signatureType the type of signature
267
+ * @param {Array} signature the signature in bytes
268
+ *
269
+ * @returns {protobuf.Message} init command packet
270
+ */
271
+ export const createInitPacket = (
272
+ fwVersion: number | undefined,
273
+ hwVersion: number | undefined,
274
+ sdReq: number[] | undefined,
275
+ fwType: number | undefined,
276
+ sdSize: number | undefined,
277
+ blSize: number | undefined,
278
+ appSize: number | undefined,
279
+ hashType: number | undefined,
280
+ hash: Buffer | undefined,
281
+ isDebug: boolean,
282
+ signatureType: number | undefined,
283
+ signature: [] | undefined
284
+ ): protobuf.Message => {
285
+ // It checks both null and undefined here
286
+ if (
287
+ (signatureType == null && signature != null) ||
288
+ (signatureType != null && signature == null)
289
+ ) {
290
+ throw new Error('Either signature type or signature is not set');
291
+ }
292
+
293
+ // Create init command
294
+ const hashInput = createHash(
295
+ hashType || HashType.NO_HASH,
296
+ hash ?? Buffer.from([])
297
+ );
298
+ const initCommand = createInitCommand(
299
+ fwVersion,
300
+ hwVersion,
301
+ sdReq,
302
+ fwType,
303
+ sdSize,
304
+ blSize,
305
+ appSize,
306
+ hashInput,
307
+ isDebug
308
+ );
309
+ let command = createCommand(OpCode.INIT, initCommand);
310
+ let isSigned = false;
311
+
312
+ // Create signed command if it is signed
313
+ if (signatureType != null && signature != null) {
314
+ command = createSignedCommand(command, signatureType, signature);
315
+ isSigned = true;
316
+ }
317
+
318
+ // Create packet
319
+ const packet = createPacket(command, isSigned);
320
+
321
+ return packet;
322
+ };
323
+
324
+ /**
325
+ * Create init command buffer
326
+ *
327
+ * @param {Integer} fwVersion the firmware version
328
+ * @param {Integer} hwVersion the hardware version
329
+ * @param {Array} sdReq the softdevice requirements
330
+ * @param {FwType} fwType the firmware type
331
+ * @param {Integer} sdSize the size of softdevice
332
+ * @param {Integer} blSize the size of bootloader
333
+ * @param {Integer} appSize the size of application
334
+ * @param {HashType} hashType the type of hash
335
+ * @param {Array} hash the hash in bytes
336
+ * @param {Boolean} isDebug whether it is in debug mode or not
337
+ * @param {SignatureType} signatureType the type of signature
338
+ * @param {Array} signature the signature in bytes
339
+ *
340
+ * @returns {Uint8Array} converted from init command packet
341
+ */
342
+ export const createInitPacketBuffer = (
343
+ fwVersion: number,
344
+ hwVersion: number,
345
+ sdReq: number[],
346
+ fwType: number,
347
+ sdSize: number,
348
+ blSize: number,
349
+ appSize: number,
350
+ hashType: number,
351
+ hash: Buffer,
352
+ isDebug: boolean,
353
+ signatureType: number,
354
+ signature: []
355
+ ): Buffer => {
356
+ const packet = createInitPacket(
357
+ fwVersion,
358
+ hwVersion,
359
+ sdReq,
360
+ fwType,
361
+ sdSize,
362
+ blSize,
363
+ appSize,
364
+ hashType,
365
+ hash,
366
+ isDebug,
367
+ signatureType,
368
+ signature
369
+ );
370
+ const buffer = messageToBuffer('Packet', packet);
371
+
372
+ return buffer;
373
+ };
374
+
375
+ /**
376
+ * Create init command packet Uint8Array
377
+ *
378
+ * @param {InitPacket} packetParams the InitPacket which carries all information
379
+ *
380
+ * @returns {Uint8Array} converted from init command packet buffer
381
+ */
382
+ export const createInitPacketUint8Array = (
383
+ packetParams: InitPacket
384
+ ): Uint8Array => {
385
+ const packet = createInitPacket(
386
+ packetParams.fwVersion,
387
+ packetParams.hwVersion,
388
+ packetParams.sdReq,
389
+ packetParams.fwType,
390
+ packetParams.sdSize,
391
+ packetParams.blSize,
392
+ packetParams.appSize,
393
+ packetParams.hashType,
394
+ packetParams.hash,
395
+ packetParams.isDebug,
396
+ packetParams.signatureType,
397
+ packetParams.signature
398
+ );
399
+ const buffer = messageToBuffer('Packet', packet);
400
+
401
+ return new Uint8Array(buffer);
402
+ };