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
741c56aa
Kaydet (Commit)
741c56aa
authored
Eyl 13, 2012
tarafından
Andrzej J.R. Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for Windows Bluetooth Stack.
Change-Id: I3a039889a033591c81e0fd531de3b053e8fa1b3e
üst
522b4c65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
6 deletions
+101
-6
BluetoothServer.cxx
sd/source/ui/remotecontrol/BluetoothServer.cxx
+101
-2
DiscoveryService.cxx
sd/source/ui/remotecontrol/DiscoveryService.cxx
+0
-4
No files found.
sd/source/ui/remotecontrol/BluetoothServer.cxx
Dosyayı görüntüle @
741c56aa
...
...
@@ -18,9 +18,16 @@
#include "bluetooth/rfcomm.h"
#endif
#ifdef WIN32
#undef MSC // Unset a legacy define, as otherwise ws2bth.h breaks
#include <winsock2.h>
#include <ws2bth.h>
#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.
// Alternatively use the binary sdp record
#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"
...
...
@@ -146,10 +153,102 @@ void BluetoothServer::execute()
}
}
#else
// LINUX && ENABLE_DBUS
#elif defined(WIN32)
WORD
wVersionRequested
;
WSADATA
wsaData
;
(
void
)
mpCommunicators
;
// avoid warnings about unused member
wVersionRequested
=
MAKEWORD
(
2
,
2
);
if
(
WSAStartup
(
wVersionRequested
,
&
wsaData
)
)
{
return
;
// winsock dll couldn't be loaded
}
int
aSocket
=
socket
(
AF_BTH
,
SOCK_STREAM
,
BTHPROTO_RFCOMM
);
if
(
!
aSocket
)
{
WSACleanup
();
return
;
}
SOCKADDR_BTH
aAddr
;
aAddr
.
addressFamily
=
AF_BTH
;
aAddr
.
btAddr
=
0
;
aAddr
.
serviceClassId
=
GUID_NULL
;
aAddr
.
port
=
BT_PORT_ANY
;
// Select any free socket.
if
(
bind
(
aSocket
,
(
SOCKADDR
*
)
&
aAddr
,
sizeof
(
aAddr
)
)
==
SOCKET_ERROR
)
{
closesocket
(
aSocket
);
WSACleanup
();
return
;
}
SOCKADDR
aName
;
int
aNameSize
=
sizeof
(
aAddr
);
getsockname
(
aSocket
,
&
aName
,
&
aNameSize
);
// Retrieve the local address and port
CSADDR_INFO
aAddrInfo
;
memset
(
&
aAddrInfo
,
0
,
sizeof
(
aAddrInfo
)
);
aAddrInfo
.
LocalAddr
.
lpSockaddr
=
&
aName
;
aAddrInfo
.
LocalAddr
.
iSockaddrLength
=
sizeof
(
SOCKADDR_BTH
);
aAddrInfo
.
RemoteAddr
.
lpSockaddr
=
&
aName
;
aAddrInfo
.
RemoteAddr
.
iSockaddrLength
=
sizeof
(
SOCKADDR_BTH
);
aAddrInfo
.
iSocketType
=
SOCK_STREAM
;
aAddrInfo
.
iProtocol
=
BTHPROTO_RFCOMM
;
// To be used for setting a custom UUID once available.
// GUID uuid;
// uuid.Data1 = 0x00001101;
// memset( &uuid, 0x1000 + UUID*2^96, sizeof( GUID ) );
// uuid.Data2 = 0;
// uuid.Data3 = 0x1000;
// ULONGLONG aData4 = 0x800000805F9B34FB;
// memcpy( uuid.Data4, &aData4, sizeof(uuid.Data4) );
WSAQUERYSET
aRecord
;
memset
(
&
aRecord
,
0
,
sizeof
(
aRecord
));
aRecord
.
dwSize
=
sizeof
(
aRecord
);
aRecord
.
lpszServiceInstanceName
=
"LibreOffice-SDRemote"
;
// Optional
aRecord
.
lpszComment
=
"Remote control of presentations over bluetooth."
;
aRecord
.
lpServiceClassId
=
(
LPGUID
)
&
SerialPortServiceClass_UUID
;
aRecord
.
dwNameSpace
=
NS_BTH
;
aRecord
.
dwNumberOfCsAddrs
=
1
;
aRecord
.
lpcsaBuffer
=
&
aAddrInfo
;
if
(
WSASetService
(
&
aRecord
,
RNRSERVICE_REGISTER
,
0
)
==
SOCKET_ERROR
)
{
closesocket
(
aSocket
);
WSACleanup
();
return
;
}
if
(
listen
(
aSocket
,
1
)
==
SOCKET_ERROR
)
{
closesocket
(
aSocket
);
WSACleanup
();
return
;
}
SOCKADDR_BTH
aRemoteAddr
;
int
aRemoteAddrLen
=
sizeof
(
aRemoteAddr
);
while
(
true
)
{
int
bSocket
;
if
(
(
bSocket
=
accept
(
aSocket
,
(
sockaddr
*
)
&
aRemoteAddr
,
&
aRemoteAddrLen
))
==
INVALID_SOCKET
)
{
closesocket
(
aSocket
);
WSACleanup
();
return
;
}
else
{
Communicator
*
pCommunicator
=
new
Communicator
(
new
BufferedStreamSocket
(
bSocket
)
);
mpCommunicators
->
push_back
(
pCommunicator
);
pCommunicator
->
launch
();
}
}
// WIN32
#else // !(defined(LINUX) && defined(ENABLE_DBUS)) && !defined(WIN32)
(
void
)
mpCommunicators
;
// avoid warnings about unused member
#endif
}
...
...
sd/source/ui/remotecontrol/DiscoveryService.cxx
Dosyayı görüntüle @
741c56aa
...
...
@@ -65,16 +65,12 @@ DiscoveryService::~DiscoveryService()
void
DiscoveryService
::
execute
()
{
char
aBuffer
[
BUFFER_SIZE
];
fprintf
(
stderr
,
"Created
\n
"
);
while
(
true
)
{
memset
(
aBuffer
,
0
,
sizeof
(
char
)
*
BUFFER_SIZE
);
sockaddr_in
aAddr
;
socklen_t
aLen
=
sizeof
(
aAddr
);
fprintf
(
stderr
,
"REcing
\n
"
);
recvfrom
(
mSocket
,
aBuffer
,
BUFFER_SIZE
,
0
,
(
sockaddr
*
)
&
aAddr
,
&
aLen
);
fprintf
(
stderr
,
"Reced
\n
"
);
fprintf
(
stderr
,
"Received from
\n
"
);
OString
aString
(
aBuffer
,
strlen
(
"LOREMOTE_SEARCH"
)
);
if
(
aString
.
compareTo
(
"LOREMOTE_SEARCH"
)
==
0
)
{
...
...
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