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
fe72f19a
Kaydet (Commit)
fe72f19a
authored
Şub 18, 2013
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
improve bluetooth discoverability toggling API.
Change-Id: I289d43fcb173b64b01183a41f780bc74d2ba0abe
üst
3708fe84
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
40 deletions
+52
-40
RemoteDialog.cxx
sd/source/ui/dlg/RemoteDialog.cxx
+3
-18
RemoteDialog.hxx
sd/source/ui/dlg/RemoteDialog.hxx
+0
-2
RemoteServer.hxx
sd/source/ui/inc/RemoteServer.hxx
+4
-2
BluetoothServer.cxx
sd/source/ui/remotecontrol/BluetoothServer.cxx
+29
-7
BluetoothServer.hxx
sd/source/ui/remotecontrol/BluetoothServer.hxx
+10
-3
Server.cxx
sd/source/ui/remotecontrol/Server.cxx
+6
-8
No files found.
sd/source/ui/dlg/RemoteDialog.cxx
Dosyayı görüntüle @
fe72f19a
...
...
@@ -22,22 +22,12 @@ RemoteDialog::RemoteDialog( Window *pWindow ) :
ModalDialog
(
pWindow
,
SdResId
(
DLG_PAIR_REMOTE
)
),
mButtonConnect
(
this
,
SdResId
(
BTN_CONNECT
)
),
mButtonCancel
(
this
,
SdResId
(
BTN_CANCEL
)
),
mClientBox
(
this
,
NULL
,
SdResId
(
LB_SERVERS
)
),
mPreviouslyDiscoverable
()
mClientBox
(
this
,
NULL
,
SdResId
(
LB_SERVERS
)
)
{
(
void
)
mPreviouslyDiscoverable
;
// avoid warnings about unused member
FreeResource
();
#ifdef ENABLE_SDREMOTE
#ifdef ENABLE_SDREMOTE_BLUETOOTH
mPreviouslyDiscoverable
=
RemoteServer
::
isBluetoothDiscoverable
();
if
(
!
mPreviouslyDiscoverable
)
RemoteServer
::
setBluetoothDiscoverable
(
true
);
#else
RemoteServer
::
setBluetoothDiscoverable
(
false
);
#endif
RemoteServer
::
ensureDiscoverable
();
vector
<
ClientInfo
*>
aClients
(
RemoteServer
::
getClients
()
);
...
...
@@ -83,12 +73,7 @@ IMPL_LINK_NOARG(RemoteDialog, HandleConnectButton)
IMPL_LINK_NOARG
(
RemoteDialog
,
CloseHdl
)
{
#if defined(ENABLE_SDREMOTE) && defined(ENABLE_SDREMOTE_BLUETOOTH)
if
(
!
mPreviouslyDiscoverable
)
{
RemoteServer
::
setBluetoothDiscoverable
(
false
);
}
#endif
RemoteServer
::
restoreDiscoverable
();
Close
();
return
0
;
}
...
...
sd/source/ui/dlg/RemoteDialog.hxx
Dosyayı görüntüle @
fe72f19a
...
...
@@ -27,8 +27,6 @@ private:
OKButton
mButtonConnect
;
CancelButton
mButtonCancel
;
ClientBox
mClientBox
;
// Whether discoverability was enabled befor the dialog started.
bool
mPreviouslyDiscoverable
;
DECL_DLLPRIVATE_LINK
(
HandleConnectButton
,
void
*
);
DECL_LINK
(
CloseHdl
,
void
*
);
...
...
sd/source/ui/inc/RemoteServer.hxx
Dosyayı görüntüle @
fe72f19a
...
...
@@ -66,8 +66,10 @@ namespace sd
SD_DLLPUBLIC
static
sal_Bool
connectClient
(
ClientInfo
*
pClient
,
rtl
::
OUString
aPin
);
SD_DLLPUBLIC
static
bool
isBluetoothDiscoverable
();
SD_DLLPUBLIC
static
void
setBluetoothDiscoverable
(
bool
aDiscoverable
);
/// ensure that discoverability (eg. for Bluetooth) is enabled
SD_DLLPUBLIC
static
void
ensureDiscoverable
();
/// restore the state of discoverability from before ensureDiscoverable
SD_DLLPUBLIC
static
void
restoreDiscoverable
();
// For the communicator
static
void
removeCommunicator
(
Communicator
*
pCommunicator
);
...
...
sd/source/ui/remotecontrol/BluetoothServer.cxx
Dosyayı görüntüle @
fe72f19a
...
...
@@ -260,7 +260,8 @@ void incomingCallback( void *userRefCon,
BluetoothServer
::
BluetoothServer
(
std
::
vector
<
Communicator
*>*
pCommunicators
)
:
mpCommunicators
(
pCommunicators
)
:
meWasDiscoverable
(
UNKNOWN
),
mpCommunicators
(
pCommunicators
)
{
}
...
...
@@ -268,6 +269,27 @@ BluetoothServer::~BluetoothServer()
{
}
void
BluetoothServer
::
ensureDiscoverable
()
{
if
(
!
spServer
||
spServer
->
meWasDiscoverable
!=
UNKNOWN
)
return
;
bool
bDiscoverable
=
spServer
->
isDiscoverable
();
spServer
->
meWasDiscoverable
=
bDiscoverable
?
DISCOVERABLE
:
NOT_DISCOVERABLE
;
spServer
->
setDiscoverable
(
true
);
}
void
BluetoothServer
::
restoreDiscoverable
()
{
if
(
!
spServer
)
return
;
if
(
spServer
->
meWasDiscoverable
==
NOT_DISCOVERABLE
)
spServer
->
setDiscoverable
(
false
);
spServer
->
meWasDiscoverable
=
UNKNOWN
;
}
bool
BluetoothServer
::
isDiscoverable
()
{
#if (defined(LINUX) && !defined(__FreeBSD_kernel__)) && defined(ENABLE_DBUS)
...
...
@@ -321,7 +343,7 @@ bool BluetoothServer::isDiscoverable()
#endif
}
void
BluetoothServer
::
setDiscoverable
(
bool
a
Discoverable
)
void
BluetoothServer
::
setDiscoverable
(
bool
b
Discoverable
)
{
#if (defined(LINUX) && !defined(__FreeBSD_kernel__)) && defined(ENABLE_DBUS)
SAL_INFO
(
"sdremote.bluetooth"
,
"BluetoothServer::setDiscoverable called"
);
...
...
@@ -391,12 +413,12 @@ void BluetoothServer::setDiscoverable( bool aDiscoverable )
return
;
}
GValue
a
DiscoverableGValue
=
G_VALUE_INIT
;
g_value_init
(
&
a
DiscoverableGValue
,
G_TYPE_BOOLEAN
);
g_value_set_boolean
(
&
aDiscoverableGValue
,
a
Discoverable
);
GValue
b
DiscoverableGValue
=
G_VALUE_INIT
;
g_value_init
(
&
b
DiscoverableGValue
,
G_TYPE_BOOLEAN
);
g_value_set_boolean
(
&
bDiscoverableGValue
,
b
Discoverable
);
aResult
=
dbus_g_proxy_call
(
aAdapter
,
"SetProperty"
,
&
aError
,
G_TYPE_STRING
,
"Discoverable"
,
G_TYPE_VALUE
,
&
a
DiscoverableGValue
,
G_TYPE_INVALID
,
G_TYPE_INVALID
);
G_TYPE_VALUE
,
&
b
DiscoverableGValue
,
G_TYPE_INVALID
,
G_TYPE_INVALID
);
if
(
!
aResult
||
aError
)
{
SAL_WARN
(
"sdremote.bluetooth"
,
"SetProperty(Discoverable) failed"
);
...
...
@@ -411,7 +433,7 @@ void BluetoothServer::setDiscoverable( bool aDiscoverable )
g_object_unref
(
G_OBJECT
(
aAdapter
));
dbus_g_connection_unref
(
aConnection
);
#else // defined(LINUX) && defined(ENABLE_DBUS)
(
void
)
a
Discoverable
;
// avoid warnings
(
void
)
b
Discoverable
;
// avoid warnings
#endif
}
...
...
sd/source/ui/remotecontrol/BluetoothServer.hxx
Dosyayı görüntüle @
fe72f19a
...
...
@@ -22,18 +22,25 @@ namespace sd
public
:
static
void
setup
(
std
::
vector
<
Communicator
*>*
pCommunicators
);
static
bool
isDiscoverable
();
static
void
setDiscoverable
(
bool
aDiscoverable
);
/// ensure that Bluetooth discoverability is on
static
void
ensureDiscoverable
();
/// restore the state of discoverability from before ensureDiscoverable
static
void
restoreDiscoverable
();
void
addCommunicator
(
Communicator
*
pCommunicator
);
private
:
BluetoothServer
(
std
::
vector
<
Communicator
*>*
pCommunicators
);
~
BluetoothServer
();
bool
isDiscoverable
();
void
setDiscoverable
(
bool
bDiscoverable
);
enum
{
UNKNOWN
,
DISCOVERABLE
,
NOT_DISCOVERABLE
}
meWasDiscoverable
;
static
BluetoothServer
*
spServer
;
virtual
void
SAL_CALL
run
();
std
::
vector
<
Communicator
*>*
mpCommunicators
;
};
}
...
...
sd/source/ui/remotecontrol/Server.cxx
Dosyayı görüntüle @
fe72f19a
...
...
@@ -318,21 +318,19 @@ void SdDLL::RegisterRemotes()
sd
::
DiscoveryService
::
setup
();
}
bool
RemoteServer
::
isBluetooth
Discoverable
()
void
RemoteServer
::
ensure
Discoverable
()
{
// FIXME: we could also enable listening on our WiFi
// socket here to significantly reduce the attack surface.
#ifdef ENABLE_SDREMOTE_BLUETOOTH
return
BluetoothServer
::
isDiscoverable
();
#else
return
false
;
BluetoothServer
::
ensureDiscoverable
();
#endif
}
void
RemoteServer
::
setBluetoothDiscoverable
(
bool
aDiscoverable
)
void
RemoteServer
::
restoreDiscoverable
(
)
{
#ifdef ENABLE_SDREMOTE_BLUETOOTH
BluetoothServer
::
setDiscoverable
(
aDiscoverable
);
#else
(
void
)
aDiscoverable
;
BluetoothServer
::
restoreDiscoverable
();
#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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