新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OS開發(fā)CLUSTER相關(guān)應(yīng)用
場景介紹

通常在汽車使用過程中,駕駛員需要設(shè)置儀表屏亮度、時間單位等參數(shù),將電臺、音樂等娛樂數(shù)據(jù)或?qū)Ш綌?shù)據(jù)顯示在儀表屏上,因此 HarmonyOS 提供了和儀表交互相關(guān)的接口,供三方開發(fā)者開發(fā)儀表設(shè)置、顯示等相關(guān)應(yīng)用。
說明
該功能與具體的車廠車型相關(guān),部分低配車型可能不具備該項(xiàng)功能。
接口說明
目前Cluster提供的功能有如下表所示:
| 接口名 | 描述 |
|---|---|
| getClusterSignal() | 獲取指定Cluster信號值。 |
| setClusterActuator() | 設(shè)置指定Cluster執(zhí)行器值。 |
| sendClusterSignal() | 發(fā)送指定字節(jié)數(shù)組類型的Cluster信號請求信息。 |
| subscribeClusterSignal() | 訂閱指定Cluster信號。 |
| subscribeBatchProperties() | 批量訂閱Cluster信號。 |
| unsubscribeClusterSignal() | 取消訂閱指定的Cluster信號。 |
| unsubscribeClusterSignalAll() | 取消所有訂閱的Cluster信號。 |
開發(fā)步驟
- 根據(jù)不同管理入口類,調(diào)對應(yīng)接口。
// 設(shè)置Cluster屬性值
String propId = ClusterManager.ID_CLUSTER_SETTINGS_BRIGHTNESS;
ClusterActuatorCallback callback = new ClusterActuatorCallback() {
@Override
public void onErrorActuator(String propId, int errorCode) {}
};
boolean result = false;
byte[] value = new byte[1];
try {
ClusterManager.sendClusterSignal(propId, callback, value);
result = true;
} catch (RemoteException | IllegalArgumentException | UnsupportedOperationException e) {
result = false;
} 網(wǎng)站標(biāo)題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OS開發(fā)CLUSTER相關(guān)應(yīng)用
網(wǎng)站URL:http://m.fisionsoft.com.cn/article/djdojps.html


咨詢
建站咨詢
