# nRF Toolbox
The nRF Toolbox is a container app that stores your Nordic Semiconductor apps for Bluetooth Smart in one location.
It contains applications demonstrating Bluetooth Smart profiles:
* **Cycling Speed and Cadence**,
* **Running Speed and Cadence**,
* **Heart Rate Monitor**,
* **Blood Pressure Monitor**,
* **Health Thermometer Monitor**,
* **Glucose Monitor**,
* **Continuous Glucose Monitor** - NEW: profile added,
* **Proximity Monitor** - NEW: multiple connections supported.
Since version 1.10.0 the *nRF Toolbox* also supports the **Nordic UART Service** which may be used for bidirectional text communication between devices.
**Note:** To get a smaller version, with only the DFU profile, switch to the *only_dfu* branch.
### BleManager and how to use it
The nRF Toolbox application is a reference design demonstrating how to use the BLE API on Android. The main class responsible for managing connection to a single device is called [BleManager](app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleManager.java). Each of the profiles listed above is using this manager and overriding it to add some profile-related functionality. The BleManager sends events using the [BleManagerCallbacks](app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleManagerCallbacks.java) interface, which should be impemented by your controller. A profile's BleManager should override the BleManager and implement required methods, that is:
* ```Deque<Request> initGatt(BluetoothGatt)``` - method that definies initialization queue
* ```boolean isRequiredServiceSupported(BluetoothGatt)``` - method that verifies if the connected device is supported by the profile
* ```void onDeviceDisconnected()``` - method that releases device's resources
There are 3 different solutions how to use the manager shown in different profiles. The very basic approach is used by the BPM, HRM and GLS profiles. Each of those activities holds a static reference to the manager. Keeping the manager as a static object protects from disposing it when device orientation changes and the activities are being destroyed and recreated. However, this approach does not allow to keep the connections in background mode and therfore is not a solution that should be used in any final application.
A better implementation may be found in CSC, RSC, HTM and CGM. The BleManager instance is maintained by the running service. The service is started in order to connect to a device and stopped when user decides to disconnect from it. When an activity is destroyed it unbinds from the service, but the service is still running, so the incoming data may continue to be handled. All device-related data are kept be the service and may be obtained by a new activity when it binds to it in order to be shown to the user.
At last, the Proximity profile allows to connect to multiple sensors at the same time. It uses a different service implementation but still the BleManager is used to manage each connection. If the [shouldAutoConnect()](https://github.com/NordicSemiconductor/Android-nRF-Toolbox/blob/master/app/src/main/java/no/nordicsemi/android/nrftoolbox/profile/BleManager.java#L181) method returns true for a connection, the manager will try to reconnect automatically to the device if a link was lost. You will also be notified about a device that got away using ```onLinklossOccur(BluetoothDevice)```.
The BleMulticonnectProfileService implementation, used by Proximity profile, does not save addresses of connected devices. When the service is killed it will not be able to reconnect to them after it's restarted, so this feature has been disabled. Also, when user removes the nRF Toolbox app from Recents, the service will be killed and all devices will be disconnected automatically. To change this behaviour a service would have to either save the addresses and reconnect to devices after it has restarted (but then removing the app from Recents would cause disconnection and immediate reconnection as the service is then killed and moved to another process), or would have to be implemented in a way that is using another [process](https://developer.android.com/guide/topics/manifest/service-element.html#proc). Then, however, it is not possible to bind to such service and data must be exchanged using a [Messenger](https://developer.android.com/reference/android/app/Service.html#RemoteMessengerServiceSample). Such approach is not demonstrated in nRF Toolbox.
### Nordic UART Service
The UART profile allows for fast prototyping of devices. The service itself it very simple, having just 2 characteristics, one for sending data and one for receiving. The data may be any byte array but it is very often used with just text. Each UART configuration in the nRF Toolbox consists of 9 programmable buttons. Each of them, when pressed, will send the stored command to the device. You may export your configuration to XML and share between other devices. Swipe the screen to right to show the log with all events.
Since nRF Toolbox version 1.16.0 the UART profile supports also Android Wear devices (watches). If you have an Android watch, the application will automatically be installed on it after you install or update the application on the phone. Before you start playing with the watch, please open the UART profile on the phone so it could share your configurations to all wearables.
Android Wear 2.0 support has been added in nRF Toolbox version 2.2.2. Now, after installing the app on the phone, you will be notified on the watch to download the watch-APK onto the watch. The app on the watch is not standalone. UART configurations must be configured on the phone.
The wearable application may work in 2 modes: as a remote control of the phone, or directly connected to a UART device.
1. Connect your phone to the UART device. After few seconds you should get a notification on the watch that your device is now connected. Swipe it left to see Disconnect button (will send a message to the phone to terminate the connection with UART target) and Open button. Click the Open button to see a list of your UART configurations. Click one and see the list of active buttons. When pressed the button will send a message to the phone using Google Play Services and the phone will send the command to the target device. In this mode you may have more than one watch connected to the phone and use both as remote controls.
![Scenario 1](resources/scenario_1.png)
2. Open the applications menu on Android Wear watch and click nRF Toolbox. The watch will now scan for all nearby Bluetooth Smart devices and show you them on a list. Select your UART device to connect to it. A list of your configurations will be shown, like in 1. As that was a direct connection from the watch to the UART target the phone, or any other watch will not be notified about it.
![Scenario 2](resources/scenario_2.png)
### Device Firmware Update
The **Device Firmware Update (DFU)** profile allows you to update the application, bootloader and/or the Soft Device image over-the-air (OTA). It is compatible with Nordic Semiconductor nRF5 devices that have the SoftDevice and DFU Bootloader flashed. From version 1.11.0 onward, the nRF Toolbox has allowed to send the init packet (required since SDK 7.0). More information about the init packet may be found here: [init packet handling](https://github.com/NordicSemiconductor/Android-nRF-Connect/tree/master/init%20packet%20handling).
The DFU has the following features:
- Scans for devices that are in DFU mode.
- Connects to devices in DFU mode and uploads the selected firmware (soft device, bootloader and/or application).
- Allows HEX or BIN file upload through your phone or tablet.
- Allows to update a soft device and bootloader from ZIP in one connection.
- Pause, resume, and cancel file uploads.
- Works in portrait and landscape orientation.
- Includes pre-installed examples that consist of the Bluetooth Smart heart rate service and r
没有合适的资源?快使用搜索试试~ 我知道了~
Nordic的nRF-Toolbox的源代码
共552个文件
png:181个
xml:162个
java:147个
需积分: 48 59 下载量 176 浏览量
2017-09-23
10:42:34
上传
评论 1
收藏 8.05MB ZIP 举报
温馨提示
nRF-Toolbox是Nordic提供的用于检查和调试蓝牙设备特别是低功耗蓝牙的工具,虽说是nordic的,但实际这是一个同样程序,任何其他蓝牙4.0以上的设备都可以连接。这个工具可以让开发者看到设备的广播信息以及一对服务信息,包括uuid值等,同时还可以通过这个工具往设备传送数据。但是一个字节一个字节发数据显然太慢了,所以这个源代码可以让你在原有程序的基础上进行改动,以便适合你自己的数据传输
资源推荐
资源详情
资源评论
收起资源包目录
Nordic的nRF-Toolbox的源代码 (552个子文件)
play-services-7.8.87.aar 4.9MB
play-services-base-7.8.87.aar 1.13MB
play-services-wearable-7.8.87.aar 207KB
dfu_win_3_1.bat 9KB
gradlew.bat 2KB
ble_app_hrs_dfu_s110_v7_1_0_ext_init.dat 16B
blinky_s110_v7_1_0_ext_init.dat 16B
.gitignore 61B
.gitignore 13B
.gitignore 13B
.gitignore 12B
build.gradle 2KB
build.gradle 2KB
build.gradle 1KB
build.gradle 735B
settings.gradle 204B
gradlew 5KB
ble_app_hrs_s110_v7_0_0.hex 59KB
ble_app_rscs_s110_v7_0_0.hex 58KB
ble_app_hrs_s110_v6_0_0.hex 53KB
ble_app_rscs_s110_v6_0_0.hex 51KB
ble_app_hrs_dfu_s110_v7_1_0.hex 46KB
blinky_arm_s110_v7_0_0.hex 3KB
blinky_s110_v7_1_0.hex 2KB
achartengine-1.1.0.jar 118KB
gradle-wrapper.jar 49KB
BleManager.java 69KB
BleManager.java 37KB
DfuActivity.java 33KB
UARTActivity.java 32KB
BleProfileServiceReadyActivity.java 24KB
BleMulticonnectProfileService.java 24KB
GlucoseManager.java 23KB
BleProfileService.java 21KB
BleMulticonnectProfileServiceReadyActivity.java 20KB
ProximityService.java 20KB
CGMSManager.java 18KB
ProximityServerManager.java 17KB
BleProfileApi.java 16KB
BleProfileExpandableListActivity.java 15KB
BleProfileActivity.java 15KB
BleProfileService.java 14KB
CGMSpecificOpsControlPointParser.java 13KB
UARTService.java 13KB
CGMService.java 12KB
ExpandableListActivity.java 12KB
ScannerFragment.java 11KB
RSCActivity.java 11KB
UARTCommandsActivity.java 11KB
CSCService.java 11KB
UARTLogFragment.java 11KB
DatabaseHelper.java 10KB
CGMMeasurementParser.java 9KB
RSCService.java 9KB
CSCActivity.java 9KB
UARTConfigurationsActivity.java 9KB
FeaturesActivity.java 9KB
CGMSActivity.java 9KB
ExpandableRecordAdapter.java 8KB
FileHelper.java 8KB
DevicesAdapter.java 8KB
HRSActivity.java 8KB
BPMManager.java 8KB
ScannerActivity.java 7KB
GlucoseMeasurementParser.java 7KB
TemplateService.java 7KB
GlucoseActivity.java 7KB
RecordAccessControlPointParser.java 7KB
HTSActivity.java 7KB
HTSService.java 7KB
DeviceListAdapter.java 7KB
UARTProfile.java 7KB
UARTManager.java 7KB
UARTEditDialog.java 7KB
BleManagerCallbacks.java 7KB
GlucoseMeasurementContextParser.java 6KB
HRSManager.java 6KB
HTSManager.java 6KB
BPMActivity.java 6KB
BleProfile.java 6KB
DeviceAdapter.java 6KB
TemplateManager.java 6KB
UARTConfigurationSynchronizer.java 6KB
TemplateActivity.java 6KB
UARTNewConfigurationDialogFragment.java 5KB
ProximityManager.java 5KB
RSCManager.java 5KB
ProximityActivity.java 5KB
BleManagerCallbacks.java 5KB
GattError.java 5KB
UARTConfigurationsAdapter.java 5KB
SettingsFragment.java 5KB
UARTConfigurationItemLayout.java 5KB
ForegroundRelativeLayout.java 5KB
CSCManager.java 5KB
ForegroundLinearLayout.java 5KB
BloodPressureMeasurementParser.java 5KB
UARTControlFragment.java 5KB
DeviceItemLayout.java 5KB
DividerItemDecoration.java 5KB
共 552 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
HelloWorm
- 粉丝: 2
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功