Batch provisioning for Bluetooth Mesh

Updated at:

This topic describes how to use the iOS SDK to batch provision Bluetooth Mesh devices.

Dependencies

Dependent SDK

Overview

IMSMeshSdk

Provides basic Bluetooth Mesh features.

IMSDeviceCenter

A centralized entry point for network provisioning.

IMSApiClient

Provides API channel capabilities and basic environment configuration information.

Initialization

For information about initialization, see SDK initialization.

Instructions

  • Provision a Mesh device

    For information about Mesh device discovery and single-device provisioning, see Provisioning SDK.

  • Batch provision Mesh devices

    • List of devices to be provisioned

      IMLCandDeviceModel is returned by device discovery. Do not modify it.
      Note

      The (IMLCandDeviceModel *)model is created from locally discovered devices or a product list pulled from the cloud.

      The following table describes the properties of IMLCandDeviceModel.

      Property

      Type

      Required

      Description

      linkType

      NS_ENUM

      Yes

      productId

      NSString

      Yes

      mac

      NSString

      Yes

      productKey

      NSString

      Yes

      authFlag

      BOOL

      Yes

      random

      NSString

      Yes

      authDevice

      NSString

      Yes

      subDeviceId

      NSString

      Yes

      confirmCloud

      NSString

      Yes

      addDeviceFrom (for gateways only)

      NSString

      Yes

      meshGatewayIotId (for gateways only)

      NSString

      Yes

      meshDeviceId (for gateways only)

      NSString

      Yes

      deviceId (for gateways only)

      NSString

      No

      gatewayDeviceName (for gateways only)

      NSString

      Yes

      gatewayProductKey (for gateways only)

      NSString

      Yes

    • Start provisioning

      // Import the header file.
      #import <IMSDeviceCenter/IMLDeviceCenter.h>
      
      
      /**
       Batch provision Mesh devices.
       Currently, only devices with a LinkType of ForceAliLinkTypeAppMesh or ForceAliLinkTypeGatewayMesh can be provisioned.
       After the devices are added, provisioning starts immediately.
      */
      - (LKDCErrCode)startConcurrentAddDevices:(nonnull NSArray<IMLCandDeviceModel *> *)devList delegate:(nullable id<ILKConcurrentAddDeviceNotifier>)delegate;
    • Provisioning result callback

      // Import the header file.
      #import <IMSDeviceCenter/IMLDeviceCenter.h>
      
      - (void)notifyConcurrentProvisionResult:(nonnull IMLCandDeviceModel *)candDeviceModel withProvisionError:(nullable NSError *)provisionError{
          if (provisionError){
              NSLog(@"Provisioning failed. Error message: %@", provisionError);
          }else{
              NSLog(@"Provisioning successful: %@",candDeviceModel);
          }
      }
    • Stop provisioning

      // Import the header file.
      #import <IMSDeviceCenter/IMLDeviceCenter.h>
      
      [kLkAddDevBiz stopAddDevice];
      [kLkAddDevBiz stopConcurrentAddDevice];
  • Gateway control

    For information about gateway control, see Thing Specification Language model SDK.