AN1200.0: Bluetooth Mesh V1.x For IOS And Android ADK

Transcription

AN1200.0: Bluetooth Mesh 1.x for iOS andAndroid ADKThis document describes how to get started with Bluetooth Meshapplication development for iOS and Android smart phones andtablets using the Silicon Labs Bluetooth Mesh for iOS and AndroidApplication Development Kit (ADK).The document also provides a high-level architecture overview of the Silicon Labs Bluetooth Mesh library, how it relates to the Bluetooth LE stack provided by the iOS and Android operating systems and what APIs are available. It also contains code snippets andexplanations for the most common Bluetooth Mesh use cases.The Bluetooth Mesh mobile app is intended to demonstrate the Silicon Labs BluetoothMesh technology together with the Bluetooth Mesh SDK sample apps. The mobile appis a reference app for the Bluetooth Mesh mobile ADK but it should not be taken as astarting point for customers to create their own mobile apps.KEY POINTS Introduction to the Silicon Labs’ Bluetooth mesh for iOS and Android ADK Prerequisites for development Contents of the Bluetooth mesh iOS andAndroid ADK Getting started with development Bluetooth mesh structure overview ADK use cases API references for iOS and Android Model descriptions Import and Export instructions Using multiple networks Code examplessilabs.com Building a more connected world.Rev. 1.9

AN1200.0: Bluetooth Mesh v1.x for iOS and Android ADKContentsTable of Contents1Introduction. 02Prerequisites for Development . 32.1iOS . 3Complying with Encryption Export Regulations. 42.2Android. 4Known Bluetooth Issues . .2.1.3.32.2.1.3.42.2.1.3.52.2.1.42.2.1.53Scanning . 5Connecting. 5Auto connect . 6Managing a Connection . 6Connection State . 6Changing MTU. 6Discovering Services . 6Reading/Writing Characteristics . 6Disconnecting . 6Errors . 7Devices with Low Bluetooth LE Quality. 7Contents of Bluetooth Mesh for iOS and Android ADK. 83.1The Bluetooth Mesh Stack Library . 8iOS . 8Android . 843.2Bluetooth Mesh Network and Device Database . 83.3Reference Application Source Code . 83.4Documentation . 8Getting Started with Development . 94.1iOS . 94.2Android. 115Bluetooth Mesh Structure Overview . 166Bluetooth Mesh: Using the ADK with a Simple Use Case . 176.1Example 1: GenericOnOff Get for element . 17Provisioning a Device . 17Proxy Connection and Configuration . 18Binding Models . 19Sending the Message . 196.2Example 2: GenericOnOff Get for group . 20Provisioning Devices . 20Proxy Connection and Configuration . 21Binding models . 22silabs.com Building a more connected world.Rev. 1.9 1

AN1200.0: Bluetooth Mesh v1.x for iOS and Android ADKContentsSending the Message . 237Bluetooth Mesh API Reference for iOS . 247.1Errors . 247.2Initializing the BluetoothMesh . 24BluetoothMesh . 24Set Up Supported Vendor Models . 24Set Up Mesh Limits . 257.3Request IV Index Update . 25Text IV Update . 26IV Index Recovery. 267.4Get Secure Network Beacon Information . 267.5Server Configuration . 26Time to Live . 267.6Set Up Bluetooth Layer (SBMConnectableDevice) . 27Device Advertisement Data. 27Device UUID . 27Device Name . 28Device Connection State . 28Connect to the Device . 28Disconnect from the Device . 28Check if a Device Contains a Service . 29Maximum Transmission Unit for Given Device Service . 29Write Data to a Given Service and Characteristic . 30Subscribe to a Given Service and Characteristic . 31Unsubscribe from a Given Service and Characteristic . 327.7Provision a Device to a Subnet . 32Create Network . 33Create Subnet . 33Find Non-Provisioned Bluetooth Devices . 33Provision the Device . 337.7.4.17.7.4.27.7.4.2.17.7.4.37.7.4.3.1In-Band Provisioning . 34OOB Provisioning . 34SBMProvisionerOOB Protocol . 34Provisioning with Proxy Session . 38One GATT Connection for Provisioning and Proxy Session . 397.8Add a Node to Another Subnet . 397.9Remove a Node from a Subnet . 39silabs.com Building a more connected world.Rev. 1.9 2

AN1200.0: Bluetooth Mesh v1.x for iOS and Android ADKContents7.10Removing Subnet . 407.11Factory reset node. 407.12Configure Node Default TTL . 407.13Connect with a Subnet . 40Find All Proxies in the Device Range . 40Get Node Representing a Given Device . 41Get Node Representing a Given Device in a Specific Subnet . 417.14Create a Group in a Given Subnet . 417.15Remove Group . 417.16Add a Node to a Group . 427.17Remove a Node from a Group. 427.18Bind a Model with a Group . 427.19Unbind a Model from a Group . 437.20Add Subscription Settings to a Model . 43SIG Model . 43Vendor Model . 437.21Add Publication Settings to a Model . 43SIG Model . 447.21.1.17.21.1.2Publish via SBMGroup Address . 44Publish Directly to the Provisioner . 44Vendor Model . 447.21.2.17.21.2.27.22Publish via SBMGroup Address . 44Publish Directly to the Provisioner . 45Control Node Functionality . 45Get Value for a Single SIG Model from the Node . 45Get Value for All Specific SIG Models Bound with a Group. 45Set Value for a Single SIG Model from the Node . 46Set Value for All Specific SIG Models Bound with the Group . 47Control Sensor Models . 477.22.5.1Get Sensor Model Values . .107.22.5.2Get Sensor Descriptors from the Node . 48Get Sensor State from the Node . 48Get Sensor Cadence from the Node . 49Get Sensor Setting from the Node . 49Get Sensor Settings from the Node . 50Get Sensor Descriptor from All Nodes in the Group . 50Get Sensor State from All Nodes in the Group . 51Get Sensor Cadence from All Nodes in the Group . 51Get Sensor Setting from All Nodes in the Group . 52Get Sensor Settings from All Nodes in the Group . 52Set Sensor Server Setup Model Values. 537.22.5.2.1Set Sensor Cadence within the Node . 53silabs.com Building a more connected world.Rev. 1.9 3

AN1200.0: Bluetooth Mesh v1.x for iOS and Android ADKContents7.22.5.2.27.22.5.2.37.22.5.2.4Set Sensor Setting within the Node . 54Set Sensor Cadence within All Nodes in the Group . 54Set Sensor Setting within All Nodes in the Group . 55Subscribe to Publications sent by SIG Model . 55Register a Local Vendor Model (SBMLocalVendorModel) . 567.22.7.17.22.7.2Create SBMLocalVendorSettings . 56Create SBMLocalVendorRegistrator . 567.22.7.2.17.22.7.2.2Register a Local Vendor Model . 56Unregister a Local Vendor Model. 56Local Vendor Model Binding with Application Key. 577.22.8.17.22.8.2Bind Local Vendor Model with Application Key . 57Unbind Local Vendor Model from Application Key . 57Manage Subscriptions to the SBMVendorModel . 577.22.9.1Sign Up for Publications. 577.22.9.1.17.22.9.1.27.22.9.2Publications sent to SBMGroup Address . 57Notifications Sent to SBMNode Address. 58Sign Out from Publications . 587.22.9.2.17.22.9.2.2Sign Out from Publications Sent to the SBMGroup Address . 58Sign Out from Publications Sent to the SBMNode Address . 58Send Value to SBMVendorModel . 587.22.10.17.22.10.27.22.10.37.22.10.4Create Implementation of the SBMControlValueSetVendorModel Protocol . 58Prepare Message to Send . 59Send Prepared Message to the Single SBMVendorModel on the SBMNode. 60Send Prepared Message to the SBMGroup . 60Control Light Control (LC) Models . 617.22.11.1Get LC Model Values . et LC Setup Model Values . et LC Mode from the Node . 61Get LC Occupancy Mode from the Node . 61Get LC Light On-Off from the Node . 62Get LC Property from the Node . 62Get LC Mode from All Nodes in the Group . 63Get LC Occupancy Mode from All Nodes in the Group. 63Get LC Light On-Off from All Nodes in the Group . 64Get LC Property from All Nodes in the Group . 65Set LC Mode within the Node . 66Set LC Occupancy Mode within the Node . 66Set LC Light On-Off within the Node . 67Set LC Property within the Node . 68Set LC Mode within All Nodes in the Group . 69Set LC Occupancy Mode within All Nodes in the Group . 69Set LC Light On-Off within All Nodes in the Group . 70Set LC Property within All Nodes in the Group . 71Subscriptions . 727.22.11.3.17.22.11.3.2Subscription to Status Publications from a Single Node . 72Subscription to Status Publications from a Group of Nodes . 73Control Scene Models . 737.22.12.1Get Scene Model Values.

Android ADK This document describes how to get started with Bluetooth Mesh application development for iOS and smart phones and Android tablets using the Silicon Labs Bluetooth Mesh for iOS and Android Application Development Kit (ADK). The document also provides a high-level architecture overview of the Silicon Labs Blue-