• nRF Connect for Desktop[自己的APP环境搭建]


    本文源码仓库地址: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/pscore6
    
    PS 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.<anonymous> (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.<anonymous> (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.<anonymous> (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 6m
    
    271 packages are looking for funding
      run `npm fund` for details        
    
    26 vulnerabilities (3 moderate, 22 high, 1 critical)
    
    To address all issues, run:
      npm audit fix
    
    Run `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> 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168

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

    PS F:\download\pc-nrfconnect-ble> npm run dev
    
    > pc-nrfconnect-ble@4.0.2 dev
    > webpack watch --mode development
    
    Hash: fbf658d3a85ac09cd845
    Version: webpack 4.46.0
    Time: 30452ms
    Built at: 2022/11/22 18:24:42
                Asset      Size  Chunks             Chunk Names
            bundle.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
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30

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

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

  • 相关阅读:
    jsp数据交互(二)
    MySQL——进阶
    从一个页面跳转到目标页面之后,对应的顶部路由高亮
    【iOS】OC关键字总结及底层原理(上)
    day36 | 435. 无重叠区间、763.划分字母区间、56. 合并区间
    不适合学习编程的人是你吗?
    【项目】若依框架如何实现批量导入,并解析出表中内容返回给前端? - poi依赖
    shiro回话管理
    6、堆(新生区,永久区,堆内存调优(jvm调优))
    单商户商城系统功能拆解20—售后订单
  • 原文地址:https://blog.csdn.net/chengdong1314/article/details/127988533