掃二維碼與項(xiàng)目經(jīng)理溝通
我們?cè)谖⑿派?4小時(shí)期待你的聲音
解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流

通常在汽車使用過程中,駕駛員需要設(shè)置儀表屏亮度、時(shí)間單位等參數(shù),將電臺(tái)、音樂等娛樂數(shù)據(jù)或?qū)Ш綌?shù)據(jù)顯示在儀表屏上,因此 HarmonyOS 提供了和儀表交互相關(guān)的接口,供三方開發(fā)者開發(fā)儀表設(shè)置、顯示等相關(guān)應(yīng)用。
說明
該功能與具體的車廠車型相關(guān),部分低配車型可能不具備該項(xiàng)功能。
目前Cluster提供的功能有如下表所示:
| 接口名 | 描述 |
|---|---|
| getClusterSignal() | 獲取指定Cluster信號(hào)值。 |
| setClusterActuator() | 設(shè)置指定Cluster執(zhí)行器值。 |
| sendClusterSignal() | 發(fā)送指定字節(jié)數(shù)組類型的Cluster信號(hào)請(qǐng)求信息。 |
| subscribeClusterSignal() | 訂閱指定Cluster信號(hào)。 |
| subscribeBatchProperties() | 批量訂閱Cluster信號(hào)。 |
| unsubscribeClusterSignal() | 取消訂閱指定的Cluster信號(hào)。 |
| unsubscribeClusterSignalAll() | 取消所有訂閱的Cluster信號(hào)。 |
// 設(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;
} 
我們?cè)谖⑿派?4小時(shí)期待你的聲音
解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流