title: Connecting to the new Bluez HDP plugin using DBUS from QT/C++
body: <p>I'm attempting to get readings from a device using the bluetooth Health Device Profile (specifically, an Nonin Onyx II 9560BT). Using this <a href="http://senzala.epx.com.br/2010/11/hdp-in-bluez.html" rel="nofollow">guide</a>, I've been able to do so using python over dbus. Now I'm trying to port it over to C++, and as I'm already using QT in the application, I'm using the QT DBus bindings. </p>
  
  <p>So far I've gotten to the following short program based on <a href="http://git.kernel.org/?p=bluetooth/bluez.git;a=blob_plain;f=doc/health-api.txt;hb=HEAD" rel="nofollow">this API</a> to test it:</p>
  
  <pre><code>#include &lt;QtCore/QCoreApplication&gt;
  #include &lt;QtCore/QDebug&gt;
  #include &lt;QtCore/QStringList&gt;
  #include &lt;QtDBus/QtDBus&gt;
  
  int main(int argc, char **argv)
  {
      QCoreApplication app(argc, argv);
  
      if (!QDBusConnection::sessionBus().isConnected()) {
          fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
                  "To start it, run:\n"
                  "\teval `dbus-launch --auto-syntax`\n");
          return 1;
      }
  
      QDBusInterface iface("org.bluez","/org/bluez","org.bluez.HealthManager",QDBusConnection::systemBus(),0);
  
      QVariantMap map;
      map.insert("DataType",ushort(1004));//same result with simply 1004
      map.insert("Role","Sink");
      map.insert("Description","HDP Test Manager"); //Optional
      //map.insert("ChannelType","Reliable");//Optional, same result with or without
      //QList&lt;QVariant&gt; argumentList;
      //argumentList.append(map);
  
      QDBusPendingReply&lt;&gt; r = iface.call("CreateApplication",map);
  
      qDebug() &lt;&lt; r.reply();
      qDebug() &lt;&lt; r.error();
      return 0;
  }
  </code></pre>
  
  <p>As far as I can tell, the dict object taken by "CreateApplication" corresponds to an a{sv} which in QT corresponds to the QVariantMap.
  However, I keep getting this error:</p>
  
  <pre><code>QDBusMessage(type=Error, service="", error name="org.bluez.Error.InvalidArguments", error message="Invalid arguments in method call", signature="", contents=([]) )
  </code></pre>
  
  <p>Question: What am I doing wrong?
  Based on the guides at freedesktop.org, the qt docs and the mighty google, this is as far as I've gotten.</p>
  
  <p>Thanks for any/all help!</p>
  
  <p>/Keyz182</p>