Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
5dcb5399
Kaydet (Commit)
5dcb5399
authored
Eyl 05, 2012
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Port remote from gdbus to dbus-glib.
Change-Id: I291ee5d32110d2fffd976f3e5257daf976428a76
üst
defe079d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
60 deletions
+62
-60
CppunitTest_sd_uimpress.mk
sd/CppunitTest_sd_uimpress.mk
+1
-0
Library_sd.mk
sd/Library_sd.mk
+1
-1
BluetoothServer.cxx
sd/source/ui/remotecontrol/BluetoothServer.cxx
+58
-55
BluetoothServer.hxx
sd/source/ui/remotecontrol/BluetoothServer.hxx
+2
-4
No files found.
sd/CppunitTest_sd_uimpress.mk
Dosyayı görüntüle @
5dcb5399
...
@@ -82,6 +82,7 @@ endif
...
@@ -82,6 +82,7 @@ endif
$(eval $(call gb_CppunitTest_use_externals,sd_uimpress,\
$(eval $(call gb_CppunitTest_use_externals,sd_uimpress,\
gtk \
gtk \
dbus \
))
))
$(eval $(call gb_CppunitTest_add_exception_objects,sd_uimpress,\
$(eval $(call gb_CppunitTest_add_exception_objects,sd_uimpress,\
...
...
sd/Library_sd.mk
Dosyayı görüntüle @
5dcb5399
...
@@ -108,7 +108,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
...
@@ -108,7 +108,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
$(eval $(call gb_Library_use_externals,sd,\
$(eval $(call gb_Library_use_externals,sd,\
libxml2 \
libxml2 \
gio
\
dbus
\
))
))
ifeq ($(OS),WNT)
ifeq ($(OS),WNT)
...
...
sd/source/ui/remotecontrol/BluetoothServer.cxx
Dosyayı görüntüle @
5dcb5399
...
@@ -9,20 +9,19 @@
...
@@ -9,20 +9,19 @@
#include "BluetoothServer.hxx"
#include "BluetoothServer.hxx"
#include <stdio.h>
#include <stdio.h>
#if defined(LINUX) && defined(ENABLE_
GIO) && defined(ENABLE_
DBUS)
#if defined(LINUX) && defined(ENABLE_DBUS)
#include <glib.h>
#include <glib.h>
#include <
gio/gio
.h>
#include <
dbus/dbus-glib
.h>
#include <sys/unistd.h>
#include <sys/unistd.h>
#include <sys/socket.h>
#include <sys/socket.h>
#endif
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#ifdef LINUX
#include "bluetooth/bluetooth.h"
#include "bluetooth/bluetooth.h"
#include "bluetooth/rfcomm.h"
#include "bluetooth/rfcomm.h"
#endif
#endif
// FIXME: move this into an external file and look at sharing definitions
// across OS's (i.e. UUID and port ).
// Also look at determining which ports are available.
#define BLUETOOTH_SERVICE_RECORD "<?xml version='1.0' encoding= 'UTF-8' ?><record><attribute id='0x0001'><sequence><uuid value='0x1101' /></sequence></attribute><attribute id='0x0004'><sequence><sequence><uuid value='0x0100' /></sequence><sequence><uuid value='0x0003' /><uint8 value='0x05' /></sequence></sequence></attribute><attribute id='0x0005'><sequence><uuid value='0x1002' /></sequence></attribute><attribute id='0x0006'><sequence><uint16 value='0x656e' /><uint16 value='0x006a' /><uint16 value='0x0100' /></sequence></attribute><attribute id='0x0009'><sequence><sequence><uuid value='0x1101' /><uint16 value='0x0100' /></sequence></sequence></attribute><attribute id='0x0100'><text value='Serial Port' /></attribute><attribute id='0x0101'><text value='COM Port' /></attribute></record>"
#include "Communicator.hxx"
#include "Communicator.hxx"
...
@@ -38,66 +37,71 @@ BluetoothServer::~BluetoothServer()
...
@@ -38,66 +37,71 @@ BluetoothServer::~BluetoothServer()
{
{
}
}
struct
oslSocketImpl
{
int
m_Socket
;
int
m_nLastError
;
void
*
m_CloseCallback
;
void
*
m_CallbackArg
;
oslInterlockedCount
m_nRefCount
;
#if defined(LINUX)
sal_Bool
m_bIsAccepting
;
sal_Bool
m_bIsInShutdown
;
#endif
};
void
BluetoothServer
::
execute
()
void
BluetoothServer
::
execute
()
{
{
#if defined(LINUX) && defined(ENABLE_GIO) && defined(ENABLE_DBUS)
#if defined(LINUX) && defined(ENABLE_DBUS)
#ifdef GLIB_VERSION_2_26
g_type_init
();
g_type_init
();
GError
*
aError
=
NULL
;
GDBusConnection
*
aConnection
=
g_bus_get_sync
(
G_BUS_TYPE_SYSTEM
,
NULL
,
&
aError
);
GError
*
aError
=
NULL
;
if
(
aError
)
{
DBusGConnection
*
aConnection
=
NULL
;
g_error_free
(
aError
);
aConnection
=
dbus_g_bus_get
(
DBUS_BUS_SYSTEM
,
&
aError
);
return
;
// We can't get a dbus connection
if
(
aError
!=
NULL
)
{
g_error_free
(
aError
);
return
;
}
}
GVariant
*
aAdapter
=
g_dbus_connection_call_sync
(
aConnection
,
"org.bluez"
,
"/"
,
"org.bluez.Manager"
,
DBusGProxy
*
aManager
=
NULL
;
"DefaultAdapter"
,
NULL
,
aManager
=
dbus_g_proxy_new_for_name
(
aConnection
,
"org.bluez"
,
"/"
,
G_VARIANT_TYPE_TUPLE
,
"org.bluez.Manager"
);
G_DBUS_CALL_FLAGS_NONE
,
-
1
,
NULL
,
&
aError
);
if
(
a
Error
)
if
(
a
Manager
==
NULL
)
{
{
g_error_free
(
aError
);
dbus_g_connection_unref
(
aConnection
);
g_object_unref
(
aConnection
);
return
;
return
;
// We can't get an adapter -- no bluetooth possible
}
}
GVariant
*
aAdapterName
=
g_variant_get_child_value
(
aAdapter
,
0
);
GVariant
*
aRecordHandle
=
g_dbus_connection_call_sync
(
aConnection
,
gboolean
aResult
;
"org.bluez"
,
g_variant_get_string
(
aAdapterName
,
NULL
),
"org.bluez.Service"
,
DBusGObjectPath
*
aAdapterPath
=
NULL
;
"AddRecord"
,
aResult
=
dbus_g_proxy_call
(
aManager
,
"DefaultAdapter"
,
&
aError
,
g_variant_new
(
"(s)"
,
G_TYPE_INVALID
,
"<?xml version='1.0' encoding= 'UTF-8' ?><record><attribute id='0x0001'><sequence><uuid value='0x1101' /></sequence></attribute><attribute id='0x0004'><sequence><sequence><uuid value='0x0100' /></sequence><sequence><uuid value='0x0003' /><uint8 value='0x05' /></sequence></sequence></attribute><attribute id='0x0005'><sequence><uuid value='0x1002' /></sequence></attribute><attribute id='0x0006'><sequence><uint16 value='0x656e' /><uint16 value='0x006a' /><uint16 value='0x0100' /></sequence></attribute><attribute id='0x0009'><sequence><sequence><uuid value='0x1101' /><uint16 value='0x0100' /></sequence></sequence></attribute><attribute id='0x0100'><text value='Serial Port' /></attribute><attribute id='0x0101'><text value='COM Port' /></attribute></record>"
),
DBUS_TYPE_G_OBJECT_PATH
,
&
aAdapterPath
,
G_VARIANT_TYPE_TUPLE
,
G_TYPE_INVALID
);
G_DBUS_CALL_FLAGS_NONE
,
-
1
,
NULL
,
&
aError
);
g_variant_unref
(
aAdapter
);
g_object_unref
(
G_OBJECT
(
aManager
));
g_object_unref
(
aConnection
);
if
(
!
aResult
)
{
dbus_g_connection_unref
(
aConnection
);
return
;
}
if
(
aError
)
DBusGProxy
*
aAdapter
=
NULL
;
aAdapter
=
dbus_g_proxy_new_for_name
(
aConnection
,
"org.bluez"
,
aAdapterPath
,
"org.bluez.Service"
);
g_free
(
aAdapterPath
);
if
(
aAdapter
==
NULL
)
{
{
g_object_unref
(
aAdapter
);
dbus_g_connection_unref
(
aConnection
);
return
;
// Couldn't set up the service.
return
;
}
}
g_variant_unref
(
aRecordHandle
);
// We don't need the handle
// as the service is automatically
// deregistered on exit.
// Add the record -- the handle can be used to release it again, but we
// don't bother as the record is automatically released when LO exits.
guint
aHandle
;
aResult
=
dbus_g_proxy_call
(
aAdapter
,
"AddRecord"
,
&
aError
,
G_TYPE_STRING
,
BLUETOOTH_SERVICE_RECORD
,
G_TYPE_INVALID
,
G_TYPE_UINT
,
&
aHandle
,
G_TYPE_INVALID
);
g_object_unref
(
G_OBJECT
(
aAdapter
));
dbus_g_connection_unref
(
aConnection
);
if
(
!
aResult
)
{
return
;
}
// ---------------- Socket code
// ---------------- Socket code
int
aSocket
;
int
aSocket
;
...
@@ -139,8 +143,7 @@ void BluetoothServer::execute()
...
@@ -139,8 +143,7 @@ void BluetoothServer::execute()
}
}
}
}
#endif // GLIB_VERSION_2_26
#endif // LINUX && ENABLE_DBUS
#endif // LINUX
#ifdef WIN32
#ifdef WIN32
...
...
sd/source/ui/remotecontrol/BluetoothServer.hxx
Dosyayı görüntüle @
5dcb5399
...
@@ -26,11 +26,9 @@ namespace sd
...
@@ -26,11 +26,9 @@ namespace sd
~
BluetoothServer
();
~
BluetoothServer
();
static
BluetoothServer
*
spServer
;
static
BluetoothServer
*
spServer
;
void
execute
();
// salhelper::Thread
public
:
private
:
void
execute
();
std
::
vector
<
Communicator
*>*
mpCommunicators
;
std
::
vector
<
Communicator
*>*
mpCommunicators
;
};
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment