nRF Connect for Desktop[自己的APP环境搭建]
创始人
2024-02-08 06:53:26

本文源码仓库地址:https://github.com/NordicSemiconductor/pc-nrfconnect-ble/blob/main/package.json
nRF Connect for Desktop是nordic自己做的一个PC端的蓝牙工具,配合nordic的dongle可以实现蓝牙的很多功能,要浏览本文要有如下知识储备:
1.nRF Connect for Desktop的APP是用js开发,所以要了解js并且安装了js的编译环境nodejs,编辑软件最好是vscode
2.已经成功安装了nRF Connect for Desktop上位机软件,可以看文章:https://blog.csdn.net/chengdong1314/article/details/109506931(好像最新版本的软件很好安装使用)

自己的APP环境搭建

1.克隆一个nordic的app到C:\Users\Administrator.nrfconnect-apps\local目录(window),参考文章:
https://nordicsemiconductor.github.io/pc-nrfconnect-docs/create_new_app
在这里插入图片描述
在这里插入图片描述
2.安装依赖,请看文章:https://nordicsemiconductor.github.io/pc-nrfconnect-docs/app_development
在这里插入图片描述
我这里安装依赖提醒如下log:

Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。尝试新的跨平台 PowerShell https://aka.ms/pscore6PS F:\download\pc-nrfconnect-ble> npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.       
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN old lockfile Error: git dep preparation failed
npm WARN old lockfile     at ChildProcess. (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
npm WARN old lockfile     at ChildProcess.emit (node:events:526:28)
npm WARN old lockfile     at maybeClose (node:internal/child_process:1092:16)
npm WARN old lockfile     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm WARN old lockfile  Could not fetch metadata for pc-nrfconnect-shared@git+ssh://git@github.com/NordicSemiconductor/pc-nrfconnect-shared.git#fa442365b33fd2dd2df5d0ea20cfe2160cac088f Error: git dep preparation failed
npm WARN old lockfile     at ChildProcess. (D:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
npm WARN old lockfile     at ChildProcess.emit (node:events:526:28)
npm WARN old lockfile     at maybeClose (node:internal/child_process:1092:16)
npm WARN old lockfile     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm WARN old lockfile   cmd: 'D:\\Program Files\\nodejs\\node.exe',
npm WARN old lockfile   args: [
npm WARN old lockfile     'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm WARN old lockfile     'install',
npm WARN old lockfile     '--force',
npm WARN old lockfile     '--cache=C:\\Users\\Administrator\\AppData\\Local\\npm-cache',
npm WARN old lockfile     '--prefer-offline=false',
npm WARN old lockfile     '--prefer-online=false',
npm WARN old lockfile     '--offline=false',
npm WARN old lockfile     '--no-progress',
npm WARN old lockfile     '--no-save',
npm WARN old lockfile     '--no-audit',
npm WARN old lockfile     '--include=dev',
npm WARN old lockfile     '--include=peer',
npm WARN old lockfile     '--include=optional',
npm WARN old lockfile     '--no-package-lock-only',
npm WARN old lockfile     '--no-dry-run'
npm WARN old lockfile   ],
npm WARN old lockfile   code: 1,
npm WARN old lockfile   signal: null,
npm WARN old lockfile   stdout: '',
npm WARN old lockfile   stderr: 'npm WARN using --force Recommended protections disabled.\n' +
npm WARN old lockfile     'npm WARN old lockfile \n' +
npm WARN old lockfile     'npm WARN old lockfile The package-lock.json file was created with an old version of npm,\n' +
npm WARN old lockfile     'npm WARN old lockfile so supplemental metadata must be fetched from the registry.\n' +
npm WARN old lockfile     'npm WARN old lockfile \n' +
npm WARN old lockfile     'npm WARN old lockfile This is a one-time fix-up, please be patient...\n' +
npm WARN old lockfile     'npm WARN old lockfile \n' +
npm WARN old lockfile     "npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.\n" +
npm WARN old lockfile     'npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated\n' +
npm WARN old lockfile     'npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility\n' +
npm WARN old lockfile     'npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated\n' +
npm WARN old lockfile     'npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated\n' +
npm WARN old lockfile     'npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated\n' +
npm WARN old lockfile     'npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.\n' +
npm WARN old lockfile     'npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.\n' +
npm WARN old lockfile     'npm WARN deprecated redux-devtools-extension@2.13.9: Package moved to @redux-devtools/extension.\n' +
npm WARN old lockfile     'npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.\n' +
npm WARN old lockfile     'npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142\n' +
npm WARN old lockfile     'npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future\n' +
npm WARN old lockfile     'npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.\n' +
npm WARN old lockfile     'npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.\n' +
npm WARN old lockfile     'npm WARN deprecated har-validator@5.1.5: this library is no longer supported\n' +
npm WARN old lockfile     'npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated\n' +
npm WARN old lockfile     'npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies\n' +
npm WARN old lockfile     'npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.\n' +
npm WARN old lockfile     "npm WARN deprecated @types/date-fns@2.6.0: This is a stub types definition for date-fns (https://github.com/date-fns/date-fns). date-fns provides its own type definitions, so you don't need @types/date-fns installed!\n" +
npm WARN old lockfile     'npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs\n' +
npm WARN old lockfile     'npm WARN deprecated core-js-pure@3.16.3: core-js-pure@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, 
feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.\n' +
npm WARN old lockfile     'npm ERR! code 1\n' +
npm WARN old lockfile     'npm ERR! path C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_cacache\\tmp\\git-cloneOTG7x9\\node_modules\\@nordicsemiconductor\\nrf-device-lib-js\n' +
npm WARN old lockfile     'npm ERR! command failed\n' +
npm WARN old lockfile     'npm ERR! command C:\\Windows\\system32\\cmd.exe /d /s /c node do_prebuild.js --decompress-only || node do_prebuild.js --install-only || node do_prebuild.js\n' +
npm WARN old lockfile     'npm ERR! Decompressing local prebuild.\n' +
npm WARN old lockfile     'npm ERR! Unable to decompress local prebuild. File does not exist: prebuilds\\@nordicsemiconductor\\nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' +
npm WARN old lockfile     'npm ERR! Installing prebuild from developer.nordicsemi.no.\n' +
npm WARN old lockfile     'npm ERR! Trying to install prebuild from developer.nordicsemi.no...\n' +
npm WARN old lockfile     'npm ERR! Runtime: napi\n' +
npm WARN old lockfile     'npm ERR! Target: 7\n' +
npm WARN old lockfile     'npm ERR! Running command: npx prebuild-install -r napi -t 7 --verbose\n' +
npm WARN old lockfile     'npm ERR! \n' +
npm WARN old lockfile     'npm ERR! npm WARN using --force Recommended protections disabled.\n' +
npm WARN old lockfile     'npm ERR! npm WARN using --force Recommended protections disabled.\n' +
npm WARN old lockfile     'npm ERR! prebuild-install info begin Prebuild-install version 7.1.1\n' +
npm WARN old lockfile     'npm ERR! prebuild-install info looking for local prebuild @ prebuilds\\nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' +
npm WARN old lockfile     'npm ERR! prebuild-install info looking for cached prebuild @ C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_prebuilds\\596c67-nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' +
npm WARN old lockfile     'npm ERR! prebuild-install http request GET https://developer.nordicsemi.com/.pc-tools/nrf-libs/nrf-device-lib-js/v0.4.13/nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' + 
npm WARN old lockfile     'npm ERR! prebuild-install warn install Request timed out\n' +
npm WARN old lockfile     'npm ERR! \n' +
npm WARN old lockfile     'npm ERR! =================================================================\n' +
npm WARN old lockfile     'npm ERR! Install from developer.nordicsemi.no failed.\n' +
npm WARN old lockfile     'npm ERR! \n' +
npm WARN old lockfile     'npm ERR! NOTE:\n' +
npm WARN old lockfile     'npm ERR! The prebuild-install module will use a different strategy for fetching prebuilt binaries and will try to download from Github instead if it finds a token in ~/.prebuild-installrc\n' +
npm WARN old lockfile     'npm ERR! Ensure that this token is not present by either deleting or temporarily moving it: ~/.prebuild-installrc\n' +
npm WARN old lockfile     'npm ERR! =================================================================\n' +
npm WARN old lockfile     'npm ERR! Error message was: Error: Command failed: npx prebuild-install -r napi -t 7 --verbose\n' +
npm WARN old lockfile     'npm ERR! npm WARN using --force Recommended protections disabled.\n' +
npm WARN old lockfile     'npm ERR! npm WARN using --force Recommended protections disabled.\n' +
npm WARN old lockfile     'npm ERR! prebuild-install info begin Prebuild-install version 7.1.1\n' +
npm WARN old lockfile     'npm ERR! prebuild-install info looking for local prebuild @ prebuilds\\nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' +
npm WARN old lockfile     'npm ERR! prebuild-install info looking for cached prebuild @ C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_prebuilds\\596c67-nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' +
npm WARN old lockfile     'npm ERR! prebuild-install http request GET https://developer.nordicsemi.com/.pc-tools/nrf-libs/nrf-device-lib-js/v0.4.13/nrf-device-lib-js-v0.4.13-napi-v7-win32-x64.tar.gz\n' + 
npm WARN old lockfile     'npm ERR! prebuild-install warn install Request timed out\n' +
npm WARN old lockfile     'npm ERR! \n' +
npm WARN old lockfile     'npm ERR! Pre-building for versions: .\n' +
npm WARN old lockfile     'npm ERR! Done with error:\n' +
npm WARN old lockfile     "npm ERR! Error: ENOENT: no such file or directory, open './include/nrfdl-js-version-autogen.h'\n" +
npm WARN old lockfile     'npm ERR!     at Object.openSync (node:fs:585:3)\n' +
npm WARN old lockfile     'npm ERR!     at Object.writeFileSync (node:fs:2157:35)\n' +
npm WARN old lockfile     'npm ERR!     at create_version_header (C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_cacache\\tmp\\git-cloneOTG7x9\\node_modules\\@nordicsemiconductor\\nrf-device-lib-js\\do_prebuild.js:32:8)\n' +
npm WARN old lockfile     'npm ERR!     at run_prebuild (C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_cacache\\tmp\\git-cloneOTG7x9\\node_modules\\@nordicsemiconductor\\nrf-device-lib-js\\do_prebuild.js:44:5)\n' +
npm WARN old lockfile     'npm ERR!     at Object. (C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_cacache\\tmp\\git-cloneOTG7x9\\node_modules\\@nordicsemiconductor\\nrf-device-lib-js\\do_prebuild.js:446:5)\n' +
npm WARN old lockfile     'npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1103:14)\n' +
npm WARN old lockfile     'npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)\n' +
npm WARN old lockfile     'npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)\n' +
npm WARN old lockfile     'npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n' +
npm WARN old lockfile     'npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\n' +
npm WARN old lockfile     'npm ERR!   errno: -4058,\n' +
npm WARN old lockfile     "npm ERR!   syscall: 'open',\n" +
npm WARN old lockfile     "npm ERR!   code: 'ENOENT',\n" +
npm WARN old lockfile     "npm ERR!   path: './include/nrfdl-js-version-autogen.h'\n" +
npm WARN old lockfile     'npm ERR! }\n' +
npm WARN old lockfile     '\n' +
npm WARN old lockfile     'npm ERR! A complete log of this run can be found in:\n' +
npm WARN old lockfile     'npm ERR!     C:\\Users\\Administrator\\AppData\\Local\\npm-cache\\_logs\\2022-11-22T10_16_35_854Z-debug-0.log\n'
npm WARN old lockfile }
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated @types/date-fns@2.6.0: This is a stub types definition for date-fns (https://github.com/date-fns/date-fns). date-fns provides its own type definitions, so you don't need @types/date-fns installed!
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated redux-devtools-extension@2.13.9: Package moved to @redux-devtools/extension.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.      
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.added 2252 packages, and audited 2253 packages in 6m271 packages are looking for fundingrun `npm fund` for details        26 vulnerabilities (3 moderate, 22 high, 1 critical)To address all issues, run:npm audit fixRun `npm audit` for details.
npm notice 
npm notice New major version of npm available! 8.5.0 -> 9.1.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.1.2
npm notice Run npm install -g npm@9.1.2 to update!
npm notice
PS F:\download\pc-nrfconnect-ble> 

3.编译项目,请看第二点文章中的编译内容,我这里编译的log如下:

PS F:\download\pc-nrfconnect-ble> npm run dev> pc-nrfconnect-ble@4.0.2 dev
> webpack watch --mode developmentHash: fbf658d3a85ac09cd845
Version: webpack 4.46.0
Time: 30452ms
Built at: 2022/11/22 18:24:42Asset      Size  Chunks             Chunk Namesbundle.js  30.8 MiB    main  [emitted]  main
nordic-publish.js  7.35 KiB          [emitted]
Entrypoint main = bundle.js
[./node_modules/@babel/runtime/helpers/esm/extends.js] 527 bytes {main} [built]
[./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js] 462 bytes {main} [built]
[./node_modules/pc-nrfconnect-shared/src/index.ts] 9.92 KiB {main} [built]
[./node_modules/react-bootstrap/esm/ProgressBar.js] 5.82 KiB {main} [built]
[./node_modules/semver/index.js] 2.57 KiB {main} [built]
[./src/config.ts] 742 bytes {main} [built]
[./src/downloadInstaller.ts] 3.34 KiB {main} [built]
[./src/index.tsx] 9.56 KiB {main} [built]
[./src/paths.ts] 2.83 KiB {main} [built]
[./src/run.ts] 2.15 KiB {main} [built]
[./src/style.css] 376 bytes {main} [built]
[@electron/remote] external "@electron/remote" 42 bytes {main} [built]
[fs] external "fs" 42 bytes {main} [built]
[path] external "path" 42 bytes {main} [built]
[react] external "react" 42 bytes {main} [built]+ 1037 hidden modules

4.修改APP名称以及描述等内容:
在这里插入图片描述

5.运行nRF Connect for Desktop查看自己的APP:
在这里插入图片描述
在这里插入图片描述
到这里环境已经搭建好了!

相关内容

热门资讯

埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...
脚上的穴位图 脚面经络图对应的... 人体穴位作用图解大全更清晰直观的标注了各个人体穴位的作用,包括头部穴位图、胸部穴位图、背部穴位图、胳...
长白山自助游攻略 吉林长白山游... 昨天介绍了西坡的景点详细请看链接:一个人的旅行,据说能看到长白山天池全凭运气,您的运气如何?今日介绍...
猫咪吃了塑料袋怎么办 猫咪误食... 你知道吗?塑料袋放久了会长猫哦!要说猫咪对塑料袋的喜爱程度完完全全可以媲美纸箱家里只要一有塑料袋的响...
demo什么意思 demo版本... 618快到了,各位的小金库大概也在准备开闸放水了吧。没有小金库的,也该向老婆撒娇卖萌服个软了,一切只...
世界上最漂亮的人 世界上最漂亮... 此前在某网上,选出了全球265万颜值姣好的女性。从这些数量庞大的女性群体中,人们投票选出了心目中最美...
埃菲尔铁塔在哪 中国仿建埃菲尔... 2019年4月26日,广西南宁市,街头惊现一座巨型山寨版埃菲尔铁塔,高约20米,白色塔身,造型逼真,...
苗族的传统节日 贵州苗族节日有... 【岜沙苗族芦笙节】岜沙,苗语叫“分送”,距从江县城7.5公里,是世界上最崇拜树木并以树为神的枪手部落...
北京的名胜古迹 北京最著名的景... 北京从元代开始,逐渐走上帝国首都的道路,先是成为大辽朝五大首都之一的南京城,随着金灭辽,金代从海陵王...
应用未安装解决办法 平板应用未... ---IT小技术,每天Get一个小技能!一、前言描述苹果IPad2居然不能安装怎么办?与此IPad不...