Last Updated on : 2024-09-25 01:52:45download
Due to the characteristics of a Matter device, all its capabilities are implemented based on Matter fabrics. Before a Matter device can be paired, controlled, or managed, you must make API requests to configure basic information about the Matter device. This configuration must be finished before any Matter services are implemented.
A fabric is a group of networked devices (also known as nodes) that share the same security domain. This enables secure communications among these nodes within the fabric. Nodes in the same fabric share the same Certificate Authority’s (CA) top-level certificate (Root of Trust) and within the context of the CA, a unique 64-bit identifier named Fabric ID.
Prerequisites
Before you start, the steps in Fast Integration with Smart Life App SDK must be finished.
Scope of application
All Matter devices are supported.
Requirements for devices
If you require UI BizBundles, the version of Smart Life App SDK must be the same as that of the UI BizBundles to ensure stable pairing and control of devices.
The following figure shows the sequence in which basic Matter information is configured.
Information about Matter is bound with homes. Therefore, at the end of the operation of switching between homes or initially loading a home, call - initFabric
to get information about the fabric that is bound with the home.
API description
void initFabric( Context context, long gid, IThingDataCallback<OpenFabricInfo> callback);
Parameters
Parameter | Description |
---|---|
Context | The context. |
gid | The value of HomeID for the current home. |
callback | The callback. |
Example
IThingMatterFabricManager fabricManager = ThingHomeSdk.getFabricManager();
fabricManager.initFabric(getContext(), spaceId, new IThingDataCallback<OpenFabricInfo>() {
@Override
public void onSuccess(OpenFabricInfo result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Different from other types of devices, certain information about Matter devices must be prepared in advance. For this purpose, at the end of loading the list of devices in a home and fabric information, call getDevicesFabricNodes
to handle Matter devices for the specified home.
API description
void getDevicesFabricNodes(Set<String> devIds, IThingDataCallback<ArrayList<DeviceNodeBean>> listener);
Parameters
Parameter | Description |
---|---|
devIds | The list of device IDs. |
Example
List<DeviceBean> deviceList = homeBean.getDeviceList();
Set<String> devIds = new HashSet<>();
devIds.add(deviceBean.getDevId());
fabricManager.getDevicesFabricNodes(devIds, new IThingDataCallback<ArrayList<DeviceNodeBean>>() {
@Override
public void onSuccess(ArrayList<DeviceNodeBean> result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback