• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

NordicSemiconductor/Android-nRF-Mesh-Library: The Bluetooth Mesh Provisioner and ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(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-Library

Download

About

The Android-nRF-Mesh-Library allows provisioning and sending messages to Bluetooth Mesh devices.

Bluetooth Mesh specification may be found here: https://www.bluetooth.com/specifications/mesh-specifications/

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.

Features

The library is compatible with

  • Mesh Profile 1.0.1,
  • Mesh Model 1.0.1,
  • Mesh Device Properties 2.

The mesh network configuration (JSON schema) is compatible with

  • Mesh Configuration Database Profile 1.0.

Bluetooth mesh specifications are available at Bluetooth.com.

Supported features

  1. Provisioning with all features that available in Bluetooth Mesh Profile 1.0.1, including OOB Public Key and all types of OOB.
  2. Managing Provisioners, Network Keys, Application Keys, resetting network, etc.
  3. All network layers are working.
  4. Parsing Secure Network beacons.
  5. Adding, removing and refreshing Network and Application Keys to Nodes.
  6. Binding and unbinding Application Keys to Models.
  7. Setting and clearing publication to a Model.
  8. Setting and removing subscriptions to a Model.
  9. Groups, including those with Virtual Addresses.
  10. UI for controlling groups (Generic OnOff and Generic Level (delta) are supported).
  11. Handling Configuration Server message sent by other Provisioner.
  12. Generic OnOff and Vendor model have dedicated controls in sample app.
  13. Proxy Filter.
  14. IV Index update (handling updates received in Secure Network beacons).

Requirements

  • Android Studio
  • An Android device with BLE capabilities

Optional

  • nRF5 based Development Kit(s) to test the sample firmwares on.

Installation

  • Open 'Android-nRF-Mesh-Library' project using Android Studio.
  • Connect an Android device.
  • Build and run project.
  • To be able to quickly start testing, use the bundled firmwares directory named ExampleFirmwares that includes a light server (Light source) and a light client (Switch) firmwares. those firmwares will work on a nrf52832 DevKit.

How to include it in your own project

Maven Central

The 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'

Manual

Clone this project and add ble module as a dependency to your project:

  1. In settings.gradle file add the following lines:
include ':mesh'
  1. In app/build.gradle file add implementation project(':mesh') inside dependencies.
  2. Sync project and build it.

See example projects in this repository.

Sample

To 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 mMeshManagerApi.handleNotifications(mtu, pdu); and mMeshManagerApi.handleWriteCallbacks(mtu, pdu); to send and receive data.

Provisioning a node in to the network can be done in three steps,

  1. Connect to the node advertising with the Mesh Provisioning UUID
  2. Identify the node to be provisioned, where the devices will blink, vibrate or beep depending on the capabilities for pre-defined duration of 5 seconds. This is useful when provisioning multiple nodes. To identify a node call
    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 MeshNetwork object to edit Mesh Network properties such as Network name, Provisioners and their properties (Name Address, TTL and Address Ranges), Network Keys, App Keys.

Following is an example on how to send a GenericOnOffSet message.

    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.

Author

Mobile Applications Team, Nordic Semiconductor ASA.

Contact: roshanrajaratnam roshan.rajaratnam@nordicsemi.no

License

The Android-nRF-Mesh-Library is available under BSD 3-Clause license. See the LICENSE file for more info.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap