diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-02-12 11:02:47 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-02-12 11:04:08 +0000 |
commit | e48b708da6556b63408084e37f83a4777c4dabfd (patch) | |
tree | e6f7d585738a6aef70e7b649b495b5788bdaf5d2 | |
parent | 39e755dd5c06823f4abda1453a195fdac74ae995 (diff) |
sdremote - cleanup and annotate bluetooth SDP record.
Change-Id: Ie6c3d12387cececce4e169482659cbcbbcfd0975
-rw-r--r-- | sd/source/ui/remotecontrol/BluetoothServer.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/BluetoothServiceRecord.hxx | 70 |
2 files changed, 73 insertions, 9 deletions
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx index f222628987b1..30c9c7de4bb8 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> @@ -41,12 +43,6 @@ #define NS_BTH 16 #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" using namespace sd; @@ -280,7 +276,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); @@ -440,7 +436,6 @@ void SAL_CALL BluetoothServer::run() #endif } - BluetoothServer *sd::BluetoothServer::spServer = NULL; void BluetoothServer::setup( std::vector<Communicator*>* pCommunicators ) @@ -452,5 +447,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: */ |