错误设置BLE温度计

时间:2016-02-24 17:42:27

标签: dbus bluetooth-lowenergy gdbus

我正在尝试设置BLE温度计的Interval属性,并遇到一些问题。

我已经测试过设置属性,例如NetworkManager中的WimaxEnabled属性:

$ gdbus call --system --dest org.freedesktop.NetworkManager \
--object-path /org/freedesktop/NetworkManager \
--method org.freedesktop.DBus.Properties.Set \
 "org.freedesktop.NetworkManager" "WimaxEnabled" "<boolean false>"
()

$ gdbus call --system --dest org.freedesktop.NetworkManager \
--object-path /org/freedesktop/NetworkManager \
--method org.freedesktop.DBus.Properties.Set \
"org.freedesktop.NetworkManager" "WimaxEnabled" "<boolean true>"
()

我可以验证这些功能确实像宣传的那样工作。当我尝试设置Interval的属性时,事情变得奇怪了。我可以毫无问题地清除Interval

$bgdbus call --system --dest org.bluez \
--object-path /org/bluez/hci0/dev_00_07_80_A6_3A_CA \
--method org.freedesktop.DBus.Properties.Set \
"org.bluez.Thermometer1" "Interval" "<uint16 0>"
()

但尝试将间隔设置为任何其他值会导致错误。我已经尝试了每个可能的uint16值,结果相同。

$ gdbus call --system --dest org.bluez \
--object-path /org/bluez/hci0/dev_00_07_80_A6_3A_CA \
--method org.freedesktop.DBus.Properties.Set \
"org.bluez.Thermometer1" "Interval" "<uint16 1>"
Error: GDBus.Error:org.bluez.Error.InvalidArguments: Invalid arguments in method call
(According to introspection data, you need to pass 'ssv')

Interval属性设置为读/写

$ gdbus introspect --system --dest org.bluez --object-path /org/bluez/hci0/dev_00_07_80_A6_3A_CA
node /org/bluez/hci0/dev_00_07_80_A6_3A_CA {
  interface org.freedesktop.DBus.Introspectable {
methods:
  Introspect(out s xml);
signals:
properties:
  };
  interface org.bluez.Device1 {
    methods:
  Disconnect();
  Connect();
  ConnectProfile(in  s UUID);
  DisconnectProfile(in  s UUID);
  Pair();
  CancelPairing();
signals:
properties:
  readonly s Address = '00:07:80:A6:3A:CA';
  readonly s Name = 'test';
  readwrite s Alias = 'test';
  readonly u Class;
  readonly q Appearance = 24585;
  readonly s Icon;
  readonly b Paired = true;
  readwrite b Trusted = false;
  readwrite b Blocked = false;
  readonly b LegacyPairing = false;
  readonly n RSSI;
  readonly b Connected = true;
  readonly as UUIDs = ['00001809-0000-1000-8000-00805f9b34fb'];
  readonly s Modalias;
  readonly o Adapter = '/org/bluez/hci0';
  };
  interface org.freedesktop.DBus.Properties {
methods:
  Get(in  s interface,
      in  s name,
      out v value);
  Set(in  s interface,
      in  s name,
      in  v value);
  GetAll(in  s interface,
         out a{sv} properties);
signals:
  PropertiesChanged(s interface,
                    a{sv} changed_properties,
                    as invalidated_properties);
properties:
  };
  interface org.bluez.Thermometer1 {
methods:
signals:
properties:
  readonly b Intermediate = false;
  readwrite q Interval = 0;
  readonly q Maximum = 0;
  readonly q Minimum = 0;
  };
};

我还编写了一个C程序来执行此操作并获得完全相同的结果,0个工作,其他每个值都失败。有人见过这个吗?有任何建议吗?

编辑:

总是会发生,我发布后很快意识到这个问题。我认为最小和最大属性是Interval的范围。由于两者都设置为0,我显然无法将Interval属性设置为0以外的任何值。

0 个答案:

没有答案