W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
通常在汽車使用過程中,駕駛員需要設(shè)置儀表屏亮度、時(shí)間單位等參數(shù),將電臺(tái)、音樂等娛樂數(shù)據(jù)或?qū)Ш綌?shù)據(jù)顯示在儀表屏上,因此 HarmonyOS 提供了和儀表交互相關(guān)的接口,供三方開發(fā)者開發(fā)儀表設(shè)置、顯示等相關(guān)應(yīng)用。
說(shuō)明
該功能與具體的車廠車型相關(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;
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: