Device Control SDK Usage

1. Overview

This article describes how to use the Device Control SDK APIs, such as navigating to device pages.

Important Change

Starting from the latest SDK version, device page navigation is unified through LMSDKDeviceRouter.framework. This framework automatically routes to the correct page based on the device access type (native, RN, H5, camera, etc.). All new integrations should use this API.

The legacy approach of calling vertical SDK navigation APIs directly has been deprecated. Please use LMSDKDeviceRouter for all device page navigation.

2. Preconditions

  1. Complete Preparation
  2. Complete Environment Build
  3. Complete Device Control SDK Integration

3. Usage

Import the header:

#import <LMSDKDeviceRouter/LMSDKDeviceRouter.h>
import LMSDKDeviceRouter

Objective-C example:

[LMSDKDeviceRouter pushToDeviceControlPageWithDevice:device
                                navigationController:self.navigationController
                                            animated:YES
                                          completion:^(NSError * _Nullable error, id _Nullable result) {
    if (error) {
        // Handle navigation failure
    }
}];

Swift example:

LMSDKDeviceRouter.pushToDeviceControlPage(with: device,
                                          navigationController: self.navigationController,
                                          animated: true) { error, result in
    if let error = error {
        // Handle navigation failure
    }
}

Parameter description

Field Type Description Source
device LMDevice Device info object Obtained from cloud after device pairing
navigationController UINavigationController Current navigation controller Provided by host app
animated BOOL Whether to animate
completion Block Completion callback; non-nil error indicates failure

LMSDKDeviceRouter automatically identifies the device access type by model and navigates to the corresponding page (native control, RN plugin, camera playback, etc.). You no longer need to manually determine the device category and call different SDK APIs.

3.2 Navigate to Device Settings / Detail Page

[LMSDKDeviceRouter pushToDeviceDetailPageWithDevice:device
                               navigationController:self.navigationController
                                           animated:YES
                                         completion:^(NSError * _Nullable error, id _Nullable result) {
}];
LMSDKDeviceRouter.pushToDeviceDetailPage(with: device,
                                         navigationController: self.navigationController,
                                         animated: true) { error, result in
}

3.3 Navigate by Page Type

When you need to explicitly specify the target page:

[LMSDKDeviceRouter pushToDevicePageWithDevice:device
                                     pageType:LMSDKDevicePageTypeControl
                         navigationController:self.navigationController
                                     animated:YES
                                  extraParams:nil
                                   completion:^(NSError * _Nullable error, id _Nullable result) {
}];

pageType values

Enum Description
LMSDKDevicePageTypeControl Device control home page
LMSDKDevicePageTypeDetail Device settings / detail page

4. Notes

Scenario API Framework
Navigate to device control home pushToDeviceControlPageWithDevice:... LMSDKDeviceRouter
Navigate to device settings pushToDeviceDetailPageWithDevice:... LMSDKDeviceRouter
Navigate by page type pushToDevicePageWithDevice:pageType:... LMSDKDeviceRouter

For camera devices, using LMSDKDeviceRouter to navigate to the control home page automatically routes to the camera playback page. See Camera SDK Integration.

LHDeviceRouter is internal routing in LMMeshDriver_UI for SDK widget callbacks; host apps should not call it directly.

lumi LogoCopyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2026-08-26 17:01:17

results matching ""

    No results matching ""