summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-02-12 11:02:47 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-02-13 11:31:19 +0000
commitc46cb184038309106e1797e071d9d17ed80f3114 (patch)
tree801896fb16a8832928545c5433bcc6fd3143b63b /sd
parent7d3a1616ee4d3f91394f5d807769d53289fd56e0 (diff)
sdremote - cleanup and annotate bluetooth SDP record.
Conflicts: sd/source/ui/remotecontrol/BluetoothServer.cxx Change-Id: Ie6c3d12387cececce4e169482659cbcbbcfd0975 Signed-off-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/remotecontrol/BluetoothServer.cxx15
-rw-r--r--sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx70
2 files changed, 77 insertions, 8 deletions
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index f676b5efef2d..2e5e62d1652e 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -6,7 +6,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+
#include "BluetoothServer.hxx"
+#include "BluetoothServiceRecord.hxx"
#include <stdio.h>
#include <sal/log.hxx>
@@ -35,11 +37,10 @@
#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>"
+#ifdef __MINGW32__
+// Value taken from http://msdn.microsoft.com/en-us/library/windows/desktop/ms738518%28v=vs.85%29.aspx
+#define NS_BTH 16
+#endif
#include "Communicator.hxx"
@@ -273,7 +274,7 @@ void SAL_CALL BluetoothServer::run()
// don't bother as the record is automatically released when LO exits.
guint aHandle;
gboolean aResult = dbus_g_proxy_call( aAdapter, "AddRecord", &aError,
- G_TYPE_STRING, BLUETOOTH_SERVICE_RECORD ,
+ G_TYPE_STRING, bluetooth_service_record,
G_TYPE_INVALID,
G_TYPE_UINT, &aHandle,
G_TYPE_INVALID);
@@ -432,7 +433,6 @@ void SAL_CALL BluetoothServer::run()
#endif
}
-
BluetoothServer *sd::BluetoothServer::spServer = NULL;
void BluetoothServer::setup( std::vector<Communicator*>* pCommunicators )
@@ -444,5 +444,4 @@ void BluetoothServer::setup( std::vector<Communicator*>* pCommunicators )
spServer->create();
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
new file mode 100644
index 000000000000..5249d904dea2
--- /dev/null
+++ b/sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef BLUETOOTH_SERVICE_RECORD_HXX
+#define BLUETOOTH_SERVICE_RECORD_HXX
+
+// FIXME: look into sharing definitions across OS's (i.e. UUID and port ).
+// Look into dynamically determining which ports are available.
+
+// SDP is a Service Description Protocol cf.
+// http://developer.bluetooth.org/TechnologyOverview/Pages/DI.aspx
+// This is an XML representation, an alternative would be a
+// binary SDP record.
+
+static const char *bluetooth_service_record =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<record>"
+ "<attribute id=\"0x0001\">" // Service class ID list
+ "<sequence>"
+ "<uuid value=\"0x1101\"/>"
+ "</sequence>"
+ "</attribute>"
+ "<attribute id=\"0x0004\">" // Protocol Descriptor list
+ "<sequence>"
+ "<sequence>"
+ "<uuid value=\"0x0100\"/>"
+ "</sequence>"
+ "<sequence>"
+ "<uuid value=\"0x0003\"/>" // enumeration value of RFCOMM protocol
+ "<uint8 value=\"0x05\"/>" // RFCOMM port number
+ "</sequence>"
+ "</sequence>"
+ "</attribute>"
+ "<attribute id=\"0x0005\">" // Browse Group List
+ "<sequence>"
+ "<uuid value=\"0x1002\"/>"
+ "</sequence>"
+ "</attribute>"
+ "<attribute id=\"0x0006\">" // Language Base Attribute ID List
+ "<sequence>"
+ "<uint16 value=\"0x656e\"/>"
+ "<uint16 value=\"0x006a\"/>"
+ "<uint16 value=\"0x0100\"/>"
+ "</sequence>"
+ "</attribute>"
+ "<attribute id=\"0x0009\">" // Bluetooth Profile Descriptor List
+ "<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>"
+ ;
+
+#endif // BLUETOOTH_SERVICE_RECORD_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */