gpt4 book ai didi

ios - HMCharacteristicWriteAction 为 targetValue 传递什么

转载 作者:行者123 更新时间:2023-12-01 18:12:48 25 4
gpt4 key购买 nike

在 HomeKit 我的代码是

HMAction *myAction = [[HMCharacteristicWriteAction alloc] 
initWithCharacteristic:[[lightBulbService characteristics] objectAtIndex:0] targetValue:characteristicValue];

HMCharacteristicWriteAction 有方法 initWithCharacterstic 需要两个参数

1)对于需要传递的initWithCharacteristic,HMService对象。

2)对于targetValue,我需要为targetValue传递什么?

我需要知道特征的目标值是什么?

最佳答案

目标值取决于您正在编写的特征。灯泡可能支持诸如

  • HMCharacteristicTypeHue - 整数 0-360(度)
  • HMCharacteristicTypeSaturation - 整数 0 - 100(百分比)
  • HMCharacteristicTypeBrightness - 整数 0 - 100(百分比)。
  • HMCharacteristicTypePowerState - bool 开或关。

  • 您几乎可以保证灯泡将支持 HMCharacteristicTypePowerState .其他的可能没有。灯泡还可以支持制造商定义的其他特性 - 例如,闪光灯可能支持“闪烁率”特性。

    关于ios - HMCharacteristicWriteAction 为 targetValue 传递什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27164143/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com