Still many open issues tdebluezauth is not working because of moving to Async (todo) Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>pull/1/head
@ -0,0 +1 @@
|
||||
Subproject commit 74654feb3bd49ba97c57e83ba2dd23c7c3d83c05
|
@ -1,11 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<!--
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
-->
|
||||
<interface name="org.bluez.MediaPlayer1">
|
||||
<method name="Play"/>
|
||||
<method name="Pause"/>
|
@ -1,11 +1,13 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<!--
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml" type="s" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
-->
|
||||
<interface name="org.bluez.Adapter1">
|
||||
<method name="StartDiscovery"></method>
|
||||
<method name="SetDiscoveryFilter">
|
@ -1,11 +1,13 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<!--
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml" type="s" direction="out" />
|
||||
</method>
|
||||
</interface>
|
||||
-->
|
||||
<interface name="org.bluez.AgentManager1">
|
||||
<method name="RegisterAgent">
|
||||
<arg name="agent" type="o" direction="in" />
|
@ -1,21 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- https://github.com/r10r/bluez/blob/master/doc/obex-agent-api.txt -->
|
||||
<node name="/org/trinitydesktop/tdeobex">
|
||||
<!-- Introspection is created by default -->
|
||||
<!-- <interface name="org.freedesktop.DBus.Introspectable"> -->
|
||||
<!-- <method name="Introspect"> -->
|
||||
<!-- <arg name="xml" type="s" direction="out"/> -->
|
||||
<!-- </method> -->
|
||||
<!-- </interface> -->
|
||||
|
||||
<!-- <interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
-->
|
||||
<interface name="org.bluez.obex.Agent1">
|
||||
<method name="Release">
|
||||
</method>
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
</method>
|
||||
<method name="AuthorizePush">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="transfer" direction="in" type="o"/>
|
||||
<arg name="filepath" direction="out" type="s"/>
|
||||
</method>
|
||||
<method name="Cancel">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
@ -1,21 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<!-- https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/obex-api.txt -->
|
||||
|
||||
<!-- Introspection is created by default -->
|
||||
<!-- https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/obex-api.txt -->
|
||||
<node name="/org/bluez/obex">
|
||||
<!--
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
<!-- dbus-send
|
||||
session
|
||||
print-reply=literal
|
||||
dest=org.bluez.obex /org/bluez/obex
|
||||
org.freedesktop.DBus.Introspectable.Introspect -->
|
||||
|
||||
-->
|
||||
<interface name="org.bluez.obex.AgentManager1">
|
||||
<method name="RegisterAgent">
|
||||
<arg name="agent" type="o" direction="in" />
|
@ -0,0 +1,143 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<!-- GDBus 2.40.0 -->
|
||||
<node>
|
||||
<interface name="org.freedesktop.DBus.Properties">
|
||||
<method name="Get">
|
||||
<arg type="s" name="interface_name" direction="in"/>
|
||||
<arg type="s" name="property_name" direction="in"/>
|
||||
<arg type="v" name="value" direction="out"/>
|
||||
</method>
|
||||
<method name="GetAll">
|
||||
<arg type="s" name="interface_name" direction="in"/>
|
||||
<arg type="a{sv}" name="properties" direction="out"/>
|
||||
</method>
|
||||
<method name="Set">
|
||||
<arg type="s" name="interface_name" direction="in"/>
|
||||
<arg type="s" name="property_name" direction="in"/>
|
||||
<arg type="v" name="value" direction="in"/>
|
||||
</method>
|
||||
<signal name="PropertiesChanged">
|
||||
<arg type="s" name="interface_name"/>
|
||||
<arg type="a{sv}" name="changed_properties"/>
|
||||
<arg type="as" name="invalidated_properties"/>
|
||||
</signal>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg type="s" name="xml_data" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.freedesktop.DBus.Peer">
|
||||
<method name="Ping"/>
|
||||
<method name="GetMachineId">
|
||||
<arg type="s" name="machine_uuid" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="org.mpris.MediaPlayer2">
|
||||
<method name="Raise">
|
||||
</method>
|
||||
<method name="Quit">
|
||||
</method>
|
||||
<property type="b" name="CanQuit" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanRaise" access="read">
|
||||
</property>
|
||||
<property type="b" name="HasTrackList" access="read">
|
||||
</property>
|
||||
<property type="s" name="Identity" access="read">
|
||||
</property>
|
||||
<property type="s" name="DesktopEntry" access="read">
|
||||
</property>
|
||||
<property type="as" name="SupportedUriSchemes" access="read">
|
||||
</property>
|
||||
<property type="as" name="SupportedMimeTypes" access="read">
|
||||
</property>
|
||||
</interface>
|
||||
<interface name="org.mpris.MediaPlayer2.Playlists">
|
||||
<method name="ActivatePlaylist">
|
||||
<arg type="o" name="PlaylistId" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
<method name="GetPlaylists">
|
||||
<arg type="u" name="Index" direction="in">
|
||||
</arg>
|
||||
<arg type="u" name="MaxCount" direction="in">
|
||||
</arg>
|
||||
<arg type="s" name="Order" direction="in">
|
||||
</arg>
|
||||
<arg type="b" name="ReverseOrder" direction="in">
|
||||
</arg>
|
||||
<arg type="a(oss)" name="arg_4" direction="out">
|
||||
</arg>
|
||||
</method>
|
||||
<property type="u" name="PlaylistCount" access="read">
|
||||
</property>
|
||||
<property type="as" name="Orderings" access="read">
|
||||
</property>
|
||||
<property type="(b(oss))" name="ActivePlaylist" access="read">
|
||||
</property>
|
||||
</interface>
|
||||
<interface name="org.mpris.MediaPlayer2.Player">
|
||||
<method name="Next">
|
||||
</method>
|
||||
<method name="Previous">
|
||||
</method>
|
||||
<method name="Pause">
|
||||
</method>
|
||||
<method name="PlayPause">
|
||||
</method>
|
||||
<method name="Stop">
|
||||
</method>
|
||||
<method name="Play">
|
||||
</method>
|
||||
<method name="Seek">
|
||||
<arg type="x" name="Offset" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
<method name="SetPosition">
|
||||
<arg type="o" name="TrackId" direction="in">
|
||||
</arg>
|
||||
<arg type="x" name="Position" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
<method name="OpenUri">
|
||||
<arg type="s" name="Uri" direction="in">
|
||||
</arg>
|
||||
</method>
|
||||
<signal name="Seeked">
|
||||
<arg type="x" name="Position">
|
||||
</arg>
|
||||
</signal>
|
||||
<property type="s" name="PlaybackStatus" access="read">
|
||||
</property>
|
||||
<property type="s" name="LoopStatus" access="readwrite">
|
||||
</property>
|
||||
<property type="d" name="Rate" access="readwrite">
|
||||
</property>
|
||||
<property type="b" name="Shuffle" access="readwrite">
|
||||
</property>
|
||||
<property type="a{sv}" name="Metadata" access="read">
|
||||
</property>
|
||||
<property type="d" name="Volume" access="readwrite">
|
||||
</property>
|
||||
<property type="x" name="Position" access="read">
|
||||
</property>
|
||||
<property type="d" name="MinimumRate" access="read">
|
||||
</property>
|
||||
<property type="d" name="MaximumRate" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanGoNext" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanGoPrevious" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanPlay" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanPause" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanSeek" access="read">
|
||||
</property>
|
||||
<property type="b" name="CanControl" access="read">
|
||||
</property>
|
||||
</interface>
|
||||
</node>
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.mpris.MediaPlayer2">
|
||||
<method name="Raise"/>
|
||||
<method name="Quit"/>
|
||||
<property name="CanQuit" type="b" access="read"/>
|
||||
<property name="CanRaise" type="b" access="read"/>
|
||||
<property name="HasTrackList" type="b" access="read"/>
|
||||
<property name="Identity" type="s" access="read"/>
|
||||
<property name="DesktopEntry" type="s" access="read"/>
|
||||
<property name="SupportedUriSchemes" type="as" access="read"/>
|
||||
<property name="SupportedMimeTypes" type="as" access="read"/>
|
||||
</interface>
|
||||
<interface name="org.mpris.MediaPlayer2.Player">
|
||||
<method name="Next"/>
|
||||
<method name="Previous"/>
|
||||
<method name="Pause"/>
|
||||
<method name="PlayPause"/>
|
||||
<method name="Stop"/>
|
||||
<method name="Play"/>
|
||||
<method name="Seek">
|
||||
<arg direction="in" name="Offset" type="x"/>
|
||||
</method>
|
||||
<method name="SetPosition">
|
||||
<arg direction="in" name="TrackId" type="o"/>
|
||||
<arg direction="in" name="Position" type="x"/>
|
||||
</method>
|
||||
<method name="OpenUri">
|
||||
<arg direction="in" name="Uri" type="s"/>
|
||||
</method>
|
||||
<signal name="Seeked">
|
||||
<arg name="Position" type="x"/>
|
||||
</signal>
|
||||
<property name="PlaybackStatus" type="s" access="read"/>
|
||||
<property name="LoopStatus" type="s" access="readwrite"/>
|
||||
<property name="Rate" type="d" access="readwrite"/>
|
||||
<property name="Shuffle" type="b" access="readwrite"/>
|
||||
<property name="Metadata" type="a{sv}" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QVariantMap"/>
|
||||
</property>
|
||||
<property name="Volume" type="d" access="read"/>
|
||||
<property name="Position" type="x" access="read"/>
|
||||
<property name="MinimumRate" type="d" access="read"/>
|
||||
<property name="MaximumRate" type="d" access="read"/>
|
||||
<property name="CanGoNext" type="b" access="read"/>
|
||||
<property name="CanGoPrevious" type="b" access="read"/>
|
||||
<property name="CanPlay" type="b" access="read"/>
|
||||
<property name="CanPause" type="b" access="read"/>
|
||||
<property name="CanSeek" type="b" access="read"/>
|
||||
<property name="CanControl" type="b" access="read"/>
|
||||
</interface>
|
||||
</node>
|
@ -1,39 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<node name="/org/trinitydesktop/tdebluez">
|
||||
<!-- The Introspectable Interface gets autogenerated -->
|
||||
<!-- <interface name="org.freedesktop.DBus.Introspectable"> -->
|
||||
<!-- <method name="Introspect"> -->
|
||||
<!-- <arg name="xml" type="s" direction="out"/> -->
|
||||
<!-- </method> -->
|
||||
<!-- </interface> -->
|
||||
<!-- The Introspectable Interface gets autogenerated
|
||||
<interface name="org.freedesktop.DBus.Introspectable">
|
||||
<method name="Introspect">
|
||||
<arg name="xml" type="s" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
-->
|
||||
<interface name="org.bluez.Agent1">
|
||||
<method name="Release">
|
||||
</method>
|
||||
<method name="RequestPinCode">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
<arg name="pincode" direction="out" type="s"/>
|
||||
</method>
|
||||
<method name="DisplayPinCode">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
<arg name="pincode" direction="in" type="s"/>
|
||||
</method>
|
||||
<method name="RequestPasskey">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
<arg name="passkey" direction="out" type="u"/>
|
||||
</method>
|
||||
<method name="DisplayPasskey">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
<arg name="passkey" direction="in" type="u"/>
|
||||
<arg name="entered" direction="in" type="q"/>
|
||||
</method>
|
||||
<method name="RequestConfirmation">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
<arg name="passkey" direction="in" type="u"/>
|
||||
</method>
|
||||
<method name="RequestAuthorization">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
</method>
|
||||
<method name="AuthorizeService">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async"/>
|
||||
<arg name="device" direction="in" type="o"/>
|
||||
<arg name="uuid" direction="in" type="s"/>
|
||||
</method>
|
@ -0,0 +1,29 @@
|
||||
interfaces
|
||||
source interfaces for autogenerating with dbusxml2qt3
|
||||
libtdebluez/
|
||||
Implementations and other files part of the library
|
||||
|
||||
libtdebluez/
|
||||
|
||||
libtdebluez/interfaces
|
||||
interfaces autogenerated with dbusxml2qt3
|
||||
- autogenerated proxy to objectmanager
|
||||
- adapter
|
||||
adapter1 proxy
|
||||
gattmanager1 proxy
|
||||
media1 proxy
|
||||
neworkserver1 proxy
|
||||
- obexagent
|
||||
autogenerated obex agent - interface and proxy
|
||||
- properties
|
||||
autogenerated dbus properties proxy
|
||||
- device
|
||||
autogenerated device1 proxy
|
||||
autogenerated mediacontrol1 proxy
|
||||
- agent
|
||||
autogenerated agent1 interface and proxy
|
||||
autogenerated introspectable interface
|
||||
autogenerated trinity desktop tdebluez node interface
|
||||
- manager
|
||||
autogenerated proxies to managers
|
||||
|
@ -0,0 +1,612 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1Interface.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
void Agent1Interface::buildIntrospectionData(TQDomElement& interfaceElement)
|
||||
{
|
||||
interfaceElement.setAttribute("name", "org.bluez.Agent1");
|
||||
|
||||
TQDomDocument document = interfaceElement.ownerDocument();
|
||||
TQDomElement methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Release");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
TQDomElement asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "RequestPinCode");
|
||||
|
||||
TQDomElement argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "pincode");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "out");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "DisplayPinCode");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "pincode");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "RequestPasskey");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "passkey");
|
||||
argumentElement.setAttribute("type", "u");
|
||||
argumentElement.setAttribute("direction", "out");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "DisplayPasskey");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "passkey");
|
||||
argumentElement.setAttribute("type", "u");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "entered");
|
||||
argumentElement.setAttribute("type", "q");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "RequestConfirmation");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "passkey");
|
||||
argumentElement.setAttribute("type", "u");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "RequestAuthorization");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "AuthorizeService");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "uuid");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Cancel");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestPinCodeAsyncReply(int asyncCallId, const TQString& pincode)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
reply << TQT_DBusData::fromString(pincode);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestPinCodeAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::DisplayPinCodeAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::DisplayPinCodeAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestPasskeyAsyncReply(int asyncCallId, TQ_UINT32 passkey)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
reply << TQT_DBusData::fromUInt32(passkey);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestPasskeyAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::DisplayPasskeyAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::DisplayPasskeyAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestConfirmationAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestConfirmationAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestAuthorizationAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::RequestAuthorizationAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::AuthorizeServiceAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::AuthorizeServiceAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1Interface::callRelease(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Release(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1Interface::Release returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.Release execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1Interface::callCancel(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Cancel(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1Interface::Cancel returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.Cancel execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
void Agent1Interface::callRequestPinCodeAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
RequestPinCodeAsync(_asyncCallId, _device);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callDisplayPinCodeAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQString _pincode = message[1].toString();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
DisplayPinCodeAsync(_asyncCallId, _device, _pincode);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callRequestPasskeyAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
RequestPasskeyAsync(_asyncCallId, _device);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callDisplayPasskeyAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQ_UINT32 _passkey = message[1].toUInt32();
|
||||
TQ_UINT16 _entered = message[2].toUInt16();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
DisplayPasskeyAsync(_asyncCallId, _device, _passkey, _entered);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callRequestConfirmationAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQ_UINT32 _passkey = message[1].toUInt32();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
RequestConfirmationAsync(_asyncCallId, _device, _passkey);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callRequestAuthorizationAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
RequestAuthorizationAsync(_asyncCallId, _device);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callAuthorizeServiceAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQString _uuid = message[1].toString();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
AuthorizeServiceAsync(_asyncCallId, _device, _uuid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool Agent1Interface::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.interface() != "org.bluez.Agent1") return false;
|
||||
|
||||
if (message.member() == "Release")
|
||||
{
|
||||
TQT_DBusMessage reply = callRelease(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestPinCode")
|
||||
{
|
||||
callRequestPinCodeAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "DisplayPinCode")
|
||||
{
|
||||
callDisplayPinCodeAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestPasskey")
|
||||
{
|
||||
callRequestPasskeyAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "DisplayPasskey")
|
||||
{
|
||||
callDisplayPasskeyAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestConfirmation")
|
||||
{
|
||||
callRequestConfirmationAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestAuthorization")
|
||||
{
|
||||
callRequestAuthorizationAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "AuthorizeService")
|
||||
{
|
||||
callAuthorizeServiceAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Cancel")
|
||||
{
|
||||
TQT_DBusMessage reply = callCancel(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,116 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1INTERFACE_H_INCLUDED)
|
||||
#define AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqmap.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQDomElement;
|
||||
class TQString;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusObjectPath;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class Agent1Interface : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
virtual ~Agent1Interface() {}
|
||||
|
||||
static void buildIntrospectionData(TQDomElement& interfaceElement);
|
||||
|
||||
public:
|
||||
virtual void RequestPinCodeAsyncReply(int asyncCallId, const TQString& pincode);
|
||||
|
||||
virtual void RequestPinCodeAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void DisplayPinCodeAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void DisplayPinCodeAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void RequestPasskeyAsyncReply(int asyncCallId, TQ_UINT32 passkey);
|
||||
|
||||
virtual void RequestPasskeyAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void DisplayPasskeyAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void DisplayPasskeyAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void RequestConfirmationAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void RequestConfirmationAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void RequestAuthorizationAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void RequestAuthorizationAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void AuthorizeServiceAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void AuthorizeServiceAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
virtual bool Release(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool Cancel(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual void RequestPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath& device) = 0;
|
||||
|
||||
virtual void DisplayPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& pincode) = 0;
|
||||
|
||||
virtual void RequestPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath& device) = 0;
|
||||
|
||||
virtual void DisplayPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered) = 0;
|
||||
|
||||
virtual void RequestConfirmationAsync(int asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey) = 0;
|
||||
|
||||
virtual void RequestAuthorizationAsync(int asyncCallId, const TQT_DBusObjectPath& device) = 0;
|
||||
|
||||
virtual void AuthorizeServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid) = 0;
|
||||
|
||||
protected: // implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRelease(const TQT_DBusMessage& message);
|
||||
|
||||
void callRequestPinCodeAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callDisplayPinCodeAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callRequestPasskeyAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callDisplayPasskeyAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callRequestConfirmationAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callRequestAuthorizationAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callAuthorizeServiceAsync(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callCancel(const TQT_DBusMessage& message);
|
||||
|
||||
protected:
|
||||
TQMap<int, TQT_DBusMessage> m_asyncCalls;
|
||||
|
||||
}; // class Agent1Interface
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,264 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1Proxy.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusproxy.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
Agent1Proxy::Agent1Proxy(const TQString& service, const TQString& path, TQObject* parent, const char* name)
|
||||
: TQObject(parent, name),
|
||||
m_baseProxy(new TQT_DBusProxy())
|
||||
{
|
||||
m_baseProxy->setInterface("org.bluez.Agent1");
|
||||
m_baseProxy->setPath(path);
|
||||
m_baseProxy->setService(service);
|
||||
|
||||
TQObject::connect(m_baseProxy, TQT_SIGNAL(asyncReply(int, const TQT_DBusMessage&)),
|
||||
this, TQT_SLOT(slotHandleAsyncReply(int, const TQT_DBusMessage&)));
|
||||
}
|
||||
|
||||
Agent1Proxy::~Agent1Proxy()
|
||||
{
|
||||
delete m_baseProxy;
|
||||
}
|
||||
|
||||
void Agent1Proxy::setConnection(const TQT_DBusConnection& connection)
|
||||
{
|
||||
m_baseProxy->setConnection(connection);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::Release(TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("Release", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1Proxy::Cancel(TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("Cancel", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1Proxy::RequestPinCodeAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("RequestPinCode", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "RequestPinCode";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::DisplayPinCodeAsync(int& asyncCallId, const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromString(pincode);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("DisplayPinCode", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "DisplayPinCode";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::RequestPasskeyAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("RequestPasskey", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "RequestPasskey";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::DisplayPasskeyAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromUInt32(passkey);
|
||||
parameters << TQT_DBusData::fromUInt16(entered);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("DisplayPasskey", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "DisplayPasskey";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::RequestConfirmationAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromUInt32(passkey);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("RequestConfirmation", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "RequestConfirmation";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::RequestAuthorizationAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("RequestAuthorization", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "RequestAuthorization";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::AuthorizeServiceAsync(int& asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromString(uuid);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("AuthorizeService", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "AuthorizeService";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
void Agent1Proxy::slotHandleAsyncReply(int asyncCallId, const TQT_DBusMessage& message)
|
||||
{
|
||||
TQMap<int, TQString>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
const TQString signalName = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
if (signalName == "RequestPinCode")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
TQString _pincode = message[0].toString();
|
||||
|
||||
emit RequestPinCodeAsyncReply(_asyncCallId, _pincode);
|
||||
}
|
||||
else if (signalName == "DisplayPinCode")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit DisplayPinCodeAsyncReply(_asyncCallId);
|
||||
}
|
||||
else if (signalName == "RequestPasskey")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
TQ_UINT32 _passkey = message[0].toUInt32();
|
||||
|
||||
emit RequestPasskeyAsyncReply(_asyncCallId, _passkey);
|
||||
}
|
||||
else if (signalName == "DisplayPasskey")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit DisplayPasskeyAsyncReply(_asyncCallId);
|
||||
}
|
||||
else if (signalName == "RequestConfirmation")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit RequestConfirmationAsyncReply(_asyncCallId);
|
||||
}
|
||||
else if (signalName == "RequestAuthorization")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit RequestAuthorizationAsyncReply(_asyncCallId);
|
||||
}
|
||||
else if (signalName == "AuthorizeService")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit AuthorizeServiceAsyncReply(_asyncCallId);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#include "agent1Proxy.moc"
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,94 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1PROXY_H_INCLUDED)
|
||||
#define AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqmap.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusMessage;
|
||||
class TQT_DBusObjectPath;
|
||||
class TQT_DBusProxy;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class Agent1Proxy : public TQObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Agent1Proxy(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0);
|
||||
|
||||
virtual ~Agent1Proxy();
|
||||
|
||||
void setConnection(const TQT_DBusConnection& connection);
|
||||
|
||||
signals:
|
||||
void AsyncErrorResponseDetected(int asyncCallId, const TQT_DBusError error);
|
||||
|
||||
void RequestPinCodeAsyncReply(int asyncCallId, const TQString& pincode);
|
||||
|
||||
void DisplayPinCodeAsyncReply(int asyncCallId);
|
||||
|
||||
void RequestPasskeyAsyncReply(int asyncCallId, TQ_UINT32 passkey);
|
||||
|
||||
void DisplayPasskeyAsyncReply(int asyncCallId);
|
||||
|
||||
void RequestConfirmationAsyncReply(int asyncCallId);
|
||||
|
||||
void RequestAuthorizationAsyncReply(int asyncCallId);
|
||||
|
||||
void AuthorizeServiceAsyncReply(int asyncCallId);
|
||||
|
||||
|
||||
public:
|
||||
virtual bool Release(TQT_DBusError& error);
|
||||
|
||||
virtual bool Cancel(TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestPinCodeAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQT_DBusError& error);
|
||||
|
||||
virtual bool DisplayPinCodeAsync(int& asyncCallId, const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestPasskeyAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQT_DBusError& error);
|
||||
|
||||
virtual bool DisplayPasskeyAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestConfirmationAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestAuthorizationAsync(int& asyncCallId, const TQT_DBusObjectPath& device, TQT_DBusError& error);
|
||||
|
||||
virtual bool AuthorizeServiceAsync(int& asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error);
|
||||
|
||||
protected slots: // usually no need to reimplement
|
||||
virtual void slotHandleAsyncReply(int id, const TQT_DBusMessage& message);
|
||||
|
||||
protected:
|
||||
TQT_DBusProxy* m_baseProxy;
|
||||
|
||||
TQMap<int, TQString> m_asyncCalls;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
Agent1Proxy(const Agent1Proxy&);
|
||||
Agent1Proxy& operator=(const Agent1Proxy&);
|
||||
}; // class Agent1Proxy
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,382 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "device1Interface.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqstring.h>
|
||||
#include <tqstringlist.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusvariant.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
void Device1Interface::buildIntrospectionData(TQDomElement& interfaceElement)
|
||||
{
|
||||
interfaceElement.setAttribute("name", "org.bluez.Device1");
|
||||
|
||||
TQDomDocument document = interfaceElement.ownerDocument();
|
||||
TQDomElement methodElement = document.createElement("method");
|
||||
TQDomElement asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "Disconnect");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "Connect");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "ConnectProfile");
|
||||
|
||||
TQDomElement argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "UUID");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "DisconnectProfile");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "UUID");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "Pair");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "CancelPairing");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
}
|
||||
|
||||
void Device1Interface::DisconnectAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::DisconnectAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::ConnectAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::ConnectAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::ConnectProfileAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::ConnectProfileAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::PairAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::PairAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::CancelPairingAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Device1Interface::CancelPairingAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1Interface::callDisconnectProfile(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQString _UUID = message[0].toString();
|
||||
|
||||
if (DisconnectProfile(_UUID, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1Interface::DisconnectProfile returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.DisconnectProfile execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
void Device1Interface::callDisconnectAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
DisconnectAsync(_asyncCallId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Device1Interface::callConnectAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
ConnectAsync(_asyncCallId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Device1Interface::callConnectProfileAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQString _UUID = message[0].toString();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
ConnectProfileAsync(_asyncCallId, _UUID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Device1Interface::callPairAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
PairAsync(_asyncCallId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Device1Interface::callCancelPairingAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
CancelPairingAsync(_asyncCallId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool Device1Interface::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.interface() != "org.bluez.Device1") return false;
|
||||
|
||||
if (message.member() == "Disconnect")
|
||||
{
|
||||
callDisconnectAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Connect")
|
||||
{
|
||||
callConnectAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "ConnectProfile")
|
||||
{
|
||||
callConnectProfileAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "DisconnectProfile")
|
||||
{
|
||||
TQT_DBusMessage reply = callDisconnectProfile(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Pair")
|
||||
{
|
||||
callPairAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "CancelPairing")
|
||||
{
|
||||
callCancelPairingAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,98 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(DEVICE1INTERFACE_H_INCLUDED)
|
||||
#define DEVICE1INTERFACE_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqmap.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQDomElement;
|
||||
class TQString;
|
||||
class TQStringList;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusObjectPath;
|
||||
class TQT_DBusVariant;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class Device1Interface : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
virtual ~Device1Interface() {}
|
||||
|
||||
static void buildIntrospectionData(TQDomElement& interfaceElement);
|
||||
|
||||
public:
|
||||
virtual void DisconnectAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void DisconnectAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void ConnectAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void ConnectAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void ConnectProfileAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void ConnectProfileAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void PairAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void PairAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void CancelPairingAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void CancelPairingAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
virtual bool DisconnectProfile(const TQString& UUID, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual void DisconnectAsync(int asyncCallId) = 0;
|
||||
|
||||
virtual void ConnectAsync(int asyncCallId) = 0;
|
||||
|
||||
virtual void ConnectProfileAsync(int asyncCallId, const TQString& UUID) = 0;
|
||||
|
||||
virtual void PairAsync(int asyncCallId) = 0;
|
||||
|
||||
virtual void CancelPairingAsync(int asyncCallId) = 0;
|
||||
|
||||
protected: // implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
void callDisconnectAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callConnectAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callConnectProfileAsync(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callDisconnectProfile(const TQT_DBusMessage& message);
|
||||
|
||||
void callPairAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callCancelPairingAsync(const TQT_DBusMessage& message);
|
||||
|
||||
protected:
|
||||
TQMap<int, TQT_DBusMessage> m_asyncCalls;
|
||||
|
||||
}; // class Device1Interface
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //DEVICE1INTERFACE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,95 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "objectmanagerProxy.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqstring.h>
|
||||
#include <tqstringlist.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusproxy.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace freedesktop
|
||||
{
|
||||
namespace DBus
|
||||
{
|
||||
|
||||
ObjectManagerProxy::ObjectManagerProxy(const TQString& service, const TQString& path, TQObject* parent, const char* name)
|
||||
: TQObject(parent, name),
|
||||
m_baseProxy(new TQT_DBusProxy())
|
||||
{
|
||||
m_baseProxy->setInterface("org.freedesktop.DBus.ObjectManager");
|
||||
m_baseProxy->setPath(path);
|
||||
m_baseProxy->setService(service);
|
||||
|
||||
TQObject::connect(m_baseProxy, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
|
||||
this, TQT_SLOT(slotHandleDBusSignal(const TQT_DBusMessage&)));
|
||||
}
|
||||
|
||||
ObjectManagerProxy::~ObjectManagerProxy()
|
||||
{
|
||||
delete m_baseProxy;
|
||||
}
|
||||
|
||||
void ObjectManagerProxy::setConnection(const TQT_DBusConnection& connection)
|
||||
{
|
||||
m_baseProxy->setConnection(connection);
|
||||
}
|
||||
|
||||
bool ObjectManagerProxy::GetManagedObjects(TQT_DBusDataMap< TQT_DBusObjectPath >& objects, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("GetManagedObjects", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
|
||||
if (reply.count() != 1) return false;
|
||||
|
||||
bool ok = false;
|
||||
|
||||
objects = reply.front().toObjectPathKeyMap(&ok);
|
||||
if (!ok) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ObjectManagerProxy::slotHandleDBusSignal(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.member() == "InterfacesAdded")
|
||||
{
|
||||
TQT_DBusObjectPath _object = message[0].toObjectPath();
|
||||
TQT_DBusDataMap< TQString > _interfaces = message[1].toStringKeyMap();
|
||||
|
||||
emit InterfacesAdded(_object, _interfaces);
|
||||
}
|
||||
else if (message.member() == "InterfacesRemoved")
|
||||
{
|
||||
TQT_DBusObjectPath _object = message[0].toObjectPath();
|
||||
TQStringList _interfaces = message[1].toList().toTQStringList();
|
||||
|
||||
emit InterfacesRemoved(_object, _interfaces);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace DBus
|
||||
|
||||
}; // namespace freedesktop
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#include "objectmanagerProxy.moc"
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,204 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "tdebluezNode.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqmap.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusmessage.h>
|
||||
|
||||
|
||||
// interface classes includes
|
||||
#include "agent1Interface.h"
|
||||
#include "introspectableInterface.h"
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace trinitydesktop
|
||||
{
|
||||
|
||||
class tdebluezNode::Private : public org::freedesktop::DBus::IntrospectableInterface
|
||||
{
|
||||
public:
|
||||
virtual ~Private();
|
||||
|
||||
public:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> interfaces;
|
||||
TQString introspectionData;
|
||||
|
||||
TQT_DBusConnection connection;
|
||||
TQString objectPath;
|
||||
TQString nextNode;
|
||||
|
||||
protected:
|
||||
virtual bool Introspect(TQString& data, TQT_DBusError& error);
|
||||
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
void cacheIntrospectionData();
|
||||
};
|
||||
|
||||
tdebluezNode::tdebluezNode() : TQT_DBusObjectBase(),
|
||||
m_private(new Private())
|
||||
{
|
||||
}
|
||||
|
||||
tdebluezNode::~tdebluezNode()
|
||||
{
|
||||
unregisterObject();
|
||||
|
||||
delete m_private;
|
||||
}
|
||||
|
||||
bool tdebluezNode::registerObject(const TQT_DBusConnection& connection, const TQString& path)
|
||||
{
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
if (!m_private->objectPath.isEmpty()) unregisterObject();
|
||||
|
||||
m_private->connection = connection;
|
||||
m_private->objectPath = path;
|
||||
|
||||
if (!m_private->connection.registerObject(path, this))
|
||||
{
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_private->interfaces.isEmpty())
|
||||
{
|
||||
TQString name = "org.freedesktop.DBus.Introspectable";
|
||||
TQT_DBusObjectBase* interface = m_private;
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.Agent1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tdebluezNode::registerObject(const TQT_DBusConnection& connection, const TQString& path, const TQString& next)
|
||||
{
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
if (!m_private->objectPath.isEmpty()) unregisterObject();
|
||||
|
||||
m_private->connection = connection;
|
||||
m_private->objectPath = path;
|
||||
m_private->nextNode = next;
|
||||
|
||||
if (!m_private->connection.registerObject(path, this))
|
||||
{
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
m_private->nextNode = TQString();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_private->interfaces.isEmpty())
|
||||
{
|
||||
TQString name = "org.freedesktop.DBus.Introspectable";
|
||||
TQT_DBusObjectBase* interface = m_private;
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.Agent1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void tdebluezNode::unregisterObject()
|
||||
{
|
||||
if (m_private->objectPath.isEmpty()) return;
|
||||
|
||||
m_private->connection.unregisterObject(m_private->objectPath);
|
||||
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
}
|
||||
|
||||
bool tdebluezNode::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::iterator findIt = m_private->interfaces.find(message.interface());
|
||||
if (findIt == m_private->interfaces.end()) return false;
|
||||
|
||||
return delegateMethodCall(message, findIt.data());
|
||||
}
|
||||
|
||||
tdebluezNode::Private::~Private()
|
||||
{
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::const_iterator it = interfaces.begin();
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::const_iterator endIt = interfaces.end();
|
||||
for (; it != endIt; ++it)
|
||||
{
|
||||
TQT_DBusObjectBase* interface = it.data();
|
||||
if (interface != this)
|
||||
delete interface;
|
||||
}
|
||||
interfaces.clear();
|
||||
}
|
||||
|
||||
bool tdebluezNode::Private::Introspect(TQString& data, TQT_DBusError& error)
|
||||
{
|
||||
Q_UNUSED(error);
|
||||
if (introspectionData.isEmpty()) cacheIntrospectionData();
|
||||
|
||||
data = introspectionData;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void tdebluezNode::Private::handleMethodReply(const TQT_DBusMessage& reply)
|
||||
{
|
||||
connection.send(reply);
|
||||
}
|
||||
|
||||
void tdebluezNode::Private::cacheIntrospectionData()
|
||||
{
|
||||
TQDomDocument doc;
|
||||
TQDomElement nodeElement = doc.createElement("node");
|
||||
if (!objectPath.isEmpty() && objectPath.compare("/") != 0)
|
||||
{
|
||||
nodeElement.setAttribute ( "name", objectPath );
|
||||
}
|
||||
if (interfaces.count()>1) {
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::freedesktop::DBus::IntrospectableInterface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
}
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::Agent1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
if (!nextNode.isEmpty()) {
|
||||
TQDomElement nodeElement1 = doc.createElement("node");
|
||||
nodeElement1.setAttribute ( "name", nextNode );
|
||||
nodeElement.appendChild(nodeElement1);
|
||||
}
|
||||
|
||||
doc.appendChild(nodeElement);
|
||||
|
||||
introspectionData = "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n";
|
||||
introspectionData += doc.toString();
|
||||
}
|
||||
|
||||
}; // namespace trinitydesktop
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,53 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(TDEBLUEZNODE_H_INCLUDED)
|
||||
#define TDEBLUEZNODE_H_INCLUDED
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace trinitydesktop
|
||||
{
|
||||
|
||||
class tdebluezNode : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
tdebluezNode();
|
||||
|
||||
virtual ~tdebluezNode();
|
||||
|
||||
bool registerObject(const TQT_DBusConnection& connection, const TQString& path);
|
||||
bool registerObject(const TQT_DBusConnection& connection, const TQString& path, const TQString& next);
|
||||
|
||||
void unregisterObject();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString& interfaceName) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* m_private;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
tdebluezNode(const tdebluezNode&);
|
||||
tdebluezNode& operator=(const tdebluezNode&);
|
||||
}; // class tdebluezNode
|
||||
|
||||
}; // namespace trinitydesktop
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //TDEBLUEZNODE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,102 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2018 Emanoil Kotsev
|
||||
# deloptes (AT) gmail.com
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
project( libtdeobex )
|
||||
set(LIBRARY_VERSION 0.0.1)
|
||||
|
||||
# include( ConfigureChecks.cmake )
|
||||
foreach( f ${TQT_LIBRARIES} )
|
||||
if( ${f} STREQUAL "tqt-mt" )
|
||||
set(TQUI_LIBRARIES "tqui" CACHE TYPE STRING FORCE)
|
||||
endif()
|
||||
if( ${f} STREQUAL "qt-mt" )
|
||||
set(TQUI_LIBRARIES "qui" CACHE TYPE STRING FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# import required
|
||||
#tde_import( lib... )
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${TDE_INCLUDE_DIR}
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${DBUS_INCLUDE_DIRS}
|
||||
${DBUS_TQT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${TQT_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
|
||||
##### headers ###################################
|
||||
# implementations
|
||||
install(
|
||||
FILES obexobjectmanagerImpl.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/tdeobex )
|
||||
# interfaces
|
||||
install(
|
||||
FILES interfaces/transfer1Proxy.h
|
||||
interfaces/client1Proxy.h
|
||||
interfaces/phonebookaccess1Proxy.h
|
||||
interfaces/objectpush1Interface.h
|
||||
interfaces/transfer1Interface.h
|
||||
interfaces/phonebookaccess1Interface.h
|
||||
interfaces/filetransfer1Proxy.h
|
||||
interfaces/synchronization1Proxy.h
|
||||
interfaces/agentmanager1Proxy.h
|
||||
interfaces/client1Interface.h
|
||||
interfaces/filetransfer1Interface.h
|
||||
interfaces/synchronization1Interface.h
|
||||
interfaces/agentmanager1Interface.h
|
||||
interfaces/session1Interface.h
|
||||
interfaces/objectpush1Proxy.h
|
||||
interfaces/session1Proxy.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/tdeobex/interfaces )
|
||||
# agent
|
||||
install(
|
||||
FILES interfaces/agent1Interface.h
|
||||
interfaces/agent1Proxy.h
|
||||
interfaces/tdeobexNode.h
|
||||
interfaces/dbusbaseNode.h
|
||||
interfaces/introspectableInterface.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/tdeobex/interfaces )
|
||||
|
||||
##### tdeobex (shared) ###########################
|
||||
# set( KDE3_DCOPIDL_EXECUTABLE ${KDE3_DCOPIDLNG_EXECUTABLE} )
|
||||
tde_add_library( tdeobex SHARED AUTOMOC
|
||||
SOURCES
|
||||
obexobjectmanagerImpl.cpp
|
||||
interfaces/objectmanagerProxy.cpp
|
||||
interfaces/propertiesProxy.cpp
|
||||
interfaces/agentmanager1Proxy.cpp
|
||||
interfaces/transfer1Proxy.cpp
|
||||
interfaces/session1Proxy.cpp
|
||||
interfaces/objectpush1Proxy.cpp
|
||||
interfaces/phonebookaccess1Proxy.cpp
|
||||
interfaces/client1Proxy.cpp
|
||||
interfaces/filetransfer1Proxy.cpp
|
||||
interfaces/synchronization1Proxy.cpp
|
||||
interfaces/introspectableInterface.cpp
|
||||
interfaces/tdeobexNode.cpp
|
||||
interfaces/dbusbaseNode.cpp
|
||||
interfaces/agent1Proxy.cpp
|
||||
interfaces/agent1Interface.cpp
|
||||
VERSION ${LIBRARY_VERSION}
|
||||
LINK ${DBUS_TQT_LIBRARIES} tdeparts-shared ${TQUI_LIBRARIES}
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
##### install import cmake modules ###############
|
||||
tde_install_export( )
|
@ -0,0 +1,228 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1Interface.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
void Agent1Interface::buildIntrospectionData(TQDomElement& interfaceElement)
|
||||
{
|
||||
interfaceElement.setAttribute("name", "org.bluez.obex.Agent1");
|
||||
|
||||
TQDomDocument document = interfaceElement.ownerDocument();
|
||||
TQDomElement methodElement = document.createElement("method");
|
||||
TQDomElement asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "Release");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "AuthorizePush");
|
||||
|
||||
TQDomElement argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "transfer");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "filepath");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "out");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
asyncAnnotationElement = document.createElement("annotation");
|
||||
asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
|
||||
asyncAnnotationElement.setAttribute("value", "true");
|
||||
methodElement.appendChild(asyncAnnotationElement);
|
||||
methodElement.setAttribute("name", "Cancel");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
}
|
||||
|
||||
void Agent1Interface::ReleaseAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::ReleaseAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::AuthorizePushAsyncReply(int asyncCallId, const TQString& filepath)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
reply << TQT_DBusData::fromString(filepath);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::AuthorizePushAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::CancelAsyncReply(int asyncCallId)
|
||||
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
|
||||
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::CancelAsyncError(int asyncCallId, const TQT_DBusError& error)
|
||||
{
|
||||
TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
TQT_DBusMessage call = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
|
||||
handleMethodReply(reply);
|
||||
}
|
||||
|
||||
void Agent1Interface::callReleaseAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
ReleaseAsync(_asyncCallId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callAuthorizePushAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusObjectPath _transfer = message[0].toObjectPath();
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
AuthorizePushAsync(_asyncCallId, _transfer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void Agent1Interface::callCancelAsync(const TQT_DBusMessage& message)
|
||||
{
|
||||
|
||||
int _asyncCallId = 0;
|
||||
while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
|
||||
{
|
||||
++_asyncCallId;
|
||||
}
|
||||
m_asyncCalls.insert(_asyncCallId, message);
|
||||
|
||||
CancelAsync(_asyncCallId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool Agent1Interface::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.interface() != "org.bluez.obex.Agent1") return false;
|
||||
|
||||
if (message.member() == "Release")
|
||||
{
|
||||
callReleaseAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "AuthorizePush")
|
||||
{
|
||||
callAuthorizePushAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Cancel")
|
||||
{
|
||||
callCancelAsync(message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,80 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1INTERFACE_H_INCLUDED)
|
||||
#define AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqmap.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQDomElement;
|
||||
class TQString;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusObjectPath;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
class Agent1Interface : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
virtual ~Agent1Interface() {}
|
||||
|
||||
static void buildIntrospectionData(TQDomElement& interfaceElement);
|
||||
|
||||
public:
|
||||
virtual void ReleaseAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void ReleaseAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void AuthorizePushAsyncReply(int asyncCallId, const TQString& filepath);
|
||||
|
||||
virtual void AuthorizePushAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
virtual void CancelAsyncReply(int asyncCallId);
|
||||
|
||||
virtual void CancelAsyncError(int asyncCallId, const TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
virtual void ReleaseAsync(int asyncCallId) = 0;
|
||||
|
||||
virtual void AuthorizePushAsync(int asyncCallId, const TQT_DBusObjectPath& transfer) = 0;
|
||||
|
||||
virtual void CancelAsync(int asyncCallId) = 0;
|
||||
|
||||
protected: // implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
void callReleaseAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callAuthorizePushAsync(const TQT_DBusMessage& message);
|
||||
|
||||
void callCancelAsync(const TQT_DBusMessage& message);
|
||||
|
||||
protected:
|
||||
TQMap<int, TQT_DBusMessage> m_asyncCalls;
|
||||
|
||||
}; // class Agent1Interface
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,138 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1Proxy.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusproxy.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
Agent1Proxy::Agent1Proxy(const TQString& service, const TQString& path, TQObject* parent, const char* name)
|
||||
: TQObject(parent, name),
|
||||
m_baseProxy(new TQT_DBusProxy())
|
||||
{
|
||||
m_baseProxy->setInterface("org.bluez.obex.Agent1");
|
||||
m_baseProxy->setPath(path);
|
||||
m_baseProxy->setService(service);
|
||||
|
||||
TQObject::connect(m_baseProxy, TQT_SIGNAL(asyncReply(int, const TQT_DBusMessage&)),
|
||||
this, TQT_SLOT(slotHandleAsyncReply(int, const TQT_DBusMessage&)));
|
||||
}
|
||||
|
||||
Agent1Proxy::~Agent1Proxy()
|
||||
{
|
||||
delete m_baseProxy;
|
||||
}
|
||||
|
||||
void Agent1Proxy::setConnection(const TQT_DBusConnection& connection)
|
||||
{
|
||||
m_baseProxy->setConnection(connection);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::ReleaseAsync(int& asyncCallId, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("Release", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Release";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::AuthorizePushAsync(int& asyncCallId, const TQT_DBusObjectPath& transfer, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(transfer);
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("AuthorizePush", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "AuthorizePush";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
bool Agent1Proxy::CancelAsync(int& asyncCallId, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
asyncCallId = m_baseProxy->sendWithAsyncReply("Cancel", parameters);
|
||||
|
||||
if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Cancel";
|
||||
|
||||
error = TQT_DBusError();
|
||||
return (asyncCallId != 0);
|
||||
}
|
||||
|
||||
void Agent1Proxy::slotHandleAsyncReply(int asyncCallId, const TQT_DBusMessage& message)
|
||||
{
|
||||
TQMap<int, TQString>::iterator findIt = m_asyncCalls.find(asyncCallId);
|
||||
if (findIt == m_asyncCalls.end()) return;
|
||||
|
||||
const TQString signalName = findIt.data();
|
||||
m_asyncCalls.erase(findIt);
|
||||
|
||||
if (signalName == "Release")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit ReleaseAsyncReply(_asyncCallId);
|
||||
}
|
||||
else if (signalName == "AuthorizePush")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
TQString _filepath = message[0].toString();
|
||||
|
||||
emit AuthorizePushAsyncReply(_asyncCallId, _filepath);
|
||||
}
|
||||
else if (signalName == "Cancel")
|
||||
{
|
||||
int _asyncCallId = asyncCallId;
|
||||
|
||||
if (message.type() == TQT_DBusMessage::ErrorMessage) {
|
||||
emit AsyncErrorResponseDetected(_asyncCallId, message.error());
|
||||
}
|
||||
|
||||
|
||||
emit CancelAsyncReply(_asyncCallId);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#include "agent1Proxy.moc"
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,78 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1PROXY_H_INCLUDED)
|
||||
#define AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqmap.h>
|
||||
#include <tqobject.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusMessage;
|
||||
class TQT_DBusObjectPath;
|
||||
class TQT_DBusProxy;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
class Agent1Proxy : public TQObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Agent1Proxy(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0);
|
||||
|
||||
virtual ~Agent1Proxy();
|
||||
|
||||
void setConnection(const TQT_DBusConnection& connection);
|
||||
|
||||
signals:
|
||||
void AsyncErrorResponseDetected(int asyncCallId, const TQT_DBusError error);
|
||||
|
||||
void ReleaseAsyncReply(int asyncCallId);
|
||||
|
||||
void AuthorizePushAsyncReply(int asyncCallId, const TQString& filepath);
|
||||
|
||||
void CancelAsyncReply(int asyncCallId);
|
||||
|
||||
|
||||
public:
|
||||
virtual bool ReleaseAsync(int& asyncCallId, TQT_DBusError& error);
|
||||
|
||||
virtual bool AuthorizePushAsync(int& asyncCallId, const TQT_DBusObjectPath& transfer, TQT_DBusError& error);
|
||||
|
||||
virtual bool CancelAsync(int& asyncCallId, TQT_DBusError& error);
|
||||
|
||||
protected slots: // usually no need to reimplement
|
||||
virtual void slotHandleAsyncReply(int id, const TQT_DBusMessage& message);
|
||||
|
||||
protected:
|
||||
TQT_DBusProxy* m_baseProxy;
|
||||
|
||||
TQMap<int, TQString> m_asyncCalls;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
Agent1Proxy(const Agent1Proxy&);
|
||||
Agent1Proxy& operator=(const Agent1Proxy&);
|
||||
}; // class Agent1Proxy
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,309 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "obexNode.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqmap.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusmessage.h>
|
||||
|
||||
|
||||
// interface classes includes
|
||||
#include "agentmanager1Interface.h"
|
||||
#include "client1Interface.h"
|
||||
#include "filetransfer1Interface.h"
|
||||
#include "objectpush1Interface.h"
|
||||
#include "session1Interface.h"
|
||||
#include "transfer1Interface.h"
|
||||
#include "synchronization1Interface.h"
|
||||
#include "phonebookaccess1Interface.h"
|
||||
#include "introspectableInterface.h"
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class obexNode::Private : public org::freedesktop::DBus::IntrospectableInterface
|
||||
{
|
||||
public:
|
||||
virtual ~Private();
|
||||
|
||||
public:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> interfaces;
|
||||
TQString introspectionData;
|
||||
|
||||
TQT_DBusConnection connection;
|
||||
TQString objectPath;
|
||||
TQString nextNode;
|
||||
|
||||
protected:
|
||||
virtual bool Introspect(TQString& data, TQT_DBusError& error);
|
||||
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
void cacheIntrospectionData();
|
||||
};
|
||||
|
||||
obexNode::obexNode() : TQT_DBusObjectBase(),
|
||||
m_private(new Private())
|
||||
{
|
||||
}
|
||||
|
||||
obexNode::~obexNode()
|
||||
{
|
||||
unregisterObject();
|
||||
|
||||
delete m_private;
|
||||
}
|
||||
|
||||
bool obexNode::registerObject(const TQT_DBusConnection& connection, const TQString& path)
|
||||
{
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
if (!m_private->objectPath.isEmpty()) unregisterObject();
|
||||
|
||||
m_private->connection = connection;
|
||||
m_private->objectPath = path;
|
||||
|
||||
if (!m_private->connection.registerObject(path, this))
|
||||
{
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_private->interfaces.isEmpty())
|
||||
{
|
||||
TQString name = "org.freedesktop.DBus.Introspectable";
|
||||
TQT_DBusObjectBase* interface = m_private;
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.AgentManager1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Client1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.FileTransfer1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.ObjectPush1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Session1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Transfer1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Synchronization1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.PhonebookAccess1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool obexNode::registerObject(const TQT_DBusConnection& connection, const TQString& path, const TQString& next)
|
||||
{
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
if (!m_private->objectPath.isEmpty()) unregisterObject();
|
||||
|
||||
m_private->connection = connection;
|
||||
m_private->objectPath = path;
|
||||
m_private->nextNode = next;
|
||||
|
||||
if (!m_private->connection.registerObject(path, this))
|
||||
{
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
m_private->nextNode = TQString();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_private->interfaces.isEmpty())
|
||||
{
|
||||
TQString name = "org.freedesktop.DBus.Introspectable";
|
||||
TQT_DBusObjectBase* interface = m_private;
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.AgentManager1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Client1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.FileTransfer1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.ObjectPush1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Session1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Transfer1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Synchronization1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.PhonebookAccess1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void obexNode::unregisterObject()
|
||||
{
|
||||
if (m_private->objectPath.isEmpty()) return;
|
||||
|
||||
m_private->connection.unregisterObject(m_private->objectPath);
|
||||
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
}
|
||||
|
||||
bool obexNode::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::iterator findIt = m_private->interfaces.find(message.interface());
|
||||
if (findIt == m_private->interfaces.end()) return false;
|
||||
|
||||
return delegateMethodCall(message, findIt.data());
|
||||
}
|
||||
|
||||
obexNode::Private::~Private()
|
||||
{
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::const_iterator it = interfaces.begin();
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::const_iterator endIt = interfaces.end();
|
||||
for (; it != endIt; ++it)
|
||||
{
|
||||
TQT_DBusObjectBase* interface = it.data();
|
||||
if (interface != this)
|
||||
delete interface;
|
||||
}
|
||||
interfaces.clear();
|
||||
}
|
||||
|
||||
bool obexNode::Private::Introspect(TQString& data, TQT_DBusError& error)
|
||||
{
|
||||
Q_UNUSED(error);
|
||||
if (introspectionData.isEmpty()) cacheIntrospectionData();
|
||||
|
||||
data = introspectionData;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void obexNode::Private::handleMethodReply(const TQT_DBusMessage& reply)
|
||||
{
|
||||
connection.send(reply);
|
||||
}
|
||||
|
||||
void obexNode::Private::cacheIntrospectionData()
|
||||
{
|
||||
TQDomDocument doc;
|
||||
TQDomElement nodeElement = doc.createElement("node");
|
||||
if (!objectPath.isEmpty() && objectPath.compare("/") != 0)
|
||||
{
|
||||
nodeElement.setAttribute ( "name", objectPath );
|
||||
}
|
||||
if (!interfaces.isEmpty()) {
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::freedesktop::DBus::IntrospectableInterface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
}
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::AgentManager1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::Client1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::FileTransfer1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::ObjectPush1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::Session1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::Transfer1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::Synchronization1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::PhonebookAccess1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
if (!nextNode.isEmpty()) {
|
||||
TQDomElement nodeElement1 = doc.createElement("node");
|
||||
nodeElement1.setAttribute ( "name", nextNode );
|
||||
nodeElement.appendChild(nodeElement1);
|
||||
}
|
||||
|
||||
doc.appendChild(nodeElement);
|
||||
|
||||
introspectionData = "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n";
|
||||
introspectionData += doc.toString();
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,53 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(OBEXNODE_H_INCLUDED)
|
||||
#define OBEXNODE_H_INCLUDED
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class obexNode : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
obexNode();
|
||||
|
||||
virtual ~obexNode();
|
||||
|
||||
bool registerObject(const TQT_DBusConnection& connection, const TQString& path);
|
||||
bool registerObject(const TQT_DBusConnection& connection, const TQString& path, const TQString& next);
|
||||
|
||||
void unregisterObject();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString& interfaceName) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* m_private;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
obexNode(const obexNode&);
|
||||
obexNode& operator=(const obexNode&);
|
||||
}; // class obexNode
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //OBEXNODE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,204 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "tdeobexNode.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqmap.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusmessage.h>
|
||||
|
||||
|
||||
// interface classes includes
|
||||
#include "agent1Interface.h"
|
||||
#include "introspectableInterface.h"
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace trinitydesktop
|
||||
{
|
||||
|
||||
class tdeobexNode::Private : public org::freedesktop::DBus::IntrospectableInterface
|
||||
{
|
||||
public:
|
||||
virtual ~Private();
|
||||
|
||||
public:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> interfaces;
|
||||
TQString introspectionData;
|
||||
|
||||
TQT_DBusConnection connection;
|
||||
TQString objectPath;
|
||||
TQString nextNode;
|
||||
|
||||
protected:
|
||||
virtual bool Introspect(TQString& data, TQT_DBusError& error);
|
||||
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
void cacheIntrospectionData();
|
||||
};
|
||||
|
||||
tdeobexNode::tdeobexNode() : TQT_DBusObjectBase(),
|
||||
m_private(new Private())
|
||||
{
|
||||
}
|
||||
|
||||
tdeobexNode::~tdeobexNode()
|
||||
{
|
||||
unregisterObject();
|
||||
|
||||
delete m_private;
|
||||
}
|
||||
|
||||
bool tdeobexNode::registerObject(const TQT_DBusConnection& connection, const TQString& path)
|
||||
{
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
if (!m_private->objectPath.isEmpty()) unregisterObject();
|
||||
|
||||
m_private->connection = connection;
|
||||
m_private->objectPath = path;
|
||||
|
||||
if (!m_private->connection.registerObject(path, this))
|
||||
{
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_private->interfaces.isEmpty())
|
||||
{
|
||||
TQString name = "org.freedesktop.DBus.Introspectable";
|
||||
TQT_DBusObjectBase* interface = m_private;
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Agent1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool tdeobexNode::registerObject(const TQT_DBusConnection& connection, const TQString& path, const TQString& next)
|
||||
{
|
||||
if (path.isEmpty()) return false;
|
||||
|
||||
if (!m_private->objectPath.isEmpty()) unregisterObject();
|
||||
|
||||
m_private->connection = connection;
|
||||
m_private->objectPath = path;
|
||||
m_private->nextNode = next;
|
||||
|
||||
if (!m_private->connection.registerObject(path, this))
|
||||
{
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
m_private->nextNode = TQString();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_private->interfaces.isEmpty())
|
||||
{
|
||||
TQString name = "org.freedesktop.DBus.Introspectable";
|
||||
TQT_DBusObjectBase* interface = m_private;
|
||||
m_private->interfaces.insert(name, interface);
|
||||
|
||||
name = "org.bluez.obex.Agent1";
|
||||
interface = createInterface(name);
|
||||
Q_ASSERT(interface != 0);
|
||||
m_private->interfaces.insert(name, interface);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void tdeobexNode::unregisterObject()
|
||||
{
|
||||
if (m_private->objectPath.isEmpty()) return;
|
||||
|
||||
m_private->connection.unregisterObject(m_private->objectPath);
|
||||
|
||||
m_private->connection = TQT_DBusConnection();
|
||||
m_private->objectPath = TQString();
|
||||
}
|
||||
|
||||
bool tdeobexNode::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::iterator findIt = m_private->interfaces.find(message.interface());
|
||||
if (findIt == m_private->interfaces.end()) return false;
|
||||
|
||||
return delegateMethodCall(message, findIt.data());
|
||||
}
|
||||
|
||||
tdeobexNode::Private::~Private()
|
||||
{
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::const_iterator it = interfaces.begin();
|
||||
TQMap<TQString, TQT_DBusObjectBase*>::const_iterator endIt = interfaces.end();
|
||||
for (; it != endIt; ++it)
|
||||
{
|
||||
TQT_DBusObjectBase* interface = it.data();
|
||||
if (interface != this)
|
||||
delete interface;
|
||||
}
|
||||
interfaces.clear();
|
||||
}
|
||||
|
||||
bool tdeobexNode::Private::Introspect(TQString& data, TQT_DBusError& error)
|
||||
{
|
||||
Q_UNUSED(error);
|
||||
if (introspectionData.isEmpty()) cacheIntrospectionData();
|
||||
|
||||
data = introspectionData;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void tdeobexNode::Private::handleMethodReply(const TQT_DBusMessage& reply)
|
||||
{
|
||||
connection.send(reply);
|
||||
}
|
||||
|
||||
void tdeobexNode::Private::cacheIntrospectionData()
|
||||
{
|
||||
TQDomDocument doc;
|
||||
TQDomElement nodeElement = doc.createElement("node");
|
||||
if (!objectPath.isEmpty() && objectPath.compare("/") != 0)
|
||||
{
|
||||
nodeElement.setAttribute ( "name", objectPath );
|
||||
}
|
||||
if (!interfaces.isEmpty()) {
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::freedesktop::DBus::IntrospectableInterface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
}
|
||||
|
||||
TQDomElement interfaceElement = doc.createElement("interface");
|
||||
org::bluez::obex::Agent1Interface::buildIntrospectionData(interfaceElement);
|
||||
nodeElement.appendChild(interfaceElement);
|
||||
|
||||
if (!nextNode.isEmpty()) {
|
||||
TQDomElement nodeElement1 = doc.createElement("node");
|
||||
nodeElement1.setAttribute ( "name", nextNode );
|
||||
nodeElement.appendChild(nodeElement1);
|
||||
}
|
||||
|
||||
doc.appendChild(nodeElement);
|
||||
|
||||
introspectionData = "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n";
|
||||
introspectionData += doc.toString();
|
||||
}
|
||||
|
||||
}; // namespace trinitydesktop
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -0,0 +1,53 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(TDEOBEXNODE_H_INCLUDED)
|
||||
#define TDEOBEXNODE_H_INCLUDED
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace trinitydesktop
|
||||
{
|
||||
|
||||
class tdeobexNode : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
tdeobexNode();
|
||||
|
||||
virtual ~tdeobexNode();
|
||||
|
||||
bool registerObject(const TQT_DBusConnection& connection, const TQString& path);
|
||||
bool registerObject(const TQT_DBusConnection& connection, const TQString& path, const TQString& next);
|
||||
|
||||
void unregisterObject();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString& interfaceName) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private* m_private;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
tdeobexNode(const tdeobexNode&);
|
||||
tdeobexNode& operator=(const tdeobexNode&);
|
||||
}; // class tdeobexNode
|
||||
|
||||
}; // namespace trinitydesktop
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //TDEOBEXNODE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 432 B After Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 681 B After Width: | Height: | Size: 681 B |
Before Width: | Height: | Size: 471 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 785 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 494 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 948 B After Width: | Height: | Size: 948 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,249 @@
|
||||
/*
|
||||
*
|
||||
* New Bluetooth App for TDE and bluez5
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "trayicon.h"
|
||||
#include "application.h"
|
||||
|
||||
TDEBluetoothApp::TDEBluetoothApp() :
|
||||
KUniqueApplication()
|
||||
{
|
||||
m_config = new TDEConfig("tdebluezrc");
|
||||
// Enable autostart
|
||||
m_config->setGroup("General");
|
||||
m_config->readBoolEntry("AutoStart", true);
|
||||
bool authAgentStart = m_config->readBoolEntry("authAgent", true);
|
||||
bool obexServerStart = m_config->readBoolEntry("obexSrv", true);
|
||||
|
||||
authAgent = 0;
|
||||
obexServer = 0;
|
||||
|
||||
manager = new ObjectManagerImpl("org.bluez", "/", this, "ObjectManager");
|
||||
if (!manager->isConnectedToDBUS())
|
||||
{
|
||||
tqDebug("ObjectManager is not connected to DBus");
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectManagerImpl::AdapterList al = manager->getAdapters();
|
||||
ObjectManagerImpl::AdapterList::Iterator ait = al.begin();
|
||||
for (ait; ait != al.end(); ++ait)
|
||||
{
|
||||
AdapterImpl *a = new AdapterImpl("org.bluez", (*ait));
|
||||
a->setConnection((*(manager->getConnection())));
|
||||
adapters.insert((*ait), a);
|
||||
}
|
||||
|
||||
ObjectManagerImpl::DeviceList dl = manager->getDevices();
|
||||
ObjectManagerImpl::DeviceList::Iterator dit = dl.begin();
|
||||
for (dit; dit != dl.end(); ++dit)
|
||||
{
|
||||
DeviceImpl *d = new DeviceImpl("org.bluez", (*dit));
|
||||
d->setConnection((*(manager->getConnection())));
|
||||
devices.insert((*dit), d);
|
||||
}
|
||||
|
||||
// connect to manager signals
|
||||
connect(manager, SIGNAL(adapterAdded(const TQString&)),
|
||||
TQT_SLOT(slotAdapterAdded(const TQString&)));
|
||||
connect(manager, SIGNAL(adapterRemoved(const TQString&)),
|
||||
TQT_SLOT(slotAdapterRemoved(const TQString&)));
|
||||
connect(manager, SIGNAL(deviceAdded(const TQString&)),
|
||||
TQT_SLOT(slotDeviceAdded(const TQString&)));
|
||||
connect(manager, SIGNAL(deviceRemoved(const TQString&)),
|
||||
TQT_SLOT(slotDeviceRemoved(const TQString&)));
|
||||
// connect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
|
||||
trayIcon = new TrayIcon(this);
|
||||
setMainWidget(trayIcon);
|
||||
|
||||
if (authAgentStart)
|
||||
{
|
||||
if (!startAuthAgent())
|
||||
tqWarning("TDEBluezAuth failed to start.");
|
||||
}
|
||||
if (obexServerStart)
|
||||
{
|
||||
if (!startObexSrv())
|
||||
{
|
||||
tqWarning("TDEBluezOBEX failed to start.");
|
||||
}
|
||||
// else
|
||||
// connect(trayIcon, SIGNAL(setObexSrv(bool)), this, SLOT(slotObexSrv(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
TDEBluetoothApp::~TDEBluetoothApp()
|
||||
{
|
||||
delete trayIcon;
|
||||
if (!stopAuthAgent())
|
||||
authAgent->kill();
|
||||
delete authAgent;
|
||||
|
||||
if (!stopObexSrv())
|
||||
obexServer->kill();
|
||||
delete obexServer;
|
||||
|
||||
if (manager->isConnectedToDBUS())
|
||||
{
|
||||
AdaptersMap::Iterator ait = adapters.begin();
|
||||
for (ait; ait != adapters.end(); ++ait)
|
||||
{
|
||||
AdapterImpl *a = ait.data();
|
||||
if (a)
|
||||
delete a;
|
||||
}
|
||||
DevicesMap::Iterator dit = devices.begin();
|
||||
for (dit; dit != devices.end(); ++dit)
|
||||
{
|
||||
DeviceImpl *d = dit.data();
|
||||
if (d)
|
||||
delete d;
|
||||
}
|
||||
devices.clear();
|
||||
adapters.clear();
|
||||
}
|
||||
delete manager;
|
||||
|
||||
if (m_config->isDirty())
|
||||
m_config->sync();
|
||||
|
||||
delete m_config;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::startAuthAgent()
|
||||
{
|
||||
authAgent = new TQProcess();
|
||||
authAgent->addArgument("tdebluezauth");
|
||||
authAgent->addArgument("--nofork");
|
||||
if (!authAgent->start())
|
||||
return false;
|
||||
TQObject::connect(authAgent, TQT_SIGNAL(processExited()), this,
|
||||
TQT_SLOT(slotprocresult()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::stopAuthAgent()
|
||||
{
|
||||
if (authAgent)
|
||||
{
|
||||
TQObject::disconnect(authAgent, 0, 0, 0);
|
||||
int pid = authAgent->processIdentifier();
|
||||
if (authAgent->isRunning())
|
||||
{
|
||||
authAgent->tryTerminate();
|
||||
wait(&pid);
|
||||
}
|
||||
if (authAgent->isRunning())
|
||||
return false;
|
||||
else
|
||||
authAgent = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::startObexSrv()
|
||||
{
|
||||
obexServer = new TQProcess();
|
||||
obexServer->addArgument("/usr/lib/bluetooth/obexd");
|
||||
// obexServer->addArgument("--nofork");
|
||||
if (!obexServer->start())
|
||||
return false;
|
||||
TQObject::connect(obexServer, TQT_SIGNAL(processExited()), this,
|
||||
TQT_SLOT(slotprocresult()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::stopObexSrv()
|
||||
{
|
||||
if (obexServer)
|
||||
{
|
||||
TQObject::disconnect(obexServer, 0, 0, 0);
|
||||
int pid = obexServer->processIdentifier();
|
||||
if (obexServer->isRunning())
|
||||
{
|
||||
obexServer->tryTerminate();
|
||||
wait(&pid);
|
||||
}
|
||||
if (obexServer->isRunning())
|
||||
return false;
|
||||
else
|
||||
obexServer = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotprocresult() {
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotAdapterAdded(const TQString &adapter)
|
||||
{
|
||||
AdapterImpl *a = new AdapterImpl("org.bluez", adapter);
|
||||
a->setConnection((*(manager->getConnection())));
|
||||
adapters.insert(adapter, a);
|
||||
if (!authAgent || !authAgent->isRunning())
|
||||
startAuthAgent();
|
||||
if (!obexServer || !obexServer->isRunning())
|
||||
startObexSrv();
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotAdapterRemoved(const TQString &adapter)
|
||||
{
|
||||
adapters.remove(adapter);
|
||||
if (adapters.isEmpty())
|
||||
{
|
||||
if (authAgent->isRunning())
|
||||
stopAuthAgent();
|
||||
if (obexServer->isRunning())
|
||||
stopObexSrv();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: run agents only if enabled in config
|
||||
//void TDEBluetoothApp::slotPowerOnChanged(const TQString &adapter, bool state) {
|
||||
// kdDebug() << k_funcinfo << endl;
|
||||
// if(state) {
|
||||
// if (!authAgent->isRunning())
|
||||
// startAuthAgent();
|
||||
// }
|
||||
// else {
|
||||
// if (authAgent->isRunning())
|
||||
// stopAuthAgent();
|
||||
// }
|
||||
//}
|
||||
|
||||
void TDEBluetoothApp::slotDeviceAdded(const TQString &device)
|
||||
{
|
||||
DeviceImpl *d = new DeviceImpl("org.bluez", device);
|
||||
d->setConnection((*(manager->getConnection())));
|
||||
devices.insert(device, d);
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotDeviceRemoved(const TQString &device)
|
||||
{
|
||||
devices.remove(device);
|
||||
}
|
||||
|
||||
#include "application.moc"
|
@ -1,5 +1,6 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>DeviceDialog</class>
|
||||
<include location="global">kseparator.h</include>
|
||||
<widget class="TQDialog">
|
||||
<property name="name">
|
||||
<cstring>DeviceDialog</cstring>
|
@ -0,0 +1,358 @@
|
||||
/*
|
||||
*
|
||||
* Dialogs for tdebluez device configuration
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <tqradiobutton.h>
|
||||
#include <tqcheckbox.h>
|
||||
#include <kcombobox.h>
|
||||
|
||||
#include <interfaces/device1Proxy.h>
|
||||
#include <btuuids.h>
|
||||
#include <devicemimeconverter.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "devicesetupwizard.h"
|
||||
|
||||
#define LOGOTIMEOUT 100 //100 msec
|
||||
#define CONTIMEOUT 50000 //50 sec
|
||||
|
||||
DeviceSetupWizard::DeviceSetupWizard(ObjectManagerImpl* _manager,
|
||||
AdapterImpl* _adapter, DeviceImpl* _device) :
|
||||
DeviceSetupWizardDialog(), manager(_manager),
|
||||
adapter(_adapter), newdev(_device)
|
||||
{
|
||||
pairingpage = page(0);
|
||||
setHelpEnabled(pairingpage, false);
|
||||
|
||||
connectpage = page(1);
|
||||
setHelpEnabled(connectpage, false);
|
||||
|
||||
// connectingpage = page(2);
|
||||
// setHelpEnabled(connectingpage, false);
|
||||
|
||||
donepage = page(2);
|
||||
setHelpEnabled(donepage, false);
|
||||
setFinishEnabled(donepage, true);
|
||||
cancelButton()->setText(i18n("S&kip Wizard"));
|
||||
|
||||
setModal(true);
|
||||
|
||||
TQT_DBusError error;
|
||||
if (newdev->getPaired(error))
|
||||
{
|
||||
setAppropriate(pairingpage, false);
|
||||
updateServiceList();
|
||||
TQWizard::showPage(connectpage);
|
||||
}
|
||||
if (newdev->getConnected(error))
|
||||
{
|
||||
setAppropriate(connectpage, false);
|
||||
setAppropriate(connectingpage, false);
|
||||
TQWizard::showPage(donepage);
|
||||
}
|
||||
if (newdev->getTrusted(error))
|
||||
trustedCheckBox->setChecked(true);
|
||||
|
||||
connect(manager, SIGNAL(devicePairedChanged(const TQString&, bool)), this,
|
||||
TQT_SLOT(slotDevicePairedChanged(const TQString&, bool)));
|
||||
connect(manager, SIGNAL(deviceServicesResolvedChanged(const TQString&, bool)), this,
|
||||
TQT_SLOT(slotDeviceServicesResolvedChanged(const TQString&, bool)));
|
||||
connect(manager, SIGNAL(deviceConnectedChanged(const TQString&, bool)), this,
|
||||
TQT_SLOT(slotDeviceConnectedChanged(const TQString&, bool)));
|
||||
|
||||
connect(newdev, SIGNAL(AsyncErrorResponseDetected(int /*asyncCallId*/, const TQT_DBusError)),
|
||||
this, TQT_SLOT(slotAsyncErrorResponseDetected(int /*asyncCallId*/, const TQT_DBusError)));
|
||||
// connect(newdev, SIGNAL(DisconnectAsyncReply(int /*asyncCallId*/)),
|
||||
// this, TQT_SLOT(slotDisconnectAsyncReply(int /*asyncCallId*/)));
|
||||
// connect(newdev, SIGNAL(CancelPairingAsyncReply(int /*asyncCallId*/)),
|
||||
// this, TQT_SLOT(slotCancelPairingAsyncReply(int /*asyncCallId*/)));
|
||||
}
|
||||
|
||||
DeviceSetupWizard::~DeviceSetupWizard()
|
||||
{
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::next()
|
||||
{
|
||||
TQT_DBusError error;
|
||||
if (currentPage() == pairingpage)
|
||||
{
|
||||
if (pairingRadioButton1->isChecked())
|
||||
{
|
||||
int asyncCallId = 0 ;
|
||||
connect(newdev, SIGNAL(PairAsyncReply(int /*asyncCallId*/)),
|
||||
this, TQT_SLOT(slotPairAsyncReply(int /*asyncCallId*/)));
|
||||
if (newdev->PairAsync(asyncCallId,error))
|
||||
{
|
||||
asyncCalls[asyncCallId]="Pair";
|
||||
TQTimer::singleShot(40000, this, TQT_SLOT(slotPairingTimeOut()));
|
||||
} else {
|
||||
// TODO: check for error
|
||||
}
|
||||
}
|
||||
else
|
||||
TQWizard::next();
|
||||
}
|
||||
else if (currentPage() == connectpage)
|
||||
{
|
||||
TQString selText = connectComboBox->currentText();
|
||||
TQString reqUUID;
|
||||
TQStringList uuids = newdev->getUUIDs(error);
|
||||
for (TQStringList::iterator it = uuids.begin(); it != uuids.end(); ++it)
|
||||
{
|
||||
TQString u = resolveUUID((*it));
|
||||
if (u == selText)
|
||||
{
|
||||
reqUUID = (*it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
kdDebug() << "REQUESTED UUID: " << reqUUID << endl;
|
||||
|
||||
int asyncCallId = 0 ;
|
||||
connect(newdev, SIGNAL(ConnectProfileAsyncReply(int /*asyncCallId*/)),
|
||||
this, TQT_SLOT(slotConnectProfileAsyncReply(int /*asyncCallId*/)));
|
||||
if (newdev->ConnectProfileAsync(asyncCallId, reqUUID, error))
|
||||
{
|
||||
asyncCalls[asyncCallId]="ConnectProfile";
|
||||
TQTimer::singleShot(10 * 1000, this, TQT_SLOT(slotConnectTimeout()));
|
||||
} else {
|
||||
// TODO: check for error
|
||||
}
|
||||
// see slotDevicePairedChanged
|
||||
}
|
||||
// else if (currentPage() == connectingpage)
|
||||
// {
|
||||
// if (!newdev->getConnected(error))
|
||||
// {
|
||||
// int asyncCallId = 0 ;
|
||||
// connect(newdev, SIGNAL(ConnectAsyncReply(int /*asyncCallId*/)),
|
||||
// this, TQT_SLOT(slotConnectAsyncReply(int /*asyncCallId*/)));
|
||||
// if (newdev->ConnectAsync(asyncCallId, error)) {
|
||||
// asyncCalls[asyncCallId]="Connect";
|
||||
// TQTimer::singleShot(10 * 1000, this, TQT_SLOT(slotConnectTimeout()));
|
||||
// } else {
|
||||
// // TODO: check for error
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// TQWizard::next();
|
||||
// }
|
||||
else if (currentPage() == donepage)
|
||||
{
|
||||
if (trustedCheckBox->isChecked())
|
||||
{
|
||||
finishButton()->setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
trustedCheckBox->setFocus();
|
||||
}
|
||||
}
|
||||
// if(currentPage()==refinepage) {
|
||||
// finishButton()->setFocus();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::back()
|
||||
{
|
||||
TQWizard::back();
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotDevicePairedChanged(const TQString &path,
|
||||
bool paired)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQString name = newdev->getName(error);
|
||||
if (paired)
|
||||
{
|
||||
TQMessageBox::information(this, i18n("Pairing succesfull"),
|
||||
i18n("Paired with %1 successfully!").arg(name),
|
||||
TQMessageBox::Ok | TQMessageBox::Default,
|
||||
TQMessageBox::NoButton, TQMessageBox::NoButton);
|
||||
updateServiceList();
|
||||
setBackEnabled(connectpage, false);
|
||||
} else {
|
||||
TQMessageBox::information(this, i18n("Pairing failed"),
|
||||
i18n("Could not pair with ") + name
|
||||
+ i18n("\nCheck if the device is available."),
|
||||
TQMessageBox::Ok | TQMessageBox::Default,
|
||||
TQMessageBox::NoButton, TQMessageBox::NoButton);
|
||||
}
|
||||
|
||||
setNextEnabled(pairingpage, true);
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotDeviceServicesResolvedChanged(const TQString &path,
|
||||
bool resolved)
|
||||
{
|
||||
if (resolved)
|
||||
{
|
||||
setNextEnabled(connectpage, true);
|
||||
if (currentPage() == pairingpage)
|
||||
TQWizard::next();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotDeviceConnectedChanged(const TQString &path,
|
||||
bool connect)
|
||||
{
|
||||
if (connect)
|
||||
{
|
||||
setNextEnabled(connectingpage, true);
|
||||
if (currentPage() == connectpage)
|
||||
TQWizard::next();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotPairingTimeOut()
|
||||
{
|
||||
TQT_DBusError error;
|
||||
slotDevicePairedChanged("", newdev->getPaired(error));
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotConnectTimeOut()
|
||||
{
|
||||
TQT_DBusError error;
|
||||
if (newdev->getConnected(error))
|
||||
if (currentPage() == connectingpage)
|
||||
TQWizard::next();
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotAsyncErrorResponseDetected(int asyncCallId, const TQT_DBusError error) {
|
||||
|
||||
tqDebug("%s failed\n%s", asyncCalls[asyncCallId].latin1(),
|
||||
(error.isValid()) ? error.message().latin1() : "");
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotConnectProfileAsyncReply(int asyncCallId) {
|
||||
TQT_DBusError error;
|
||||
asyncCalls.remove(asyncCallId);
|
||||
slotDeviceConnectedChanged("", true);
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotPairAsyncReply(int asyncCallId) {
|
||||
TQT_DBusError error;
|
||||
asyncCalls.remove(asyncCallId);
|
||||
slotDevicePairedChanged("", newdev->getPaired(error));
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotNext()
|
||||
{
|
||||
TQWizard::next();
|
||||
}
|
||||
|
||||
bool DeviceSetupWizard::askClose()
|
||||
{
|
||||
TQString text;
|
||||
if (currentPage() == page(0))
|
||||
{
|
||||
text =
|
||||
i18n(
|
||||
"<p>Are you sure you want to quit the Device Settings Wizard?</p>"
|
||||
"<p>The Device Settings Wizard helps you to configure the BT device and use it later.</p>"
|
||||
"<p>Click <b>Cancel</b> to return and finish your setup.</p>");
|
||||
}
|
||||
else
|
||||
{
|
||||
text =
|
||||
i18n(
|
||||
"<p>Are you sure you want to quit the Device Settings Wizard?</p>"
|
||||
"<p>If yes, click <b>Quit</b> and all changes will be lost."
|
||||
"<br>If not, click <b>Cancel</b> to return and finish your setup.</p>");
|
||||
}
|
||||
int status = KMessageBox::warningContinueCancel(this, text,
|
||||
i18n("All Changes Will Be Lost"), KStdGuiItem::quit());
|
||||
if (status == KMessageBox::Continue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** the cancel button is connected to the reject() slot of TQDialog,
|
||||
* so we have to reimplement this here to add a dialogbox to ask if we
|
||||
* really want to quit the wizard.
|
||||
*/
|
||||
void DeviceSetupWizard::reject()
|
||||
{
|
||||
close(); // this will trigger the close event caught below
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::closeEvent(TQCloseEvent* e)
|
||||
{
|
||||
if (askClose())
|
||||
hide();
|
||||
else
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
/** maybe call a dialog that the wizard has finished. */
|
||||
void DeviceSetupWizard::accept()
|
||||
{
|
||||
TQT_DBusError error;
|
||||
if (trustedCheckBox->isChecked())
|
||||
{
|
||||
if (!newdev->getTrusted(error))
|
||||
{
|
||||
// newdev->setTrusted(error);
|
||||
newdev->setTrusted(true, error);
|
||||
if (error.isValid())
|
||||
tqDebug("Could not set trusted for %s\nError: %s",
|
||||
newdev->getPath().latin1(), error.message().latin1());
|
||||
else
|
||||
kdDebug() << "Trusted set for: " << newdev->getAlias(error) << endl;
|
||||
}
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::updateServiceList()
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQStringList uuids = newdev->getUUIDs(error);
|
||||
for (TQStringList::iterator it = uuids.begin(); it != uuids.end(); ++it)
|
||||
{
|
||||
if (((*it) == "00001203-0000-1000-8000-00805f9b34fb") || //Generic Audio
|
||||
((*it) == "00001108-0000-1000-8000-00805f9b34fb") || //Headset
|
||||
((*it) == "0000111e-0000-1000-8000-00805f9b34fb") || //Handsfree
|
||||
((*it) == "0000111f-0000-1000-8000-00805f9b34fb") || //Handsfree AG
|
||||
((*it) == "0000110a-0000-1000-8000-00805f9b34fb") || //A2DP Source
|
||||
((*it) == "0000110b-0000-1000-8000-00805f9b34fb") || //A2DP Sink
|
||||
((*it) == "00001103-0000-1000-8000-00805f9b34fb") || //DUN Gateway
|
||||
((*it) == "00001800-0000-1000-8000-00805f9b34fb") //GAP
|
||||
)
|
||||
{
|
||||
connectComboBox->insertItem(resolveUUID((*it)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "devicesetupwizard.moc"
|
@ -1,5 +1,6 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>DeviceSetupWizardDialog</class>
|
||||
<include location="global">kcombobox.h</include>
|
||||
<widget class="TQWizard">
|
||||
<property name="name">
|
||||
<cstring>DeviceSetupWizardDialog</cstring>
|
@ -0,0 +1,253 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>MediaCtlDlg</class>
|
||||
<widget class="TQWidget">
|
||||
<property name="name">
|
||||
<cstring>MediaCtlDlg</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>257</width>
|
||||
<height>178</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Media Control</string>
|
||||
</property>
|
||||
<widget class="TQLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout3</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>247</width>
|
||||
<height>159</height>
|
||||
</rect>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQSlider" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>tQVolumeSlider</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>NoMarks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQSlider" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>tQProgressSlider</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickmarks">
|
||||
<enum>Below</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>pixmapAudio</cstring>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>image0</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQLayoutWidget" row="0" column="0" rowspan="2" colspan="1">
|
||||
<property name="name">
|
||||
<cstring>layoutButtons</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQPushButton" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonPlay</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>></string>
|
||||
<comment>Play</comment>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="toggleButton">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQPushButton" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonSeekForward</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>31</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>>></string>
|
||||
<comment>Seek Forward</comment>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQPushButton" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonForward</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>>|</string>
|
||||
<comment>Next</comment>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQPushButton" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonSeekBackward</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><<</string>
|
||||
<comment>Seek Back</comment>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQPushButton" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonBackward</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>|<</string>
|
||||
<comment>Previous</comment>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQPushButton" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonStop</cstring>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
<comment>Stop</comment>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="TQPushButton" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>tQPushButtonRepeat</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>image1</pixmap>
|
||||
</property>
|
||||
<property name="accel">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="toggleButton">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</widget>
|
||||
<images>
|
||||
<image name="image0">
|
||||
<data format="PNG" length="389">89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af40000000473424954080808087c0864880000013c494441545885edd44d8a22311887f19f3078010fe6091457e2815c097e5d4711575e4010541475a1961f65f52a3da4a9699a1eed81a1febba4429ee74dbd09458a1429f28f53fa415696c7fef553e06ab50a2a958a5eaff7fef1950219349b4dd06eb741abd58a16bd42208346a3118167b359eee2670a6450abd540a7d389c0cbe5f2650211b8dbed82d3e91481e7f3f9d30572c1c7e3118cc7e308bc5eaf9f26108187c321381c0e60341a81cd66f329f83b0219d4eb7530180cc07ebfc7ef8ac378b55a7d69d3af084415f7fbfd08349d4ea3f162b10097cbe5af05a2eb14ba3a1c750087a30ef301fc783cbe2d900bfed85ca1e200de6eb7e07ebf835229ff954fd3f453812cfce38fe0d05cb7db0dec76bb77709aa6cee7b324496459e67abd4a922457205ccf3f09984c26a05c2ee76e50a4489122ff5dde0051dcb85173c955470000000049454e44ae426082</data>
|
||||
</image>
|
||||
<image name="image1">
|
||||
<data format="PNG" length="854">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000000473424954080808087c0864880000030d49444154388dedd55b4814511807f0ff9999bdccec2415ae9bb8ed206e51b151490f5eb6d8cca8a7e862659715840a89ae04fa20928291866117e8c5a790a82028eaa17a88322c82a848964d0da92ca4a0dad471e7d4ceecd743bab86169906f7df03d9c0bbf73f8387c871111a623846951ffc3e3431a3f608c89001c00c4291e9a046001f84644d6843063cc595357332fb422d862936c45494aaa93a982200c9b09abf3c1fd7bd58cb13e2232d2e0402060afae3e12280d85eecef5fa94acac3992ec94c1184b4b207dccb931a3fffddb3562a9f0c834ad924020d0158944bea7e0bcbcbcccc260715376768ea2aa19e2d3e74f74ce8d496f2c3b157de18245ae2cb7472e0c16357577f755001848c19aa6cdb49256414e768ef4f071a76e18c69eb28ddb2e4f065fbd76a5fcd98ba76df94b97abaffa7a0b344d9b39060b00e0f57a338c78dce574ca88c5bea8534101a06ce3b6cb5f6331d566b3c1881b2eafd79b91aa3f00f8fd7e99733e5a373e1533159c735856029c73f8fd7e796c5e02009fcf270f3ce907f067f8fcf9b34126b23b8c61b86aef813963b0699ae09cc3b7d897820500d0340d969534e2c608ec36bbded2da5cfe2b7aea54739089ecd6d62ddb157d64c403002dadcde5a228ea834383304dd3d0340d69b0dbedd615598946225d66c9aa5297c36e6f6b3c514f4d271b3f00c0f1e686a060136f55842b55d929431004de78a29e24496a5bb62cdfd5dbdb6329b21275bbdd7a5a290044d7ac5ed77ef1d285854585c58e1de56175d6acd938d650eb01b0548070a96cd3565512258cc475ecda59e14c9809c4625fd4972fa3564f77f7f75d3b2adb0144c76036ae1f075ebfee5b77e3e6f5f0a7cf9fe673ce9d8aac0c35d41f3ffaa0f3bebfa3a3e3f0a183471cc9a489b3e75a13c3c3bacd6e77189999993d1bd66fbe989b9b7b1b4024550b221a9f1e225a4b446122aa22a2dd44944f44a17b1d775b6aeb6a78ffbb37b4ff60158dae8747f77b7e71d29b10808f00ee4cf020586865892832493c7da6759fa2b8bee167036affdd0b627ff1353100c500960020009d00bafe05fc57316d8dfe07fa3155dcf5eed88b0000000049454e44ae426082</data>
|
||||
</image>
|
||||
</images>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -0,0 +1,749 @@
|
||||
/*
|
||||
*
|
||||
* TrayIcon for tdebluez
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <kprocess.h>
|
||||
#include <kstdaction.h>
|
||||
#include "trayicon.h"
|
||||
|
||||
using namespace TDEBluetooth;
|
||||
//using namespace std;
|
||||
|
||||
TrayIcon::TrayIcon(TDEBluetoothApp* app)
|
||||
{
|
||||
iconConnectingBlinkState = false;
|
||||
this->helpMenu = new KHelpMenu(this, TDEApplication::kApplication()->aboutData());
|
||||
this->app = app;
|
||||
|
||||
manager = app->manager;
|
||||
|
||||
// iconState = IDLE;
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
// config->setGroup("UI");
|
||||
// alwaysVisible = config->readBoolEntry("alwaysVisible", true);
|
||||
config->setGroup("General");
|
||||
int agentstate = config->readBoolEntry("authAgent", true);
|
||||
int obexserver = config->readBoolEntry("obexSrv", true);
|
||||
int autostart = config->readBoolEntry("AutoStart", true);
|
||||
|
||||
blinkTimer = new TQTimer(this);
|
||||
connect(blinkTimer, SIGNAL(timeout()), this, TQT_SLOT(updateIcon()));
|
||||
|
||||
deviceConfDialog = 0;
|
||||
deviceWizard = 0;
|
||||
|
||||
// // KBlueMon
|
||||
//// kbluemonAction = new TDEAction(i18n("KBlue&Mon"),
|
||||
//// TDEGlobal::iconLoader()->loadIcon("info", TDEIcon::Small, 16),
|
||||
//// TDEShortcut::null(), this, "kbluemon");
|
||||
//// connect(kbluemonAction, SIGNAL(activated()), this, SLOT(slotkbluemonitor()));
|
||||
////
|
||||
//// // KBlueLock
|
||||
//// kbluelockAction = new TDEAction(i18n("KBlue&Lock"),
|
||||
//// TDEGlobal::iconLoader()->loadIcon("kbluelock", TDEIcon::Small, 16),
|
||||
//// TDEShortcut::null(), this, "kbluelock");
|
||||
//// connect(kbluelockAction, SIGNAL(activated()), this, SLOT(slotkbluelock()));
|
||||
////
|
||||
//// // KBtobexclient
|
||||
//// kbtobexclientAction = new TDEAction(i18n("&Send File..."),
|
||||
//// TDEGlobal::iconLoader()->loadIcon("attach", TDEIcon::Small, 16),
|
||||
//// TDEShortcut::null(), this, "kbtobexclient");
|
||||
//// connect(kbtobexclientAction, SIGNAL(activated()), this, SLOT(slotkbtobexclient()));
|
||||
////
|
||||
// BT switch
|
||||
TDEBluetoothApp::AdaptersMap::iterator it = app->adapters.begin();
|
||||
for (it; it != app->adapters.end(); ++it)
|
||||
{
|
||||
// slotAddAdapter(it.key());
|
||||
TQT_DBusError error;
|
||||
TQString name = app->adapters[it.key()]->getName(error);
|
||||
//TODO check for error
|
||||
bool powered = app->adapters[it.key()]->getPowered(error);
|
||||
//TODO check for error
|
||||
TDEToggleAction *ad_a = new TDEToggleAction(this, name.utf8());
|
||||
connect(ad_a, SIGNAL(toggled(bool)), this, TQT_SLOT(slotPowerOn(bool)));
|
||||
showPowerOnActionMap.insert(it.key(), ad_a);
|
||||
setTrayIconAdapterState(it.key(), name, powered);
|
||||
}
|
||||
|
||||
// Configuration menu
|
||||
configActionMenu = new TDEActionMenu(i18n("&Configuration"),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
this, "config_menu");
|
||||
|
||||
// Help menu
|
||||
helpActionMenu = new TDEActionMenu(i18n("&Help"),
|
||||
TDEGlobal::iconLoader()->loadIcon("help", TDEIcon::Small, 16), this,
|
||||
"help_menu");
|
||||
|
||||
// show documentation
|
||||
showHelpAction = KStdAction::help(this, TQT_SLOT(slotShowHelp()),
|
||||
actionCollection());
|
||||
|
||||
// "About" menu item
|
||||
aboutAction = KStdAction::aboutApp(this, TQT_SLOT(slotAbout()),
|
||||
actionCollection());
|
||||
|
||||
// // Inputdevice configuration
|
||||
// inputConfigAction = new TDEAction(i18n("&Input Devices..."),
|
||||
// TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
// TDEShortcut::null(), this, "input_config");
|
||||
// connect(inputConfigAction, SIGNAL(activated()), this, SLOT(slotInputConfig()));
|
||||
|
||||
// Bluetooth Device configuration
|
||||
// from 06_rev748007.patch
|
||||
deviceConfigAction = new TDEAction(i18n("&Devices..."),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
TDEShortcut::null(), this, "device_config");
|
||||
connect(deviceConfigAction, SIGNAL(activated()), this,
|
||||
TQT_SLOT(slotDeviceConfig()));
|
||||
|
||||
// Bluetooth Adapter configuration
|
||||
adapterConfigAction = new TDEAction(i18n("&Adapters..."),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
TDEShortcut::null(), this, "device_config");
|
||||
connect(adapterConfigAction, SIGNAL(activated()), this,
|
||||
TQT_SLOT(slotAdapterConfig()));
|
||||
|
||||
// // Paired device configuration
|
||||
// pairedConfigAction = new TDEAction(i18n("&Paired/Trusted Devices..."),
|
||||
// TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
// TDEShortcut::null(), this, "paired_config");
|
||||
// connect(pairedConfigAction, SIGNAL(activated()), this, SLOT(slotPairedConfig()));
|
||||
|
||||
// Autostart switch
|
||||
autostartIconAction = new TDEToggleAction(this, "autostart");
|
||||
connect(autostartIconAction, SIGNAL(toggled(bool)), this,
|
||||
TQT_SLOT(slotIconAutostartToggled(bool)));
|
||||
autostartIconAction->setChecked(autostart);
|
||||
autostartIconAction->setText(i18n("&Auto Start"));
|
||||
|
||||
// Agent switch
|
||||
agentIconAction = new TDEToggleAction(this, "tdeauthagent");
|
||||
connect(agentIconAction, SIGNAL(toggled(bool)), this,
|
||||
TQT_SLOT(slotIconAgentToggled(bool)));
|
||||
agentIconAction->setChecked(agentstate);
|
||||
agentIconAction->setText(i18n("Auth A&gent"));
|
||||
|
||||
// Obexsrv switch
|
||||
obexIconAction = new TDEToggleAction(this, "tdebtobexsrv");
|
||||
connect(obexIconAction, SIGNAL(toggled(bool)), this,
|
||||
TQT_SLOT(slotObexSrv(bool)));
|
||||
obexIconAction->setChecked(obexserver);
|
||||
obexIconAction->setText(i18n("&Obex Server"));
|
||||
|
||||
// // Always-visible switch
|
||||
// showIconAction = new TDEToggleAction(this, "always_visible");
|
||||
// connect(showIconAction, SIGNAL(toggled(bool)), this, SLOT(slotShowIconToggled(bool)));
|
||||
// showIconAction->setChecked(alwaysVisible);
|
||||
// showIconAction->setText(i18n("Always &Visible"));
|
||||
// configActionMenu->insert(showIconAction);
|
||||
|
||||
KPixmap logoPixmap = TDEGlobal::iconLoader()->loadIcon("tdebluez",
|
||||
TDEIcon::Small,
|
||||
22);
|
||||
iconIdle = logoPixmap;
|
||||
iconOff = logoPixmap;
|
||||
iconConnected = logoPixmap;
|
||||
iconNoAdapter = logoPixmap;
|
||||
KPixmapEffect::toGray(iconOff);
|
||||
KPixmapEffect::fade(iconOff, 0.3, TQColor(255, 255, 255));
|
||||
KPixmapEffect::fade(iconConnected, 0.5, TQColor(255, 0, 0));
|
||||
KPixmapEffect::toGray(iconNoAdapter);
|
||||
KPixmapEffect::fade(iconNoAdapter, 0.5, TQColor(128, 128, 128));
|
||||
|
||||
connect(manager, SIGNAL(adapterRemoved(const TQString&)), this,
|
||||
TQT_SLOT(slotRemoveAdapter(const TQString&)));
|
||||
connect(manager, SIGNAL(adapterAdded(const TQString&)), this,
|
||||
TQT_SLOT(slotAddAdapter(const TQString&)));
|
||||
|
||||
connect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), this,
|
||||
TQT_SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
|
||||
if (app->adapters.isEmpty())
|
||||
setupTray(false);
|
||||
else
|
||||
setupTray(true);
|
||||
|
||||
updateIcon();
|
||||
|
||||
connect(this, SIGNAL(quitSelected()), this, SLOT(slotQuitSelected()));
|
||||
|
||||
}
|
||||
|
||||
void TrayIcon::setupTray(bool enable)
|
||||
{
|
||||
|
||||
// CONTEXT MENU
|
||||
|
||||
// if (!kbluemonAction->isPlugged())
|
||||
// kbluemonAction->plug(contextMenu());
|
||||
// kbluemonAction->setEnabled(enable);
|
||||
//
|
||||
// if (!kbluelockAction->isPlugged())
|
||||
// kbluelockAction->plug(contextMenu());
|
||||
// kbluelockAction->setEnabled(enable);
|
||||
//
|
||||
// if (!kbtobexclientAction->isPlugged())
|
||||
// kbtobexclientAction->plug(contextMenu());
|
||||
// kbtobexclientAction->setEnabled(enable);
|
||||
|
||||
bool anyPowered = false;
|
||||
|
||||
TDEBluetoothApp::AdaptersMap::iterator it = app->adapters.begin();
|
||||
for (it; it != app->adapters.end(); ++it)
|
||||
{
|
||||
// know if any adapter is powered
|
||||
TQT_DBusError error;
|
||||
if (app->adapters[it.key()]->getPowered(error))
|
||||
{
|
||||
anyPowered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// show the on/off button per adapter
|
||||
TQMap<TQString, TDEToggleAction *>::iterator tait =
|
||||
showPowerOnActionMap.begin();
|
||||
for (tait; tait != showPowerOnActionMap.end(); ++tait)
|
||||
{
|
||||
if (!tait.data()->isPlugged())
|
||||
tait.data()->plug(contextMenu());
|
||||
tait.data()->setEnabled(true);
|
||||
}
|
||||
|
||||
// device wizard
|
||||
if (!deviceConfigAction->isPlugged())
|
||||
deviceConfigAction->plug(contextMenu());
|
||||
deviceConfigAction->setEnabled(anyPowered);
|
||||
|
||||
// adapter configuration
|
||||
if (!adapterConfigAction->isPlugged())
|
||||
adapterConfigAction->plug(contextMenu());
|
||||
adapterConfigAction->setEnabled(anyPowered);
|
||||
|
||||
// the config menu
|
||||
if (!configActionMenu->isPlugged())
|
||||
configActionMenu->plug(contextMenu());
|
||||
configActionMenu->setEnabled(enable);
|
||||
|
||||
// the help menu
|
||||
if (!helpActionMenu->isPlugged())
|
||||
helpActionMenu->plug(contextMenu());
|
||||
|
||||
// HELP MENU
|
||||
if (!showHelpAction->isPlugged())
|
||||
showHelpAction->plug(helpActionMenu->popupMenu());
|
||||
|
||||
// Report bug menu item
|
||||
/*
|
||||
TDEAction* reportBugAction = KStdAction::reportBug(this,
|
||||
SLOT(slotReportBug()), actionCollection());
|
||||
helpActionMenu->insert(reportBugAction);
|
||||
*/
|
||||
|
||||
// ABOUT MENU
|
||||
if (!aboutAction->isPlugged())
|
||||
aboutAction->plug(helpActionMenu->popupMenu());
|
||||
|
||||
// Menu entries:
|
||||
// -------------
|
||||
|
||||
// // CONFIG MENU
|
||||
// if (!inputConfigAction->isPlugged())
|
||||
// inputConfigAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// Service configuration
|
||||
/* TODO: create BlueZ service UI
|
||||
serviceConfigAction = new TDEAction(i18n("Configure &Services..."),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
TDEShortcut::null(), this, "service_config");
|
||||
connect(serviceConfigAction, SIGNAL(activated()), this, SLOT(slotServiceConfig()));
|
||||
configActionMenu->insert(serviceConfigAction);
|
||||
*/
|
||||
|
||||
// if (!pairedConfigAction->isPlugged())
|
||||
// pairedConfigAction->plug(configActionMenu->popupMenu());
|
||||
// configure notifications
|
||||
/*
|
||||
TDEAction* notificationAction = KStdAction::configureNotifications(this,
|
||||
SLOT(slotConfigureNotifications()), actionCollection());
|
||||
configActionMenu->insert(notificationAction);
|
||||
*/
|
||||
|
||||
// Autostart option
|
||||
if (!autostartIconAction->isPlugged())
|
||||
autostartIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// Agent option
|
||||
if (!agentIconAction->isPlugged())
|
||||
agentIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
//Obex option
|
||||
if (!obexIconAction->isPlugged())
|
||||
obexIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// if (!showIconAction->isPlugged())
|
||||
// showIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
if (!app->adapters.isEmpty())
|
||||
{
|
||||
// for (ObjectManagerImpl::AdapterList::iterator it=app->adapters.begin(); it!=app->adapters.end(); ++it) {
|
||||
connect(manager, SIGNAL(deviceConnectedChanged(const TQString&, bool)),
|
||||
TQT_SLOT(slotDeviceConnectedChanged(const TQString&, bool)));
|
||||
// connect(app->adapter, SIGNAL(remoteDeviceDisconnected(const TQString&)),
|
||||
// TQT_SLOT(slotIconDisconnected(const TQString&)));
|
||||
connect(manager, SIGNAL(adapterNameChanged(const TQString&, const TQString&)), this,
|
||||
TQT_SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
connect(manager, SIGNAL(adapterAliasChanged(const TQString&, const TQString&)), this,
|
||||
TQT_SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
// connect(manager, SIGNAL(adapterModeChanged(const TQString&, const TQString&)), this,
|
||||
// TQT_SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
// connect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), this,
|
||||
// TQT_SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
// connect(manager, SIGNAL(adapterDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)), this,
|
||||
// TQT_SLOT(slotDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)));
|
||||
// connect(manager, SIGNAL(adapterDiscoverableChanged(const TQString&, bool)), this,
|
||||
// TQT_SLOT(slotDiscoverableChanged(const TQString&, bool)));
|
||||
// connect(manager, SIGNAL(adapterDiscoveringChanged(const TQString&, bool)), this,
|
||||
// TQT_SLOT(slotDiscoveringChanged(const TQString&, bool)));
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
// for (ObjectManagerImpl::AdapterList::iterator it=app->adapters.begin(); it!=app->adapters.end(); ++it) {
|
||||
// disconnect(app->adapter, SIGNAL(remoteDeviceConnected(const TQString&)),
|
||||
// TQT_SLOT(slotIconConnected(const TQString&)));
|
||||
// disconnect(app->adapter, SIGNAL(remoteDeviceDisconnected(const TQString&)),
|
||||
// TQT_SLOT(slotIconDisconnected(const TQString&)));
|
||||
disconnect(manager, SIGNAL(adapterNameChanged(const TQString&, const TQString&)), this,
|
||||
TQT_SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
disconnect(manager, SIGNAL(adapterAliasChanged(const TQString&, const TQString&)), this,
|
||||
TQT_SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
// disconnect(manager, SIGNAL(adapterModeChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
// disconnect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), this,
|
||||
// TQT_SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
// disconnect(manager, SIGNAL(adapterDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)), this, SLOT(slotDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)));
|
||||
// disconnect(manager, SIGNAL(adapterDiscoverableChanged(const TQString&, bool)), this, SLOT(slotDiscoverableChanged(const TQString&, bool)));
|
||||
// disconnect(manager, SIGNAL(adapterDiscoveringChanged(const TQString&, bool)), this, SLOT(slotDiscoveringChanged(const TQString&, bool)));
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TrayIcon::~TrayIcon()
|
||||
{
|
||||
if (deviceWizard)
|
||||
delete deviceWizard;
|
||||
if (deviceConfDialog)
|
||||
delete deviceConfDialog;
|
||||
}
|
||||
|
||||
void TrayIcon::updateIcon()
|
||||
{
|
||||
TQString oldText = TQToolTip::textFor(this);
|
||||
TQString newText = "";
|
||||
if (app->adapters.count() > 0)
|
||||
{
|
||||
|
||||
bool anyPowered = false;
|
||||
TQMap<TQString, TDEToggleAction *>::iterator it = showPowerOnActionMap.begin();
|
||||
for (it; it != showPowerOnActionMap.end(); ++it)
|
||||
{
|
||||
// know if any adapter is powered
|
||||
TQT_DBusError error;
|
||||
if (app->adapters[it.key()]->getPowered(error))
|
||||
{
|
||||
anyPowered = true;
|
||||
newText += tr("Adapter: %1\nAddress: %2\nMode: %3\n").arg(
|
||||
app->adapters[it.key()]->getAlias(error),
|
||||
app->adapters[it.key()]->getAddress(error),
|
||||
(app->adapters[it.key()]->getDiscoverable(error)) ?
|
||||
"discoverable" : "hidden");
|
||||
}
|
||||
else
|
||||
{
|
||||
newText = tr("Adapter not powered on");
|
||||
}
|
||||
if (error.isValid())
|
||||
tqDebug("Error: %s", error.message().utf8().data());
|
||||
}
|
||||
|
||||
bool anyConnected = false;
|
||||
TDEBluetoothApp::DevicesMap::Iterator dit = app->devices.begin();
|
||||
for (dit; dit != app->devices.end(); ++dit)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
if (dit.data()->getConnected(error))
|
||||
{
|
||||
anyConnected = true;
|
||||
break;
|
||||
}
|
||||
// TODO check for error
|
||||
}
|
||||
|
||||
if (anyPowered)
|
||||
{
|
||||
if (anyConnected)
|
||||
setPixmap(iconConnected);
|
||||
else
|
||||
setPixmap(iconIdle);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPixmap(iconOff);
|
||||
}
|
||||
|
||||
// TQT_DBusError err1,err2,err3;
|
||||
// newText = tr("Adapter: %1\nAddress: %2\nMode: %3\n(Not connected)").arg(app->adapters[0]->getName(err1)).arg(app->adapters[0]->getAddress(err2)).arg(app->adapters[0]->getDiscoverable(err3));
|
||||
// kdDebug() << "Name: " << app->adapters[0]->getName(err1) << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPixmap(iconNoAdapter);
|
||||
newText = tr("No Bluetooth Adapter");
|
||||
}
|
||||
show();
|
||||
|
||||
if (oldText != newText)
|
||||
{
|
||||
TQToolTip::remove(this);
|
||||
TQToolTip::add(this, newText);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconAutostartToggled(bool state)
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
config->writeEntry("AutoStart", state);
|
||||
}
|
||||
|
||||
void TrayIcon::slotServiceConfig()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
}
|
||||
|
||||
void TrayIcon::slotAdapterConfig()
|
||||
{
|
||||
deviceConfDialog = new DeviceConfig(app);
|
||||
deviceConfDialog->show();
|
||||
}
|
||||
|
||||
void TrayIcon::slotDeviceConfig()
|
||||
{
|
||||
if (!deviceWizard)
|
||||
{
|
||||
deviceWizard = new DeviceWizard(app);
|
||||
deviceWizard->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceWizard->show();
|
||||
deviceWizard->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotInputConfig()
|
||||
{
|
||||
TDEProcess process(0);
|
||||
|
||||
process << "kinputwizard";
|
||||
if (!process.start(TDEProcess::DontCare))
|
||||
{
|
||||
KMessageBox::information(this, i18n("Could not execute kinputwizard."),
|
||||
i18n("TDEBluetooth"));
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotkbluemonitor()
|
||||
{
|
||||
TDEProcess process(0);
|
||||
process << "kbluemon";
|
||||
|
||||
if (!process.start(TDEProcess::DontCare))
|
||||
{
|
||||
KMessageBox::information(this, i18n("Could not execute KBlueMon."),
|
||||
i18n("TDEBluetooth"));
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotkbluelock()
|
||||
{
|
||||
TDEProcess process(0);
|
||||
process << "kbluelock";
|
||||
|
||||
if (!process.start(TDEProcess::DontCare))
|
||||
{
|
||||
KMessageBox::information(this, i18n("Could not execute KBlueLock."),
|
||||
i18n("TDEBluetooth"));
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotObexSrv(bool state)
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
if (state)
|
||||
{
|
||||
if (!app->startObexSrv())
|
||||
{
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("obexSrv", state);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!app->stopObexSrv())
|
||||
{
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("obexSrv", state);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconAgentToggled(bool state)
|
||||
{
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
if (state)
|
||||
{
|
||||
if (!app->startAuthAgent())
|
||||
{
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("authAgent", state);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!app->stopAuthAgent())
|
||||
{
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("authAgent", state);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotPowerOn(bool state)
|
||||
{
|
||||
// who send the signal ?
|
||||
const TQObject * o = TQObject::sender();
|
||||
const TDEToggleAction* obj =
|
||||
const_cast<TDEToggleAction*>(reinterpret_cast<const TDEToggleAction*>(o));
|
||||
TQMap<TQString, TDEToggleAction *>::Iterator it = showPowerOnActionMap.begin();
|
||||
TQString path;
|
||||
for (it; it != showPowerOnActionMap.end(); ++it)
|
||||
{
|
||||
if (obj == it.data())
|
||||
{
|
||||
path = it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
app->adapters[path]->powerOn(state);
|
||||
}
|
||||
|
||||
void TrayIcon::slotPowerOnChanged(const TQString &adapter, bool state)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQString name = app->adapters[adapter]->getName(error);
|
||||
|
||||
if (state)
|
||||
{
|
||||
adapterConfigAction->setEnabled(true);
|
||||
deviceConfigAction->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME disable only when there is no other adapter powered
|
||||
if (deviceWizard)
|
||||
deviceWizard->close();
|
||||
adapterConfigAction->setEnabled(false);
|
||||
|
||||
if (deviceConfDialog)
|
||||
deviceConfDialog->hide();
|
||||
deviceConfigAction->setEnabled(false);
|
||||
}
|
||||
setTrayIconAdapterState(adapter, name, state);
|
||||
}
|
||||
|
||||
void TrayIcon::setTrayIconAdapterState(const TQString &adapter, const TQString &name, bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
showPowerOnActionMap[adapter]->setText(i18n("Power off") + " [" + name + "]");
|
||||
setPixmap(iconIdle);
|
||||
}
|
||||
else
|
||||
{
|
||||
showPowerOnActionMap[adapter]->setText(i18n("Power on") + " [" + name + "]");
|
||||
setPixmap(iconOff);
|
||||
}
|
||||
showPowerOnActionMap[adapter]->setChecked(state);
|
||||
}
|
||||
|
||||
void TrayIcon::slotDeviceConnectedChanged(const TQString& path, bool state)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQString name = app->devices[path]->getName(error);
|
||||
TQString address = app->devices[path]->getAddress(error);
|
||||
if (state)
|
||||
{
|
||||
slotIconConnected(name, address);
|
||||
}
|
||||
else
|
||||
{
|
||||
slotIconDisconnected(name, address);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TrayIcon::mousePressEvent(TQMouseEvent *e)
|
||||
{
|
||||
if (e->button() == TQMouseEvent::LeftButton)
|
||||
{
|
||||
e->accept();
|
||||
TDEProcess proc;
|
||||
proc << "kfmclient" << "openURL" << "bluetooth:/";
|
||||
proc.start(TDEProcess::DontCare);
|
||||
}
|
||||
else
|
||||
{
|
||||
KSystemTray::mousePressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotQuitSelected()
|
||||
{
|
||||
if (autostartIconAction->isChecked())
|
||||
return;
|
||||
// Ask if the user want to simply quit or disable
|
||||
// automatic start of TDEBluetooth
|
||||
int autoStart = KMessageBox::questionYesNoCancel(0,
|
||||
i18n("Should TDEBluetooth still be restarted when you login?"),
|
||||
i18n("Automatically Start TDEBluetooth?"), i18n("Start"),
|
||||
i18n("Do Not Start"));
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
if (autoStart == KMessageBox::Yes)
|
||||
{
|
||||
config->writeEntry("AutoStart", true);
|
||||
}
|
||||
else if (autoStart == KMessageBox::No)
|
||||
{
|
||||
config->writeEntry("AutoStart", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotShowHelp()
|
||||
{
|
||||
// TODO: This is surely not the correct way to jump to the
|
||||
// right chapter. Do I really have to mention the html-file,
|
||||
// or is the id enough?
|
||||
TDEApplication::kApplication()->invokeHelp("",
|
||||
"tdebluetooth/components.html#components.TDEBluetooth");
|
||||
}
|
||||
|
||||
TQString TrayIcon::localAndEnglish(const TQCString& s)
|
||||
{
|
||||
if (TQString(s) != i18n(s))
|
||||
return TQString("%1 (\"%2\")").arg(i18n(s)).arg(s);
|
||||
else
|
||||
return s;
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconConnected(const TQString& name, const TQString& address)
|
||||
{
|
||||
setPixmap(iconConnected);
|
||||
KNotifyClient::event(TDEApplication::kApplication()->mainWidget()->winId(), "IncomingConnection",
|
||||
i18n("Connected to <b>%1</b><br/>(<b>%2</b>)").arg(name).arg(address));
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconDisconnected(const TQString& name, const TQString& address)
|
||||
{
|
||||
setPixmap(iconIdle);
|
||||
KNotifyClient::event(TDEApplication::kApplication()->mainWidget()->winId(), "IncomingConnection",
|
||||
i18n("Disconnected from <b>%1</b><br/>(<b>%2</b>)").arg(name).arg(address));
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void TrayIcon::slotAddAdapter(const TQString& path)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQString name = app->adapters[path]->getName(error);
|
||||
//TODO check for error
|
||||
bool powered = app->adapters[path]->getPowered(error);
|
||||
//TODO check for error
|
||||
|
||||
TDEToggleAction *ad_a = new TDEToggleAction(this, name.utf8());
|
||||
connect(ad_a, SIGNAL(toggled(bool)), this, SLOT(slotPowerOn(bool)));
|
||||
showPowerOnActionMap.insert(path, ad_a);
|
||||
setTrayIconAdapterState(path, name, powered);
|
||||
}
|
||||
|
||||
void TrayIcon::slotRemoveAdapter(const TQString& path)
|
||||
{
|
||||
showPowerOnActionMap.remove(path);
|
||||
iconAdapterChanged();
|
||||
}
|
||||
|
||||
void TrayIcon::iconAdapterChanged()
|
||||
{
|
||||
if (showPowerOnActionMap.isEmpty())
|
||||
{
|
||||
setPixmap(iconNoAdapter);
|
||||
setupTray(0);
|
||||
deviceWizard->close();
|
||||
deviceWizard = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
setPixmap(iconIdle);
|
||||
setupTray(1);
|
||||
if (!deviceWizard)
|
||||
deviceWizard = new DeviceWizard(app);
|
||||
}
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void TrayIcon::slotUpdateToolTip(const TQString& adapter, const TQString& name)
|
||||
{
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
#include "trayicon.moc"
|
@ -0,0 +1,190 @@
|
||||
/*
|
||||
*
|
||||
* TrayIcon for tdebluez
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRAYICON_H
|
||||
#define TRAYICON_H
|
||||
|
||||
#include <ntqobject.h>
|
||||
#include <dcopobject.h>
|
||||
#include <ntqevent.h>
|
||||
#include <ntqtooltip.h>
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <ksystemtray.h>
|
||||
#include <ntqpixmap.h>
|
||||
//#include <tdeaboutapplication.h>
|
||||
#include <tdeaction.h>
|
||||
#include <tdeapplication.h>
|
||||
//#include <kbugreport.h>
|
||||
#include <tdeconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <tdeglobal.h>
|
||||
#include <khelpmenu.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kicontheme.h>
|
||||
#include <tdelocale.h>
|
||||
#include <tdemessagebox.h>
|
||||
#include <knotifydialog.h>
|
||||
#include <knotifyclient.h>
|
||||
#include <kpixmapeffect.h>
|
||||
#include <tdepopupmenu.h>
|
||||
#include <kprocess.h>
|
||||
#include <krun.h>
|
||||
#include <tdeactionclasses.h>
|
||||
#include <objectmanagerImpl.h>
|
||||
#include <adapterImpl.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "deviceconfig.h"
|
||||
#include "devicewizard.h"
|
||||
|
||||
class TQTimer;
|
||||
class TDEToggleAction;
|
||||
class TDEAction;
|
||||
class TDEActionMenu;
|
||||
class TDEPopupMenu;
|
||||
class KHelpMenu;
|
||||
class TDEBluetoothApp;
|
||||
|
||||
/**
|
||||
@author Fred Schaettgen
|
||||
*/
|
||||
class TrayIcon: public KSystemTray
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrayIcon(TDEBluetoothApp* app);
|
||||
~TrayIcon();
|
||||
// void setAlwaysShowIcon(bool state);
|
||||
|
||||
private slots:
|
||||
// void slotQuitSelected();
|
||||
// void slotShowIconToggled(bool);
|
||||
void slotServiceConfig();
|
||||
// void slotPairedConfig();
|
||||
void slotDeviceConfig();
|
||||
void slotAdapterConfig();
|
||||
void slotInputConfig();
|
||||
void slotkbluemonitor();
|
||||
void slotkbluelock();
|
||||
// void slotkbtobexclient();
|
||||
void slotConfigureNotifications()
|
||||
{
|
||||
KNotifyDialog::configure(this);
|
||||
}
|
||||
;
|
||||
void slotQuitSelected();
|
||||
void slotReportBug()
|
||||
{
|
||||
helpMenu->reportBug();
|
||||
}
|
||||
;
|
||||
void slotAbout()
|
||||
{
|
||||
helpMenu->aboutApplication();
|
||||
}
|
||||
;
|
||||
void slotShowHelp();
|
||||
void slotIconConnected(const TQString&, const TQString&);
|
||||
void slotIconDisconnected(const TQString&, const TQString&);
|
||||
void slotIconAutostartToggled(bool state);
|
||||
void slotIconAgentToggled(bool state);
|
||||
void slotUpdateToolTip(const TQString&, const TQString&);
|
||||
void slotObexSrv(bool state);
|
||||
// gui -> manager
|
||||
void slotPowerOn(bool state);
|
||||
// manager -> gui
|
||||
void slotPowerOnChanged(const TQString&, bool);
|
||||
void slotDeviceConnectedChanged(const TQString&, bool);
|
||||
void slotAddAdapter(const TQString&);
|
||||
void slotRemoveAdapter(const TQString&);
|
||||
// void slotDiscoverableTimeoutChanged(const TQString&, TQ_UINT32 timeout);
|
||||
// void slotDiscoverableChanged(const TQString&, bool state);
|
||||
// void slotDiscoveringChanged(const TQString&, bool state);
|
||||
void updateIcon();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(TQMouseEvent *e);
|
||||
|
||||
private:
|
||||
// bool obexserv;
|
||||
// bool alwaysVisible;
|
||||
// bool autostart;
|
||||
// bool agentstate;
|
||||
bool acceptClose;
|
||||
// bool noAdapter;
|
||||
// bool adapterRemoved;
|
||||
// bool isPowered;
|
||||
|
||||
KPixmap iconIdle;
|
||||
KPixmap iconConnected;
|
||||
KPixmap iconNoAdapter;
|
||||
KPixmap iconOff;
|
||||
|
||||
TQTimer *blinkTimer;
|
||||
bool iconConnectingBlinkState;
|
||||
|
||||
TDEToggleAction *agentIconAction;
|
||||
TDEToggleAction *obexIconAction;
|
||||
// TDEToggleAction *showIconAction;
|
||||
TDEToggleAction *autostartIconAction;
|
||||
TQMap<TQString, TDEToggleAction *> showPowerOnActionMap;
|
||||
|
||||
TDEAction *serviceConfigAction;
|
||||
// TDEAction *pairedConfigAction;
|
||||
TDEAction *adapterConfigAction;
|
||||
TDEAction *deviceConfigAction;
|
||||
// TDEAction *inputConfigAction;
|
||||
TDEAction *showHelpAction;
|
||||
TDEAction *kbluemonAction;
|
||||
TDEAction *kbluelockAction;
|
||||
TDEAction *kbtobexclientAction;
|
||||
TDEAction *aboutAction;
|
||||
TDEActionMenu *configActionMenu;
|
||||
TDEActionMenu *helpActionMenu;
|
||||
|
||||
TDEBluetoothApp* app;
|
||||
|
||||
KHelpMenu *helpMenu;
|
||||
|
||||
DeviceConfig *deviceConfDialog; // for BT Adapters
|
||||
DeviceWizard *deviceWizard; // for BT Devices
|
||||
ObjectManagerImpl *manager;
|
||||
|
||||
TQString localAndEnglish(const TQCString& s);
|
||||
void setupTray(bool);
|
||||
void iconAdapterChanged();
|
||||
void setTrayIconAdapterState(const TQString &adapter, const TQString &name,
|
||||
bool state);
|
||||
|
||||
signals:
|
||||
// void setObexSrv(bool);
|
||||
void setPowerOn(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,359 @@
|
||||
/*
|
||||
*
|
||||
* Authorization Agent implementation of bluez5
|
||||
*
|
||||
* Copyright (C) 2019 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluezauth.
|
||||
*
|
||||
* tdebluezauth is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluezauth is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "authservice.h"
|
||||
#include <kdebug.h>
|
||||
|
||||
// TQt includes
|
||||
#include <ntqlayout.h>
|
||||
#include <tqdom.h>
|
||||
#include <tqstring.h>
|
||||
#include <tqstringlist.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <deviceImpl.h>
|
||||
#include <btuuids.h>
|
||||
|
||||
#include "pindialog.h"
|
||||
#include "authorize.h"
|
||||
|
||||
Agent1InterfaceImpl::Agent1InterfaceImpl(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
Agent1InterfaceImpl::~Agent1InterfaceImpl(){
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Implement virtual methods
|
||||
*
|
||||
*/
|
||||
|
||||
void Agent1InterfaceImpl::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
// if (message.interface() != "org.bluez.Agent1") return false;
|
||||
//
|
||||
// if (message.member() == "Release")
|
||||
// {
|
||||
// TQT_DBusMessage reply = callRelease(message);
|
||||
// handleMethodReply(reply);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "RequestPinCode")
|
||||
// {
|
||||
// callRequestPinCodeAsync(message);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "DisplayPinCode")
|
||||
// {
|
||||
// TQT_DBusMessage reply = callDisplayPinCode(message);
|
||||
// handleMethodReply(reply);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "RequestPasskey")
|
||||
// {
|
||||
// callRequestPasskeyAsync(message);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "DisplayPasskey")
|
||||
// {
|
||||
// TQT_DBusMessage reply = callDisplayPasskey(message);
|
||||
// handleMethodReply(reply);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "RequestConfirmation")
|
||||
// {
|
||||
// callRequestConfirmationAsync(message);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "RequestAuthorization")
|
||||
// {
|
||||
// callRequestAuthorizationAsync(message);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "AuthorizeService")
|
||||
// {
|
||||
// callAuthorizeServiceAsync(message);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if (message.member() == "Cancel")
|
||||
// {
|
||||
// callCancelAsync(message);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// return false;
|
||||
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
bool Agent1InterfaceImpl::Release(TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::RequestPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath& device) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
TQT_DBusError error;
|
||||
TDEBluetooth::DeviceImpl *devImpl = new TDEBluetooth::DeviceImpl("org.bluez", device);
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString());
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(false);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
// TODO
|
||||
// if (pinDialog->exec()==TQDialog::Accepted)
|
||||
// return true;
|
||||
// else {
|
||||
// error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::DisplayPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& pincode){
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
// do something
|
||||
// TODO
|
||||
// return true;
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::RequestPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath& device) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
TQT_DBusError error;
|
||||
TDEBluetooth::DeviceImpl *devImpl = new TDEBluetooth::DeviceImpl("org.bluez", device);
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
// pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(passkey));
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString());
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(true);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
// TODO
|
||||
// if (pinDialog->exec()==TQDialog::Accepted)
|
||||
// return true;
|
||||
// else {
|
||||
// error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::DisplayPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
TQT_DBusError error;
|
||||
TDEBluetooth::DeviceImpl *devImpl = new TDEBluetooth::DeviceImpl("org.bluez", device);
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(passkey));
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(false);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
// TODO
|
||||
// if (pinDialog->exec()==TQDialog::Accepted)
|
||||
// return true;
|
||||
// else {
|
||||
// error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::RequestConfirmationAsync(int asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
// do something
|
||||
TQT_DBusError error;
|
||||
TDEBluetooth::DeviceImpl *devImpl = new TDEBluetooth::DeviceImpl("org.bluez", device);
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(passkey));
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(false);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
// TODO
|
||||
// if (pinDialog->exec()==TQDialog::Accepted)
|
||||
// return true;
|
||||
// else {
|
||||
// error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::RequestAuthorizationAsync(int asyncCallId, const TQT_DBusObjectPath& device) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
TQT_DBusError error;
|
||||
TDEBluetooth::DeviceImpl *devImpl = new TDEBluetooth::DeviceImpl("org.bluez", device);
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
AuthorizeDialog *authDialog = new AuthorizeDialog(name,addr,TQString());
|
||||
KDialogBase::centerOnScreen(authDialog);
|
||||
authDialog->setActiveWindow();
|
||||
authDialog->raise();
|
||||
|
||||
// TODO
|
||||
// if (authDialog->exec()==TQDialog::Accepted)
|
||||
// return true;
|
||||
// else {
|
||||
// error = TQT_DBusError::stdFailed ("Request not authorized");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
void Agent1InterfaceImpl::AuthorizeServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
TQT_DBusError error;
|
||||
TDEBluetooth::DeviceImpl *devImpl = new TDEBluetooth::DeviceImpl("org.bluez", device);
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
AuthorizeDialog *authDialog = new AuthorizeDialog(name,addr,resolveUUID(uuid));
|
||||
KDialogBase::centerOnScreen(authDialog);
|
||||
authDialog->setActiveWindow();
|
||||
authDialog->raise();
|
||||
|
||||
// TODO
|
||||
// if (authDialog->exec()==TQDialog::Accepted)
|
||||
// return true;
|
||||
// else {
|
||||
// error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
bool Agent1InterfaceImpl::Cancel(TQT_DBusError& error) {
|
||||
kdDebug() << __func__ << "()" << endl;
|
||||
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
RootNodeService::RootNodeService(TQT_DBusConnection &connection )
|
||||
: DBusBaseNode(), m_connection(connection)
|
||||
{
|
||||
registerObject(m_connection,"/","org");
|
||||
}
|
||||
|
||||
RootNodeService::~RootNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* RootNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) m_interfaces[interfaceName];
|
||||
}
|
||||
|
||||
OrgNodeService::OrgNodeService(TQT_DBusConnection &connection )
|
||||
: DBusBaseNode(), m_connection(connection)
|
||||
{
|
||||
registerObject(m_connection,"/org", "trinitydesktop");
|
||||
}
|
||||
|
||||
OrgNodeService::~OrgNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* OrgNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) m_interfaces[interfaceName];
|
||||
}
|
||||
|
||||
TrinityDekstopNodeService::TrinityDekstopNodeService(TQT_DBusConnection &connection )
|
||||
: DBusBaseNode(), m_connection(connection)
|
||||
{
|
||||
registerObject(m_connection,"/org/trinitydesktop", "tdebluez");
|
||||
}
|
||||
|
||||
TrinityDekstopNodeService::~TrinityDekstopNodeService(){
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* TrinityDekstopNodeService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) m_interfaces[interfaceName];
|
||||
}
|
||||
|
||||
AuthService::AuthService(TQT_DBusConnection &conn)
|
||||
: org::trinitydesktop::tdebluezNode(),
|
||||
m_connection(conn)
|
||||
{
|
||||
m_interfaces.insert("org.freedesktop.DBus.Introspectable", this);
|
||||
m_interfaces.insert("org.bluez.Agent1", new Agent1InterfaceImpl(m_connection));
|
||||
registerObject(m_connection,DBUS_AUTH_SERVICE_PATH);
|
||||
}
|
||||
|
||||
AuthService::~AuthService(){
|
||||
// unregisterObject();
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* AuthService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) m_interfaces[interfaceName];
|
||||
}
|
@ -0,0 +1,241 @@
|
||||
/*
|
||||
*
|
||||
* Authorization Agent implementation of bluez5
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluezauth.
|
||||
*
|
||||
* tdebluezauth is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluezauth is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#ifndef AGENTIMPL_H
|
||||
#define AGENTIMPL_H
|
||||
|
||||
//#include <tqobject.h>
|
||||
//#include "deviceImpl.h"
|
||||
//#include "authagent.h"
|
||||
|
||||
#include <tqmap.h>
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusobject.h>
|
||||
#include <tqtimer.h>
|
||||
#include <tqeventloop.h>
|
||||
|
||||
#include <interfaces/agent1Interface.h>
|
||||
#include <interfaces/tdebluezNode.h>
|
||||
#include <interfaces/dbusbaseNode.h>
|
||||
|
||||
//#define DBUS_AUTH_SERVICE_PATH "/"
|
||||
#define DBUS_AUTH_SERVICE_PATH "/org/trinitydesktop/tdebluez"
|
||||
|
||||
class Agent1InterfaceImpl : public org::bluez::Agent1Interface
|
||||
{
|
||||
|
||||
public:
|
||||
Agent1InterfaceImpl(TQT_DBusConnection&);
|
||||
virtual ~Agent1InterfaceImpl();
|
||||
protected:
|
||||
/**
|
||||
* void Release()
|
||||
* This method gets called when the service daemon
|
||||
* unregisters the agent. An agent can use it to do
|
||||
* cleanup tasks. There is no need to unregister the
|
||||
* agent, because when this method gets called it has
|
||||
* already been unregistered.
|
||||
*/
|
||||
virtual bool Release(TQT_DBusError& error);
|
||||
/**
|
||||
* string RequestPinCode(object device)
|
||||
*
|
||||
* This method gets called when the service daemon
|
||||
* needs to get the passkey for an authentication.
|
||||
*
|
||||
* The return value should be a string of 1-16 characters
|
||||
* length. The string can be alphanumeric.
|
||||
*
|
||||
* Possible errors: org.bluez.Error.Rejected
|
||||
* org.bluez.Error.Canceled
|
||||
*/
|
||||
virtual void RequestPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath& device);
|
||||
/**
|
||||
* void DisplayPinCode(object device, string pincode)
|
||||
|
||||
This method gets called when the service daemon
|
||||
needs to display a pincode for an authentication.
|
||||
|
||||
An empty reply should be returned. When the pincode
|
||||
needs no longer to be displayed, the Cancel method
|
||||
of the agent will be called.
|
||||
|
||||
This is used during the pairing process of keyboards
|
||||
that don't support Bluetooth 2.1 Secure Simple Pairing,
|
||||
in contrast to DisplayPasskey which is used for those
|
||||
that do.
|
||||
|
||||
This method will only ever be called once since
|
||||
older keyboards do not support typing notification.
|
||||
|
||||
Note that the PIN will always be a 6-digit number,
|
||||
zero-padded to 6 digits. This is for harmony with
|
||||
the later specification.
|
||||
|
||||
Possible errors: org.bluez.Error.Rejected
|
||||
org.bluez.Error.Canceled
|
||||
*/
|
||||
virtual void DisplayPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& pincode);
|
||||
/**
|
||||
* uint32 RequestPasskey(object device)
|
||||
|
||||
This method gets called when the service daemon
|
||||
needs to get the passkey for an authentication.
|
||||
|
||||
The return value should be a numeric value
|
||||
between 0-999999.
|
||||
|
||||
Possible errors: org.bluez.Error.Rejected
|
||||
org.bluez.Error.Canceled
|
||||
*/
|
||||
virtual void RequestPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath& device);
|
||||
/**
|
||||
* void DisplayPasskey(object device, uint32 passkey,
|
||||
uint16 entered)
|
||||
|
||||
This method gets called when the service daemon
|
||||
needs to display a passkey for an authentication.
|
||||
|
||||
The entered parameter indicates the number of already
|
||||
typed keys on the remote side.
|
||||
|
||||
An empty reply should be returned. When the passkey
|
||||
needs no longer to be displayed, the Cancel method
|
||||
of the agent will be called.
|
||||
|
||||
During the pairing process this method might be
|
||||
called multiple times to update the entered value.
|
||||
|
||||
Note that the passkey will always be a 6-digit number,
|
||||
so the display should be zero-padded at the start if
|
||||
the value contains less than 6 digits.
|
||||
*/
|
||||
virtual void DisplayPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered);
|
||||
/**
|
||||
* void RequestConfirmation(object device, uint32 passkey)
|
||||
|
||||
This method gets called when the service daemon
|
||||
needs to confirm a passkey for an authentication.
|
||||
|
||||
To confirm the value it should return an empty reply
|
||||
or an error in case the passkey is invalid.
|
||||
|
||||
Note that the passkey will always be a 6-digit number,
|
||||
so the display should be zero-padded at the start if
|
||||
the value contains less than 6 digits.
|
||||
|
||||
Possible errors: org.bluez.Error.Rejected
|
||||
org.bluez.Error.Canceled
|
||||
*/
|
||||
virtual void RequestConfirmationAsync(int asyncCallId, const TQT_DBusObjectPath& device, TQ_UINT32 passkey);
|
||||
/**
|
||||
* void RequestAuthorization(object device)
|
||||
|
||||
This method gets called to request the user to
|
||||
authorize an incoming pairing attempt which
|
||||
would in other circumstances trigger the just-works
|
||||
model, or when the user plugged in a device that
|
||||
implements cable pairing. In the latter case, the
|
||||
device would not be connected to the adapter via
|
||||
Bluetooth yet.
|
||||
|
||||
Possible errors: org.bluez.Error.Rejected
|
||||
org.bluez.Error.Canceled
|
||||
*/
|
||||
virtual void RequestAuthorizationAsync(int asyncCallId, const TQT_DBusObjectPath& device);
|
||||
/**
|
||||
* void AuthorizeService(object device, string uuid)
|
||||
|
||||
This method gets called when the service daemon
|
||||
needs to authorize a connection/service request.
|
||||
|
||||
Possible errors: org.bluez.Error.Rejected
|
||||
org.bluez.Error.Canceled
|
||||
*/
|
||||
virtual void AuthorizeServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid);
|
||||
/**
|
||||
* void Cancel()
|
||||
|
||||
This method gets called to indicate that the agent
|
||||
request failed before a reply was returned.
|
||||
*/
|
||||
virtual bool Cancel(TQT_DBusError& error);
|
||||
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class AuthService : public org::trinitydesktop::tdebluezNode
|
||||
{
|
||||
public:
|
||||
AuthService(TQT_DBusConnection&);
|
||||
~AuthService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
|
||||
TQT_DBusConnection m_connection;
|
||||
};
|
||||
|
||||
class RootNodeService : public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
RootNodeService(TQT_DBusConnection&);
|
||||
~RootNodeService();
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
|
||||
TQT_DBusConnection m_connection;
|
||||
};
|
||||
|
||||
class OrgNodeService : public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
OrgNodeService(TQT_DBusConnection&);
|
||||
~OrgNodeService();
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
|
||||
TQT_DBusConnection m_connection;
|
||||
};
|
||||
|
||||
class TrinityDekstopNodeService : public DBusBaseNode
|
||||
{
|
||||
public:
|
||||
TrinityDekstopNodeService(TQT_DBusConnection&);
|
||||
~TrinityDekstopNodeService();
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
|
||||
TQT_DBusConnection m_connection;
|
||||
};
|
||||
|
||||
#endif // AGENTIMPL_H
|
@ -1,32 +0,0 @@
|
||||
libtdebluez/
|
||||
Implementations and other files part of the library
|
||||
|
||||
libtdebluez/manager
|
||||
autogenerated proxies to managers
|
||||
|
||||
libtdebluez/interfaces
|
||||
source interfaces for autogenerating with dbusxml2qt3
|
||||
|
||||
libtdebluez/objectmanager
|
||||
autogenerated proxy to objectmanager
|
||||
|
||||
libtdebluez/adapter
|
||||
adapter1 proxy
|
||||
gattmanager1 proxy
|
||||
media1 proxy
|
||||
neworkserver1 proxy
|
||||
|
||||
libtdebluez/obexagent
|
||||
autogenerated obex agent - interface and proxy
|
||||
|
||||
libtdebluez/properties
|
||||
autogenerated dbus properties proxy
|
||||
|
||||
libtdebluez/device
|
||||
autogenerated device1 proxy
|
||||
autogenerated mediacontrol1 proxy
|
||||
|
||||
libtdebluez/agent
|
||||
autogenerated agent1 interface and proxy
|
||||
autogenerated introspectable interface
|
||||
autogenerated trinity desktop tdebluez node interface
|
@ -1,481 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1interface.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
void Agent1::buildIntrospectionData(TQDomElement& interfaceElement)
|
||||
{
|
||||
interfaceElement.setAttribute("name", "org.bluez.Agent1");
|
||||
|
||||
TQDomDocument document = interfaceElement.ownerDocument();
|
||||
TQDomElement methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Release");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "RequestPinCode");
|
||||
|
||||
TQDomElement argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "pincode");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "out");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "DisplayPinCode");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "pincode");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "RequestPasskey");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "passkey");
|
||||
argumentElement.setAttribute("type", "u");
|
||||
argumentElement.setAttribute("direction", "out");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "DisplayPasskey");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "passkey");
|
||||
argumentElement.setAttribute("type", "u");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "entered");
|
||||
argumentElement.setAttribute("type", "q");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "RequestConfirmation");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "passkey");
|
||||
argumentElement.setAttribute("type", "u");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "RequestAuthorization");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "AuthorizeService");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "device");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "uuid");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Cancel");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callRelease(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Release(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::Release returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.Release execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callRequestPinCode(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQString _pincode;
|
||||
|
||||
if (RequestPinCode(_device, _pincode, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
reply << TQT_DBusData::fromString(_pincode);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::RequestPinCode returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.RequestPinCode execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callDisplayPinCode(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQString _pincode = message[1].toString();
|
||||
|
||||
if (DisplayPinCode(_device, _pincode, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::DisplayPinCode returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.DisplayPinCode execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callRequestPasskey(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQ_UINT32 _passkey;
|
||||
|
||||
if (RequestPasskey(_device, _passkey, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
reply << TQT_DBusData::fromUInt32(_passkey);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::RequestPasskey returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.RequestPasskey execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callDisplayPasskey(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQ_UINT32 _passkey = message[1].toUInt32();
|
||||
TQ_UINT16 _entered = message[2].toUInt16();
|
||||
|
||||
if (DisplayPasskey(_device, _passkey, _entered, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::DisplayPasskey returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.DisplayPasskey execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callRequestConfirmation(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQ_UINT32 _passkey = message[1].toUInt32();
|
||||
|
||||
if (RequestConfirmation(_device, _passkey, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::RequestConfirmation returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.RequestConfirmation execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callRequestAuthorization(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
|
||||
if (RequestAuthorization(_device, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::RequestAuthorization returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.RequestAuthorization execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callAuthorizeService(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _device = message[0].toObjectPath();
|
||||
TQString _uuid = message[1].toString();
|
||||
|
||||
if (AuthorizeService(_device, _uuid, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::AuthorizeService returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.AuthorizeService execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callCancel(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Cancel(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Agent1::Cancel returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Agent1.Cancel execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
bool Agent1::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.interface() != "org.bluez.Agent1") return false;
|
||||
|
||||
if (message.member() == "Release")
|
||||
{
|
||||
TQT_DBusMessage reply = callRelease(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestPinCode")
|
||||
{
|
||||
TQT_DBusMessage reply = callRequestPinCode(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "DisplayPinCode")
|
||||
{
|
||||
TQT_DBusMessage reply = callDisplayPinCode(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestPasskey")
|
||||
{
|
||||
TQT_DBusMessage reply = callRequestPasskey(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "DisplayPasskey")
|
||||
{
|
||||
TQT_DBusMessage reply = callDisplayPasskey(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestConfirmation")
|
||||
{
|
||||
TQT_DBusMessage reply = callRequestConfirmation(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "RequestAuthorization")
|
||||
{
|
||||
TQT_DBusMessage reply = callRequestAuthorization(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "AuthorizeService")
|
||||
{
|
||||
TQT_DBusMessage reply = callAuthorizeService(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Cancel")
|
||||
{
|
||||
TQT_DBusMessage reply = callCancel(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -1,80 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1INTERFACE_H_INCLUDED)
|
||||
#define AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQDomElement;
|
||||
class TQString;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusObjectPath;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class Agent1 : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
virtual ~Agent1() {}
|
||||
|
||||
static void buildIntrospectionData(TQDomElement& interfaceElement);
|
||||
|
||||
protected:
|
||||
virtual bool Release(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool RequestPinCode(const TQT_DBusObjectPath& device, TQString& pincode, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool DisplayPinCode(const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool RequestPasskey(const TQT_DBusObjectPath& device, TQ_UINT32& passkey, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool DisplayPasskey(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool RequestConfirmation(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool RequestAuthorization(const TQT_DBusObjectPath& device, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool AuthorizeService(const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool Cancel(TQT_DBusError& error) = 0;
|
||||
|
||||
protected: // implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRelease(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRequestPinCode(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callDisplayPinCode(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRequestPasskey(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callDisplayPasskey(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRequestConfirmation(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRequestAuthorization(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callAuthorizeService(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callCancel(const TQT_DBusMessage& message);
|
||||
|
||||
}; // class Agent1
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -1,173 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1proxy.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusproxy.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
Agent1::Agent1(const TQString& service, const TQString& path, TQObject* parent, const char* name)
|
||||
: TQObject(parent, name),
|
||||
m_baseProxy(new TQT_DBusProxy())
|
||||
{
|
||||
m_baseProxy->setInterface("org.bluez.Agent1");
|
||||
m_baseProxy->setPath(path);
|
||||
m_baseProxy->setService(service);
|
||||
|
||||
}
|
||||
|
||||
Agent1::~Agent1()
|
||||
{
|
||||
delete m_baseProxy;
|
||||
}
|
||||
|
||||
void Agent1::setConnection(const TQT_DBusConnection& connection)
|
||||
{
|
||||
m_baseProxy->setConnection(connection);
|
||||
}
|
||||
|
||||
bool Agent1::Release(TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("Release", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::RequestPinCode(const TQT_DBusObjectPath& device, TQString& pincode, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("RequestPinCode", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
|
||||
if (reply.count() != 1) return false;
|
||||
|
||||
bool ok = false;
|
||||
|
||||
pincode = reply.front().toString(&ok);
|
||||
if (!ok) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::DisplayPinCode(const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromString(pincode);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("DisplayPinCode", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::RequestPasskey(const TQT_DBusObjectPath& device, TQ_UINT32& passkey, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("RequestPasskey", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
|
||||
if (reply.count() != 1) return false;
|
||||
|
||||
bool ok = false;
|
||||
|
||||
passkey = reply.front().toUInt32(&ok);
|
||||
if (!ok) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::DisplayPasskey(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromUInt32(passkey);
|
||||
parameters << TQT_DBusData::fromUInt16(entered);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("DisplayPasskey", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::RequestConfirmation(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromUInt32(passkey);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("RequestConfirmation", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::RequestAuthorization(const TQT_DBusObjectPath& device, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("RequestAuthorization", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::AuthorizeService(const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(device);
|
||||
parameters << TQT_DBusData::fromString(uuid);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("AuthorizeService", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::Cancel(TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("Cancel", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -1,70 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1PROXY_H_INCLUDED)
|
||||
#define AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqobject.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusMessage;
|
||||
class TQT_DBusObjectPath;
|
||||
class TQT_DBusProxy;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class Agent1 : public TQObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Agent1(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0);
|
||||
|
||||
virtual ~Agent1();
|
||||
|
||||
void setConnection(const TQT_DBusConnection& connection);
|
||||
|
||||
public:
|
||||
virtual bool Release(TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestPinCode(const TQT_DBusObjectPath& device, TQString& pincode, TQT_DBusError& error);
|
||||
|
||||
virtual bool DisplayPinCode(const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestPasskey(const TQT_DBusObjectPath& device, TQ_UINT32& passkey, TQT_DBusError& error);
|
||||
|
||||
virtual bool DisplayPasskey(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestConfirmation(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error);
|
||||
|
||||
virtual bool RequestAuthorization(const TQT_DBusObjectPath& device, TQT_DBusError& error);
|
||||
|
||||
virtual bool AuthorizeService(const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error);
|
||||
|
||||
virtual bool Cancel(TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
TQT_DBusProxy* m_baseProxy;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
Agent1(const Agent1&);
|
||||
Agent1& operator=(const Agent1&);
|
||||
}; // class Agent1
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -1,287 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "device1interface.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqmap.h>
|
||||
#include <tqstring.h>
|
||||
#include <tqstringlist.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusdata.h>
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusvariant.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
void Device1::buildIntrospectionData(TQDomElement& interfaceElement)
|
||||
{
|
||||
interfaceElement.setAttribute("name", "org.bluez.Device1");
|
||||
|
||||
TQDomDocument document = interfaceElement.ownerDocument();
|
||||
TQDomElement methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Disconnect");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Connect");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "ConnectProfile");
|
||||
|
||||
TQDomElement argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "UUID");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "DisconnectProfile");
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "UUID");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Pair");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "CancelPairing");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1::callDisconnect(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Disconnect(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1::Disconnect returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.Disconnect execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1::callConnect(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Connect(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1::Connect returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.Connect execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1::callConnectProfile(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQString _UUID = message[0].toString();
|
||||
|
||||
if (ConnectProfile(_UUID, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1::ConnectProfile returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.ConnectProfile execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1::callDisconnectProfile(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQString _UUID = message[0].toString();
|
||||
|
||||
if (DisconnectProfile(_UUID, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1::DisconnectProfile returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.DisconnectProfile execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1::callPair(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Pair(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1::Pair returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.Pair execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Device1::callCancelPairing(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (CancelPairing(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::Device1::CancelPairing returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.Device1.CancelPairing execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
bool Device1::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.interface() != "org.bluez.Device1") return false;
|
||||
|
||||
if (message.member() == "Disconnect")
|
||||
{
|
||||
TQT_DBusMessage reply = callDisconnect(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Connect")
|
||||
{
|
||||
TQT_DBusMessage reply = callConnect(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "ConnectProfile")
|
||||
{
|
||||
TQT_DBusMessage reply = callConnectProfile(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "DisconnectProfile")
|
||||
{
|
||||
TQT_DBusMessage reply = callDisconnectProfile(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Pair")
|
||||
{
|
||||
TQT_DBusMessage reply = callPair(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "CancelPairing")
|
||||
{
|
||||
TQT_DBusMessage reply = callCancelPairing(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -1,71 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(DEVICE1INTERFACE_H_INCLUDED)
|
||||
#define DEVICE1INTERFACE_H_INCLUDED
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQDomElement;
|
||||
class TQString;
|
||||
class TQStringList;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusObjectPath;
|
||||
class TQT_DBusVariant;
|
||||
template <typename K, typename V> class TQMap;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
|
||||
class Device1 : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
virtual ~Device1() {}
|
||||
|
||||
static void buildIntrospectionData(TQDomElement& interfaceElement);
|
||||
|
||||
protected:
|
||||
virtual bool Disconnect(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool Connect(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool ConnectProfile(const TQString& UUID, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool DisconnectProfile(const TQString& UUID, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool Pair(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool CancelPairing(TQT_DBusError& error) = 0;
|
||||
|
||||
protected: // implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callDisconnect(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callConnect(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callConnectProfile(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callDisconnectProfile(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callPair(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callCancelPairing(const TQT_DBusMessage& message);
|
||||
|
||||
}; // class Device1
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //DEVICE1INTERFACE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -1,100 +0,0 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2018 Emanoil Kotsev
|
||||
# deloptes (AT) gmail.com
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
project( libtdeobex )
|
||||
set(LIBRARY_VERSION 0.0.1)
|
||||
|
||||
# include( ConfigureChecks.cmake )
|
||||
foreach( f ${TQT_LIBRARIES} )
|
||||
if( ${f} STREQUAL "tqt-mt" )
|
||||
set(TQUI_LIBRARIES "tqui" CACHE TYPE STRING FORCE)
|
||||
endif()
|
||||
if( ${f} STREQUAL "qt-mt" )
|
||||
set(TQUI_LIBRARIES "qui" CACHE TYPE STRING FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# import required
|
||||
#tde_import( lib... )
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${TDE_INCLUDE_DIR}
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${DBUS_INCLUDE_DIRS}
|
||||
${DBUS_TQT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(
|
||||
${TQT_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
|
||||
##### headers ###################################
|
||||
# implementations
|
||||
install(
|
||||
FILES obexobjectmanagerImpl.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/tdeobex )
|
||||
# obexclient
|
||||
install(
|
||||
FILES obexclient/transfer1proxy.h
|
||||
obexclient/client1proxy.h
|
||||
obexclient/phonebookaccess1proxy.h
|
||||
obexclient/objectpush1interface.h
|
||||
obexclient/transfer1interface.h
|
||||
obexclient/phonebookaccess1interface.h
|
||||
obexclient/filetransfer1proxy.h
|
||||
obexclient/synchronization1proxy.h
|
||||
obexclient/agentmanager1proxy.h
|
||||
obexclient/client1interface.h
|
||||
obexclient/filetransfer1interface.h
|
||||
obexclient/synchronization1interface.h
|
||||
obexclient/agentmanager1interface.h
|
||||
obexclient/session1interface.h
|
||||
obexclient/objectpush1proxy.h
|
||||
obexclient/session1proxy.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/tdeobex/obexclient )
|
||||
# agent
|
||||
install(
|
||||
FILES obexagent/agent1interface.h
|
||||
obexagent/agent1proxy.h
|
||||
obexagent/org_trinitydesktop_tdeobexnode.h
|
||||
obexagent/introspectableinterface.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/tdeobex/obexagent )
|
||||
|
||||
##### tdeobex (shared) ###########################
|
||||
# set( KDE3_DCOPIDL_EXECUTABLE ${KDE3_DCOPIDLNG_EXECUTABLE} )
|
||||
tde_add_library( tdeobex SHARED AUTOMOC
|
||||
SOURCES
|
||||
obexobjectmanagerImpl.cpp
|
||||
objectmanager/objectmanagerproxy.cpp
|
||||
properties/propertiesproxy.cpp
|
||||
obexclient/agentmanager1proxy.cpp
|
||||
obexclient/transfer1proxy.cpp
|
||||
obexclient/session1proxy.cpp
|
||||
obexclient/objectpush1proxy.cpp
|
||||
obexclient/phonebookaccess1proxy.cpp
|
||||
obexclient/client1proxy.cpp
|
||||
obexclient/filetransfer1proxy.cpp
|
||||
obexclient/synchronization1proxy.cpp
|
||||
obexagent/introspectableinterface.cpp
|
||||
obexagent/org_trinitydesktop_tdeobexnode.cpp
|
||||
obexagent/agent1proxy.cpp
|
||||
obexagent/agent1interface.cpp
|
||||
VERSION ${LIBRARY_VERSION}
|
||||
LINK ${DBUS_TQT_LIBRARIES} tdeparts-shared ${TQUI_LIBRARIES}
|
||||
DESTINATION ${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
##### install import cmake modules ###############
|
||||
tde_install_export( )
|
@ -1,172 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1interface.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqdom.h>
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
void Agent1::buildIntrospectionData(TQDomElement& interfaceElement)
|
||||
{
|
||||
interfaceElement.setAttribute("name", "org.bluez.obex.Agent1");
|
||||
|
||||
TQDomDocument document = interfaceElement.ownerDocument();
|
||||
TQDomElement methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Release");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "AuthorizePush");
|
||||
|
||||
TQDomElement argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "transfer");
|
||||
argumentElement.setAttribute("type", "o");
|
||||
argumentElement.setAttribute("direction", "in");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
argumentElement = document.createElement("arg");
|
||||
argumentElement.setAttribute("name", "filepath");
|
||||
argumentElement.setAttribute("type", "s");
|
||||
argumentElement.setAttribute("direction", "out");
|
||||
methodElement.appendChild(argumentElement);
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
|
||||
methodElement = document.createElement("method");
|
||||
methodElement.setAttribute("name", "Cancel");
|
||||
|
||||
interfaceElement.appendChild(methodElement);
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callRelease(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Release(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::obex::Agent1::Release returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.obex.Agent1.Release execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callAuthorizePush(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
TQT_DBusObjectPath _transfer = message[0].toObjectPath();
|
||||
TQString _filepath;
|
||||
|
||||
if (AuthorizePush(_transfer, _filepath, error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
reply << TQT_DBusData::fromString(_filepath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::obex::Agent1::AuthorizePush returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.obex.Agent1.AuthorizePush execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
TQT_DBusMessage Agent1::callCancel(const TQT_DBusMessage& message)
|
||||
{
|
||||
TQT_DBusError error;
|
||||
TQT_DBusMessage reply;
|
||||
|
||||
|
||||
if (Cancel(error))
|
||||
{
|
||||
reply = TQT_DBusMessage::methodReply(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!error.isValid())
|
||||
{
|
||||
tqWarning("Call to implementation of org::bluez::obex::Agent1::Cancel returned 'false' but error object is not valid!");
|
||||
|
||||
error = TQT_DBusError::stdFailed("org.bluez.obex.Agent1.Cancel execution failed");
|
||||
}
|
||||
|
||||
reply = TQT_DBusMessage::methodError(message, error);
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
bool Agent1::handleMethodCall(const TQT_DBusMessage& message)
|
||||
{
|
||||
if (message.interface() != "org.bluez.obex.Agent1") return false;
|
||||
|
||||
if (message.member() == "Release")
|
||||
{
|
||||
TQT_DBusMessage reply = callRelease(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "AuthorizePush")
|
||||
{
|
||||
TQT_DBusMessage reply = callAuthorizePush(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.member() == "Cancel")
|
||||
{
|
||||
TQT_DBusMessage reply = callCancel(message);
|
||||
handleMethodReply(reply);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
@ -1,60 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1INTERFACE_H_INCLUDED)
|
||||
#define AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusobject.h>
|
||||
|
||||
// forward declarations
|
||||
class TQDomElement;
|
||||
class TQString;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusObjectPath;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
class Agent1 : public TQT_DBusObjectBase
|
||||
{
|
||||
public:
|
||||
virtual ~Agent1() {}
|
||||
|
||||
static void buildIntrospectionData(TQDomElement& interfaceElement);
|
||||
|
||||
protected:
|
||||
virtual bool Release(TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool AuthorizePush(const TQT_DBusObjectPath& transfer, TQString& filepath, TQT_DBusError& error) = 0;
|
||||
|
||||
virtual bool Cancel(TQT_DBusError& error) = 0;
|
||||
|
||||
protected: // implement sending replies
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
|
||||
|
||||
protected: // usually no need to reimplement
|
||||
virtual bool handleMethodCall(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callRelease(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callAuthorizePush(const TQT_DBusMessage& message);
|
||||
|
||||
TQT_DBusMessage callCancel(const TQT_DBusMessage& message);
|
||||
|
||||
}; // class Agent1
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1INTERFACE_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -1,93 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "agent1proxy.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqstring.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusproxy.h>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
Agent1::Agent1(const TQString& service, const TQString& path, TQObject* parent, const char* name)
|
||||
: TQObject(parent, name),
|
||||
m_baseProxy(new TQT_DBusProxy())
|
||||
{
|
||||
m_baseProxy->setInterface("org.bluez.obex.Agent1");
|
||||
m_baseProxy->setPath(path);
|
||||
m_baseProxy->setService(service);
|
||||
|
||||
}
|
||||
|
||||
Agent1::~Agent1()
|
||||
{
|
||||
delete m_baseProxy;
|
||||
}
|
||||
|
||||
void Agent1::setConnection(const TQT_DBusConnection& connection)
|
||||
{
|
||||
m_baseProxy->setConnection(connection);
|
||||
}
|
||||
|
||||
bool Agent1::Release(TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("Release", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::AuthorizePush(const TQT_DBusObjectPath& transfer, TQString& filepath, TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
parameters << TQT_DBusData::fromObjectPath(transfer);
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("AuthorizePush", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
|
||||
if (reply.count() != 1) return false;
|
||||
|
||||
bool ok = false;
|
||||
|
||||
filepath = reply.front().toString(&ok);
|
||||
if (!ok) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1::Cancel(TQT_DBusError& error)
|
||||
{
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("Cancel", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
// End of File
|
||||
|
||||
#include "agent1proxy.moc"
|
@ -1,62 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
#if !defined(AGENT1PROXY_H_INCLUDED)
|
||||
#define AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// TQt includes
|
||||
#include <tqobject.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbuserror.h>
|
||||
|
||||
// forward declarations
|
||||
class TQString;
|
||||
class TQT_DBusConnection;
|
||||
class TQT_DBusError;
|
||||
class TQT_DBusMessage;
|
||||
class TQT_DBusObjectPath;
|
||||
class TQT_DBusProxy;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace bluez
|
||||
{
|
||||
namespace obex
|
||||
{
|
||||
|
||||
class Agent1 : public TQObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Agent1(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0);
|
||||
|
||||
virtual ~Agent1();
|
||||
|
||||
void setConnection(const TQT_DBusConnection& connection);
|
||||
|
||||
public:
|
||||
virtual bool Release(TQT_DBusError& error);
|
||||
|
||||
virtual bool AuthorizePush(const TQT_DBusObjectPath& transfer, TQString& filepath, TQT_DBusError& error);
|
||||
|
||||
virtual bool Cancel(TQT_DBusError& error);
|
||||
|
||||
protected:
|
||||
TQT_DBusProxy* m_baseProxy;
|
||||
|
||||
private: // Hiding copy constructor and assignment operator
|
||||
Agent1(const Agent1&);
|
||||
Agent1& operator=(const Agent1&);
|
||||
}; // class Agent1
|
||||
|
||||
}; // namespace obex
|
||||
|
||||
}; // namespace bluez
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#endif //AGENT1PROXY_H_INCLUDED
|
||||
|
||||
// End of File
|
||||
|
@ -1,106 +0,0 @@
|
||||
// File autogenerated
|
||||
|
||||
// declaration include
|
||||
#include "objectmanagerproxy.h"
|
||||
|
||||
// TQt includes
|
||||
#include <tqmap.h>
|
||||
#include <tqstring.h>
|
||||
#include <tqstringlist.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
// TQt D-Bus includes
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbusdatamap.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <tqdbusproxy.h>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace freedesktop
|
||||
{
|
||||
namespace DBus
|
||||
{
|
||||
|
||||
ObjectManager::ObjectManager(const TQString& service, const TQString& path, TQObject* parent, const char* name)
|
||||
: TQObject(parent, name),
|
||||
m_baseProxy(new TQT_DBusProxy())
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_baseProxy->setInterface("org.freedesktop.DBus.ObjectManager");
|
||||
m_baseProxy->setPath(path);
|
||||
m_baseProxy->setService(service);
|
||||
|
||||
TQObject::connect(m_baseProxy, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
|
||||
this, TQT_SLOT(slotHandleDBusSignal(const TQT_DBusMessage&)));
|
||||
}
|
||||
|
||||
ObjectManager::~ObjectManager()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
delete m_baseProxy;
|
||||
}
|
||||
|
||||
void ObjectManager::setConnection(const TQT_DBusConnection& connection)
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_baseProxy->setConnection(connection);
|
||||
}
|
||||
|
||||
//bool ObjectManager::GetManagedObjects(TQMap< TQT_DBusObjectPath, TQT_DBusDataMap< TQString > >& objects, TQT_DBusError& error)
|
||||
bool ObjectManager::GetManagedObjects(TQT_DBusData& objects, TQT_DBusError& error)
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
TQValueList<TQT_DBusData> parameters;
|
||||
|
||||
|
||||
TQT_DBusMessage reply = m_baseProxy->sendWithReply("GetManagedObjects", parameters, &error);
|
||||
|
||||
if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
|
||||
|
||||
if (reply.count() != 1) return false;
|
||||
|
||||
bool ok = false;
|
||||
|
||||
// bool subOK = false;
|
||||
|
||||
// objects = reply.front().toObjectPathKeyMap(&ok).toStringKeyMapMap(&subOK);
|
||||
objects = TQT_DBusData::fromObjectPathKeyMap(reply.front().toObjectPathKeyMap(&ok));
|
||||
// objects = TQT_DBusData(reply.front());
|
||||
// if (!subOK) return false;
|
||||
if (!ok) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ObjectManager::slotHandleDBusSignal(const TQT_DBusMessage& message)
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
if (message.member() == "InterfacesAdded")
|
||||
{
|
||||
TQT_DBusObjectPath object = message[0].toObjectPath();
|
||||
TQT_DBusDataMap< TQString > interfaces = message[1].toStringKeyMap();
|
||||
|
||||
emit InterfacesAdded(object, interfaces);
|
||||
}
|
||||
else if (message.member() == "InterfacesRemoved")
|
||||
{
|
||||
TQT_DBusObjectPath object = message[0].toObjectPath();
|
||||
TQStringList interfaces = message[1].toList().toTQStringList();
|
||||
|
||||
emit InterfacesRemoved(object, interfaces);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace DBus
|
||||
|
||||
}; // namespace freedesktop
|
||||
|
||||
}; // namespace org
|
||||
|
||||
#include "objectmanagerproxy.moc"
|
||||
// End of File
|
||||
|
@ -1,219 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* New Bluetooth App for TDE and bluez5
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "trayicon.h"
|
||||
#include "application.h"
|
||||
|
||||
TDEBluetoothApp::TDEBluetoothApp() :
|
||||
KUniqueApplication()
|
||||
{
|
||||
m_config = new TDEConfig("tdebluezrc");
|
||||
// Enable autostart
|
||||
m_config->setGroup("General");
|
||||
m_config->readBoolEntry("AutoStart", true);
|
||||
bool authAgentStart = m_config->readBoolEntry("authAgent", true);
|
||||
bool obexServerStart = m_config->readBoolEntry("obexSrv", true);
|
||||
|
||||
authAgent=0;
|
||||
obexServer=0;
|
||||
|
||||
manager = new ObjectManagerImpl("org.bluez", "/", this, "ObjectManager");
|
||||
if (!manager->isConnectedToDBUS()) {
|
||||
tqDebug( "ObjectManager is not connected to DBus" );
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectManagerImpl::AdapterList al = manager->getAdapters();
|
||||
ObjectManagerImpl::AdapterList::Iterator ait=al.begin();
|
||||
for(ait; ait != al.end(); ++ait) {
|
||||
AdapterImpl *a= new AdapterImpl("org.bluez",(*ait));
|
||||
a->setConnection((*(manager->getConnection())));
|
||||
adapters.insert((*ait),a);
|
||||
}
|
||||
|
||||
ObjectManagerImpl::DeviceList dl = manager->getDevices();
|
||||
ObjectManagerImpl::DeviceList::Iterator dit=dl.begin();
|
||||
for(dit; dit != dl.end(); ++dit) {
|
||||
DeviceImpl *d= new DeviceImpl("org.bluez",(*dit));
|
||||
d->setConnection((*(manager->getConnection())));
|
||||
devices.insert((*dit),d);
|
||||
}
|
||||
|
||||
// connect to manager signals
|
||||
connect(manager, SIGNAL(adapterAdded(const TQString&)), SLOT(slotAdapterAdded(const TQString&)));
|
||||
connect(manager, SIGNAL(adapterRemoved(const TQString&)), SLOT(slotAdapterRemoved(const TQString&)));
|
||||
connect(manager, SIGNAL(deviceAdded(const TQString&)), SLOT(slotDeviceAdded(const TQString&)));
|
||||
connect(manager, SIGNAL(deviceRemoved(const TQString&)), SLOT(slotDeviceRemoved(const TQString&)));
|
||||
// connect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
|
||||
trayIcon = new TrayIcon(this);
|
||||
setMainWidget(trayIcon);
|
||||
|
||||
if (authAgentStart) {
|
||||
if ( ! startAuthAgent() )
|
||||
tqWarning("TDEBluezAuth failed to start.");
|
||||
}
|
||||
if (obexServerStart) {
|
||||
if ( ! startObexSrv() ) {
|
||||
tqWarning("TDEBluezOBEX failed to start.");
|
||||
}
|
||||
// else
|
||||
// connect(trayIcon, SIGNAL(setObexSrv(bool)), this, SLOT(slotObexSrv(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
TDEBluetoothApp::~TDEBluetoothApp()
|
||||
{
|
||||
delete trayIcon;
|
||||
if (!stopAuthAgent())
|
||||
authAgent->kill();
|
||||
delete authAgent;
|
||||
|
||||
if (!stopObexSrv())
|
||||
obexServer->kill();
|
||||
delete obexServer;
|
||||
|
||||
if (manager->isConnectedToDBUS()) {
|
||||
AdaptersMap::Iterator ait=adapters.begin();
|
||||
for(ait; ait != adapters.end(); ++ait) {
|
||||
AdapterImpl *a = ait.data();
|
||||
if (a) delete a;
|
||||
}
|
||||
DevicesMap::Iterator dit=devices.begin();
|
||||
for(dit; dit != devices.end(); ++dit) {
|
||||
DeviceImpl *d = dit.data();
|
||||
if (d) delete d;
|
||||
}
|
||||
devices.clear();
|
||||
adapters.clear();
|
||||
}
|
||||
delete manager;
|
||||
|
||||
if (m_config->isDirty())
|
||||
m_config->sync();
|
||||
|
||||
delete m_config;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::startAuthAgent() {
|
||||
authAgent=new TQProcess();
|
||||
authAgent->addArgument( "tdebluezauth");
|
||||
authAgent->addArgument("--nofork");
|
||||
if ( ! authAgent->start() )
|
||||
return false;
|
||||
TQObject::connect(authAgent, TQT_SIGNAL(processExited()),this, TQT_SLOT(slotprocresult()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::stopAuthAgent() {
|
||||
if (authAgent) {
|
||||
int pid = authAgent->processIdentifier();
|
||||
if (authAgent->isRunning()) {
|
||||
authAgent->tryTerminate();
|
||||
wait(&pid);
|
||||
}
|
||||
if (authAgent->isRunning())
|
||||
return false;
|
||||
else
|
||||
authAgent=0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::startObexSrv() {
|
||||
obexServer=new TQProcess();
|
||||
obexServer->addArgument( "/usr/lib/bluetooth/obexd");
|
||||
// obexServer->addArgument("--nofork");
|
||||
if ( ! obexServer->start() ) {
|
||||
tqDebug( "Bluez Obex Server failed to start." );
|
||||
return false;
|
||||
}
|
||||
TQObject::connect(obexServer, TQT_SIGNAL(processExited()),this, TQT_SLOT(slotprocresult()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TDEBluetoothApp::stopObexSrv() {
|
||||
if (obexServer) {
|
||||
int pid = obexServer->processIdentifier();
|
||||
if (obexServer->isRunning()) {
|
||||
obexServer->tryTerminate();
|
||||
wait(&pid);
|
||||
}
|
||||
if (obexServer->isRunning())
|
||||
return false;
|
||||
else
|
||||
obexServer=0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotprocresult() {
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotAdapterAdded(const TQString &adapter) {
|
||||
AdapterImpl *a= new AdapterImpl("org.bluez",adapter);
|
||||
a->setConnection((*(manager->getConnection())));
|
||||
adapters.insert(adapter,a);
|
||||
if (!authAgent || !authAgent->isRunning())
|
||||
startAuthAgent();
|
||||
if (!obexServer || !obexServer->isRunning())
|
||||
startObexSrv();
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotAdapterRemoved(const TQString &adapter) {
|
||||
adapters.remove(adapter);
|
||||
if (adapters.isEmpty ()) {
|
||||
if (authAgent->isRunning())
|
||||
stopAuthAgent();
|
||||
if (obexServer->isRunning())
|
||||
stopObexSrv();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: run agents only if enabled in config
|
||||
//void TDEBluetoothApp::slotPowerOnChanged(const TQString &adapter, bool state) {
|
||||
// kdDebug() << k_funcinfo << endl;
|
||||
// if(state) {
|
||||
// if (!authAgent->isRunning())
|
||||
// startAuthAgent();
|
||||
// }
|
||||
// else {
|
||||
// if (authAgent->isRunning())
|
||||
// stopAuthAgent();
|
||||
// }
|
||||
//}
|
||||
|
||||
void TDEBluetoothApp::slotDeviceAdded(const TQString &device) {
|
||||
DeviceImpl *d= new DeviceImpl("org.bluez",device);
|
||||
d->setConnection((*(manager->getConnection())));
|
||||
devices.insert(device,d);
|
||||
}
|
||||
|
||||
void TDEBluetoothApp::slotDeviceRemoved(const TQString &device) {
|
||||
devices.remove(device);
|
||||
}
|
||||
|
||||
#include "application.moc"
|
@ -1,283 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Dialogs for tdebluez device configuration
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <tqradiobutton.h>
|
||||
#include <tqcheckbox.h>
|
||||
#include <kcombobox.h>
|
||||
|
||||
#include <device/device1proxy.h>
|
||||
#include <btuuids.h>
|
||||
#include <devicemimeconverter.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "devicesetupwizard.h"
|
||||
|
||||
#define LOGOTIMEOUT 100 //100 msec
|
||||
#define CONTIMEOUT 50000 //50 sec
|
||||
|
||||
DeviceSetupWizard::DeviceSetupWizard(ObjectManagerImpl* _manager,
|
||||
AdapterImpl* _adapter, DeviceImpl* _device) :
|
||||
DeviceSetupWizardDialog(),
|
||||
manager(_manager), adapter(_adapter), newdev(_device)
|
||||
{
|
||||
pairingpage = page(0);
|
||||
setHelpEnabled(pairingpage, false);
|
||||
|
||||
connectpage = page(1);
|
||||
setHelpEnabled(connectpage, false);
|
||||
|
||||
connectingpage = page(2);
|
||||
setHelpEnabled(connectingpage, false);
|
||||
|
||||
donepage = page(3);
|
||||
setHelpEnabled(donepage, false);
|
||||
setFinishEnabled(donepage, true);
|
||||
cancelButton()->setText(i18n("S&kip Wizard"));
|
||||
|
||||
setModal(true);
|
||||
|
||||
TQT_DBusError error;
|
||||
if (newdev->getPaired(error)) {
|
||||
setAppropriate(pairingpage,false);
|
||||
updateServiceList();
|
||||
TQWizard::showPage(connectpage);
|
||||
}
|
||||
if (newdev->getConnected(error)) {
|
||||
setAppropriate(connectpage,false);
|
||||
setAppropriate(connectingpage,false);
|
||||
TQWizard::showPage(donepage);
|
||||
}
|
||||
if (newdev->getTrusted(error))
|
||||
trustedCheckBox->setChecked(true);
|
||||
|
||||
connect(manager, SIGNAL(devicePairedChanged(const TQString&, bool)), this, SLOT(slotDevicePairedChanged(const TQString&, bool)));
|
||||
connect(manager, SIGNAL(deviceServicesResolvedChanged(const TQString&, bool)), this, SLOT(slotDeviceServicesResolvedChanged(const TQString&, bool)));
|
||||
connect(manager, SIGNAL(deviceConnectedChanged(const TQString&, bool)), this, SLOT(slotDeviceConnectedChanged(const TQString&, bool)));
|
||||
|
||||
}
|
||||
|
||||
DeviceSetupWizard::~DeviceSetupWizard() {
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::next() {
|
||||
TQT_DBusError error;
|
||||
if(currentPage()==pairingpage) {
|
||||
if ( pairingRadioButton1->isChecked() ) {
|
||||
TQTimer::singleShot(40000, this, SLOT(slotPairingTimeOut()));
|
||||
kdDebug() << "START PAIRING" << endl;
|
||||
pairing = true;
|
||||
if (!newdev->Pair()) {
|
||||
// TODO handle error
|
||||
}
|
||||
}
|
||||
else
|
||||
TQWizard::next();
|
||||
}
|
||||
else if(currentPage()==connectpage){
|
||||
TQString selText = connectComboBox->currentText();
|
||||
TQString reqUUID;
|
||||
TQStringList uuids = newdev->getUUIDs(error);
|
||||
for (TQStringList::iterator it = uuids.begin(); it != uuids.end(); ++it) {
|
||||
TQString u = resolveUUID((*it));
|
||||
if ( u == selText) {
|
||||
reqUUID = (*it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
kdDebug() << "REQUESTED UUID: " << reqUUID << endl;
|
||||
|
||||
if (newdev->ConnectProfile(reqUUID, error)) {
|
||||
kdDebug() << "UUID: " << reqUUID << " SUCCESSFULLY CONNECTED" << endl;
|
||||
}
|
||||
else {
|
||||
// TODO: check for error
|
||||
}
|
||||
// see slotDevicePairedChanged
|
||||
}
|
||||
else if(currentPage()==connectingpage){
|
||||
if (!newdev->getConnected(error)) {
|
||||
TQTimer::singleShot(10*1000, this, TQT_SLOT(slotConnectTimeout()));
|
||||
newdev->Connect(); // async
|
||||
}
|
||||
else
|
||||
TQWizard::next();
|
||||
}
|
||||
else if(currentPage()==donepage){
|
||||
if ( trustedCheckBox->isChecked() ) {
|
||||
finishButton()->setFocus();
|
||||
}
|
||||
else {
|
||||
trustedCheckBox->setFocus();
|
||||
}
|
||||
}
|
||||
// if(currentPage()==refinepage) {
|
||||
// finishButton()->setFocus();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::back() {
|
||||
TQWizard::back();
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotDevicePairedChanged(const TQString &path, bool paired) {
|
||||
TQT_DBusError error;
|
||||
TQString name = newdev->getName(error);
|
||||
if (pairing) {
|
||||
if (paired) {
|
||||
TQMessageBox::information(this, i18n("Pairing succesfull"),
|
||||
i18n("Paired with %1 successfully!").arg(name),
|
||||
TQMessageBox::Ok | TQMessageBox::Default,
|
||||
TQMessageBox::NoButton, TQMessageBox::NoButton);
|
||||
}
|
||||
else {
|
||||
TQMessageBox::information(this, i18n("Pairing failed"),
|
||||
i18n("Could not pair with ") + name
|
||||
+ i18n("\nCheck if the device is available."),
|
||||
TQMessageBox::Ok | TQMessageBox::Default,
|
||||
TQMessageBox::NoButton, TQMessageBox::NoButton);
|
||||
}
|
||||
}
|
||||
|
||||
pairing = false;
|
||||
if (paired) {
|
||||
updateServiceList();
|
||||
setBackEnabled(connectpage, false);
|
||||
}
|
||||
setNextEnabled(pairingpage, true);
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotDeviceServicesResolvedChanged(const TQString &path, bool resolved) {
|
||||
if (resolved) {
|
||||
setNextEnabled(connectpage, true);
|
||||
if(currentPage()==pairingpage)
|
||||
TQWizard::next();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotDeviceConnectedChanged(const TQString &path, bool connect) {
|
||||
if (connect) {
|
||||
setNextEnabled(connectingpage, true);
|
||||
if(currentPage()==connectpage)
|
||||
TQWizard::next();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotPairingTimeOut() {
|
||||
TQT_DBusError error;
|
||||
slotDevicePairedChanged("", newdev->getPaired(error));
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotConnectTimeOut() {
|
||||
TQT_DBusError error;
|
||||
if(newdev->getConnected(error))
|
||||
if(currentPage()==connectingpage)
|
||||
TQWizard::next();
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::slotNext() {
|
||||
TQWizard::next();
|
||||
}
|
||||
|
||||
|
||||
bool DeviceSetupWizard::askClose(){
|
||||
TQString text;
|
||||
if (currentPage()==page(0)) {
|
||||
text = i18n("<p>Are you sure you want to quit the Device Settings Wizard?</p>"
|
||||
"<p>The Device Settings Wizard helps you to configure the BT device and use it later.</p>"
|
||||
"<p>Click <b>Cancel</b> to return and finish your setup.</p>");
|
||||
} else {
|
||||
text = i18n("<p>Are you sure you want to quit the Device Settings Wizard?</p>"
|
||||
"<p>If yes, click <b>Quit</b> and all changes will be lost."
|
||||
"<br>If not, click <b>Cancel</b> to return and finish your setup.</p>");
|
||||
}
|
||||
int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit());
|
||||
if(status==KMessageBox::Continue){
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
setDefaults();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** the cancel button is connected to the reject() slot of TQDialog,
|
||||
* so we have to reimplement this here to add a dialogbox to ask if we
|
||||
* really want to quit the wizard.
|
||||
*/
|
||||
void DeviceSetupWizard::reject(){
|
||||
close(); // this will trigger the close event caught below
|
||||
}
|
||||
|
||||
void DeviceSetupWizard::closeEvent(TQCloseEvent* e){
|
||||
if ( askClose() )
|
||||
hide();
|
||||
else
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
/** maybe call a dialog that the wizard has finished. */
|
||||
void DeviceSetupWizard::accept() {
|
||||
TQT_DBusError error;
|
||||
if ( trustedCheckBox->isChecked() ) {
|
||||
if (!newdev->getTrusted(error)) {
|
||||
// newdev->setTrusted(error);
|
||||
newdev->setTrusted(true, error);
|
||||
if (error.isValid())
|
||||
tqDebug("Could not set trusted for %s\nError: %s", newdev->getPath().latin1(), error.message().latin1());
|
||||
else
|
||||
kdDebug() << "Trusted set for: " << newdev->getAlias(error) << endl;
|
||||
}
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */
|
||||
void DeviceSetupWizard::setDefaults(){
|
||||
pairing = false;
|
||||
connecting = false;
|
||||
}
|
||||
void DeviceSetupWizard::updateServiceList(){
|
||||
TQT_DBusError error;
|
||||
TQStringList uuids = newdev->getUUIDs(error);
|
||||
for (TQStringList::iterator it = uuids.begin(); it != uuids.end(); ++it) {
|
||||
if (
|
||||
((*it) == "00001203-0000-1000-8000-00805f9b34fb") || //Generic Audio
|
||||
((*it) == "00001108-0000-1000-8000-00805f9b34fb") || //Headset
|
||||
((*it) == "0000111e-0000-1000-8000-00805f9b34fb") || //Handsfree
|
||||
((*it) == "0000111f-0000-1000-8000-00805f9b34fb") || //Handsfree AG
|
||||
((*it) == "0000110a-0000-1000-8000-00805f9b34fb") || //A2DP Source
|
||||
((*it) == "0000110b-0000-1000-8000-00805f9b34fb") || //A2DP Sink
|
||||
((*it) == "00001103-0000-1000-8000-00805f9b34fb") || //DUN Gateway
|
||||
((*it) == "00001800-0000-1000-8000-00805f9b34fb") //GAP
|
||||
) {
|
||||
connectComboBox->insertItem(resolveUUID((*it)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "devicesetupwizard.moc"
|
@ -1,658 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* TrayIcon for tdebluez
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include <kprocess.h>
|
||||
#include <kstdaction.h>
|
||||
#include "trayicon.h"
|
||||
|
||||
|
||||
using namespace TDEBluetooth::Proxy;
|
||||
//using namespace std;
|
||||
|
||||
TrayIcon::TrayIcon(TDEBluetoothApp* app)
|
||||
{
|
||||
iconConnectingBlinkState = false;
|
||||
this->helpMenu = new KHelpMenu(this, TDEApplication::kApplication()->aboutData());
|
||||
this->app = app;
|
||||
|
||||
manager = app->manager;
|
||||
|
||||
// iconState = IDLE;
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
// config->setGroup("UI");
|
||||
// alwaysVisible = config->readBoolEntry("alwaysVisible", true);
|
||||
config->setGroup("General");
|
||||
int agentstate = config->readBoolEntry("authAgent", true);
|
||||
int obexserver = config->readBoolEntry("obexSrv", true);
|
||||
int autostart = config->readBoolEntry("AutoStart", true);
|
||||
|
||||
blinkTimer = new TQTimer(this);
|
||||
connect(blinkTimer, SIGNAL(timeout()), this, SLOT(updateIcon()));
|
||||
|
||||
deviceConfDialog = 0;
|
||||
deviceWizard = 0;
|
||||
|
||||
// // KBlueMon
|
||||
//// kbluemonAction = new TDEAction(i18n("KBlue&Mon"),
|
||||
//// TDEGlobal::iconLoader()->loadIcon("info", TDEIcon::Small, 16),
|
||||
//// TDEShortcut::null(), this, "kbluemon");
|
||||
//// connect(kbluemonAction, SIGNAL(activated()), this, SLOT(slotkbluemonitor()));
|
||||
////
|
||||
//// // KBlueLock
|
||||
//// kbluelockAction = new TDEAction(i18n("KBlue&Lock"),
|
||||
//// TDEGlobal::iconLoader()->loadIcon("kbluelock", TDEIcon::Small, 16),
|
||||
//// TDEShortcut::null(), this, "kbluelock");
|
||||
//// connect(kbluelockAction, SIGNAL(activated()), this, SLOT(slotkbluelock()));
|
||||
////
|
||||
//// // KBtobexclient
|
||||
//// kbtobexclientAction = new TDEAction(i18n("&Send File..."),
|
||||
//// TDEGlobal::iconLoader()->loadIcon("attach", TDEIcon::Small, 16),
|
||||
//// TDEShortcut::null(), this, "kbtobexclient");
|
||||
//// connect(kbtobexclientAction, SIGNAL(activated()), this, SLOT(slotkbtobexclient()));
|
||||
////
|
||||
// BT switch
|
||||
TDEBluetoothApp::AdaptersMap::iterator it = app->adapters.begin();
|
||||
for (it; it != app->adapters.end(); ++it ) {
|
||||
// slotAddAdapter(it.key());
|
||||
TQT_DBusError error;
|
||||
TQString name = app->adapters[it.key()]->getName(error);
|
||||
//TODO check for error
|
||||
bool powered = app->adapters[it.key()]->getPowered(error);
|
||||
//TODO check for error
|
||||
|
||||
TDEToggleAction *ad_a = new TDEToggleAction(this, name.utf8());
|
||||
ad_a->setChecked(powered);
|
||||
if (powered)
|
||||
ad_a->setText(i18n("Power off") + " [" + name + "]");
|
||||
else
|
||||
ad_a->setText(i18n("Power on") + " [" + name + "]");
|
||||
connect(ad_a, SIGNAL(toggled(bool)), this, SLOT(slotPowerOn(bool)));
|
||||
showPowerOnActionMap.insert(it.key(),ad_a);
|
||||
}
|
||||
|
||||
// Configuration menu
|
||||
configActionMenu = new TDEActionMenu(i18n("&Configuration"),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16), this, "config_menu");
|
||||
|
||||
// Help menu
|
||||
helpActionMenu = new TDEActionMenu(i18n("&Help"),
|
||||
TDEGlobal::iconLoader()->loadIcon("help", TDEIcon::Small, 16), this, "help_menu");
|
||||
|
||||
// show documentation
|
||||
showHelpAction = KStdAction::help(this,
|
||||
SLOT(slotShowHelp()), actionCollection());
|
||||
|
||||
// "About" menu item
|
||||
aboutAction = KStdAction::aboutApp(this,
|
||||
SLOT(slotAbout()), actionCollection());
|
||||
|
||||
// // Inputdevice configuration
|
||||
// inputConfigAction = new TDEAction(i18n("&Input Devices..."),
|
||||
// TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
// TDEShortcut::null(), this, "input_config");
|
||||
// connect(inputConfigAction, SIGNAL(activated()), this, SLOT(slotInputConfig()));
|
||||
|
||||
// Bluetooth Device configuration
|
||||
// from 06_rev748007.patch
|
||||
deviceConfigAction = new TDEAction(i18n("&Devices..."),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
TDEShortcut::null(), this, "device_config");
|
||||
connect(deviceConfigAction, SIGNAL(activated()), this, SLOT(slotDeviceConfig()));
|
||||
|
||||
// Bluetooth Adapter configuration
|
||||
adapterConfigAction = new TDEAction(i18n("&Adapters..."),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
TDEShortcut::null(), this, "device_config");
|
||||
connect(adapterConfigAction, SIGNAL(activated()), this, SLOT(slotAdapterConfig()));
|
||||
|
||||
// // Paired device configuration
|
||||
// pairedConfigAction = new TDEAction(i18n("&Paired/Trusted Devices..."),
|
||||
// TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
// TDEShortcut::null(), this, "paired_config");
|
||||
// connect(pairedConfigAction, SIGNAL(activated()), this, SLOT(slotPairedConfig()));
|
||||
|
||||
// Autostart switch
|
||||
autostartIconAction = new TDEToggleAction(this, "autostart");
|
||||
connect(autostartIconAction, SIGNAL(toggled(bool)), this, SLOT(slotIconAutostartToggled(bool)));
|
||||
autostartIconAction->setChecked(autostart);
|
||||
autostartIconAction->setText(i18n("&Auto Start"));
|
||||
|
||||
// Agent switch
|
||||
agentIconAction = new TDEToggleAction(this, "tdeauthagent");
|
||||
connect(agentIconAction, SIGNAL(toggled(bool)), this, SLOT(slotIconAgentToggled(bool)));
|
||||
agentIconAction->setChecked(agentstate);
|
||||
agentIconAction->setText(i18n("Auth A&gent"));
|
||||
|
||||
// Obexsrv switch
|
||||
obexIconAction = new TDEToggleAction(this, "tdebtobexsrv");
|
||||
connect(obexIconAction, SIGNAL(toggled(bool)), this, SLOT(slotObexSrv(bool)));
|
||||
obexIconAction->setChecked(obexserver);
|
||||
obexIconAction->setText(i18n("&Obex Server"));
|
||||
|
||||
// // Always-visible switch
|
||||
// showIconAction = new TDEToggleAction(this, "always_visible");
|
||||
// connect(showIconAction, SIGNAL(toggled(bool)), this, SLOT(slotShowIconToggled(bool)));
|
||||
// showIconAction->setChecked(alwaysVisible);
|
||||
// showIconAction->setText(i18n("Always &Visible"));
|
||||
// configActionMenu->insert(showIconAction);
|
||||
|
||||
TQPixmap logoPixmap = TDEGlobal::iconLoader()->loadIcon("tdebluez", TDEIcon::Small, 22);
|
||||
iconIdle = logoPixmap;
|
||||
iconOff = logoPixmap;
|
||||
iconConnected = logoPixmap;
|
||||
iconNoAdapter = logoPixmap;
|
||||
KPixmapEffect::toGray(iconOff);
|
||||
KPixmapEffect::fade(iconOff, 0.3, TQColor(255,255,255));
|
||||
KPixmapEffect::fade(iconConnected, 0.5, TQColor(255,0,0));
|
||||
KPixmapEffect::toGray(iconNoAdapter);
|
||||
KPixmapEffect::fade(iconNoAdapter, 0.5, TQColor(128,128,128));
|
||||
|
||||
connect(manager, SIGNAL(adapterRemoved(const TQString&)), this, SLOT(slotRemoveAdapter(const TQString&)));
|
||||
connect(manager, SIGNAL(adapterAdded(const TQString&)), this, SLOT(slotAddAdapter(const TQString&)));
|
||||
|
||||
if ( app->adapters.isEmpty())
|
||||
setupTray(false);
|
||||
else
|
||||
setupTray(true);
|
||||
|
||||
updateIcon();
|
||||
|
||||
connect(this, SIGNAL(quitSelected()), this, SLOT(slotQuitSelected()));
|
||||
|
||||
}
|
||||
|
||||
void TrayIcon::setupTray(bool enable) {
|
||||
|
||||
// CONTEXT MENU
|
||||
|
||||
// if (!kbluemonAction->isPlugged())
|
||||
// kbluemonAction->plug(contextMenu());
|
||||
// kbluemonAction->setEnabled(enable);
|
||||
//
|
||||
// if (!kbluelockAction->isPlugged())
|
||||
// kbluelockAction->plug(contextMenu());
|
||||
// kbluelockAction->setEnabled(enable);
|
||||
//
|
||||
// if (!kbtobexclientAction->isPlugged())
|
||||
// kbtobexclientAction->plug(contextMenu());
|
||||
// kbtobexclientAction->setEnabled(enable);
|
||||
|
||||
bool anyPowered = false;
|
||||
|
||||
TDEBluetoothApp::AdaptersMap::iterator it = app->adapters.begin();
|
||||
for (it; it != app->adapters.end(); ++it ) {
|
||||
// know if any adapter is powered
|
||||
TQT_DBusError error;
|
||||
if (app->adapters[it.key()]->getPowered(error)) {
|
||||
anyPowered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// show the on/off button per adapter
|
||||
TQMap<TQString, TDEToggleAction *>::iterator tait = showPowerOnActionMap.begin();
|
||||
for (tait; tait != showPowerOnActionMap.end(); ++tait ) {
|
||||
if (!tait.data()->isPlugged())
|
||||
tait.data()->plug(contextMenu());
|
||||
tait.data()->setEnabled(true);
|
||||
}
|
||||
|
||||
// device wizard
|
||||
if (!deviceConfigAction->isPlugged())
|
||||
deviceConfigAction->plug(contextMenu());
|
||||
deviceConfigAction->setEnabled(anyPowered);
|
||||
|
||||
// adapter configuration
|
||||
if (!adapterConfigAction->isPlugged())
|
||||
adapterConfigAction->plug(contextMenu());
|
||||
adapterConfigAction->setEnabled(anyPowered);
|
||||
|
||||
// the config menu
|
||||
if (!configActionMenu->isPlugged())
|
||||
configActionMenu->plug(contextMenu());
|
||||
configActionMenu->setEnabled(enable);
|
||||
|
||||
// the help menu
|
||||
if (!helpActionMenu->isPlugged())
|
||||
helpActionMenu->plug(contextMenu());
|
||||
|
||||
// HELP MENU
|
||||
if (!showHelpAction->isPlugged())
|
||||
showHelpAction->plug(helpActionMenu->popupMenu());
|
||||
|
||||
// Report bug menu item
|
||||
/*
|
||||
TDEAction* reportBugAction = KStdAction::reportBug(this,
|
||||
SLOT(slotReportBug()), actionCollection());
|
||||
helpActionMenu->insert(reportBugAction);
|
||||
*/
|
||||
|
||||
// ABOUT MENU
|
||||
if (!aboutAction->isPlugged())
|
||||
aboutAction->plug(helpActionMenu->popupMenu());
|
||||
|
||||
// Menu entries:
|
||||
// -------------
|
||||
|
||||
// // CONFIG MENU
|
||||
// if (!inputConfigAction->isPlugged())
|
||||
// inputConfigAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// Service configuration
|
||||
/* TODO: create BlueZ service UI
|
||||
serviceConfigAction = new TDEAction(i18n("Configure &Services..."),
|
||||
TDEGlobal::iconLoader()->loadIcon("configure", TDEIcon::Small, 16),
|
||||
TDEShortcut::null(), this, "service_config");
|
||||
connect(serviceConfigAction, SIGNAL(activated()), this, SLOT(slotServiceConfig()));
|
||||
configActionMenu->insert(serviceConfigAction);
|
||||
*/
|
||||
|
||||
// if (!pairedConfigAction->isPlugged())
|
||||
// pairedConfigAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// configure notifications
|
||||
/*
|
||||
TDEAction* notificationAction = KStdAction::configureNotifications(this,
|
||||
SLOT(slotConfigureNotifications()), actionCollection());
|
||||
configActionMenu->insert(notificationAction);
|
||||
*/
|
||||
|
||||
// Autostart option
|
||||
if (!autostartIconAction->isPlugged())
|
||||
autostartIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// Agent option
|
||||
if (!agentIconAction->isPlugged())
|
||||
agentIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
//Obex option
|
||||
if (!obexIconAction->isPlugged())
|
||||
obexIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
// if (!showIconAction->isPlugged())
|
||||
// showIconAction->plug(configActionMenu->popupMenu());
|
||||
|
||||
if (! app->adapters.isEmpty()) {
|
||||
// for (ObjectManagerImpl::AdapterList::iterator it=app->adapters.begin(); it!=app->adapters.end(); ++it) {
|
||||
connect(manager, SIGNAL(deviceConnectedChanged(const TQString&, bool)), SLOT(slotDeviceConnectedChanged(const TQString&, bool)));
|
||||
// connect(app->adapter, SIGNAL(remoteDeviceDisconnected(const TQString&)), SLOT(slotIconDisconnected(const TQString&)));
|
||||
connect(manager, SIGNAL(adapterNameChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
connect(manager, SIGNAL(adapterAliasChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
// connect(manager, SIGNAL(adapterModeChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
connect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), this, SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
// connect(manager, SIGNAL(adapterDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)), this, SLOT(slotDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)));
|
||||
// connect(manager, SIGNAL(adapterDiscoverableChanged(const TQString&, bool)), this, SLOT(slotDiscoverableChanged(const TQString&, bool)));
|
||||
// connect(manager, SIGNAL(adapterDiscoveringChanged(const TQString&, bool)), this, SLOT(slotDiscoveringChanged(const TQString&, bool)));
|
||||
// }
|
||||
}
|
||||
else {
|
||||
// for (ObjectManagerImpl::AdapterList::iterator it=app->adapters.begin(); it!=app->adapters.end(); ++it) {
|
||||
// disconnect(app->adapter, SIGNAL(remoteDeviceConnected(const TQString&)), SLOT(slotIconConnected(const TQString&)));
|
||||
// disconnect(app->adapter, SIGNAL(remoteDeviceDisconnected(const TQString&)), SLOT(slotIconDisconnected(const TQString&)));
|
||||
disconnect(manager, SIGNAL(adapterNameChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
disconnect(manager, SIGNAL(adapterAliasChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
// disconnect(manager, SIGNAL(adapterModeChanged(const TQString&, const TQString&)), this, SLOT(slotUpdateToolTip(const TQString&, const TQString&)));
|
||||
disconnect(manager, SIGNAL(adapterPowerOnChanged(const TQString&, bool)), this, SLOT(slotPowerOnChanged(const TQString&, bool)));
|
||||
// disconnect(manager, SIGNAL(adapterDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)), this, SLOT(slotDiscoverableTimeoutChanged(const TQString&, TQ_UINT32)));
|
||||
// disconnect(manager, SIGNAL(adapterDiscoverableChanged(const TQString&, bool)), this, SLOT(slotDiscoverableChanged(const TQString&, bool)));
|
||||
// disconnect(manager, SIGNAL(adapterDiscoveringChanged(const TQString&, bool)), this, SLOT(slotDiscoveringChanged(const TQString&, bool)));
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TrayIcon::~TrayIcon()
|
||||
{
|
||||
if (deviceWizard) delete deviceWizard;
|
||||
if (deviceConfDialog) delete deviceConfDialog;
|
||||
}
|
||||
|
||||
|
||||
void TrayIcon::updateIcon()
|
||||
{
|
||||
TQString oldText = TQToolTip::textFor(this);
|
||||
TQString newText = "";
|
||||
if (app->adapters.count() > 0) {
|
||||
|
||||
bool anyPowered = false;
|
||||
TQMap<TQString, TDEToggleAction *>::iterator it = showPowerOnActionMap.begin();
|
||||
for (it; it != showPowerOnActionMap.end(); ++it ) {
|
||||
// know if any adapter is powered
|
||||
TQT_DBusError error;
|
||||
if (app->adapters[it.key()]->getPowered(error)) {
|
||||
anyPowered = true;
|
||||
newText += tr("Adapter: %1\nAddress: %2\nMode: %3\n").arg(app->adapters[it.key()]->getAlias(error),app->adapters[it.key()]->getAddress(error),(app->adapters[it.key()]->getDiscoverable(error)) ? "discoverable" : "hidden");
|
||||
}
|
||||
else {
|
||||
newText = tr("Adapter not powered on");
|
||||
}
|
||||
if (error.isValid())
|
||||
tqDebug("Error: %s", error.message().utf8().data());
|
||||
}
|
||||
|
||||
bool anyConnected=false;
|
||||
TDEBluetoothApp::DevicesMap::Iterator dit=app->devices.begin();
|
||||
for (dit; dit != app->devices.end(); ++dit) {
|
||||
TQT_DBusError error;
|
||||
if (dit.data()->getConnected(error)) {
|
||||
anyConnected=true;
|
||||
break;
|
||||
}
|
||||
// TODO check for error
|
||||
}
|
||||
|
||||
if ( anyPowered ) {
|
||||
if ( anyConnected )
|
||||
setPixmap(iconConnected);
|
||||
else
|
||||
setPixmap(iconIdle);
|
||||
}
|
||||
else {
|
||||
setPixmap(iconOff);
|
||||
}
|
||||
|
||||
// TQT_DBusError err1,err2,err3;
|
||||
// newText = tr("Adapter: %1\nAddress: %2\nMode: %3\n(Not connected)").arg(app->adapters[0]->getName(err1)).arg(app->adapters[0]->getAddress(err2)).arg(app->adapters[0]->getDiscoverable(err3));
|
||||
// kdDebug() << "Name: " << app->adapters[0]->getName(err1) << endl;
|
||||
}
|
||||
else {
|
||||
setPixmap(iconNoAdapter);
|
||||
newText = tr("No Bluetooth Adapter");
|
||||
}
|
||||
show();
|
||||
|
||||
if (oldText != newText) {
|
||||
TQToolTip::remove(this);
|
||||
TQToolTip::add(this, newText);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconAutostartToggled(bool state) {
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
config->writeEntry("AutoStart", state);
|
||||
}
|
||||
|
||||
void TrayIcon::slotServiceConfig()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
}
|
||||
|
||||
void TrayIcon::slotAdapterConfig()
|
||||
{
|
||||
deviceConfDialog = new DeviceConfig(app);
|
||||
deviceConfDialog->show();
|
||||
}
|
||||
|
||||
void TrayIcon::slotDeviceConfig()
|
||||
{
|
||||
if (!deviceWizard) {
|
||||
deviceWizard = new DeviceWizard(app);
|
||||
deviceWizard->show();
|
||||
}
|
||||
else {
|
||||
deviceWizard->show();
|
||||
deviceWizard->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotInputConfig()
|
||||
{
|
||||
TDEProcess process(0);
|
||||
|
||||
process << "kinputwizard";
|
||||
if (!process.start(TDEProcess::DontCare)) {
|
||||
KMessageBox::information(this,
|
||||
i18n("Could not execute kinputwizard."),
|
||||
i18n("TDEBluetooth"));
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotkbluemonitor()
|
||||
{
|
||||
TDEProcess process(0);
|
||||
process << "kbluemon";
|
||||
|
||||
if (!process.start(TDEProcess::DontCare)) {
|
||||
KMessageBox::information(this,
|
||||
i18n("Could not execute KBlueMon."),
|
||||
i18n("TDEBluetooth"));
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotkbluelock()
|
||||
{
|
||||
TDEProcess process(0);
|
||||
process << "kbluelock";
|
||||
|
||||
if (!process.start(TDEProcess::DontCare)) {
|
||||
KMessageBox::information(this,
|
||||
i18n("Could not execute KBlueLock."),
|
||||
i18n("TDEBluetooth"));
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotObexSrv(bool state) {
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
if (state) {
|
||||
if (!app->startObexSrv()) {
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("obexSrv", state);
|
||||
}
|
||||
else {
|
||||
if (!app->stopObexSrv()) {
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("obexSrv", state);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconAgentToggled(bool state) {
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
if (state) {
|
||||
if (!app->startAuthAgent()) {
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("authAgent", state);
|
||||
}
|
||||
else {
|
||||
if (!app->stopAuthAgent()) {
|
||||
// TODO: pop up warning
|
||||
}
|
||||
else
|
||||
config->writeEntry("authAgent", state);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotPowerOn(bool state) {
|
||||
// who send the signal ?
|
||||
const TQObject * o = TQObject::sender();
|
||||
const TDEToggleAction* obj = const_cast<TDEToggleAction*>(reinterpret_cast<const TDEToggleAction*>(o));
|
||||
TQMap<TQString, TDEToggleAction *>::Iterator it = showPowerOnActionMap.begin();
|
||||
TQString path;
|
||||
for (it; it != showPowerOnActionMap.end(); ++it) {
|
||||
if (obj == it.data()) {
|
||||
path = it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
app->adapters[path]->powerOn(state);
|
||||
}
|
||||
|
||||
void TrayIcon::slotPowerOnChanged(const TQString &adapter, bool state) {
|
||||
TQT_DBusError error;
|
||||
TQString name = app->adapters[adapter]->getName(error);
|
||||
|
||||
if (state) {
|
||||
adapterConfigAction->setEnabled(true);
|
||||
deviceConfigAction->setEnabled(true);
|
||||
showPowerOnActionMap[adapter]->setText(i18n("Power off") + " [" + name + "]");
|
||||
setPixmap(iconIdle);
|
||||
}
|
||||
else {
|
||||
// FIXME disable only when there is no other adapter powered
|
||||
if (deviceWizard) deviceWizard->close();
|
||||
adapterConfigAction->setEnabled(false);
|
||||
if (deviceConfDialog)
|
||||
deviceConfDialog->hide();
|
||||
deviceConfigAction->setEnabled(false);
|
||||
showPowerOnActionMap[adapter]->setText(i18n("Power on") + " [" + name + "]");
|
||||
setPixmap(iconOff);
|
||||
}
|
||||
showPowerOnActionMap[adapter]->setChecked(state);
|
||||
}
|
||||
|
||||
void TrayIcon::slotDeviceConnectedChanged(const TQString& path, bool state) {
|
||||
TQT_DBusError error;
|
||||
if (state) {
|
||||
slotIconConnected(app->devices[path]->getAddress(error)) ;
|
||||
}
|
||||
else {
|
||||
slotIconDisconnected(app->devices[path]->getAddress(error)) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TrayIcon::mousePressEvent(TQMouseEvent *e)
|
||||
{
|
||||
if (e->button() == TQMouseEvent::LeftButton) {
|
||||
e->accept();
|
||||
TDEProcess proc;
|
||||
proc << "kfmclient" << "openURL" << "bluetooth:/";
|
||||
proc.start(TDEProcess::DontCare);
|
||||
}
|
||||
else {
|
||||
KSystemTray::mousePressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void TrayIcon::slotQuitSelected()
|
||||
{
|
||||
if (autostartIconAction->isChecked())
|
||||
return;
|
||||
// Ask if the user want to simply quit or disable
|
||||
// automatic start of TDEBluetooth
|
||||
int autoStart = KMessageBox::questionYesNoCancel( 0,
|
||||
i18n("Should TDEBluetooth still be restarted when you login?"),
|
||||
i18n("Automatically Start TDEBluetooth?"),i18n("Start"), i18n("Do Not Start") );
|
||||
TDEConfig *config = TDEGlobal::config();
|
||||
config->setGroup("General");
|
||||
if (autoStart == KMessageBox::Yes) {
|
||||
config->writeEntry("AutoStart", true);
|
||||
}
|
||||
else if (autoStart == KMessageBox::No) {
|
||||
config->writeEntry("AutoStart", false);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrayIcon::slotShowHelp()
|
||||
{
|
||||
// TODO: This is surely not the correct way to jump to the
|
||||
// right chapter. Do I really have to mention the html-file,
|
||||
// or is the id enough?
|
||||
TDEApplication::kApplication()->invokeHelp("",
|
||||
"tdebluetooth/components.html#components.TDEBluetooth");
|
||||
}
|
||||
|
||||
TQString TrayIcon::localAndEnglish(const TQCString& s)
|
||||
{
|
||||
if (TQString(s) != i18n(s))
|
||||
return TQString("%1 (\"%2\")").arg(i18n(s)).arg(s);
|
||||
else
|
||||
return s;
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconConnected(const TQString& address)
|
||||
{
|
||||
setPixmap(iconConnected);
|
||||
// KNotifyClient::event(TDEApplication::kApplication()->mainWidget()->winId(), "IncomingConnection",
|
||||
// i18n("Connected to <b>%1</b><br/>(<b>%2</b>)").arg(name).arg(address));
|
||||
// updateIcon();
|
||||
}
|
||||
|
||||
void TrayIcon::slotIconDisconnected(const TQString& address)
|
||||
{
|
||||
setPixmap(iconIdle);
|
||||
}
|
||||
|
||||
void TrayIcon::slotAddAdapter(const TQString& path) {
|
||||
TQT_DBusError error;
|
||||
TQString name = app->adapters[path]->getName(error);
|
||||
//TODO check for error
|
||||
bool powered = app->adapters[path]->getPowered(error);
|
||||
//TODO check for error
|
||||
|
||||
TDEToggleAction *ad_a = new TDEToggleAction(this, name.utf8());
|
||||
ad_a->setChecked(powered);
|
||||
if (powered)
|
||||
ad_a->setText(i18n("Power off") + " [" + name + "]");
|
||||
else
|
||||
ad_a->setText(i18n("Power on") + " [" + name + "]");
|
||||
connect(ad_a, SIGNAL(toggled(bool)), this, SLOT(slotPowerOn(bool)));
|
||||
showPowerOnActionMap.insert(path,ad_a);
|
||||
iconAdapterChanged();
|
||||
}
|
||||
|
||||
void TrayIcon::slotRemoveAdapter(const TQString& path) {
|
||||
showPowerOnActionMap.remove(path);
|
||||
iconAdapterChanged();
|
||||
}
|
||||
|
||||
void TrayIcon::iconAdapterChanged()
|
||||
{
|
||||
if (showPowerOnActionMap.isEmpty()) {
|
||||
setPixmap(iconNoAdapter);
|
||||
setupTray(0);
|
||||
deviceWizard->close();
|
||||
deviceWizard = 0;
|
||||
} else {
|
||||
setPixmap(iconIdle);
|
||||
setupTray(1);
|
||||
if (!deviceWizard)
|
||||
deviceWizard = new DeviceWizard(app);
|
||||
}
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
void TrayIcon::slotUpdateToolTip(const TQString& adapter, const TQString& name)
|
||||
{
|
||||
updateIcon();
|
||||
}
|
||||
|
||||
#include "trayicon.moc"
|
@ -1,176 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* TrayIcon for tdebluez
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluez.
|
||||
*
|
||||
* tdebluez is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluez is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRAYICON_H
|
||||
#define TRAYICON_H
|
||||
|
||||
#include <ntqobject.h>
|
||||
#include <dcopobject.h>
|
||||
#include <ntqevent.h>
|
||||
#include <ntqtooltip.h>
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <ksystemtray.h>
|
||||
#include <ntqpixmap.h>
|
||||
//#include <tdeaboutapplication.h>
|
||||
#include <tdeaction.h>
|
||||
#include <tdeapplication.h>
|
||||
//#include <kbugreport.h>
|
||||
#include <tdeconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <tdeglobal.h>
|
||||
#include <khelpmenu.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kicontheme.h>
|
||||
#include <tdelocale.h>
|
||||
#include <tdemessagebox.h>
|
||||
#include <knotifydialog.h>
|
||||
#include <knotifyclient.h>
|
||||
#include <kpixmapeffect.h>
|
||||
#include <tdepopupmenu.h>
|
||||
#include <kprocess.h>
|
||||
#include <krun.h>
|
||||
#include <tdeactionclasses.h>
|
||||
#include <objectmanagerImpl.h>
|
||||
#include <adapterImpl.h>
|
||||
|
||||
#include "application.h"
|
||||
#include "deviceconfig.h"
|
||||
#include "devicewizard.h"
|
||||
|
||||
class TQTimer;
|
||||
class TDEToggleAction;
|
||||
class TDEAction;
|
||||
class TDEActionMenu;
|
||||
class TDEPopupMenu;
|
||||
class KHelpMenu;
|
||||
class TDEBluetoothApp;
|
||||
|
||||
/**
|
||||
@author Fred Schaettgen
|
||||
*/
|
||||
class TrayIcon : public KSystemTray
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrayIcon(TDEBluetoothApp* app);
|
||||
~TrayIcon();
|
||||
// void setAlwaysShowIcon(bool state);
|
||||
|
||||
private slots:
|
||||
// void slotQuitSelected();
|
||||
// void slotShowIconToggled(bool);
|
||||
void slotServiceConfig();
|
||||
// void slotPairedConfig();
|
||||
void slotDeviceConfig();
|
||||
void slotAdapterConfig();
|
||||
void slotInputConfig();
|
||||
void slotkbluemonitor();
|
||||
void slotkbluelock();
|
||||
// void slotkbtobexclient();
|
||||
void slotConfigureNotifications() { KNotifyDialog::configure(this); };
|
||||
void slotQuitSelected();
|
||||
void slotReportBug() { helpMenu->reportBug(); };
|
||||
void slotAbout() { helpMenu->aboutApplication(); };
|
||||
void slotShowHelp();
|
||||
void slotIconConnected(const TQString&);
|
||||
void slotIconDisconnected(const TQString&);
|
||||
void slotIconAutostartToggled(bool state);
|
||||
void slotIconAgentToggled(bool state);
|
||||
void slotUpdateToolTip(const TQString&, const TQString&);
|
||||
void slotObexSrv(bool state);
|
||||
// gui -> manager
|
||||
void slotPowerOn(bool state);
|
||||
// manager -> gui
|
||||
void slotPowerOnChanged(const TQString&, bool);
|
||||
void slotDeviceConnectedChanged(const TQString&, bool);
|
||||
void slotAddAdapter(const TQString&);
|
||||
void slotRemoveAdapter(const TQString&);
|
||||
// void slotDiscoverableTimeoutChanged(const TQString&, TQ_UINT32 timeout);
|
||||
// void slotDiscoverableChanged(const TQString&, bool state);
|
||||
// void slotDiscoveringChanged(const TQString&, bool state);
|
||||
void updateIcon();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(TQMouseEvent *e);
|
||||
|
||||
private:
|
||||
// bool obexserv;
|
||||
// bool alwaysVisible;
|
||||
// bool autostart;
|
||||
// bool agentstate;
|
||||
bool acceptClose;
|
||||
// bool noAdapter;
|
||||
// bool adapterRemoved;
|
||||
// bool isPowered;
|
||||
|
||||
KPixmap iconIdle;
|
||||
KPixmap iconConnected;
|
||||
KPixmap iconNoAdapter;
|
||||
KPixmap iconOff;
|
||||
|
||||
TQTimer *blinkTimer;
|
||||
bool iconConnectingBlinkState;
|
||||
|
||||
TDEToggleAction *agentIconAction;
|
||||
TDEToggleAction *obexIconAction;
|
||||
// TDEToggleAction *showIconAction;
|
||||
TDEToggleAction *autostartIconAction;
|
||||
TQMap<TQString, TDEToggleAction *> showPowerOnActionMap;
|
||||
|
||||
TDEAction *serviceConfigAction;
|
||||
// TDEAction *pairedConfigAction;
|
||||
TDEAction *adapterConfigAction;
|
||||
TDEAction *deviceConfigAction;
|
||||
// TDEAction *inputConfigAction;
|
||||
TDEAction *showHelpAction;
|
||||
TDEAction *kbluemonAction;
|
||||
TDEAction *kbluelockAction;
|
||||
TDEAction *kbtobexclientAction;
|
||||
TDEAction *aboutAction;
|
||||
TDEActionMenu *configActionMenu;
|
||||
TDEActionMenu *helpActionMenu;
|
||||
|
||||
TDEBluetoothApp* app;
|
||||
|
||||
KHelpMenu *helpMenu;
|
||||
|
||||
DeviceConfig *deviceConfDialog; // for BT Adapters
|
||||
DeviceWizard *deviceWizard; // for BT Devices
|
||||
ObjectManagerImpl *manager;
|
||||
|
||||
TQString localAndEnglish(const TQCString& s);
|
||||
void setupTray(bool);
|
||||
void iconAdapterChanged();
|
||||
|
||||
signals:
|
||||
// void setObexSrv(bool);
|
||||
void setPowerOn(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,217 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Authorization Agent implementation of bluez5
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluezauth.
|
||||
*
|
||||
* tdebluezauth is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluezauth is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "authservice.h"
|
||||
#include <kdebug.h>
|
||||
|
||||
// TQt includes
|
||||
#include <ntqlayout.h>
|
||||
#include <tqdom.h>
|
||||
#include <tqstring.h>
|
||||
#include <tqstringlist.h>
|
||||
#include <tqdbuserror.h>
|
||||
#include <tqdbusmessage.h>
|
||||
#include <tqdbusdatalist.h>
|
||||
#include <tqdbusobjectpath.h>
|
||||
#include <deviceImpl.h>
|
||||
#include <btuuids.h>
|
||||
|
||||
#include "pindialog.h"
|
||||
#include "authorize.h"
|
||||
|
||||
Agent1Interface::Agent1Interface(TQT_DBusConnection &conn)
|
||||
: m_connection(&conn)
|
||||
{
|
||||
}
|
||||
|
||||
Agent1Interface::~Agent1Interface(){
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Implement virtual methods
|
||||
*
|
||||
*/
|
||||
|
||||
void Agent1Interface::handleMethodReply(const TQT_DBusMessage& reply) {
|
||||
// do something
|
||||
m_connection->send(reply);
|
||||
}
|
||||
|
||||
bool Agent1Interface::Release(TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1Interface::RequestPinCode(const TQT_DBusObjectPath& device, TQString& pincode, TQT_DBusError& error) {
|
||||
TDEBluetooth::Proxy::DeviceImpl *devImpl = new TDEBluetooth::Proxy::DeviceImpl("org.bluez", device.data());
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(pincode));
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(false);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
if (pinDialog->exec()==TQDialog::Accepted)
|
||||
return true;
|
||||
else {
|
||||
error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Agent1Interface::DisplayPinCode(const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Agent1Interface::RequestPasskey(const TQT_DBusObjectPath& device, TQ_UINT32& passkey, TQT_DBusError& error) {
|
||||
TDEBluetooth::Proxy::DeviceImpl *devImpl = new TDEBluetooth::Proxy::DeviceImpl("org.bluez", device.data());
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(passkey));
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(true);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
if (pinDialog->exec()==TQDialog::Accepted)
|
||||
return true;
|
||||
else {
|
||||
error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Agent1Interface::DisplayPasskey(const TQT_DBusObjectPath& device, const TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error) {
|
||||
TDEBluetooth::Proxy::DeviceImpl *devImpl = new TDEBluetooth::Proxy::DeviceImpl("org.bluez", device.data());
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(passkey));
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(false);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
if (pinDialog->exec()==TQDialog::Accepted)
|
||||
return true;
|
||||
else {
|
||||
error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Agent1Interface::RequestConfirmation(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error) {
|
||||
// do something
|
||||
TDEBluetooth::Proxy::DeviceImpl *devImpl = new TDEBluetooth::Proxy::DeviceImpl("org.bluez", device.data());
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
PinDialog *pinDialog = new PinDialog(name,addr);
|
||||
pinDialog->pinDlg->pinEdit->setText(TQString("%1").arg(passkey));
|
||||
pinDialog->pinDlg->pinEdit->setEnabled(false);
|
||||
KDialogBase::centerOnScreen(pinDialog);
|
||||
pinDialog->setActiveWindow();
|
||||
pinDialog->raise();
|
||||
|
||||
if (pinDialog->exec()==TQDialog::Accepted)
|
||||
return true;
|
||||
else {
|
||||
error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Agent1Interface::RequestAuthorization(const TQT_DBusObjectPath& device, TQT_DBusError& error) {
|
||||
TDEBluetooth::Proxy::DeviceImpl *devImpl = new TDEBluetooth::Proxy::DeviceImpl("org.bluez", device.data());
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
AuthorizeDialog *authDialog = new AuthorizeDialog(name,addr,TQString());
|
||||
KDialogBase::centerOnScreen(authDialog);
|
||||
authDialog->setActiveWindow();
|
||||
authDialog->raise();
|
||||
|
||||
if (authDialog->exec()==TQDialog::Accepted)
|
||||
return true;
|
||||
else {
|
||||
error = TQT_DBusError::stdFailed ("Request not authorized");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Agent1Interface::AuthorizeService(const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error) {
|
||||
TDEBluetooth::Proxy::DeviceImpl *devImpl = new TDEBluetooth::Proxy::DeviceImpl("org.bluez", device.data());
|
||||
devImpl->setConnection((*m_connection));
|
||||
TQString addr = devImpl->getAddress(error);
|
||||
TQString name = devImpl->getAlias(error);
|
||||
delete devImpl;
|
||||
AuthorizeDialog *authDialog = new AuthorizeDialog(name,addr,resolveUUID(uuid));
|
||||
KDialogBase::centerOnScreen(authDialog);
|
||||
authDialog->setActiveWindow();
|
||||
authDialog->raise();
|
||||
|
||||
if (authDialog->exec()==TQDialog::Accepted)
|
||||
return true;
|
||||
else {
|
||||
error = TQT_DBusError::stdFailed ("Request not accepted");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Agent1Interface::Cancel(TQT_DBusError& error) {
|
||||
// do something
|
||||
return true;
|
||||
}
|
||||
|
||||
AuthService::AuthService(TQT_DBusConnection &conn)
|
||||
: org_trinitydesktop_tdebluez(),
|
||||
m_connection(conn)
|
||||
{
|
||||
m_interfaces.insert("org.freedesktop.DBus.Introspectable", this);
|
||||
m_interfaces.insert("org.bluez.Agent1", new Agent1Interface(m_connection));
|
||||
registerObject(m_connection,DBUS_AUTH_SERVICE_PATH);
|
||||
}
|
||||
|
||||
AuthService::~AuthService(){
|
||||
unregisterObject();
|
||||
}
|
||||
|
||||
TQT_DBusObjectBase* AuthService::createInterface(const TQString& interfaceName)
|
||||
{
|
||||
return (TQT_DBusObjectBase*) m_interfaces[interfaceName];
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Authorization Agent implementation of bluez5
|
||||
*
|
||||
* Copyright (C) 2018 Emanoil Kotsev <deloptes@gmail.com>
|
||||
*
|
||||
*
|
||||
* This file is part of tdebluezauth.
|
||||
*
|
||||
* tdebluezauth is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* tdebluezauth is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with kbluetooth; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#ifndef AGENTIMPL_H
|
||||
#define AGENTIMPL_H
|
||||
|
||||
//#include <tqobject.h>
|
||||
|
||||
#include <agent/agent1interface.h>
|
||||
#include <agent/org_trinitydesktop_tdeblueznode.h>
|
||||
//#include "deviceImpl.h"
|
||||
//#include "authagent.h"
|
||||
|
||||
#include <tqmap.h>
|
||||
#include <tqdbusconnection.h>
|
||||
#include <tqdbusobject.h>
|
||||
#include <tqtimer.h>
|
||||
#include <tqeventloop.h>
|
||||
|
||||
#define DBUS_AUTH_SERVICE_PATH "/"
|
||||
|
||||
class Agent1Interface : public org::bluez::Agent1
|
||||
{
|
||||
|
||||
public:
|
||||
Agent1Interface(TQT_DBusConnection&);
|
||||
virtual ~Agent1Interface();
|
||||
protected:
|
||||
virtual bool Release(TQT_DBusError& error);
|
||||
virtual bool RequestPinCode(const TQT_DBusObjectPath& device, TQString& pincode, TQT_DBusError& error);
|
||||
virtual bool DisplayPinCode(const TQT_DBusObjectPath& device, const TQString& pincode, TQT_DBusError& error);
|
||||
virtual bool RequestPasskey(const TQT_DBusObjectPath& device, TQ_UINT32& passkey, TQT_DBusError& error);
|
||||
virtual bool DisplayPasskey(const TQT_DBusObjectPath& device, const TQ_UINT32 passkey, TQ_UINT16 entered, TQT_DBusError& error);
|
||||
virtual bool RequestConfirmation(const TQT_DBusObjectPath& device, TQ_UINT32 passkey, TQT_DBusError& error);
|
||||
virtual bool RequestAuthorization(const TQT_DBusObjectPath& device, TQT_DBusError& error);
|
||||
virtual bool AuthorizeService(const TQT_DBusObjectPath& device, const TQString& uuid, TQT_DBusError& error);
|
||||
virtual bool Cancel(TQT_DBusError& error);
|
||||
virtual void handleMethodReply(const TQT_DBusMessage& reply);
|
||||
private:
|
||||
TQT_DBusConnection *m_connection;
|
||||
};
|
||||
|
||||
class AuthService : public org_trinitydesktop_tdebluez
|
||||
{
|
||||
public:
|
||||
AuthService(TQT_DBusConnection&);
|
||||
~AuthService();
|
||||
|
||||
protected:
|
||||
virtual TQT_DBusObjectBase* createInterface(const TQString&);
|
||||
|
||||
private:
|
||||
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
|
||||
TQT_DBusConnection m_connection;
|
||||
};
|
||||
|
||||
#endif // AGENTIMPL_H
|