Device Control SDK Usage
1. Overview
This article mainly introduces how to use the device control SDK to make Api calls.
2. Preconditions
- Confirm completion Preparation
- Confirm the completion of Environment Build
- CompletedDevice Control SDK Integration
2. Use
3.1 Jump to the specified device page
LumiRMUIManager.getInstance()
.getRouter()
.launchRMPage(
context,
deviceModel,
deviceId,
isSharingDevice,
pageName );
Parameter Description
Field | Type of data | Describe | Access channel |
---|---|---|---|
context | String | Context | / |
deviceModel | String | Device model value | After the device is configured successfully, it can be obtained from the cloud. |
deviceId | String | Device Id | After the device is configured successfully, it can be obtained from the cloud. |
isSharingDevice | boolean | Whether the device is a shared device will affect the display of more settings | trueTrue means to share the device, false otherwise |
pageName | String | PageId | Refer to the value below, depending on the specific business, usually the default control |
PageName value description
Value | Describe |
---|---|
control | Device details page |
detail | Device Settings Page |
3.2 Event Listener
When the user clicks some buttons or meets other conditions during the page operation, the event callback can be obtained through the event listener. For example, click a button to jump to a page in the host App, or a third-party custom event.
//Register
LumiRMUIManager.getInstance()
.getEventDispatcher()
.register(new RMMsgObserver<String>() {
@Override
public void onHandleMessage(String message) {
}
});
//Unregister
LumiRMUIManager.getInstance()
.getEventDispatcher()
.unregister(observer);
3.3 Device Profile
3.3.1 Rely on local configuration files
If the project needs to use local configuration files, it needs to:
- Put the configuration file in the assets/deviceRes directory.
- Additional parameters need to be added when the SDK is initialized:
val extensions = HashMap<String, String>()
//Device control using local resources
extensions.put("RMSDK_K_LOCAL_RES", "true")
LumiCoreManager.getInstance()
.init(
application,
true,
LumiCoreManager.LumiCoreSDKConfig.builder()
...
.extensions(extensions)
.build()
)
The local configuration file needs to be generated according to the specific equipment and business type, please contact the business to obtain it.
3.3.2 Rely on remote configuration files
Relying on remote configuration files, it can support device control for most services and hot update of UI.
This function involves the management and distribution of remote configuration files, and is not available for external use at the moment. If you need it, please contact the business.