在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):NordicSemiconductor/Android-nRF-Mesh-Library开源软件地址(OpenSource Url):https://github.com/NordicSemiconductor/Android-nRF-Mesh-Library开源编程语言(OpenSource Language):Java 99.1%开源软件介绍(OpenSource Introduction):Android-nRF-Mesh-LibraryAboutThe Android-nRF-Mesh-Library allows provisioning and sending messages to Bluetooth Mesh devices.
The library is compatible with version 1.0.1 of the Bluetooth Mesh Profile Specification. nRF Mesh for Android is supported on Android devices running Android 4.3 and onwards. FeaturesThe library is compatible with
The mesh network configuration (JSON schema) is compatible with
Bluetooth mesh specifications are available at Bluetooth.com. Supported features
Requirements
Optional
Installation
How to include it in your own projectMaven CentralThe library may be found on the Maven Central repository. Add it to your project by adding the following dependency: implementation 'no.nordicsemi.android:mesh:3.2.4' ManualClone this project and add ble module as a dependency to your project:
include ':mesh'
See example projects in this repository. SampleTo start using the library in your own project take a look at the following snippet. MeshManagerApi mMeshManagerApi = new MeshManagerApi(context);
mMeshManagerApi.setMeshManagerCallbacks(this);
mMeshManagerApi.setProvisioningStatusCallbacks(this);
mMeshManagerApi.setMeshStatusCallbacks(this);
mMeshManagerApi.loadMeshNetwork(); The sample application uses the Android BLE Library by Nordic Semiconductor ASA and is recommended to use this dependency in your application. Follow the snippet below when using the Android-Ble-Library in combination with the Android-Mesh-Library to send and receive data. @Override
public void onDataReceived(final BluetoothDevice bluetoothDevice, final int mtu, final byte[] pdu) {
mMeshManagerApi.handleNotifications(mtu, pdu);
}
@Override
public void onDataSent(final BluetoothDevice device, final int mtu, final byte[] pdu) {
mMeshManagerApi.handleWriteCallbacks(mtu, pdu);
} When using your own ble library/module call the Provisioning a node in to the network can be done in three steps,
void identifyNode(@NonNull final UUID deviceUUID) throws IllegalArgumentException; by passing the device uuid of the unprovisioned mesh node. or call void identifyNode(@NonNull final UUID deviceUUID, final int attentionTimer) throws IllegalArgumentException; by passing the device uuid of the unprovisioned mesh node and the desired duration. 3. Depending on the identified device capabilities, call one of the following functions to provision the node. void startProvisioning(
@NonNull final UnprovisionedMeshNode unprovisionedMeshNode
) throws IllegalArgumentException; or void startProvisioningWithStaticOOB(
@NonNull final UnprovisionedMeshNode unprovisionedMeshNode
) throws IllegalArgumentException; or void startProvisioningWithOutputOOB(
@NonNull final UnprovisionedMeshNode unprovisionedMeshNode,
@NonNull final OutputOOBAction oobAction
) throws IllegalArgumentException; or void startProvisioningWithInputOOB(
@NonNull final UnprovisionedMeshNode unprovisionedMeshNode,
@NonNull final InputOOBAction oobAction
) throws IllegalArgumentException; Use the Following is an example on how to send a final GenericOnOffSet genericOnOffSet = new GenericOnOffSet(
appKey, // App Key to sign the request with
state, // The new state
new Random().nextInt()
);
mMeshManagerAPi.createMeshPdu(address, genericOnOffSet); and Config messages can also be sent similarly. AuthorMobile Applications Team, Nordic Semiconductor ASA. Contact: roshanrajaratnam [email protected] LicenseThe Android-nRF-Mesh-Library is available under BSD 3-Clause license. See the LICENSE file for more info. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论