--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/bteng/btengconnman/inc/btengpairinghandler.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Bluetooth Engine API for connection management functionality.
+*
+*/
+
+#ifndef BTENGPAIRINGHANDLER_H
+#define BTENGPAIRINGHANDLER_H
+
+#include <btnotifclient.h>
+#include <btmanclient.h>
+
+#include "btengactive.h"
+
+class CBTEngConnMan;
+class MBTEngConnObserver;
+
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CBTEngPairingHandler ) : public CBase, public MBTEngActiveObserver
+ {
+
+public:
+
+ /**
+ * Two-phase constructor
+ */
+ static CBTEngPairingHandler* NewL( MBTEngConnObserver* aObserver,
+ CBTEngConnMan* aParent );
+
+ /**
+ * Destructor
+ */
+ virtual ~CBTEngPairingHandler();
+
+ /**
+ * ?description
+ *
+ * @since S60 v3.2
+ * @param ?arg1 ?description
+ * @param ?arg2 ?description
+ * @return ?description
+ */
+ void StartPairingL( const TBTDevAddr& aAddr, TBTDeviceClass& aDeviceClass );
+
+ /**
+ * ?description
+ *
+ * @since S60 v3.2
+ * @param ?arg1 ?description
+ * @param ?arg2 ?description
+ * @return ?description
+ */
+ void CancelPairing();
+
+// from base class MBTEngActiveObserver
+
+ /**
+ * From MBTEngActiveObserver.
+ * ?description
+ *
+ * @since S60 v3.2
+ * @param ?arg1 ?description
+ */
+ virtual void RequestCompletedL( CBTEngActive* aActive,
+ TInt aStatus );
+
+ /**
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @param aId The ID that identifies the outstanding request.
+ */
+ virtual void CancelRequest( TInt aRequestId );
+
+ /**
+ * From MBTEngActiveObserver.
+ * ?description
+ *
+ * @since S60 v3.2
+ * @param ?arg1 ?description
+ */
+ virtual void HandleError( CBTEngActive* aActive,
+ TInt aError );
+
+private:
+
+ /**
+ * C++ default constructor
+ */
+ CBTEngPairingHandler( MBTEngConnObserver* aObserver,
+ CBTEngConnMan* aParent );
+
+ /**
+ * Symbian 2nd-phase constructor
+ */
+ void ConstructL();
+
+private: // data
+
+ /**
+ * the address of the remote device to be paired.
+ */
+ TBTDevAddrPckgBuf iAddr;
+
+ /**
+ * the class of device value of the remote device to be paired.
+ */
+ TBTDeviceClass iCod;
+
+ /**
+ * the session to notifier which handles the actual pairing operation.
+ * Own.
+ */
+ RBTNotifier iBtNotifier;
+
+ /**
+ * Active object for pairing request
+ * Own.
+ */
+ CBTEngActive* iActive;
+
+ /**
+ * the observer that receives the result of pairing operation.
+ * Not own.
+ */
+ MBTEngConnObserver* iObserver;
+
+ /**
+ * ?description_of_pointer_member
+ * Not own.
+ */
+ CBTEngConnMan* iParent;
+
+ };
+
+
+#endif // BTENGPAIRINGHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/bteng/btengconnman/src/btengpairinghandler.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of pairing a Bluetooth device.
+*
+*/
+#include "btengpairinghandler.h"
+#include "btengconnman.h"
+#include "btengactive.h"
+#include "debug.h"
+
+const TInt KPairingRequestId = 60;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTEngPairingHandler::CBTEngPairingHandler( MBTEngConnObserver* aObserver,
+ CBTEngConnMan* aParent )
+: iObserver( aObserver ),
+ iParent( aParent )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTEngPairingHandler::ConstructL()
+ {
+ ASSERT( iObserver );
+ iActive = CBTEngActive::NewL( *this, KPairingRequestId,
+ CActive::EPriorityStandard );
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CBTEngPairingHandler* CBTEngPairingHandler::NewL( MBTEngConnObserver* aObserver,
+ CBTEngConnMan* aParent )
+ {
+ CBTEngPairingHandler* self = new( ELeave ) CBTEngPairingHandler( aObserver,
+ aParent );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTEngPairingHandler::~CBTEngPairingHandler()
+ {
+ delete iActive;
+ iBtNotifier.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CBTEngPairingHandler::StartPairingL( const TBTDevAddr& aAddr,
+ TBTDeviceClass& aDeviceClass )
+ {
+ TRACE_FUNC_ENTRY
+ if ( !iBtNotifier.Handle() )
+ {
+ User::LeaveIfError( iBtNotifier.Connect() );
+ }
+ iAddr() = aAddr;
+ iCod = aDeviceClass;
+ iBtNotifier.PairDevice( iAddr, iCod.DeviceClass(), iActive->RequestStatus() );
+ iActive->GoActive();
+ TRACE_FUNC_EXIT
+ }
+
+// ---------------------------------------------------------------------------
+// Cancel a pairing request.
+// ---------------------------------------------------------------------------
+//
+void CBTEngPairingHandler::CancelPairing()
+ {
+ TRACE_FUNC_ENTRY
+ if( iActive->IsActive() )
+ {
+ iBtNotifier.CancelPairDevice();
+ iActive->Cancel();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTEngActiveObserver.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CBTEngPairingHandler::RequestCompletedL( CBTEngActive* aActive,
+ TInt aStatus )
+ {
+ TRACE_FUNC_ARG( ( _L( "status: %d" ), aStatus ) )
+ ASSERT( aActive->RequestId() != 0 );
+ (void) aActive;
+ // Pairing completes, inform client.
+ iObserver->PairingComplete( iAddr(), aStatus );
+ TRACE_FUNC_EXIT
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTEngActiveObserver.
+// Handles cancelation of an outstanding request
+// ---------------------------------------------------------------------------
+//
+void CBTEngPairingHandler::CancelRequest( TInt aRequestId )
+ {
+ TRACE_FUNC_ARG( ( _L( "reqID %d" ), aRequestId ) );
+ if ( aRequestId == KPairingRequestId )
+ {
+ iBtNotifier.CancelPairDevice();
+ }
+ TRACE_FUNC_EXIT
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTEngActiveObserver.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CBTEngPairingHandler::HandleError( CBTEngActive* aActive,
+ TInt aError )
+ {
+ // Our RunL can actually not leave, so we should never reach here.
+ (void) aActive;
+ (void) aError;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.pro Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Global confirmation query notification plugin
+#
+
+TEMPLATE = lib
+TARGET = btdevicedialogplugin
+CONFIG += hb plugin
+INCLUDEPATH += . ../inc
+DEPENDPATH += .
+DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs
+
+MOC_DIR = moc
+OBJECTS_DIR = obj
+
+# dependencies
+HEADERS += inc/btdevicedialoginputwidget.h \
+ inc/btdevicedialogquerywidget.h \
+ inc/btdevicedialognotifwidget.h \
+ inc/btdevicedialogpluginerrors.h \
+ inc/btdevicedialogplugin.h \
+ inc/btdevicesearchdialogwidget.h \
+ inc/btdevicedialogplugintrace.h
+
+SOURCES += src/btdevicedialogplugin.cpp \
+ src/btdevicedialoginputwidget.cpp \
+ src/btdevicedialogquerywidget.cpp \
+ src/btdevicedialognotifwidget.cpp \
+ src/btdevicesearchdialogwidget.cpp
+
+RESOURCES += btdevicedialogplugin.qrc
+
+symbian: {
+ SYMBIAN_PLATFORMS = WINSCW ARMV5
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.UID3 = 0x2002E6DF
+ hblib.sources = Hb.dll
+ hblib.path = \sys\bin
+ hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}"
+ pluginstub.sources = btdevicedialogplugin.dll
+ pluginstub.path = /resource/plugins/devicedialogs
+ DEPLOYMENT += pluginstub
+}
+!local {
+ target.path = $${HB_PLUGINS_DIR}/devicedialogs
+ INSTALLS += target
+}
+
+BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ "rom/btdevicedialogplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btdevicedialogplugin.iby)" \
+ "qmakepluginstubs/btdevicedialogplugin.qtplugin /epoc32/data/z/pluginstub/btdevicedialogplugin.qtplugin"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/btdevicedialogplugin.qrc Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>docml/bt-device-search-dialog.docml</file>
+ <file>icons/qgn_prop_sml_bt.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/docml/bt-device-search-dialog.docml Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.8">
+
+ <widget name="dialog" type="HbDialog">
+ <widget name="heading" role="HbDialog:headingWidget" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ </widget>
+ <widget name="container" role="HbDialog:contentWidget" type="HbWidget">
+ <widget name="listView" type="HbListView">
+ <widget name="listItemPrototype" role="HbAbstractView:prototype" type="HbListViewItem">
+ <string name="state" value="normal"/>
+ </widget>
+ <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
+ <enums name="verticalScrollBarPolicy" value="ScrollBarAsNeeded"/>
+ </widget>
+ <widget name="container_1" type="HbWidget">
+ <widget name="viewBy" type="HbPushButton">
+ <string name="text" value="View by"/>
+ </widget>
+ <widget name="stop" type="HbPushButton">
+ <string name="text" value="Stop"/>
+ </widget>
+ <widget name="retry" type="HbPushButton">
+ <string name="text" value="Retry"/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="10un" type="PREFERRED" width="27un"/>
+ <layout spacing="0.5un" type="grid">
+ <griditem column="0" itemname="viewBy" row="0"/>
+ <griditem column="1" itemname="stop" row="0"/>
+ <griditem column="2" itemname="retry" row="0"/>
+ </layout>
+ </widget>
+ <layout type="grid">
+ <griditem column="0" itemname="listView" row="0"/>
+ <griditem column="0" itemname="container_1" row="1"/>
+ </layout>
+ </widget>
+ </widget>
+ <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ <dummydata objectName="listView" section="#common" value="0"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/icons/qgn_prop_sml_bt.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="84" height="58" viewBox="0.346 2.404 84 58">
+<linearGradient id="_11" gradientUnits="userSpaceOnUse" x1="35.53" y1="8.58" x2="15.86" y2="37.39">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path fill="url(#_11)" d="M28.073,11.521c-8.63,3.226-17.035,9.366-17.035,15.963c0.214,4.914,3.531,10.465,8.251,12.718 l-0.479-3.623c0,0-0.724-0.627-0.81-0.883c-0.188-0.759-0.284-1.486-0.284-2.174c0-5.745,6.096-9.069,11.15-11.158 c0.009,0.183,0.051,0.972,0.051,0.972l17.664-11.233L27.767,6.535C27.767,6.535,28.046,11.074,28.073,11.521z"/>
+<linearGradient id="_12" gradientUnits="userSpaceOnUse" x1="26.18" y1="29.3" x2="18.46" y2="24.18">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path fill="url(#_12)" d="M18.157,37.349c-3.745-9.36,6.649-13.8,12.099-15.924c-0.684-1.658-0.453-1.881-1.138-3.54 C16.947,22.626,12.446,29.557,18.157,37.349"/>
+<path fill="#17594C" d="M18.486,36.793c-4.707-2.647-7.327-6.673-7.02-9.781c-0.262,4.508,3.185,10.516,7.391,12.587L18.486,36.793z "/>
+<linearGradient id="_13" gradientUnits="userSpaceOnUse" x1="22.02" y1="1.34" x2="28.89" y2="21.43">
+<stop stop-color="#DCE8E4" offset="0"/>
+<stop stop-color="#43910A" offset="1"/>
+</linearGradient>
+<path fill="url(#_13)" d="M18.486,36.793C3.938,28.536,13.99,17.055,28.438,11.75l-0.291-4.737l17.599,5.209L29.237,22.72 l-0.243-4.601C17.948,22.426,11.835,29.852,18.486,36.793z"/>
+<linearGradient id="_14" gradientUnits="userSpaceOnUse" x1="44.66" y1="11.55" x2="57.38" y2="37.94">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<path fill="url(#_14)" d="M34.267,13.541l4.54-2.407c-0.029,0.018,5.495-2.224,10.221-0.995 c4.566,1.189,7.303,3.673,9.93,7.732c2.629,4.055,3.246,11.162,1.51,14.948c-1.74,3.786-3.346,5.118-4.619,6.318L34.267,13.541z"/>
+<radialGradient id="_15" gradientUnits="userSpaceOnUse" cx="34.06" cy="16.69" r="22.73">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</radialGradient>
+<path fill="url(#_15)" d="M57.314,29.195c0.453,9.102-6.096,16.178-14.625,15.811c-8.535-0.366-15.818-8.057-16.269-17.161 c-0.453-9.101,6.097-16.182,14.628-15.815C49.582,12.405,56.863,20.094,57.314,29.195z"/>
+<linearGradient id="_16" gradientUnits="userSpaceOnUse" x1="55.94" y1="38.63" x2="63.33" y2="53.19">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path fill="url(#_16)" d="M61.177,17.654c-0.096,0.239,0.225,0.462,0.225,0.462c4.405,2.811,7.194,6.907,6.558,10.752 c-0.598,4.594-5.178,8.876-11.973,11.272c-0.04-0.772-0.247-4.722-0.247-4.722l-17.22,11.052l0.428,3.709l18.586,5.84l-0.076-3.953 c0,0-0.034-0.178-0.067-0.352c2.115-0.857,16.265-7.052,16.265-19.208c0-6.525-2.87-11.621-11.938-15.011 C61.717,17.496,61.305,17.334,61.177,17.654z M73.385,29.575l-0.004-0.033C73.382,29.546,73.385,29.568,73.385,29.575z"/>
+<linearGradient id="_17" gradientUnits="userSpaceOnUse" x1="69.57" y1="42.52" x2="59.03" y2="35.34">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#2F8E9A" offset="0.44"/>
+<stop stop-color="#003D6D" offset="0.94"/>
+</linearGradient>
+<path fill="url(#_17)" d="M72.268,26.715c0,0-16.184,20.426-16.186,20.426c0.002,0,0.82,4.387,0.82,4.387 C57.377,51.393,78.113,43.305,72.268,26.715z"/>
+<linearGradient id="_18" gradientUnits="userSpaceOnUse" x1="37.66" y1="46.77" x2="64.66" y2="57.61">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#2F8E9A" offset="0.44"/>
+<stop stop-color="#003D6D" offset="0.94"/>
+</linearGradient>
+<polygon fill="url(#_18)" points="57.107,52.074 57.174,55.54 39.269,49.915 38.892,46.647 "/>
+<linearGradient id="_19" gradientUnits="userSpaceOnUse" x1="48.25" y1="18.94" x2="71.38" y2="74.51">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#2F8E9A" offset="0.44"/>
+<stop stop-color="#003D6D" offset="0.94"/>
+</linearGradient>
+<path fill="url(#_19)" d="M61.594,17.824c20.027,7.488,11.043,25.286-5.373,29.831l0.887,4.419l-18.216-5.427l16.53-10.608 l0.24,4.602C68.314,36.398,73.684,25.779,61.594,17.824z"/>
+<linearGradient id="_20" gradientUnits="userSpaceOnUse" x1="32.78" y1="17.21" x2="51.02" y2="38.71">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path fill="url(#_20)" d="M51.607,23.322l-11.484-9.805l-0.003,2.292c0,0-0.011,6.183-0.016,9.391l-5.984-5.037l-1.376,1.735 c0,0,2.93,2.427,6.589,5.549c-3.659,2.103-7.395,4.359-7.395,4.359l1.377,2.122l6.789-4.013c0.006,3.718,0.019,11.683,0.019,11.683 l11.484-6.576l-8.197-7.001L51.607,23.322z M42.482,18.439c1.766,1.508,3.668,3.132,5.047,4.31 c-0.754,0.432-2.664,1.526-5.058,2.899C42.476,23.42,42.48,20.708,42.482,18.439z M42.482,37.342 c-0.002-2.271-0.006-4.983-0.01-7.209c2.396,2.043,4.305,3.672,5.057,4.316C46.15,35.243,44.247,36.328,42.482,37.342z"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialoginputwidget.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogWidget class declaration.
+*
+*/
+
+
+#ifndef BTDEVICEDIALOGINPUTWIDGET_H
+#define BTDEVICEDIALOGINPUTWIDGET_H
+
+#include <QVariantMap>
+
+#include <hbdevicedialoginterface.h>
+#include <hbdevicedialog.h>
+#include <hbinputdialog.h>
+
+/*!
+ \class BtDeviceDialogInputWidget
+ \brief Widget class with properties setting.
+
+ BtDeviceDialogInputWidget, inherited from HbInputDialog,
+ implements interface HbDeviceDialogInterface. The Q_Properties
+ here are interfaces for caller of HbDeviceDialog to configue
+ what to be shown in the widget.
+
+ */
+class BtDeviceDialogInputWidget :
+ public QObject, public HbDeviceDialogInterface
+{
+ Q_OBJECT
+
+public:
+ BtDeviceDialogInputWidget(const QVariantMap ¶meters);
+
+ // From base class HbDeviceDialogInterface
+ virtual bool setDeviceDialogParameters(const QVariantMap ¶meters);
+ virtual int deviceDialogError() const;
+ virtual void closeDeviceDialog(bool byClient);
+ virtual HbDialog *deviceDialogWidget() const;
+ virtual QObject *signalSender() const;
+
+signals:
+ // Required by the framework
+ void deviceDialogClosed();
+ void deviceDialogData(QVariantMap data);
+
+public slots:
+ void inputClosed(HbAction *action);
+
+private:
+ void processParam(const QVariantMap ¶meters);
+ bool constructInputDialog(const QVariantMap ¶meters);
+ void resetProperties();
+
+private:
+ Q_DISABLE_COPY(BtDeviceDialogInputWidget)
+
+ int mLastError;
+ int mSendAction;
+ bool mShowEventReceived;
+ HbInputDialog *mInputDialog;
+};
+
+#endif // BTDEVICEDIALOGINPUTWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialognotifwidget.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogWidget class declaration.
+*
+*/
+
+
+#ifndef BTDEVICEDIALOGNOTIFWIDGET_H
+#define BTDEVICEDIALOGNOTIFWIDGET_H
+
+#include <QVariantMap>
+
+#include <hbdevicedialoginterface.h>
+#include <hbdevicedialog.h>
+#include <hbnotificationdialog.h>
+
+/*!
+ \class BtDeviceDialogQueryWidget
+ \brief Widget class with properties setting.
+
+ BtDeviceDialogQueryWidget, inherited from HbNotificationDialog,
+ implements interface HbDeviceDialogInterface. The Q_Properties
+ here are interfaces for caller of HbDeviceDialog to configue
+ what to be shown in the widget.
+
+ */
+class BtDeviceDialogNotifWidget :
+ public HbNotificationDialog, public HbDeviceDialogInterface
+{
+ Q_OBJECT
+
+public:
+ BtDeviceDialogNotifWidget(const QVariantMap ¶meters);
+
+ // From base class HbDeviceDialogInterface
+ virtual bool setDeviceDialogParameters(const QVariantMap ¶meters);
+ virtual int deviceDialogError() const;
+ virtual void closeDeviceDialog(bool byClient);
+ virtual HbDialog *deviceDialogWidget() const;
+
+signals:
+ // Required by the framework
+ void deviceDialogClosed();
+
+private:
+ void processParam(const QVariantMap ¶meters);
+ bool constructQueryDialog(const QVariantMap ¶meters);
+ void resetProperties();
+
+ // From base HbInputDialog, reimplement and emit signals.
+ void hideEvent(QHideEvent *event);
+ void showEvent(QShowEvent *event);
+
+private:
+ Q_DISABLE_COPY(BtDeviceDialogNotifWidget)
+
+ int mLastError;
+ int mSendAction;
+ bool mShowEventReceived;
+};
+
+#endif // BTDEVICEDIALOGNOTIFWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugin.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogPlugin class declaration.
+*
+*/
+
+
+#ifndef BTDEVICEDIALOGPLUGIN_P_H
+#define BTDEVICEDIALOGPLUGIN_P_H
+
+#include <QObject>
+#include <QVariantMap>
+
+#include <hbdevicedialogplugin.h>
+
+// Forward declarations
+class BtDeviceDialogPluginPrivate;
+
+/*!
+ \class BtDeviceDialogPlugin
+ \brief Device dialog widget plugin providing generic input dialog.
+
+ BtDeviceDialogPlugin implements interface HbDeviceDialogPlugin and
+ creates device dialog widget, which allows user's input.
+ Currently this plugin implements only one dialog type, identified by
+ "com.nokia.hb.btdevicedialog/1.0".
+
+ ToDo: create widget base on dialog types when multiple dialog types available.
+ */
+class BtDeviceDialogPlugin : public HbDeviceDialogPlugin
+{
+ Q_OBJECT
+
+public:
+ friend class BtDeviceDialogPluginPrivate;
+
+ BtDeviceDialogPlugin();
+ ~BtDeviceDialogPlugin();
+
+ // from base HbDeviceDialogPluginInterface
+ virtual HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType,
+ const QVariantMap ¶meters);
+
+ // from base HbDeviceDialogPlugin
+ virtual bool accessAllowed(const QString &deviceDialogType,
+ const QVariantMap ¶meters, const QVariantMap &securityInfo) const;
+ virtual bool deviceDialogInfo(const QString &deviceDialogType,
+ const QVariantMap ¶meters, DeviceDialogInfo *info) const;
+ virtual QStringList deviceDialogTypes() const;
+ virtual PluginFlags pluginFlags() const;
+ virtual int error() const;
+
+private:
+ HbDeviceDialogInterface *checkDialogType( const QVariantMap ¶meters );
+
+private:
+ Q_DISABLE_COPY(BtDeviceDialogPlugin)
+ BtDeviceDialogPluginPrivate *d;
+};
+
+#endif // BTDEVICEDIALOGPLUGIN_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogpluginerrors.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Plugin error constants
+*
+*/
+
+#ifndef BTDEVICEDIALOGPLUGINERRORS_H
+#define BTDEVICEDIALOGPLUGINERRORS_H
+
+#include <hbdevicedialog.h>
+
+// No error
+const int NoError = 0;
+// Illegal parameter error
+const int ParameterError = HbDeviceDialog::PluginErrors + 1;
+// Unknown device dialog error
+const int UnknownDeviceDialogError = HbDeviceDialog::PluginErrors + 2;
+
+#endif // BTDEVICEDIALOGPLUGINERRORS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogplugintrace.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Tracing macros
+*
+*/
+
+#ifndef BTDEVICEDIALOGPLUGINTRACE_H
+#define BTDEVICEDIALOGPLUGINTRACE_H
+
+#include <QDebug> // QDebug
+#include <QtGlobal> // qDebug()
+
+
+#ifdef ENABLE_TRACE_OUTPUT
+ #define INSTALL_MESSAGE_HANDLER HbDeviceDialogMessageHandler::installMessageHandler(QString(TRACE_OUTPUT_FILE), TRACE_OUTPUT_FILE_REQUIRED);
+ #define UNINSTALL_MESSAGE_HANDLER HbDeviceDialogMessageHandler::uninstallMessageHandler();
+ #define TRACE_UNUSED(name)
+ #define TRACE_STATIC_ENTRY qDebug() << __PRETTY_FUNCTION__ << "entry";
+ #define TRACE_STATIC_ENTRY_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "entry," << args;
+ #define TRACE_ENTRY qDebug() << __PRETTY_FUNCTION__ << "this" << (void *)this << "entry";
+ #define TRACE_ENTRY_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "this" << (void *)this << "entry," << args;
+ #define TRACE_EXIT qDebug() << __PRETTY_FUNCTION__ << "exit";
+ #define TRACE_EXIT_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "exit," << args;
+ #define TRACE(args) qDebug() << __PRETTY_FUNCTION__ << args;
+#else
+ #define INSTALL_MESSAGE_HANDLER
+ #define UNINSTALL_MESSAGE_HANDLER
+ #define TRACE_UNUSED(name) Q_UNUSED(name)
+ #define TRACE_STATIC_ENTRY
+ #define TRACE_STATIC_ENTRY_ARGS(args)
+ #define TRACE_ENTRY
+ #define TRACE_ENTRY_ARGS(args)
+ #define TRACE_EXIT
+ #define TRACE_EXIT_ARGS(args)
+ #define TRACE(args)
+#endif // ENABLE_TRACE_OUTPUT
+
+#endif // BTDEVICEDIALOGPLUGINTRACE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicedialogquerywidget.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogWidget class declaration.
+*
+*/
+
+
+#ifndef BTDEVICEDIALOGQUERYWIDGET_H
+#define BTDEVICEDIALOGQUERYWIDGET_H
+
+#include <QVariantMap>
+
+#include <hbdevicedialoginterface.h>
+#include <hbdevicedialog.h>
+#include <hbmessagebox.h>
+
+/*!
+ \class BtDeviceDialogQueryWidget
+ \brief Widget class with properties setting.
+
+ BtDeviceDialogQueryWidget, inherited from HbMessageBox,
+ implements interface HbDeviceDialogInterface. The Q_Properties
+ here are interfaces for caller of HbDeviceDialog to configue
+ what to be shown in the widget.
+
+ */
+class BtDeviceDialogQueryWidget :
+ public QObject, public HbDeviceDialogInterface
+{
+ Q_OBJECT
+
+public:
+ BtDeviceDialogQueryWidget(HbMessageBox::MessageBoxType type, const QVariantMap ¶meters);
+
+ // From base class HbDeviceDialogInterface
+ virtual bool setDeviceDialogParameters(const QVariantMap ¶meters);
+ virtual int deviceDialogError() const;
+ virtual void closeDeviceDialog(bool byClient);
+ virtual HbDialog *deviceDialogWidget() const;
+ virtual QObject *signalSender() const;
+
+signals:
+ // Required by the framework
+ void deviceDialogClosed();
+ void deviceDialogData(QVariantMap data);
+
+public slots:
+ void messageBoxClosed(HbAction*);
+
+private:
+ void processParam(const QVariantMap ¶meters);
+ bool constructQueryDialog(const QVariantMap ¶meters);
+ void resetProperties();
+
+private:
+ Q_DISABLE_COPY(BtDeviceDialogQueryWidget)
+
+ int mLastError;
+ int mSendAction;
+ bool mShowEventReceived;
+
+ HbMessageBox *mMessageBox;
+};
+
+#endif // BTDEVICEDIALOGQUERYWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/inc/btdevicesearchdialogwidget.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+
+#ifndef BTDEVICESEARCHDIALOGWIDGET_H
+#define BTDEVICESEARCHDIALOGWIDGET_H
+
+#include <QObject>
+#include <QVariantMap>
+#include <hbdialog.h>
+#include <hbdevicedialoginterface.h>
+#include <hbpopup.h>
+#include <hbdocumentloader.h>
+#include <qstandarditemmodel.h>
+#include <hbradiobuttonlist.h>
+#include <hblistwidget.h>
+
+
+struct device
+ {
+ QString mDeviceName;
+ QString mDeviceType;
+ int mDeviceIdx;
+ };
+
+class BTDeviceSearchDialogWidget : public HbDialog,
+ public HbDeviceDialogInterface
+ {
+ Q_OBJECT
+
+public:
+ BTDeviceSearchDialogWidget(const QVariantMap ¶meters);
+ ~BTDeviceSearchDialogWidget();
+
+public: // from HbDeviceDialogInterface
+ bool setDeviceDialogParameters(const QVariantMap ¶meters);
+ int deviceDialogError() const;
+ void closeDeviceDialog(bool byClient);
+ HbPopup *deviceDialogWidget() const;
+
+public slots:
+ void stopClicked();
+ void retryClicked();
+// void viewByClicked();
+ void deviceSelected(const QModelIndex& modelIndex);
+// void viewByItemSelected(int index);
+
+private:
+ bool constructDialog(const QVariantMap ¶meters);
+ void hideEvent(QHideEvent *event);
+ void showEvent(QShowEvent *event);
+ void appendToDeviceList(const QString deviceName);
+ bool appendToDeviceTypeList(const QString deviceType);
+ QIcon icon();
+
+signals:
+ void deviceDialogClosed();
+ void deviceDialogData(QVariantMap data);
+
+private:
+ HbDocumentLoader *mLoader;
+
+ /**
+ *
+ * item model for content list view.
+ */
+
+ QStandardItemModel* mContentItemModel;
+ HbDialog* mViewByDialog;
+ HbRadioButtonList* mRbl;
+ QList<QString> mDeviceTypeList;
+ QList<device> mDeviceList;
+ HbListView* mListView;
+ bool mViewByChosen;
+ QList<device> mDeviceLstOfType;
+ int mDeviceLstIdx;
+ int mSelectedType;
+ int mDeviceDialogData;
+
+ Q_DISABLE_COPY(BTDeviceSearchDialogWidget)
+ };
+
+#endif /* BTDEVICESEARCHDIALOGWIDGET_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/rom/btdevicedialogplugin.iby Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for project btdevicedialogplugin
+*
+*/
+
+
+#ifndef BTDEVICEDIALOGPLUGIN_IBY
+#define BTDEVICEDIALOGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef __BT
+file=ABI_DIR/BUILD_DIR/btdevicedialogplugin.dll SHARED_LIB_DIR/btdevicedialogplugin.dll
+data=/epoc32/data/z/pluginstub/btdevicedialogplugin.qtplugin resource/plugins/devicedialogs/btdevicedialogplugin.qtplugin
+#endif // __BT
+
+#endif // BTDEVICEDIALOGPLUGIN_IBY
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialoginputwidget.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogWidget class implementation.
+*
+*/
+
+
+#include "btdevicedialoginputwidget.h"
+#include "btdevicedialogplugintrace.h"
+#include <bluetoothdevicedialogs.h>
+#include <hbaction.h>
+#include <hbdialog.h>
+#include "btdevicedialogpluginerrors.h"
+
+/*!
+ class Constructor
+ */
+BtDeviceDialogInputWidget::BtDeviceDialogInputWidget(
+ const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ // set properties
+ mLastError = NoError;
+ mShowEventReceived = false;
+ mInputDialog = new HbInputDialog();
+
+ resetProperties();
+ constructInputDialog(parameters);
+ TRACE_EXIT
+}
+
+/*!
+ Set parameters, implementation of interface
+ Invoked when HbDeviceDialog::update calls.
+ */
+bool BtDeviceDialogInputWidget::setDeviceDialogParameters(
+ const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ mLastError = NoError;
+ processParam(parameters);
+ TRACE_EXIT
+ return true;
+}
+
+/*!
+ Get error, implementation of interface
+ */
+int BtDeviceDialogInputWidget::deviceDialogError() const
+{
+ TRACE_ENTRY
+ TRACE_EXIT
+ return mLastError;
+}
+
+/*!
+ Close notification, implementation of interface
+ */
+void BtDeviceDialogInputWidget::closeDeviceDialog(bool byClient)
+{
+ TRACE_ENTRY
+ Q_UNUSED(byClient);
+ // Closed by client or internally by server -> no action to be transmitted.
+ mSendAction = false;
+ mInputDialog->close();
+ // If show event has been received, close is signalled from hide event. If not,
+ // hide event does not come and close is signalled from here.
+ if (!mShowEventReceived) {
+ emit deviceDialogClosed();
+ }
+ TRACE_EXIT
+}
+
+/*!
+ Return display widget, implementation of interface
+ */
+HbDialog *BtDeviceDialogInputWidget::deviceDialogWidget() const
+{
+ TRACE_ENTRY
+ TRACE_EXIT
+ return mInputDialog;
+}
+
+QObject *BtDeviceDialogInputWidget::signalSender() const
+{
+ return const_cast<BtDeviceDialogInputWidget*>(this);
+}
+
+/*!
+ Construct display widget
+ */
+bool BtDeviceDialogInputWidget::constructInputDialog(const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ // analyze the parameters to compose the properties of the widget
+ processParam(parameters);
+ connect(mInputDialog, SIGNAL(finished(HbAction*)), this, SLOT(inputClosed(HbAction*)));
+
+ TRACE_EXIT
+ return true;
+}
+
+/*!
+ Take parameter values and generate relevant property of this widget
+ */
+void BtDeviceDialogInputWidget::processParam(const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+
+ QString keyStr, prompt;
+ keyStr.setNum( TBluetoothDialogParams::EResource );
+ // Validate if the resource item exists.
+ QVariantMap::const_iterator i = parameters.constFind( keyStr );
+ // item of ResourceId is not found, can't continue.
+ if ( i == parameters.constEnd() ) {
+ mLastError = UnknownDeviceDialogError;
+ return;
+ }
+
+ QVariant param = parameters.value( keyStr );
+ if ( param.toInt() == EPinInput ) {
+ prompt = QString( tr( "Passcode for device %1:" ) );
+ }
+ else {
+ mLastError = ParameterError;
+ return;
+ }
+
+ // check if minLength of passcode required
+ keyStr.setNum( TBluetoothDeviceDialog::EAdditionalDesc );
+ i = parameters.constFind( keyStr );
+ // Mini Length required, update prompt
+ // ToDo: use Validator to check input length.
+ if ( i != parameters.constEnd() ) {
+ prompt = QString( tr( "Enter %1 digit passcode for device %2:" ) );
+ param = parameters.value( keyStr );
+ }
+
+ // replace % with the miniLength and device name
+ int repls = prompt.count( QString( "%" ) );
+ if ( repls > 1 ) {
+ prompt = prompt.arg( param.toString() );
+ }
+ if ( repls > 0 ) {
+ QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) );
+ prompt = prompt.arg( name.toString() );
+ }
+ // set property value to this dialog widget
+ mInputDialog->setPromptText( prompt );
+ TRACE_EXIT
+}
+
+/*!
+ Reset properties to default values
+ */
+void BtDeviceDialogInputWidget::resetProperties()
+{
+ TRACE_ENTRY
+ // set to default values
+ mInputDialog->setModal(true);
+ mInputDialog->setTimeout(HbDialog::NoTimeout);
+ mInputDialog->setDismissPolicy(HbDialog::NoDismiss);
+ mSendAction = true;
+ // Todo: clean the Validator
+ TRACE_EXIT
+ return;
+}
+
+void BtDeviceDialogInputWidget::inputClosed(HbAction *action)
+{
+ QVariantMap data;
+
+ HbInputDialog *dlg=static_cast<HbInputDialog*>(sender());
+ if(dlg->actions().first() == action) {
+ //Ok
+ QVariant result( dlg->value().toString().toUtf8() );
+ data.insert( QString( "result" ), QVariant(true));
+ data.insert( QString( "input" ), result );
+ }
+ else if(dlg->actions().at(1) == action) {
+ //Cancel
+ data.insert( QString( "result" ), QVariant(false));
+ }
+
+ emit deviceDialogData(data);
+ emit deviceDialogClosed();
+ mSendAction = false;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialognotifwidget.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogWidget class implementation.
+*
+*/
+
+
+#include "btdevicedialognotifwidget.h"
+#include "btdevicedialogplugintrace.h"
+#include <bluetoothdevicedialogs.h>
+#include <hbaction.h>
+#include <hbdialog.h>
+#include "btdevicedialogpluginerrors.h"
+
+/*!
+ class Constructor
+ */
+BtDeviceDialogNotifWidget::BtDeviceDialogNotifWidget( const QVariantMap ¶meters )
+{
+ TRACE_ENTRY
+ // set properties
+ mLastError = NoError;
+ mShowEventReceived = false;
+ resetProperties();
+ constructQueryDialog(parameters);
+ TRACE_EXIT
+}
+
+/*!
+ Set parameters, implementation of interface
+ Invoked when HbDeviceDialog::update calls.
+ */
+bool BtDeviceDialogNotifWidget::setDeviceDialogParameters(
+ const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ mLastError = NoError;
+ processParam(parameters);
+ TRACE_EXIT
+ return true;
+}
+
+/*!
+ Get error, implementation of interface
+ */
+int BtDeviceDialogNotifWidget::deviceDialogError() const
+{
+ TRACE_ENTRY
+ TRACE_EXIT
+ return mLastError;
+}
+
+/*!
+ Close notification, implementation of interface
+ */
+void BtDeviceDialogNotifWidget::closeDeviceDialog(bool byClient)
+{
+ TRACE_ENTRY
+ Q_UNUSED(byClient);
+ // Closed by client or internally by server -> no action to be transmitted.
+ mSendAction = false;
+ close();
+ // If show event has been received, close is signalled from hide event. If not,
+ // hide event does not come and close is signalled from here.
+ if (!mShowEventReceived) {
+ emit deviceDialogClosed();
+ }
+ TRACE_EXIT
+}
+
+/*!
+ Return display widget, implementation of interface
+ */
+HbDialog *BtDeviceDialogNotifWidget::deviceDialogWidget() const
+{
+ TRACE_ENTRY
+ TRACE_EXIT
+ return const_cast<BtDeviceDialogNotifWidget*>(this);
+}
+
+/*!
+ Construct display widget
+ */
+bool BtDeviceDialogNotifWidget::constructQueryDialog(const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ // analyze the parameters to compose the properties of the message box widget
+ processParam(parameters);
+
+ TRACE_EXIT
+ return true;
+}
+
+/*!
+ Take parameter values and generate relevant property of this widget
+ */
+void BtDeviceDialogNotifWidget::processParam(const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ QString keyStr, prompt;
+ keyStr.setNum( TBluetoothDialogParams::EResource );
+ // Validate if the resource item exists.
+ QVariantMap::const_iterator i = parameters.constFind( keyStr );
+ // item of ResourceId is not found, can't continue.
+ if ( i == parameters.constEnd() ) {
+ mLastError = UnknownDeviceDialogError;
+ return;
+ }
+
+ QVariant param = parameters.value( keyStr );
+ int key = param.toInt();
+ switch ( key ) {
+ // Note dialogs
+ case EPairingSuccess:
+ prompt = QString( tr( "Pairing with %1 complete" ) );
+ break;
+ case EPairingFailure:
+ prompt = QString( tr( "Unable to pair with %1" ) );
+ break;
+ case EVisibilityTimeout:
+ prompt = QString( tr( "Phone is not detectable in searches made by other devices" ) );
+ break;
+ default:
+ mLastError = ParameterError;
+ break;
+ }
+ // Could use QChar with ReplacementCharacter?
+ int repls = prompt.count( QString( "%" ) );
+ if ( repls > 0 ) {
+ QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) );
+ prompt = prompt.arg( name.toString() );
+ }
+ // set property value to this dialog widget
+ HbNotificationDialog::setTitle( prompt );
+ TRACE_EXIT
+}
+
+/*!
+ Reset properties to default values
+ */
+void BtDeviceDialogNotifWidget::resetProperties()
+{
+ TRACE_ENTRY
+ mSendAction = true;
+ TRACE_EXIT
+ return;
+}
+
+/*!
+ Widget is about to hide. Closing effect has ended.
+ */
+void BtDeviceDialogNotifWidget::hideEvent(QHideEvent *event)
+{
+ HbNotificationDialog::hideEvent(event);
+ emit deviceDialogClosed();
+}
+
+/*!
+ Widget is about to show
+ */
+void BtDeviceDialogNotifWidget::showEvent(QShowEvent *event)
+{
+ HbNotificationDialog::showEvent(event);
+ mShowEventReceived = true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogplugin.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogPlugin class implementation.
+*
+*/
+
+
+#include "btdevicedialogplugin.h"
+#include "btdevicedialogplugintrace.h"
+#include <bluetoothdevicedialogs.h>
+#include <QtPlugin>
+#include <hbdevicedialog.h>
+#include "btdevicedialoginputwidget.h"
+#include "btdevicedialogquerywidget.h"
+#include "btdevicedialognotifwidget.h"
+
+#include "btdevicedialogpluginerrors.h"
+#include "btdevicesearchdialogwidget.h"
+
+Q_EXPORT_PLUGIN2(btdevicedialogplugin, BtDeviceDialogPlugin)
+
+// This plugin implements one device dialog type
+static const struct {
+ const char *mTypeString;
+} noteInfos[] = {
+ {"com.nokia.hb.btdevicedialog/1.0"}
+};
+
+class BtDeviceDialogPluginPrivate
+{
+public:
+ BtDeviceDialogPluginPrivate();
+public:
+ int mError;
+};
+/*!
+ BtDeviceDialogPluginPrivate Constructor
+ */
+BtDeviceDialogPluginPrivate::BtDeviceDialogPluginPrivate()
+{
+ mError = NoError;
+}
+
+/*!
+ BtDeviceDialogPlugin Constructor
+ */
+BtDeviceDialogPlugin::BtDeviceDialogPlugin()
+{
+ d = new BtDeviceDialogPluginPrivate;
+}
+
+/*!
+ Destructor
+ */
+BtDeviceDialogPlugin::~BtDeviceDialogPlugin()
+{
+ delete d;
+}
+
+/*!
+ Check if client is allowed to use device dialog widget
+ */
+bool BtDeviceDialogPlugin::accessAllowed(const QString &deviceDialogType,
+ const QVariantMap ¶meters, const QVariantMap &securityInfo) const
+{
+ Q_UNUSED(deviceDialogType)
+ Q_UNUSED(parameters)
+ Q_UNUSED(securityInfo)
+
+ // This plugin doesn't perform operations that may compromise security.
+ // All clients are allowed to use.
+ return true;
+}
+
+/*!
+ From interface class.
+ Use the dialog type in the parameter to create widget.
+ */
+HbDeviceDialogInterface *BtDeviceDialogPlugin::createDeviceDialog(
+ const QString &deviceDialogType, const QVariantMap ¶meters)
+{
+ d->mError = NoError;
+
+ int i;
+ // verify that requested dialog type is supported
+ const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]);
+ for(i = 0; i < numTypes; i++) {
+ if (noteInfos[i].mTypeString == deviceDialogType) {
+ break;
+ }
+ }
+ // dialog type was found
+ if (i < numTypes) {
+ return checkDialogType( parameters );
+ }
+ else {
+ // unknown dialog type, return error
+ d->mError = UnknownDeviceDialogError;
+ return 0;
+ }
+}
+
+/*!
+ Return information of device dialog the plugin creates
+ Currently only supporting 1 device dialog type, so no need to check the type.
+ */
+bool BtDeviceDialogPlugin::deviceDialogInfo(const QString &deviceDialogType,
+ const QVariantMap ¶meters, DeviceDialogInfo *info) const
+{
+ Q_UNUSED(parameters)
+ Q_UNUSED(deviceDialogType)
+ // set return values
+ info->group = GenericDeviceDialogGroup;
+ info->flags = NoDeviceDialogFlags;
+ info->priority = DefaultPriority;
+ return true;
+}
+
+/*!
+ Return device dialog types this plugin implements
+ Function will work fine (unchanged) when new dialogs are added.
+ */
+QStringList BtDeviceDialogPlugin::deviceDialogTypes() const
+{
+ QStringList types;
+ // read supported types from noteInfos
+ const int numTypes = sizeof(noteInfos) / sizeof(noteInfos[0]);
+ for(int i = 0; i < numTypes; i++) {
+ types.append(noteInfos[i].mTypeString);
+ }
+ return types;
+}
+
+/*!
+ Return plugin flags
+ */
+HbDeviceDialogPlugin::PluginFlags BtDeviceDialogPlugin::pluginFlags() const
+{
+ return NoPluginFlags;
+}
+
+/*!
+ Return last error
+ */
+int BtDeviceDialogPlugin::error() const
+{
+ return d->mError;
+}
+
+/*!
+ Check the device dialog type to decide which widget to be used.
+ And create the specified widget.
+ */
+HbDeviceDialogInterface *BtDeviceDialogPlugin::checkDialogType( const QVariantMap ¶meters )
+{
+ // Construct the key of EDialogType
+ QString keyStr;
+ keyStr.setNum( TBluetoothDialogParams::EDialogType );
+ // Find the const iterator with key EDialogType
+ QVariantMap::const_iterator i = parameters.constFind( keyStr );
+
+ // item with key EDialogType is not found
+ if ( i == parameters.constEnd() ) {
+ d->mError = UnknownDeviceDialogError;
+ return NULL;
+ }
+
+ // item with key EDialogType is found
+ // generate specified widget based on the dialog type value.
+ HbDeviceDialogInterface *deviceDialog = NULL;
+ switch ( i.value().toInt() ) {
+ case TBluetoothDialogParams::ENote:
+ deviceDialog =
+ new BtDeviceDialogQueryWidget(HbMessageBox::MessageTypeInformation, parameters);
+ break;
+ case TBluetoothDialogParams::EQuery:
+ deviceDialog =
+ new BtDeviceDialogQueryWidget(HbMessageBox::MessageTypeQuestion, parameters);
+ break;
+ case TBluetoothDialogParams::EInput:
+ deviceDialog = new BtDeviceDialogInputWidget(parameters);
+ break;
+ case TBluetoothDialogParams::EDeviceSearch:
+ deviceDialog = new BTDeviceSearchDialogWidget(parameters);
+ break;
+ case TBluetoothDialogParams::EGlobalNotif:
+ deviceDialog = new BtDeviceDialogNotifWidget(parameters);
+ break;
+ default:
+ d->mError = UnknownDeviceDialogError;
+ break;
+ }
+ if ( deviceDialog ) {
+ // verify no error has occurred
+ d->mError = deviceDialog->deviceDialogError();
+ if ( d->mError ) {
+ // Do not continue if an error occurred
+ delete deviceDialog;
+ deviceDialog = NULL;
+ }
+ else {
+ d->mError = UnknownDeviceDialogError;
+ }
+ }
+ return deviceDialog;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicedialogquerywidget.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtDeviceDialogWidget class implementation.
+*
+*/
+
+
+#include "btdevicedialogquerywidget.h"
+#include "btdevicedialogplugintrace.h"
+#include <bluetoothdevicedialogs.h>
+#include <hbaction.h>
+#include <hbdialog.h>
+#include "btdevicedialogpluginerrors.h"
+
+/*!
+ class Constructor
+ */
+BtDeviceDialogQueryWidget::BtDeviceDialogQueryWidget(
+ HbMessageBox::MessageBoxType type, const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ // set properties
+ mLastError = NoError;
+ mShowEventReceived = false;
+ mMessageBox = new HbMessageBox(type);
+
+ resetProperties();
+ constructQueryDialog(parameters);
+ TRACE_EXIT
+}
+
+/*!
+ Set parameters, implementation of interface
+ Invoked when HbDeviceDialog::update calls.
+ */
+bool BtDeviceDialogQueryWidget::setDeviceDialogParameters(
+ const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ mLastError = NoError;
+ processParam(parameters);
+ TRACE_EXIT
+ return true;
+}
+
+/*!
+ Get error, implementation of interface
+ */
+int BtDeviceDialogQueryWidget::deviceDialogError() const
+{
+ TRACE_ENTRY
+ TRACE_EXIT
+ return mLastError;
+}
+
+/*!
+ Close notification, implementation of interface
+ */
+void BtDeviceDialogQueryWidget::closeDeviceDialog(bool byClient)
+{
+ TRACE_ENTRY
+ Q_UNUSED(byClient);
+ // Closed by client or internally by server -> no action to be transmitted.
+ mSendAction = false;
+ mMessageBox->close();
+ // If show event has been received, close is signalled from hide event. If not,
+ // hide event does not come and close is signalled from here.
+ if (!mShowEventReceived) {
+ emit deviceDialogClosed();
+ }
+ TRACE_EXIT
+}
+
+/*!
+ Return display widget, implementation of interface
+ */
+HbDialog *BtDeviceDialogQueryWidget::deviceDialogWidget() const
+{
+ TRACE_ENTRY
+ TRACE_EXIT
+ return mMessageBox;
+}
+
+QObject *BtDeviceDialogQueryWidget::signalSender() const
+{
+ return const_cast<BtDeviceDialogQueryWidget*>(this);
+}
+
+/*!
+ Construct display widget
+ */
+bool BtDeviceDialogQueryWidget::constructQueryDialog(const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ // analyze the parameters to compose the properties of the message box widget
+ processParam(parameters);
+
+ connect(mMessageBox, SIGNAL(finished(HbAction*)), this, SLOT(messageBoxClosed(HbAction*)));
+
+ TRACE_EXIT
+ return true;
+}
+
+/*!
+ Take parameter values and generate relevant property of this widget
+ */
+void BtDeviceDialogQueryWidget::processParam(const QVariantMap ¶meters)
+{
+ TRACE_ENTRY
+ QString keyStr, prompt;
+ keyStr.setNum( TBluetoothDialogParams::EResource );
+ // Validate if the resource item exists.
+ QVariantMap::const_iterator i = parameters.constFind( keyStr );
+ // item of ResourceId is not found, can't continue.
+ if ( i == parameters.constEnd() ) {
+ mLastError = UnknownDeviceDialogError;
+ return;
+ }
+
+ QVariant param = parameters.value( keyStr );
+ int key = param.toInt();
+ switch ( key ) {
+ // Query dialogs:
+ case EAuthorization:
+ prompt = QString( tr( "Accept connection request from:\n%1" ) );
+ break;
+ case EIncomingPairing:
+ prompt = QString( tr( "Device '%1' is trying to pair with you. Allow pairing?" ) );
+ break;
+ case ENumericComparison:
+ prompt = QString( tr( "Does this code match the one on %1?\n\n%2" ) );
+ break;
+ case EPasskeyDisplay:
+ prompt = QString( tr( "Enter on %1:\n\n%2" ) );
+ break;
+ case ESetTrusted:
+ prompt = QString( tr( "Authorise this device to make connections automatically?" ) );
+ break;
+ case EBlockUnpairedDevice:
+ prompt = QString( tr( "Do you want to block all future connection attempts from device %1?" ) );
+ break;
+ case EBlockPairedDevice:
+ prompt = QString( tr( "Do you want to block all future connection attempts from paired device %1? \nThis will delete your pairing with the device." ) );
+ break;
+ // Note dialogs, but not Notification dialogs
+ // Input dialogs
+ case EPinInput:
+ case EObexPasskeyInput:
+ // NULL parameters
+ case ENoResource:
+ case EUnusedResource:
+ default:
+ mLastError = ParameterError;
+ break;
+ }
+ // Could use QChar with ReplacementCharacter?
+ int repls = prompt.count( QString( "%" ) );
+ if ( repls > 0 ) {
+ QVariant name = parameters.value( QString::number( TBluetoothDeviceDialog::EDeviceName ) );
+ prompt = prompt.arg( name.toString() );
+ if ( repls > 1 ) {
+ QVariant addval = parameters.value( QString::number( TBluetoothDeviceDialog::EAdditionalDesc ) );
+ prompt = prompt.arg( addval.toString() );
+ }
+ }
+ // set property value to this dialog widget
+ mMessageBox->setText( prompt );
+ TRACE_EXIT
+}
+
+/*!
+ Reset properties to default values
+ */
+void BtDeviceDialogQueryWidget::resetProperties()
+{
+ TRACE_ENTRY
+ // set to default values
+ mMessageBox->setModal(true);
+ mMessageBox->setTimeout(HbDialog::NoTimeout);
+ mMessageBox->setDismissPolicy(HbDialog::NoDismiss);
+ mSendAction = true;
+ TRACE_EXIT
+ return;
+}
+
+
+void BtDeviceDialogQueryWidget::messageBoxClosed(HbAction* action)
+{
+ QVariantMap data;
+
+ HbMessageBox *dlg=static_cast<HbMessageBox*>(sender());
+ if(dlg->actions().first() == action) {
+ //Yes
+ data.insert( QString( "result" ), QVariant(true));
+ }
+ else if(dlg->actions().at(1) == action) {
+ //No
+ data.insert( QString( "result" ), QVariant(false));
+ }
+
+ emit deviceDialogData(data);
+ emit deviceDialogClosed();
+ mSendAction = false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btdevicedialogplugin/src/btdevicesearchdialogwidget.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+
+#include "btdevicesearchdialogwidget.h"
+#include <hblabel.h>
+#include <hblistview.h>
+#include <hbtoolbar.h>
+#include <hbpushbutton.h>
+#include <qstandarditemmodel.h>
+
+const char* DOCML_BTDEV_SEARCH_DIALOG = ":/docml/bt-device-search-dialog.docml";
+
+
+BTDeviceSearchDialogWidget::BTDeviceSearchDialogWidget(const QVariantMap ¶meters)
+:HbDialog()
+ {
+ mDeviceLstIdx = 0;
+ mViewByChosen = false;
+ mSelectedType = 0;
+ mDeviceDialogData = 0;
+ constructDialog(parameters);
+ }
+
+BTDeviceSearchDialogWidget::~BTDeviceSearchDialogWidget()
+ {
+ delete mLoader;
+ mLoader = NULL;
+ delete mContentItemModel;
+ mContentItemModel = NULL;
+ // delete mRbl;
+ // delete mViewByDialog;
+ }
+
+bool BTDeviceSearchDialogWidget::setDeviceDialogParameters(const QVariantMap ¶meters)
+ {
+ device newDevice;
+
+ // newDevice.mDeviceName = parameters.value("deviceName").toString();
+ newDevice.mDeviceName = parameters.value(parameters.keys().at(0)).toString();
+
+ // newDevice.mDeviceType = parameters.value("deviceType").toString();
+ newDevice.mDeviceIdx = mDeviceLstIdx;
+
+ mDeviceList.append(newDevice);
+ mDeviceLstIdx++;
+
+
+ QStringList info;
+ // if(!mViewByChosen)
+ {
+ info.append(newDevice.mDeviceName);
+ // info.append(newDevice.mDeviceType);
+ QStandardItem* listitem = new QStandardItem();
+ listitem->setData(info, Qt::DisplayRole);
+
+ listitem->setIcon(icon());
+
+ mContentItemModel->appendRow(listitem);
+ }
+ /* else
+ {
+ if(mDeviceTypeList[mSelectedType] == newDevice.mDeviceType)
+ {
+ info.append(newDevice.mDeviceName);
+ info.append(newDevice.mDeviceType);
+ QStandardItem* listitem = new QStandardItem();
+ listitem->setData(info, Qt::DisplayRole);
+
+ listitem->setIcon(icon(newDevice.mDeviceType));
+
+ mContentItemModel->appendRow(listitem);
+ }
+ }*/
+
+ return true;
+ }
+
+int BTDeviceSearchDialogWidget::deviceDialogError() const
+ {
+ return 0;
+ }
+
+void BTDeviceSearchDialogWidget::closeDeviceDialog(bool byClient)
+ {
+ Q_UNUSED(byClient);
+ this->close();
+ }
+
+HbPopup* BTDeviceSearchDialogWidget::deviceDialogWidget() const
+ {
+ return const_cast<BTDeviceSearchDialogWidget*>(this);
+ }
+
+bool BTDeviceSearchDialogWidget::constructDialog(const QVariantMap ¶meters)
+ {
+ (void) parameters;
+ mLoader = new HbDocumentLoader();
+ bool ok = false;
+
+ mLoader->load(DOCML_BTDEV_SEARCH_DIALOG, &ok);
+ if(ok)
+ {
+ HbLabel* label = qobject_cast<HbLabel*>(mLoader->findWidget("heading"));
+ if(label)
+ {
+ label->setTextWrapping(Hb::TextWordWrap);
+ label->setAlignment(Qt::AlignHCenter);
+ label->setPlainText("Bluetooth - Found devices");
+ }
+ this->setHeadingWidget(label);
+ this->setFrameType(HbDialog::Strong);
+ this->setBackgroundFaded(false);
+
+ HbPushButton* viewBy = qobject_cast<HbPushButton*>(mLoader->findWidget("viewBy"));
+ HbPushButton* stop = qobject_cast<HbPushButton*>(mLoader->findWidget("stop"));
+ HbPushButton* retry = qobject_cast<HbPushButton*>(mLoader->findWidget("retry"));
+
+ mListView = qobject_cast<HbListView*>(mLoader->findWidget("listView"));
+ mListView->setSelectionMode(HbAbstractItemView::SingleSelection);
+
+ mContentItemModel = new QStandardItemModel(this);
+ mListView->setModel(mContentItemModel);//, prototype);
+
+ connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(deviceSelected(QModelIndex)));
+ connect(stop, SIGNAL(clicked()), this, SLOT(stopClicked()));
+ connect(retry, SIGNAL(clicked()), this, SLOT(retryClicked()));
+ connect(viewBy, SIGNAL(clicked()), this, SLOT(viewByClicked()));
+
+ QGraphicsWidget *widget = mLoader->findWidget(QString("container"));
+ this->setContentWidget(widget);
+ }
+ else
+ {
+
+ }
+
+ this->setBackgroundFaded(false);
+ setDismissPolicy(HbPopup::TapOutside);
+ setTimeout(HbPopup::NoTimeout);
+
+ /* mViewByDialog = new HbDialog();
+ mRbl = new HbRadioButtonList(mViewByDialog);
+ connect(mRbl, SIGNAL(itemSelected(int)), this, SLOT(viewByItemSelected(int)));*/
+
+ return true;
+ }
+
+void BTDeviceSearchDialogWidget::hideEvent(QHideEvent *event)
+ {
+ HbDialog::hideEvent(event);
+ if(mDeviceDialogData == 0)
+ {
+ QVariantMap val;
+ QVariant index(-1);
+ val.insert("selectedindex",index);
+ emit deviceDialogData(val);
+ }
+ emit deviceDialogClosed();
+ }
+
+void BTDeviceSearchDialogWidget::showEvent(QShowEvent *event)
+ {
+ HbDialog::showEvent(event);
+ }
+
+void BTDeviceSearchDialogWidget::stopClicked()
+ {
+ QVariantMap val;
+ QVariant index("Stop");
+ val.insert("Stop",index);
+ emit deviceDialogData(val);
+ }
+
+void BTDeviceSearchDialogWidget::retryClicked()
+ {
+ QVariantMap val;
+ QVariant index("Retry");
+ val.insert("Retry",index);
+ emit deviceDialogData(val);
+ delete mContentItemModel;
+ mContentItemModel = new QStandardItemModel(this);
+ mListView->setModel(mContentItemModel);
+ }
+
+//void BTDeviceSearchDialogWidget::viewByClicked()
+// {
+/* mViewByDialog->setDismissPolicy(HbPopup::NoDismiss);
+ mViewByDialog->setTimeout(HbPopup::NoTimeout);
+
+ bool foundEntry = false;
+ QStringList st;
+ st << "All";
+ mDeviceTypeList.clear();
+ for(int i = 0; i < mDeviceList.count(); i++)
+ {
+ for(int j = 0; j < mDeviceTypeList.count(); j++)
+ {
+ if(mDeviceTypeList[j] == mDeviceList[i].mDeviceType)
+ {
+ foundEntry = true;
+ break;
+ }
+ }
+ if(!foundEntry)
+ {
+ mDeviceTypeList.append(mDeviceList[i].mDeviceType);
+ }
+ foundEntry = false;
+ }
+
+ for(int k = 0; k < mDeviceTypeList.count(); k++)
+ {
+ st << mDeviceTypeList[k];
+ }
+
+ mRbl->setItems(st);
+ mViewByDialog->setContentWidget(mRbl);
+ mViewByDialog->setMaximumHeight(300);
+ mViewByDialog->setMaximumWidth(500);
+
+ mViewByDialog->show();*/
+ // }
+
+void BTDeviceSearchDialogWidget::deviceSelected(const QModelIndex& modelIndex)
+ {
+ int row = 0;
+
+ /* if(mViewByChosen)
+ {
+ row = mDeviceLstOfType[modelIndex.row()].mDeviceIdx;
+ }
+
+ else*/
+ {
+ row = modelIndex.row();
+ }
+
+ QVariantMap val;
+ QVariant index(row);
+ val.insert("selectedindex",index);
+ emit deviceDialogData(val);
+ mDeviceDialogData = 1;//flag is to say that device dialog data is emitted required when we cancel the dialog
+ //emit deviceDialogClosed();
+ this->close();
+ }
+
+//void BTDeviceSearchDialogWidget::viewByItemSelected(int index)
+ // {
+ // (void) index;
+ /* if(index == 0)
+ {
+ //Option 'All' selected
+ mViewByDialog->close();
+ delete mContentItemModel;
+ mContentItemModel = new QStandardItemModel(this);
+ mListView->setModel(mContentItemModel);
+ mViewByChosen = false;
+
+ for(int i = 0; i < mDeviceList.count(); i++)
+ {
+ QStandardItem* listitem = new QStandardItem();
+
+ QStringList info;
+ info << mDeviceList[i].mDeviceName << mDeviceList[i].mDeviceType ;
+ listitem->setData(info, Qt::DisplayRole);
+
+ //listitem->setIcon(icon(mDeviceList[i].mDeviceType));
+
+ mContentItemModel->appendRow(listitem);
+ }
+ }
+ else
+ {
+ index--;
+ mSelectedType = index;
+ mViewByDialog->close();
+
+ delete mContentItemModel;
+ mContentItemModel = new QStandardItemModel(this);
+ mListView->setModel(mContentItemModel);
+
+ mDeviceLstOfType.clear();
+ for(int i = 0; i < mDeviceList.count(); i++)
+ {
+ if(mDeviceList[i].mDeviceType == mDeviceTypeList[index])
+ {
+ mDeviceLstOfType.append(mDeviceList[i]);
+
+ QStandardItem* listitem = new QStandardItem();
+
+ QStringList info;
+ info << mDeviceList[i].mDeviceName << mDeviceTypeList[index];
+ listitem->setData(info, Qt::DisplayRole);
+
+ //listitem->setIcon(icon(mDeviceTypeList[index]));
+
+ mContentItemModel->appendRow(listitem);
+ }
+ }
+ mViewByChosen = true;
+ }*/
+ // }
+
+QIcon BTDeviceSearchDialogWidget::icon()
+ {
+ /* if(deviceType == "Audio")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_audio.svg")));
+ }
+ else if(deviceType == "Car-kit")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_car_kit.svg")));
+ }
+ else if(deviceType == "Computer")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_computer.svg")));
+ }
+ else if(deviceType == "Headset")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_headset.svg")));
+ }
+ else if(deviceType == "Keyboard")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_keyboard.svg")));
+ }
+ else if(deviceType == "Mouse")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_mouse.svg")));
+ }
+ else if(deviceType == "Phone")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_phone.svg")));
+ }
+ else if(deviceType == "Printer")
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_printer.svg")));
+ }
+ else
+ {
+ return (QIcon(QString(":/icons/qgn_prop_bt_unknown.svg")));
+ }*/
+ return QIcon(QString(":/icons/qgn_prop_sml_bt.svg"));
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/bwins/btnotifclientu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,11 @@
+EXPORTS
+ ??0RBTNotifier@@QAE@XZ @ 1 NONAME ; RBTNotifier::RBTNotifier(void)
+ ?CancelNotifier@RBTNotifier@@QAEHVTUid@@@Z @ 2 NONAME ; int RBTNotifier::CancelNotifier(class TUid)
+ ?Connect@RBTNotifier@@QAEHXZ @ 3 NONAME ; int RBTNotifier::Connect(void)
+ ?StartNotifier@RBTNotifier@@QAEHVTUid@@ABVTDesC8@@@Z @ 4 NONAME ; int RBTNotifier::StartNotifier(class TUid, class TDesC8 const &)
+ ?StartNotifierAndGetResponse@RBTNotifier@@QAEXAAVTRequestStatus@@VTUid@@ABVTDesC8@@AAVTDes8@@@Z @ 5 NONAME ; void RBTNotifier::StartNotifierAndGetResponse(class TRequestStatus &, class TUid, class TDesC8 const &, class TDes8 &)
+ ?UpdateNotifier@RBTNotifier@@QAEHVTUid@@ABVTDesC8@@AAVTDes8@@@Z @ 6 NONAME ; int RBTNotifier::UpdateNotifier(class TUid, class TDesC8 const &, class TDes8 &)
+ ?Version@RBTNotifier@@QAE?AVTVersion@@XZ @ 7 NONAME ; class TVersion RBTNotifier::Version(void)
+ ?CancelPairDevice@RBTNotifier@@QAEXXZ @ 8 NONAME ; void RBTNotifier::CancelPairDevice(void)
+ ?PairDevice@RBTNotifier@@QAEXABV?$TPckgBuf@VTBTDevAddr@@@@JAAVTRequestStatus@@@Z @ 9 NONAME ; void RBTNotifier::PairDevice(class TPckgBuf<class TBTDevAddr> const &, long, class TRequestStatus &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/eabi/btnotifclientu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,12 @@
+EXPORTS
+ _ZN11RBTNotifier13StartNotifierE4TUidRK6TDesC8 @ 1 NONAME
+ _ZN11RBTNotifier14CancelNotifierE4TUid @ 2 NONAME
+ _ZN11RBTNotifier14UpdateNotifierE4TUidRK6TDesC8R5TDes8 @ 3 NONAME
+ _ZN11RBTNotifier27StartNotifierAndGetResponseER14TRequestStatus4TUidRK6TDesC8R5TDes8 @ 4 NONAME
+ _ZN11RBTNotifier7ConnectEv @ 5 NONAME
+ _ZN11RBTNotifier7VersionEv @ 6 NONAME
+ _ZN11RBTNotifierC1Ev @ 7 NONAME
+ _ZN11RBTNotifierC2Ev @ 8 NONAME
+ _ZN11RBTNotifier10PairDeviceERK8TPckgBufI10TBTDevAddrElR14TRequestStatus @ 9 NONAME
+ _ZN11RBTNotifier16CancelPairDeviceEv @ 10 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/group/bld.inf Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* ============================================================================
+* Name : bld.inf
+* Part of : bluetoothengine / bluetoothengine
+* Description : Build information file for bluetoothengine subsystem
+* Version : %version: 1 %
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1.1
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/btnotifclient.h |../../../inc/btnotifclient.h
+../rom/btnotifclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btnotifclient.iby)
+PRJ_MMPFILES
+
+btnotifclient.mmp
+
+PRJ_TESTMMPFILES
+
+../tsrc/btnotifclienttest/group/btnotifclienttest.mmp
+
+PRJ_TESTEXPORTS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/group/btnotifclient.mmp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* ============================================================================
+* Name : btnotifclient.mmp
+* Part of : bluetoothengine / btnotifclient
+* Description : Project definition file for project btnotifclient
+* Version : %version: 1 %
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET btnotifclient.dll
+TARGETTYPE DLL
+UID 0x1000008d 0x20026FF6
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE btnotifclient.cpp
+
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE ../../inc
+
+LIBRARY euser.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/inc/btnotifclient.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* ============================================================================
+* Name : btnotifclient.h
+* Part of : bluetoothengine / btnotifclient
+* Description : Session class for client-server interaction with btnotifserver.
+*
+* Copyright © 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef RBTNOTIFCLIENT_H
+#define RBTNOTIFCLIENT_H
+
+#include <e32base.h>
+#include <btmanclient.h>
+
+/**
+ * A handle to a session with the Bluetooth notifier server for showing
+ * Bluetooth-related notifications to the user.
+ *
+ * ?more_complete_description
+ * @code
+ * ?good_class_usage_example(s)
+ * @endcode
+ *
+ * @lib ?library
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( RBTNotifier ) : public RSessionBase
+ {
+public:
+
+ /**
+ * Constructor.
+ *
+ * @since Symbian^4
+ */
+ IMPORT_C RBTNotifier();
+
+ /**
+ * Connect to the Bluetooth notifier server.
+ *
+ * @since Symbian^4
+ * @return KErrNone, if successful. Otherwise one of
+ * the system-wide error codes.
+ */
+ IMPORT_C TInt Connect();
+
+ /**
+ * Get the version information about the client.
+ *
+ * @since Symbian^4
+ * @return The version of the client-server interface implemented by this client.
+ */
+ IMPORT_C TVersion Version();
+
+ /**
+ * Requests the extended notifier server to start the notifier
+ * identified by the specified UID. The request is synchronous;
+ * the call returns when the request is complete.
+ *
+ * @since Symbian^4
+ * @param aNotifierUid The UID identifying the notifier. This is
+ * the same UID as used with RNotifier for the same purpose.
+ * @param aBuffer Data that can be passed to the notifier; the format and
+ * meaning of this depends on the notifier.
+ * @return KErrNone, if successful; KErrNotFound, if there
+ * is no notifier matching the specified UID; otherwise
+ * one of the other system-wide error codes.
+ */
+ IMPORT_C TInt StartNotifier( TUid aNotifierUid, const TDesC8& aBuffer );
+
+ /**
+ * Requests the extended notifier server to start the notifier
+ * identified by the specified UID. This is an asynchronous request.
+ *
+ * @since Symbian^4
+ * @param aRs The request status. On request completion, contains KErrNone,
+ * if successful; KErrNotFound, if there is no notifier matching the
+ * specified UID; KErrCancel, if the notifier was cancelled through
+ * RBTNotifier::CancelNotifier; otherwise, one of the other system
+ * wide error codes.
+ * @param aNotifierUid The UID identifying the notifier. This is
+ * the same UID as used with RNotifier for the same purpose.
+ * @param aBuffer Data that can be passed to the notifier; the format and
+ * meaning of this depends on the notifier.
+ * @param aResponse Response data from the notifier; the format and meaning
+ * of this depends on the notifier.
+ */
+ IMPORT_C void StartNotifierAndGetResponse( TRequestStatus& aRs,
+ TUid aNotifierUid, const TDesC8& aBuffer, TDes8& aResponse );
+
+ /**
+ * Requests the Bluetooth notifier server to cancel the notifier
+ * identified by the specified UID. The request is synchronous;
+ * the call returns when the request is complete.
+ *
+ * @since Symbian^4
+ * @param aNotifierUid The UID identifying the notifier. This is
+ * the same UID as used with RNotifier for the same purpose.
+ * @return KErrNone, if successful; KErrNotFound, if there
+ * is no notifier matching the specified UID; otherwise
+ * one of the other system-wide error codes.
+ */
+ IMPORT_C TInt CancelNotifier( TUid aNotifierUid );
+
+ /**
+ * Requests the Bluetooth notifier server to update the active
+ * notifier identified by the specified UID, with the data supplied.
+ * The request is synchronous; the call returns when the request is complete.
+ *
+ * @since Symbian^4
+ * @param aNotifierUid The UID identifying the notifier. This is
+ * the same UID as used with RNotifier for the same purpose.
+ * @param aBuffer Data that can be passed to the notifier; the format and
+ * meaning of this depends on the notifier.
+ * @param aResponse Response data from the notifier; the format and meaning
+ * of this depends on the notifier.
+ * @return KErrNone, if successful; KErrNotFound, if there
+ * is no notifier matching the specified UID; otherwise
+ * one of the other system-wide error codes.
+ */
+ IMPORT_C TInt UpdateNotifier( TUid aNotifierUid,
+ const TDesC8& aBuffer, TDes8& aResponse );
+
+ /**
+ * Requests the Bluetooth notifier server to pair with the device
+ * specified by the given Bluetooth device address.
+ * The request is asynchronous; Use CancelPairing() to cancel
+ * an outstanding pairing request.
+ *
+ * @since Symbian^4
+ * @param aAddr The address of the remote device to perform pairing with.
+ * @param aDeviceClass the CoD of the remote device.
+ * @param aStatus The request status. On request completion, contains KErrNone,
+ * if successful; KErrCancel, if the notifier was cancelled through
+ * RBTNotifier::CancelPair; otherwise, one of the other system
+ * wide error codes.
+ */
+ IMPORT_C void PairDevice( const TBTDevAddrPckgBuf& aAddr, TInt32 aDeviceClass,
+ TRequestStatus& aStatus );
+
+ /**
+ * Requests the Bluetooth notifier server to cancel the current pairing
+ * request. The request is synchronous;
+ * the call returns when the request is complete.
+ *
+ * If this request is issued when the Bluetooth
+ * notifier server has completed pairing with the device, the pairing
+ * will not be un-done. That is, the device will not be unpaired.
+ *
+ * @since Symbian^4
+ */
+ IMPORT_C void CancelPairDevice();
+
+private:
+
+private: // data
+
+ /**
+ * ?description_of_member
+ */
+// ?type ?member_name;
+
+ };
+
+#endif // RBTNOTIFCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/rom/btnotifclient.iby Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for project btnotif
+*
+*/
+
+
+#ifndef BTNOTIFCLIENT_IBY
+#define BTNOTIFCLIENT_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef __BT
+
+file=ABI_DIR/BUILD_DIR/btnotifclient.dll SHARED_LIB_DIR/btnotifclient.dll
+
+#endif // __BT
+
+#endif // BTNOTIFCLIENT_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifclient/src/btnotifclient.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* ============================================================================
+* Name : btnotifclient.cpp
+* Part of : bluetoothengine / btnotifclient
+* Description : Session class for client-server interaction with btnotifserver.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifclient.h"
+#include "btnotifclientserver.h"
+
+
+// ---------------------------------------------------------------------------
+// start btnotif server from client.
+// ---------------------------------------------------------------------------
+//
+TInt StartBTNotifSrv()
+ {
+ const TUidType serverUid( KNullUid, KNullUid, KBTNotifServerUid3 );
+ // Create a new server process. Simultaneous launching of two processes
+ // should be detected when the second one attempts to create the server
+ // object, failing with KErrAlreadyExists.
+ RProcess server;
+ TInt err = server.Create( KBTNotifServerName, KNullDesC, serverUid );
+ if( err != KErrNone )
+ {
+ return err;
+ }
+ TRequestStatus status;
+ server.Rendezvous( status );
+ if( status != KRequestPending )
+ {
+ server.Kill( KErrCancel ); // Abort startup
+ }
+ else
+ {
+ server.Resume();
+ }
+ User::WaitForRequest( status ); // Wait for start or death
+ err = status.Int();
+ if( server.ExitType() == EExitPanic )
+ {
+ // The server actually panicked; inform the client.
+ err = KErrDied;
+ }
+ server.Close();
+ return err;
+ }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RBTNotifier::RBTNotifier()
+: RSessionBase()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Return the client-server version number we implement.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TVersion RBTNotifier::Version()
+ {
+ return TVersion( KBTNotifServerVersionMajor, KBTNotifServerVersionMinor,
+ KBTNotifServerVersionBuild );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Connect to the notifier server. Start the server if necessary.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RBTNotifier::Connect()
+ {
+ TInt err = CreateSession( KBTNotifServerName, Version() );
+ if( err == KErrNotFound || err == KErrServerTerminated )
+ {
+ err = StartBTNotifSrv();
+ if( err == KErrNone || err == KErrAlreadyExists )
+ {
+ err = CreateSession( KBTNotifServerName, Version() );
+ }
+ }
+ return err;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Start the specified notifier, synchronous call.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RBTNotifier::StartNotifier( TUid aNotifierUid, const TDesC8& aBuffer )
+ {
+ return SendReceive( EBTNotifStartSyncNotifier,
+ TIpcArgs( (TInt) aNotifierUid.iUid, &aBuffer ) );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Start the specified notifier, asynchronous call.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RBTNotifier::StartNotifierAndGetResponse( TRequestStatus& aRs,
+ TUid aNotifierUid, const TDesC8& aBuffer, TDes8& aResponse )
+ {
+ SendReceive( EBTNotifStartAsyncNotifier,
+ TIpcArgs( (TInt) aNotifierUid.iUid, &aBuffer, &aResponse ), aRs );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancel the specified notifier.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RBTNotifier::CancelNotifier( TUid aNotifierUid )
+ {
+ return SendReceive( EBTNotifCancelNotifier, TIpcArgs( (TInt) aNotifierUid.iUid ) );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Update the specified notifier, synchronous call.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RBTNotifier::UpdateNotifier( TUid aNotifierUid,
+ const TDesC8& aBuffer, TDes8& aResponse )
+ {
+ return SendReceive( EBTNotifUpdateNotifier,
+ TIpcArgs( (TInt) aNotifierUid.iUid, &aBuffer, &aResponse ) );
+ }
+
+// ---------------------------------------------------------------------------
+// Issue a pairing request. asynchronous call.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RBTNotifier::PairDevice( const TBTDevAddrPckgBuf& aDevice,
+ TInt32 aDeviceClass, TRequestStatus& aStatus )
+ {
+ SendReceive( EBTEngPairDevice,
+ TIpcArgs( (TInt) EBTEngPairDevice, &aDevice, aDeviceClass ), aStatus );
+ }
+
+// ---------------------------------------------------------------------------
+// Cancel an ongoing pair request.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RBTNotifier::CancelPairDevice()
+ {
+ (void) SendReceive( EBTEngCancelPairDevice );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/bluetoothnotification.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,262 @@
+/*
+* ============================================================================
+* Name : bluetoothnotification.h
+* Part of : bluetoothengine / btnotif
+* Description : Class for managing an actual user notification or query.
+* It hides UI framework-specifics in a private class.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BLUETOOTHNOTIFICATION_H
+#define BLUETOOTHNOTIFICATION_H
+
+#include <e32base.h>
+#include <hb/hbcore/hbdevicedialogsymbian.h>
+#include "bluetoothdevicedialogs.h"
+#include "btnotificationresult.h"
+#include "bluetoothtrace.h"
+
+class CBTNotificationManager;
+class CHbSymbianVariantMap;
+
+/**
+ * CBluetoothNotification manages and controls notifications.
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBluetoothNotification ) : public CBase,
+ public MHbDeviceDialogObserver
+ {
+
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aManager Reference to the notification manager.
+ * @param aObserver Reference to our observer.
+ */
+ static CBluetoothNotification* NewL( CBTNotificationManager* aManager );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBluetoothNotification();
+
+ /**
+ * Sets the receiver of callbacks.
+ *
+ * @since Symbian^4
+ * @param aObserver Pointer to the callback interface.
+ */
+ inline void SetObserver( MBTNotificationResult* aObserver )
+ { iObserver = aObserver; }
+
+ /**
+ * Clears the receiver of callbacks.
+ *
+ * @since Symbian^4
+ */
+ inline void RemoveObserver()
+ { iObserver = NULL; }
+
+ /**
+ * Reset the notification.
+ *
+ * @since Symbian^4
+ */
+ void Reset();
+
+ /**
+ * Getter for the notification type.
+ *
+ * @since Symbian^4
+ * @return Notification type.
+ */
+ inline TBluetoothDialogParams::TBTDialogType NotificationType()
+ { return iType; }
+
+ /**
+ * Getter for the resource id.
+ *
+ * @since Symbian^4
+ * @return Resource identifier.
+ */
+ inline TBTDialogResourceId ResourceId()
+ { return iResourceId; }
+
+ inline CHbSymbianVariantMap* Data()
+ { return iNotificationData; }
+
+ /**
+ * Sets the type of notification (query, note, etc).
+ *
+ * @since Symbian^4
+ * @param aType The type of the notification.
+ * @param aResourceId The id of the resource to be shown.
+ * @return Error code
+ */
+ inline void SetNotificationType( TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId )
+ { iType = aType; iResourceId = aResourceId; }
+
+ /**
+ * Sets the data to be shown to the user.
+ *
+ * @since Symbian^4
+ * @param aType Identifies the type of data parameter to be set.
+ * @param aData Additional descriptor data to be shown in the dialog.
+ * @return Error code
+ */
+ TInt SetData( TInt aDataType, const TDesC& aData );
+
+ /**
+ * Sets the data to be shown to the user.
+ *
+ * @since Symbian^4
+ * @param aType Identifies the type of data parameter to be set.
+ * @param aData Additional integer data to be shown in the dialog.
+ * @return Error code
+ */
+ TInt SetData( TInt aDataType, TInt aData );
+
+ /**
+ * Updates the data to be shown to the user.
+ *
+ * @since Symbian^4
+ * @param ?arg1 ?description
+ * @return Error code
+ */
+ TInt Update( const TDesC& aData =KNullDesC );
+
+ /**
+ * Show the notification, which means that it
+ * is added to the queue.
+ *
+ * @since Symbian^4
+ * @param ?arg1 ?description
+ * @return Error code
+ */
+ TInt Show();
+
+ /**
+ * Stop showing the notification.
+ *
+ * @since Symbian^4
+ * @param ?arg1 ?description
+ * @return Error code
+ */
+ TInt Close();
+
+
+private:
+
+ CBluetoothNotification( CBTNotificationManager* aManager );
+
+ void ConstructL();
+
+ /**
+ * Sets the data to be shown to the user, leaves on error.
+ *
+ * @since Symbian^4
+ * @param aType Identifies the type of data parameter to be set.
+ * @param aData Additional descriptor data to be shown in the dialog.
+ */
+ void SetDataL( TInt aType, const TDesC& aData );
+
+ /**
+ * Sets the data to be shown to the user, leaves on error.
+ *
+ * @since Symbian^4
+ * @param aType Identifies the type of data parameter to be set.
+ * @param aData Additional integer data to be shown in the dialog.
+ */
+ void SetDataL( TInt aType, TInt aData );
+
+ /**
+ * From MHbDeviceDialogObserver.
+ * This callback is called when data is received from a device dialog.
+ *
+ * @since Symbian^4
+ * @param aData contains data from the dialog plugin.
+ */
+ virtual void DataReceived( CHbSymbianVariantMap& aData );
+
+ /**
+ * From MHbDeviceDialogObserver.
+ * This callback is called when a device dialog is closed. Any data sent by
+ * the dialog is indicated by the dataReceived() callback. If no observer is
+ * set in CHbDeviceDialog::Show the latest data can be retrieved with
+ * CHbDeviceDialog::receivedData().
+ *
+ * @since Symbian^4
+ * @param aCompletionCode gives the result of the dialog completion. Code can be
+ * either Symbian error code or device dialog error code.
+ */
+ virtual void DeviceDialogClosed( TInt aCompletionCode );
+
+#ifdef BLUETOOTHTRACE_ENABLED
+ void debugHbSymbianVariantMap( CHbSymbianVariantMap& aData);
+#endif // BLUETOOTHTRACE_ENABLED
+
+private: // data
+
+ /**
+ * The type of notification currently showing.
+ */
+ TBluetoothDialogParams::TBTDialogType iType;
+
+ /**
+ * The id of the resource (string identifier)
+ * of the currently showing notification.
+ */
+ TBTDialogResourceId iResourceId;
+
+ /**
+ * Reference to the queue manager.
+ * Not own.
+ */
+ CBTNotificationManager* iManager;
+
+ /**
+ * Reference to the receiver of the results.
+ * Not own.
+ */
+ MBTNotificationResult* iObserver;
+
+ /**
+ * The data to be shown to the user in a device dialog.
+ * Own.
+ */
+ CHbSymbianVariantMap* iNotificationData;
+
+ /**
+ * Buffer for receiving return data from the notifier.
+ */
+ CHbSymbianVariantMap* iReturnData;
+
+ /**
+ * Session object with the notification server.
+ * Own.
+ */
+ CHbDeviceDialogSymbian *iDialog;
+
+ BTUNITTESTHOOK
+
+ };
+
+#endif // BLUETOOTHNOTIFICATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnection.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,490 @@
+/*
+* ============================================================================
+* Name : btnotifconnection.h
+* Part of : bluetoothengine / btnotif
+* Description : Class for observing events of a single connection, and for
+* managing any user notifications related to the connection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFCONNECTION_H
+#define BTNOTIFCONNECTION_H
+
+#include <bt_sock.h>
+#include <btservices/btsimpleactive.h>
+#include <btengdevman.h>
+#include <btengconstants.h>
+
+#include "bluetoothnotification.h"
+
+#include "bluetoothtrace.h"
+
+class CBTNotifConnectionTracker;
+class CBTNotifPairingHelper;
+
+/**
+ * Utility function for getting the name of a device to display.
+ *
+ * @since Symbian^4
+ * @param aName On return, will hold the device name to display.
+ * @param aDevice Data dtructure holding the device record.
+ */
+void GetDeviceNameL( TBTDeviceName& aName, const CBTDevice& aDevice );
+
+
+/**
+ * CBTNotifConnection handles the connection information and operations
+ * related to remote devices.
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifConnection ) : public CBase,
+ public MBTNotificationResult,
+ public MBtSimpleActiveObserver,
+ public MBTEngDevManObserver
+ {
+
+public:
+
+ /** Enumeration for the current active operation. */
+ enum TOperation
+ {
+ EIdle,
+ EAuthorizing,
+ EPairing,
+ EBonding,
+ EAdditionalNotes, // Marks the queries and notes which follow
+ // notifier requests, but are done after completing
+ // the actual notifier message
+ EBlocking,
+ EInternalOperations, // Marks internal operations such as registry update.
+ EReadingRegistry,
+ EUpdatingRegistry
+ };
+
+ /** Array of BT profiles. */
+ typedef RArray<TBTProfile> RBTProfileArray;
+
+ /**
+ * Two-phased constructor.
+ * @param aAddr Address of the remote device for this connection.
+ * @param aTracker Pointer to our parent
+ */
+ static CBTNotifConnection* NewLC( const TBTDevAddr& aAddr,
+ CBTNotifConnectionTracker* aTracker );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifConnection();
+
+ /**
+ * Get the address of the remote device for this connection.
+ *
+ * @since Symbian^4
+ * @return The BD_ADDR.
+ */
+ inline const TBTDevAddr& Address() const
+ { return iAddr; }
+
+ /**
+ * Get the device record of the remote device for this connection.
+ *
+ * @since Symbian^4
+ * @return The CBTDevice device record.
+ */
+ inline CBTDevice* BTDevice() const
+ { return iDevice; }
+
+ /**
+ * Get the current operation for this connection.
+ *
+ * @since Symbian^4
+ * @param aProfile The profile identifying the service.
+ */
+ inline CBTNotifConnection::TOperation CurrentOperation() const
+ { return iCurrentOp; }
+
+ /**
+ * Checks if we have any outstanding request, and handle the next
+ * in line. Also checks the link state, and informs the tracker
+ * if we have finished processing and the link is down.
+ *
+ * @since Symbian^4
+ */
+ void CheckNextOperationL();
+
+ /**
+ * Completes the first outstanding client request and removes
+ * it from the queue.
+ *
+ * @since Symbian^4
+ * @param aReason The reason code to complete the message with.
+ * @param aReply Data to write back to the client.
+ */
+ void CompleteClientRequest( TInt aReason, const TDesC8& aReply );
+
+ /**
+ * Distinguish the type request of this connection and queue it
+ * or handle it.
+ *
+ * @since Symbian^4
+ * @param aParams The parameters for this request from the client.
+ * @param aMessage The message from the client.
+ */
+ void HandleNotifierRequestL( const TDesC8& aParams, const RMessage2& aMessage );
+
+ /**
+ * Update an outstanding request for this connection.
+ *
+ * @since Symbian^4
+ * @param aParams The parameters of the original request from the client.
+ * @param aMessage The update message from the client.
+ */
+ void HandleNotifierUpdateL( const TDesC8& aParams, const RMessage2& aMessage );
+
+ /**
+ * Cancel an outstanding request for this connection.
+ *
+ * @since Symbian^4
+ * @param aMessage The message from the client. (Temp! find better way!)
+ */
+ void CancelNotifierRequestL( const RMessage2& aMessage );
+
+ /**
+ * Start a bonding operation with the remote device.
+ *
+ * @since Symbian^4
+ * @param aMessage The message from the client.
+ */
+ void StartBondingL( const RMessage2& aMessage );
+
+ /**
+ * Cancel an ongoing bonding operation with the remote device.
+ *
+ * @since Symbian^4
+ */
+ void CancelBondingL();
+
+ /**
+ * The pairing handler has completed a pairing operation. If this was part
+ * of a bonding procedure then this will complete the client request.
+ *
+ * @since Symbian^4
+ */
+ void PairingCompleted();
+
+ /**
+ * Process a new pairing result, and determine if we need to show
+ * anything to the user.
+ *
+ * @since Symbian^4
+ * @param aError Result of the pairing operation.
+ */
+ void PairingResult( TInt aError );
+
+ /**
+ * A service-level connection has been made with the device
+ * observed by this instance. The appropriate notification
+ * will be shown to the user.
+ *
+ * @since Symbian^4
+ * @param aProfile The profile identifying the service.
+ */
+ void ServiceConnectedL( TBTProfile aProfile );
+
+ /**
+ * A service-level connection has disconnected from the device
+ * observed by this instance. The appropriate notification
+ * will be shown to the user.
+ *
+ * @since Symbian^4
+ * @param aProfile The profile identifying the service.
+ */
+ void ServiceDisconnectedL( TBTProfile aProfile );
+
+ /**
+ * Ask the user if he/she wants to block future connection requests.
+ *
+ * @since Symbian^4
+ */
+ void LaunchBlockingQueryL();
+
+ /**
+ * Modify the record for the remote device in BTRegistry, with the
+ * changes already made in the local record.
+ *
+ * @since Symbian^4
+ */
+ void UpdateRegistryEntryL();
+
+ /**
+ * Modify the record for the remote device in BTRegistry, if
+ * aTrusted == true, then update trusted status after reading device
+ * info from registry
+ *
+ * @since Symbian^4
+ */
+ void UpdateRegistryEntryL(TBool aTrusted);
+
+// from base class MBTNotificationResult
+
+ /**
+ * From MBTNotificationResult.
+ * Handle an intermediate result from a user query.
+ * This ffunction is called if the user query passes information
+ * back before it has finished i.e. is dismissed. The final acceptance/
+ * denial of a query is passed back in MBRNotificationClosed.
+ *
+ * @since Symbian^4
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRDataReceived( CHbSymbianVariantMap & aData );
+
+ /**
+ * From MBTNotificationResult.
+ * The notification is finished. The resulting data (e.g. user input or
+ * acceptance/denial of the query) is passed back here.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
+
+// from base class MBtSimpleActiveObserver
+
+ /**
+ * From MBtSimpleActiveObserver.
+ * Callback to notify that an outstanding request has completed.
+ *
+ * @since Symbian^4
+ * @param aActive The active object helper that completed this request.
+ * @param aStatus The status of the completed request.
+ */
+ virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * From MBtSimpleActiveObserver.
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @since Symbian^4
+ * @param aId The ID that identifies the outstanding request.
+ */
+ virtual void CancelRequest( TInt aRequestId );
+
+ /**
+ * Callback to notify that an error has occurred in RunL.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param sError The error occured in RunL
+ */
+ virtual void HandleError( CBtSimpleActive* aActive,
+ TInt aError );
+
+// from base class MBTEngDevmanObserver
+
+ /**
+ * From MBTEngDevManObserver.
+ * Indicates to the caller that adding, deleting or modifying a device
+ * has completed.
+ * When this function is called, new commands can be issued to the
+ * CBTEngDevMan API immediately.
+ *
+ * @since S60 v3.2
+ * @param aErr Status information, if there is an error.
+ */
+ virtual void HandleDevManComplete( TInt aErr );
+
+ /**
+ * From MBTEngDevManObserver.
+ * Indicates to the caller that getting a device from registry
+ * has completed.
+ *
+ * @param aErr Status information, if there is an error.
+ * @param aDeviceArray Array of devices that match the given criteria
+ * (the array provided by the caller).
+ */
+ virtual void HandleGetDevicesComplete(
+ TInt err, CBTDeviceArray* deviceArray );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CBTNotifConnection( const TBTDevAddr& aAddr,
+ CBTNotifConnectionTracker* aTracker );
+
+ /**
+ * Symbian 2nd-phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Get a notification and configure it according to the current operation.
+ *
+ * @since Symbian^4
+ * @param aType The notification type.
+ * @param aResourceId Identifier for the resource to display.
+ */
+ void PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId );
+
+ /**
+ * Handle the result from a notification that is finished.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData The returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ void NotificationClosedL( TInt aError, const TDesC8& aData );
+
+ /**
+ * Handle a request for authorization of this connection.
+ *
+ * @since Symbian^4
+ * @param aParams The parameters for this request from the client.
+ */
+ void HandleAuthorizationReqL( const TDesC8& aParams );
+
+ /**
+ * Process the user input and complete the outstanding authorization request.
+ *
+ * @since Symbian^4
+ * @param aError The result off the notification.
+ * @param aData The data returned from the notification dialog.
+ */
+ void CompleteAuthorizationReqL( TInt aError, const TDesC8& aData );
+
+ /**
+ * Process the user input for blocking a device.
+ *
+ * @since Symbian^4
+ * @param aError The result off the notification.
+ * @param aData The data returned from the notification dialog.
+ */
+ void CompleteBlockingReqL( TInt aError, const TDesC8& aData );
+
+ /**
+ * Fetch device from registry
+ *
+ * @since Symbian^4
+ * @param addr BT address of device to fetch from registry
+ */
+ void GetDeviceFromRegistry( const TBTDevAddr &addr );
+
+private: // data
+
+ /**
+ * The current operation we are carrying out.
+ */
+ TOperation iCurrentOp;
+
+ /**
+ * Address of the remote device, identifying this connection.
+ */
+ TBTDevAddr iAddr;
+
+ /**
+ * Package to receive updates of the physical link state.
+ */
+ TBTBasebandEvent iBasebandEvent;
+
+ /**
+ * Queue of handles (identifier) of client messages we have been requested to work on.
+ */
+ RArray<TInt> iMsgHandleQ;
+
+ /**
+ * Array of accepted profile connections (as known here).
+ */
+ RBTProfileArray iAcceptedConnections;
+
+ /**
+ * Array of rejected profile connections (as known here).
+ */
+ RBTProfileArray iDeniedConnections;
+
+ /**
+ * Handle to observe and control the baseband connection.
+ */
+ RBTPhysicalLinkAdapter iPhyLink;
+
+ /**
+ * Subsession with BT registry.
+ */
+ RBTRegistry iRegistry;
+
+ /**
+ * Details of the remote device.
+ * Own.
+ */
+ CBTDevice* iDevice;
+
+ /**
+ * Details of the remote device as retrieved from BT registry.
+ * Own.
+ */
+ CBTRegistryResponse* iRegistryResponse;
+
+ /**
+ * helper for modifying registry.
+ * Own.
+ */
+ CBTEngDevMan* iDevMan;
+
+ /**
+ * Active object helper for observing physical link changes.
+ * Own.
+ */
+ CBtSimpleActive* iPhyActive;
+
+ /**
+ * Active object helper for observing BT registry changes.
+ * Own.
+ */
+ CBtSimpleActive* iRegActive;
+
+ /**
+ * Helper class for processing pairing-related operations.
+ * Own.
+ */
+ CBTNotifPairingHelper* iPairingHelper;
+
+ /**
+ * Pointer to an outstanding user interaction.
+ * Not own.
+ */
+ CBluetoothNotification* iNotification;
+
+ /**
+ * Pointer to our parent.
+ * Not own.
+ */
+ CBTNotifConnectionTracker* iTracker;
+
+ CBTDeviceArray* iRegDevArray; // used for retrieving devices from registry
+
+ BTUNITTESTHOOK
+
+ };
+
+#endif // BTNOTIFCONNECTION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifconnectiontracker.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,396 @@
+/*
+* ============================================================================
+* Name : btnotifconnectiontracker.h
+* Part of : bluetoothengine / btnotif
+* Description : Bluetooth connection tracker and manager.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFCONNECTIONTRACKER_H
+#define BTNOTIFCONNECTIONTRACKER_H
+
+
+#include <e32property.h>
+#include <btmanclient.h>
+#include <bluetooth/pairing.h>
+#include <btengconnman.h>
+#include <btservices/btsimpleactive.h>
+#include "btnotifserver.h"
+
+class CBTNotifConnection;
+class CBTNotificationManager;
+class CbtnotifConnectionTrackerTest;
+
+
+
+/**
+ * CBTNotifConnectionTracker keeps track of remote device connections
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifConnectionTracker ) : public CBase,
+ public MBluetoothPhysicalLinksNotifier,
+ public MBTEngConnObserver,
+ public MBtSimpleActiveObserver
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aServer Pointer to our parent
+ */
+ static CBTNotifConnectionTracker* NewL( CBTNotifServer* aServer );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifConnectionTracker();
+
+ /**
+ * Get a pointer to the btnotif server object.
+ *
+ * @since Symbian^4
+ * @return The server.
+ */
+ inline CBTNotifServer* Server() const
+ { return iServer; }
+
+ /**
+ * Get a pointer to the notification manager.
+ * This handle can be used for queueing notifications.
+ *
+ * @since Symbian^4
+ * @return The notification manager.
+ */
+ inline CBTNotificationManager* NotificationManager() const
+ { return iServer->NotificationManager(); }
+
+ /**
+ * Get the shared handle to BT registry server.
+ * This handle can be used for creating subsessions.
+ *
+ * @since Symbian^4
+ * @return Session with BT registry server.
+ */
+ inline RBTRegServ& RegistryServerSession()
+ { return iBTRegistrySession; }
+
+ /**
+ * Get the handle to the socket server.
+ * This handle can be used for creating subsessions.
+ *
+ * @since Symbian^4
+ * @return Session with the socket server.
+ */
+ inline RSocketServ& SocketServerSession()
+ { return iSockServ; }
+
+ /**
+ * Get the handle to the Bluetooth pairing server.
+ * This handle can be used for creating subsessions.
+ *
+ * @since Symbian^4
+ * @return Session with the socket server or NULL.
+ */
+ inline RBluetoothPairingServer* PairingServerSession()
+ { return iPairingServ; }
+
+ /**
+ * Processes a message from a notifier client related to connections.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the client request.
+ */
+ void DispatchNotifierMessageL( const RMessage2& aMessage );
+
+ /**
+ * Handle a request related to pairing.
+ *
+ * @since Symbian^4
+ * @param aUid The UID of the notification request.
+ */
+ void HandleBondingRequestL( const RMessage2& aMessage );
+
+ /**
+ * Handle a change in the number of physical connections.
+ * This also handles the case where a connection monitor has finished
+ * its processing, and is now ready for removal.
+ *
+ * @since Symbian^4
+ */
+ void HandleLinkCountChangeL();
+
+ /**
+ * Check repeated connection attempts, and record rejected/accepted queries.
+ *
+ * @since Symbian^4
+ * @param aDevice The details of the remote device for this query.
+ * @param aAccepted ETrue if the user accepted the request, EFalse if rejected.
+ * @return ETrue if the user should be queried for blocking this device,
+ * EFalse if no query should be launched by the caller.
+ */
+ TBool UpdateBlockingHistoryL( const CBTDevice* aDevice, TBool aAccepted );
+
+// from base class MBluetoothPhysicalLinksNotifier
+ /** Notification of a requested connection coming up.
+ * If no error is reported, then that connection is ready for use.
+ *
+ * @since Symbian^4
+ * @param aErr the returned error
+ */
+ virtual void HandleCreateConnectionCompleteL( TInt aErr );
+
+ /** Notification of a requested disconnection having taken place.
+ * If no error is reported, then that connection has been closed.
+ *
+ * @since Symbian^4
+ * @param aErr the returned error
+ */
+ virtual void HandleDisconnectCompleteL( TInt aErr );
+
+ /** Notification that all existing connections have been torn down.
+ * If no error is reported, then there are no Bluetooth connections existing.
+ *
+ * @since Symbian^4
+ * @param aErr the returned error
+ */
+ virtual void HandleDisconnectAllCompleteL( TInt aErr );
+
+// from base class MBTEngConnObserver
+
+ /**
+ * From MBTEngConnObserver.
+ * Indicates to the caller that a service-level connection has completed.
+ * This function is called for both incoming and outgoing connections.
+ * This function is also called when an outgoing connection request fails,
+ * e.g. with error code KErrCouldNotConnect.
+ * When this function is called, new commands can be issued to the
+ * CBTEngConnMan API immediately.
+ *
+ * @since S60 v3.2
+ * @param aAddr The address of the remote device.
+ * @param aErr Status information of the connection. KErrNone if the
+ * connection succeeded, otherwise the error code with
+ * which the outgoing connection failed. KErrAlreadyExists
+ * is returned if there already is an existing connection
+ * for the selected profile(s), or otherwise e.g.
+ * KErrCouldNotConnect or KErrDisconnected for indicating
+ * connection problems.
+ * @param aConflicts If there already is a connection for the selected
+ * profile(s) of an outgoing connection request (the
+ * selection is performed by BTEng), then this array
+ * contains the bluetooth device addresses of the
+ * remote devices for those connections.
+ */
+ virtual void ConnectComplete( TBTDevAddr& aAddr, TInt aErr,
+ RBTDevAddrArray* aConflicts = NULL );
+
+ /**
+ * From MBTEngConnObserver.
+ * Indicates to the caller that a service-level connection has disconnected.
+ * When this function is called, new commands can be issued to the
+ * CBTEngConnMan API immediately.
+ *
+ * @since S60 v3.2
+ * @param aAddr The address of the remote device.
+ * @param aErr The error code with which the disconnection occured.
+ * KErrNone for a normal disconnection,
+ * or e.g. KErrDisconnected if the connection was lost.
+ */
+ virtual void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr );
+
+// from base class MBtSimpleActiveObserver
+
+ /**
+ * From MBtSimpleActiveObserver.
+ * Callback to notify that an outstanding request has completed.
+ *
+ * @since Symbian^4
+ * @param aActive The active object helper that completed this request.
+ * @param aStatus The status of the completed request.
+ */
+ virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * From MBtSimpleActiveObserver.
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @since Symbian^4
+ * @param aId The ID that identifies the outstanding request.
+ */
+ virtual void CancelRequest( TInt aRequestId );
+
+ /**
+ * Callback to notify that an error has occurred in RunL.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param sError The error occured in RunL
+ */
+ virtual void HandleError( CBtSimpleActive* aActive,
+ TInt aError );
+
+private:
+
+ CBTNotifConnectionTracker( CBTNotifServer* aServer );
+
+ void ConstructL();
+
+ /**
+ * Parse a client message and find the correct connection handler
+ * for dispatching a request.
+ * The parsed client message may be a request that is being served,
+ * in case a cancel request has come in. The opcode identifies the
+ * client message that is currently being dispatched.
+ *
+ * @since Symbian^4
+ * @param aOpcode The opcode of the original request.
+ * @param aMessage The client message to parse.
+ * @param aBuffer On return this contains the parameters read from the message.
+ * @return The connection that is identified by the address in the
+ * message, or NULL if none found.
+ */
+ CBTNotifConnection* FindConnectionFromMessageL( TInt aOpcode,
+ const RMessage2& aMessage, TDes8& aBuffer );
+
+ /**
+ * Parse the Bluetooth address from a request for some notification.
+ *
+ * @since Symbian^4
+ * @param aUid The UID of the notification request.
+ * @param aParamsBuf Descriptor containing the parameter read from the
+ * client message.
+ * @return Bluetooth address parsed from the descriptor.
+ */
+ TBTDevAddr ParseAddressL( TInt aUid, const TDesC8& aParamsBuf ) const;
+
+ /**
+ * Find the handler of a specific connection.
+ *
+ * @since Symbian^4
+ * @param aAddr The remote device address identifying the connection.
+ * @return Connnection handler or NULL;
+ */
+ CBTNotifConnection* FindConnectionHandler( const TBTDevAddr& aAddr ) const;
+
+ /**
+ * Record and check the time between connection attempts.
+ *
+ * @since Symbian^4
+ * @param aAccepted ETrue if the user accepted the request, EFalse if rejected.
+ * @return EFalse if the attempt followed the previous attempt too fast,
+ * otherwise ETrue.
+ */
+ TBool RecordConnectionAttempts( TBool aAccepted );
+
+private: // data
+
+ /**
+ * PubSub key for tracking the number of connections.
+ */
+ RProperty iLinkCount;
+
+// ToDo: remove this when registry notifications API is available!!
+ /**
+ * PubSub key for tracking registry changes.
+ */
+ RProperty iRegistryChange;
+
+ /**
+ * Helper active object for observing the link count.
+ * Own.
+ */
+ CBtSimpleActive* iRegistryActive;
+// End ToDo
+
+ /**
+ * Array of pointers to observers of individual connections.
+ */
+ RPointerArray<CBTNotifConnection> iConnArray;
+// RHashMap<TBTDevAddr,CBTNotifConnection*> iConnArray;
+
+ /**
+ * Time of the last denied connection attempt.
+ */
+ TInt64 iLastReject;
+
+ /**
+ * Array of device addresses that the user has denied access.
+ */
+ RArray<TBTDevAddr> iDeniedRequests;
+
+ /**
+ * Single session with BTRegistry, to be used for subsessions.
+ */
+ RBTRegServ iBTRegistrySession;
+
+ /**
+ * Single session with the socket server, to be used for subsessions.
+ */
+ RSocketServ iSockServ;
+
+ /**
+ * Address placeholder for receiving secure simple pairing results.
+ */
+ TBTDevAddr iSspResultAddr;
+
+ /**
+ * Session with pairing server for receiving secure simple pairing results.
+ */
+ RBluetoothPairingResult iSspResultSession;
+
+ /**
+ * Single session with the pairing server, to be used for subsessions.
+ * Own.
+ */
+ RBluetoothPairingServer* iPairingServ;
+
+ /**
+ * Object for managing the piconet.
+ * Own.
+ */
+ CBTEngConnMan* iConnMan;
+
+ /**
+ * Object for managing the piconet.
+ * Own.
+ */
+ CBluetoothPhysicalLinks* iPhyLinks;
+
+ /**
+ * Helper active object for observing the link count.
+ * Own.
+ */
+ CBtSimpleActive* iLinkCountActive;
+
+ /**
+ * Helper active object for receiving secure simple pairing results.
+ * Own.
+ */
+ CBtSimpleActive* iSspResultActive;
+
+ /**
+ * Reference to our parent the server class.
+ * Not own.
+ */
+ CBTNotifServer* iServer;
+
+ BTUNITTESTHOOK
+
+ };
+
+#endif // BTNOTIFCONNECTIONTRACKER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* ============================================================================
+* Name : btnotifdeviceselector.h
+* Part of : BTProximity / BTProximity
+* Description : Class for tracking Bluetooth settings, and also for
+* handling notes unrelated to specific connection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFDEVICESELECTOR_H
+#define BTNOTIFDEVICESELECTOR_H
+
+
+#include <e32base.h>
+#include <btengsettings.h>
+#include <btservices/devdiscoveryobserver.h>
+#include "bluetoothnotification.h"
+
+class CBTNotifServer;
+class CAdvanceDevDiscoverer;
+class CBtDevExtension;
+
+/**
+ * ?one_line_short_description
+ * ?more_complete_description
+ *
+ * @code
+ * ?good_class_usage_example(s)
+ * @endcode
+ *
+ * @lib ?library
+ * @since S60 ?S60_version *** for example, S60 v3.0
+ */
+NONSHARABLE_CLASS( CBTNotifDeviceSelector ) :
+ public CBase,
+ public MBTNotificationResult,
+ public MDevDiscoveryObserver
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aServer Pointer to our parent
+ */
+ static CBTNotifDeviceSelector* NewL( CBTNotifServer& aServer );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifDeviceSelector();
+
+ /**
+ * Processes a message from a notifier client related to settings.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the client request.
+ */
+ void DispatchNotifierMessageL( const RMessage2& aMessage );
+
+ /**
+ * Cancels an oustanding message from a notifier client related to settings.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the original client request.
+ */
+ void CancelNotifierMessageL( const RMessage2& aMessage );
+
+private:
+// from base class MBTNotificationResult
+
+ /**
+ * From MBTNotificationResult.
+ * Handle an intermediate result from a user query.
+ * This ffunction is called if the user query passes information
+ * back before it has finished i.e. is dismissed. The final acceptance/
+ * denial of a query is passed back in MBRNotificationClosed.
+ *
+ * @since Symbian^4
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
+
+ /**
+ * From MBTNotificationResult.
+ * The notification is finished. The resulting data (e.g. user input or
+ * acceptance/denial of the query) is passed back here.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
+
+ // From MDevDiscoveryObserver
+
+ /**
+ * Callback to notify that a device has been found.
+ *
+ * @param aAddr the inquiry address that contains the inquiry information
+ * of the found device.
+ * @param aName the Bluetooth device name of the found device
+ */
+ virtual void HandleNextDiscoveryResultL(
+ const TInquirySockAddr& aAddr, const TDesC& aName );
+
+ /**
+ * Callback to notify that the device search has completed.
+ *
+ * @param aErr the error code of device search result.
+ */
+ virtual void HandleDiscoveryCompleted( TInt aErr );
+
+private:
+
+ CBTNotifDeviceSelector( CBTNotifServer& aServer );
+
+ void ConstructL();
+
+ void PrepareNotificationL(
+ TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId );
+
+private: // data
+
+ /**
+ * Reference to our parent the server class.
+ * Not own.
+ */
+ CBTNotifServer& iServer;
+
+ /**
+ * Pointer to an outstanding user interaction.
+ * Not own.
+ */
+ CBluetoothNotification* iNotification;
+
+ /**
+ * device inquiry handler:
+ */
+ CAdvanceDevDiscoverer* iDiscoverer;
+
+ /**
+ * do not own the elements in the array.
+ */
+ RPointerArray<CBtDevExtension> iDevices;
+
+ /**
+ * The message for a pending device selection request from a RNotifier client.
+ */
+ RMessage2 iMessage;
+
+ };
+
+#endif // BTNOTIFDEVICESELECTOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotificationmanager.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* ============================================================================
+* Name : btnotificationmanager.h
+* Part of : bluetoothengine / btnotif
+* Description : Class for managing user notification and query objects, and for serializing access to the notification server.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFICATIONMANAGER_H
+#define BTNOTIFICATIONMANAGER_H
+
+
+#include <e32base.h>
+
+class CBTNotifServer;
+class CBluetoothNotification;
+
+/**
+ * CBTNotificationManager manages Bt Notifications
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotificationManager ) : public CBase
+ {
+
+public:
+
+ /** Enumeration for the priority of the notification. */
+ enum TNotificationPriority
+ {
+ EPriorityLow,
+ EPriorityStandard,
+ EPriorityHigh
+ };
+
+ /**
+ * Two-phased constructor.
+ * @param aServer Pointer to our parent
+ */
+ static CBTNotificationManager* NewL( const CBTNotifServer* aServer );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotificationManager();
+
+ CBluetoothNotification* GetNotification();
+
+ void ReleaseNotification( CBluetoothNotification* aNotification );
+
+ /**
+ * Add a notification to the queue of notifications scheduled to be
+ * shown. Notifications are serialized, to avoid overlapping notes.
+ * The queue is managed on priority of each notification.
+ *
+ * @since Symbian^4
+ * @param aNotification The notification to be added.
+ * @param aPriority The priority of the notification. EPriorityHigh means
+ * that the note is put to the front of the queue.
+ * EPriorityStandard means that it is appended to the end,
+ * and should be used for most notes. EPriorityLow is not
+ * used yet.
+ * @return Error code.
+ */
+ TInt QueueNotification( CBluetoothNotification* aNotification,
+ TNotificationPriority aPriority = EPriorityStandard );
+
+private:
+
+ CBTNotificationManager( const CBTNotifServer* aServer );
+
+ void ConstructL();
+
+ /**
+ * Process the notification queue and launch the next notification.
+ *
+ * @since Symbian^4
+ */
+ void ProcessNotificationQueueL();
+
+ /**
+ * Process the notification queue and launch the next notification.
+ *
+ * @since Symbian^4
+ */
+ void CleanupUnusedQueueL();
+
+ /**
+ * Create and queue an idle timer if there are no outstanding notifications,
+ * otherwise cancel the idle timer.
+ *
+ * @since Symbian^4
+ */
+ void CheckIdle();
+
+ /**
+ * Callback function for asynchronous processing of
+ * queued notification requests.
+ *
+ * @since Symbian^4
+ * @param aPtr Pointer to notification manager instance.
+ */
+ static TInt AsyncCallback( TAny* aPtr );
+
+private: // data
+
+ /**
+ * The queue of notifications to be shown to the user.
+ */
+ RPointerArray<CBluetoothNotification> iNotificationQ;
+
+ /**
+ * The queue of spare notifications.
+ */
+ RPointerArray<CBluetoothNotification> iUnusedQ;
+
+ /**
+ * Callback for asynchronous processing.
+ * Own.
+ */
+ CAsyncCallBack* iAsyncCb;
+
+ /**
+ * Pointer to our parent.
+ * Not own.
+ */
+ const CBTNotifServer* iServer;
+
+ };
+
+#endif // BTNOTIFICATIONMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotificationresult.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* ============================================================================
+* Name : btnotificationresult.h
+* Part of : bluetoothengine / btnotif
+* Description : Abstract interface for receiving the result of a user query.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFICATIONRESULT_H
+#define BTNOTIFICATIONRESULT_H
+
+class CHbSymbianVariantMap;
+
+/**
+ * MBTNotificationResult returns the result from a user query.
+ *
+ *
+ * @since Symbian^4
+ */
+class MBTNotificationResult
+ {
+
+public:
+
+ /**
+ * Handle an intermediate result from a user query.
+ * This function is called if the user query passes information
+ * back before it has finished i.e. is dismissed. The final acceptance/
+ * denial of a query is passed back in MBRNotificationClosed.
+ *
+ * @since Symbian^4
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRDataReceived( CHbSymbianVariantMap& aData ) = 0;
+
+
+ /**
+ * The notification is finished. The resulting data (e.g. user input or
+ * acceptance/denial of the query) is passed back here.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData ) = 0;
+
+ };
+
+
+#endif // BTNOTIFICATIONRESULT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifpairinghelper.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,471 @@
+/*
+* ============================================================================
+* Name : btnotifpairinghelper.h
+* Part of : bluetoothengine / btnotif
+* Description : Helper class for processing pairing requests and results, as extended functionality for CBTNotifConnection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFPAIRINGHELPER_H
+#define BTNOTIFPAIRINGHELPER_H
+
+#include <e32base.h>
+#include <btmanclient.h>
+#include <bluetooth/pairing.h>
+#include <btservices/btsimpleactive.h>
+
+#include "bluetoothnotification.h"
+#include "bluetoothtrace.h"
+
+class CBTNotifConnection;
+class CBTNotifConnectionTracker;
+class CBTDevice;
+
+
+/**
+ * Helper class for performing pairing-related operations.
+ *
+ * This class is constructed only when there is a pairing-related event,
+ * and destructed after completion. Pairing-related events are bonding
+ * (outgoing bonding request from an application), pairing notifiers
+ * (PIN input i.e. legacy pairing, numeric comparison and passkey display),
+ * and Just Works pairing completion.
+ *
+ * The structure of operations is as follows: each event is initiated through
+ * StartXxL() operation, and finished with CompleteXxL(), there is also a
+ * CancelXxL() operation where needed. In addition there are the base class virtual
+ * functions, a few helper functions and HandleAuthenticationCompleteL, which
+ * processes a baseband authentication result. The same structure applies to
+ * suboperations, such as StartTrustedQueryL and CompleteTrustedQueryL.
+ *
+ * For bonding, there is StartBondingL, CompleteBondingL() CancelBondingL();
+ * for pairing notifiers there is StartPairingNotifierL(),
+ * CancelPairingNotifierL(), CompletePairingNotifierL() and also
+ * UpdatePairingNotifierL(). For Just Works processing, there is
+ * StartJustWorksProcessingL(), CancelJustWorksProcessingL() and
+ * CompleteJustWorksProcessingL().
+ *
+ * The design of this class is focussed on structure and maintainability first.
+ * Duplicate (state) information is kept to a minimum. And memory usage comes
+ * before processing. Pairing is an infrequent operation, and this class is
+ * only instantiated when there is pairing-related processing, so extreme
+ * focus on memory or processing efficiency would have relatively little effect.
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifPairingHelper ) : public CBase,
+ public MBTNotificationResult,
+ public MBtSimpleActiveObserver
+ {
+
+public:
+
+ /** Enumeration identifying the stage of the pairing operation. */
+ enum TPairingOp
+ {
+ EIdle,
+ EAcceptPairing,
+ ELegacyPairing,
+ ESspPairing,
+ EJustWorksPairing,
+ EAutoPairing,
+ EPostPairingOperations, // Marks the queries and notes which follow
+ // the real pairing input from the user.
+ EDedicatedBonding,
+ EUnpairing,
+ EAwaitingPairingResult,
+ EShowPairingSuccess,
+ EShowPairingFailure,
+ EQueryTrust,
+ EBlocking,
+ EPairingCancelled
+ };
+
+ /**
+ * Two-phased constructor.
+ * @param aConnection Pointer to the parent.
+ * @param aDevice Pointer to information of the remote device.
+ * aParam aTracker Pointer to the connection tracker.
+ */
+ static CBTNotifPairingHelper* NewL( CBTNotifConnection* aConnection,
+ CBTNotifConnectionTracker* aTracker );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifPairingHelper();
+
+ /**
+ * Get the address of the remote device for this connection.
+ *
+ * @since Symbian^4
+ * @param aProfile The profile identifying the service.
+ */
+ inline CBTNotifPairingHelper::TPairingOp CurrentOperation() const
+ { return iOperation; }
+
+ /**
+ * The baseband authentication has completed, handle the result.
+ *
+ * @since Symbian^4
+ * @param aError The result of the authentication procedure.
+ */
+ void HandleAuthenticationCompleteL( TInt aError );
+
+ /**
+ * Start a bonding operation with the remote device.
+ *
+ * @since Symbian^4
+ * @param aMessage The handle of the message from the client.
+ */
+ void StartBondingL( TInt aHandle );
+
+ /**
+ * Cancel an ongoing bonding operation with the remote device.
+ *
+ * @since Symbian^4
+ */
+ void CancelBondingL();
+
+ /**
+ * Handle a notifier request for pairing with the remote device
+ * of this connection.
+ *
+ * @since Symbian^4
+ * @param aUid The UID of the notifier for this pairing request.
+ * @param aParams The parameters for this request from the client.
+ */
+ void StartPairingNotifierL( TInt aUid, const TDesC8& aParams );
+
+ /**
+ * Update an outstanding request for this connection.
+ *
+ * @since Symbian^4
+ * @param aUid The UID of the notifier for this update.
+ * @param aParams The updated parameters for this request from the client.
+ */
+ void UpdatePairingNotifierL( TInt aUid, const TDesC8& aParams );
+
+ /**
+ * Cancel an outstanding request for this connection.
+ *
+ * @since Symbian^4
+ * @param aUid The UID of the notifier for this pairing request.
+ */
+ void CancelPairingNotifierL( TInt aUid );
+
+ /**
+ * Start the processing of a completed Just Works pairing.
+ * This needs special attention, as this class is not notified
+ * other than by observing the registry, and the user is not
+ * notified otherwise either (which is the point of this association
+ * model). It needs to be verified that the pairing is related to
+ * a service access, as dedicated bonding should not be possible
+ * (for devices that do not have any IO capabilities).
+ *
+ * @since Symbian^4
+ * @param aMessage The handle of the message from the client.
+ */
+ void StartJustWorksProcessingL();
+
+ /**
+ * Cancel the processing of a completed Just Works pairing.
+ *
+ * @since Symbian^4
+ */
+ void CancelJustWorksProcessingL();
+
+// from base class MBTNotificationResult
+
+ /**
+ * From MBTNotificationResult.
+ * Handle an intermediate result from a user query.
+ * This function is called if the user query passes information
+ * back before it has finished i.e. is dismissed. The final acceptance/
+ * denial of a query is passed back in MBRNotificationClosed.
+ *
+ * @since Symbian^4
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
+
+ /**
+ * From MBTNotificationResult.
+ * The notification is finished. The resulting data (e.g. user input or
+ * acceptance/denial of the query) is passed back here.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
+
+// from base class MBtSimpleActiveObserver
+
+ /**
+ * From MBtSimpleActiveObserver.
+ * Callback to notify that an outstanding request has completed.
+ *
+ * @since Symbian^4
+ * @param aActive The active object helper that completed this request.
+ * @param aStatus The status of the completed request.
+ */
+ virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * From MBtSimpleActiveObserver.
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @since Symbian^4
+ * @param aId The ID that identifies the outstanding request.
+ */
+ virtual void CancelRequest( TInt aRequestId );
+
+ /**
+ * Callback to notify that an error has occurred in RunL.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param aError The error occurred in RunL.
+ */
+ virtual void HandleError( CBtSimpleActive* aActive, TInt aError );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CBTNotifPairingHelper( CBTNotifConnection* aConnection,
+ CBTNotifConnectionTracker* aTracker );
+
+ /**
+ * Symbian 2nd-phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Process the user input and complete the outstanding pairing request.
+ *
+ * @since Symbian^4
+ * @param aError The result off the notification.
+ * @param aResult The user response; ETrue if the user accepted the query,
+ * otherwise EFalse.
+ * @param aData The data returned from the notification dialog.
+ */
+ void CompletePairingNotifierL( TInt aError, TBool aResult, const TDesC8& aData );
+
+ /**
+ * Completes a bonding operation.
+ *
+ * @since Symbian^4
+ * @param aError The result of the bonding attempt.
+ */
+ void CompleteBondingL( TInt aError );
+
+ /**
+ * Completes a bonding operation.
+ *
+ * @since Symbian^4
+ * @param aError The result of the bonding attempt.
+ */
+ void CompleteJustWorksProcessingL( TInt aError );
+
+ /**
+ * Ask the user to allow incoming pairing.
+ *
+ * @since Symbian^4
+ */
+ void StartAcceptPairingQueryL();
+
+ /**
+ * Process the user input and for accepting an incoming pairing and
+ * continue with the outstanding pairing request.
+ *
+ * @since Symbian^4
+ * @param aError The result of the notification.
+ * @param aResult The user response; ETrue if the user accepted the query,
+ * otherwise EFalse.
+ */
+ void CompleteAcceptPairingQueryL( TInt aError, TBool aResult );
+
+ /**
+ * Ask the user to set the device as trusted.
+ *
+ * @since Symbian^4
+ * @param aData The data returned from the notification dialog.
+ */
+ void StartTrustedQueryL();
+
+ /**
+ * Process the user input for setting the device as trusted.
+ *
+ * @since Symbian^4
+ * @param aError The result of the notification.
+ * @param aResult The user response; ETrue if the user accepted the query,
+ * otherwise EFalse.
+ */
+ void CompleteTrustedQueryL( TInt aError, TBool aResult );
+
+ /**
+ * Parse the parameters of a request for pairing.
+ * This function also returns values to use for dialog config, and sets
+ * the operation state member variable (iOperation).
+ *
+ * @since Symbian^4
+ * @param aLocallyInitiated On return, will be set to ETrue if the pairing
+ * was initiated by us.
+ * @param aNumVal On return, this descriptor will contain a number to use in
+ * the pairing dialog. The meaning depends on the type of pairing.
+ * @param aDialogType On return, will contain the dialog type.
+ * @param aResourceId On return, will contain the resource id.
+ */
+ void ParseNotifierReqParamsL( TBool& aLocallyInitiated, TDes& aNumVal,
+ TBluetoothDialogParams::TBTDialogType& aDialogType,
+ TBTDialogResourceId& aResourceId );
+
+ /**
+ * Parse the parameters of a request for pairing using pin query.
+ *
+ * @since Symbian^4
+ * @param aLocallyInitiated On return, will be set to ETrue if the pairing
+ * was initiated by us.
+ * @param aNumVal On return, this will contain the minimum passcode length.
+ */
+ void ParsePinCodeReqParamsL( TBool& aLocallyInitiated, TUint& aNumVal );
+
+ /**
+ * Parse the parameters of a request for pairing using numeric comparison.
+ *
+ * @since Symbian^4
+ * @param aLocallyInitiated On return, will be set to ETrue if the pairing
+ * was initiated by us.
+ * @param aNumVal On return, this descriptor will contain the passkey to
+ * show to the user.
+ */
+ void ParseNumericCompReqParamsL( TBool& aLocallyInitiated, TDes& aNumVal );
+
+ /**
+ * Parse the parameters of a request for pairing using passkey display.
+ *
+ * @since Symbian^4
+ * @param aLocallyInitiated On return, will be set to ETrue if the pairing
+ * was initiated by us.
+ * @param aNumVal On return, this descriptor will contain the passkey to
+ * show to the user.
+ */
+ void ParsePasskeyDisplayReqParamsL( TBool& aLocallyInitiated, TDes& aNumVal );
+
+ /**
+ * Check if we can guess the PIN and complete the notifier without
+ * user interaction.
+ *
+ * @since Symbian^4
+ * @param aLocallyInitiated ETrue if we initiated the pairing, otherwise EFalse.
+ * @param aNumVal The minimum lenght of the passcode.
+ */
+ void CheckAutoPairingL( TBool aLocallyInitiated, const TDesC& aNumVal );
+
+ /**
+ * Get a notification and configure it according to the current operation.
+ *
+ * @since Symbian^4
+ * @param aType The notification type.
+ * @param aResourceId Identifier for the resource to display.
+ */
+ void PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId );
+
+ /**
+ * Handle the result from a notification that is finished.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData The returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ void NotificationClosedL( TInt aError, const TDesC8& aData );
+
+private: // data
+
+ /**
+ * Identifier for the current operation.
+ */
+ TPairingOp iOperation;
+
+ /**
+ * UID of the notifier pairing dialog request.
+ */
+ TInt iNotifierUid;
+
+ /**
+ * Handle to the client message for dedicated bonding. Also serves as flag
+ * indicating that we are performing dedicated bonding.
+ */
+ TInt iDedicatedBonding;
+
+ /**
+ * Subsession with pairing server for dedicated bonding.
+ */
+ RBluetoothDedicatedBondingInitiator iBondingSession;
+
+ /**
+ * Handle for general bonding.
+ */
+ RBTPhysicalLinkAdapter iBondingSocket;
+
+ /**
+ * Buffer containing the parameters of the client message.
+ * Own.
+ */
+ HBufC8* iParams;
+
+ /**
+ * Active object helper for outgoing bonding.
+ * Own.
+ */
+ CBtSimpleActive* iBondingActive;
+
+ /**
+ * Pointer to the data record of the remote device.
+ * Not own.
+ */
+ CBTDevice* iDevice;
+
+ /**
+ * Pointer to an outstanding user interaction.
+ * Not own.
+ */
+ CBluetoothNotification* iNotification;
+
+ /**
+ * Pointer to the class that we are helping.
+ * Not own.
+ */
+ CBTNotifConnection* iConnection;
+
+ /**
+ * Pointer to our grandparent.
+ * Not own.
+ */
+ CBTNotifConnectionTracker* iTracker;
+
+ BTUNITTESTHOOK
+
+ };
+
+#endif // BTNOTIFPAIRINGHELPER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifserver.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,289 @@
+/*
+* ============================================================================
+* Name : btnotifserver.h
+* Part of : bluetoothengine / btnotif
+* Description : Server class for handling commands from clients, and the
+* central class in btnotif thread.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFSERVER_H
+#define BTNOTIFSERVER_H
+
+
+#include <e32base.h>
+#include <btengsettings.h>
+
+#include "bluetoothtrace.h"
+
+class CBTNotifConnectionTracker;
+class CBTNotifSettingsTracker;
+class CBTNotificationManager;
+class CBTNotifDeviceSelector;
+class CBtDevRepository;
+
+class CbtnotifServerTest; // ToDo: shall be refactored under compile flag?
+
+/**
+ * Utility function for panicking the server.
+ *
+ * @since Symbian^4
+ * @param aReason The panic reason code.
+ */
+void PanicServer( TInt aReason );
+
+/**
+ * Utility function for panicking the server.
+ *
+ * @since Symbian^4
+ * @param aMessage The handle to the client side.
+ * @param aReason The panic reason code.
+ */
+void PanicClient( const RMessage2& aMessage, TInt aReason );
+
+/** BTNotif panic codes */
+enum TBTNotifServerPanic
+ {
+ EBTNotifPanicUnknown,
+ EBTNotifPanicCorrupt,
+ EBTNotifPanicMissing,
+ EBTNotifPanicNullMember,
+ EBTNotifPanicBadState,
+ EBTNotifPanicBadArgument,
+ EBTNotifPanicBadResult
+ };
+
+/** Convenience macro for indicating unimplemented events */
+#define NOTIF_NOTIMPL
+//{ __ASSERT_ALWAYS( 1, PanicServer( EBTNotifPanicNotImplemented ) ); }
+/** Convenience macro for indicating unhandled events */
+#define NOTIF_NOTHANDLED( cond )
+//{ __ASSERT_ALWAYS( cond, PanicServer( EBTNotifPanicNotHandled ) ); }
+
+
+/**
+ * CBTNotifServer handles notifications and also maintains state information related to
+ * the local device as well as remote devices.
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifServer ) : public CPolicyServer
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CBTNotifServer* NewLC();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifServer();
+
+ /**
+ * Called when the BT power state changes.
+ *
+ * @since Symbian^4
+ * @param aState The new BT power state.
+ */
+ void HandlePowerStateChangeL( TBTPowerStateValue aState );
+
+ /**
+ * Called by a session during creation, to keep track of the number
+ * of active sessions.
+ *
+ * @since Symbian^4
+ */
+ void AddSession();
+
+ /**
+ * Called by a session during destruction, to keep track of the number
+ * of active sessions.
+ *
+ * @since Symbian^4
+ */
+ void RemoveSession();
+
+ /**
+ * Returns a handle to the settings tracker.
+ *
+ * @since Symbian^4
+ * @param Pointer to the settings tracker.
+ */
+ inline CBTNotifSettingsTracker* SettingsTracker() const
+ { return iSettingsTracker; }
+
+ /**
+ * Returns a handle to the connection tracker.
+ *
+ * @since Symbian^4
+ * @param Pointer to the connection tracker.
+ */
+ inline CBTNotifConnectionTracker* ConnectionTracker() const
+ { return iConnectionTracker; }
+
+ /**
+ * Returns a handle to the notification manager.
+ *
+ * @since Symbian^4
+ * @param Pointer to the notification manager.
+ */
+ inline CBTNotificationManager* NotificationManager() const
+ { return iNotificationMgr; }
+
+ CBtDevRepository& DevRepository();
+
+ CBTNotifDeviceSelector& DeviceSelectorL();
+
+ /**
+ * Searches for a specific client message from a message handle
+ * on all active sessions, and complete the message with the
+ * specified reason code.
+ *
+ * @since Symbian^4
+ * @param aHandle The handle identifying the message.
+ * @param aReply Data to write back to the client.
+ * @return KErrNone on success; KErrNotFound if the message is not found.
+ */
+ TInt CompleteMessage( TInt aHandle, TInt aReason, const TDesC8& aReply );
+
+ /**
+ * Searches for and returns a specific client message from a message
+ * handle on all active sessions.
+ *
+ * @since Symbian^4
+ * @param aHandle The handle identifying the message.
+ * @return Pointer to the message, NULL if not found.
+ */
+ const RMessage2* FindMessageFromHandle( TInt aHandle );
+
+ /**
+ * Searches for and returns a specific client message from a message
+ * UID on all active sessions.
+ * The use of this method assumes that there can be only one message
+ * outstanding for a specific UID. This is enforced by RNotifier backend.
+ *
+ * @since Symbian^4
+ * @param aUid The UID identifying the message.
+ * @return Pointer to the message, NULL if not found.
+ */
+ const RMessage2* FindMessageFromUid( TInt aUid );
+
+// from base class CPolicyServer
+
+ /**
+ * From CPolicyServer.
+ * Creates and returns a server-side session object.
+ *
+ * @since Symbian^4
+ * @param aVersion The version information supplied by the client.
+ * @param aMessage Represents the details of the client request that
+ * is requesting the creation of the session.
+ * @return A pointer to the newly created server-side session object.
+ */
+ virtual CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
+
+private:
+
+ CBTNotifServer();
+
+ void ConstructL();
+
+ /**
+ * Asynchronous second-phase constructor. This function is called asynchronously
+ * from ConstructL, to facilitate short initial construction, and allow construction
+ * of e.g. session to BTEngine. So in fact this is a third-phase constructor.
+ *
+ * @since Symbian^4
+ */
+ void AsyncConstructL();
+
+ void CheckIdle( TBTPowerStateValue aState );
+
+ /**
+ * Callback function for asynchronous construction.
+ *
+ * @since Symbian^4
+ * @param aPtr Pointer to server instance.
+ */
+ static TInt AsyncConstructCb( TAny* aPtr );
+
+ static TInt ShutdownTimeout( TAny* aPtr );
+
+private: // data
+
+ /**
+ * Counter for the number of active sessions.
+ */
+ TInt iSessionCount;
+
+ /**
+ * Helper class for tracking settings.
+ * Own.
+ */
+ CBTNotifSettingsTracker* iSettingsTracker;
+
+ /**
+ * Helper class for tracking connections.
+ * Own.
+ */
+ CBTNotifConnectionTracker* iConnectionTracker;
+
+ /**
+ * Helper class for managing the actual notifications.
+ * Own.
+ */
+ CBTNotificationManager* iNotificationMgr;
+
+ /**
+ * Remote device repository.
+ * Singleton in btnotifsrv. This is useful
+ * for getting the correct name for displaying in UI
+ * without the need getting the device everytime
+ * when a name is needed.
+ * Pairing handling also needs this repository to drive
+ * the logic flow.
+ */
+ CBtDevRepository* iDevRep;
+
+ /**
+ * Helper class for device searching and selection.
+ * Own.
+ */
+ CBTNotifDeviceSelector* iDevSelector;
+
+ /**
+ * Callback for asynchronous processing.
+ * Own.
+ */
+ CAsyncCallBack* iAsyncCb;
+
+ /**
+ * Timer for various timeouts.
+ * Own.
+ */
+ CDeltaTimer* iTimer;
+
+ TDeltaTimerEntry iShutdownTimerEntry;
+
+ BTUNITTESTHOOK
+
+ };
+
+#endif // BTNOTIFSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifserversecpolicy.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* ============================================================================
+* Name : btnotifserversecpolicy.h
+* Part of : bluetoothengine / btnotif *** Info from the SWAD
+* Description : Security policy for btnotif client-server interface.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFSRVSECPOLICY_H
+#define BTNOTIFSRVSECPOLICY_H
+
+/** Number of ranges in btnotif security policy */
+const TInt KBTNotifRangeCount = 4;
+
+/** Ranges of btnotif command opcodes */
+const TInt KBTNotifRanges[ KBTNotifRangeCount ] =
+ {
+ 0, // Range 0: 0 - EBTNotifMinValue (Out of range)
+ 10, // Range 1: All commands requiring no access control
+ 30, // Range 2: All commands requiring local services
+ // More ranges may be added here
+ 50 // Range 3: Out of range
+ };
+
+/** Mapping of ranges to policies */
+const TUint8 KBTNotifElementsIndex[ KBTNotifRangeCount ] =
+ {
+ CPolicyServer::ENotSupported, // applies to 0th range (out of range)
+ CPolicyServer::EAlwaysPass, // no policy for the 1st range
+ 0, // policy 0 applies to 2nd range
+ CPolicyServer::ENotSupported // applies to xth range(out of range)
+ };
+
+/** BTEng security policies, applied on a range of commands */
+const CPolicyServer::TPolicyElement KBTNotifPolicyElements[] =
+ {
+ { _INIT_SECURITY_POLICY_C1( ECapabilityLocalServices ),
+ CPolicyServer::EFailClient
+ } //policy 0, for now on all operations
+ // More policies may be added here
+ };
+
+/** BTNotif security policy package (combining all the above) */
+const CPolicyServer::TPolicy KBTNotifServerPolicy =
+ {
+ CPolicyServer::EAlwaysPass, // Connection attempts may pass
+ KBTNotifRangeCount, // Number of ranges
+ KBTNotifRanges, // Array of ranges
+ KBTNotifElementsIndex, // Mapping of ranges to policies
+ KBTNotifPolicyElements // Array of policies
+ };
+
+#endif // BTNOTIFSRVSECPOLICY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifsession.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* ============================================================================
+* Name : btnotifsession.h
+* Part of : bluetoothengine / btnotif
+* Description : Session class for handling commands from clients.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFSESSION_H
+#define BTNOTIFSESSION_H
+
+#include "btnotifserver.h"
+
+/**
+ * CBTNotifSession maintains a session with a client.
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifSession ) : public CSession2
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CBTNotifSession* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifSession();
+
+// from base class CSession2
+
+ /**
+ * From CSession2.
+ * Receives a message from a client.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the client request.
+ */
+ virtual void ServiceL( const RMessage2& aMessage );
+
+ /**
+ * From CSession2.
+ * Completes construction of the session.
+ *
+ * @since Symbian^4
+ */
+ virtual void CreateL();
+
+ /**
+ * Complete a client message from a message handle.
+ *
+ * @since Symbian^4
+ * @param aHandle The handle identifying the message.
+ * @param aReason The reason code to complete the message with.
+ * @param aReply Data to write back to the client.
+ * @return KErrNone on success; KErrNotFound if the message is not found.
+ */
+ TInt CompleteMessage( TInt aHandle, TInt aReason, const TDesC8& aReply );
+
+ /**
+ * Find a message identified by an RMessage2 handle.
+ *
+ * @since Symbian^4
+ * @param aHandle The handle identifying the message.
+ * @return The message.
+ */
+ const RMessage2* FindMessageFromHandle( TInt aHandle ) const;
+
+ /**
+ * Find a message identified by an RNotifier notifier UID.
+ *
+ * @since Symbian^4
+ * @param aUid The UID identifying the message.
+ * @return The message.
+ */
+ const RMessage2* FindMessageFromUid( TInt aUid ) const;
+
+private:
+
+ CBTNotifSession();
+
+ void ConstructL();
+
+ /**
+ * Returns a handle to our server.
+ *
+ * @since Symbian^4
+ * @param Pointer to our server.
+ */
+ inline CBTNotifServer* Server() const
+ { return (CBTNotifServer*) CSession2::Server(); }
+
+ /**
+ * Processes a message from a client.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the client request.
+ */
+ void DispatchMessageL( const RMessage2& aMessage );
+
+private: // data
+
+ /**
+ * Array of messages currently being processed.
+ */
+ RArray<RMessage2> iMessageQ;
+
+ BTUNITTESTHOOK
+
+ };
+
+#endif // BTNOTIFSESSION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/btnotifsettingstracker.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* ============================================================================
+* Name : btnotifsettingstracker.h
+* Part of : BTProximity / BTProximity
+* Description : Class for tracking Bluetooth settings, and also for
+* handling notes unrelated to specific connection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFSETTINGSTRACKER_H
+#define BTNOTIFSETTINGSTRACKER_H
+
+
+#include <e32base.h>
+#include <btengsettings.h>
+
+#include "bluetoothnotification.h"
+
+class CBTNotifServer;
+
+/**
+ * CBTNotifSettingsTracker keeps track of local device settings
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifSettingsTracker ) : public CBase,
+ public MBTEngSettingsObserver,
+ public MBTNotificationResult
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aServer Pointer to our parent
+ */
+ static CBTNotifSettingsTracker* NewL( CBTNotifServer* aServer );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifSettingsTracker();
+
+ /**
+ * Return the current power state
+ *
+ * @since Symbian^4
+ * @return The current power state.
+ */
+ inline TBTPowerStateValue GetPowerState() const
+ { return iPowerState; }
+
+ /**
+ * Processes a message from a notifier client related to settings.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the client request.
+ */
+ void DispatchNotifierMessageL( const RMessage2& aMessage );
+
+ /**
+ * Cancels an oustanding message from a notifier client related to settings.
+ *
+ * @since Symbian^4
+ * @param aMessage The message containing the details of the original client request.
+ */
+ void CancelNotifierMessageL( const RMessage2& aMessage );
+
+// from base class MBTEngSettingsObserver
+
+ /**
+ * From MBTEngSettingsObserver.
+ * Provides notification of changes in the power state
+ * of the Bluetooth hardware.
+ *
+ * @since Symbian^4
+ * @param aState EBTPowerOff if the BT hardware has been turned off,
+ * EBTPowerOn if it has been turned off.
+ */
+ virtual void PowerStateChanged( TBTPowerStateValue aState );
+
+ /**
+ * From MBTEngSettingsObserver.
+ * Provides notification of changes in the discoverability
+ * mode of the Bluetooth hardware.
+ *
+ * @since Symbian^4
+ * @param aState EBTDiscModeHidden if the BT hardware is in hidden mode,
+ * EBTDiscModeGeneral if it is in visible mode.
+ */
+ virtual void VisibilityModeChanged( TBTVisibilityMode aState );
+
+// from base class MBTNotificationResult
+
+ /**
+ * From MBTNotificationResult.
+ * Handle an intermediate result from a user query.
+ * This ffunction is called if the user query passes information
+ * back before it has finished i.e. is dismissed. The final acceptance/
+ * denial of a query is passed back in MBRNotificationClosed.
+ *
+ * @since Symbian^4
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
+
+ /**
+ * From MBTNotificationResult.
+ * The notification is finished. The resulting data (e.g. user input or
+ * acceptance/denial of the query) is passed back here.
+ *
+ * @since Symbian^4
+ * @param aErr KErrNone or one of the system-wide error codes.
+ * @param aData the returned data. The actual format
+ * is dependent on the actual notifier.
+ */
+ virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
+
+private:
+
+ CBTNotifSettingsTracker( CBTNotifServer* aServer );
+
+ void ConstructL();
+
+private: // data
+
+ /**
+ * Local copy of current power state.
+ */
+ TBTPowerStateValue iPowerState;
+
+ /**
+ * Local copy of current visibility mode.
+ */
+ TBTVisibilityMode iVisibilityMode;
+
+ /**
+ * ?description_of_pointer_member
+ * Own.
+ */
+ CBTEngSettings* iSettings;
+
+ /**
+ * Pointer to an outstanding user interaction.
+ * Not own.
+ */
+ CBluetoothNotification* iNotification;
+
+ /**
+ * Reference to our parent the server class.
+ * Not own.
+ */
+ CBTNotifServer* iServer;
+
+ };
+
+#endif // BTNOTIFSETTINGSTRACKER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/inc/traceconfig.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* ============================================================================
+* Name : traceconfig_template.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : Configuration of debug tracing in btnotif
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+#ifndef BLUETOOTHTRACECONFIG_H
+#define BLUETOOTHTRACECONFIG_H
+
+/*
+Sample usage:
+ void testTracing()
+ {
+ BOstrace0( TRACE_FATAL, TNAME_DEVLIST_1, "BOstrace0" );
+ BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_2, "BOstrace1 %d", 123 );
+ _LIT(String, "\"Symbian Descriptor\"");
+ TPtrC ptr(String);
+ TBuf<20> buf(ptr);
+ BOstraceExt1( TRACE_NORMAL, TNAME_DEVLIST_3, "BOstraceExt1 %S", &ptr);
+ BOstraceExt2( TRACE_API, TNAME_DEVLIST_4, "BOstraceExt2 %d %S", 456, &ptr );
+ BOstraceExt3( TRACE_FLOW, TNAME_DEVLIST, "BOstraceExt3 0x%x %d %S", 128, 256, &ptr );
+ BOstraceExt4( TRACE_DETAILED, TNAME_DEVL_5IST, "BOstraceExt4 0x%x %d %S %S", 128, 256, &ptr, &buf );
+ BOstraceExt5( TRACE_DEBUG, TNAME_DEVLIST_6, "BOstraceExt5 0x%x %d %S %S, %b", 128, 256, &ptr, &buf, 512 );
+ BOstraceFunctionEntry0( TNAME_DEVLIST_7 );
+ BOstraceFunctionEntry1( TNAME_DEVLIST_8, 0x00abcdef );
+ BOstraceFunctionEntryExt(TNAME_DEVLIST_9, 0xdeadbeef, 123);
+ BOstraceFunctionExit0( TNAME_DEVLIST_9 );
+ BOstraceFunctionExit1( TNAME_DEVLIST_10, 0x00beebee );
+ BOstraceFunctionExitExt(TNAME_DEVLIST_11, 0x00badbed, -1);
+ BOstraceEventStart0( TNAME_DEVLIST_12, "BOstraceEventStart0" );
+ BOstraceEventStart1( TNAME_DEVLIST_13, "BOstraceEventStart1", 789 );
+ BOstraceEventStop( TNAME_DEVLIST_14, "BOstraceEventStop" );
+ BOstraceState0( TNAME_DEVLIST_15, "connection state", 1 );
+ BOstraceState1( TNAME_DEVLIST_16, "audio state", 2, 0xdeadbeef );
+ BtTraceBlock(
+ for (int i = 0; i < 5; ++i) {
+ BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_, "BtTraceBlock counter(1-5): %d", i+1 );
+ });
+ QString str("\"Qt String\"");
+ BtTraceQString0( TRACE_NORMAL, TNAME_DEVLIST_17, str);
+ BtTraceQString1( TRACE_NORMAL, TNAME_DEVLIST_18, "additional text;", str);
+ TBTDevAddr addr;
+ addr.SetReadable(_L("0060576ff376"));
+ BtTraceBtAddr0( TRACE_NORMAL, TNAME_DEVLIST_19, addr );
+ BtTraceBtAddr1( TRACE_NORMAL, TNAME_DEVLIST_20, "additional trace;", addr );
+ }
+
+ */
+
+// At early development phase, tracing is activated
+#ifdef _DEBUG
+#define BLUETOOTHTRACE_ENABLED
+#endif //_DEBUG
+
+/*
+ * Tracing media configuration
+ */
+#ifdef BLUETOOTHTRACE_ENABLED
+ #ifdef __WINS__
+ #define BLUETOOTHTRACE_MEDIA_FILE
+ #else
+ // RDEBUG is used for tracing output before we migrate to OST tracing.
+ #define BLUETOOTHTRACE_MEDIA_RDEBUG
+ // #define BLUETOOTHTRACE_MEDIA_OST
+ #endif // __WINS__
+#endif //BLUETOOTHTRACE_ENABLED
+
+/*
+ * Configuration of tracing to file
+ */
+#ifdef BLUETOOTHTRACE_MEDIA_FILE
+
+_LIT( KLogFile, "btenglog.txt" );
+_LIT( KLogDir, "bt" );
+
+#endif //BLUETOOTHTRACE_MEDIA_FILE
+
+/*
+ * Configuration of tracing using RDebug
+ */
+#ifdef BLUETOOTHTRACE_MEDIA_RDEBUG
+
+#endif //BLUETOOTHTRACE_MEDIA_RDEBUG
+
+/*
+ * Configuration of tracing using OST
+ */
+#ifndef BLUETOOTHTRACE_MEDIA_OST
+
+/**
+ * Group-mapping aligning with OST groups.
+ * The purpose of using groups is to ease migrating tracing from legacy logging to OST.
+ */
+#define TRACE_FATAL "[FATAL]"
+#define TRACE_IMPORTANT "[IMPTT]"
+#define TRACE_NORMAL "[NORML]"
+#define TRACE_API "[ API ]"
+#define TRACE_FLOW "[FLOW ]"
+#define TRACE_STATE "[STATE]"
+#define TRACE_DETAILED "[DETLD]"
+#define TRACE_DEBUG "[DEBUG]"
+#define TRACE_PERFORMANCE "[PFMAN]"
+
+/**
+ * Component Identifier to be written into traces:
+ */
+_LIT(KComponentName, "[BtNotif]");
+
+#endif //BLUETOOTHTRACE_MEDIA_OST
+
+#endif // BLUETOOTHTRACECONFIG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/bluetoothnotification.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,440 @@
+/*
+* ============================================================================
+* Name : bluetoothnotification.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Class for managing an actual user notification or query.
+* It hides UI framework-specifics in a private class.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "bluetoothnotification.h"
+#include <hb/hbcore/hbsymbianvariant.h>
+#include "btnotificationmanager.h"
+#include "btnotifserver.h"
+#include "bluetoothtrace.h"
+#include <utf.h> // for debugging
+
+/** Identifier of Bluetooth device dialog plug-in. */
+_LIT( KBTDevDialogId, "com.nokia.hb.btdevicedialog/1.0" );
+/** Key name of result. */
+_LIT( KBTDevDialogResult, "result" );
+_LIT( KBTDevDialogInput, "input" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBluetoothNotification::CBluetoothNotification( CBTNotificationManager* aManager )
+: iManager( aManager )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBluetoothNotification::ConstructL()
+ {
+ iNotificationData = CHbSymbianVariantMap::NewL();
+ iDialog = CHbDeviceDialogSymbian::NewL();
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewL.
+// ---------------------------------------------------------------------------
+//
+CBluetoothNotification* CBluetoothNotification::NewL(
+ CBTNotificationManager* aManager )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ CBluetoothNotification* self = new( ELeave ) CBluetoothNotification( aManager );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBluetoothNotification::~CBluetoothNotification()
+{
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ delete iDialog;
+ delete iNotificationData;
+ delete iReturnData;
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this )
+}
+
+
+// ---------------------------------------------------------------------------
+// Resets the notification, clean all the internals.
+// ---------------------------------------------------------------------------
+//
+void CBluetoothNotification::Reset()
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ iType = TBluetoothDialogParams::EInvalidDialog;
+ iResourceId = ENoResource;
+ iObserver = NULL;
+ iDialog->Cancel();
+ iDialog->SetObserver( NULL ); // Not interested in a callback anymore.
+ delete iNotificationData;
+ iNotificationData = NULL;
+ iNotificationData = CHbSymbianVariantMap::NewL();
+ delete iReturnData;
+ iReturnData = NULL;
+ iReturnData = CHbSymbianVariantMap::NewL();
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Sets the data to be shown to the user.
+// ---------------------------------------------------------------------------
+//
+TInt CBluetoothNotification::SetData( TInt aDataType, const TDesC& aData )
+ {
+ TRAPD( err, SetDataL( aDataType, aData ) );
+ return (int) err;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Sets the data to be shown to the user.
+// ---------------------------------------------------------------------------
+//
+TInt CBluetoothNotification::SetData( TInt aDataType, TInt aData )
+ {
+ TRAPD( err, SetDataL( aDataType, aData ) );
+ return (int) err;
+ }
+
+// ---------------------------------------------------------------------------
+// Updates the data to be shown to the user.
+// ---------------------------------------------------------------------------
+//
+TInt CBluetoothNotification::Update( const TDesC& aData )
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ (void) aData;
+ int ret = iDialog->Update( *iNotificationData );
+ delete iNotificationData;
+ iNotificationData = NULL;
+ iNotificationData = CHbSymbianVariantMap::NewL();
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ return ret;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Show the notification, which means that it is added to the queue.
+// ---------------------------------------------------------------------------
+//
+TInt CBluetoothNotification::Show()
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ TRAPD( err, SetDataL( TBluetoothDialogParams::EDialogType, iType ) );
+ if( !err )
+ {
+ TRAP( err, SetDataL( TBluetoothDialogParams::EResource, iResourceId ) );
+ }
+ delete iReturnData;
+ iReturnData = NULL;
+ if( !err )
+ {
+ TRAP( err, iReturnData = CHbSymbianVariantMap::NewL() );
+ }
+ if( !err )
+ {
+ err = iDialog->Show( KBTDevDialogId(), *iNotificationData, this );
+ }
+ delete iNotificationData;
+ iNotificationData = NULL;
+ iNotificationData = CHbSymbianVariantMap::NewL();
+
+ const TInt KPluginErr = CHbDeviceDialogSymbian::EPluginErrors + 1;
+ if( err == KPluginErr )
+ {
+ err = KErrNotFound;
+ }
+ BOstraceFunctionExitExt( DUMMY_DEVLIST, this, err );
+ return err;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Stop showing the notification.
+// ---------------------------------------------------------------------------
+//
+TInt CBluetoothNotification::Close()
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ iDialog->Cancel();
+ iManager->ReleaseNotification( this );
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Sets the data to be shown to the user.
+// ---------------------------------------------------------------------------
+//
+void CBluetoothNotification::SetDataL( TInt aType, const TDesC& aData )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aType );
+ TBuf16<6> key;
+ TInt err = 0;
+ CHbSymbianVariant* value = NULL;
+ switch( aType )
+ {
+ case TBluetoothDialogParams::EAddress:
+ case TBluetoothDeviceDialog::EDeviceName:
+ case TBluetoothDeviceDialog::EAdditionalDesc:
+ case TBluetoothDialogParams::EDialogTitle:
+ key.Num(aType);
+ value = CHbSymbianVariant::NewL( (TAny*) &aData, CHbSymbianVariant::EDes );
+ BtTraceBlock(
+ TBuf<32> buf;
+ switch (aType) {
+ case TBluetoothDialogParams::EAddress:
+ _LIT(KAddress,"EAddress");
+ buf.Append(KAddress);
+ break;
+ case TBluetoothDeviceDialog::EDeviceName:
+ _LIT(KDeviceName,"EDeviceName");
+ buf.Append(KDeviceName);
+ break;
+ case TBluetoothDeviceDialog::EAdditionalDesc:
+ _LIT(KAdditionalDesc,"EAdditionalDesc");
+ buf.Append(KAdditionalDesc);
+ break;
+ }
+ TPtrC p(buf);
+ TPtrC16 *ptr = (TPtrC16 *)value->Data();
+ BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%S]", &p, ptr);
+ );
+ err = iNotificationData->Add( key, value ); // Takes ownership of value
+ if ( err )
+ {
+ // Note: need a proper exception handling.
+ // NOTIF_NOTHANDLED( err )
+ }
+ break;
+ case TBluetoothDialogParams::EResource:
+ case TBluetoothDeviceDialog::EDeviceClass:
+ case TBluetoothDeviceDialog::EAdditionalInt:
+ PanicServer( EBTNotifPanicBadArgument );
+ break;
+ case TBluetoothDialogParams::ENoParams:
+ case TBluetoothDeviceDialog::ENoParams:
+ default:
+ break;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Sets the data to be shown to the user.
+// ---------------------------------------------------------------------------
+//
+void CBluetoothNotification::SetDataL( TInt aType, TInt aData )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aType );
+ TBuf<6> key;
+ TInt err = 0;
+ CHbSymbianVariant* value = NULL;
+ switch( aType )
+ {
+ case TBluetoothDialogParams::EDialogType:
+ case TBluetoothDialogParams::EResource:
+ case TBluetoothDialogParams::EDialogTitle:
+ case TBluetoothDeviceDialog::EDeviceClass:
+ case TBluetoothDeviceDialog::EAdditionalInt:
+ key.Num(aType);
+ value = CHbSymbianVariant::NewL( (TAny*) &aData, CHbSymbianVariant::EInt );
+ BtTraceBlock(
+ TBuf<32> buf;
+ switch (aType) {
+ case TBluetoothDialogParams::EDialogType:
+ buf = _L("EDialogType");
+ break;
+ case TBluetoothDialogParams::EResource:
+ buf = _L("EResource");
+ break;
+ case TBluetoothDeviceDialog::EDeviceClass:
+ buf = _L("EDeviceClass");
+ break;
+ case TBluetoothDeviceDialog::EAdditionalInt:
+ buf = _L("EAdditionalInt");
+ break;
+ }
+ TPtrC p(buf);
+ TInt *intPtr = (TInt *)value->Data();
+ BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST, "SetData [%S] = [%d]", &p, *intPtr);
+ );
+ err = iNotificationData->Add( key, value ); // Takes ownership of value
+ if ( err )
+ {
+ // need a proper exception handling.
+ //NOTIF_NOTHANDLED( !err )
+ }
+
+ break;
+ case TBluetoothDialogParams::EAddress:
+ case TBluetoothDeviceDialog::EDeviceName:
+ PanicServer( EBTNotifPanicBadArgument );
+ break;
+ case TBluetoothDialogParams::ENoParams:
+ case TBluetoothDeviceDialog::ENoParams:
+ default:
+ break;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MHbDeviceDialogObserver.
+// Callback called when data is received from a device dialog.
+// ---------------------------------------------------------------------------
+//
+void CBluetoothNotification::DataReceived( CHbSymbianVariantMap& aData )
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ BtTraceBlock( debugHbSymbianVariantMap(aData); );
+ for( TInt i = 0; i < aData.Keys().MdcaCount(); i++ )
+ {
+ TPtrC key( aData.Keys().MdcaPoint( i ).Ptr(), aData.Keys().MdcaPoint( i ).Length() );
+ const CHbSymbianVariant* valueRef = aData.Get( key );
+ CHbSymbianVariant* value = CHbSymbianVariant::NewL( valueRef->Data(), valueRef->Type() );
+ TInt err = iReturnData->Add( key, value );
+ NOTIF_NOTHANDLED( !err )
+ }
+ iObserver->MBRDataReceived( aData );
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+#ifdef BLUETOOTHTRACE_ENABLED
+
+void CBluetoothNotification::debugHbSymbianVariantMap( CHbSymbianVariantMap& aData)
+ {
+ for( TInt i = 0; i < aData.Keys().MdcaCount(); i++ )
+ {
+ TBuf<128> buf;
+ TPtrC key( aData.Keys().MdcaPoint( i ).Ptr(), aData.Keys().MdcaPoint( i ).Length() );
+ buf = key;
+ buf.Append(_L(" = "));
+ const CHbSymbianVariant* value = aData.Get( key );
+ TBuf<16> nbr;
+ TBuf<32> newBuf;
+ switch (value->Type()) {
+ case CHbSymbianVariant::EInt :
+ buf.Append(_L("[EInt] "));
+ nbr.Num(*((TInt*)value->Data()));
+ buf.Append(nbr);
+ break;
+ case CHbSymbianVariant::EBool :
+ buf.Append(_L("[EBool] "));
+ buf.Append(*((TBool*)value->Data()) ? _L("True") : _L("False"));
+ break;
+ case CHbSymbianVariant::EUint :
+ buf.Append( _L("[EUint] "));
+ nbr.Num(*((TUint*)value->Data()));
+ buf.Append(nbr);
+ break;
+ case CHbSymbianVariant::EReal :
+ buf.Append(_L("[EReal] "));
+ nbr.Num(*((TReal*)value->Data()));
+ buf.Append(nbr);
+ break;
+ case CHbSymbianVariant::EDes : // TDesC
+ buf.Append(_L("[EDes] "));
+ buf.Append(*((TPtrC16 *)value->Data()));
+ break;
+ case CHbSymbianVariant::EBinary : // TDesC8
+ buf.Append(_L("[EBinary] "));
+ // the following function caused problems when converting this function to
+ // a trace function in bluetoothtrace.h
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(newBuf,*((TPtrC8 *)value->Data()) );
+ buf.Append(newBuf);
+ break;
+ case CHbSymbianVariant::EChar : // a TChar
+ buf.Append(_L("[EChar] "));
+ buf.Append(*((TChar *)value->Data()));
+ break;
+ case CHbSymbianVariant::ERect : // a TRect
+ case CHbSymbianVariant::EPoint : // a TPoint
+ case CHbSymbianVariant::ESize : // a TSize
+ case CHbSymbianVariant::EDesArray : // a MDesCArray
+ break;
+ default:
+ break;
+ }
+ TPtrC p(buf);
+ BOstraceExt1( TRACE_DEBUG, DUMMY_DEVLIST, "HbSymbianVariantMap [%S]", &p);
+ }
+ }
+#endif // BLUETOOTHTRACE_ENABLED
+// ---------------------------------------------------------------------------
+// From class MHbDeviceDialogObserver.
+// Callback called when a device dialog is closed.
+// ---------------------------------------------------------------------------
+//
+void CBluetoothNotification::DeviceDialogClosed( TInt aCompletionCode )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aCompletionCode );
+ TPckg<TBool> result( EFalse );
+ TPtrC8 resultPtr( result );
+ const CHbSymbianVariant* value = iReturnData->Get( KBTDevDialogResult );
+ if( value && value->IsValid() )
+ {
+ result() = *value->Value<TBool>();
+ }
+ RBuf8 resultBuf;
+ value = iReturnData->Get( KBTDevDialogInput );
+ if( value && value->IsValid() )
+ {
+ HBufC8* data = value->Value<HBufC8>();
+ if( !resultBuf.Create( data->Length() + result.Length() ) )
+ {
+ resultBuf = *data;
+ resultBuf.Insert( 0, result );
+ resultPtr.Set( resultBuf );
+ }
+ }
+ if( iObserver )
+ {
+ if( aCompletionCode == CHbDeviceDialogSymbian::ECancelledError )
+ {
+ aCompletionCode = KErrCancel;
+ }
+ iObserver->MBRNotificationClosed( aCompletionCode, resultPtr );
+ }
+ iManager->ReleaseNotification( this );
+ // Note that we might get deleted after releasing ourselves.
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifconnection.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,964 @@
+/*
+* ============================================================================
+* Name : btnotifconnection.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Class for observing events of a single connection, and for
+* managing any user notifications related to the connection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifconnection.h"
+#include <btextnotifiers.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <btextnotifierspartner.h>
+#endif
+
+#include "btnotifconnectiontracker.h"
+#include "btnotifpairinghelper.h"
+#include "btnotificationmanager.h"
+#include "btnotifclientserver.h"
+#include "bluetoothtrace.h"
+
+/** Id for the baseband connection watcher active object. */
+const TInt KConnectionWatcher = 40;
+/** Id for the registry watcher active object. */
+const TInt KRegistryWatcher = 41;
+/** Id for the active object for updating the registry. */
+const TInt KRegistryRetriever = 42;
+/** Event mask for subscribing to baseband connection events
+ * (need to check if these are appropriate). */
+const TInt KBbEventMask = ENotifyAnyRole | ENotifyAuthenticationComplete |
+ ENotifyPhysicalLinkUp | ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError;
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Decide the device name to display from the device information, and
+// converts the name if necessary.
+// ---------------------------------------------------------------------------
+//
+void GetDeviceNameL( TBTDeviceName& aName, const CBTDevice& aDevice )
+ {
+ if( aDevice.IsValidFriendlyName() )
+ {
+ aName.Copy( aDevice.FriendlyName() );
+ }
+ else
+ {
+ aName.Zero();
+ if( aDevice.IsValidDeviceName() )
+ {
+ aName = BTDeviceNameConverter::ToUnicodeL( aDevice.DeviceName() );
+ }
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Compare 2 device records device pairing has succeeded.
+// aDev2 is the updated device record, aDev1 is the previous record.
+// ---------------------------------------------------------------------------
+//
+TBool CheckRegistryPairedStatus( const CBTDevice* aOrig, const CBTDevice* aNew )
+ {
+ TBool result = EFalse;
+ // Use the device class to check that this has any valid information.
+ if( aOrig->AsNamelessDevice().IsValidDeviceClass() &&
+ !( aOrig->IsValidPaired() && aOrig->IsPaired() ) ||
+ aOrig->LinkKeyType() == ELinkKeyUnauthenticatedUpgradable )
+ {
+ // Only consider the result if the original device is not marked as paired.
+ if( aNew->IsValidPaired() && aNew->IsPaired() && aNew->IsValidLinkKey() &&
+ aNew->LinkKeyType() != ELinkKeyUnauthenticatedUpgradable )
+ {
+ // The new device record has valid pairing information, so
+ // this device is now paired.
+ result = ETrue;
+ }
+ }
+ return result;
+ }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnection::CBTNotifConnection( const TBTDevAddr& aAddr,
+ CBTNotifConnectionTracker* aTracker )
+: iAddr( aAddr ),
+ iTracker( aTracker )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::ConstructL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ iDevice = CBTDevice::NewL( iAddr );
+ iPhyActive = CBtSimpleActive::NewL(*this, KConnectionWatcher );
+ iRegActive = CBtSimpleActive::NewL( *this, KRegistryRetriever );
+ // ToDo: need to check if this succeeds if a connection is
+ // being created, in case of outgoing pairing.
+ User::LeaveIfError( iPhyLink.Open( iTracker->SocketServerSession(), iAddr ) );
+ // Subscribe to events.
+ iBasebandEvent.FillZ(); // To be sure that we are not reading false events.
+ iPhyLink.NotifyNextBasebandChangeEvent( iBasebandEvent,
+ iPhyActive->RequestStatus(), KBbEventMask );
+ iPhyActive->GoActive();
+ // Get the details from BT registry
+ TBTRegistrySearch pattern;
+ pattern.FindAddress( iAddr );
+ User::LeaveIfError( iRegistry.Open( iTracker->RegistryServerSession() ) );
+ iRegistry.CreateView( pattern, iRegActive->RequestStatus() );
+ iRegActive->GoActive();
+ iCurrentOp = EReadingRegistry;
+ iRegDevArray = new CBTDeviceArray(1); // only 1 entry ever used
+ // ToDo: more initialization needed?
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewLC.
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnection* CBTNotifConnection::NewLC( const TBTDevAddr& aAddr,
+ CBTNotifConnectionTracker* aTracker )
+ {
+ CBTNotifConnection* self = new( ELeave ) CBTNotifConnection( aAddr, aTracker );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnection::~CBTNotifConnection()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( iNotification )
+ {
+ // Clear the notification callback, we cannot receive them anymore.
+ iNotification->RemoveObserver();
+ iNotification->Close(); // Also dequeues the notification from the queue.
+ iNotification = NULL;
+ }
+ delete iRegActive;
+ delete iRegistryResponse;
+ iRegistry.Close();
+ delete iDevMan;
+
+ delete iPhyActive;
+ iPhyLink.Close();
+ delete iDevice;
+ delete iPairingHelper;
+
+ while( iMsgHandleQ.Count() )
+ {
+ CompleteClientRequest( KErrDisconnected, KNullDesC8 );
+ }
+ iMsgHandleQ.Close();
+ iAcceptedConnections.Close();
+ iDeniedConnections.Close();
+ iRegDevArray->ResetAndDestroy();
+ delete iRegDevArray;
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Check what to do next.
+// This function should be called whenever we may be ready for the next
+// request/action, which is from any callback function i.e.
+// MBAORequestCompletedL, MBRNotificationClosed, HandleNotifierRequestL and
+// CancelNotifierRequestL.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CheckNextOperationL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( iCurrentOp == EIdle )
+ {
+ // Check the link state, to see if it has gone down already.
+ TUint32 linkState = 0;
+ TInt err = iPhyLink.PhysicalLinkState( linkState );
+ TBool linkDown = linkState & ENotifyPhysicalLinkDown;
+ if( ( !err && linkDown ) || err == KErrDisconnected )
+ {
+ // The link state tells us that the link is down,
+ // inform the connection tracker the we are done.
+ iTracker->HandleLinkCountChangeL();
+ // Note that we may be deleted now!
+ }
+ else if( iMsgHandleQ.Count() )
+ {
+ // Get the next request and handle it.
+ // ToDo: differentiate between notifier and pairing message!
+ const RMessage2* message = iTracker->Server()->FindMessageFromHandle( iMsgHandleQ[0] );
+ NOTIF_NOTHANDLED( message )
+ TInt opcode = message->Function();
+ if( opcode <= EBTNotifUpdateNotifier )
+ {
+ TBuf8<0x250> paramsBuf; // Size needs to be long enough to read all possible parameter sizes.
+ message->ReadL( EBTNotifSrvParamSlot, paramsBuf );
+ HandleNotifierRequestL( paramsBuf, *message );
+ }
+ else
+ {
+ iMsgHandleQ.Remove( 0 );
+ StartBondingL( *message );
+ }
+ }
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Complete the first outstanding client request and removes it from the queue.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CompleteClientRequest( TInt aReason, const TDesC8& aReply )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ NOTIF_NOTHANDLED( iMsgHandleQ.Count() )
+ TInt err = iTracker->Server()->CompleteMessage( iMsgHandleQ[0], aReason, aReply );
+ NOTIF_NOTHANDLED( !err )
+ iMsgHandleQ.Remove( 0 );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Distinguish a request and pass to corresponding handle.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::HandleNotifierRequestL( const TDesC8& aParams,
+ const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aMessage.Int0() );
+ if( !iMsgHandleQ.Count() || iMsgHandleQ[0] != aMessage.Handle() )
+ {
+ // If we are processing a queued request, we of course don't queue
+ // it again. In that case we are handling the first request from the queue.
+ iMsgHandleQ.AppendL( aMessage.Handle() );
+ }
+ if( iCurrentOp == EIdle || iCurrentOp == EBonding )
+ {
+ // ToDo: check non-pairing operation when bonding
+ TInt uid = aMessage.Int0();
+ if( uid == KBTManAuthNotifierUid.iUid )
+ {
+ HandleAuthorizationReqL( aParams );
+ }
+ else if( uid == KBTManPinNotifierUid.iUid ||
+ uid == KBTPinCodeEntryNotifierUid.iUid ||
+ uid == KBTNumericComparisonNotifierUid.iUid ||
+ uid == KBTPasskeyDisplayNotifierUid.iUid )
+ {
+ if( !iPairingHelper )
+ {
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifConnection::HandleNotifierRequestL: creating CBTNotifPairingHelper");
+ iPairingHelper = CBTNotifPairingHelper::NewL( this, iTracker );
+ }
+ if( iCurrentOp != EBonding )
+ {
+ iCurrentOp = EPairing;
+ }
+ iPairingHelper->StartPairingNotifierL( uid, aParams );
+ }
+ // We may be done with the current request, proceed to the next one
+ CheckNextOperationL();
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Update a notifier, update the outstanding dialog if the notifier request
+// is currently being served.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::HandleNotifierUpdateL( const TDesC8& aParams,
+ const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ NOTIF_NOTHANDLED( iCurrentOp != EIdle )
+ (void) aParams;
+ TBuf8<0x250> paramsBuf; // Size needs to be long enough to read all possible sizes.
+ aMessage.ReadL( EBTNotifSrvParamSlot, paramsBuf );
+ TInt uid = aMessage.Int0();
+ if( uid == KBTManAuthNotifierUid.iUid )
+ {
+ TBTNotifierUpdateParams params;
+ TPckgC<TBTNotifierUpdateParams> paramsPckg( params );
+ paramsPckg.Set( paramsBuf );
+ // The result means result of conversion to unicode
+ if( !paramsPckg().iResult )
+ {
+ // Only update locally, registry will update us with the same info later on.
+ iDevice->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( paramsPckg().iName ) );
+ if( iNotification )
+ {
+ // Update the dialog with the new name. It is up to the dialog to
+ // determine the validity (in case another dialog is shown).
+ //iNotification->Update( )
+ }
+ }
+ }
+ else if( iPairingHelper && ( uid == KBTPinCodeEntryNotifierUid.iUid ||
+ uid == KBTNumericComparisonNotifierUid.iUid ||
+ uid == KBTPasskeyDisplayNotifierUid.iUid ) )
+ {
+ // Just forward to pairing helper
+ iPairingHelper->UpdatePairingNotifierL( uid, paramsBuf );
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancel a request, dismiss the outstanding dialog if the notifier request
+// is currently being served.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CancelNotifierRequestL( const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ NOTIF_NOTHANDLED( iCurrentOp != EIdle )
+ TInt pos = iMsgHandleQ.Find( aMessage.Handle() );
+ if( pos > KErrNotFound )
+ {
+ // We have queued the message, remove it from the queue.
+ iMsgHandleQ.Remove( pos );
+ // We use the supplied handle to remove it, as it may not be
+ // the first in the queue.
+ TInt err = iTracker->Server()->CompleteMessage( aMessage.Handle(), KErrCancel, KNullDesC8 );
+ NOTIF_NOTHANDLED( !err )
+ if( pos == 0 )
+ {
+ // There could be the case that we are still post-processing
+ // the previous request (e.g. blocking query), then the next
+ // notification is not yet started but the first in the queue.
+ // We can see that from the current operation type.
+ if( iNotification && iCurrentOp < EAdditionalNotes )
+ {
+ // Cancel the user query
+ // This will also unregister us from the notification.
+ TInt err = iNotification->Close();
+ NOTIF_NOTHANDLED( !err )
+ iNotification = NULL;
+ iCurrentOp = EIdle;
+ }
+ if( iPairingHelper )
+ {
+ // The pairing helper calls back PairingCompleted and sets state.
+ iPairingHelper->CancelPairingNotifierL( aMessage.Int0() );
+ // The pairing helper may have now been deleted.
+ }
+ }
+ }
+ // We may be done with the current request, proceed to the next one
+ CheckNextOperationL();
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Start a bonding operation with the remote device.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::StartBondingL( const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aMessage.Function() );
+ if( iCurrentOp == EIdle || iCurrentOp > EInternalOperations )
+ {
+ __ASSERT_ALWAYS( !iPairingHelper, PanicServer( EBTNotifPanicBadState ) );
+ iPairingHelper = CBTNotifPairingHelper::NewL( this, iTracker );
+ // The pairingg helper stored the handle, not in our queue here.
+ // This is because bonding will generate a pairing notifier request, which
+ // will be completed first. The bookkeeping gets complicated if we have to
+ // re-order the queue here.
+ iPairingHelper->StartBondingL( aMessage.Handle() );
+ iCurrentOp = EBonding;
+ }
+ else if( iCurrentOp == EPairing || iCurrentOp == EBonding )
+ {
+ // We only do one pairing at the time.
+ User::Leave( KErrInUse );
+ }
+ else
+ {
+ // We only store it here if it is not handled immediately.
+ iMsgHandleQ.AppendL( aMessage.Handle() );
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancel an ongoing bonding operation with the remote device.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CancelBondingL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( iPairingHelper )
+ {
+ iPairingHelper->CancelBondingL();
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// The pairing handler has completed a pairing operation.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::PairingCompleted()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ __ASSERT_ALWAYS( iPairingHelper, PanicServer( EBTNotifPanicNullMember ) );
+ if( iPairingHelper->CurrentOperation() == CBTNotifPairingHelper::EIdle )
+ {
+ // We are still idle. Remove the pairing helper
+ delete iPairingHelper;
+ iPairingHelper = NULL;
+ }
+ if( iCurrentOp == EPairing || iCurrentOp == EBonding )
+ {
+ iCurrentOp = EIdle;
+ TRAP_IGNORE( CheckNextOperationL() );
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process a new pairing result, and determine if we need to show
+// anything to the user.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::PairingResult( TInt aError )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( !iPairingHelper )
+ {
+ TRAP_IGNORE( iPairingHelper = CBTNotifPairingHelper::NewL( this, iTracker ) );
+ }
+ if( iPairingHelper )
+ {
+ iPairingHelper->HandleAuthenticationCompleteL( aError );
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process the new service-level connection, and determine if we need to
+// show anything to the user.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::ServiceConnectedL( TBTProfile aProfile )
+ {
+ (void) aProfile;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process the new service-level disconnection, and determine if we need to
+// show anything to the user.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::ServiceDisconnectedL( TBTProfile aProfile )
+ {
+ (void) aProfile;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Ask the user if he/she wants to block future connection requests.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::LaunchBlockingQueryL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ iCurrentOp = EBlocking;
+ TBTDialogResourceId resourceId = EBlockUnpairedDevice;
+ if( iDevice->IsValidPaired() && iDevice->IsPaired() &&
+ iDevice->LinkKeyType() != ELinkKeyUnauthenticatedUpgradable )
+ {
+ resourceId = EBlockPairedDevice;
+ }
+ PrepareNotificationL( TBluetoothDialogParams::EQuery, resourceId );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Modify the record for the remote device in BTRegistry, with the changes
+// already made in the local record.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::UpdateRegistryEntryL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // We use CBTEngDevMan here. We could use the registry API directly, however,
+ // using this convenience API makes the registry processing much simpler.
+ if( !iDevMan )
+ {
+ iDevMan = CBTEngDevMan::NewL( this );
+ }
+ iDevMan->ModifyDevice( *iDevice );
+ if( iCurrentOp == EIdle ||
+ ( ( iCurrentOp == EPairing || iCurrentOp == EBonding ) &&
+ iPairingHelper->CurrentOperation() == CBTNotifPairingHelper::EIdle ) )
+ {
+ // To make sure that we don't get deleted while updating.
+ iCurrentOp = EUpdatingRegistry;
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+// ---------------------------------------------------------------------------
+// Modify the record for the remote device in BTRegistry, if aTrusted == true, then
+// update trusted status after reading device info from registry
+//
+// ---------------------------------------------------------------------------
+
+void CBTNotifConnection::UpdateRegistryEntryL( TBool aTrusted )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aTrusted );
+ if (!aTrusted) {
+ UpdateRegistryEntryL();
+ return;
+ }
+ // We use CBTEngDevMan here. We could use the registry API directly, however,
+ // using this convenience API makes the registry processing much simpler.
+ if( !iDevMan )
+ {
+ iDevMan = CBTEngDevMan::NewL( this );
+ }
+ // first read device info from registry, to make sure we have up-to-date local info
+ iCurrentOp = EReadingRegistry;
+ GetDeviceFromRegistry( iDevice->BDAddr() );
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// Handle a result from a user query.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::MBRDataReceived( CHbSymbianVariantMap & aData )
+ {
+ (void) aData;
+ NOTIF_NOTIMPL
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// The notification is finished.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::MBRNotificationClosed( TInt aError, const TDesC8& aData )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // ToDo: call leaving function from here!
+ __ASSERT_ALWAYS( iCurrentOp != EIdle, PanicServer( EBTNotifPanicBadState ) );
+ // First unregister from the notification, so we can already get the next one.
+ iNotification->RemoveObserver();
+ iNotification = NULL;
+ TRAP_IGNORE( NotificationClosedL( aError, aData ) );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Handle the active object completion.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::RequestCompletedL( CBtSimpleActive* aActive,
+ TInt aStatus )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aActive->RequestId() );
+ switch( aActive->RequestId() )
+ {
+ case KRegistryRetriever:
+ {
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifConnection::MBAORequestCompletedL: KRegistryRetriever" );
+ if( !iRegistryResponse )
+ {
+ // We have just created the view, now get the results.
+ // There can only be one result, as the address is unique.
+ // (note: how about LE random addresses?)
+ // Or then we have tried to re-open an existing view, so we get KErrInuse.
+ // We anyway just get the results.
+ __ASSERT_ALWAYS( aStatus < 2, PanicServer( EBTNotifPanicCorrupt ) );
+ iRegistryResponse = CBTRegistryResponse::NewL( iRegistry );
+ iRegistryResponse->Start( iRegActive->RequestStatus() );
+ iRegActive->GoActive();
+ }
+ else
+ {
+ if( !aStatus )
+ {
+ // There can be only one result.
+ __ASSERT_ALWAYS( iRegistryResponse->Results().Count() == 1, PanicServer( EBTNotifPanicCorrupt ) );
+ CBTDevice* regDevice = iRegistryResponse->Results()[0];
+ TBool paired = CheckRegistryPairedStatus( iDevice, regDevice );
+ iDevice->UpdateL( *regDevice );
+ if( paired )
+ {
+ __ASSERT_ALWAYS( iPairingHelper, PanicServer( EBTNotifPanicNullMember ) );
+ iPairingHelper->HandleAuthenticationCompleteL( KErrNone );
+ }
+ }
+ // ToDo: error handling of registry response result?
+ delete iRegistryResponse;
+ iRegistryResponse = NULL;
+ }
+ if( iCurrentOp == EReadingRegistry && !iRegActive->IsActive() )
+ {
+ // If this is part of the sequence of operations, we are done.
+ // Otherwise we just update with the latest info from registry,
+ // and then we don't interrupt or change the state.
+ iCurrentOp = EIdle;
+ }
+ }
+ // ToDo: start registry watching (preferably using registry API when this is available)
+ break;
+ case KRegistryWatcher:
+ {
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifConnection::MBAORequestCompletedL: KRegistryWatcher" );
+ NOTIF_NOTHANDLED( !aStatus )
+ // Ignore updates while we are already retrieving.
+ if( !iRegActive->IsActive() )
+ {
+ // Refresh our information with the latest from registry
+ iRegActive->SetRequestId( KRegistryRetriever );
+ TBTRegistrySearch pattern;
+ pattern.FindAddress( iAddr );
+ iRegistry.CreateView( pattern, iRegActive->RequestStatus() );
+ iRegActive->GoActive();
+ }
+ }
+ break;
+ case KConnectionWatcher:
+ {
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifConnection::MBAORequestCompletedL: KConnectionWatcher" );
+ TUint32 event = iBasebandEvent().EventType();
+ // First subscribe to the next event notification.
+ // This will overwrite iBasebandEvent().EventType() with KBbEventMask
+ iPhyLink.NotifyNextBasebandChangeEvent( iBasebandEvent,
+ iPhyActive->RequestStatus(), KBbEventMask );
+ iPhyActive->GoActive();
+ // Link down and link error are handled in CheckNextOperationL below.
+ // ToDo: handle events!
+ if( event & ( ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError ) )
+ {
+ // We re-use the error code to store the indication that the
+ // link has disconnected. This will only be overridden by next
+ // event, which can only be a connection up event.
+ iBasebandEvent().SetErrorCode( KErrDisconnected );
+ }
+ if( iPairingHelper )
+ {
+ if( event & ( ENotifyPhysicalLinkDown | ENotifyPhysicalLinkError |
+ ENotifyAuthenticationComplete ) )
+ {
+ // Results interesting for pairing result processing.
+ iPairingHelper->HandleAuthenticationCompleteL( iBasebandEvent().SymbianErrorCode() );
+ }
+ else if( event & ENotifyPhysicalLinkUp &&
+ iPairingHelper->CurrentOperation() == CBTNotifPairingHelper::EDedicatedBonding )
+ {
+ iPairingHelper->StartBondingL( 0 );
+ }
+ }
+ }
+ break;
+ default:
+ PanicServer( EBTNotifPanicBadState );
+ break;
+ }
+ // We may be done with the current request, proceed to the next one
+ CheckNextOperationL();
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Cancel and clean up all requests related to the active object.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CancelRequest( TInt aRequestId )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if ( aRequestId == KConnectionWatcher )
+ {
+ iPhyLink.CancelNextBasebandChangeEventNotifier();
+ }
+ else if ( aRequestId == KRegistryWatcher && iRegistryResponse )
+ {
+ iRegistryResponse->Cancel();
+ }
+ else if ( aRequestId == KRegistryRetriever )
+ {
+ iRegistry.CancelRequest( iRegActive->RequestStatus());
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::HandleError( CBtSimpleActive* aActive,
+ TInt aError )
+ {
+ (void) aActive;
+ (void) aError;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTEngDevmanObserver.
+// Registry modification has completed.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::HandleDevManComplete( TInt aErr )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ (void) aErr;
+ NOTIF_NOTHANDLED( !aErr )
+ if( iCurrentOp == EUpdatingRegistry )
+ {
+ // To make sure that we don't get deleted while updating.
+ iCurrentOp = EIdle;
+ }
+ // Refresh is done separately, we will get notified through
+ // the registry watcher of the change.
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTEngDevmanObserver.
+// Callback for getting a device from the registry
+//
+// Currently only used in context of setting device to trusted
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::HandleGetDevicesComplete(
+ TInt err, CBTDeviceArray* deviceArray )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, err );
+ // err is not used here very much, -1 could be returned if there is no device in registry,
+ // but this case is covered by examing mRegDevArray.
+ if (!err && (iCurrentOp == EReadingRegistry) ) {
+ CBTDevice* dev (0);
+ if ( deviceArray->Count() ) {
+ dev = deviceArray->At( 0 );
+ }
+ if ( dev ) {
+ iDevice = dev->CopyL();
+ }
+ // Set device to trusted
+ // Copy the existing security settings.
+ TBTDeviceSecurity sec( iDevice->GlobalSecurity().SecurityValue(),
+ iDevice->GlobalSecurity().PasskeyMinLength() );
+ sec.SetNoAuthorise( ETrue ); // new value: set device as trusted
+ iDevice->SetGlobalSecurity( sec );
+ iDevMan->ModifyDevice( *iDevice ); // write trusted (& paired) status to registry
+ // To make sure that we don't get deleted while updating.
+ iCurrentOp = EUpdatingRegistry;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+// ---------------------------------------------------------------------------
+// Retrieves device from registry based on BT address parameter
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::GetDeviceFromRegistry( const TBTDevAddr &addr )
+{
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ TBTRegistrySearch searchPattern;
+ searchPattern.FindAddress( addr );
+ // and get this device from registry
+ iRegDevArray->ResetAndDestroy();
+ iDevMan->GetDevices(searchPattern, iRegDevArray);
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+}
+
+// ---------------------------------------------------------------------------
+// Get and configure a notification.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ iNotification = iTracker->NotificationManager()->GetNotification();
+ User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory
+ iNotification->SetObserver( this );
+ iNotification->SetNotificationType( aType, aResourceId );
+ // Set the address of the remote device
+ TBuf<KBTDevAddrSize> addr;
+ addr.Copy( iAddr.Des() );
+ TInt err = iNotification->SetData( TBluetoothDialogParams::EAddress, addr );
+ NOTIF_NOTHANDLED( !err )
+ // Set the name of the remote device
+ TBTDeviceName name;
+ GetDeviceNameL( name, *iDevice );
+ // ToDo: handle leave in name conversion!
+ err = iNotification->SetData( (TInt) TBluetoothDeviceDialog::EDeviceName, name );
+ NOTIF_NOTHANDLED( !err )
+ // Queue the notification for displaying to the user
+ err = iTracker->NotificationManager()->QueueNotification( iNotification );
+ NOTIF_NOTHANDLED( !err )
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// The notification is finished, handle the result.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::NotificationClosedL( TInt aError, const TDesC8& aData )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ switch( iCurrentOp )
+ {
+ case EAuthorizing:
+ CompleteAuthorizationReqL( aError, aData );
+ break;
+ case EBlocking:
+ CompleteBlockingReqL( aError, aData );
+ break;
+ default:
+ NOTIF_NOTIMPL
+ break;
+ }
+ // We may be done with the current request, proceed to the next one
+ CheckNextOperationL();
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Handle a request for authorization of this connection.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::HandleAuthorizationReqL( const TDesC8& aParams )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ __ASSERT_ALWAYS( iCurrentOp == EIdle, PanicServer( EBTNotifPanicBadState ) );
+ __ASSERT_ALWAYS( !iNotification, PanicServer( EBTNotifPanicCorrupt ) );
+ TBTAuthorisationParams params;
+ TPckgC<TBTAuthorisationParams> paramsPckg( params );
+ paramsPckg.Set( aParams );
+ iCurrentOp = EAuthorizing;
+ // The name in the parameter package is the latest one, retrieved from
+ // the remote device during this connection.
+ if( paramsPckg().iName.Length() )
+ {
+ // Update the local device record. No need to update the registry,
+ // that will be done by the stack, and we will receive the update
+ // information when that has completed.
+ iDevice->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( paramsPckg().iName ) );
+ }
+ PrepareNotificationL( TBluetoothDialogParams::EQuery, EAuthorization );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process the user input and complete the outstanding authorization request.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CompleteAuthorizationReqL( TInt aError, const TDesC8& aData )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // Set our state to idle for now. This may get changed if the user just chose
+ // to block, or if we have a pending request.
+ iCurrentOp = EIdle;
+ if( !aError )
+ {
+ TPckgC<TBool> result( EFalse );
+ result.Set( aData );
+ TBool proceed = iTracker->UpdateBlockingHistoryL( iDevice, result() );
+ if( result() == EFalse && proceed )
+ {
+ // The user denied the connection, ask to block the device.
+ LaunchBlockingQueryL();
+ }
+ CompleteClientRequest( KErrNone, aData );
+ }
+ else
+ {
+ CompleteClientRequest( aError, KNullDesC8 );
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process the user input for blocking a device.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnection::CompleteBlockingReqL( TInt aError, const TDesC8& aData )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ TPckgC<TBool> result( EFalse );
+ result.Set( KNullDesC8 ); // to test!
+ result.Set( aData );
+ iCurrentOp = EIdle; // May get changed if we have a pending request.
+ if( !aError && result() )
+ {
+ // The user accepted to block this device.
+ TBTDeviceSecurity sec; // use default values when setting as banned.
+ sec.SetBanned( ETrue );
+ iDevice->SetGlobalSecurity( sec );
+ if( iDevice->IsValidPaired() && iDevice->IsPaired() )
+ {
+ // Deleting the link key will also set the device as unpaired.
+ iDevice->DeleteLinkKey();
+ }
+ UpdateRegistryEntryL();
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifconnectiontracker.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,721 @@
+/*
+* ============================================================================
+* Name : btnotifconnectiontracker.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Bluetooth connection tracker and manager.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifconnectiontracker.h"
+#include <btextnotifiers.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <btextnotifierspartner.h>
+#endif
+
+#include "btnotifconnection.h"
+#include "btnotifsession.h"
+#include "btnotifclientserver.h"
+#include "bluetoothtrace.h"
+
+/** Id for the link key watcher active object. */
+const TInt KLinkCountWatcher = 30;
+/** Id for the pairing result watcher active object. */
+const TInt KSspResultWatcher = 31;
+/** Id for the registry watcher active object (TEMP!). */
+const TInt KRegistryWatcher = 41;
+/** Time window for determining if there are too many requests. */
+#ifndef __WINS__
+#define KDENYTHRESHOLD TTimeIntervalSeconds(3)
+#else //__WINS__
+#define KDENYTHRESHOLD TTimeIntervalSeconds(5)
+#endif //__WINS__
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Checks if the notifier is one launched by the security manager of the
+// protocol stack. These notifiers need to be served unless really not possible.
+// ---------------------------------------------------------------------------
+//
+TBool IsStackSecmanNotifier( TInt aUid )
+ {
+ TBool result = EFalse;
+ if( aUid == KBTManAuthNotifierUid.iUid || aUid == KBTManPinNotifierUid.iUid ||
+ aUid == KBTPinCodeEntryNotifierUid.iUid || aUid == KBTNumericComparisonNotifierUid.iUid ||
+ aUid == KBTPasskeyDisplayNotifierUid.iUid )
+ {
+ result = ETrue;
+ }
+ return result;
+ }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnectionTracker::CBTNotifConnectionTracker( CBTNotifServer* aServer )
+: iServer( aServer )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::ConstructL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // Start watching the number of baseband links.
+ TInt err = iLinkCount.Attach( KPropertyUidBluetoothCategory,
+ KPropertyKeyBluetoothGetPHYCount );
+ // There is not much point to continue if we can't attach to
+ // the link count key.
+ User::LeaveIfError( err );
+ iLinkCountActive = CBtSimpleActive::NewL( *this, KLinkCountWatcher );
+ iLinkCount.Subscribe( iLinkCountActive->RequestStatus() );
+ iLinkCountActive->GoActive();
+ // Open a handle to the registry server
+ User::LeaveIfError( iBTRegistrySession.Connect() );
+ // Open a handle to the socket server
+ User::LeaveIfError( iSockServ.Connect() );
+ iPairingServ = new( ELeave ) RBluetoothPairingServer();
+ if( iPairingServ->Connect() )
+ {
+ // Delete in case of error - there is no good other way to keep track.
+ delete iPairingServ;
+ iPairingServ = NULL;
+ }
+ else
+ {
+ iSspResultActive = CBtSimpleActive::NewL( *this, KSspResultWatcher );
+ User::LeaveIfError( iSspResultSession.Open( *iPairingServ ) );
+ iSspResultSession.SimplePairingResult( iSspResultAddr, iSspResultActive->RequestStatus() );
+ iSspResultActive->GoActive();
+ }
+ iConnMan = CBTEngConnMan::NewL( this );
+ iPhyLinks = CBluetoothPhysicalLinks::NewL( *this, iSockServ );
+// ToDo: remove this when registry notifications API is available!!
+ err = iRegistryChange.Attach( KPropertyUidBluetoothCategory, KPropertyKeyBluetoothRegistryTableChange );
+ User::LeaveIfError( err );
+ iRegistryActive = CBtSimpleActive::NewL( *this, KRegistryWatcher );
+ iRegistryChange.Subscribe( iRegistryActive->RequestStatus() );
+ iRegistryActive->GoActive();
+// End ToDo
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewL.
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnectionTracker* CBTNotifConnectionTracker::NewL( CBTNotifServer* aServer )
+ {
+ CBTNotifConnectionTracker* self = new( ELeave ) CBTNotifConnectionTracker( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnectionTracker::~CBTNotifConnectionTracker()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ iConnArray.ResetAndDestroy();
+ iConnArray.Close();
+ iDeniedRequests.Close();
+ delete iLinkCountActive;
+ iLinkCount.Close();
+
+ delete iConnMan;
+ delete iPhyLinks;
+ iSockServ.Close();
+ delete iSspResultActive;
+ iSspResultSession.Close();
+ if( iPairingServ )
+ {
+ iPairingServ->Close();
+ delete iPairingServ;
+ }
+ delete iRegistryActive;
+ iRegistryChange.Close();
+ iBTRegistrySession.Close();
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+// ---------------------------------------------------------------------------
+// Process a client message related to notifiers.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::DispatchNotifierMessageL( const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() );
+ TInt opcode = aMessage.Function();
+ TInt uid = aMessage.Int0();
+ const RMessage2* message = &aMessage;
+ // Use a pointer to the original message, so that we don't duplicate it.
+ // Then we avoid any bookkeeping for keeping them in sync.
+ if( opcode == EBTNotifCancelNotifier )
+ {
+ // We only accept a cancel message from the same session as the original
+ // request (this is enforced by the RNotifier backend). So we use the
+ // session of the cancel request (if this would change, the same way as
+ // for updates can be followed).
+ // We need to find the original request to identify the handler of the
+ // connection; the uid points to the original request.
+ message = ( (CBTNotifSession *) aMessage.Session() )->FindMessageFromUid( uid );
+ }
+ else if( opcode == EBTNotifUpdateNotifier )
+ {
+ // We accept a update messages from any client, although in practice,
+ // they will all come from the same session (through RNotifier).
+ // We need to find the original request to identify the handler of the
+ // connection (the uid points to the original request). Through the
+ // server, we get it from any session.
+ message = iServer->FindMessageFromUid( uid );
+ }
+ if( !message )
+ {
+ // It's hard to continue if we don't know where to route the message.
+ User::Leave( KErrDisconnected );
+ }
+ TBuf8<0x250> paramsBuf; // Size needs to be long enough to read all possible parameter sizes.
+ CBTNotifConnection* connection = FindConnectionFromMessageL( opcode, *message, paramsBuf );
+ if( !connection )
+ {
+ User::Leave( KErrDisconnected );
+ }
+ switch( opcode )
+ {
+ case EBTNotifStartSyncNotifier:
+ case EBTNotifStartAsyncNotifier:
+ connection->HandleNotifierRequestL( paramsBuf, aMessage );
+ break;
+ case EBTNotifUpdateNotifier:
+ connection->HandleNotifierUpdateL( paramsBuf, aMessage );
+ break;
+ case EBTNotifCancelNotifier:
+ // Complete the cancel message already here, so that the caller can
+ // continue, and the next operation can close sessions with the caller.
+ aMessage.Complete( KErrNone );
+ connection->CancelNotifierRequestL( *message );
+ break;
+ default:
+ break;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Handle a request related to pairing.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::HandleBondingRequestL( const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() );
+ // Bonding is an infrequently occurring operation, so we don't waste memory
+ // to keep a copy of the parameters. Instead we read them again when needed.
+ TPckgBuf<TBTDevAddr> addrBuf;
+ TInt opcode = aMessage.Function();
+ if( opcode == EBTEngPairDevice )
+ {
+ aMessage.ReadL( EBTNotifSrvParamSlot, addrBuf );
+ }
+ else if( opcode == EBTEngCancelPairDevice )
+ {
+ const RMessage2* message =
+ ( (CBTNotifSession *) aMessage.Session() )->FindMessageFromUid( EBTEngPairDevice );
+ message->ReadL( EBTNotifSrvParamSlot, addrBuf );
+ }
+ BtTraceBtAddr1( TRACE_DEBUG, DUMMY_LIST, "CBTNotifConnectionTracker::HandleBondingRequestL() addr=", addrBuf() );
+ TInt err = KErrNotFound;
+ CBTNotifConnection* connection = FindConnectionHandler( addrBuf() );
+ if( opcode == EBTEngPairDevice )
+ {
+ if( !connection )
+ {
+ // Create a connection first, then tell it to bond.
+ err = iPhyLinks->CreateConnection( addrBuf() );
+ connection = CBTNotifConnection::NewLC( addrBuf(), this );
+ iConnArray.AppendL( connection );
+ CleanupStack::Pop( connection );
+ }
+ else
+ {
+ // There is an existing connection. Care must be taken, the connection
+ // _should_ be disconnect first if this device is already paired, so that
+ // we are sure that we don't mix up the state of the connection.
+ RBTPhysicalLinkAdapter link;
+ err = link.Open( iSockServ, addrBuf() );
+ TUint32 linkState = 0;
+ if( !err )
+ {
+ err = link.PhysicalLinkState( linkState );
+ }
+ if( !err && linkState & ( ENotifyAuthenticationComplete | ENotifyEncryptionChangeOn ) )
+ {
+ // For now, we just reject the request.
+ err = KErrAlreadyExists;
+ }
+ link.Close();
+ }
+ if( !err )
+ {
+ // Start bonding immediately so that the connection object is in the right state.
+ connection->StartBondingL( aMessage );
+ }
+ }
+ else if( opcode == EBTEngCancelPairDevice && connection )
+ {
+ connection->CancelBondingL();
+ err = KErrNone;
+ aMessage.Complete( err );
+ }
+ // KErrNotFound is returned for a request to cancel pairing that has no connection.
+ if( err )
+ {
+ aMessage.Complete( err );
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Handle a change in the number of connections.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::HandleLinkCountChangeL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ TInt linkCount = 0;
+ User::LeaveIfError( iLinkCount.Get( linkCount ) );
+ if( linkCount )
+ {
+ RBTDevAddrArray links;
+ CleanupClosePushL( links );
+ User::LeaveIfError( iPhyLinks->Enumerate( links, 10 ) );
+ __ASSERT_ALWAYS( links.Count(), PanicServer( EBTNotifPanicBadState ) );
+ for( TInt i = iConnArray.Count() -1; i >= 0 ; i-- )
+ {
+ // Loop backwards, as we may remove entries from the array.
+
+ // First check the existing connections, and
+ // remove disconnected links
+ TBTDevAddr addr = iConnArray[i]->Address();
+ TInt pos = links.Find( addr );
+ if( pos > KErrNotFound )
+ {
+ // The link we know is still connected,
+ // remove the watceher from the array.
+ links.Remove( pos );
+ // ToDo: see comment below!
+ }
+ else if( iConnArray[i]->CurrentOperation() == CBTNotifConnection::EIdle )
+ {
+ // This link is no more connected and idle, remove.
+ CBTNotifConnection* connection = iConnArray[i];
+ iConnArray.Remove( i ); // Does not delete the object.
+ delete connection;
+ }
+ // else we wait for the link to complete its operations.
+ }
+ // Now we have an array with only the new connections.
+ // Add new watchers.
+ for( TInt i = 0; i < links.Count(); i++ )
+ {
+ CBTNotifConnection* connection = CBTNotifConnection::NewLC( links[i], this );
+ iConnArray.AppendL( connection );
+ CleanupStack::Pop( connection );
+ }
+ // Close the links RBTDevAddrArray, needed before going out of scope.
+ CleanupStack::PopAndDestroy();
+ }
+ else
+ {
+ for( TInt i = iConnArray.Count() -1; i >= 0 ; i-- )
+ {
+ if( iConnArray[i]->CurrentOperation() == CBTNotifConnection::EIdle )
+ {
+ // This link is now idle, so we can remove it safely.
+ CBTNotifConnection* connection = iConnArray[i];
+ iConnArray.Remove( i ); // Does not delete the object.
+ delete connection;
+ }
+ }
+ if( !iConnArray.Count() )
+ {
+ // The array is idle, clean up the array resources.
+ iConnArray.Reset();
+ }
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Check if this device has been denied a connection already before.
+// Also check if a previous connection attempt has just been rejected.
+// ---------------------------------------------------------------------------
+//
+TBool CBTNotifConnectionTracker::UpdateBlockingHistoryL( const CBTDevice* aDevice,
+ TBool aAccepted )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ __ASSERT_ALWAYS( aDevice, PanicServer( EBTNotifPanicBadArgument ) );
+ // Check the time since the previous event.
+ TBool result = RecordConnectionAttempts( aAccepted );
+ TInt pos = iDeniedRequests.Find( aDevice->BDAddr() );
+ if( !aAccepted )
+ {
+ if( pos == KErrNotFound )
+ {
+ // The user denied the request from a new device, record the device address.
+ if( aDevice->IsValidPaired() && aDevice->IsPaired() )
+ //[MCL]: && iDevice->LinkKeyType() != ELinkKeyUnauthenticatedUpgradable )
+ {
+ // Paired devices are allowed one time rejection without a prompt for blocking.
+ result = EFalse;
+ }
+ iDeniedRequests.AppendL( aDevice->BDAddr() );
+ }
+ // Nothing needed here if the address is already in the array.
+ }
+ else if( pos > KErrNotFound )
+ {
+ // The user accepted a request, and it was from a device he/she
+ // previously rejected. Clear the history for this device from the array.
+ iDeniedRequests.Remove( pos );
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ return result;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBluetoothPhysicalLinksNotifier.
+// Handle baseband connection completion.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::HandleCreateConnectionCompleteL( TInt aErr )
+ {
+ BOstraceFunctionEntryExt ( DUMMY_LIST, this, aErr );
+ // We only connect links for starting outgoing bonding.
+ const RMessage2* message = iServer->FindMessageFromUid( (TInt) EBTEngPairDevice );
+ if( message )
+ {
+ TPckgBuf<TBTDevAddr> addrBuf;
+ message->ReadL( EBTNotifSrvParamSlot, addrBuf );
+ CBTNotifConnection* connection = FindConnectionHandler( addrBuf() );
+ __ASSERT_ALWAYS( connection, PanicServer( EBTNotifPanicBadState ) );
+ if( !aErr && connection->CurrentOperation() == CBTNotifConnection::EIdle )
+ {
+ TRAP( aErr, connection->StartBondingL( *message ) );
+ }
+ if( aErr && connection->CurrentOperation() == CBTNotifConnection::EBonding )
+ {
+ connection->PairingResult( aErr ); // Launch error note
+ }
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBluetoothPhysicalLinksNotifier.
+// Handle baseband disconnection.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::HandleDisconnectCompleteL( TInt aErr )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // We only disconnect links for starting outgoing bonding.
+ const RMessage2* message = iServer->FindMessageFromUid( (TInt) EBTEngPairDevice );
+ if( message )
+ {
+ TPckgBuf<TBTDevAddr> addrBuf;
+ message->ReadL( EBTNotifSrvParamSlot, addrBuf );
+ if( !aErr )
+ {
+ aErr = iPhyLinks->CreateConnection( addrBuf() );
+ }
+ if( aErr )
+ {
+ iServer->CompleteMessage( message->Handle(), aErr, KNullDesC8 );
+ CBTNotifConnection* connection = FindConnectionHandler( addrBuf() );
+ __ASSERT_ALWAYS( connection, PanicServer( EBTNotifPanicBadState ) );
+ connection->PairingResult( aErr ); // Launch error note
+ }
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBluetoothPhysicalLinksNotifier.
+// Handle disconnection of all links.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::HandleDisconnectAllCompleteL( TInt aErr )
+ {
+ (void) aErr;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTEngConnObserver.
+// Handle service-level connection completion.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::ConnectComplete( TBTDevAddr& aAddr,
+ TInt aErr, RBTDevAddrArray* aConflicts )
+ {
+ (void) aAddr;
+ (void) aErr;
+ (void) aConflicts;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTEngConnObserver.
+// Handle service-level disconnection.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr )
+ {
+ (void) aAddr;
+ (void) aErr;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Handle the active object completion.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::RequestCompletedL( CBtSimpleActive* aActive,
+ TInt aStatus )
+ {
+ BOstraceFunctionEntryExt ( DUMMY_LIST, this, aActive->RequestId() );
+ BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST,
+ "CBTNotifConnectionTracker::MBAORequestCompletedL() requestid=%d status=%d",
+ aActive->RequestId(), aStatus);
+ if( aActive->RequestId() == KLinkCountWatcher )
+ {
+ iLinkCount.Subscribe( aActive->RequestStatus() );
+ aActive->GoActive();
+ if( !aStatus )
+ {
+ // HandleLinkCountChangeL();
+ }
+ }
+// ToDo: remove this when registry notifications API is available!!
+ else if( aActive->RequestId() == KRegistryWatcher )
+ {
+ // BTRegistry notifies of a change. Check which one.
+ iRegistryChange.Subscribe( aActive->RequestStatus() );
+ aActive->GoActive();
+ TInt tableChanged = 0;
+ if( !aStatus && !iRegistryChange.Get( tableChanged ) &&
+ tableChanged == KRegistryChangeRemoteTable )
+ {
+ // A record for a remote device has changed. Tell all
+ // connections to update their record.
+ for( TInt i = 0; i < iConnArray.Count(); i++ )
+ {
+ // Reuse the functionality in the connection
+ if( iConnArray[i]->CurrentOperation() < CBTNotifConnection::EReadingRegistry )
+ {
+ iConnArray[i]->RequestCompletedL( aActive, aStatus );
+ }
+ }
+ }
+ }
+// End ToDo
+ else if( aActive->RequestId() == KSspResultWatcher )
+ {
+ iSspResultSession.SimplePairingResult( iSspResultAddr, iSspResultActive->RequestStatus() );
+ iSspResultActive->GoActive();
+ CBTNotifConnection* connection = FindConnectionHandler( iSspResultAddr );
+ // ToDo: how to handle a result of a link that already disconnected?
+ if( connection )
+ {
+ connection->PairingResult( aStatus );
+ }
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Cancel and clean up all requests related to the active object.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::CancelRequest( TInt aRequestId )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( aRequestId == KLinkCountWatcher )
+ {
+ iLinkCount.Cancel();
+ }
+ else if( aRequestId == KSspResultWatcher )
+ {
+ iSspResultSession.CancelSimplePairingResult();
+ }
+ else if ( aRequestId == KRegistryWatcher )
+ {
+ iRegistryChange.Cancel();
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifConnectionTracker::HandleError( CBtSimpleActive* aActive,
+ TInt aError )
+ {
+ (void) aActive;
+ (void) aError;
+ }
+
+// ---------------------------------------------------------------------------
+// Parse the details from a client message and find the associated handler.
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnection* CBTNotifConnectionTracker::FindConnectionFromMessageL(
+ TInt aOpcode, const RMessage2& aMessage, TDes8& aBuffer )
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ TInt uid = aMessage.Int0();
+ aMessage.ReadL( EBTNotifSrvParamSlot, aBuffer );
+ TBTDevAddr addr = ParseAddressL( uid, aBuffer );
+ // If this is a
+ CBTNotifConnection* connection = FindConnectionHandler( addr );
+ if( !connection && IsStackSecmanNotifier( uid ) &&
+ ( aOpcode == EBTNotifStartAsyncNotifier || aOpcode == EBTNotifStartSyncNotifier ) )
+ {
+ // A notifier from stack. This happens if e.g. the pairing
+ // request comes in before the link count changes (like security
+ // mode 3). Create the handler and queue the request.
+ // And note that
+ connection = CBTNotifConnection::NewLC( addr, this );
+ iConnArray.AppendL( connection );
+ CleanupStack::Pop( connection );
+ }
+ BOstraceFunctionExitExt( DUMMY_DEVLIST, this, connection );
+ return connection;
+ }
+
+
+// ---------------------------------------------------------------------------
+// read the address from a client message.
+// ---------------------------------------------------------------------------
+//
+TBTDevAddr CBTNotifConnectionTracker::ParseAddressL( TInt aUid,
+ const TDesC8& aParamsBuf ) const
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ TBTDevAddr addr;
+ if( IsStackSecmanNotifier( aUid ) )
+ {
+ // For all these, the address is the first data member,
+ // so can be read using the TBTNotifierParams data structure.
+ TBTNotifierParams params;
+ TPckgC<TBTNotifierParams> paramsPckg( params );
+ paramsPckg.Set( aParamsBuf );
+ addr = paramsPckg().iBDAddr;
+ }
+ //else if( ) other notifier types
+ BOstraceFunctionExitExt( DUMMY_DEVLIST, this, &addr );
+ return addr;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Find a specific connection.
+// ---------------------------------------------------------------------------
+//
+CBTNotifConnection* CBTNotifConnectionTracker::FindConnectionHandler(
+ const TBTDevAddr& aAddr ) const
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ CBTNotifConnection* conn = NULL;
+ if( aAddr != TBTDevAddr() )
+ {
+ // This may be replaced by RArray::Find with appropriate key
+ for( TInt i = 0; i < iConnArray.Count(); i++ )
+ {
+ if( iConnArray[i]->Address() == aAddr )
+ {
+ conn = iConnArray[i];
+ break;
+ }
+ }
+ }
+ BOstraceFunctionExitExt( DUMMY_DEVLIST, this, conn );
+ return conn;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Record and check the time between connection attempts.
+// ---------------------------------------------------------------------------
+//
+TBool CBTNotifConnectionTracker::RecordConnectionAttempts( TBool aAccepted )
+ {
+ BOstraceFunctionEntry1( DUMMY_DEVLIST, this );
+ TBool result = ETrue;
+ TTime now( 0 );
+ if( !aAccepted )
+ {
+ now.UniversalTime();
+ if( iLastReject )
+ {
+ // Check the time between denied connections, that it does not go too fast.
+ TTimeIntervalSeconds prev( 0 );
+ if( !now.SecondsFrom( TTime( iLastReject ), prev ) )
+ {
+ if( prev <= KDENYTHRESHOLD )
+ {
+ // We are getting the requests too fast. Present the user with
+ // an option to turn BT off.
+ //iServer->SettingsTracker()->SetPower( EFalse );
+ result = EFalse;
+ }
+ }
+ }
+ }
+ // Record the current timestamp.
+ // It is reset in case the user accepted the request.
+ iLastReject = now.Int64();
+ BOstraceFunctionExitExt( DUMMY_DEVLIST, this, result );
+ return result;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifdeviceselector.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <btextnotifiers.h>
+#include <btservices/advancedevdiscoverer.h>
+#include <btservices/btdevextension.h>
+#include <hb/hbcore/hbdevicedialogsymbian.h>
+#include <hb/hbcore/hbsymbianvariant.h>
+#include "btnotifdeviceselector.h"
+
+#include "btnotifserver.h"
+#include "btnotificationmanager.h"
+#include "btnotifclientserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifDeviceSelector::CBTNotifDeviceSelector( CBTNotifServer& aServer )
+: iServer( aServer )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::ConstructL()
+ {
+ iDiscoverer = CAdvanceDevDiscoverer::NewL( iServer.DevRepository(), *this );
+ }
+
+// ---------------------------------------------------------------------------
+// NewL.
+// ---------------------------------------------------------------------------
+//
+CBTNotifDeviceSelector* CBTNotifDeviceSelector::NewL( CBTNotifServer& aServer )
+ {
+ CBTNotifDeviceSelector* self = new( ELeave ) CBTNotifDeviceSelector( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifDeviceSelector::~CBTNotifDeviceSelector()
+ {
+ if( iNotification )
+ {
+ // Clear the notification callback, we cannot receive them anymore.
+ iNotification->RemoveObserver();
+ iNotification->Close(); // Also dequeues the notification from the queue.
+ iNotification = NULL;
+ }
+ iDevices.ResetAndDestroy();
+ iDevices.Close();
+ delete iDiscoverer;
+ }
+
+// ---------------------------------------------------------------------------
+// Process a client message related to notifiers.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::DispatchNotifierMessageL( const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntryExt ( DUMMY_LIST, this, aMessage.Function() );
+ TInt opcode = aMessage.Function();
+ TInt uid = aMessage.Int0();
+ switch ( opcode )
+ {
+ case EBTNotifCancelNotifier:
+ {
+ // We only accept a cancel message from the same session as the original
+ // request (this is enforced by the RNotifier backend).
+ TInt err( KErrNotFound );
+ if ( !iMessage.IsNull() && opcode == iMessage.Function() &&
+ aMessage.Session() == iMessage.Session() )
+ {
+ iMessage.Complete( KErrCancel );
+ err = KErrNone;
+ }
+ aMessage.Complete( err );
+ break;
+ }
+ case EBTNotifUpdateNotifier:
+ {
+ // not handling so far
+ break;
+ }
+ case EBTNotifStartSyncNotifier:
+ {
+ // synch version of device searching is not supported:
+ aMessage.Complete( KErrNotSupported );
+ break;
+ }
+ case EBTNotifStartAsyncNotifier:
+ {
+ if ( !iMessage.IsNull() )
+ {
+ aMessage.Complete( KErrServerBusy );
+ return;
+ }
+ PrepareNotificationL(TBluetoothDialogParams::EDeviceSearch, ENoResource);
+ iDevices.ResetAndDestroy();
+ iDiscoverer->DiscoverDeviceL();
+ iMessage = aMessage;
+ break;
+ }
+ default:
+ {
+ aMessage.Complete( KErrNotSupported );
+ }
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancels an outstanding client message related to notifiers.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::CancelNotifierMessageL( const RMessage2& aMessage )
+ {
+ (void) aMessage;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// Handle a result from a user query.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::MBRDataReceived( CHbSymbianVariantMap& aData )
+ {
+ TInt err = KErrCancel;
+// const CHbSymbianVariant* value = aData.Get(_L("selectedindex"));
+ if(aData.Keys().MdcaPoint(0).Compare(_L("selectedindex"))==KErrNone)
+ {
+ TInt val = *(static_cast<TInt*>(aData.Get(_L("selectedindex"))->Data()));
+ BOstrace1( TRACE_DEBUG, TNAME_DEVLIST_2, "MBRDataReceived, val %d", val );
+
+ if ( !iMessage.IsNull() )
+ {
+ // TInt sel = val;// - TBluetoothDialogParams::EDialogExt;
+ TBTDeviceResponseParamsPckg devParams;
+ if ( val > -1 && val < iDevices.Count() )
+ {
+ devParams().SetDeviceAddress( iDevices[val]->Addr() );
+ err = iMessage.Write( EBTNotifSrvReplySlot, devParams );
+ }
+ iMessage.Complete( err );
+ }
+
+ iDiscoverer->CancelDiscovery();
+ }
+ else if(aData.Keys().MdcaPoint(0).Compare(_L("Stop"))==KErrNone)
+ {
+ iDiscoverer->CancelDiscovery();
+ }
+ else if(aData.Keys().MdcaPoint(0).Compare(_L("Retry"))==KErrNone)
+ {
+ iDiscoverer->CancelDiscovery();
+ iDevices.ResetAndDestroy();
+ delete iDiscoverer;
+ iDiscoverer = NULL;
+ iDiscoverer = CAdvanceDevDiscoverer::NewL( iServer.DevRepository(), *this );
+ iDiscoverer->DiscoverDeviceL();
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// The notification is finished.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::MBRNotificationClosed( TInt aError, const TDesC8& aData )
+ {
+ (void) aError;
+ (void) aData;
+ iNotification->RemoveObserver();
+ iNotification = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// HandleNextDiscoveryResultL
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::HandleNextDiscoveryResultL(
+ const TInquirySockAddr& aAddr, const TDesC& aName )
+ {
+ // Todo: look for this device in repository before creating it.
+ CBtDevExtension* devext = CBtDevExtension::NewLC( aAddr, aName );
+ iDevices.AppendL( devext );
+ CleanupStack::Pop( devext );
+ CHbSymbianVariantMap* map = iNotification->Data();
+ TBuf<8> keyStr;
+ CHbSymbianVariant* devEntry;
+
+ keyStr.Num( TBluetoothDialogParams::EDialogExt + iDevices.Count() - 1 );
+ devEntry = CHbSymbianVariant::NewL( (TAny*) &(devext->Alias()),
+ CHbSymbianVariant::EDes );
+ map->Add( keyStr, devEntry );
+ iNotification->Update();
+ }
+
+// ---------------------------------------------------------------------------
+// HandleDiscoveryCompleted
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::HandleDiscoveryCompleted( TInt aErr )
+ {
+ (void) aErr;
+ // todo: update dialog
+ }
+
+// ---------------------------------------------------------------------------
+// Get and configure a notification.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifDeviceSelector::PrepareNotificationL(
+ TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ iNotification = iServer.NotificationManager()->GetNotification();
+ User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory
+ iNotification->SetObserver( this );
+ iNotification->SetNotificationType( aType, aResourceId );
+
+ /*
+ _LIT(KTitleValue, "BT Search");
+ TPtrC ptr;
+ ptr.Set( KTitleValue );
+ iNotification->SetData( TBluetoothDialogParams::EDialogTitle, ptr );
+ */
+
+ /*err = */ iServer.NotificationManager()->QueueNotification( iNotification );
+ //NOTIF_NOTHANDLED( !err )
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotificationmanager.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,202 @@
+/*
+* ============================================================================
+* Name : btnotificationmanager.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Class for managing user notification and query objects, and for serializing access to the notification server.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotificationmanager.h"
+#include "btnotifserver.h"
+
+#include "bluetoothnotification.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotificationManager::CBTNotificationManager( const CBTNotifServer* aServer )
+: iServer( aServer )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotificationManager::ConstructL()
+ {
+ iAsyncCb = new( ELeave ) CAsyncCallBack( iServer->Priority() );
+ TCallBack cb( AsyncCallback, this );
+ iAsyncCb->Set( cb );
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewL.
+// ---------------------------------------------------------------------------
+//
+CBTNotificationManager* CBTNotificationManager::NewL( const CBTNotifServer* aServer )
+ {
+ CBTNotificationManager* self = new( ELeave ) CBTNotificationManager( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotificationManager::~CBTNotificationManager()
+ {
+ iNotificationQ.ResetAndDestroy();
+ iNotificationQ.Close();
+ iUnusedQ.ResetAndDestroy();
+ iUnusedQ.Close();
+ delete iAsyncCb;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Get a new notification
+// ---------------------------------------------------------------------------
+//
+CBluetoothNotification* CBTNotificationManager::GetNotification()
+ {
+ CBluetoothNotification* notification = NULL;
+ if( iUnusedQ.Count() )
+ {
+ // Re-use the first idle notification.
+ notification = iUnusedQ[0];
+ iUnusedQ.Remove( 0 );
+ }
+ else
+ {
+ TRAP_IGNORE( notification = CBluetoothNotification::NewL( this ) );
+ }
+ if( notification )
+ {
+ if( iNotificationQ.Append( notification ) )
+ {
+ // In case the appending fails, we just delete the notification.
+ // Otherwise we cannot keep track of it anymore.
+ delete notification;
+ notification = NULL;
+ }
+ }
+ return notification;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Release the notification
+// ---------------------------------------------------------------------------
+//
+void CBTNotificationManager::ReleaseNotification( CBluetoothNotification* aNotification )
+ {
+ __ASSERT_ALWAYS( aNotification, PanicServer( EBTNotifPanicBadArgument ) );
+ TInt pos = iNotificationQ.Find( aNotification );
+ __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) );
+ // ToDo: Cancel outstanding notification!
+ iNotificationQ.Remove( pos );
+ TInt err = iUnusedQ.Append( aNotification );
+ aNotification->Reset(); // Clean up notification's resources
+ if( err )
+ {
+ // Just delete the notification.
+ delete aNotification;
+ }
+ if( !iAsyncCb->IsActive() )
+ {
+ if( !iNotificationQ.Count() )
+ {
+ // Set the priority so that this is the last scheduled active object to execute.
+ iAsyncCb->SetPriority( CActive::EPriorityIdle );
+ }
+ iAsyncCb->CallBack();
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Queue the notification with given priority
+// ---------------------------------------------------------------------------
+//
+TInt CBTNotificationManager::QueueNotification( CBluetoothNotification* aNotification,
+ TNotificationPriority aPriority )
+ {
+ TInt pos = iNotificationQ.Find( aNotification );
+ __ASSERT_ALWAYS( pos > KErrNotFound, PanicServer( EBTNotifPanicMissing ) );
+ if( aPriority == EPriorityHigh && pos != 0 )
+ {
+ // ToDo: Move the note to the front of the queue
+ }
+ if( !iAsyncCb->IsActive() )
+ {
+ if( iAsyncCb->Priority() != iServer->Priority() )
+ {
+ // Reset priority back to original value
+ // We first check the current priority, otherwise CActive will do an
+ // unnecessary removal and adding of the callback from the active scheduler.
+ iAsyncCb->SetPriority( iServer->Priority() );
+ }
+ iAsyncCb->CallBack();
+ }
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process the notification queue and launch the next notification.
+// ---------------------------------------------------------------------------
+//
+void CBTNotificationManager::ProcessNotificationQueueL()
+ {
+ if( iNotificationQ.Count() )
+ {
+ TInt err = iNotificationQ[0]->Show();
+ // If the note is already showing, it will return KErrAlreadyExists
+ (void) err; // ToDo: add error handling!!
+ NOTIF_NOTHANDLED( !err || err == KErrAlreadyExists || err == KErrNotFound )
+ }
+ else
+ {
+ // No outstanding notifications, and unused notifications.
+ // Clean up the unused notifications.
+ iUnusedQ.ResetAndDestroy();
+ iNotificationQ.Reset(); // the queue is empty, reset it.
+ // Also clean up any resources.
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Callback for asynchronous processing of queued notification requests.
+// ---------------------------------------------------------------------------
+//
+TInt CBTNotificationManager::AsyncCallback( TAny* aPtr )
+ {
+ TRAPD( err, ( (CBTNotificationManager*) aPtr )->ProcessNotificationQueueL() );
+ return err;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifpairinghelper.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,958 @@
+/*
+* ============================================================================
+* Name : btnotifpairinghelper.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Helper class for processing pairing requests and results, as extended functionality for CBTNotifConnection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifpairinghelper.h"
+#include <bt_sock.h>
+#include <btextnotifiers.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <btextnotifierspartner.h>
+#endif
+
+#include "btnotifconnection.h"
+#include "btnotifconnectiontracker.h"
+#include "btnotificationmanager.h"
+#include "btnotifserver.h"
+#include "bluetoothtrace.h"
+
+/** Id for the active object for a dedicated bonding session. */
+const TInt KDedicatedBonding = 50;
+/** Length of the default PIN. */
+const TInt KDefaultPinLength = 4;
+/** Default PIN character. */
+const TText8 KDefaultPinValue = '0';
+/** Format syntax for numeric comparison value. */
+_LIT( KNumCompFormat, "%06u" );
+/** Format syntax for passkey display value. */
+_LIT( KPassKeyFormat, "%06u" );
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description
+// ---------------------------------------------------------------------------
+//
+/*?type ?function_name( ?arg_type ?arg,
+ ?arg_type ?arg )
+ {
+ }
+*/
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor.
+// ---------------------------------------------------------------------------
+//
+CBTNotifPairingHelper::CBTNotifPairingHelper( CBTNotifConnection* aConnection,
+ CBTNotifConnectionTracker* aTracker )
+: iConnection( aConnection ),
+ iTracker( aTracker )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::ConstructL()
+ {
+ if( iConnection )
+ {
+ iDevice = iConnection->BTDevice();
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CBTNotifPairingHelper* CBTNotifPairingHelper::NewL( CBTNotifConnection* aConnection,
+ CBTNotifConnectionTracker* aTracker )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ CBTNotifPairingHelper* self = new( ELeave ) CBTNotifPairingHelper( aConnection, aTracker );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CBTNotifPairingHelper::~CBTNotifPairingHelper()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( iNotification )
+ {
+ // Clear the notification callback, we cannot receive them anymore.
+ iNotification->RemoveObserver();
+ iNotification->Close(); // Also dequeues the notification from the queue.
+ iNotification = NULL;
+ }
+ delete iParams;
+ if( iBondingActive )
+ {
+ iBondingActive->Cancel(); // Will close subsession;
+ }
+ delete iBondingActive;
+ iBondingSession.Close();
+ iBondingSocket.Close();
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Handle the authentication result from the baseband. Show the result in a note.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::HandleAuthenticationCompleteL( TInt aError )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+ if( iOperation == EDedicatedBonding || iOperation == EAwaitingPairingResult ||
+ iOperation == EAutoPairing )
+ {
+ // Default case (aError == 0): Success, we are now paired.
+ TBTDialogResourceId resourceId = EPairingSuccess;
+ TBool autoPairing = ( iOperation == EAutoPairing ); // Remember the autopairing state
+ iOperation = EShowPairingSuccess;
+ if( aError && aError != KHCIErrorBase )
+ {
+ // Authentication failure, means pairing failed.
+ resourceId = EPairingFailure;
+ iOperation = EShowPairingFailure;
+ // Communicate the error now that we still remember it.
+ if( iDedicatedBonding )
+ {
+ if( autoPairing && aError == KHCIErrorBase - EAuthenticationFailure )
+ {
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifPairingHelper::HandleAuthenticationCompleteL: Autopairing failed, we need to try again.");
+ // Autopairing failed, we need to try again.
+ iOperation = EAutoPairing; // Reset back
+ resourceId = ENoResource;
+ }
+ CompleteBondingL( aError );
+ }
+ }
+ if( resourceId )
+ {
+ // Inform the user of the result.
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifPairingHelper::HandleAuthenticationCompleteL: pairing successful, inform user" );
+ PrepareNotificationL( TBluetoothDialogParams::EGlobalNotif, resourceId );
+ // MBRNotificationClosed will be called from this, which will
+ // check the next stage.
+ }
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Start a bonding operation with the remote device.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::StartBondingL( TInt aHandle )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aHandle );
+ __ASSERT_ALWAYS( iOperation == EIdle || iOperation == EDedicatedBonding
+ || iOperation == EAutoPairing, PanicServer( EBTNotifPanicBadState ) );
+ if( !iBondingActive )
+ {
+ iBondingActive = CBtSimpleActive::NewL( *this, KDedicatedBonding );
+ }
+ if( aHandle )
+ {
+ iDedicatedBonding = aHandle;
+ }
+ if( iOperation == EIdle )
+ {
+ iOperation = EDedicatedBonding;
+ }
+ if( iOperation == EDedicatedBonding && iTracker->PairingServerSession() )
+ {
+ if( !iBondingActive->IsActive() )
+ {
+ BtTraceBtAddr1( TRACE_DEBUG,DUMMY_LIST,"CBTNotifPairingHelper::StartBondingL()",iDevice->BDAddr() );
+ iBondingSession.Start( *iTracker->PairingServerSession(),
+ iDevice->BDAddr(), iBondingActive->RequestStatus() );
+ iBondingActive->GoActive();
+ }
+ }
+ else
+ {
+ // We are doing autopairing (or the unlikely situation that the pairing server is unavailable)
+ CompleteBondingL( KErrServerTerminated );
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this);
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancel an ongoing bonding operation with the remote device.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CancelBondingL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ if( iDedicatedBonding )
+ {
+ CompleteBondingL( KErrCancel ); // Closes sessions
+ if( iNotification )
+ {
+ // Cancel the outstanding user query
+ // This will also unregister us from the notification.
+ TInt err = iNotification->Close();
+ NOTIF_NOTHANDLED( !err )
+ iNotification = NULL;
+ }
+ if( iNotifierUid )
+ {
+ // Also finish up the notifier processing.
+ CompletePairingNotifierL( KErrCancel, EFalse, KNullDesC8 );
+ }
+ iOperation = EIdle;
+ iConnection->PairingCompleted(); // This may delete us.
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Handle a notifier request for pairing with the remote device of this connection.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::StartPairingNotifierL( TInt aUid, const TDesC8& aParams )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aUid );
+ if( iDevice->GlobalSecurity().Banned() && !iDedicatedBonding )
+ {
+ // ToDo: should this case actually be ignored, and presume that
+ // the caller will take care of unblocking the device?
+ iOperation = EIdle;
+ User::Leave( KErrAccessDenied );
+ }
+ // Store the parameters locally, we need them later again.
+ delete iParams;
+ iParams = NULL;
+ iParams = HBufC8::NewL( aParams.Length() );
+ *iParams = aParams;
+ iNotifierUid = aUid;
+
+ if( iDevice->IsValidPaired() && iDevice->IsPaired() )
+ {
+ // The device is still paired, we unpair it first.
+ // Deleting the link key will set the device as unpaired.
+ iDevice->DeleteLinkKey();
+ iOperation = EUnpairing; // So that parent state does not get changed.
+ iConnection->UpdateRegistryEntryL();
+ // Note that this will only be done before trying autopairing, so
+ // it not interfere with a second attempt;
+ }
+ // Update the device name
+ TBTPasskeyDisplayParams params; // Enough for reading the base class type parameter
+ TPckgC<TBTPasskeyDisplayParams> paramsPckg( params );
+ paramsPckg.Set( *iParams );
+ if( paramsPckg().DeviceName().Length() )
+ {
+ // The name in the parameter package is the latest one, retrieved from
+ // the remote device during this connection. Update locally.
+ iDevice->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( paramsPckg().DeviceName() ) );
+ }
+
+ TBool locallyInitiated = EFalse;
+ TBuf<8> numVal;
+ TBluetoothDialogParams::TBTDialogType dialog = TBluetoothDialogParams::EInvalidDialog;
+ TBTDialogResourceId resource = ENoResource;
+ // Read the notifier parameters (sets iOperation as well)
+ ParseNotifierReqParamsL( locallyInitiated, numVal, dialog, resource );
+ // If this is an incoming pairing, we first ask the user to accept it.
+ if( !locallyInitiated && !iDedicatedBonding )
+ {
+ // Ignore the initatior if we initiated bonding.
+ StartAcceptPairingQueryL(); // Overrides iOperation
+ }
+ else
+ {
+ __ASSERT_ALWAYS( resource != ENoResource, PanicServer( EBTNotifPanicBadState ) );
+ CheckAutoPairingL( locallyInitiated, numVal );
+ // CheckAutoPairingL sets
+ if( iOperation != EAutoPairing )
+ {
+ PrepareNotificationL( dialog, resource );
+ if( numVal.Length() )
+ {
+ TInt err = iNotification->SetData( TBluetoothDeviceDialog::EAdditionalDesc, numVal );
+ NOTIF_NOTHANDLED( !err )
+ }
+ }
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Update a notifier, update the outstanding dialog if the notifier request
+// is currently being served.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::UpdatePairingNotifierL( TInt aUid, const TDesC8& aParams )
+ {
+ (void) aUid;
+ TBTNotifierUpdateParams2 params; // Enough for reading the base class type parameter
+ TPckgC<TBTNotifierUpdateParams2> paramsPckg( params );
+ paramsPckg.Set( aParams );
+ if( paramsPckg().Type() == TBTNotifierUpdateParams2::EPasskeyDisplay )
+ {
+ // Paskey display update - keypress on remote device.
+ }
+ else
+ {
+ // name update
+ TBTDeviceNameUpdateParams nameUpdate;
+ TPckgC<TBTDeviceNameUpdateParams> nameUpdatePckg( nameUpdate );
+ nameUpdatePckg.Set( aParams );
+ // The result means result of conversion to unicode
+ if( !nameUpdatePckg().Result() )
+ {
+ // Only update locally, registry will update us with the same info later on.
+ iDevice->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( nameUpdatePckg().DeviceName() ) );
+ if( iNotification )
+ {
+ // Update the dialog with the new name. It is up to the dialog to
+ // determine the validity (in case another dialog is shown).
+ //iNotification->Update( )
+ }
+ }
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancel a request, dismiss the outstanding dialog if the notifier request
+// is currently being served.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CancelPairingNotifierL( TInt aUid )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // ToDo: we need to check that the UID and the outstanding notification
+ // type are matching?
+ if( iOperation > EIdle && iOperation < EPostPairingOperations && aUid == iNotifierUid &&
+ ( aUid == KBTPinCodeEntryNotifierUid.iUid ||
+ aUid == KBTNumericComparisonNotifierUid.iUid ||
+ aUid == KBTPasskeyDisplayNotifierUid.iUid ) )
+ {
+ if( iNotification )
+ {
+ // Cancel the user query
+ // This will also unregister us from the notification.
+ TInt err = iNotification->Close();
+ NOTIF_NOTHANDLED( !err )
+ iNotification = NULL;
+ }
+ iOperation = EIdle;
+ iNotifierUid = 0;
+ // We do not call pairing completed from here, our parent will
+ // check our status by itself, and may delete us.
+
+ // Any bonding requester needs to be informed though.
+ CancelBondingL();
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::StartJustWorksProcessingL()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CancelJustWorksProcessingL()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// Handle a result from a user query.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::MBRDataReceived( CHbSymbianVariantMap& aData )
+ {
+ (void) aData;
+ NOTIF_NOTIMPL
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// The notification is finished.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::MBRNotificationClosed( TInt aError, const TDesC8& aData )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+ // First unregister from the notification, so we can already get the next one.
+ iNotification->RemoveObserver();
+ iNotification = NULL;
+ TRAP_IGNORE( NotificationClosedL( aError, aData ) );
+ if( iOperation == EIdle )
+ {
+ // Any error has been communicated already.
+ iConnection->PairingCompleted(); // This may delete us.
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Handle the active object completion.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::RequestCompletedL( CBtSimpleActive* aActive,
+ TInt aStatus )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ switch( aActive->RequestId() )
+ {
+ case KDedicatedBonding:
+ {
+ if( iDedicatedBonding )
+ {
+ // If the result hasn't been processed already.
+ HandleAuthenticationCompleteL( aStatus );
+ }
+ }
+ break;
+ default:
+ NOTIF_NOTIMPL
+ break;
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Cancel and clean up all requests related to the active object.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CancelRequest( TInt aRequestId )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ switch( aRequestId )
+ {
+ case KDedicatedBonding:
+ iBondingSession.Close();
+ break;
+ default:
+ NOTIF_NOTIMPL
+ break;
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::HandleError( CBtSimpleActive* aActive,
+ TInt aError )
+ {
+ (void) aActive;
+ (void) aError;
+ }
+
+// ---------------------------------------------------------------------------
+// Process the user input and complete the outstanding pairing request.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CompletePairingNotifierL( TInt aError, TBool aResult,
+ const TDesC8& aData )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+ TInt err = aError;
+ TPtrC8 resultData;
+ if( !err )
+ {
+ // The returned data is the entered passkey.
+ TBool proceed = iTracker->UpdateBlockingHistoryL( iDevice, aResult );
+ if( iOperation == ESspPairing && iNotifierUid == KBTNumericComparisonNotifierUid.iUid )
+ {
+ // Numeric comparison needs the boolean result passed back.
+ TPckgBuf<TBool> userAcceptance( aResult );
+ resultData.Set( userAcceptance );
+ }
+ if( aResult )
+ {
+ if( iOperation == ELegacyPairing || iOperation == EAutoPairing )
+ {
+ // Check the passkey entered by the user.
+ // The length of the returned data equals the number of characters
+ // entered by the user.
+ TBTPinCode pinCode;
+ pinCode().iLength = aData.Length();
+ TUint minLen = 0;
+ TBool locallyInitiated = EFalse; // Not used here.
+ ParsePinCodeReqParamsL( locallyInitiated, minLen );
+ if( aData.Length() >= minLen )
+ {
+ // Check that the length of the passkey meets the minimum
+ // required pin code length
+ for( TInt i = 0; i < aData.Length(); i++ )
+ {
+ pinCode().iPIN[i] = aData[i];
+ }
+ resultData.Set( pinCode );
+ }
+ else
+ {
+ // PIN wasn't long enough. This should be handled by the dialog though.
+ err = KErrCompletion;
+ }
+ }
+ // Now we just wait for the result to come in.
+ if( iOperation != EAutoPairing )
+ {
+ iOperation = EAwaitingPairingResult;
+ }
+ }
+ else
+ {
+ err = KErrCancel;
+ TBool locallyInitiated = EFalse; // Needed below
+ TBuf<8> numVal; // Not needed here.
+ TBluetoothDialogParams::TBTDialogType type = TBluetoothDialogParams::EInvalidDialog;
+ TBTDialogResourceId resource = ENoResource; // Resources and type are not needed here.
+ // Check the notifier parameters
+ ParseNotifierReqParamsL( locallyInitiated, numVal, type, resource );
+ if( proceed && locallyInitiated && !iDedicatedBonding )
+ {
+ // The user denied the connection, ask to block the device.
+ // This is only for pairing (and not bonding) initiated by us,
+ // as the user already gets the opportunity to block when
+ // rejecting an incoming pairing request.
+ // This case may be for someone requesting to access a service
+ // which requires authentication by us, but not by the remote device.
+ iConnection->LaunchBlockingQueryL();
+ // For incoming pairing, blocking is asked after rejecting the
+ // pairing request. This is done in CompleteAcceptPairingQueryL
+ }
+ CompleteBondingL( err ); // Notify the client if there was a bonding request.
+ }
+ }
+ iNotifierUid = 0; // Clean up notifier data
+ delete iParams;
+ iParams = NULL;
+ if( err )
+ {
+ iOperation = EIdle; // We are done now.
+ }
+ // Complete the message with the result, and result data if any.
+ iConnection->CompleteClientRequest( err, resultData );
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Completes a bonding operation.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CompleteBondingL( TInt aError )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+ if( iDedicatedBonding )
+ {
+ if( iBondingActive )
+ {
+ iBondingActive->Cancel(); // Will close subsession;
+ }
+ iBondingSession.Close(); // In case not active
+ iBondingSocket.Close();
+ }
+ // Determine if we try another time.
+ if( ( iOperation == EAutoPairing && aError == KHCIErrorBase - EAuthenticationFailure ) ||
+ ( iDedicatedBonding && iOperation == EAwaitingPairingResult &&
+ aError == KErrRemoteDeviceIndicatedNoBonding ) ||
+ aError == KErrServerTerminated )
+ {
+ // The cases are: 2) autopairing with a headset that has a non-default passkey
+ // 2) SSP dedicated bonding with a device that does not allow that.
+ // 3) the pairing server is unavailable (unlikely)
+ // Then we try another time, requesting authentication on a
+ // RBTPhysicialLinkAdapter
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifPairingHelper::CompleteBondingL: trying another time." );
+ TInt err = iBondingSocket.Open( iTracker->SocketServerSession(), iConnection->Address() );
+ TUint32 linkState = 0;
+ if( !err )
+ {
+ err = iBondingSocket.PhysicalLinkState( linkState );
+ }
+ if( !err && linkState & ENotifyPhysicalLinkUp )
+ {
+ err = iBondingSocket.Authenticate();
+ // Now wait for the dialog and then the link state notification
+ }
+ else
+ {
+ // We need to wait for the link to come up. We wait until our
+ // parent calls us again.
+ iBondingSocket.Close();
+ }
+ if( err )
+ {
+ // Cannot continue, show the result to the user.
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifPairingHelper::HandleAuthenticationCompleteL: pairing failed, complete message." );
+ iOperation = EShowPairingFailure;
+ PrepareNotificationL( TBluetoothDialogParams::ENote, EPairingFailure );
+ }
+ }
+ if( iDedicatedBonding && iOperation != EAutoPairing )
+ {
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST,
+ "[BTNOTIF]\t CBTNotifPairingHelper::CompleteBondingL: complete message." );
+ TInt err = iTracker->Server()->CompleteMessage( iDedicatedBonding, aError, KNullDesC8 );
+ NOTIF_NOTHANDLED( !err )
+ iDedicatedBonding = 0;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CompleteJustWorksProcessingL( TInt aError )
+ {
+ (void) aError;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Ask the user to allow incoming pairing.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::StartAcceptPairingQueryL()
+ {
+ iOperation = EAcceptPairing;
+ PrepareNotificationL( TBluetoothDialogParams::EQuery, EIncomingPairing );
+ // if rejected, the client message is completed in CompleteAcceptPairingQueryL
+ }
+
+
+// ---------------------------------------------------------------------------
+// The user was asked to accept an incoming pairing. Process and proceed.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CompleteAcceptPairingQueryL( TInt aError, TBool aResult )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // Set our state to idle for now. This may get changed if the user just chose
+ // to block, or if we have a pending request.
+ iOperation = EIdle;
+ TInt err = aError;
+ if( !err )
+ {
+ TBool proceed = iTracker->UpdateBlockingHistoryL( iDevice, aResult );
+ if( aResult )
+ {
+ // User accepted, continue to show pairing query.
+ // Minimum lenght does not apply, should only be set on outgoing pairing
+ TBool locallyInitiated = EFalse;
+ TBuf<8> numVal;
+ TBluetoothDialogParams::TBTDialogType dialog = TBluetoothDialogParams::EInvalidDialog;
+ TBTDialogResourceId resource = ENoResource;
+ // Read the notifier parameters
+ ParseNotifierReqParamsL( locallyInitiated, numVal, dialog, resource );
+ __ASSERT_ALWAYS( resource != ENoResource, PanicServer( EBTNotifPanicBadState ) );
+ PrepareNotificationL( dialog, resource );
+ if( numVal.Length() )
+ {
+ TInt err = iNotification->SetData( TBluetoothDeviceDialog::EAdditionalDesc, numVal );
+ NOTIF_NOTHANDLED( !err )
+ }
+ }
+ else
+ {
+ err = KErrCancel;
+ if( proceed )
+ {
+ // The user denied the connection, ask to block the device.
+ iConnection->LaunchBlockingQueryL();
+ }
+ }
+ }
+ if( err )
+ {
+ // The user denied the connection, or something else prevented completion.
+ CompletePairingNotifierL( err, EFalse, KNullDesC8 );
+ }
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Launch a dialog for setting the device as trusted.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::StartTrustedQueryL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ // Assume that the registry update has come through by now.
+ iOperation = EQueryTrust;
+ PrepareNotificationL( TBluetoothDialogParams::EQuery, ESetTrusted );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process the user input for setting the device as trusted.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CompleteTrustedQueryL( TInt aError, TBool aResult )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+ BOstraceExt2( TRACE_DEBUG, DUMMY_DEVLIST,
+ "CBTNotifPairingHelper::CompleteTrustedQueryL() err=%d result=%d", aError, aResult );
+ iOperation = EIdle; // We are done with pairing now.
+ if( !aError && aResult )
+ {
+ // need to update pairing info from registry before writing trusted status
+ iConnection->UpdateRegistryEntryL(true);
+ }
+ CompleteBondingL( KErrNone ); // Notify the client if there was a bonding request.
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Parse the parameters of a request for pairing.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::ParseNotifierReqParamsL( TBool& aLocallyInitiated,
+ TDes& aNumVal, TBluetoothDialogParams::TBTDialogType& aDialogType,
+ TBTDialogResourceId& aResourceId )
+ {
+ // Determine the notifier type by the length of the parameter buffer
+ if( iNotifierUid == KBTPinCodeEntryNotifierUid.iUid )
+ {
+ aNumVal.Zero();
+ TUint minLen = 0;
+ ParsePinCodeReqParamsL( aLocallyInitiated, minLen );
+ if( minLen )
+ {
+ // Don't set zero to this buffer, the buffer length serves for this.
+ aNumVal.Num( minLen );
+ }
+ aDialogType = TBluetoothDialogParams::EInput;
+ aResourceId = EPinInput;
+ if( iOperation != EAutoPairing )
+ {
+ iOperation = ELegacyPairing;
+ }
+ }
+ else if( iNotifierUid == KBTNumericComparisonNotifierUid.iUid )
+ {
+ ParseNumericCompReqParamsL( aLocallyInitiated, aNumVal );
+ aDialogType = TBluetoothDialogParams::EQuery;
+ aResourceId = ENumericComparison;
+ iOperation = ESspPairing;
+ }
+ else if( iNotifierUid == KBTPasskeyDisplayNotifierUid.iUid )
+ {
+ ParsePasskeyDisplayReqParamsL( aLocallyInitiated, aNumVal );
+ aDialogType = TBluetoothDialogParams::EQuery;
+ aResourceId = EPasskeyDisplay;
+ iOperation = ESspPairing;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Parse the parameters of a request for pairing using pin query.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::ParsePinCodeReqParamsL( TBool& aLocallyInitiated,
+ TUint& aNumVal )
+ {
+ TBTPinCodeEntryNotifierParams params;
+ TPckgC<TBTPinCodeEntryNotifierParams> paramsPckg( params );
+ paramsPckg.Set( *iParams );
+ aLocallyInitiated = paramsPckg().LocallyInitiated();
+ aNumVal = paramsPckg().PinCodeMinLength();
+ }
+
+
+// ---------------------------------------------------------------------------
+// Parse the parameters of a request for pairing using numeric comparison.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::ParseNumericCompReqParamsL( TBool& aLocallyInitiated,
+ TDes& aNumVal )
+ {
+ TBTNumericComparisonParams params;
+ TPckgC<TBTNumericComparisonParams> paramsPckg( params );
+ paramsPckg.Set( *iParams );
+ aLocallyInitiated = paramsPckg().LocallyInitiated();
+ TBTNumericComparisonParams::TComparisonScenario scenario =
+ paramsPckg().ComparisonScenario();
+ aNumVal.Format( KNumCompFormat, paramsPckg().NumericalValue() );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Parse the parameters of a request for pairing using passkey display.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::ParsePasskeyDisplayReqParamsL( TBool& aLocallyInitiated,
+ TDes& aNumVal )
+ {
+ TBTPasskeyDisplayParams params;
+ TPckgC<TBTPasskeyDisplayParams> paramsPckg( params );
+ paramsPckg.Set( *iParams );
+ aLocallyInitiated = paramsPckg().LocallyInitiated();
+ aNumVal.Format( KPassKeyFormat, paramsPckg().NumericalValue() );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Check if we can guess the PIN and complete the notifier without user interaction.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::CheckAutoPairingL( TBool aLocallyInitiated, const TDesC& aNumVal )
+ {
+ TUint minLen = 0;
+ if( aNumVal.Length() )
+ {
+ ParsePinCodeReqParamsL( aLocallyInitiated, minLen );
+ }
+ // ToDo: Add support for NFC OOB pairing
+ if( iDedicatedBonding && iOperation == ELegacyPairing &&
+ iDevice->DeviceClass().MajorDeviceClass() == EMajorDeviceAV &&
+ iDevice->DeviceClass().MinorDeviceClass() != EMinorDeviceAVHandsfree &&
+ minLen <= KDefaultPinLength )
+ {
+ // Outgoing bonding with headset and no passkey requirement => AutomatedPairing
+ // Complete message with 0000 and return.
+ iOperation = EAutoPairing;
+ TBuf8<KDefaultPinLength + sizeof( TPckgBuf<TBool> )> defaultPin( KDefaultPinLength );
+ for( TInt i = 0; i < KDefaultPinLength; i++ )
+ {
+ defaultPin[i] = KDefaultPinValue;
+ }
+ // Complete the pairing through the function dedicated to that.
+ CompletePairingNotifierL( KErrNone, ETrue, defaultPin );
+ }
+ else if( iOperation == EAutoPairing )
+ {
+ iOperation = ELegacyPairing; // Reset the autopairing status
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Get and configure a notification.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::PrepareNotificationL( TBluetoothDialogParams::TBTDialogType aType,
+ TBTDialogResourceId aResourceId )
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+ __ASSERT_ALWAYS( iOperation != EIdle || aType == TBluetoothDialogParams::ENote, PanicServer( EBTNotifPanicBadState ) );
+ iNotification = iTracker->NotificationManager()->GetNotification();
+ User::LeaveIfNull( iNotification ); // For OOM exception, leaves with KErrNoMemory
+ iNotification->SetObserver( this );
+ iNotification->SetNotificationType( aType, aResourceId );
+ TBTDeviceName name;
+ GetDeviceNameL( name, *iDevice );
+ TInt err = iNotification->SetData( TBluetoothDeviceDialog::EDeviceName, name );
+ NOTIF_NOTHANDLED( !err )
+ // Re-use name buffer for 16-bit descriptor representation of remote address.
+ iConnection->Address().GetReadable( name );
+ err = iNotification->SetData( TBluetoothDialogParams::EAddress, name );
+ NOTIF_NOTHANDLED( !err )
+ err = iNotification->SetData( (TInt) TBluetoothDeviceDialog::EDeviceClass,
+ iDevice->DeviceClass().DeviceClass() );
+ err = iTracker->NotificationManager()->QueueNotification( iNotification );
+ NOTIF_NOTHANDLED( !err )
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+
+// ---------------------------------------------------------------------------
+// The notification is finished, handle the result.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifPairingHelper::NotificationClosedL( TInt aError, const TDesC8& aData )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aError );
+ // Read the result.
+ TPckgC<TBool> result( EFalse );
+ result.Set( aData.Ptr(), result.Length() ); // Read the part containing the result
+ // Set a pointer descriptor to capture the remaining data, if any.
+ TPtrC8 dataPtr( aData.Mid( result.Length() ) );
+ switch( iOperation )
+ {
+ case EAcceptPairing:
+ CompleteAcceptPairingQueryL( aError, result() );
+ break;
+ case ELegacyPairing:
+ case ESspPairing:
+ CompletePairingNotifierL( aError, result(), dataPtr );
+ break;
+ case EQueryTrust:
+ CompleteTrustedQueryL( aError, result() );
+ break;
+ case EShowPairingSuccess:
+ StartTrustedQueryL();
+ break;
+ case EShowPairingFailure:
+ // Pairing failure, we are done.
+ iOperation = EIdle;
+ break;
+ default:
+ NOTIF_NOTIMPL
+ break;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifserver.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,370 @@
+/*
+* ============================================================================
+* Name : btnotifserver.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Server class for handling commands from clients, and the
+* central class in btnotif thread.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifserver.h"
+#include <btservices/btdevrepository.h>
+#include "btnotifsession.h"
+#include "btnotifconnectiontracker.h"
+#include "btnotifsettingstracker.h"
+#include "btnotificationmanager.h"
+#include "btnotifdeviceselector.h"
+#include "btnotifserversecpolicy.h"
+#include "btnotifclientserver.h"
+
+/** Panic category */
+_LIT( KBTNotifPanic, "BTNotif panic" );
+
+/** Timeout (10 sec) for shutting down the server
+ * (when BT power is off and no clients connected). */
+const TInt KBTNtoifShutdownTimeout = 10 * 1000 * 1000;
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Start the server.
+// ---------------------------------------------------------------------------
+//
+static void RunServerL()
+ {
+ BOstraceFunctionEntry0( DUMMY_DEVLIST );
+
+ (void) User::RenameThread( KBTNotifServerName );
+ // Create and install the active scheduler for this thread.
+ CActiveScheduler* scheduler = new( ELeave ) CActiveScheduler();
+ CleanupStack::PushL( scheduler );
+ CActiveScheduler::Install( scheduler );
+ // create the server (and leave it on the cleanup stack)
+ CBTNotifServer* notifServer = CBTNotifServer::NewLC();
+ // Initialisation complete, now signal the client
+ RProcess::Rendezvous( KErrNone );
+ // The server is now up and running.
+ BOstrace0( TRACE_NORMAL, DUMMY_DEVLIST, "[BTNOTIF]\t BTNotif server now up and running" );
+ // The active scheduler runs during the lifetime of this thread.
+ CActiveScheduler::Start();
+ // Stopping the active scheduler means terminating the thread.
+ // Cleanup the server and scheduler.
+ CleanupStack::PopAndDestroy( notifServer );
+ CleanupStack::PopAndDestroy( scheduler );
+ BOstraceFunctionExit0( DUMMY_DEVLIST );
+ }
+
+// ---------------------------------------------------------------------------
+// Panic the server.
+// ---------------------------------------------------------------------------
+//
+void PanicServer( TInt aReason )
+ {
+ User::Panic( KBTNotifPanic, aReason );
+ }
+
+// ---------------------------------------------------------------------------
+// Panic the client through the client-side message.
+// ---------------------------------------------------------------------------
+//
+void PanicClient( const RMessage2& aMessage, TInt aReason )
+ {
+ aMessage.Panic( KBTNotifPanic, aReason );
+ }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifServer::CBTNotifServer()
+: CPolicyServer( EPriorityUserInput, KBTNotifServerPolicy )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifServer::ConstructL()
+ {
+ // Add the server to the active scheduler (from CServer2):
+ StartL( KBTNotifServerName );
+ iAsyncCb = new( ELeave ) CAsyncCallBack( EPriorityHigh );
+ TCallBack cb( AsyncConstructCb, this );
+ iAsyncCb->Set( cb );
+ iAsyncCb->CallBack();
+ }
+
+// ---------------------------------------------------------------------------
+// Asynchronous 3rd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifServer::AsyncConstructL()
+ {
+ iSettingsTracker = CBTNotifSettingsTracker::NewL( this );
+ if( iSettingsTracker->GetPowerState() == EBTPowerOn )
+ {
+ iConnectionTracker = CBTNotifConnectionTracker::NewL( this );
+ }
+ iNotificationMgr = CBTNotificationManager::NewL( this );
+
+ iTimer = CDeltaTimer::NewL(CActive::EPriorityLow);
+ TCallBack shutdownCb( ShutdownTimeout, this );
+ iShutdownTimerEntry.Set( shutdownCb );
+ // The server class does not handle any registry events.
+ // Classes that want to receive these events must register
+ // via observer interface.
+ iDevRep = CBtDevRepository::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+// Callback for asynchronous construction.
+// ---------------------------------------------------------------------------
+//
+TInt CBTNotifServer::AsyncConstructCb( TAny* aPtr )
+ {
+ TRAPD( err, ( (CBTNotifServer*) aPtr )->AsyncConstructL() );
+ return err;
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewLC.
+// ---------------------------------------------------------------------------
+//
+CBTNotifServer* CBTNotifServer::NewLC()
+ {
+ CBTNotifServer* self = new( ELeave ) CBTNotifServer();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifServer::~CBTNotifServer()
+ {
+ delete iDevSelector;
+ delete iSettingsTracker;
+ delete iConnectionTracker;
+ delete iNotificationMgr;
+ delete iAsyncCb;
+ delete iTimer;
+ delete iDevRep;
+ }
+
+// ---------------------------------------------------------------------------
+// Handle a change in BT power state.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifServer::HandlePowerStateChangeL( TBTPowerStateValue aState )
+ {
+ if( aState && !iConnectionTracker )
+ {
+ // only construct tracker if it is not available yet
+ iConnectionTracker = CBTNotifConnectionTracker::NewL( this );
+ }
+ else
+ {
+ delete iConnectionTracker;
+ iConnectionTracker = NULL;
+ }
+ CheckIdle( aState );
+ }
+
+// ---------------------------------------------------------------------------
+// Increase the session count.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifServer::AddSession()
+ {
+ ++iSessionCount;
+ iTimer->Remove( iShutdownTimerEntry );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Decrease the session count.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifServer::RemoveSession()
+ {
+ if ( iSessionCount > 0 )
+ {
+ // session counter can't be less than 0
+ --iSessionCount;
+ }
+ CheckIdle( iSettingsTracker->GetPowerState() );
+ }
+
+// ---------------------------------------------------------------------------
+// get the singleton instance of device repository
+// ---------------------------------------------------------------------------
+//
+CBtDevRepository& CBTNotifServer::DevRepository()
+ {
+ return *iDevRep;
+ }
+
+// ---------------------------------------------------------------------------
+// get the singleton instance of device search notifier
+// ---------------------------------------------------------------------------
+//
+CBTNotifDeviceSelector& CBTNotifServer::DeviceSelectorL()
+ {
+ if ( ! iDevSelector )
+ {
+ iDevSelector = CBTNotifDeviceSelector::NewL( *this );
+ }
+ return *iDevSelector;
+ }
+
+// ---------------------------------------------------------------------------
+// Searches for a client message from a message handle and completes it.
+// ---------------------------------------------------------------------------
+//
+TInt CBTNotifServer::CompleteMessage( TInt aHandle, TInt aReason, const TDesC8& aReply )
+ {
+ TInt err = KErrNotFound;
+ iSessionIter.SetToFirst();
+ CBTNotifSession* session = NULL;
+ while( ( session = (CBTNotifSession*) iSessionIter++ ) != NULL )
+ {
+ err = session->CompleteMessage( aHandle, aReason, aReply );
+ if( err != KErrNotFound )
+ {
+ // Found the correct session, and message, and completed it.
+ break;
+ }
+ }
+ return err;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Searches for a client message from a message handle and returns it.
+// ---------------------------------------------------------------------------
+//
+const RMessage2* CBTNotifServer::FindMessageFromHandle( TInt aHandle )
+ {
+ const RMessage2* message = NULL;
+ iSessionIter.SetToFirst();
+ CBTNotifSession* session = NULL;
+ while( ( session = (CBTNotifSession*) iSessionIter++ ) != NULL )
+ {
+ message = session->FindMessageFromHandle( aHandle );
+ if( message )
+ {
+ // Found the correct session and message to return.
+ break;
+ }
+ }
+ return message;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Searches for a client message from a message handle and returns it.
+// ---------------------------------------------------------------------------
+//
+const RMessage2* CBTNotifServer::FindMessageFromUid( TInt aUid )
+ {
+ const RMessage2* message = NULL;
+ iSessionIter.SetToFirst();
+ CBTNotifSession* session = NULL;
+ while( ( session = (CBTNotifSession*) iSessionIter++ ) != NULL )
+ {
+ message = session->FindMessageFromUid( aUid );
+ if( message )
+ {
+ // Found the correct session and message to return.
+ break;
+ }
+ }
+ return message;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class CPolicyServer.
+// Create a new session object.
+// ---------------------------------------------------------------------------
+//
+CSession2* CBTNotifServer::NewSessionL( const TVersion& aVersion,
+ const RMessage2& aMessage ) const
+ {
+ (void) aMessage;
+ // Compare our version with client-side version, CServer2 requires that
+ // we leave if they are not compatible.
+ TVersion srvVersion( KBTNotifServerVersionMajor, KBTNotifServerVersionMinor,
+ KBTNotifServerVersionBuild );
+
+ if( !User::QueryVersionSupported( aVersion, srvVersion ) )
+ {
+ // EFalse is returned if our version is not less than or
+ // equal to the client version.
+ User::Leave( KErrNotSupported );
+ }
+ return CBTNotifSession::NewL();
+ }
+
+void CBTNotifServer::CheckIdle( TBTPowerStateValue aState )
+ {
+ // In special scenarios, we do not have to remove the timer and queue it
+ // again, but these scenarios rarely happen in end-user use cases.
+ iTimer->Remove( iShutdownTimerEntry );
+ if ( iSessionCount == 0 && aState == EBTPowerOff )
+ {
+ // BT power is off, start the shutdown timer.
+ TTimeIntervalMicroSeconds32 interval = KBTNtoifShutdownTimeout;
+ iTimer->Queue( interval, iShutdownTimerEntry );
+ }
+ }
+
+TInt CBTNotifServer::ShutdownTimeout( TAny* aPtr )
+ {
+ (void) aPtr;
+ CActiveScheduler::Stop();
+ return KErrNone;
+ }
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Main function of the executable.
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+ {
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ TInt err = KErrNoMemory;
+ if ( cleanup )
+ {
+ TRAP( err, RunServerL() );
+ delete cleanup;
+ }
+ __UHEAP_MARKEND;
+ return err;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifsession.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,304 @@
+/*
+* ============================================================================
+* Name : btnotifsession.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Session class for handling commands from clients.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifsession.h"
+#include <btextnotifiers.h>
+#include "btnotifclientserver.h"
+#include "btnotifsettingstracker.h"
+#include "btnotifconnectiontracker.h"
+#include "btnotifdeviceselector.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Start the server.
+// ---------------------------------------------------------------------------
+//
+void LeaveIfNullL( const TAny* aPtr, TInt aLeaveCode )
+ {
+ if( aPtr == NULL )
+ {
+ User::Leave( aLeaveCode );
+ }
+ }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifSession::CBTNotifSession()
+: CSession2()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSession::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// NewL.
+// ---------------------------------------------------------------------------
+//
+CBTNotifSession* CBTNotifSession::NewL()
+ {
+ CBTNotifSession* self = new( ELeave ) CBTNotifSession();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifSession::~CBTNotifSession()
+ {
+ for( TInt i = 0; i < iMessageQ.Count(); i++ )
+ {
+ // Complete all outstanding messages with error code
+ iMessageQ[i].Complete( KErrSessionClosed );
+ }
+ iMessageQ.Close(); // Cleans up all message objects.
+ Server()->RemoveSession();
+ }
+
+// ---------------------------------------------------------------------------
+// From class CSession2.
+// Receives a message from a client.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSession::ServiceL( const RMessage2& aMessage )
+ {
+ TInt opCode = aMessage.Function();
+ if ( opCode == EBTNotifCancelNotifier ||
+ opCode == EBTNotifStartSyncNotifier ||
+ opCode == EBTNotifStartAsyncNotifier ||
+ opCode == EBTNotifUpdateNotifier )
+ {
+ TInt uid = aMessage.Int0();
+ if( uid == KDeviceSelectionNotifierUid.iUid )
+ {
+ // Note for implementers:
+ // message queue is not used in this notifier handling (due
+ // to its drawbacks for exception handlings in various situations).
+ // implementations using message queue will be migrated step
+ // by step.
+
+ TRAPD( err, {
+ CBTNotifDeviceSelector& selector = Server()->DeviceSelectorL();
+ selector.DispatchNotifierMessageL( aMessage ); }
+ );
+ if ( err )
+ {
+ aMessage.Complete( err );
+ }
+ // deviceselector takes the ownership of aMessage.
+ return;
+ }
+ }
+
+ // Messages are completed by message handlers, not here.
+ // Queue the message already so that handlers can find it from the queue.
+ iMessageQ.AppendL( aMessage );
+ // The position is assumed to not change during the execution of this function.
+ TInt handle = aMessage.Handle(); // Store the handle for de-queueing
+ TRAPD( err, DispatchMessageL( aMessage ) );
+ if( err || ( aMessage.IsNull() && FindMessageFromHandle( handle ) ) )
+ {
+ // If the message has been completed by now (handle is null and the message
+ // still in the queue), we remove it again from the queue. Otherwise it
+ // will be completed by the handling handler when it has handled the handling.
+ for( TInt i = 0; i < iMessageQ.Count(); i++ )
+ {
+ // This may be replaced by RArray::Find with appropriate key
+ if( iMessageQ[i].Handle() == handle )
+ {
+ iMessageQ.Remove( i );
+ }
+ }
+ }
+ if( err && !aMessage.IsNull() )
+ {
+ aMessage.Complete( err );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class CSession2.
+// Completes construction of the session.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSession::CreateL()
+ {
+ Server()->AddSession();
+ }
+
+// ---------------------------------------------------------------------------
+// Complete a client message from a message handle with given data.
+// If a zero-length descriptor is passed, no data will be written back.
+// ---------------------------------------------------------------------------
+//
+TInt CBTNotifSession::CompleteMessage( TInt aHandle, TInt aReason, const TDesC8& aReply )
+ {
+ TInt err = KErrNotFound;
+ // This may be replaced by RArray::Find with appropriate key
+ for( TInt i = 0; i < iMessageQ.Count(); i++ )
+ {
+ if( iMessageQ[i].Handle() == aHandle )
+ {
+ err = KErrNone;
+ if( aReply.Length() )
+ {
+ // For now, assume a fixed index for the result.
+ // Change this if a the client can pass more arguments!
+ // ToDo: replace with constant!
+ err = iMessageQ[i].Write( EBTNotifSrvReplySlot, aReply );
+ // Should the result be passed back to the calller,
+ // or used to complete the message?
+ }
+ iMessageQ[i].Complete( aReason );
+ iMessageQ.Remove( i );
+ break;
+ }
+ }
+ return err;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Find a client message from an RMessage2 handle.
+// ---------------------------------------------------------------------------
+//
+const RMessage2* CBTNotifSession::FindMessageFromHandle( TInt aHandle ) const
+ {
+ // This may be replaced by RArray::Find with appropriate key
+ for( TInt i = 0; i < iMessageQ.Count(); i++ )
+ {
+ if( iMessageQ[i].Handle() == aHandle )
+ {
+ return &iMessageQ[i];
+ }
+ }
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process a client message.
+// The processing here relies on RNotifier backend server for queueing
+// notifiers on the same channel. Therefore pairing (SSP and legacy) and
+// authorization notifiers arrive in order, not simultaneously, even if
+// they use arrive on different session instances.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSession::DispatchMessageL( const RMessage2& aMessage )
+ {
+ BOstraceFunctionEntryExt( DUMMY_DEVLIST, this, aMessage.Function() );
+ CBTNotifSettingsTracker* settTracker = Server()->SettingsTracker();
+ CBTNotifConnectionTracker* connTracker = Server()->ConnectionTracker();
+ LeaveIfNullL( settTracker, KErrNotReady );
+ TInt opcode = aMessage.Function();
+ if( opcode < EBTNotifMinValue )
+ {
+ User::Leave( KErrArgument );
+ }
+ switch( opcode )
+ {
+ case EBTNotifCancelNotifier:
+ case EBTNotifStartSyncNotifier:
+ case EBTNotifStartAsyncNotifier:
+ case EBTNotifUpdateNotifier:
+ {
+ // All these messages get the same treatment: forward
+ // to settings and connection tracker, who will deal with it appropriately.
+ // First the settings tracker handles the message.
+ settTracker->DispatchNotifierMessageL( aMessage );
+ if( connTracker && !aMessage.IsNull() )
+ {
+ // Pass it on to the connection tracker, if it hasn't been completed yet.
+ connTracker->DispatchNotifierMessageL( aMessage );
+ }
+ else
+ {
+ // Power is off, can't do this now.
+ LeaveIfNullL( connTracker, KErrNotReady );
+ }
+ if( opcode != EBTNotifStartAsyncNotifier && !aMessage.IsNull() )
+ {
+ // Nobody has yet completed the message, and it is a synchronous
+ // one so we'll do it here to allow the notifier to keep on going.
+ aMessage.Complete( KErrNone );
+ }
+ }
+ break;
+ case EBTEngPrepareDiscovery:
+ {
+ // This is functionality only related to existing connections.
+ // Can't do when power is off though.
+ LeaveIfNullL( connTracker, KErrNotReady );
+ //connTracker->HandlePairingRequestL( aMessage );
+ }
+ break;
+ case EBTEngPairDevice:
+ case EBTEngCancelPairDevice:
+ {
+ // This is functionality only related to connections.
+ // Can't do when power is off though.
+ LeaveIfNullL( connTracker, KErrNotReady );
+ connTracker->HandleBondingRequestL( aMessage );
+ }
+ break;
+ default:
+ // Communicate result back.
+ User::Leave( KErrNotSupported );
+ break;
+ }
+ BOstraceFunctionExit1( DUMMY_DEVLIST, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// Find a client message from an RNotifier UID.
+// ---------------------------------------------------------------------------
+//
+const RMessage2* CBTNotifSession::FindMessageFromUid( TInt aUid ) const
+ {
+ // This may be replaced by RArray::Find with appropriate key
+ for( TInt i = 0; i < iMessageQ.Count(); i++ )
+ {
+ if( iMessageQ[i].Int0() == aUid )
+ {
+ return &iMessageQ[i];
+ }
+ }
+ return NULL;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifsrv/src/btnotifsettingstracker.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* ============================================================================
+* Name : btnotifsettingstracker.cpp
+* Part of : BTProximity / BTProximity
+* Description : Class for tracking Bluetooth settings, and also for handling notes unrelated to specific connection.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifsettingstracker.h"
+#include <btserversdkcrkeys.h>
+
+#include "btnotifserver.h"
+#include "btnotificationmanager.h"
+#include "btnotifclientserver.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifSettingsTracker::CBTNotifSettingsTracker( CBTNotifServer* aServer )
+: iServer( aServer )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::ConstructL()
+ {
+ iSettings = CBTEngSettings::NewL( this );
+ User::LeaveIfError( iSettings->GetPowerState( iPowerState ) );
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewL.
+// ---------------------------------------------------------------------------
+//
+CBTNotifSettingsTracker* CBTNotifSettingsTracker::NewL( CBTNotifServer* aServer )
+ {
+ CBTNotifSettingsTracker* self = new( ELeave ) CBTNotifSettingsTracker( aServer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBTNotifSettingsTracker::~CBTNotifSettingsTracker()
+ {
+ if( iNotification )
+ {
+ // Clear the notification callback, we cannot receive them anymore.
+ iNotification->RemoveObserver();
+ iNotification->Close(); // Also dequeues the notification from the queue.
+ iNotification = NULL;
+ }
+ delete iSettings;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Process a client message related to notifiers.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::DispatchNotifierMessageL( const RMessage2& aMessage )
+ {
+ TUid uid = TUid::Uid( aMessage.Int0() );
+ (void) uid;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Cancels an outstanding client message related to notifiers.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::CancelNotifierMessageL( const RMessage2& aMessage )
+ {
+ (void) aMessage;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTEngSettingsObserver.
+// Handle a power status change.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::PowerStateChanged( TBTPowerStateValue aState )
+ {
+ iPowerState = aState;
+ TRAP_IGNORE( iServer->HandlePowerStateChangeL( aState ) );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTEngSettingsObserver.
+// Handle a visibility mode change.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::VisibilityModeChanged( TBTVisibilityMode aState )
+ {
+ if( iVisibilityMode == EBTVisibilityModeTemporary &&
+ aState == EBTVisibilityModeHidden && iPowerState == EBTPowerOn )
+ {
+ // Timeout expired, launch a note.
+ // Note that we get the power state change before this one, when powering
+ // off and setting visibility mode to hidden automatically.
+ NOTIF_NOTHANDLED( !iNotification )
+ iNotification = iServer->NotificationManager()->GetNotification();
+ if ( iNotification )
+ {
+ iNotification->SetObserver( this );
+ iNotification->SetNotificationType( TBluetoothDeviceDialog::ENote, EVisibilityTimeout );
+ iServer->NotificationManager()->QueueNotification( iNotification );
+ }
+ }
+ iVisibilityMode = aState;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// Handle a result from a user query.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::MBRDataReceived( CHbSymbianVariantMap& aData )
+ {
+ (void) aData;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBTNotificationResult.
+// The notification is finished.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifSettingsTracker::MBRNotificationClosed( TInt aError, const TDesC8& aData )
+ {
+ (void) aError;
+ (void) aData;
+ iNotification->RemoveObserver();
+ iNotification = NULL;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifwrapper/data/101fd68f.rss Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* ============================================================================
+* Name : 101fd68f.rss
+* Part of : bluetoothengine / btnotifwrapper
+* Description : Resource definitions for project btnotifwrapper
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include <uikon.hrh>
+#include <ecom/registryinfov2.rh>
+
+// ---------------------------------------------------------------------------
+// ecomInfo
+// ECOM registration info
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO ecomInfo
+ {
+ resource_format_version = RESOURCE_FORMAT_VERSION_2;
+ dll_uid = 0x101FD68F;
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = KUikonUidPluginInterfaceNotifiers;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x20026FEE;
+ version_no = 2;
+ display_name = "BTNOTIFPLUGINWRAPPER vQT";
+ default_data = "BTNOTIFPLUGIN vQT";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifwrapper/inc/btnotifwrapper.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* ============================================================================
+* Name : btnotifwrapper.h
+* Part of : bluetoothengine / btnotif
+* Description : Wrapper for Bluetooth Notifiers
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFWRAPPER_H
+#define BTNOTIFWRAPPER_H
+
+
+#include <eiknotapi.h>
+#include <btnotifclient.h>
+#include <btservices/btsimpleactive.h>
+
+class CBTNotifWrapperUnitTester;
+
+/**
+ * Function for creating the array of notifiers supported by this plug-in.
+ * The main purpose for declaring it here is to allow it to be used
+ * by the test module.
+ *
+ * @since Symbian^4
+ * @return Array of notifiers.
+ */
+CArrayPtr<MEikSrvNotifierBase2>* CreateNotifierArrayL();
+
+/**
+ * RNotif plugin implementation providing the client API for BTNotif
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( CBTNotifWrapper ) : public CBase,
+ public MEikSrvNotifierBase2,
+ public MBtSimpleActiveObserver
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CBTNotifWrapper* NewLC( const TUid& aUid, const TUid& aChannel );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBTNotifWrapper();
+
+private:
+
+// from base class MEikSrvNotifierBase2
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * Frees all resources owned by this notifier.
+ *
+ * @since Symbian^4
+ */
+ virtual void Release();
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * Performs any initialisation that this notifier may require.
+ * As a minimum, the function should return a TNotifierInfo instance
+ * describing the notifier parameters.
+ *
+ * @since Symbian^4
+ * @return Describes the parameters of the notifier.
+ */
+ virtual TNotifierInfo RegisterL();
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * Gets the notifier parameters.
+ *
+ * @since Symbian^4
+ * @return Describes the parameters of the notifier.
+ */
+ virtual TNotifierInfo Info() const;
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * This is called as a result of a client-side call to
+ * RNotifier::StartNotifier(), which the client uses to
+ * start a notifier from which it does not expect a response.
+ *
+ * @since Symbian^4
+ * @param aBuffer Data that can be passed from the client-side. The format
+ * and meaning of any data is implementation dependent.
+ * @return A pointer descriptor representing data that may be returned.
+ * The format and meaning of any data is implementation dependent.
+ */
+ virtual TPtrC8 StartL(const TDesC8& aBuffer);
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * This is called as a result of a client-side call to the asynchronous
+ * function RNotifier::StartNotifierAndGetResponse(). This means that the
+ * client is waiting, asynchronously, for the notifier to tell the
+ * client that it has finished its work.
+ *
+ * @since Symbian^4
+ * @param aBuffer Data that can be passed from the client-side. The format
+ * and meaning of any data is implementation dependent.
+ * @param aReplySlot Identifies which message argument to use for the reply.
+ * This message argument will refer to a modifiable
+ * descriptor, a TDes8 type, into which data can be
+ * returned. The format and meaning of any returned data
+ * is implementation dependent.
+ * @param aMessage Encapsulates a client request.
+ */
+ virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * Cancels an active notifier.
+ * This is called as a result of a client-side call to RNotifier::CancelNotifier().
+ *
+ * @since Symbian^4
+ */
+ virtual void Cancel();
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * Updates a currently active notifier with new data.
+ * This is called as a result of a client-side call
+ * to RNotifier::UpdateNotifier().
+ *
+ * @since Symbian^4
+ * @param aBuffer Data that can be passed from the client-side. The format
+ * and meaning of any data is implementation dependent.
+ * @return A pointer descriptor representing data that may be returned.
+ * The format and meaning of any data is implementation dependent.
+ */
+ virtual TPtrC8 UpdateL(const TDesC8& aBuffer);
+
+ /**
+ * From MEikSrvNotifierBase2.
+ * Updates a currently active notifier with new data.
+ * This is called as a result of a client-side call to the asynchronous
+ * function RNotifier::UpdateNotifierAndGetResponse().
+ *
+ * @since Symbian^4
+ * @param aBuffer Data that can be passed from the client-side. The format
+ * and meaning of any data is implementation dependent.
+ * @param aReplySlot Identifies which message argument to use for the reply.
+ * This message argument will refer to a modifiable
+ * descriptor, a TDes8 type, into which data can be
+ * returned. The format and meaning of any returned data
+ * is implementation dependent.
+ * @param aMessage Encapsulates a client request.
+ */
+ virtual void UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
+
+// from base class MBtSimpleActiveObserver
+
+ /**
+ * Callback to notify that an outstanding request has completed.
+ *
+ * @since Symbian^4
+ * @param aActive Pointer to the active object that completed.
+ * @param aStatus The status of the completed request.
+ */
+ virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @since Symbian^4
+ * @param aId The ID that identifies the outstanding request.
+ */
+ virtual void CancelRequest( TInt aRequestId );
+
+ /**
+ * Callback to notify that an error has occurred in RunL.
+ *
+ * @since Symbian^4
+ * @param aActive Pointer to the active object that completed.
+ * @param aError The error occurred in RunL.
+ */
+ virtual void HandleError( CBtSimpleActive* aActive, TInt aError );
+
+private:
+
+ CBTNotifWrapper( const TUid& aUid, const TUid& aChannel );
+
+ void ConstructL();
+
+ /**
+ * Check if this notifier is a synchronous or asunchronous notifier.
+ *
+ * @since Symbian^4
+ * @return ETrue is the notifier is synchronous, EFalse if asyncrhonous.
+ */
+ TBool IsSync() const;
+
+private: // data
+
+ /**
+ * The UID identifying the notifier.
+ */
+ TUid iUid;
+
+ /**
+ * The channel of the notifier.
+ */
+ TUid iChannel;
+
+ /**
+ * The replyslot for the result.
+ */
+ TInt iReplySlot;
+
+ /**
+ * Session with the BT notifier server.
+ */
+ RBTNotifier iBTNotif;
+
+ /**
+ * The client-side message containing the current request.
+ */
+ RMessagePtr2 iMessage;
+
+ /**
+ * Buffer containing a copy of the notifier parameters, for async notifiers.
+ * Own.
+ */
+ HBufC8* iParamsBuf;
+
+ /**
+ * Modifiable pointer descriptor for getting the response back.
+ */
+ TPtr8 iResponsePtr;
+
+ /**
+ * Buffer for receiving the response from the BT notifier server.
+ * Own.
+ */
+ HBufC8* iResponseBuf;
+
+ /**
+ * Active object helper class.
+ * Own.
+ */
+ CBtSimpleActive* iActive;
+
+ friend class CBTNotifWrapperUnitTester;
+
+ };
+
+#endif // BTNOTIFWRAPPER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifwrapper/src/btnotifwrapper.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,315 @@
+/*
+* ============================================================================
+* Name : btnotifwrapper.cpp
+* Part of : bluetoothengine / btnotif
+* Description : Wrapper for Bluetooth Notifiers
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btnotifwrapper.h"
+#include <btnotif.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <btextnotifierspartner.h>
+#endif
+
+/** Identifier of the active object. */
+const TInt KWrapperActive = 10;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CBTNotifWrapper::CBTNotifWrapper( const TUid& aUid, const TUid& aChannel )
+: MEikSrvNotifierBase2(),
+ iUid( aUid ),
+ iChannel( aChannel ),
+ iResponsePtr( NULL, 0 )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::ConstructL()
+ {
+ // lazy initialization: members are created and destroyed when needed.
+ }
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CBTNotifWrapper* CBTNotifWrapper::NewLC( const TUid& aUid, const TUid& aChannel )
+ {
+ CBTNotifWrapper* self = new( ELeave ) CBTNotifWrapper( aUid, aChannel );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CBTNotifWrapper::~CBTNotifWrapper()
+ {
+ Cancel(); // Cleans up buffers
+ delete iActive;
+ iBTNotif.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Frees all the resources i.e. destruct ourselves.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::Release()
+ {
+ delete this;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+MEikSrvNotifierBase2::TNotifierInfo CBTNotifWrapper::RegisterL()
+ {
+ return Info();
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+MEikSrvNotifierBase2::TNotifierInfo CBTNotifWrapper::Info() const
+ {
+ MEikSrvNotifierBase2::TNotifierInfo info;
+ info.iUid = iUid;
+ info.iChannel = iChannel;
+ info.iPriority = MEikSrvNotifierBase2::ENotifierPriorityVHigh;
+ return info;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CBTNotifWrapper::StartL(const TDesC8& aBuffer)
+ {
+ if( !IsSync() )
+ {
+ // due to the charasteristics of Bluetooth and UI operations,
+ // most of Bluetooth notifiers do not support synchronous version.
+ User::Leave( KErrNotSupported );
+ }
+ // Call notifier server and get response.
+ if( !iBTNotif.Handle() )
+ {
+ User::LeaveIfError( iBTNotif.Connect() );
+ }
+ User::LeaveIfError( iBTNotif.StartNotifier( iUid, aBuffer ) );
+ iBTNotif.Close();
+ return KNullDesC8();
+ }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::StartL(const TDesC8& aBuffer, TInt aReplySlot,
+ const RMessagePtr2& aMessage)
+ {
+ if( !iMessage.IsNull() )
+ {
+ aMessage.Complete( KErrAlreadyExists );
+ return;
+ }
+
+ // Call notifier server and get response.
+ if( !iBTNotif.Handle() )
+ {
+ User::LeaveIfError( iBTNotif.Connect() );
+ }
+ if( !iActive )
+ {
+ iActive = CBtSimpleActive::NewL( *this, KWrapperActive );
+ }
+
+ // We need to store the parameters locally, as aBuffer is destroyed after
+ // returning from this call. We do it on the heap, so we do not permanently
+ // consume memory for the buffer.
+
+ iParamsBuf = HBufC8::NewL( aBuffer.Size() );
+ *iParamsBuf = aBuffer;
+
+ TInt len = aMessage.GetDesMaxLength( aReplySlot );
+ iResponseBuf = HBufC8::NewL( len );
+ // Copy in the response, to get the right buffer size.
+ iResponsePtr.Set( iResponseBuf->Des() );
+ aMessage.ReadL( aReplySlot, iResponsePtr );
+
+ iBTNotif.StartNotifierAndGetResponse( iActive->RequestStatus(),
+ iUid, *iParamsBuf, iResponsePtr );
+ iActive->GoActive();
+ // record the request
+ iReplySlot = aReplySlot;
+ iMessage = aMessage;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::Cancel()
+ {
+ // Call notifier server to cancel.
+ if( iActive )
+ {
+ iActive->Cancel();
+ }
+ if( !iMessage.IsNull() )
+ {
+ iMessage.Complete( KErrCancel );
+ }
+ iReplySlot = 0;
+ delete iParamsBuf;
+ iParamsBuf = NULL;
+ delete iResponseBuf;
+ iResponseBuf = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Synchronous notifier update.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CBTNotifWrapper::UpdateL(const TDesC8& aBuffer)
+ {
+ // Call notifier server and get response.
+ TBuf8<256> response;
+ if( !iBTNotif.Handle() )
+ {
+ User::LeaveIfError( iBTNotif.Connect() );
+ }
+ User::LeaveIfError( iBTNotif.UpdateNotifier( iUid, aBuffer, response ) );
+ return response;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Asynchronous notifier update.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage)
+ {
+ (void) aReplySlot;
+ (void) aBuffer;
+ if( iMessage.IsNull() )
+ {
+ // There is no outstanding request, can't relate this to anything.
+ aMessage.Complete( KErrNotFound );
+ return;
+ }
+ // Call notifier server and get response.
+ // Async updates are just for updating parameters, so they are still
+ // done synchronously between here and btnotif, as they don't
+ // require any user feedback or other response with
+ // asynchronous/long cycles.
+ TPtrC8 response = UpdateL( aBuffer );
+ aMessage.WriteL( aReplySlot, response );
+ aMessage.Complete( KErrNone );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Callback to notify that an outstanding request has completed.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus )
+ {
+ ASSERT( aActive->RequestId() == KWrapperActive );
+ (void) aActive;
+ if( !iMessage.IsNull() )
+ {
+ TInt err( aStatus );
+ if( !aStatus )
+ {
+ // for testing:
+ //TPckgBuf<TBTDeviceResponseParams> response;
+ //response.Copy( *iResponseBuf );
+ //response().BDAddr();
+ err = iMessage.Write( iReplySlot, *iResponseBuf );
+ }
+ iMessage.Complete( err );
+ }
+ // Clean up after usage.
+ iBTNotif.Close();
+ delete iParamsBuf;
+ iParamsBuf = NULL;
+ delete iResponseBuf;
+ iResponseBuf = NULL;
+ delete iActive;
+ iActive = NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Cancel and clean up all requests related to the active object.
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::CancelRequest( TInt aRequestId )
+ {
+ ASSERT( aRequestId == KWrapperActive );
+ (void) aRequestId;
+ iBTNotif.CancelNotifier( iUid );
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+//
+// ---------------------------------------------------------------------------
+//
+void CBTNotifWrapper::HandleError( CBtSimpleActive* aActive,
+ TInt aError )
+ {
+ // RequestCompletedL() is not leavable.
+ (void) aActive;
+ (void) aError;
+ }
+
+// ---------------------------------------------------------------------------
+// Check if this is a synchronous notifier or not.
+// ---------------------------------------------------------------------------
+//
+TBool CBTNotifWrapper::IsSync() const
+ {
+ return ( iUid == KBTGenericInfoNotifierUid );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/btnotifwrapper/src/btnotifwrapperproxy.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* ============================================================================
+* Name : btnotifwrapperproxy.cpp
+* Part of : bluetoothengine / btnotifwrapper
+* Description : ECOM plug-in entry implementation.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+
+#include <ecom/implementationproxy.h>
+#include <btmanclient.h>
+#include <btextnotifiers.h>
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <btextnotifierspartner.h>
+#endif
+#include <btnotifierapi.h>
+//#include <networking/panuiinterfaces.h>
+
+#include "btnotifwrapper.h"
+
+/** Granularity for constructing the array of notifiers */
+const TInt KBTNotifWrapperArraySize = 11;
+/** Channel for discovery notifiers */
+const TUid KBTDiscoveryChannel = { 0x00000601 };
+/** Channel for authentication and authorisation notifiers */
+const TUid KBTAuthChannel = {0x00000602};
+/** Channel for OBEX passkey notifiers */
+//const TUid KBTObexAuthChannel = {0x00000603};
+/** Channel for power mode query */
+//const TUid KBTPowerModeChannel = {0x00000605};
+/** Channel for query notifiers */
+//const TUid KBTQueryChannel = {0x00000606};
+/** Channel for power mode query */
+//const TUid KBTInfoChannel = {0x00000610};
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description
+// ---------------------------------------------------------------------------
+//
+void CreateAndAppendNotifierLC( CArrayPtr<MEikSrvNotifierBase2>& aArray,
+ const TUid& aUid, const TUid& aChannel )
+ {
+ CBTNotifWrapper* notifier = CBTNotifWrapper::NewLC( aUid, aChannel );
+ aArray.AppendL( notifier );
+ }
+
+// ---------------------------------------------------------------------------
+// ?description
+// ---------------------------------------------------------------------------
+//
+CArrayPtr<MEikSrvNotifierBase2>* CreateNotifierArrayL()
+ {
+ CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers =
+ new( ELeave ) CArrayPtrFlat<MEikSrvNotifierBase2>( KBTNotifWrapperArraySize );
+ CleanupStack::PushL( notifiers );
+ // Create all the notifiers:
+ // Connection authorization notifier
+ CreateAndAppendNotifierLC( *notifiers, KBTManAuthNotifierUid, KBTAuthChannel );
+ // Old and new PIN notifiers
+ CreateAndAppendNotifierLC( *notifiers, KBTManPinNotifierUid, KBTAuthChannel );
+ CreateAndAppendNotifierLC( *notifiers, KBTPinCodeEntryNotifierUid, KBTAuthChannel );
+ // Secure simple pairing notifiers
+ CreateAndAppendNotifierLC( *notifiers, KBTNumericComparisonNotifierUid, KBTAuthChannel );
+ CreateAndAppendNotifierLC( *notifiers, KBTPasskeyDisplayNotifierUid, KBTAuthChannel );
+
+ CreateAndAppendNotifierLC( *notifiers, KDeviceSelectionNotifierUid, KBTDiscoveryChannel );
+
+ /*
+ * Other notifiers to be migrated:
+ *
+ * existing stack notifiers:
+ * CreateAndAppendNotifierL( aArray, KPbapAuthNotifierUid, KBTObexPINChannel );
+ *
+ * S60 SDK API:
+ * CreateAndAppendNotifierL( aArray, KPowerModeSettingNotifierUid, KBTPowerModeChannel );
+ *
+ * S60-defined platform:
+ * CreateAndAppendNotifierL( aArray, KBTObexPasskeyQueryNotifierUid, KBTObexPINChannel );
+ * CreateAndAppendNotifierL( aArray, KBTGenericInfoNotifierUid, KBTInfoChannel );
+ * CreateAndAppendNotifierL( aArray, KBTGenericQueryNotifierUid, KBTQueryChannel );
+ *
+ * new (PAN-related):
+ * CreateAndAppendNotifierL( aArray, KBTPanDeviceSelectionNotifierUid, KBTDiscoveryChannel );
+ * CreateAndAppendNotifierL( aArray, KBTPanNapUplinkAuthorisationNotifierUid, KBTAuthChannel );
+ */
+ CleanupStack::Pop( notifiers->Count() + 1, notifiers ); // Each notifier + notifier array itself
+ return notifiers;
+ }
+
+// ---------------------------------------------------------------------------
+// ECOM entry point.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x20026FEE, CreateNotifierArrayL )
+ };
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ECOM factory method.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+ {
+ aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/group/btnotifsrv.mmp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* ============================================================================
+* Name : btnotifsrv.mmp
+* Part of : bluetoothengine / btnotif
+* Description : Project definition file for project btnotif
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET btnotifsrv.exe
+TARGETTYPE exe
+UID 0x1000008d 0x20026FED
+
+CAPABILITY CAP_SERVER NetworkControl PowerMgmt CommDD
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../btnotifsrv/src
+SOURCE btnotifserver.cpp
+SOURCE btnotifsession.cpp
+SOURCE btnotifconnectiontracker.cpp
+SOURCE btnotifconnection.cpp
+SOURCE btnotifpairinghelper.cpp
+SOURCE btnotifsettingstracker.cpp
+SOURCE btnotificationmanager.cpp
+SOURCE bluetoothnotification.cpp
+SOURCE btnotifdeviceselector.cpp
+
+USERINCLUDE ../btnotifsrv/inc ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE ../../inc
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY euser.lib
+LIBRARY esock.lib
+LIBRARY bluetooth.lib
+LIBRARY btdevice.lib
+LIBRARY btmanclient.lib
+LIBRARY btextnotifiers.lib
+LIBRARY btengsettings.lib
+LIBRARY btengconnman.lib
+LIBRARY btengdevman.lib
+LIBRARY btserviceutil.lib
+LIBRARY HbCore.lib
+LIBRARY commonengine.lib
+LIBRARY flogger.lib
+LIBRARY charconv.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/group/btnotifwrapper.mmp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* ============================================================================
+* Name : btnotifwrapper.mmp
+* Part of : bluetoothengine / btnotifwrapper
+* Description : Project definition file for project btnotifwrapper
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET btnotifwrapper.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D 0x101FD68F
+
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+START RESOURCE ../btnotifwrapper/data/101fd68f.rss
+HEADER
+TARGET btnotifwrapper.rsc
+END // RESOURCE
+
+SOURCEPATH ../btnotifwrapper/src
+SOURCE btnotifwrapper.cpp
+SOURCE btnotifwrapperproxy.cpp
+
+USERINCLUDE ../btnotifwrapper/inc ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../inc
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY eiksrv.lib
+LIBRARY btnotifclient.lib
+LIBRARY btserviceutil.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/inc/bluetoothdevicedialogs.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* ============================================================================
+* Name : bluetoothdevicedialogs.h
+* Part of : bluetoothengine / btnotif
+* Description : Data structures for passing dialog type and formatting between btnotif and the UI component showing the actual dialogs. Also defines identifiers for Bluetooth device dialogs.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BLUETOOTHDEVICEDIALOGS_H
+#define BLUETOOTHDEVICEDIALOGS_H
+
+#include <btdevice.h>
+
+/** Enumeration for the type of notification to be launched. */
+enum TBTDialogResourceId
+ {
+ ENoResource,
+ EAuthorization,
+ EIncomingPairing,
+ EPinInput,
+ ENumericComparison,
+ EPasskeyDisplay,
+ EObexPasskeyInput,
+ ESetTrusted,
+ EBlockUnpairedDevice,
+ EBlockPairedDevice,
+ EPairingSuccess,
+ EPairingFailure,
+ EVisibilityTimeout,
+ EUnusedResource // The last ID
+ };
+
+
+/**
+ * TBluetoothDialogParams contains device dialog parameters except for device name and type
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( TBluetoothDialogParams )
+ {
+
+public:
+
+ /** Enumeration for the type of notification to be launched. */
+ enum TBTDialogType
+ {
+ EInvalidDialog,
+ ENote,
+ EQuery,
+ EInput,
+ EDeviceSearch,
+ EGlobalNotif
+ };
+
+ /** Enumeration for the notification parameters data type to be configured. */
+ enum TDialogDataType
+ {
+ ENoParams,
+ EDialogType,
+ EResource,
+ EAddress,
+ EDialogTitle,
+ EDialogExt // Id for first data type of derived class.
+ };
+
+ inline TBluetoothDialogParams();
+
+public: // data
+
+ /**
+ * Identifier for the type of notification.
+ */
+ TInt iDialogType;
+
+ /**
+ * Identifier for the resource to be shown in the dialog.
+ */
+ TInt iResourceId;
+
+ /**
+ * Address of the remote device (not used, for future extension).
+ */
+ TBTDevAddr iAddr;
+
+ /**
+ * Unused padding (not used, for future extension).
+ */
+ TUint32 iPadding;
+
+ };
+
+
+/**
+ * TBluetoothDeviceDialog contains more device dialog parameters
+ *
+ * @since Symbian^4
+ */
+NONSHARABLE_CLASS( TBluetoothDeviceDialog ) : public TBluetoothDialogParams
+ {
+
+public:
+
+ /** Enumeration for the notification parameters data type to be configured. */
+ enum TDialogDataType
+ {
+ ENoParams = TBluetoothDialogParams::EDialogExt,
+ EDeviceName,
+ EDeviceClass,
+ EAdditionalInt,
+ EAdditionalDesc
+ };
+
+ inline TBluetoothDeviceDialog();
+
+public: // data
+
+ /**
+ * The name of the remote device.
+ */
+ TBTDeviceName iDeviceName;
+
+ /**
+ * The class of device of the remote device.
+ */
+ TInt iDeviceClass;
+
+ /**
+ * Additional data depending on the resource.
+ */
+ TInt iIntParam;
+
+ /**
+ * Additional data depending on the resource.
+ */
+ TBuf<10> iDescParam;
+
+ };
+
+
+/** Typedef'ed pckgbuf to send dialog parameters to the notification framework. */
+typedef TPckgBuf<TBluetoothDialogParams> TBluetoothDialogParamsPckg;
+
+/** Typedef'ed pckgbuf to send dialog parameters to the notification framework. */
+typedef TPckgBuf<TBluetoothDeviceDialog> TBluetoothDeviceDialogPckg;
+
+
+inline TBluetoothDialogParams::TBluetoothDialogParams()
+: iDialogType( EInvalidDialog ),
+ iResourceId( ENoResource ),
+ iAddr( TBTDevAddr() ),
+ iPadding( 0 )
+ {
+ }
+
+inline TBluetoothDeviceDialog::TBluetoothDeviceDialog()
+: iDeviceName( 0 ),
+ iDeviceClass( 0 ),
+ iIntParam( 0 )
+ {
+ }
+
+
+#endif // BLUETOOTHDEVICEDIALOGS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/inc/bluetoothtrace.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,455 @@
+/*
+* ============================================================================
+* Name : bluetoothtrace.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : API declaration of run-time debug tracing
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BLUETOOTHTRACE_H
+#define BLUETOOTHTRACE_H
+
+#include <e32base.h>
+#include "traceconfig.h"
+
+/*
+ * Common tracing utility definition to be used by Bluetooth projects.
+ * The configuration is loaded from traceconfig.h which shall be private for
+ * each individual project.
+ *
+ * In this utility, a set of OST-alike tracing macros are defined.
+ * (The purpose is to ease migration to OST in future.)
+ *
+ * Individual project can also define new macros based on this utility in
+ * its own space.
+ *
+ */
+
+#ifdef BLUETOOTHTRACE_ENABLED
+
+#ifdef BLUETOOTHTRACE_MEDIA_OST
+
+/**
+ * Convert own macros to OST macros when OST tracing is used.
+ * In OST tracing, aTraceName must be a unique identifier in scope of a module.
+ * Thus many OST compiling errors may occur if the same TraceName is used in multiple
+ * tracing lines where tracing is miigrated from non-OST to OST.
+ * The fix is to renaming the TraceName:s to be unique.
+ */
+#include <OpenSystemTrace.h>
+
+#define BOstrace0( aGroupName, aTraceName, aTraceText ) \
+ OstTrace0( aGroupName, aTraceName, aTraceText )
+
+#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \
+ OstTrace1( aGroupName, aTraceName, aTraceText, aParam )
+
+#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \
+ OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+
+#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \
+ OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam )
+
+#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \
+ OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
+
+#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \
+ OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
+
+#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \
+ OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
+
+#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \
+ OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
+
+#define BOstraceFunctionEntry0( aTraceName ) \
+ OstTraceFunctionEntry0( aTraceName )
+
+#define BOstraceFunctionEntry1( aTraceName, aInstance ) \
+ OstTraceFunctionEntry1( aTraceName, aInstance )
+
+#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \
+ OstTraceFunctionEntryExt(aTraceName, aInstance, aArg)
+
+#define BOstraceFunctionExit0( aTraceName ) \
+ OstTraceFunctionExit0( aTraceName )
+
+#define BOstraceFunctionExit1( aTraceName, aInstance ) \
+ OstTraceFunctionExit1( aTraceName, aInstance )
+
+#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \
+ OstTraceFunctionExitExt(aTraceName, aInstance, aRetval)
+
+#define BOstraceEventStart0( aTraceName, aEventName ) \
+ OstTraceEventStart0( aTraceName, aEventName )
+
+#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \
+ OstTraceEventStart1( aTraceName, aEventName, aParam )
+
+#define BOstraceEventStop( aTraceName, aEventName ) \
+ OstTraceEventStop( aTraceName, aEventName )
+
+#define BOstraceState0( aTraceName, aStateName, aNewState ) \
+ OstTraceState0( aTraceName, aStateName, aNewState )
+
+#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \
+ OstTraceState1( aTraceName, aStateName, aNewState, aInstance )
+
+#else // BLUETOOTHTRACE_MEDIA_OST
+
+#ifdef BLUETOOTHTRACE_MEDIA_FILE
+#include <flogger.h>
+#else
+#include <e32debug.h>
+#endif
+
+/**
+ * When tracing compilation with OST is disabled, the TraceName in each OST trace line
+ * is ignored, that is, the Trace Names are not checked at compiling time, neither
+ * are they written into the specified trace output media.
+ */
+
+/**
+ * Handlers below are used for tolerating overflow of formatting strings.
+ * to trucate rather than panic the caller.
+ */
+NONSHARABLE_CLASS( TBtTraceOflowTruncate8 ) : public TDes8Overflow
+ {
+public:
+ void Overflow( TDes8& /*aDes*/ ) {}
+ };
+
+NONSHARABLE_CLASS( TBtTraceOflowTruncate16 ) : public TDes16Overflow
+ {
+public:
+ void Overflow( TDes16& /*aDes*/ ) {}
+ };
+
+/**
+ * internal tracing implementation, do not use it out of this file.
+ */
+inline void Trace(const TDesC &trGrp, const TDesC &trTxt)
+{
+ _LIT(Format, "%S%S%S");
+ TBuf16<0x180> str;
+ TPtrC cp(KComponentName);
+ str.Format(Format, &cp, &trGrp, &trTxt);
+#ifdef BLUETOOTHTRACE_MEDIA_FILE
+ RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, str);
+#else
+ RDebug::Print( str );
+#endif
+}
+
+/*
+ * trace with no parameters
+ */
+#define BOstrace0( aGroupName, aTraceName, aTraceText ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ Trace( TrGrp, TrTxt ); \
+}
+
+/*
+ * trace with one 32-bit parameter
+ */
+#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with more than 32 bits of data. Not supported
+ */
+#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+
+/*
+ * trace with one parameter that is not 32-bit integer
+ */
+#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \
+ BOstrace1( aGroupName, aTraceName, aTraceText, aParam )
+
+/*
+ * trace with two parameters.
+ */
+#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with three parameters.
+ */
+#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with four parameters
+ */
+#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with five parameters
+ */
+#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function entry trace without extra parameters.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionEntry0( aTraceName ) \
+{\
+ _LIT(TrGrp, "[ API ]"); \
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, ">> "); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry );\
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function entry trace with a parameter representing the instance identifier, e.g.
+ * "this" pointer.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionEntry1( aTraceName, aInstance ) \
+{\
+ _LIT(TrGrp, "[ API ]");\
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d)"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function entry trace, which traces function parameters.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \
+{ \
+ _LIT(TrGrp, "[ API ]");\
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d) arg %d"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aArg); \
+ Trace( TrGrp, buf ); \
+}
+/*
+ * Function exit trace without extra parameters.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionExit0( aTraceName ) \
+{\
+ _LIT(TrGrp, "[ API ]"); \
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, "<< "); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function exit trace with a parameter representing the instance identifier
+ * for example "this" pointer.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionExit1( aTraceName, aInstance ) \
+{\
+ _LIT(TrGrp, "[ API ]"); \
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d)"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function exit trace with parameters representing the instance identifier,
+ * for example "this" pointer, and return value.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \
+{\
+ _LIT(TrGrp, "[ API ]");\
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d) ret %d"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aRetval); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Performance measurement event start trace without extra parameters.
+ * The trace is mapped to TRACE_PERFORMANCE group.
+ */
+#define BOstraceEventStart0( aTraceName, aEventName ) \
+{\
+ _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \
+ _LIT(Entry, "[Start] "); \
+ TBuf<512> buf(Entry); buf.Append( EvName ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Performance measurement event start trace with single 32-bit parameter.
+ * The trace is mapped to TRACE_PERFORMANCE group.
+ */
+#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \
+{\
+ _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \
+ _LIT(Entry, "[Start] %S 0x%X(%d)"); \
+ TPtrC evt(EvName); TBuf<512> buf; \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Entry, &overflow, &evt, aParam, aParam ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Performance measurement event end trace.
+ * The trace is mapped to TRACE_PERFORMANCE group.
+ */
+#define BOstraceEventStop( aTraceName, aEventName ) \
+{\
+ _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \
+ _LIT(Entry, "[Stop] "); \
+ TBuf<512> buf(Entry); buf.Append( EvName ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * State transition event.
+ * The trace is mapped to TRACE_STATE group.
+ */
+#define BOstraceState0( aTraceName, aStateName, aNewState ) \
+{\
+ _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \
+ _LIT(Entry, "%S 0x%X(%d)"); \
+ TPtrC evt(StName); TBuf<512> buf; \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * State transition event with instance identifier.
+ * The trace is mapped to TRACE_STATE group.
+ */
+#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \
+{\
+ _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \
+ _LIT(Entry, "%S 0x%X(%d) instance=0x%X(%d)"); \
+ TPtrC evt(StName); TBuf<512> buf; \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \
+ Trace( TrGrp, buf ); \
+}
+
+#endif // BLUETOOTHTRACE_MEDIA_OST
+
+// Extended tracing macros facilitating domain specific tracing needs:
+
+/*
+ * A block of source code merely for tracing purpose.
+ */
+#define BtTraceBlock( exp ) {exp}
+
+/*
+ * trace macro for BT device address printing with an additional trace text.
+ * aParam must be TBTDevAddr type.
+ */
+#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) \
+{ \
+ _LIT(TrTxt, aTraceText); TPtrC p(TrTxt); \
+ TBuf<12> buf; \
+ aParam.GetReadable( buf ); TPtrC p2(buf);\
+ BOstraceExt2( aGroupName, aTraceName, "%S%S", &p, &p2 ); \
+}
+
+/*
+ * trace macro for BT device address printing with no additional trace text.
+ * aParam must be TBTDevAddr type.
+ */
+#define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) \
+{ \
+ TBuf<12> buf; aParam.GetReadable( buf ); TPtrC p(buf); \
+ BOstraceExt1( aGroupName, aTraceName, "%S", &p ); \
+}
+
+#else // BLUETOOTHTRACE_ENABLED
+
+#define BOstrace0( aGroupName, aTraceName, aTraceText )
+#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam )
+#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam )
+#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
+#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
+#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
+#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
+
+#define BOstraceFunctionEntry0( aTraceName )
+#define BOstraceFunctionEntry1( aTraceName, aInstance )
+#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg)
+#define BOstraceFunctionExit0( aTraceName )
+#define BOstraceFunctionExit1( aTraceName, aInstance )
+#define BOstraceEventStart0( aTraceName, aEventName )
+#define BOstraceEventStart1( aTraceName, aEventName, aParam )
+#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval)
+#define BOstraceEventStop( aTraceName, aEventName )
+#define BOstraceState0( aTraceName, aStateName, aNewState )
+#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance )
+
+#define BtTraceBlock( exp )
+#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam )
+#define BtTraceBtAddr0( aGroupName, aTraceName, aParam )
+
+#endif // BLUETOOTHTRACE_ENABLED
+
+/*
+ * Additional general purpose definition, a hook for defining a friend class
+ * for unit testing to get access to class internals.
+ */
+#ifndef BTUNITTEST
+#define BTUNITTESTHOOK
+#endif
+
+#endif // BLUETOOTHTRACE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btnotif/inc/btnotifclientserver.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* ============================================================================
+* Name : btnotifclientserver.h
+* Part of : bluetoothengine / btnotif
+* Description : Definitions for the btnotif client-server interface.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTNOTIFCLIENTSERVER_H
+#define BTNOTIFCLIENTSERVER_H
+
+/** BTNotif server name */
+_LIT( KBTNotifServerName, "btnotifsrv" );
+
+/** btnotifsrv Uid3 for creating the server process */
+const TUid KBTNotifServerUid3 = { 0x20026FED };
+
+/**
+ * BTNotif server version numbers;
+ * Major version number is 2 to distinguish
+ * from old btnotif architecture.
+ */
+const TInt KBTNotifServerVersionMajor = 2;
+const TInt KBTNotifServerVersionMinor = 0;
+const TInt KBTNotifServerVersionBuild = 0;
+
+/**
+ * Opcodes used in the client-server interface
+ * for identifying the requested command.
+ */
+enum TBTNotifServerRequest
+ {
+ EBTNotifMinValue = 9,
+ EBTNotifStartSyncNotifier,
+ EBTNotifStartAsyncNotifier,
+ EBTNotifCancelNotifier,
+ EBTNotifUpdateNotifier,
+ // Commands moved from BTEngine server.
+ EBTEngPrepareDiscovery = 43,
+ EBTEngPairDevice,
+ EBTEngCancelPairDevice,
+ };
+
+/**
+ * Message slots Opcodes used in the client-server interface
+ * for identifying the requested command.
+ */
+enum TBTNotifServerRequestSlot
+ {
+ EBTNotifSrvUidSlot,
+ EBTNotifSrvParamSlot,
+ EBTNotifSrvReplySlot
+ };
+
+#endif // T_BTNOTIFCLIENTSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/bwins/btserviceutilu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,33 @@
+EXPORTS
+ ?CopyL@CBtDevExtension@@QAEPAV1@XZ @ 1 NONAME ; class CBtDevExtension * CBtDevExtension::CopyL(void)
+ ?GoActive@CBtSimpleActive@@QAEXXZ @ 2 NONAME ; void CBtSimpleActive::GoActive(void)
+ ?IsUserAwareBonded@CBtDevExtension@@QBEHXZ @ 3 NONAME ; int CBtDevExtension::IsUserAwareBonded(void) const
+ ?IsUserAwareBonded@CBtDevExtension@@SAHABVTBTNamelessDevice@@@Z @ 4 NONAME ; int CBtDevExtension::IsUserAwareBonded(class TBTNamelessDevice const &)
+ ?NewL@CBtSimpleActive@@SAPAV1@AAVMBtSimpleActiveObserver@@HH@Z @ 5 NONAME ; class CBtSimpleActive * CBtSimpleActive::NewL(class MBtSimpleActiveObserver &, int, int)
+ ?AllDevices@CBtDevRepository@@QBEABV?$RPointerArray@VCBtDevExtension@@@@XZ @ 6 NONAME ; class RPointerArray<class CBtDevExtension> const & CBtDevRepository::AllDevices(void) const
+ ?IsBonded@CBtDevExtension@@SAHABVTBTNamelessDevice@@@Z @ 7 NONAME ; int CBtDevExtension::IsBonded(class TBTNamelessDevice const &)
+ ?RemoveObserver@CBtDevRepository@@QAEXPAVMBtDevRepositoryObserver@@@Z @ 8 NONAME ; void CBtDevRepository::RemoveObserver(class MBtDevRepositoryObserver *)
+ ?AddObserverL@CBtDevRepository@@QAEXPAVMBtDevRepositoryObserver@@@Z @ 9 NONAME ; void CBtDevRepository::AddObserverL(class MBtDevRepositoryObserver *)
+ ?SetRequestId@CBtSimpleActive@@QAEXH@Z @ 10 NONAME ; void CBtSimpleActive::SetRequestId(int)
+ ?SetDeviceL@CBtDevExtension@@QAEXPAVCBTDevice@@@Z @ 11 NONAME ; void CBtDevExtension::SetDeviceL(class CBTDevice *)
+ ??1CBtDevRepository@@UAE@XZ @ 12 NONAME ; CBtDevRepository::~CBtDevRepository(void)
+ ?SetObserver@CAdvanceDevDiscoverer@@QAEXAAVMDevDiscoveryObserver@@@Z @ 13 NONAME ; void CAdvanceDevDiscoverer::SetObserver(class MDevDiscoveryObserver &)
+ ?RequestStatus@CBtSimpleActive@@QAEAAVTRequestStatus@@XZ @ 14 NONAME ; class TRequestStatus & CBtSimpleActive::RequestStatus(void)
+ ??1CAdvanceDevDiscoverer@@UAE@XZ @ 15 NONAME ; CAdvanceDevDiscoverer::~CAdvanceDevDiscoverer(void)
+ ?Alias@CBtDevExtension@@QBEABVTDesC16@@XZ @ 16 NONAME ; class TDesC16 const & CBtDevExtension::Alias(void) const
+ ?NewL@CAdvanceDevDiscoverer@@SAPAV1@AAVCBtDevRepository@@AAVMDevDiscoveryObserver@@@Z @ 17 NONAME ; class CAdvanceDevDiscoverer * CAdvanceDevDiscoverer::NewL(class CBtDevRepository &, class MDevDiscoveryObserver &)
+ ?ServiceConnectionStatus@CBtDevExtension@@QBE?AW4TBTEngConnectionStatus@@XZ @ 18 NONAME ; enum TBTEngConnectionStatus CBtDevExtension::ServiceConnectionStatus(void) const
+ ?NewLC@CBtDevExtension@@SAPAV1@ABVTInquirySockAddr@@ABVTDesC16@@W4TDefaultDevNameOption@@@Z @ 19 NONAME ; class CBtDevExtension * CBtDevExtension::NewLC(class TInquirySockAddr const &, class TDesC16 const &, enum TDefaultDevNameOption)
+ ??1CBtDevExtension@@UAE@XZ @ 20 NONAME ; CBtDevExtension::~CBtDevExtension(void)
+ ?DiscoverDeviceL@CAdvanceDevDiscoverer@@QAEXW4TDevDiscoveryFilter@1@W4TBTMajorDeviceClass@@@Z @ 21 NONAME ; void CAdvanceDevDiscoverer::DiscoverDeviceL(enum CAdvanceDevDiscoverer::TDevDiscoveryFilter, enum TBTMajorDeviceClass)
+ ?NewLC@CBtDevExtension@@SAPAV1@PAVCBTDevice@@W4TDefaultDevNameOption@@@Z @ 22 NONAME ; class CBtDevExtension * CBtDevExtension::NewLC(class CBTDevice *, enum TDefaultDevNameOption)
+ ?IsJustWorksBonded@CBtDevExtension@@SAHABVTBTNamelessDevice@@@Z @ 23 NONAME ; int CBtDevExtension::IsJustWorksBonded(class TBTNamelessDevice const &)
+ ?Device@CBtDevExtension@@QBEABVCBTDevice@@XZ @ 24 NONAME ; class CBTDevice const & CBtDevExtension::Device(void) const
+ ?RequestId@CBtSimpleActive@@QAEHXZ @ 25 NONAME ; int CBtSimpleActive::RequestId(void)
+ ?IsInitialized@CBtDevRepository@@QBEHXZ @ 26 NONAME ; int CBtDevRepository::IsInitialized(void) const
+ ?Addr@CBtDevExtension@@QBEABVTBTDevAddr@@XZ @ 27 NONAME ; class TBTDevAddr const & CBtDevExtension::Addr(void) const
+ ?CancelDiscovery@CAdvanceDevDiscoverer@@QAEXXZ @ 28 NONAME ; void CAdvanceDevDiscoverer::CancelDiscovery(void)
+ ?NewL@CBtDevRepository@@SAPAV1@XZ @ 29 NONAME ; class CBtDevRepository * CBtDevRepository::NewL(void)
+ ??1CBtSimpleActive@@UAE@XZ @ 30 NONAME ; CBtSimpleActive::~CBtSimpleActive(void)
+ ?Device@CBtDevRepository@@QBEPBVCBtDevExtension@@ABVTBTDevAddr@@@Z @ 31 NONAME ; class CBtDevExtension const * CBtDevRepository::Device(class TBTDevAddr const &) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/eabi/btserviceutilu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,37 @@
+EXPORTS
+ _ZN15CBtDevExtension10SetDeviceLEP9CBTDevice @ 1 NONAME
+ _ZN15CBtDevExtension5CopyLEv @ 2 NONAME
+ _ZN15CBtDevExtension5NewLCEP9CBTDevice21TDefaultDevNameOption @ 3 NONAME
+ _ZN15CBtDevExtension5NewLCERK16TInquirySockAddrRK7TDesC1621TDefaultDevNameOption @ 4 NONAME
+ _ZN15CBtDevExtensionD0Ev @ 5 NONAME
+ _ZN15CBtDevExtensionD1Ev @ 6 NONAME
+ _ZN15CBtDevExtensionD2Ev @ 7 NONAME
+ _ZN15CBtSimpleActive12SetRequestIdEi @ 8 NONAME
+ _ZN15CBtSimpleActive13RequestStatusEv @ 9 NONAME
+ _ZN15CBtSimpleActive4NewLER23MBtSimpleActiveObserverii @ 10 NONAME
+ _ZN15CBtSimpleActive8GoActiveEv @ 11 NONAME
+ _ZN15CBtSimpleActive9RequestIdEv @ 12 NONAME
+ _ZN15CBtSimpleActiveD0Ev @ 13 NONAME
+ _ZN15CBtSimpleActiveD1Ev @ 14 NONAME
+ _ZN15CBtSimpleActiveD2Ev @ 15 NONAME
+ _ZN16CBtDevRepository12AddObserverLEP24MBtDevRepositoryObserver @ 16 NONAME
+ _ZN16CBtDevRepository14RemoveObserverEP24MBtDevRepositoryObserver @ 17 NONAME
+ _ZN16CBtDevRepository4NewLEv @ 18 NONAME
+ _ZN16CBtDevRepositoryD0Ev @ 19 NONAME
+ _ZN16CBtDevRepositoryD1Ev @ 20 NONAME
+ _ZN16CBtDevRepositoryD2Ev @ 21 NONAME
+ _ZN21CAdvanceDevDiscoverer11SetObserverER21MDevDiscoveryObserver @ 22 NONAME
+ _ZN21CAdvanceDevDiscoverer15CancelDiscoveryEv @ 23 NONAME
+ _ZN21CAdvanceDevDiscoverer15DiscoverDeviceLENS_19TDevDiscoveryFilterE19TBTMajorDeviceClass @ 24 NONAME
+ _ZN21CAdvanceDevDiscoverer4NewLER16CBtDevRepositoryR21MDevDiscoveryObserver @ 25 NONAME
+ _ZN21CAdvanceDevDiscovererD0Ev @ 26 NONAME
+ _ZN21CAdvanceDevDiscovererD1Ev @ 27 NONAME
+ _ZN21CAdvanceDevDiscovererD2Ev @ 28 NONAME
+ _ZNK15CBtDevExtension17IsUserAwareBondedEv @ 29 NONAME
+ _ZNK15CBtDevExtension4AddrEv @ 30 NONAME
+ _ZNK15CBtDevExtension5AliasEv @ 31 NONAME
+ _ZNK15CBtDevExtension6DeviceEv @ 32 NONAME
+ _ZNK16CBtDevRepository10AllDevicesEv @ 33 NONAME
+ _ZNK16CBtDevRepository13IsInitializedEv @ 34 NONAME
+ _ZNK16CBtDevRepository6DeviceERK10TBTDevAddr @ 35 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/export/advancedevdiscoverer.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declares Bluetooth device inquiry helper class.
+*
+*/
+
+#ifndef ADVANCEBTDEVDISCOVERER_H
+#define ADVANCEBTDEVDISCOVERER_H
+
+#include <btdevice.h>
+#include <bt_sock.h>
+#include <btservices/devdiscoveryobserver.h>
+#include <btservices/btdevrepository.h>
+
+class CAdvanceDevDiscovererImpl;
+
+/**
+ * APIs from this class offer functionalities that are common in mw and app
+ * components of Bluetooth packages. They do not serve as domain APIs.
+ *
+ * Using these from external components is risky, due to possible source
+ * and binary breaks in future.
+ *
+ */
+
+/**
+* The interface of discovering in-range Bluetooth devices via Host Resolver.
+* This class offers some options to search certain devices by CoD and other
+* filters e.g., bonded and blocked.
+*
+* It requires the client to supply a CBtDevRepository instance for filtering
+* devices.
+*/
+NONSHARABLE_CLASS( CAdvanceDevDiscoverer ) : public CBase
+ {
+
+public: // Constructor and destructor
+
+ /**
+ * Options for clients to specify criteria on discovered devices.
+ */
+ enum TDevDiscoveryFilter
+ {
+ // do not filter in-range devices
+ ENoFilter = 0,
+
+ // Excludes an in-range device if its device name is not available
+ ExcludeIfNoDevName = 0x01,
+
+ // Excludes an in-range device if it is user-aware bonded with phone.
+ ExcludeUserAwareBonded = 0x02,
+
+ // Excludes an in-range device if it is banned by phone.
+ ExcludeBanned = 0x04,
+ };
+
+ IMPORT_C static CAdvanceDevDiscoverer* NewL(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ IMPORT_C virtual ~CAdvanceDevDiscoverer();
+
+ /**
+ * sets the discovery result receiver.
+ *
+ * @param aObserver the new observer to receive inquiry results
+ */
+ IMPORT_C void SetObserver( MDevDiscoveryObserver& aObserver );
+
+ /**
+ * Discover currently in-range devices that matches the given major
+ * device class type.
+
+ * Found devices will be informed by
+ * MBtDevDiscoveryObserver::HandleNextDiscoveryResult().
+ *
+ * When no more device can be found,
+ * MBtDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued.
+ *
+ * @param aFilter the filter that shall be applied when a device
+ * is discovered. If this is specified, only a device passing
+ * the filter will be informed to client.
+ * By default, no filter is applied.
+ *
+ * @param aDeviceClass the major device class which a found device
+ * must match.
+ * By default, it includes any device types.
+ */
+ IMPORT_C void DiscoverDeviceL(
+ TDevDiscoveryFilter aFilter = CAdvanceDevDiscoverer::ENoFilter,
+ TBTMajorDeviceClass aDeviceClass = EMajorDeviceMisc );
+
+ /**
+ * Cancels any outstanding discovery request.
+ */
+ IMPORT_C void CancelDiscovery();
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CAdvanceDevDiscoverer();
+
+ /**
+ * The 2nd phase constructor
+ */
+ void ConstructL( CBtDevRepository& aDevRep, MDevDiscoveryObserver& aObserver );
+
+private: // Data
+
+ CAdvanceDevDiscovererImpl* iImpl;
+};
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/export/btdevextension.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: an extended BT device offering properties of
+* a Bluetooth device that may be needed by Bluetooth UIs
+*
+*/
+
+#ifndef BTDEVEXTENSION_H
+#define BTDEVEXTENSION_H
+
+#include <btdevice.h>
+#include <btmanclient.h>
+#include <bt_sock.h>
+#include <btengconstants.h>
+
+/**
+ * APIs from this class offer functionalities that are common in mw and app
+ * components of Bluetooth packages. They do not serve as domain APIs.
+ *
+ * Using these from external components is risky, due to possible source
+ * and binary breaks in future.
+ *
+ */
+
+/**
+ * The option for specify the default name for a BT device in
+ * case the device has neither a device name nor a friendly name.
+ */
+enum TDefaultDevNameOption
+ {
+ ENoDefaultName,
+ EColonSeperatedBDAddr, // device name will be formated
+ EPlainBDAddr,
+ };
+
+/**
+ * Class CBtDevExtension
+ *
+ * This class provides the access to the properties of devices from BT registry.
+ * In addition, it provides other dynamic properties such as the connection
+ * and proximity statuses. Note that client should not store the dynamic
+ * properties for future use since they may change frequently.
+ *
+ */
+NONSHARABLE_CLASS( CBtDevExtension ) : public CBase
+ {
+
+public:
+ // placeholder for providing more properties of a device
+ enum TBtDevStatus
+ {
+ EUndefinedStatus,
+ EInRangUnknown = 0x01,
+ EInRange = 0x02,
+ EPermanentInRegistry = 0x04,
+ };
+
+ /**
+ * Two-phase constructor
+ * @param aDev a CBTDevice instance. The ownership is transferred.
+ * @param aNameOption the option for formating the default device
+ * name when the given aDev instance has no valid name.
+ */
+ IMPORT_C static CBtDevExtension* NewLC( CBTDevice* aDev,
+ TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr );
+
+ /**
+ * Two-phase constructor
+ * @param aDev a CBTDevice instance. The ownership is transferred.
+ * @param aNameOption the option for formating the default device
+ * name when the given aDev instance has no valid name.
+ */
+ IMPORT_C static CBtDevExtension* NewLC(
+ const TInquirySockAddr& aAddr,
+ const TDesC& aName = KNullDesC,
+ TDefaultDevNameOption aNameOption = EColonSeperatedBDAddr );
+
+ /**
+ * Destructor
+ */
+ IMPORT_C virtual ~CBtDevExtension();
+
+ /**
+ * Tells if the given device is bonded regardless of whether the pairing was
+ * performed under user awareness.
+ *
+ * @return ETrue if it is bonded.
+ */
+ IMPORT_C static TBool IsBonded( const TBTNamelessDevice &dev );
+
+ /**
+ * Tells if the given device is bonded with the Just Works pairing model.
+ *
+ * @return ETrue if it is bonded and the pairing was performed with Just Works.
+ */
+ IMPORT_C static TBool IsJustWorksBonded( const TBTNamelessDevice &dev );
+
+ /**
+ * Tells if the given device has been bonded under user awareness.
+ * User awareness refers that the user interacted or was informed during or
+ * immediately after the pairing completed.
+ *
+ * @return ETrue if the user is aware of the bonding.
+ */
+ IMPORT_C static TBool IsUserAwareBonded( const TBTNamelessDevice &dev );
+
+ /**
+ * Returns the display name of this device for end users.
+ * @return the friendly name of the device if it is available; else, the device
+ * name if it is available; otherwise, the BDADDR seperated with ":".
+ */
+ IMPORT_C const TDesC& Alias() const;
+
+ /**
+ * Gets the device address.
+ * @return the device.
+ */
+ IMPORT_C const TBTDevAddr& Addr() const;
+
+ /**
+ * Gets the CBTDevice instance.
+ * @return the device.
+ */
+ IMPORT_C const CBTDevice& Device() const;
+
+ /**
+ * Checks if this device was bonded under user awareness.
+ * @return ETrue if it is user-aware bonded.
+ */
+ IMPORT_C TBool IsUserAwareBonded() const;
+
+ /**
+ *
+ * Returns the service (limited to services managed in bteng scope)
+ * level connection status of the specified device.
+ *
+ * @param aAddr the address of the device
+ * @return one of TBTEngConnectionStatus enums
+ */
+ IMPORT_C TBTEngConnectionStatus ServiceConnectionStatus() const;
+
+ /**
+ * Sets a device. The ownership is transferred.
+ *
+ * @param aDev the device to be set.
+ */
+ IMPORT_C void SetDeviceL( CBTDevice* aDev );
+
+ /**
+ * Make a copy of this evice.
+ *
+ * @return a new device instance.
+ */
+ IMPORT_C CBtDevExtension* CopyL();
+
+public:
+
+ /**
+ * Internally invoked in this module, not a DLL level API.
+ *
+ * Sets the service connection status of this device.
+ */
+ void SetServiceConnectionStatus( TBTEngConnectionStatus aStatus );
+
+private:
+
+ /**
+ * C++ default constructor
+ */
+ CBtDevExtension( TDefaultDevNameOption aNameOption );
+
+ /**
+ * Symbian 2nd-phase constructor
+ */
+ void ConstructL( CBTDevice* aDev );
+
+ /**
+ * Update device properties due to setDeviceL or other events.
+ */
+ void UpdateNameL();
+
+ /**
+ * Update the service connection status for this device:
+ */
+ //void UpdateServiceStatusL();
+
+ /**
+ * formats the BD_Addr as the device name.
+ */
+ void FormatAddressAsNameL();
+
+private:
+
+ RBuf iAlias; // contains:
+ // friendly name, if it is not empty; else
+ // device name, if it is not empty; else
+ // the assignment depending on the option chosen by client.
+
+ // The Device instance ( in most case it is given by registry)
+ CBTDevice* iDev;
+
+ // The bits of dynamic status
+ TInt iDynamicStatus;
+
+ // Indicates the service connection status of this device
+ TBTEngConnectionStatus iServiceStatus;
+
+ // The option chosen by the client to deal with default BT name assignment.
+ TDefaultDevNameOption iNameOption;
+ };
+
+typedef RPointerArray<CBtDevExtension> RDevExtensionArray;
+
+#endif /*BTDEVEXTENSION_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/export/btdevrepository.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The repository of remote devices from BT registry
+*
+*/
+
+#ifndef BTDEVICEREPOSITORY_H
+#define BTDEVICEREPOSITORY_H
+
+#include <btdevice.h>
+#include <btmanclient.h>
+#include <btservices/btdevextension.h>
+
+class CBtDevRepositoryImpl;
+
+/**
+ * APIs from this class offer functionalities that are common in mw and app
+ * components of Bluetooth packages. They do not serve as domain APIs.
+ *
+ * Using these from external components is risky, due to possible source
+ * and binary breaks in future.
+ *
+ */
+
+/**
+ * Class MBtDevRepositoryObserver
+ *
+ * Callback class to notify changes in BT registry.
+ */
+class MBtDevRepositoryObserver
+ {
+public:
+
+ /**
+ * Callback to notify that the repository has finished initialization.
+ * Initialization completion means the repository has retieved all
+ * Bluetooth devices from BT registry, and it is subscribing to
+ * registry update events.
+ *
+ */
+ virtual void RepositoryInitialiazed() = 0;
+
+ /**
+ * Callback to notify that a device has been deleted from BT registry.
+ *
+ *
+ * @param aAddr the bd_addr of the deleted device
+ */
+ virtual void BtDeviceDeleted( const TBTDevAddr& aAddr ) = 0;
+
+ /**
+ * Callback to notify that the device has been added to BT registry.
+ *
+ * @param aDevice the device that has been added to registry
+ */
+ virtual void BtDeviceAdded( const CBtDevExtension& aDevice ) = 0;
+
+ /**
+ * Callback to notify that the property of a device in BT registry has been
+ * changed.
+ *
+ * @param aDevice the device that possesses the latest properties.
+ * @param aSimilarity the similarity of the properties comparing to the ones
+ * prior to this change.
+ * Refer CBTDevice::TBTDeviceNameSelector and
+ * TBTNamelessDevice::TBTDeviceSet for the meanings of the bits
+ * in this parameter.
+ */
+ virtual void BtDeviceChangedInRegistry(
+ const CBtDevExtension& aDevice, TUint aSimilarity ) = 0;
+ };
+
+/**
+ * Class CBtDevRepository
+ *
+ * This class provides the full access to remote devices in BT registry,
+ * and informs client when the properties of remote devices are changed.
+ *
+ */
+NONSHARABLE_CLASS( CBtDevRepository ) : public CBase
+ {
+public:
+
+ /**
+ * Two-phase constructor
+ */
+ IMPORT_C static CBtDevRepository* NewL();
+
+ /**
+ * Destructor
+ */
+ IMPORT_C virtual ~CBtDevRepository();
+
+ /**
+ * Add an observer to this reposity for receivng repository update
+ * events.
+ * @param aObserver the observer to be added.
+ */
+ IMPORT_C void AddObserverL( MBtDevRepositoryObserver* aObserver );
+
+ /**
+ * Remove an observer from this repository.
+ * @param aObserver the observer to be removed.
+ */
+ IMPORT_C void RemoveObserver( MBtDevRepositoryObserver* aObserver );
+
+ /**
+ * Tells if this repository has finished the initialization.
+ * Initialization completion means the repository has retieved all
+ * Bluetooth devices from BT registry, and it is subscribing to
+ * registry update events.
+ */
+ IMPORT_C TBool IsInitialized() const;
+
+ /**
+ * Get all devices in this repository.
+ * @return the device list
+ */
+ IMPORT_C const RDevExtensionArray& AllDevices() const;
+
+ /**
+ * Get a specific device by the given address.
+ * @param aAddr the address of the device to be retrieved
+ * @return the device pointer, NULL if the device is unavailable.
+ */
+ IMPORT_C const CBtDevExtension* Device( const TBTDevAddr& aAddr ) const;
+
+private:
+
+ /**
+ * C++ default constructor
+ */
+ CBtDevRepository();
+
+ /**
+ * Symbian 2nd-phase constructor
+ */
+ void ConstructL();
+
+private:
+
+ CBtDevRepositoryImpl* iImpl;
+ };
+
+#endif /*BTDEVICEREPOSITORY_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/export/btsimpleactive.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Active object helper class.
+*
+*/
+
+#ifndef BTSIMPLEACTIVE_H
+#define BTSIMPLEACTIVE_H
+
+#include <e32base.h>
+
+class CBtSimpleActive;
+
+/**
+ * APIs from this class offer functionalities that are common in mw and app
+ * components of Bluetooth packages. They do not serve as domain APIs.
+ *
+ * Using these from external components is risky, due to possible source
+ * and binary breaks in future.
+ *
+ */
+
+
+/**
+ * Class MBtSimpleActiveObserver
+ *
+ * Callback class for receiving a completed active object event.
+ * Users of CBtSimpleActive need to derive from this class.
+ *
+ * @lib bteng*.lib
+ * @since S60 v3.2
+ */
+class MBtSimpleActiveObserver
+ {
+public:
+
+ /**
+ * Callback from RunL() to notify that an outstanding request has completed.
+ *
+ * @since Symbian^4
+ * @param aActive Pointer to the active object that completed.
+ * @param aStatus The status of the completed request.
+ */
+ virtual void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus ) = 0;
+
+ /**
+ * Callback from Docancel() for handling cancelation of an outstanding request.
+ *
+ * @since Symbian^4
+ * @param aId The ID that identifies the outstanding request.
+ */
+ virtual void CancelRequest( TInt aRequestId ) = 0;
+
+ /**
+ * Callback from RunError() to notify that an error has occurred in RunL.
+ *
+ * @since Symbian^4
+ * @param aActive Pointer to the active object that completed.
+ * @param aError The error occurred in RunL.
+ */
+ virtual void HandleError( CBtSimpleActive* aActive, TInt aError ) = 0;
+ };
+
+/**
+ * Class CBtSimpleActive.
+ *
+ * This Active Object provides its client a TRequestStatus for performing
+ * asynchronous requests. It does not know the detail of the asynch operation.
+ * All of AO callbacks, such as RunL, will be delegated to the client
+ * for processing, via interface MBtSimpleActiveObserver.
+ *
+ */
+NONSHARABLE_CLASS ( CBtSimpleActive ): public CActive
+ {
+
+public:
+
+ /**
+ * Two-phase constructor
+ *
+ * @since Symbian^4
+ * @param aObserver Pointer to callback interface that receives notification
+ * that the request has been completed.
+ * @param aId Identifier for the CBtSimpleActive instance.
+ * @param aPriority The priority of the active object.
+ * @return Pointer to the constructed CBtSimpleActive object.
+ */
+ IMPORT_C static CBtSimpleActive* NewL( MBtSimpleActiveObserver& aObserver, TInt aId,
+ TInt aPriority = CActive::EPriorityStandard );
+
+ /**
+ * Destructor
+ */
+ IMPORT_C virtual ~CBtSimpleActive();
+
+ /**
+ * Get the request ID of this active object.
+ *
+ * @since Symbian^4
+ * @return The request ID of this active object.
+ */
+ IMPORT_C TInt RequestId();
+
+ /**
+ * Set a new request ID for this active object.
+ *
+ * @since Symbian^4
+ * @param The new request ID of this active object.
+ */
+ IMPORT_C void SetRequestId( TInt aId );
+
+ /**
+ * Activate the active object.
+ *
+ * @since Symbian^4
+ */
+ IMPORT_C void GoActive();
+
+ /**
+ * Get a reference to the active object request status.
+ *
+ * @since Symbian^4
+ * @return Reference to the active object request status.
+ */
+ IMPORT_C TRequestStatus& RequestStatus();
+
+private:
+// from base class CActive
+
+ /**
+ * From CActive.
+ * Called by the active scheduler when the request has been cancelled.
+ *
+ * @since S60 v3.2
+ */
+ void DoCancel();
+
+ /**
+ * From CActive.
+ * Called by the active scheduler when the request has been completed.
+ *
+ * @since S60 v3.2
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * Called by the active scheduler when an error in RunL has occurred.
+ *
+ * @since S60 v3.2
+ */
+ TInt RunError( TInt aError );
+
+private:
+
+ /**
+ * C++ default constructor
+ *
+ * @since S60 v3.2
+ * @param aObserver Pointer to callback interface that receives notification
+ * that the request has been completed.
+ * @param aId ID of the request (for the client to keep track of multiple
+ * active objects).
+ * @param aPriority Priority of
+ */
+ CBtSimpleActive( MBtSimpleActiveObserver& aObserver, TInt aId, TInt aPriority );
+
+private: // data
+
+ /**
+ * ID of the request (used only by our client).
+ */
+ TInt iRequestId;
+
+ /**
+ * Our observer.
+ * Not own.
+ */
+ MBtSimpleActiveObserver& iObserver;
+
+ };
+
+#endif // BTSIMPLEACTIVE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/export/devdiscoveryobserver.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef DEVDISCOVEREYOBSERVER_H
+#define DEVDISCOVEREYOBSERVER_H
+
+#include <btdevice.h>
+#include <bt_sock.h>
+
+/**
+ * Class MDevDiscoveryObserver
+ *
+ * Callback class to notify the completion of device discovery.
+ */
+class MDevDiscoveryObserver
+ {
+public:
+
+ /**
+ * Callback to notify that a device has been found.
+ *
+ * @param aAddr the inquiry address that contains the inquiry information
+ * of the found device.
+ * @param aName the Bluetooth device name of the found device
+ */
+ virtual void HandleNextDiscoveryResultL(
+ const TInquirySockAddr& aAddr, const TDesC& aName ) = 0;
+
+ /**
+ * Callback to notify that the device search has completed.
+ *
+ * @param aErr the error code of device search result.
+ */
+ virtual void HandleDiscoveryCompleted( TInt aErr ) = 0;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/group/bld.inf Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* ============================================================================
+* Name : bld.inf
+* Part of : bluetoothengine / bluetoothengine
+* Description : Build information file for bluetoothengine subsystem
+*
+* Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1.1
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../export/btsimpleactive.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btsimpleactive.h)
+../export/btdevextension.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btdevextension.h)
+../export/advancedevdiscoverer.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/advancedevdiscoverer.h)
+../export/devdiscoveryobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/devdiscoveryobserver.h)
+../export/btdevrepository.h MW_LAYER_PLATFORM_EXPORT_PATH(btservices/btdevrepository.h)
+../rom/btserviceutil.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btserviceutil.iby)
+
+PRJ_MMPFILES
+btserviceutil.mmp
+
+PRJ_TESTMMPFILES
+../tsrc/btserviceutiltest/group/btserviceutiltest.mmp
+
+PRJ_TESTEXPORTS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/group/btserviceutil.mmp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for project btservice utility
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET btserviceutil.dll
+TARGETTYPE dll
+UID 0x1000008d 0x2002E6E0
+
+CAPABILITY CAP_GENERAL_DLL
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+
+SOURCE btsimpleactive.cpp
+SOURCE btdevextension.cpp
+SOURCE btdevrepository.cpp
+SOURCE btdevrepositoryimpl.cpp
+
+SOURCE basicdevdiscoverer.cpp
+SOURCE advancebtdevdiscoverer.cpp
+SOURCE advancedevdiscovererimpl.cpp
+
+USERINCLUDE ../inc
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY btdevice.lib
+LIBRARY btmanclient.lib
+LIBRARY bluetooth.lib
+LIBRARY esock.lib
+LIBRARY btengconnman.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/inc/advancedevdiscovererimpl.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declares Bluetooth device inquiry helper class.
+*
+*/
+
+#ifndef ADVANCEDEVDISCOVERERIMPL_H
+#define ADVANCEDEVDISCOVERERIMPL_H
+
+#include <btservices/devdiscoveryobserver.h>
+
+#include <btservices/btsimpleactive.h>
+#include <btservices/advancedevdiscoverer.h>
+
+class CBasicDevDiscoverer;
+class CBtDevRepository;
+class CBtDevExtension;
+
+/**
+* A helper class for searching nearby Bluetooth devices.
+*/
+NONSHARABLE_CLASS(CAdvanceDevDiscovererImpl) : public CBase,
+ public MDevDiscoveryObserver,
+ public MBtSimpleActiveObserver
+ {
+public:
+ /**
+ * instantiator
+ */
+ static CAdvanceDevDiscovererImpl* NewL(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CAdvanceDevDiscovererImpl();
+
+ /**
+ * sets the inquiry result observer.
+ *
+ * @param aObserver the new observer to receive inquiry results
+ */
+ void SetObserver( MDevDiscoveryObserver& aObserver );
+
+ /**
+ * Cancels all inquiry activity.
+ */
+ void Cancel();
+
+ /**
+ * Discover currently in-range devices that matches the given major device class type.
+ * Found devices will be informed by
+ * MBtAdvanceDevDiscoveryObserver::HandleNextDiscoveryResult().
+ *
+ * When no more device can be found,
+ * MBtAdvanceDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued.
+ *
+ * @param aFilter the filter that shall be applied when a device
+ * is discovered. If this is specified, only a device passing
+ * the filter will be informed to client.
+ *
+ * @param aDeviceClass the major device class which a found device
+ * must match.
+ */
+ void DiscoverDeviceL(
+ CAdvanceDevDiscoverer::TDevDiscoveryFilter aFilter,
+ TBTMajorDeviceClass aDeviceClass );
+
+ /**
+ * Discover currently in-range devices that match the given major device class.
+ * The devices in the given priority list have higher priority to
+ * be discovered, i.e., inquiry on these devices will take place first.
+ *
+ * Found devices will be informed by
+ * MDevDiscoveryObserver::HandleNextDiscoveryResult().
+ *
+ * When no more device can be found,
+ * MDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued.
+ *
+ * @param aPriorityList contains the devices to be discovered first
+ */
+ void DiscoverDeviceL(
+ const RBTDevAddrArray& aPriorityList );
+
+private:
+
+ // from MDevDiscoveryObserver
+
+ /**
+ * Callback to notify that a device has been found.
+ *
+ * @param aAddr the inquiry address that contains the inquiry information
+ * of the found device.
+ * @param aName the Bluetooth device name of the found device
+ */
+ void HandleNextDiscoveryResultL(
+ const TInquirySockAddr& aAddr, const TDesC& aName );
+
+ /**
+ * Callback to notify that the device search has completed.
+ *
+ * @param aErr the error code of device search result.
+ */
+ void HandleDiscoveryCompleted( TInt aErr );
+
+ // from MBtSimpleActiveObserver
+
+ /**
+ * Callback to notify that an outstanding request has completed.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param aStatus The status of the completed request.
+ */
+ void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @param aId The ID that identifies the outstanding request.
+ */
+ void CancelRequest( TInt aId );
+
+ /**
+ * Callback to notify that an error has occurred in RunL.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param aError The error occurred in RunL.
+ */
+ void HandleError( CBtSimpleActive* aActive, TInt aError );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CAdvanceDevDiscovererImpl(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver );
+
+ /**
+ * The 2nd phase constructor
+ */
+ void ConstructL();
+
+private: // Data
+
+ // for retrieving device properties
+ // Not own
+ CBtDevRepository& iDevRep;
+
+ // our client
+ // Not own
+ MDevDiscoveryObserver& iObserver;
+
+ // The class doing actual inquirying
+ CBasicDevDiscoverer* iBasicDiscoverer;
+
+ // filters from CAdvanceDevDiscoverer::TDevDiscoveryFilter
+ TInt iFilter;
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/inc/basicdevdiscoverer.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Declares Bluetooth device inquiry helper class.
+*
+*/
+
+#ifndef BASICDEVDISCOVERER_H
+#define BASICDEVDISCOVERER_H
+
+#include <btdevice.h>
+#include <bt_sock.h>
+#include <btservices/btsimpleactive.h>
+
+class MDevDiscoveryObserver;
+
+class CDeviceSearchRecord : public CBase
+ {
+public:
+ TInquirySockAddr iAddr;
+ TBTDeviceName iName;
+ };
+
+/**
+* A basic implementation for searching nearby Bluetooth devices.
+*/
+NONSHARABLE_CLASS(CBasicDevDiscoverer) : public CBase, public MBtSimpleActiveObserver
+ {
+public:
+
+ /**
+ * factory method
+ */
+ static CBasicDevDiscoverer* NewL( MDevDiscoveryObserver& aObserver );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CBasicDevDiscoverer();
+
+ /**
+ * sets the inquiry result observer.
+ *
+ * @param aObserver the new observer to receive inquiry results
+ */
+ void SetObserver( MDevDiscoveryObserver& aObserver );
+
+ /**
+ * Cancels all inquiry activity.
+ */
+ void Cancel();
+
+ /**
+ * Discover currently in-range devices that matches the given major device class type.
+ * Found devices will be informed by
+ * MDevDiscoveryObserver::HandleNextDiscoveryResult().
+ *
+ * When no device can be found any more,
+ * MDevDiscoveryObserver::HandleDiscoveryCompleted() will be issued.
+ *
+ * @param aDeviceClass the major device class device must match.
+ */
+ void DiscoverDeviceL( TBTMajorDeviceClass aDeviceClass = EMajorDeviceMisc );
+
+private: // from MBtSimpleActiveObserver
+
+ /**
+ * Callback to notify that an outstanding request has completed.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param aStatus The status of the completed request.
+ */
+ void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * Callback for handling cancelation of an outstanding request.
+ *
+ * @param aId The ID that identifies the outstanding request.
+ */
+ void CancelRequest( TInt aId );
+
+ /**
+ * Callback to notify that an error has occurred in RunL.
+ *
+ * @param aActive Pointer to the active object that completed.
+ * @param aError The error occurred in RunL.
+ */
+ void HandleError( CBtSimpleActive* aActive, TInt aError );
+
+private:
+
+ /**
+ * C++ default constructor.
+ */
+ CBasicDevDiscoverer( MDevDiscoveryObserver& aObserver );
+
+ /**
+ * The 2nd phase constructor
+ */
+ void ConstructL();
+
+ /*
+ * retrieves the device name of the device pointed by
+ * iPagingNamePos to local array.
+ */
+ void PageNextDeviceName();
+
+ /**
+ * Performs the result from an inquiry operation.
+ */
+ TInt HandleInquiryResultL();
+
+ /**
+ * Create a heap object of CDeviceSearchRecord.
+ */
+ CDeviceSearchRecord* NewInstanceL(
+ const TInquirySockAddr& aAddr, const TDesC& aName = KNullDesC );
+
+ /**
+ * resets the state and memory caused by a client request.
+ */
+ void Reset();
+
+private: // Data
+
+ // Not own
+ MDevDiscoveryObserver& iObserver;
+
+ // The major device class filter from the client.
+ TBTMajorDeviceClass iMajorDeviceClassFilter;
+
+ // For inquiry and paging names:
+ CBtSimpleActive* iActive;
+
+ RSocketServ iSocketServer;
+ RHostResolver iHostResolver;
+ TInquirySockAddr iInquirySockAddr;
+ TNameEntry iEntry; // Inquiry result record
+
+ // Devices found so far
+ RPointerArray<CDeviceSearchRecord> iDevices;
+
+ // position in array iDevices: the item the current name paging operation is for
+ TInt iPagingNamePos;
+
+ };
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/inc/btdevrepositoryimpl.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: The repository of remote devices from BT registry
+*
+*/
+
+#ifndef BTDEVICEREPOSITORYIMPL_H
+#define BTDEVICEREPOSITORYIMPL_H
+
+#include <bttypes.h>
+#include <bt_sock.h>
+#include <btmanclient.h>
+#include <e32property.h>
+#include <btengconnman.h>
+#include <btservices/btsimpleactive.h>
+#include <btservices/btdevextension.h>
+
+class MBtDevRepositoryObserver;
+
+/**
+ * Class CBtDevRepositoryImpl
+ *
+ * This class keep a storage of remote device information.
+ *
+ */
+NONSHARABLE_CLASS( CBtDevRepositoryImpl ) :
+ public CBase,
+ public MBtSimpleActiveObserver,
+ public MBTEngConnObserver
+ {
+public:
+
+ /**
+ * Two-phase constructor
+ */
+ static CBtDevRepositoryImpl* NewL();
+
+ /**
+ * Destructor
+ */
+ ~CBtDevRepositoryImpl();
+
+ /**
+ * Add an observer to this reposity for receivng repository update
+ * events.
+ * @param aObserver the observer to be added.
+ */
+ void AddObserverL( MBtDevRepositoryObserver* aObserver );
+
+ /**
+ * Remove an observer from this repository.
+ * @param aObserver the observer to be removed.
+ */
+ void RemoveObserver( MBtDevRepositoryObserver* aObserver );
+
+ /**
+ * Tells if this repository has finished the initialization.
+ * Initialization completion means the repository has retieved all
+ * Bluetooth devices from BT registry, and it is subscribing to
+ * registry update events.
+ */
+ TBool IsInitialized() const;
+
+ /**
+ * Gets all devices in this repository.
+ * @return the device list.
+ */
+ const RDevExtensionArray& AllDevices() const;
+
+ /**
+ * Get a specific device by the given address.
+ * @param aAddr the address of the device to be retrieved
+ * @return the device pointer, NULL if the device is unavailable.
+ */
+ const CBtDevExtension* Device( const TBTDevAddr& aAddr ) const;
+
+ /**
+ * Returns the service (limited to services managed in bteng scope)
+ * level connection status of the specified device.
+ *
+ * @param aAddr the address of the device
+ * @return one of TBTEngConnectionStatus enums
+ */
+ //TBTEngConnectionStatus IsDeviceConnected( const TBTDevAddr& aAddr );
+
+private:
+
+ // from MBtSimpleActiveObserver
+
+ /**
+ * Callback from RunL() to notify that an outstanding request has completed.
+ *
+ * @since Symbian^4
+ * @param aActive Pointer to the active object that completed.
+ * @param aStatus The status of the completed request.
+ */
+ void RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus );
+
+ /**
+ * Callback from Docancel() for handling cancelation of an outstanding request.
+ *
+ * @since Symbian^4
+ * @param aId The ID that identifies the outstanding request.
+ */
+ void CancelRequest( TInt aRequestId );
+
+ /**
+ * Callback from RunError() to notify that an error has occurred in RunL.
+ *
+ * @since Symbian^4
+ * @param aActive Pointer to the active object that completed.
+ * @param aError The error occurred in RunL.
+ */
+ void HandleError( CBtSimpleActive* aActive, TInt aError );
+
+ // From MBTEngConnObserver
+
+ /**
+ * Indicates to the caller that a service-level connection has completed.
+ * This function is called for both incoming and outgoing connections.
+ * This function is also called when an outgoing connection request fails,
+ * e.g. with error code KErrCouldNotConnect.
+ * When this function is called, new commands can be issued to the
+ * CBTEngConnMan API immediately.
+ * @param aAddr The address of the remote device.
+ * @param aErr Status information of the connection. KErrNone if the
+ * connection succeeded, otherwise the error code with
+ * which the outgoing connection failed. KErrAlreadyExists
+ * is returned if there already is an existing connection
+ * for the selected profile(s), or otherwise e.g.
+ * KErrCouldNotConnect or KErrDisconnected for indicating
+ * connection problems.
+ * @param aConflicts If there already is a connection for the selected
+ * profile(s) of an outgoing connection request (the
+ * selection is performed by BTEng), then this array
+ * contains the bluetooth device addresses of the
+ * remote devices for those connections.
+ */
+ void ConnectComplete( TBTDevAddr& aAddr, TInt aErr,
+ RBTDevAddrArray* aConflicts = NULL );
+
+ /**
+ * Indicates to the caller that a service-level connection has disconnected.
+ * When this function is called, new commands can be issued to the
+ * CBTEngConnMan API immediately.
+ *
+ * @param aAddr The address of the remote device.
+ * @param aErr The error code with which the disconnection occured.
+ * KErrNone for a normal disconnection,
+ * or e.g. KErrDisconnected if the connection was lost.
+ */
+ void DisconnectComplete( TBTDevAddr& aAddr, TInt aErr );
+
+private:
+
+ /**
+ * C++ default constructor
+ */
+ CBtDevRepositoryImpl();
+
+ /**
+ * Symbian 2nd-phase constructor
+ */
+ void ConstructL();
+
+ /**
+ * Creates a registry view which shall contain all remote devices.
+ */
+ void CreateRemoteDeviceView();
+
+ /**
+ * retrieves remote devices from registry.
+ */
+ void GetRemoteDevicesL();
+
+ /**
+ * handles the completion of paired device view creation
+ */
+ void HandleCreateRemoteDeviceViewCompletedL( TInt aStatus);
+
+ /**
+ * handles the completion of getting paired devices
+ */
+ void HandleGetRemoteDevicesCompletedL( TInt aStatus );
+
+ /**
+ * Copy the remote devices to internal array storage.
+ */
+ void UpdateRemoteDeviceRepositoryL();
+
+private:
+
+ /**
+ * The observers
+ * do not own them.
+ */
+ RPointerArray<MBtDevRepositoryObserver> iObservers;
+
+ /**
+ * Registry sub session for remote device db.
+ * not own
+ */
+ RBTRegistry iBTRegistry;
+
+ // own.
+ RBTRegServ iBTRegServ;
+
+ /**
+ * AO for registry operations
+ * own.
+ */
+ CBtSimpleActive* iRegistryActive;
+
+ /**
+ * the counter of not handled registry events.
+ */
+ TInt iNotHandledRegEventCounter;
+
+ /**
+ * temporary instance to retrieve paired devices.
+ * own.
+ */
+ CBTRegistryResponse* iRegRespRemoteDevices;
+
+ /**
+ * Property containing the BT registry change monitoring key
+ * own.
+ */
+ RProperty iBtRegistryKey;
+
+ /**
+ * AO for subscribing registry PubSub key
+ * own.
+ */
+ CBtSimpleActive* iRegistryKeyActive;
+
+ /**
+ * For connection status
+ */
+ CBTEngConnMan* iBtengConn;
+
+ /**
+ * contains the list of all devices.
+ * own.
+ */
+ RDevExtensionArray iDevices;
+
+ TInt iInitialized;
+
+ };
+
+#endif /*BTDEVICEREPOSITORYIMPL_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/inc/btserviceutilconsts.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Internal symbolic constants of this component
+*
+*/
+
+#ifndef BTSERVICEUTILCONSTS_H
+#define BTSERVICEUTILCONSTS_H
+
+#include <e32base.h>
+
+namespace BtServiceUtil {
+
+const TInt KServiceRequestIdBase = 0x100;
+
+enum TRequestIdentifier
+ {
+ // Inquiry with Host Resolver
+ EBluetoothInquiry = KServiceRequestIdBase,
+ // Get the name of a device
+ EBluetoothPageDeviceName,
+ // Schedule the notification of search completion
+ EAsyncNotifyDeviceSearchCompleted,
+ // Create view table of remote devices from BT registry
+ ECreateRemoteDeviceViewRequest,
+ // Retrieves remote devices from BT registry
+ EGetRemoteDevicesRequest,
+ // Subsribes the PubSub key for BT registry update events
+ ERegistryPubSubWatcher
+ };
+}
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/rom/btserviceutil.iby Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for project btserviceutil
+*
+*/
+
+
+#ifndef BTSERVICEUTIL_IBY
+#define BTSERVICEUTIL_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef __BT
+file=ABI_DIR\BUILD_DIR\btserviceutil.dll SHARED_LIB_DIR\btserviceutil.dll
+
+#endif // __BT
+
+#endif // BTSERVICEUTIL_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/advancebtdevdiscoverer.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CAdvanceDevDiscoverer class: the interface class for
+* searching in-range Bluetooth devices using Host Resolver.
+*
+*/
+
+#include <btservices/advancedevdiscoverer.h>
+#include "advancedevdiscovererimpl.h"
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscoverer::CAdvanceDevDiscoverer
+// ----------------------------------------------------------
+//
+CAdvanceDevDiscoverer::CAdvanceDevDiscoverer()
+ {
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscoverer::CAdvanceDevDiscoverer
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscoverer::ConstructL(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver )
+ {
+ iImpl = CAdvanceDevDiscovererImpl::NewL( aDevRep, aObserver );
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscoverer::NewL
+// ----------------------------------------------------------
+//
+EXPORT_C CAdvanceDevDiscoverer* CAdvanceDevDiscoverer::NewL(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver )
+ {
+ CAdvanceDevDiscoverer* self = new (ELeave) CAdvanceDevDiscoverer();
+ CleanupStack::PushL( self );
+ self->ConstructL( aDevRep, aObserver );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------
+//
+EXPORT_C CAdvanceDevDiscoverer::~CAdvanceDevDiscoverer()
+ {
+ delete iImpl;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscoverer::SetObserver
+// ----------------------------------------------------------
+//
+EXPORT_C void CAdvanceDevDiscoverer::SetObserver(
+ MDevDiscoveryObserver& aObserver )
+ {
+ iImpl->SetObserver( aObserver );
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscoverer::DiscoverDeviceL
+// ----------------------------------------------------------
+//
+EXPORT_C void CAdvanceDevDiscoverer::DiscoverDeviceL(
+ TDevDiscoveryFilter aFilter,
+ TBTMajorDeviceClass aDeviceClass )
+ {
+ iImpl->DiscoverDeviceL( aFilter, aDeviceClass );
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscoverer::CancelDiscovery
+// ----------------------------------------------------------
+//
+EXPORT_C void CAdvanceDevDiscoverer::CancelDiscovery()
+ {
+ iImpl->Cancel();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/advancedevdiscovererimpl.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: class for searching BT devices
+*
+*/
+#include "advancedevdiscovererimpl.h"
+#include "basicdevdiscoverer.h"
+
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::CAdvanceDevDiscovererImpl
+// ----------------------------------------------------------
+//
+CAdvanceDevDiscovererImpl::CAdvanceDevDiscovererImpl(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver )
+ :iDevRep( aDevRep ), iObserver( aObserver )
+ {
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::ConstructL
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::ConstructL()
+ {
+ iBasicDiscoverer = CBasicDevDiscoverer::NewL( *this );
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::NewL
+// ----------------------------------------------------------
+//
+CAdvanceDevDiscovererImpl* CAdvanceDevDiscovererImpl::NewL(
+ CBtDevRepository& aDevRep,
+ MDevDiscoveryObserver& aObserver )
+ {
+ CAdvanceDevDiscovererImpl* self =
+ new (ELeave) CAdvanceDevDiscovererImpl( aDevRep, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::
+// ----------------------------------------------------------
+//
+CAdvanceDevDiscovererImpl::~CAdvanceDevDiscovererImpl()
+ {
+ delete iBasicDiscoverer;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::SetObserver
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::SetObserver( MDevDiscoveryObserver& aObserver )
+ {
+ iObserver = aObserver;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::Cancel()
+ {
+ iBasicDiscoverer->Cancel();
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::DiscoverDeviceL(
+ CAdvanceDevDiscoverer::TDevDiscoveryFilter aFilter,
+ TBTMajorDeviceClass aDeviceClass )
+ {
+ iBasicDiscoverer->DiscoverDeviceL( aDeviceClass );
+ iFilter = aFilter;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::DiscoverDeviceL
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::DiscoverDeviceL(
+ const RBTDevAddrArray& aPriorityList )
+ {
+ // to be implemented when BTUI requires this feature.
+ ( void ) aPriorityList;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::HandleNextDiscoveryResult
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::HandleNextDiscoveryResultL(
+ const TInquirySockAddr& aAddr, const TDesC& aName )
+ {
+ TBool filtered = EFalse;
+ if ( iFilter )
+ {
+ // For filtering, we need to examine the properties of
+ // this device from repository.
+ const CBtDevExtension* devExt = iDevRep.Device( aAddr.BTAddr() );
+ // No filter is needed if this device is not in registry.
+ if ( devExt )
+ {
+ if ( iFilter & CAdvanceDevDiscoverer::ExcludeUserAwareBonded)
+ {
+ // client does not want to discover devices that have been
+ // bonded already.
+ if ( devExt->IsUserAwareBonded() )
+ {
+ filtered = ETrue;
+ }
+ }
+ }
+ }
+ if ( !filtered )
+ {
+ iObserver.HandleNextDiscoveryResultL( aAddr, aName );
+ }
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::HandleDiscoveryCompleted
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::HandleDiscoveryCompleted( TInt aErr )
+ {
+ iObserver.HandleDiscoveryCompleted( aErr );
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::RequestCompletedL
+// Inform caller for received device and issue next EIR/Name request
+// if the request was successful.
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus )
+ {
+ (void) aActive;
+ (void) aStatus;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::CancelRequest
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::CancelRequest( TInt aId )
+ {
+ (void) aId;
+ }
+
+// ----------------------------------------------------------
+// CAdvanceDevDiscovererImpl::HandleError
+// ----------------------------------------------------------
+//
+void CAdvanceDevDiscovererImpl::HandleError( CBtSimpleActive* aActive, TInt aError )
+ {
+ (void) aActive;
+ (void) aError;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/basicdevdiscoverer.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,318 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: class for searching BT devices
+*
+*/
+#include "basicdevdiscoverer.h"
+#include <btservices/devdiscoveryobserver.h>
+#include "btserviceutilconsts.h"
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::CBasicDevDiscoverer
+// ----------------------------------------------------------
+//
+CBasicDevDiscoverer::CBasicDevDiscoverer( MDevDiscoveryObserver& aObserver )
+ : iObserver( aObserver )
+ {
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::ConstructL
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::ConstructL()
+ {
+ User::LeaveIfError( iSocketServer.Connect() );
+ iActive = CBtSimpleActive::NewL( *this, BtServiceUtil::EBluetoothInquiry );
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::NewL
+// ----------------------------------------------------------
+//
+CBasicDevDiscoverer* CBasicDevDiscoverer::NewL( MDevDiscoveryObserver& aObserver )
+ {
+ CBasicDevDiscoverer* self = new (ELeave)
+ CBasicDevDiscoverer( aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::
+// ----------------------------------------------------------
+//
+CBasicDevDiscoverer::~CBasicDevDiscoverer()
+ {
+ delete iActive;
+ Reset();
+ iSocketServer.Close();
+ iDevices.Close();
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::SetObserver
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::SetObserver( MDevDiscoveryObserver& aObserver )
+ {
+ iObserver = aObserver;
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::Cancel()
+ {
+ iActive->Cancel();
+ iHostResolver.Close();
+ iDevices.ResetAndDestroy();
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::DiscoverDeviceL(TBTMajorDeviceClass aDeviceClass )
+ {
+ // This class supports only one request at the time:
+ if ( iActive->IsActive() )
+ {
+ User::Leave( KErrInUse );
+ }
+ Reset();
+ iMajorDeviceClassFilter = aDeviceClass;
+ _LIT( KLinkMgrDes, "BTLinkManager" );
+ // Associate with bluetooth Link Manager.
+ TProtocolName protocol( KLinkMgrDes );
+ TProtocolDesc pInfo;
+ User::LeaveIfError( iSocketServer.FindProtocol( protocol, pInfo));
+ User::LeaveIfError( iHostResolver.Open(iSocketServer,
+ pInfo.iAddrFamily, pInfo.iProtocol));
+ iActive->SetRequestId( BtServiceUtil::EBluetoothInquiry );
+ iInquirySockAddr.SetAction( KHostResInquiry + KHostResEir + KHostResIgnoreCache );
+ // We always do Generic Inquiry.
+ // Limited Inquiry could be added here in future on business need.
+ iInquirySockAddr.SetIAC(KGIAC);
+ iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iActive->RequestStatus() );
+ iActive->GoActive();
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::RequestCompletedL
+// Inform caller for received device and issue next EIR/Name request
+// if the request was successful.
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus )
+ {
+ TInt errToObserver( aStatus );
+ // position in array iDevices: the device item the observer will be notified of.
+ TInt devToNotify ( KErrNotFound );
+
+ if ( aActive->RequestId() == BtServiceUtil::EBluetoothInquiry )
+ {
+ if ( aStatus == KErrNone )
+ {
+ TInt pos = HandleInquiryResultL();
+ // continue to inquiry for more devices in range
+ iHostResolver.Next( iEntry, iActive->RequestStatus() );
+ iActive->GoActive();
+ if ( pos > KErrNotFound && iDevices[pos]->iName.Length() > 0 )
+ {
+ devToNotify = pos;
+ }
+ }
+ else if( iDevices.Count() > 0 )
+ {
+ // an error from inquiry operation.
+ // we move to next step to get device names if some devices have been
+ // found but without a name.
+ iPagingNamePos = iDevices.Count() - 1;
+ aActive->SetRequestId( BtServiceUtil::EBluetoothPageDeviceName );
+ PageNextDeviceName();
+ }
+ }
+ else if ( aActive->RequestId() == BtServiceUtil::EBluetoothPageDeviceName )
+ {
+ errToObserver = KErrNone;
+ devToNotify = iPagingNamePos;
+ // the name in iEntry was reset before paging operation, so we
+ // can rely on this length() at this time:
+ if ( aStatus == KErrNone && iEntry().iName.Length() > 0 )
+ {
+ iDevices[iPagingNamePos]->iName = iEntry().iName;
+ }
+ // the return error is not checked here. We continue to page the rest
+ // device names.
+ --iPagingNamePos;
+ PageNextDeviceName();
+ }
+ // request ID is BtServiceUtil::EAsyncNotifyDeviceSearchCompleted
+ else
+ {
+ iObserver.HandleDiscoveryCompleted( errToObserver );
+ return;
+ }
+
+ // AO not active means that this is neither inquiring nor paging name.
+ // Schedule an operation completion callback:
+ if ( !iActive->IsActive() &&
+ aActive->RequestId() != BtServiceUtil::EAsyncNotifyDeviceSearchCompleted )
+ {
+ // We inform the client of operation completion asynchronously, so that
+ // we will not end up with problems, e.g., invalid memory,
+ // if the client issues more request in the callback context.
+ aActive->SetRequestId( BtServiceUtil::EAsyncNotifyDeviceSearchCompleted );
+ aActive->RequestStatus() = KRequestPending;
+ TRequestStatus* sta = &aActive->RequestStatus();
+ User::RequestComplete( sta, errToObserver );
+ aActive->GoActive();
+ }
+
+ // This could be possible in both inquiry and paging operations.
+ if ( devToNotify > KErrNotFound )
+ {
+ // This device record is not used any more after we have informed client.
+ // Extract it and push to cleanup for detroy.
+ // This is to prevent peak memory usage in case of a great number of
+ // devices being in range.
+ CDeviceSearchRecord* rec = iDevices[devToNotify];
+ iDevices.Remove( devToNotify );
+ CleanupStack::PushL( rec );
+ iObserver.HandleNextDiscoveryResultL( rec->iAddr, rec->iName );
+ CleanupStack::PopAndDestroy( rec );
+ }
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::DoCancelRequest
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::CancelRequest( TInt aId )
+ {
+ // host resolver needs to be cancelled.
+ // For request BtServiceUtil::EAsyncNotifyDeviceSearchCompleted, we
+ // are doing self-completing. Thus, nothing is needed now.
+ if ( aId == BtServiceUtil::EBluetoothInquiry ||
+ aId == BtServiceUtil::EBluetoothPageDeviceName )
+ {
+ iHostResolver.Cancel();
+ }
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::HandleError
+// Inform UI from error occured.
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::HandleError( CBtSimpleActive* aActive, TInt aError )
+ {
+ // We might have issued an request to Host Resolver in RequestCompleted().
+ // Cancel AO just in case:
+ aActive->Cancel();
+ Reset();
+ // We cannot proceed more. Inform client:
+ iObserver.HandleDiscoveryCompleted( aError );
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::PageNextDeviceName()
+ {
+ // reset the name in entry so that previous result will
+ // not propogate if the next paging operation fails.
+ iEntry().iName.Zero();
+ for (; iPagingNamePos > -1; --iPagingNamePos )
+ {
+ // Get the next in-range device that has no device name yet
+ // This is practically meaning that the device would be
+ // < v2.1
+ if( iDevices[iPagingNamePos]->iName.Length() == 0 )
+ {
+ iInquirySockAddr.SetAction( KHostResName + KHostResIgnoreCache );
+ TBTDevAddr btaddr = iDevices[iPagingNamePos]->iAddr.BTAddr();
+ iInquirySockAddr.SetBTAddr( iDevices[iPagingNamePos]->iAddr.BTAddr() );
+ iInquirySockAddr.SetIAC(KGIAC);
+ iHostResolver.GetByAddress( iInquirySockAddr, iEntry, iActive->RequestStatus() );
+ iActive->GoActive();
+ break;
+ }
+ }
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::HandleInquiryResultL
+// Inform of properties of the found BTdevice,
+// which passes the search filter. Its name would be retrived
+// later if not contained by the first round of inquiry.
+// ----------------------------------------------------------
+//
+TInt CBasicDevDiscoverer::HandleInquiryResultL()
+ {
+ TInquirySockAddr& sa = TInquirySockAddr::Cast( iEntry().iAddr );
+ // parse the inquiry result if this device passes the filters:
+ if ( iMajorDeviceClassFilter == EMajorDeviceMisc
+ || sa.MajorClassOfDevice() == iMajorDeviceClassFilter )
+ {
+ CDeviceSearchRecord* record = NewInstanceL( sa );
+ CleanupStack::PushL( record );
+ iDevices.InsertL(record, 0 );
+ CleanupStack::Pop( record );
+
+ TBTDeviceName devName;
+ TBluetoothNameRecordWrapper eir( iEntry() );
+ TInt length = eir.GetDeviceNameLength();
+ TBool isComplete( EFalse );
+ if( length > 0 )
+ {
+ User::LeaveIfError( eir.GetDeviceName( record->iName, isComplete) );
+ }
+ return 0;
+ }
+ return KErrNotFound;
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::CompleteDiscovery
+// ----------------------------------------------------------
+//
+CDeviceSearchRecord* CBasicDevDiscoverer::NewInstanceL(
+ const TInquirySockAddr& aAddr, const TDesC& aName )
+ {
+ CDeviceSearchRecord* record = new (ELeave) CDeviceSearchRecord();
+ record->iAddr = aAddr;
+ record->iName = aName;
+ return record;
+ }
+
+// ----------------------------------------------------------
+// CBasicDevDiscoverer::Reset
+// ----------------------------------------------------------
+//
+void CBasicDevDiscoverer::Reset()
+ {
+ // Free the cache of host Resolver.
+ iHostResolver.Close();
+ // Clean previous in-range devices whose proximity status
+ // may have been changed.
+ iDevices.ResetAndDestroy();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/btdevextension.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: an extended BT device offering properties of
+* a Bluetooth device that may be needed by Bluetooth UIs
+*
+*/
+
+#include <btservices/btdevextension.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBtDevExtension::CBtDevExtension( TDefaultDevNameOption aNameOption )
+: iNameOption( aNameOption )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBtDevExtension::ConstructL( CBTDevice* aDev )
+ {
+ SetDeviceL( aDev );
+ }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtDevExtension* CBtDevExtension::NewLC(
+ CBTDevice* aDev, TDefaultDevNameOption aNameOption )
+ {
+ CBtDevExtension* self = NULL;
+ self = new (ELeave) CBtDevExtension( aNameOption );
+ CleanupStack::PushL( self );
+ self->ConstructL( aDev );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtDevExtension* CBtDevExtension::NewLC(
+ const TInquirySockAddr& aAddr,
+ const TDesC& aName,
+ TDefaultDevNameOption aNameOption )
+ {
+ CBtDevExtension* self = new (ELeave) CBtDevExtension( aNameOption );
+ CleanupStack::PushL( self );
+ CBTDevice* dev = CBTDevice::NewLC( aAddr.BTAddr() );
+ TBTDeviceClass cod( aAddr.MajorServiceClass(),
+ aAddr.MajorClassOfDevice(), aAddr.MinorClassOfDevice() );
+ dev->SetDeviceClass( cod );
+ if ( aName.Length() )
+ {
+ dev->SetDeviceNameL( BTDeviceNameConverter::ToUTF8L( aName ) );
+ }
+ self->ConstructL( dev );
+ CleanupStack::Pop( dev );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtDevExtension::~CBtDevExtension()
+ {
+ iAlias.Close();
+ delete iDev;
+ }
+
+// ---------------------------------------------------------------------------
+// IsBonded
+// ---------------------------------------------------------------------------
+//
+TBool CBtDevExtension::IsBonded( const TBTNamelessDevice &dev )
+ {
+ // IsValidPaired tells if the paired bit of dev is valid
+ // and IsPaired tells if the device is paired or not:
+ return dev.IsValidPaired() &&
+ dev.IsPaired() &&
+ // Authentication due to OBEX cases e.g. file transfer, is not
+ // considered as bonded in Bluetooth UI:
+ dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable;
+ }
+
+// ---------------------------------------------------------------------------
+// IsJustWorksBonded
+// ---------------------------------------------------------------------------
+//
+TBool CBtDevExtension::IsJustWorksBonded( const TBTNamelessDevice &dev )
+ {
+ return IsBonded( dev ) &&
+ dev.LinkKeyType() == ELinkKeyUnauthenticatedNonUpgradable;
+ }
+
+// ---------------------------------------------------------------------------
+// IsUserAwareBonded
+// ---------------------------------------------------------------------------
+//
+TBool CBtDevExtension::IsUserAwareBonded( const TBTNamelessDevice &dev )
+ {
+ if ( IsJustWorksBonded( dev ) )
+ {
+ // Just Works bonded devices can happen without user awareness.
+ // For example, authentication due to an incoming service connection request
+ // from a device without IO.
+ // We use cookies to identify if this JW pairing is user aware or not:
+ TInt32 cookie = dev.IsValidUiCookie() ? dev.UiCookie() : EBTUiCookieUndefined;
+ return (cookie & EBTUiCookieJustWorksPaired );
+ }
+ // Pairing in other mode than Just Works are always user-aware:
+ return IsBonded( dev );
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CBtDevExtension::Alias() const
+ {
+ return iAlias;
+ }
+
+// ---------------------------------------------------------------------------
+// Addr()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TBTDevAddr& CBtDevExtension::Addr() const
+ {
+ return iDev->BDAddr();
+ }
+
+// ---------------------------------------------------------------------------
+// Device
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CBTDevice& CBtDevExtension::Device() const
+ {
+ return *iDev;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// IsUserAwareBonded
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CBtDevExtension::IsUserAwareBonded() const
+ {
+ return IsUserAwareBonded( iDev->AsNamelessDevice() );
+ }
+
+// ---------------------------------------------------------------------------
+// ServiceConnectionStatus()
+// ---------------------------------------------------------------------------
+//
+TBTEngConnectionStatus CBtDevExtension::ServiceConnectionStatus() const
+ {
+ return iServiceStatus;
+ }
+
+// ---------------------------------------------------------------------------
+// SetDeviceL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBtDevExtension::SetDeviceL( CBTDevice* aDev )
+ {
+ delete iDev;
+ iDev = aDev;
+ // It is possible that the client set a NULL object to us.
+ if ( !iDev )
+ {
+ iDev = CBTDevice::NewL();
+ }
+ // No optimization here. If client sets an identical device instance
+ // We will still execute these steps:
+ UpdateNameL();
+ //UpdateServiceStatusL();
+ }
+
+EXPORT_C CBtDevExtension* CBtDevExtension::CopyL()
+ {
+ CBtDevExtension* newDev = CBtDevExtension::NewLC( NULL );
+ CBTDevice* dev = iDev->CopyL();
+ CleanupStack::PushL( dev );
+ newDev->SetDeviceL( dev );
+ CleanupStack::Pop( dev);
+ newDev->SetServiceConnectionStatus( ServiceConnectionStatus() );
+ CleanupStack::Pop( newDev );
+ return newDev;
+ }
+
+// ---------------------------------------------------------------------------
+// ServiceConnectionStatus()
+// ---------------------------------------------------------------------------
+//
+void CBtDevExtension::SetServiceConnectionStatus(
+ TBTEngConnectionStatus aStatus )
+ {
+ iServiceStatus = aStatus;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// UpdateL()
+// ---------------------------------------------------------------------------
+//
+void CBtDevExtension::UpdateNameL()
+ {
+ // UI takes friendly name for displaying if it is available
+ iAlias.Zero();
+ if ( iDev->IsValidFriendlyName() && iDev->FriendlyName().Length() != 0 )
+ {
+ iAlias.CreateL( iDev->FriendlyName() );
+ }
+ // otherwise, device name, if it is available, will be displayed
+ else if ( iDev->IsValidDeviceName() && iDev->DeviceName().Length() != 0 )
+ {
+ iAlias.CreateL( BTDeviceNameConverter::ToUnicodeL(iDev->DeviceName() ) );
+ }
+ if ( iAlias.Length() == 0 &&
+ ( iNameOption == EColonSeperatedBDAddr || iNameOption == EPlainBDAddr ) )
+ {
+ // Name for display is still missing. We need to make one for user to
+ // identify it.
+ FormatAddressAsNameL();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// FormatAddressAsNameL()
+// ---------------------------------------------------------------------------
+//
+void CBtDevExtension::FormatAddressAsNameL()
+ {
+ // readable format of BD_ADDR is double size of BD ADDR size,
+ // and plus the seperators.
+ iAlias.ReAllocL( KBTDevAddrSize * 3 );
+ _LIT(KColon, ":");
+ if ( iNameOption == EColonSeperatedBDAddr )
+ {
+ iDev->BDAddr().GetReadable( iAlias, KNullDesC, KColon, KNullDesC );
+ }
+ else
+ {
+ iDev->BDAddr().GetReadable( iAlias );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/btdevrepository.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Repository of remote Bluetooth devices
+*
+*/
+
+#include <btservices/btdevrepository.h>
+#include "btdevrepositoryimpl.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBtDevRepository::CBtDevRepository()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepository::ConstructL()
+ {
+ iImpl = CBtDevRepositoryImpl::NewL();
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtDevRepository* CBtDevRepository::NewL()
+ {
+ CBtDevRepository* self = NULL;
+ self = new (ELeave) CBtDevRepository();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtDevRepository::~CBtDevRepository()
+ {
+ delete iImpl;
+ }
+
+// ---------------------------------------------------------------------------
+// AddObserverL.
+// Delegate to the implementor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBtDevRepository::AddObserverL( MBtDevRepositoryObserver* aObserver )
+ {
+ iImpl->AddObserverL( aObserver );
+ }
+
+// ---------------------------------------------------------------------------
+// RemoveObserver.
+// Delegate to the implementor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CBtDevRepository::RemoveObserver( MBtDevRepositoryObserver* aObserver )
+ {
+ iImpl->RemoveObserver( aObserver );
+ }
+
+// ---------------------------------------------------------------------------
+// AllDevices
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CBtDevRepository::IsInitialized() const
+ {
+ return iImpl->IsInitialized();
+ }
+
+// ---------------------------------------------------------------------------
+// AllDevices
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const RDevExtensionArray& CBtDevRepository::AllDevices() const
+ {
+ return iImpl->AllDevices();
+ }
+
+// ---------------------------------------------------------------------------
+// Device
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const CBtDevExtension* CBtDevRepository::Device(
+ const TBTDevAddr& aAddr ) const
+ {
+ return iImpl->Device( aAddr );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/btdevrepositoryimpl.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,439 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: respository of remote Bluetooth devices.
+*
+*/
+
+#include "btdevrepositoryimpl.h"
+#include <e32property.h>
+#include <bt_subscribe.h>
+#include <btservices/btdevrepository.h>
+#include "btserviceutilconsts.h"
+
+// ---------------------------------------------------------------------------
+// Tells if two CBTDevice instances are for the same remote device
+// ---------------------------------------------------------------------------
+//
+TBool CompareDeviceByAddress( const CBTDevice& aDevA, const CBTDevice& aDevB )
+ {
+ return aDevA.BDAddr() == aDevB.BDAddr();
+ }
+
+// ---------------------------------------------------------------------------
+// Tells if these two instances are for the same remote device
+// ---------------------------------------------------------------------------
+//
+TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBTDevice& aDev)
+ {
+ return *aAddr == aDev.BDAddr();
+ }
+
+// ---------------------------------------------------------------------------
+// Tells if these two instances are for the same remote device
+// ---------------------------------------------------------------------------
+//
+TBool MatchDeviceAddress(const TBTDevAddr* aAddr, const CBtDevExtension& aDev)
+ {
+ return *aAddr == aDev.Device().BDAddr();
+ }
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBtDevRepositoryImpl::CBtDevRepositoryImpl()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::ConstructL()
+ {
+ // connect to registry
+ User::LeaveIfError( iBTRegServ.Connect() );
+ User::LeaveIfError( iBTRegistry.Open( iBTRegServ ) );
+ iRegistryActive = CBtSimpleActive::NewL(
+ *this, BtServiceUtil::ECreateRemoteDeviceViewRequest );
+ // Start to get the list of devices from registry.
+ CreateRemoteDeviceView();
+
+ User::LeaveIfError( iBtRegistryKey.Attach(
+ KPropertyUidBluetoothCategory,
+ KPropertyKeyBluetoothGetRegistryTableChange ) );
+
+ iRegistryKeyActive = CBtSimpleActive::NewL( *this, BtServiceUtil::ERegistryPubSubWatcher );
+ iBtRegistryKey.Subscribe( iRegistryKeyActive->RequestStatus() );
+ iRegistryKeyActive->GoActive();
+ iBtengConn = CBTEngConnMan::NewL( this );
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CBtDevRepositoryImpl* CBtDevRepositoryImpl::NewL()
+ {
+ CBtDevRepositoryImpl* self = NULL;
+ self = new (ELeave) CBtDevRepositoryImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CBtDevRepositoryImpl::~CBtDevRepositoryImpl()
+ {
+ iObservers.Close();
+ delete iBtengConn;
+ delete iRegistryActive;
+ delete iRegRespRemoteDevices;
+ iDevices.ResetAndDestroy();
+ iDevices.Close();
+ iBTRegistry.Close();
+ iBTRegServ.Close();
+ delete iRegistryKeyActive;
+ iBtRegistryKey.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// AddObserverL
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::AddObserverL( MBtDevRepositoryObserver* aObserver )
+ {
+ // Do not allow null pointer.
+ if ( aObserver )
+ {
+ iObservers.AppendL( aObserver );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// RemoveObserver
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::RemoveObserver( MBtDevRepositoryObserver* aObserver )
+ {
+ TInt i = iObservers.Find( aObserver );
+ if ( i >= 0 )
+ {
+ iObservers.Remove( i );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// IsInitialized
+// ---------------------------------------------------------------------------
+//
+TBool CBtDevRepositoryImpl::IsInitialized() const
+ {
+ return iInitialized;
+ }
+
+// ---------------------------------------------------------------------------
+// AllDevices
+// ---------------------------------------------------------------------------
+//
+const RDevExtensionArray& CBtDevRepositoryImpl::AllDevices() const
+ {
+ return iDevices;
+ }
+
+// ---------------------------------------------------------------------------
+// Device
+// ---------------------------------------------------------------------------
+//
+const CBtDevExtension* CBtDevRepositoryImpl::Device(
+ const TBTDevAddr& aAddr ) const
+ {
+ TInt pos = iDevices.Find( aAddr, MatchDeviceAddress);
+ if ( pos > -1 )
+ {
+ return iDevices[pos];
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Checks if there is an authentication result.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::RequestCompletedL( CBtSimpleActive* aActive, TInt aStatus )
+ {
+ if ( aActive->RequestId() == BtServiceUtil::ECreateRemoteDeviceViewRequest )
+ {
+ HandleCreateRemoteDeviceViewCompletedL( aStatus );
+ }
+ else if ( aActive->RequestId() == BtServiceUtil::EGetRemoteDevicesRequest )
+ {
+ HandleGetRemoteDevicesCompletedL( aStatus );
+ }
+ else if ( aActive->RequestId() == BtServiceUtil::ERegistryPubSubWatcher )
+ {
+ TInt myChangedTable;
+ iBtRegistryKey.Subscribe( aActive->RequestStatus() );
+ aActive->GoActive();
+ TInt err = iBtRegistryKey.Get( myChangedTable );
+ if( !err && myChangedTable == KRegistryChangeRemoteTable )
+ {
+ if ( !iRegistryActive->IsActive() )
+ {
+ CreateRemoteDeviceView();
+ }
+ else
+ {
+ iNotHandledRegEventCounter++;
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// Checks if there is an authentication result.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::CancelRequest( TInt aRequestId )
+ {
+ if ( aRequestId == BtServiceUtil::ECreateRemoteDeviceViewRequest )
+ {
+ iBTRegistry.CancelRequest(iRegistryActive->RequestStatus());
+ }
+ else if ( aRequestId == BtServiceUtil::EGetRemoteDevicesRequest )
+ {
+ iRegRespRemoteDevices->Cancel();
+ }
+ else if ( aRequestId == BtServiceUtil::ERegistryPubSubWatcher )
+ {
+ iBtRegistryKey.Cancel();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBtSimpleActiveObserver.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::HandleError( CBtSimpleActive* aActive, TInt aError )
+ {
+ (void) aError;
+ if ( aActive->RequestId() == BtServiceUtil::ECreateRemoteDeviceViewRequest ||
+ aActive->RequestId() == BtServiceUtil::EGetRemoteDevicesRequest )
+ {// leave happened in registry operation, delete registry response:
+ delete iRegRespRemoteDevices;
+ iRegRespRemoteDevices = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTEngConnObserver.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::ConnectComplete( TBTDevAddr& aAddr, TInt aErr,
+ RBTDevAddrArray* aConflicts)
+ {
+ // connection is single profile based, to make sure getting the correct status,
+ // we always retrieve it from btengconnman:
+ (void)aConflicts;
+ (void) aErr;
+ TInt pos = iDevices.Find( aAddr, MatchDeviceAddress );
+ if ( pos > -1 )
+ {
+ TBTEngConnectionStatus status = EBTEngNotConnected;
+ // error returned from the call is treated as not connected.
+ (void) iBtengConn->IsConnected( aAddr, status );
+ iDevices[pos]->SetServiceConnectionStatus( status );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From class MBTEngConnObserver.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::DisconnectComplete( TBTDevAddr& aAddr, TInt aErr )
+ {
+ // unified handling for connections status events:
+ ConnectComplete( aAddr, aErr, NULL);
+ }
+
+// ---------------------------------------------------------------------------
+// issue creating a remote device view from the registry
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::CreateRemoteDeviceView()
+ {
+ iNotHandledRegEventCounter = 0;
+ (void) iBTRegistry.CloseView();
+ TBTRegistrySearch searchPattern;
+ searchPattern.FindAll();
+ iRegistryActive->SetRequestId( BtServiceUtil::ECreateRemoteDeviceViewRequest );
+ iBTRegistry.CreateView( searchPattern, iRegistryActive->iStatus );
+ iRegistryActive->GoActive();
+ }
+
+// ---------------------------------------------------------------------------
+// gets the paired devices from the view created by CreatePairedDevicesView
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::GetRemoteDevicesL()
+ {
+ delete iRegRespRemoteDevices;
+ iRegRespRemoteDevices = NULL;
+ iRegRespRemoteDevices = CBTRegistryResponse::NewL( iBTRegistry );
+ iRegistryActive->SetRequestId( BtServiceUtil::EGetRemoteDevicesRequest );
+ iRegRespRemoteDevices->Start( iRegistryActive->iStatus );
+ iRegistryActive->GoActive();
+ }
+
+// ---------------------------------------------------------------------------
+// re-create a paired device view if registry was changed during the previous
+// operation. otherwise if the view is not empty, get the remote devices.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::HandleCreateRemoteDeviceViewCompletedL( TInt aStatus )
+ {
+ // aStatus may indicate the number of devices from registry.
+ // However, our algorithm does not rely on this return error
+ // for implementation simplicity.
+ (void) aStatus;
+ if (iNotHandledRegEventCounter)
+ { // more registry change detected, create paired device view again:
+ CreateRemoteDeviceView( );
+ }
+ else
+ {
+ GetRemoteDevicesL( );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// update remote device list. if registry was changed, create a new view.
+// otherwise inform client for any changes.
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::HandleGetRemoteDevicesCompletedL( TInt aStatus )
+ {
+ // aStatus may indicate the number of devices from registry.
+ // However, our algorithm does not rely on this return error.
+ (void) aStatus;
+ if (iNotHandledRegEventCounter)
+ { // more registry change detected, create paired device view again:
+ CreateRemoteDeviceView( );
+ return;
+ }
+
+ UpdateRemoteDeviceRepositoryL();
+ if ( !iInitialized )
+ {
+ iInitialized = ETrue;
+ // The first time we have got the device lists from registry,
+ // Get the connections statuses of these devices from bteng.
+ for ( TInt i = iDevices.Count() - 1; i > -1; --i )
+ {
+ TBTEngConnectionStatus status = EBTEngNotConnected;
+ // error returned from the call is treated as not connected.
+ (void) iBtengConn->IsConnected( iDevices[i]->Addr(), status );
+ iDevices[i]->SetServiceConnectionStatus( status );
+ }
+ for ( TInt i = 0; i < iObservers.Count(); ++i )
+ {
+ iObservers[i]->RepositoryInitialiazed();
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// update remote devices in local array with the latest data
+// ---------------------------------------------------------------------------
+//
+void CBtDevRepositoryImpl::UpdateRemoteDeviceRepositoryL()
+ {
+ TIdentityRelation<CBTDevice> addrComp( CompareDeviceByAddress );
+ RBTDeviceArray& devsFromReg = iRegRespRemoteDevices->Results();
+ for ( TInt i = iDevices.Count() - 1; i > -1; --i )
+ {
+ TInt pos = devsFromReg.Find( &(iDevices[i]->Device()), addrComp );
+ if ( pos > KErrNotFound )
+ {
+ // Device is found in registry, check if its properties have been changed
+ TUint similarity = devsFromReg[pos]->CompareTo( iDevices[i]->Device() );
+ TBool changed = EFalse;
+ if ( similarity !=
+ ( CBTDevice::EAllNameProperties |
+ TBTNamelessDevice::EAllNamelessProperties) )
+ {
+ // This device was updated in registry.
+ // move its ownership to local store
+ iDevices[i]->SetDeviceL( devsFromReg[pos] );
+ changed = ETrue;
+ }
+ else
+ {
+ // This device has no update:
+ delete devsFromReg[pos];
+ }
+ // either the instance at pos has been moved or deleted.
+ devsFromReg.Remove( pos );
+ if ( iInitialized && changed )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); ++i )
+ {
+ iObservers[i]->BtDeviceChangedInRegistry( *iDevices[i], similarity );
+ }
+ }
+ }
+ else
+ {
+ // This device was deleted from registry.
+ // Free it from the local store before informing client.
+ TBTDevAddr addr = iDevices[i]->Addr();
+ delete iDevices[i];
+ iDevices.Remove( i );
+ if ( iInitialized )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); ++i )
+ {
+ iObservers[i]->BtDeviceDeleted( addr );
+ }
+ }
+ }
+ }
+
+ // Remaining devices in iRegRespRemoteDevices are new devices:
+ for ( TInt i = 0; i < devsFromReg.Count() ; i++ )
+ {
+ CBtDevExtension* devExt = CBtDevExtension::NewLC( devsFromReg[i] );
+ iDevices.AppendL( devExt );
+ CleanupStack::Pop( devExt );
+ devsFromReg.Remove( i );
+ if ( iInitialized )
+ {
+ for ( TInt i = 0; i < iObservers.Count(); ++i )
+ {
+ iObservers[i]->BtDeviceAdded( *iDevices[ iDevices.Count() - 1 ] );
+ }
+ }
+ }
+ // the devices in devsFromReg was either deleted, or moved.
+ delete iRegRespRemoteDevices;
+ iRegRespRemoteDevices = NULL;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btserviceutil/src/btsimpleactive.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Active object helper class.
+*
+*/
+
+#include <btservices/btsimpleactive.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CBtSimpleActive::CBtSimpleActive( MBtSimpleActiveObserver& aObserver, TInt aId,
+ TInt aPriority )
+: CActive( aPriority ),
+ iRequestId( aId ),
+ iObserver( aObserver )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtSimpleActive* CBtSimpleActive::NewL( MBtSimpleActiveObserver& aObserver,
+ TInt aId, TInt aPriority )
+ {
+ CBtSimpleActive* self = new( ELeave ) CBtSimpleActive( aObserver, aId, aPriority );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CBtSimpleActive::~CBtSimpleActive()
+ {
+ Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// Get the identifier of this instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CBtSimpleActive::RequestId()
+ {
+ return iRequestId;
+ }
+
+// -----------------------------------------------------------------------------
+// Set the identifier of this instance.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CBtSimpleActive::SetRequestId( TInt aId )
+ {
+ iRequestId = aId;
+ }
+
+// -----------------------------------------------------------------------------
+// Activate the active object.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CBtSimpleActive::GoActive()
+ {
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// Get a reference to the active object request status.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TRequestStatus& CBtSimpleActive::RequestStatus()
+ {
+ return iStatus;
+ }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Called by the active scheduler when the request has been cancelled.
+// ---------------------------------------------------------------------------
+//
+void CBtSimpleActive::DoCancel()
+ {
+ iObserver.CancelRequest( iRequestId );
+ }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Called by the active scheduler when the request has been completed.
+// ---------------------------------------------------------------------------
+//
+void CBtSimpleActive::RunL()
+ {
+ iObserver.RequestCompletedL( this, iStatus.Int() );
+ }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Called by the active scheduler when an error in RunL has occurred.
+// ---------------------------------------------------------------------------
+//
+TInt CBtSimpleActive::RunError( TInt aError )
+ {
+ iObserver.HandleError( this, aError );
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpplugin.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+
+#include <cpsettingformentryitemdataimpl.h>
+#include "BtCpPlugin.h"
+#include "btcpuimainview.h"
+#include "btcpuisettingitem.h"
+
+/*!
+ BtCpPlugin::BtCpPlugin
+ */
+BtCpPlugin::BtCpPlugin()
+{
+}
+
+/*!
+ BtCpPlugin::~BtCpPlugin
+ */
+BtCpPlugin::~BtCpPlugin()
+{
+}
+
+/*!
+ BtCpPlugin::createSettingFormItemData
+ */
+QList<CpSettingFormItemData*> BtCpPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
+{
+
+ return QList<CpSettingFormItemData*> () << new BtCpUiSettingItem(
+ itemDataHelper, tr("Bluetooth"));
+
+}
+
+Q_EXPORT_PLUGIN2(BtCpPlugin, BtCpPlugin);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpplugin.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef BTCPPLUGIN_H
+#define BTCPPLUGIN_H
+
+#include <qobject.h>
+#include <cpplugininterface.h>
+
+class BtCpPlugin : public QObject, public CpPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(CpPluginInterface)
+
+public:
+
+ BtCpPlugin();
+ ~BtCpPlugin();
+ virtual QList<CpSettingFormItemData*> createSettingFormItemData(CpItemDataHelper &itemDataHelper) const;
+};
+
+#endif /* BTCPPLUGIN_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpplugin.pro Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = lib
+TARGET = btcpplugin
+DEPENDPATH += .
+INCLUDEPATH += . ../inc/
+
+
+CONFIG += qt hb plugin
+LIBS += -lcpframework -lbtuimodel -lbtuidelegate
+
+MOC_DIR = moc
+OBJECTS_DIR = obj
+
+#TRANSLATIONS = telephone_cp.ts
+RESOURCES += btcpplugin.qrc
+
+# Input
+HEADERS += btcpplugin.h \
+ btcpuibaseview.h \
+ btcpuimainview.h \
+ btcpuisearchview.h \
+ btcpuisettingitem.h
+
+SOURCES += btcpplugin.cpp \
+ btcpuibaseview.cpp \
+ btcpuimainview.cpp \
+ btcpuisearchview.cpp \
+ btcpuisettingitem.cpp
+
+symbian: {
+ DEFINES += PLUGINUID3=0x2002434E
+ TARGET.UID3 = 0x2002434E
+ TARGET.CAPABILITY = ALL -TCB
+
+ TARGET.EPOCALLOWDLLDATA = 1
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+ PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel
+
+ deploy.path = C:
+ pluginstub.sources = $${TARGET}.dll
+ pluginstub.path = $$PLUGIN_STUB_PATH
+ DEPLOYMENT += pluginstub
+
+ qtplugins.path = $$PLUGIN_STUB_PATH
+ qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin
+
+ for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)"
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpplugin.qrc Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,26 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>icons/qgn_graf_blid_det_circle.svg</file>
+ <file>icons/qgn_graf_blid_time.svg</file>
+ <file>icons/qgn_indi_bt_blocked.svg</file>
+ <file>icons/qgn_indi_bt_paired_add.svg</file>
+ <file>icons/qgn_indi_bt_trusted_add.svg</file>
+ <file>icons/qgn_prop_bt_audio.svg</file>
+ <file>icons/qgn_prop_bt_blocked_tab3.svg</file>
+ <file>icons/qgn_prop_bt_car_kit.svg</file>
+ <file>icons/qgn_prop_bt_carkit.svg</file>
+ <file>icons/qgn_prop_bt_computer.svg</file>
+ <file>icons/qgn_prop_bt_headset.svg</file>
+ <file>icons/qgn_prop_bt_keyboard.svg</file>
+ <file>icons/qgn_prop_bt_misc.svg</file>
+ <file>icons/qgn_prop_bt_mouse.svg</file>
+ <file>icons/qgn_prop_bt_phone.svg</file>
+ <file>icons/qgn_prop_bt_printer.svg</file>
+ <file>icons/qgn_prop_bt_unknown.svg</file>
+ <file>icons/qgn_frwidget_add_friend_photo.svg</file>
+ </qresource>
+ <qresource prefix="/" >
+ <file>docml/bt-main-view.docml</file>
+ <file>docml/bt-search-view.docml</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuibaseview.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* ============================================================================
+* Name : btcpuibaseclass.cpp
+* Part of : BluetoothUI / btapplication *** Info from the SWAD
+* Description : Implements the baseclass for all views in btapplication.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "btcpuibaseview.h"
+#include <HbAction.h>
+
+/*!
+ Constructor.
+ */
+BtCpUiBaseView::BtCpUiBaseView( BtuiModel &model, QGraphicsItem *parent )
+ :CpBaseSettingView( 0 , parent ),mModel(model)
+{
+
+}
+
+/*!
+ Destructor.
+ */
+BtCpUiBaseView::~BtCpUiBaseView()
+{
+
+}
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuibaseview.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* ============================================================================
+* Name : btcpuibaseview.h
+* Part of : BluetoothUI / btapplication *** Info from the SWAD
+* Description : Declaration of the baseclass for all views in btapplication.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTCPUIBASEVIEW_H
+#define BTCPUIBASEVIEW_H
+
+#include <hbview.h>
+#include <qglobal.h>
+#include <cpbasesettingview.h>
+#include <btuimodel.h>
+
+/*!
+ \class BtUiBaseView
+ \brief the class is the base class for all views in btapplication.
+
+ */
+class BtCpUiBaseView : public CpBaseSettingView
+{
+ Q_OBJECT
+
+public:
+
+ virtual ~BtCpUiBaseView();
+ virtual void activateView( const QVariant& value, int cmdId ) = 0;
+ virtual void deactivateView() = 0;
+
+signals:
+
+protected:
+ explicit BtCpUiBaseView( BtuiModel &model, QGraphicsItem *parent = 0);
+ virtual void setSoftkeyBack() = 0;
+ virtual void switchToPreviousView() = 0;
+
+protected:
+
+ //Does not own this model.
+ BtuiModel &mModel;
+
+ QGraphicsItem *mParent;
+ int mPreviousViewId;
+
+ Q_DISABLE_COPY(BtCpUiBaseView)
+};
+
+#endif // BTCPUIBASEVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,524 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: BtCpUiMainView implementation
+*
+*/
+
+#include "btcpuimainview.h"
+#include <QtGlobal>
+#include <QGraphicsLinearLayout>
+#include <HbInstance>
+//#include "btuiviewutil.h"
+#include <hbdocumentloader.h>
+#include <hbnotificationdialog.h>
+#include <hbgridview.h>
+#include <hbpushbutton.h>
+#include <hblabel.h>
+#include <hbicon.h>
+#include <hblineedit.h>
+#include <hbtooltip.h>
+#include <btengconstants.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbcombobox.h>
+#include "btcpuisearchview.h"
+#include <bluetoothuitrace.h>
+#include <btdelegatefactory.h>
+#include <btabstractdelegate.h>
+#include "btqtconstants.h"
+
+
+// docml to load
+const char* BTUI_MAINVIEW_DOCML = ":/docml/bt-main-view.docml";
+
+/*!
+ Constructs a new BtUiMainView using HBDocumentLoader. Docml (basically xml) file
+ has been generated using Application Designer.
+
+ */
+BtCpUiMainView::BtCpUiMainView( BtuiModel &model, QGraphicsItem *parent )
+ : BtCpUiBaseView( model, parent ), mAbstractDelegate(0)
+{
+ bool ret(false);
+
+ mMainWindow = hbInstance->allMainWindows().first();
+ mMainView = this;
+
+ // Create view for the application.
+ // Set the name for the view. The name should be same as the view's
+ // name in docml.
+ setObjectName("view");
+
+ QObjectList objectList;
+ objectList.append(this);
+ // Pass the view to documentloader. Document loader uses this view
+ // when docml is parsed, instead of creating new view.
+ mLoader = new HbDocumentLoader();
+ mLoader->setObjectTree(objectList);
+
+ bool ok = false;
+ mLoader->load( BTUI_MAINVIEW_DOCML, &ok );
+ // Exit if the file format is invalid
+ BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file" );
+
+ mOrientation = mMainWindow->orientation();
+
+ if (mOrientation == Qt::Horizontal) {
+ mLoader->load(BTUI_MAINVIEW_DOCML, "landscape", &ok);
+ BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: landscape section problem" );
+ }
+ else {
+ mLoader->load(BTUI_MAINVIEW_DOCML, "portrait", &ok);
+ BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: landscape section problem" );
+ }
+
+ mDeviceNameEdit=0;
+ mDeviceNameEdit = qobject_cast<HbLineEdit *>( mLoader->findWidget( "lineEdit" ) );
+ BTUI_ASSERT_X( mDeviceNameEdit != 0, "bt-main-view", "Device Name not found" );
+ ret = connect(mDeviceNameEdit, SIGNAL(editingFinished ()), this, SLOT(changeBtLocalName()));
+
+ mPowerButton=0;
+ mPowerButton = qobject_cast<HbPushButton *>( mLoader->findWidget( "pushButton" ) );
+ BTUI_ASSERT_X( mPowerButton != 0, "bt-main-view", "power button not found" );
+ ret = connect(mPowerButton, SIGNAL(clicked()), this, SLOT(changePowerState()));
+ BTUI_ASSERT_X( ret, "BtCpUiMainView::BtCpUiMainView", "can't connect power button" );
+
+ mVisibilityMode=0;
+ mVisibilityMode = qobject_cast<HbComboBox *>( mLoader->findWidget( "combobox" ) );
+ BTUI_ASSERT_X( mVisibilityMode != 0, "bt-main-view", "visibility combobox not found" );
+
+ mDeviceList=0;
+ mDeviceList = qobject_cast<HbGridView *>( mLoader->findWidget( "gridView" ) );
+ BTUI_ASSERT_X( mDeviceList != 0, "bt-main-view", "Device List (grid view) not found" );
+
+ // listen for orientation changes
+ ret = connect(mMainWindow, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(changeOrientation(Qt::Orientation)));
+ BTUI_ASSERT_X( ret, "BtCpUiMainView::BtCpUiMainView()", "connect orientationChanged() failed");
+
+ // load tool bar actions
+ HbAction *discoverAction = static_cast<HbAction*>( mLoader->findObject( "discoverAction" ) );
+ BTUI_ASSERT_X( discoverAction, "bt-main-view", "discover action missing" );
+ ret = connect(discoverAction, SIGNAL(triggered()), this, SLOT(goToDiscoveryView()));
+ BTUI_ASSERT_X( ret, "bt-main-view", "orientation toggle can't connect" );
+
+ // load menu
+ HbMenu *optionsMenu = qobject_cast<HbMenu *>(mLoader->findWidget("viewMenu"));
+ BTUI_ASSERT_X( optionsMenu != 0, "bt-main-view", "Options menu not found" );
+ this->setMenu(optionsMenu);
+
+ // update display when setting data changed
+ ret = connect(&mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+ this, SLOT(updateSettingItems(QModelIndex,QModelIndex)));
+ BTUI_ASSERT_X( ret, "BtCpUiMainView::BtCpUiMainView", "can't connect dataChanged" );
+
+ QModelIndex top = mModel.index( BtuiModel::LocalSettingRow, BtuiModel::BluetoothNameCol );
+ QModelIndex bottom = mModel.index( BtuiModel::LocalSettingRow, BtuiModel::VisibilityCol );
+ // update name, power and visibility rows
+ updateSettingItems( top, bottom );
+
+ //Handle Visibility Change User Interaction
+ ret = connect(mVisibilityMode, SIGNAL(currentIndexChanged (int)),
+ this, SLOT(visibilityChanged (int)));
+ // create other views
+ createViews();
+ mCurrentView = this;
+ mCurrentViewId = MainView;
+
+}
+
+/*!
+ Destructs the BtCpUiMainView.
+ */
+BtCpUiMainView::~BtCpUiMainView()
+{
+ delete mLoader; // Also deletes all widgets that it constructed.
+ mMainWindow->removeView(mSearchView);
+ delete mSearchView;
+ if (mAbstractDelegate)
+ {
+ delete mAbstractDelegate;
+ }
+}
+
+/*!
+ from base class, initialize the view
+ */
+void BtCpUiMainView::activateView(const QVariant& value, int cmdId )
+{
+ Q_UNUSED(value);
+ Q_UNUSED(cmdId);
+
+}
+
+/*!
+ From base class. Handle resource before the current view is deactivated.
+ */
+void BtCpUiMainView::deactivateView()
+{
+
+}
+
+void BtCpUiMainView::itemActivated(QModelIndex index)
+{
+ Q_UNUSED(index);
+}
+
+void BtCpUiMainView::goToDiscoveryView()
+{
+ changeView( SearchView, false, 0 );
+}
+
+Qt::Orientation BtCpUiMainView::orientation()
+{
+ return mOrientation;
+}
+
+void BtCpUiMainView::changeBtLocalName()
+{
+ //Error handling has to be done.
+ if (!mAbstractDelegate) {
+ mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::DeviceName, mModel);
+ connect( mAbstractDelegate, SIGNAL(commandCompleted(int,QVariant)), this, SLOT(btNameDelegateCompleted(int,QVariant)) );
+ mAbstractDelegate->exec(mDeviceNameEdit->text ());
+ }
+ else {
+ setPrevBtLocalName();
+ }
+}
+
+void BtCpUiMainView::setPrevBtLocalName()
+{
+ //Should we notify user this as Error...?
+ HbNotificationDialog::launchDialog(hbTrId("Error"));
+ QModelIndex index = mModel.index( BtuiModel::LocalSettingRow, BtuiModel::BluetoothNameCol );
+
+ mDeviceNameEdit->setText( mModel.data(index,BtuiModel::settingDisplay).toString() );
+}
+
+
+void BtCpUiMainView::btNameDelegateCompleted(int status, QVariant param)
+{
+ if(KErrNone == status) {
+ mDeviceNameEdit->setText(param.toString());
+ }
+ else {
+ setPrevBtLocalName();
+ }
+ //Error handling has to be done.
+ if (mAbstractDelegate)
+ {
+ disconnect(mAbstractDelegate);
+ delete mAbstractDelegate;
+ mAbstractDelegate = 0;
+ }
+
+}
+
+void BtCpUiMainView::visibilityChanged (int index)
+{
+ QList<QVariant> list;
+
+ VisibilityMode mode = indexToVisibilityMode(index);
+ list.append(QVariant((int)mode));
+ if(BtTemporary == VisibilityMode(mode)) {
+ //Right now hardcoded to 5 Mins.
+ list.append(QVariant(5));
+ }
+ //Error handling has to be done.
+ if (!mAbstractDelegate) {
+ mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::Visibility, mModel);
+ connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(visibilityDelegateCompleted(int)) );
+ mAbstractDelegate->exec(list);
+ }
+ else {
+ setPrevVisibilityMode();
+ }
+
+}
+
+void BtCpUiMainView::setPrevVisibilityMode()
+{
+ bool ret(false);
+
+ //Should we notify this error to user..?
+ HbNotificationDialog::launchDialog(hbTrId("Error"));
+ QModelIndex index = mModel.index( BtuiModel::LocalSettingRow, BtuiModel::VisibilityCol );
+
+ ret = disconnect(mVisibilityMode, SIGNAL(currentIndexChanged (int)),
+ this, SLOT(visibilityChanged (int)));
+ BTUI_ASSERT_X( ret, "BtCpUiMainView::setPrevVisibilityMode", "can't disconnect signal" );
+
+ mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode)
+ mModel.data(index,BtuiModel::SettingValue).toInt()) );
+
+ //Handle Visibility Change User Interaction
+ ret = connect(mVisibilityMode, SIGNAL(currentIndexChanged (int)),
+ this, SLOT(visibilityChanged (int)));
+ BTUI_ASSERT_X( ret, "BtCpUiMainView::setPrevVisibilityMode", "can't connect signal" );
+
+}
+
+
+void BtCpUiMainView::visibilityDelegateCompleted(int status)
+{
+
+ //This should be mapped to Qt error
+ if(KErrNone != status) {
+ setPrevVisibilityMode();
+ }
+
+ //Error handling has to be done.
+ if (mAbstractDelegate)
+ {
+ disconnect(mAbstractDelegate);
+ delete mAbstractDelegate;
+ mAbstractDelegate = 0;
+ }
+
+}
+
+
+// called due to real orientation change event coming from main window
+void BtCpUiMainView::changeOrientation( Qt::Orientation orientation )
+{
+ bool ok = false;
+ mOrientation = orientation;
+ if( orientation == Qt::Vertical ) {
+ // load "portrait" section
+ mLoader->load( BTUI_MAINVIEW_DOCML, "portrait", &ok );
+ BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: portrait section problem" );
+ } else {
+ // load "landscape" section
+ mLoader->load( BTUI_MAINVIEW_DOCML, "landscape", &ok );
+ BTUI_ASSERT_X( ok, "bt-main-view", "Invalid docml file: landscape section problem" );
+ }
+}
+
+void BtCpUiMainView::commandCompleted( int cmdId, int err, const QString &diagnostic )
+{
+ Q_UNUSED(cmdId);
+ Q_UNUSED(err);
+ Q_UNUSED(diagnostic);
+
+}
+
+/*!
+ Slot for receiving notification of data changes from the model.
+ Identify the setting changed and update the corresponding UI item.
+ */
+void BtCpUiMainView::updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+{
+
+ // update only the part of the view specified by the model's row(s)
+
+ for (int i=topLeft.column(); i <= bottomRight.column(); i++) {
+ QModelIndex index = mModel.index( BtuiModel::LocalSettingRow, i);
+ // Distinguish which setting value is changed.
+ switch ( i ) {
+ case BtuiModel::BluetoothNameCol :
+ mDeviceNameEdit->setText( mModel.data(index,BtuiModel::settingDisplay).toString() );
+ break;
+ case BtuiModel::PowerStateCol:
+ mPowerButton->setText( mModel.data(index,BtuiModel::settingDisplay).toString() );
+ break;
+ case BtuiModel::VisibilityCol:
+ mVisibilityMode->setCurrentIndex ( visibilityModeToIndex((VisibilityMode)
+ mModel.data(index,BtuiModel::SettingValue).toInt()) );
+ break;
+ }
+ }
+
+
+}
+
+/*!
+ Slot for receiving notification for user interaction on power state.
+ Manually update model data since HbPushButton is not linked to model directly.
+ */
+void BtCpUiMainView::changePowerState()
+{
+
+ QModelIndex index = mModel.index(BtuiModel::LocalSettingRow, BtuiModel::PowerStateCol);
+ QVariant powerState = mModel.data(index, Qt::EditRole);
+ if (!mAbstractDelegate)//if there is no other delegate running
+ {
+ mAbstractDelegate = BtDelegateFactory::newDelegate(BtDelegate::ManagePower, mModel);
+ connect( mAbstractDelegate, SIGNAL(commandCompleted(int)), this, SLOT(powerDelegateCompleted(int)) );
+ mAbstractDelegate->exec(powerState);
+ }
+
+}
+
+void BtCpUiMainView::powerDelegateCompleted(int status)
+{
+ Q_UNUSED(status);
+ //ToDo: Error handling here
+ if (mAbstractDelegate)
+ {
+ disconnect(mAbstractDelegate);
+ delete mAbstractDelegate;
+ mAbstractDelegate = 0;
+ }
+ //BTUI_ASSERT_X( status, "bt-main-view", "error in delegate complete" );
+}
+
+/*!
+ * Mapping from visibility mode UI row to VisibilityMode
+ */
+VisibilityMode BtCpUiMainView::indexToVisibilityMode(int index)
+{
+ VisibilityMode mode;
+ switch(index) {
+ case UiRowBtHidden:
+ mode = BtHidden;
+ break;
+ case UiRowBtVisible:
+ mode = BtVisible;
+ break;
+ case UiRowBtTemporary:
+ mode = BtTemporary;
+ break;
+ default:
+ mode = BtUnknown;
+ }
+ return mode;
+}
+
+/*!
+ * Mapping from VisibilityMode to visibility mode UI row
+ */
+int BtCpUiMainView::visibilityModeToIndex(VisibilityMode mode)
+{
+ int uiRow;
+ switch(mode) {
+ case BtHidden:
+ uiRow = UiRowBtHidden;
+ break;
+ case BtVisible:
+ uiRow = UiRowBtVisible;
+ break;
+ case BtTemporary:
+ uiRow = UiRowBtTemporary;
+ break;
+ default:
+ uiRow = -1; // error
+ }
+ return uiRow;
+}
+//////////////////////
+//
+// from view manager
+//
+//////////////////////
+
+/*!
+ Create views(main view, device view and search view).
+ Add them to MainWindow. All views are long-lived and are deleted only when exiting the application
+ (or when main view is deleted).
+ */
+void BtCpUiMainView::createViews()
+{
+ Qt::Orientation orientation = mMainWindow->orientation();
+ // Create other views
+ mSearchView = new BtCpUiSearchView( mModel, this );
+ mMainWindow->addView(mSearchView);
+ mDeviceView = 0; // ToDo: add this later
+
+ mCurrentView = this;
+ mCurrentViewId = MainView;
+
+
+ // QList<int> stores the previous view ids for each view.
+ for( int i=0; i < LastView; i++ ) {
+ mPreviousViewIds.append( 0 );
+ }
+}
+
+/*!
+ Switch between the views.
+ Parameter cmdId is used for automatically executing command.
+ Parameter "value" is optional except for GadgetView,
+ which needs the BT address (QString)
+ */
+void BtCpUiMainView::changeView(int targetViewId, bool fromBackButton,
+ int cmdId, const QVariant& value )
+{
+ mCurrentView->deactivateView();
+
+ // update the previous view Id in QList<int>
+ // If launching the target view from back softkey,
+ // the previous viewId of target view should not be changed.
+ // Otherwise, loop happens between two views.
+ if(!fromBackButton) {
+ if ((targetViewId == DeviceView) && (mCurrentViewId == SearchView)) {
+ // we don't want to return to search view after e.g. pairing a new device
+ mPreviousViewIds[ targetViewId ] = MainView;
+ }
+ else {
+ // normal case: return to previous view
+ mPreviousViewIds[ targetViewId ] = mCurrentViewId;
+ }
+ }
+
+ // set the new current view
+ mCurrentView = idToView(targetViewId);
+ mCurrentViewId = targetViewId;
+ mMainWindow->setCurrentView( mCurrentView );
+
+ // do preparation or some actions when new view is activated
+ mCurrentView->activateView( value, cmdId );
+}
+
+
+BtCpUiBaseView * BtCpUiMainView::idToView(int targetViewId)
+{
+ switch (targetViewId) {
+ case MainView:
+ return mMainView;
+ case SearchView:
+ return mSearchView;
+ case DeviceView:
+ return mDeviceView;
+ default :
+ BTUI_ASSERT_X(false, "BtCpUiMainView::idToView", "invalid view id");
+ }
+ return 0;
+}
+
+/*
+ Jump to previous view. This function is used when back button is pressed.
+ */
+void BtCpUiMainView::switchToPreviousViewReally()
+{
+ // jump to previous view of current view.
+ if( (mCurrentViewId >= 0) && (mCurrentViewId < LastView)) {
+ changeView( mPreviousViewIds[mCurrentViewId], true, 0 );
+ }
+ else {
+ BTUI_ASSERT_X(false, "BtCpUiMainView::switchToPreviousViewReally", "invalid view id");
+ }
+}
+
+
+void BtCpUiMainView::setSoftkeyBack()
+{
+
+}
+
+void BtCpUiMainView::switchToPreviousView()
+{
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuimainview.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Main View of BT Application
+*
+*/
+
+#ifndef BTCPUIMAINVIEW_H
+#define BTCPUIMAINVIEW_H
+
+#include "btcpuibaseview.h"
+#include <btqtconstants.h>
+#include <QStringListModel>
+
+class HbLabel;
+class HbLineEdit;
+class HbPushButton;
+class HbIcon;
+class HbComboBox;
+class HbDocumentLoader;
+class HbGridView;
+class BtAbstractDelegate;
+
+
+class BtCpUiMainView : public BtCpUiBaseView
+{
+ Q_OBJECT
+
+public:
+ enum ViewIndex {
+ MainView,
+ SearchView,
+ DeviceView,
+ LastView
+ };
+ explicit BtCpUiMainView( BtuiModel &model, QGraphicsItem *parent = 0 );
+ ~BtCpUiMainView();
+ // from view manager
+ void createViews();
+
+ Qt::Orientation orientation();
+
+ // from base class BtCpUiBaseView
+ virtual void setSoftkeyBack();
+ virtual void activateView( const QVariant& value, int cmdId );
+ virtual void deactivateView();
+
+public slots:
+ void commandCompleted( int cmdId, int err, const QString &diagnostic );
+ void changeOrientation( Qt::Orientation orientation );
+ void itemActivated(QModelIndex index);
+ void changePowerState();
+ void updateSettingItems(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+
+ void goToDiscoveryView();
+
+ // from view manager
+ void changeView(int targetViewId, bool fromBackButton, int cmdId, const QVariant& value = 0 );
+ void switchToPreviousViewReally();
+ virtual void switchToPreviousView();
+
+ void visibilityChanged (int index);
+ void changeBtLocalName();
+
+ //from delegate classes
+ void powerDelegateCompleted(int status);
+ void visibilityDelegateCompleted(int status);
+ void btNameDelegateCompleted(int status, QVariant param);
+
+protected:
+
+
+private:
+ VisibilityMode indexToVisibilityMode(int index);
+ int visibilityModeToIndex(VisibilityMode mode);
+ BtCpUiBaseView * idToView(int targetViewId);
+
+ //Functions to set the Previous Local settings in case of error
+ void setPrevBtLocalName();
+ void setPrevVisibilityMode();
+
+private:
+ QAbstractItemModel* mSubModel;
+ HbDocumentLoader *mLoader;
+ HbLineEdit *mDeviceNameEdit;
+ HbPushButton *mPowerButton;
+ HbComboBox *mVisibilityMode;
+ QStringListModel *mVisiListModel;
+ HbGridView *mDeviceList;
+
+ // data structures for switching between views
+ bool mEventFilterInstalled;
+ int mAutoCmdId;
+ Qt::Orientation mOrientation;
+
+ // from view manager
+ HbMainWindow* mMainWindow;
+ BtCpUiBaseView* mMainView;
+ BtCpUiBaseView* mDeviceView;
+ BtCpUiBaseView* mSearchView;
+ BtCpUiBaseView* mCurrentView;
+ int mCurrentViewId;
+ HbAction *mBackAction;
+ QList<int> mPreviousViewIds;
+
+ //poiter to abstract delegate, and it is instantiated at runtime
+ BtAbstractDelegate* mAbstractDelegate;
+
+};
+#endif // BTCPUIMAINVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuisearchview.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include "btcpuisearchview.h"
+#include <QtGui/QGraphicsLinearLayout>
+#include <HbInstance>
+#include <hbdocumentloader.h>
+#include <hbdataform.h>
+#include <hbpushbutton.h>
+#include <hblabel.h>
+#include <hblistview.h>
+#include <hbmenu.h>
+#include <qstringlist>
+#include <qdebug>
+#include <bluetoothuitrace.h>
+#include "btcpuimainview.h"
+
+
+
+// docml to load
+const char* BTUI_SEARCHVIEW_DOCML = ":/docml/bt-search-view.docml";
+
+BtCpUiSearchView::BtCpUiSearchView(BtuiModel &model, QGraphicsItem *parent) :
+ BtCpUiBaseView(model,parent)
+/*{
+ mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
+ BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiBaseView::BtCpUiBaseView", "can't create back action");
+
+ QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout( Qt::Vertical, this );
+ // create button
+ HbPushButton *button = new HbPushButton(this);
+ button->setText("Press Me");
+ button->setMaximumSize(150,50);
+ mainLayout->addItem(button);
+
+// (void) connect(button, SIGNAL(clicked()), this, SLOT(changePowerState()));
+
+ setLayout(mainLayout);
+
+ // create dummy options menu
+ HbMenu *optionsMenu = new HbMenu();
+ HbAction *openGadgetGallery = optionsMenu->addAction("Open Device Gallery");
+// connect(openGadgetGallery, SIGNAL(triggered()), this, SLOT(openGadgetGalleryView()));
+ HbAction *openNewMainView = optionsMenu->addAction("Open new Main View");
+// connect(openNewMainView, SIGNAL(triggered()), this, SLOT(openNewMainView()));
+ setMenu(optionsMenu);
+
+}*/
+
+{
+ //bool ret(false);
+
+ mSearchView = this;
+ mMainView = (BtCpUiMainView *) parent;
+
+ mMainWindow = hbInstance->allMainWindows().first();
+
+ mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);
+ BTUI_ASSERT_X(mSoftKeyBackAction, "BtCpUiBaseView::BtCpUiBaseView", "can't create back action");
+
+
+ // read view info from docml file
+
+
+ // Create view for the application.
+ // Set the name for the view. The name should be same as the view's
+ // name in docml.
+ setObjectName("bt_search_view");
+
+ QObjectList objectList;
+ objectList.append(this);
+ // Pass the view to documentloader. Document loader uses this view
+ // when docml is parsed, instead of creating new view.
+ mLoader = new HbDocumentLoader();
+ mLoader->setObjectTree(objectList);
+
+ bool ok = false;
+ mLoader->load( BTUI_SEARCHVIEW_DOCML, &ok );
+ // Exit if the file format is invalid
+ BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file" );
+
+ // Set title for the control panel
+ // ToDo: check if deprecated API
+ setTitle("Control Panel");
+
+ // assign automatically created widgets to local variables
+
+ mDeviceIcon=0;
+ // can't use qobject_cast since HbIcon is not derived from QObject!
+ mDeviceIcon = qobject_cast<HbLabel *>( mLoader->findWidget( "icon" ) );
+ BTUI_ASSERT_X( mDeviceIcon != 0, "bt-search-view", "Device Icon not found" );
+
+ mDeviceName=0;
+ mDeviceName = qobject_cast<HbLabel *>( mLoader->findWidget( "label_found_devices" ) );
+ BTUI_ASSERT_X( mDeviceName != 0, "bt-search-view", "Device Name not found" );
+
+ mDeviceList=0;
+ mDeviceList = qobject_cast<HbListView *>( mLoader->findWidget( "deviceList" ) );
+ BTUI_ASSERT_X( mDeviceList != 0, "bt-search-view", "Device List not found" );
+
+
+// // set model to list view
+// mDeviceList->setModel( mFilterProxy );
+// // define settings for list view
+// mDeviceList->setSelectionMode(HbAbstractItemView::SingleSelection);
+// // set prototype item for list view
+// BtUiDevListGridItem *item = new BtUiDevListGridItem( mDeviceList );
+// mDeviceList->setItemPrototype(item);
+// // connect to list view pressed signal
+// ret = connect( mDeviceList, SIGNAL(pressed(QModelIndex)),this, SLOT(itemActivated(QModelIndex)) );
+// BTUI_ASSERT_X( ret, "bt-search-view", "device list can't connect" );
+
+ // read landscape orientation section from docml file if needed
+// mOrientation = ((BTUIViewManager*)parent)->orientation();
+ mOrientation = Qt::Vertical;
+ if (mOrientation == Qt::Horizontal) {
+ mLoader->load(BTUI_SEARCHVIEW_DOCML, "landscape", &ok);
+ BTUI_ASSERT_X( ok, "bt-search-view", "Invalid docml file: landscape section problem" );
+ }
+
+
+ // load tool bar actions
+ HbAction *viewByAction = static_cast<HbAction*>( mLoader->findObject( "viewByAction" ) );
+ BTUI_ASSERT_X( viewByAction, "bt-search-view", "view by action missing" );
+// ret = connect(viewByAction, SIGNAL(triggered()), this, SLOT(noOp()));
+// BTUI_ASSERT_X( ret, "bt-search-view", "viewByAction can't connect" );
+
+ HbAction *stopAction = static_cast<HbAction*>( mLoader->findObject( "stopAction" ) );
+ BTUI_ASSERT_X( stopAction, "bt-search-view", "view by action missing" );
+// ret = connect(stopAction, SIGNAL(triggered()), this, SLOT(noOp()));
+// BTUI_ASSERT_X( ret, "bt-search-view", "stopAction can't connect" );
+
+ HbAction *retryAction = static_cast<HbAction*>( mLoader->findObject( "retryAction" ) );
+ BTUI_ASSERT_X( retryAction, "bt-search-view", "view by action missing" );
+// ret = connect(retryAction, SIGNAL(triggered()), this, SLOT(noOp()));
+// BTUI_ASSERT_X( ret, "bt-search-view", "retryAction can't connect" );
+
+
+ // load menu
+ HbMenu *optionsMenu = qobject_cast<HbMenu *>(mLoader->findWidget("viewMenu"));
+ BTUI_ASSERT_X( optionsMenu != 0, "bt-search-view", "Options menu not found" );
+ this->setMenu(optionsMenu);
+
+
+ // update display when setting data changed
+// ret = connect(mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
+// this, SLOT(updateSettingItems(QModelIndex,QModelIndex)));
+// BTUI_ASSERT_X( ret, "BtCpUiSearchView::BtCpUiSearchView", "can't connect dataChanged" );
+
+// QModelIndex top = mModel->index( Btuim::LocalDeviceName, KDefaultColumn );
+// QModelIndex bottom = mModel->index( Btuim::Visibility, KDefaultColumn );
+// // update name, power and visibility rows
+// updateSettingItems( top, bottom );
+
+
+}
+
+BtCpUiSearchView::~BtCpUiSearchView()
+{
+ setNavigationAction(0);
+ delete mSoftKeyBackAction;
+}
+
+void BtCpUiSearchView::deviceSelected(const QModelIndex& modelIndex)
+{
+ int row = modelIndex.row();
+}
+
+void BtCpUiSearchView::setSoftkeyBack()
+{
+ if (navigationAction() != mSoftKeyBackAction) {
+ setNavigationAction(mSoftKeyBackAction);
+ connect( mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(switchToPreviousView()) );
+ }
+}
+
+void BtCpUiSearchView::switchToPreviousView()
+{
+ BTUI_ASSERT_X(mMainView, "BtCpUiSearchView::switchToPreviousView", "invalid mMainView");
+ // jump to previous view of current view.
+ mSearchView->deactivateView();
+
+ // set the new current view
+ mMainWindow->setCurrentView( mMainView );
+
+ // do preparation or some actions when new view is activated
+ mMainView->activateView( 0, 0 );
+
+}
+
+void BtCpUiSearchView::activateView( const QVariant& value, int cmdId )
+{
+ Q_UNUSED(value);
+ Q_UNUSED(cmdId);
+
+ setSoftkeyBack();
+}
+
+void BtCpUiSearchView::deactivateView()
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuisearchview.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef BTCPUISEARCHVIEW_H
+#define BTCPUISEARCHVIEW_H
+
+#include <cpbasesettingview.h>
+#include <hbaction.h>
+#include <hbtoolbar.h>
+#include "btcpuibaseview.h"
+
+class HbLabel;
+class HbPushButton;
+class HbIcon;
+class HbDocumentLoader;
+class HbListView;
+class HbDataFormModel;
+class HbDataFormModelItem;
+class CpSettingFormItemData;
+
+
+class BtCpUiSearchView : public BtCpUiBaseView
+{
+ Q_OBJECT
+
+public:
+ explicit BtCpUiSearchView(BtuiModel &model, QGraphicsItem *parent = 0);
+ virtual ~BtCpUiSearchView();
+ virtual void activateView( const QVariant& value, int cmdId );
+ virtual void deactivateView();
+ virtual void setSoftkeyBack();
+
+public slots:
+ void deviceSelected(const QModelIndex& modelIndex);
+ virtual void switchToPreviousView();
+
+private:
+ HbDocumentLoader *mLoader;
+ HbLabel *mDeviceIcon;
+ HbLabel *mDeviceName;
+ HbListView *mDeviceList;
+
+ // data structures for switching between views
+ bool mEventFilterInstalled;
+ int mAutoCmdId;
+ Qt::Orientation mOrientation;
+
+ HbMainWindow* mMainWindow;
+ BtCpUiBaseView* mMainView;
+ BtCpUiBaseView* mSearchView;
+ HbAction *mSoftKeyBackAction;
+// CpCustomLabelViewItem* mLabelItem;
+// CpCustomListViewItem* mListItem;
+ HbToolBar* mToolBar;
+ HbAction* mViewBy;
+ HbAction* mStop;
+ HbAction* mRetry;
+ HbDataFormModel* mModel;
+};
+
+#endif// BTCPUISEARCHVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuisettingitem.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#include "btcpuisettingitem.h"
+#include <cpitemdatahelper.h>
+
+#include <HbInstance>
+
+BtCpUiSettingItem::BtCpUiSettingItem(CpItemDataHelper &itemDataHelper,
+ const QString &text /*= QString()*/,
+ const QString &description /*= QString()*/,
+ const HbIcon &icon /*= HbIcon()*/,
+ const HbDataFormModelItem *parent /*= 0*/)
+ : CpSettingFormEntryItemData(itemDataHelper,
+ text,
+ description,
+ icon,
+ parent)
+{
+}
+
+BtCpUiSettingItem::~BtCpUiSettingItem()
+{
+
+}
+
+void BtCpUiSettingItem::onLaunchView()
+{
+ mModel = new BtuiModel();
+
+ mMainWindow = hbInstance->allMainWindows().first();
+
+ mBtMainView = new BtCpUiMainView(*mModel);
+
+ mCpView = mMainWindow->currentView();
+
+ mMainWindow->addView(mBtMainView);
+ mMainWindow->setCurrentView(mBtMainView);
+
+ connect(mBtMainView, SIGNAL(aboutToClose()), this, SLOT(handleCloseView()));
+
+}
+
+void BtCpUiSettingItem::handleCloseView()
+{
+ mBtMainView->deactivateView();
+ mMainWindow->setCurrentView(mCpView);
+ delete mBtMainView;
+ delete mModel;
+}
+
+
+CpBaseSettingView *BtCpUiSettingItem::createSettingView() const
+{
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/btcpuisettingitem.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0""
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef BTCPUISETTINGITEM_H
+#define BTCPUISETTINGITEM_H
+
+#include <cpsettingformentryitemdata.h>
+#include <btuimodel.h>
+
+#include "btcpuimainview.h"
+
+class BtCpUiSettingItem : public CpSettingFormEntryItemData
+{
+ Q_OBJECT
+public:
+ explicit BtCpUiSettingItem(CpItemDataHelper &itemDataHelper,
+ const QString &text = QString(),
+ const QString &description = QString(),
+ const HbIcon &icon = HbIcon(),
+ const HbDataFormModelItem *parent = 0);
+ virtual ~BtCpUiSettingItem();
+private slots:
+ void onLaunchView();
+ void handleCloseView();
+private:
+ virtual CpBaseSettingView *createSettingView() const;
+
+private:
+ HbMainWindow* mMainWindow;
+
+ BtCpUiMainView *mBtMainView;
+
+ //Owns this model.
+ BtuiModel *mModel;
+
+ HbView *mCpView;
+
+};
+
+#endif //BTCPUISETTINGITEM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/docml/bt-main-view.docml Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.0">
+ <object name="allAction" type="HbAction">
+ <string name="text" value="All"/>
+ </object>
+ <object name="pairedAction" type="HbAction">
+ <string name="text" value="Paired"/>
+ </object>
+ <object name="discoverAction" type="HbAction">
+ <string name="text" value="Discover"/>
+ </object>
+ <object name="advanceSettings" type="HbAction">
+ <string name="text" value="Advanced Settings"/>
+ </object>
+ <object name="audioDevices" type="HbAction">
+ <string name="text" value="Audio Devices"/>
+ </object>
+ <object name="computers" type="HbAction">
+ <string name="text" value="Computers"/>
+ </object>
+ <object name="inputDevices" type="HbAction">
+ <string name="text" value="Input Devices"/>
+ </object>
+ <object name="otherDevices" type="HbAction">
+ <string name="text" value="Other Devices"/>
+ </object>
+ <object name="removePairedDevices" type="HbAction">
+ <string name="text" value="Remove Paired Devices"/>
+ </object>
+ <object name="exit" type="HbAction">
+ <string name="text" value="Exit"/>
+ </object>
+ <object name="phones" type="HbAction">
+ <string name="text" value="Phones"/>
+ </object>
+ <widget name="view" type="HbView">
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <widget name="gridView" type="HbGridView">
+ <widget name="gridItemPrototype" role="HbAbstractView:prototype" type="HbGridViewItem"/>
+ <integer name="columnCount" value="1"/>
+ <sizehint height="47.7612un" type="PREFERRED" width="47.7612un"/>
+ </widget>
+ <widget name="toolBar" type="HbToolBar">
+ <sizehint height="7.46269un" type="PREFERRED" width="22.38806un"/>
+ <ref object="allAction" role="HbToolBar:addAction"/>
+ <ref object="pairedAction" role="HbToolBar:addAction"/>
+ <ref object="discoverAction" role="HbToolBar:addAction"/>
+ </widget>
+ <widget name="container_1" type="HbWidget">
+ <widget name="groupBox" type="HbGroupBox">
+ <bool name="collapsable" value="FALSE"/>
+ <string name="heading" value="Bluetooth"/>
+ </widget>
+ <widget name="container" type="HbWidget">
+ <widget name="icon" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="qtg_large_mobile" name="icon"/>
+ <real name="z" value="1"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+ <enums name="elideMode" value="ElideNone"/>
+ </widget>
+ <widget name="pushButton" type="HbPushButton">
+ <real name="z" value="2"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+ <string name="text" value="On"/>
+ </widget>
+ <widget name="combobox" type="HbComboBox">
+ <container name="items" type="stringlist">
+ <string value="Hidden"/>
+ <string value="Visible"/>
+ <string value="Visible for 5 Min"/>
+ </container>
+ <real name="z" value="4"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="36un"/>
+ </widget>
+ <widget name="lineEdit" type="HbLineEdit">
+ <real name="z" value="3"/>
+ <integer name="maxLength" value="30"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="34un"/>
+ <string name="text" value="Text"/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="23.8806un"/>
+ <layout type="anchor">
+ <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="lineEdit" dstEdge="LEFT" spacing="2un" src="icon" srcEdge="RIGHT"/>
+ <anchoritem dst="lineEdit" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="lineEdit" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="LEFT" spacing="2un" src="pushButton" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="lineEdit" srcEdge="BOTTOM"/>
+ <anchoritem dst="combobox" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="pushButton" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="pushButton" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="icon" srcEdge="BOTTOM"/>
+ <anchoritem dst="pushButton" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="11.9403un"/>
+ <layout orientation="Vertical" spacing="0un" type="linear">
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <linearitem itemname="groupBox"/>
+ <linearitem itemname="container"/>
+ </layout>
+ </widget>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="container_1"/>
+ <linearitem itemname="gridView"/>
+ <linearitem itemname="toolBar"/>
+ </layout>
+ </widget>
+ <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+ <widget name="subMenu" role="HbMenu:menu" type="HbMenu">
+ <ref object="audioDevices" role="HbMenu:addAction"/>
+ <ref object="computers" role="HbMenu:addAction"/>
+ <ref object="phones" role="HbMenu:addAction"/>
+ <ref object="inputDevices" role="HbMenu:addAction"/>
+ <ref object="otherDevices" role="HbMenu:addAction"/>
+ <string name="title" value="Show Only"/>
+ </widget>
+ <ref object="advanceSettings" role="HbMenu:addAction"/>
+ <ref object="removePairedDevices" role="HbMenu:addAction"/>
+ <ref object="exit" role="HbMenu:addAction"/>
+ </widget>
+ <string name="title" value="Control Panel"/>
+ </widget>
+ <section name="portrait">
+ <widget name="lineEdit" type="HbLineEdit">
+ <sizehint type="PREFERRED" width="29.25373un"/>
+ </widget>
+ <widget name="combobox" type="HbComboBox">
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="31.34328un"/>
+ </widget>
+ <widget name="container" type="HbWidget">
+ <layout type="anchor">
+ <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="lineEdit" dstEdge="LEFT" spacing="2un" src="icon" srcEdge="RIGHT"/>
+ <anchoritem dst="lineEdit" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="lineEdit" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="LEFT" spacing="2un" src="pushButton" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="lineEdit" srcEdge="BOTTOM"/>
+ <anchoritem dst="combobox" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="pushButton" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="pushButton" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="icon" srcEdge="BOTTOM"/>
+ <anchoritem dst="pushButton" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ <widget name="icon" type="HbLabel">
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+ </widget>
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" spacing="var(hb-param-margin-gene-middle-vertical)" type="linear">
+ <linearitem itemname="groupBox"/>
+ <linearitem itemname="container"/>
+ <linearitem itemname="gridView"/>
+ <linearitem itemname="toolBar"/>
+ </layout>
+ </widget>
+ <widget name="pushButton" type="HbPushButton">
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+ </widget>
+ </section>
+ <section name="landscape">
+ <widget name="lineEdit" type="HbLineEdit">
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="33un"/>
+ </widget>
+ <widget name="gridView" type="HbGridView">
+ <enums name="horizontalScrollBarPolicy" value="ScrollBarAlwaysOff"/>
+ <enums name="scrollDirections" value="Horizontal"/>
+ <integer name="columnCount" value="5"/>
+ <integer name="rowCount" value="1"/>
+ </widget>
+ <widget name="combobox" type="HbComboBox">
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="34.92537un"/>
+ </widget>
+ <widget name="container" type="HbWidget">
+ <layout type="anchor">
+ <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="lineEdit" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="lineEdit" dstEdge="LEFT" spacing="1.97885un" src="icon" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="LEFT" spacing="expr(var(hb-param-margin-gene-middle-horizontal) )" src="pushButton" srcEdge="RIGHT"/>
+ <anchoritem dst="combobox" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="" srcEdge="TOP"/>
+ <anchoritem dst="combobox" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="pushButton" dstEdge="LEFT" spacing="2un" src="lineEdit" srcEdge="RIGHT"/>
+ <anchoritem dst="pushButton" dstEdge="TOP" spacing="expr(var(hb-param-margin-gene-top) )" src="" srcEdge="TOP"/>
+ </layout>
+ </widget>
+ <widget name="icon" type="HbLabel">
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+ </widget>
+ </section>
+ <metadata activeUIState="landscape" display="NHD landscape" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ <uistate name="portrait" sections="#common"/>
+ <uistate name="portrait_UI" sections="#common portrait"/>
+ <uistate name="landscape" sections="#common landscape"/>
+ <dummydata objectName="gridView" section="#common" value="app_grid_template2"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/docml/bt-search-view.docml Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+ <object name="viewByAction" type="HbAction">
+ <string name="text" value="View by"/>
+ <bool name="visible" value="TRUE"/>
+ </object>
+ <object name="stopAction" type="HbAction">
+ <string name="text" value="Stop"/>
+ </object>
+ <object name="retryAction" type="HbAction">
+ <string name="text" value="Retry"/>
+ </object>
+ <object name="exitAction" type="HbAction">
+ <string name="text" value="Exit"/>
+ </object>
+ <object name="connectAction" type="HbAction">
+ <string name="text" value="Connect"/>
+ </object>
+ <object name="disconnectAction" type="HbAction">
+ <string name="text" value="Disconnect"/>
+ </object>
+ <widget name="bt_search_view" type="HbView">
+ <widget name="search_view_content" role="HbView:widget" type="HbWidget">
+ <widget name="search_container" type="HbWidget">
+ <widget name="label_found_devices" type="HbLabel">
+ <real name="z" value="3"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="38.20896un"/>
+ <bool name="visible" value="TRUE"/>
+ <string name="plainText" value="Bluetooth - Found devices"/>
+ </widget>
+ <widget name="icon" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName="note_warning" name="icon"/>
+ <real name="z" value="2"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="var(hb-param-graphic-size-primary-large)"/>
+ <bool name="visible" value="TRUE"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="MAXIMUM" width="var(hb-param-graphic-size-primary-large)"/>
+ </widget>
+ <widget name="label_searching" type="HbLabel">
+ <real name="z" value="3"/>
+ <sizehint height="var(hb-param-graphic-size-primary-large)" type="PREFERRED" width="38.20896un"/>
+ <bool name="visible" value="TRUE"/>
+ <string name="plainText" value="Searching..."/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="21un" type="PREFERRED" width="51.19403un"/>
+ <bool name="visible" value="TRUE"/>
+ <layout type="anchor">
+ <anchoritem dst="label_found_devices" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="label_found_devices" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="label_found_devices" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="label_found_devices" srcEdge="BOTTOM"/>
+ <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="icon" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="label_searching" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="label_found_devices" srcEdge="BOTTOM"/>
+ <anchoritem dst="label_searching" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="icon" srcEdge="RIGHT"/>
+ <anchoritem dst="label_searching" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="label_searching" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ </layout>
+ </widget>
+ <widget name="toolBar" type="HbToolBar">
+ <real name="z" value="2"/>
+ <sizehint height="7.46269un" type="PREFERRED" width="52.98508un"/>
+ <bool name="visible" value="TRUE"/>
+ <ref object="viewByAction" role="HbToolBar:addAction"/>
+ <ref object="stopAction" role="HbToolBar:addAction"/>
+ <ref object="retryAction" role="HbToolBar:addAction"/>
+ </widget>
+ <widget name="deviceList" type="HbListWidget"/>
+ <real name="z" value="0"/>
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="0un" left="0un" right="0un" top="0un"/>
+ <linearitem itemname="search_container"/>
+ <linearitem itemname="deviceList"/>
+ <linearitem itemname="toolBar"/>
+ </layout>
+ </widget>
+ <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+ <ref object="exitAction" role="HbMenu:addAction"/>
+ <ref object="connectAction" role="HbMenu:addAction"/>
+ </widget>
+ <string name="title" value="Control Panel"/>
+ <real name="z" value="1"/>
+ </widget>
+ <section name="landscape">
+ <widget name="search_container" type="HbWidget">
+ <sizehint height="10un" type="PREFERRED" width="51.19403un"/>
+ <layout type="anchor">
+ <anchoritem dst="label_found_devices" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="label_found_devices" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="label_found_devices" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="icon" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="icon" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="label_found_devices" srcEdge="RIGHT"/>
+ <anchoritem dst="icon" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="label_searching" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="label_searching" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="icon" srcEdge="RIGHT"/>
+ <anchoritem dst="label_searching" dstEdge="BOTTOM" spacing="-var(hb-param-margin-gene-bottom)" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="label_searching" dstEdge="RIGHT" spacing="-var(hb-param-margin-gene-right)" src="" srcEdge="RIGHT"/>
+ </layout>
+ </widget>
+ </section>
+ <metadata activeUIState="portrait_ui" display="NHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ <uistate name="landscape_ui" sections="#common landscape"/>
+ <uistate name="portrait_ui" sections="#common"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_frwidget_add_friend_photo.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="54px" height="54px" viewBox="0 0 54 54" enable-background="new 0 0 54 54" xml:space="preserve">
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="18.2432" y1="-6516.127" x2="18.2432" y2="-6462.127" gradientTransform="matrix(1 0 0 -1 8.2573 -6462.627)">
+ <stop offset="0" style="stop-color:#171511"/>
+ <stop offset="0.51" style="stop-color:#2F3838"/>
+ <stop offset="0.51" style="stop-color:#3A4547"/>
+ <stop offset="1" style="stop-color:#5C6869"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" d="M53.5,47.072c0,3.535-2.893,6.428-6.429,6.428H5.929c-3.535,0-6.429-2.893-6.429-6.428V5.929
+ C-0.5,2.392,2.394-0.5,5.929-0.5h41.143c3.536,0,6.429,2.892,6.429,6.429V47.072z"/>
+<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="8.8711" y1="1490.1309" x2="15.9404" y2="1524.4484" gradientTransform="matrix(1 0 0 1 8.2573 -1479.3516)">
+ <stop offset="0" style="stop-color:#CCCFD3"/>
+ <stop offset="0.8146" style="stop-color:#7F848B"/>
+ <stop offset="1" style="stop-color:#5A5D60"/>
+</linearGradient>
+<path fill="url(#SVGID_2_)" d="M22.764,24.915c-6.442,0-11.667,5.228-11.667,11.666v4.138c0,5.25,23.334,5.25,23.334,0V36.58
+ C34.432,30.145,29.207,24.915,22.764,24.915z M22.39,24.097c4.076-0.196,7.325-3.443,7.523-7.517
+ c-0.202-3.794-3.308-6.814-7.143-6.812c-3.963,0.007-7.18,3.216-7.18,7.18C15.59,20.788,18.608,23.897,22.39,24.097z"/>
+<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="14.4937" y1="1489.9238" x2="14.4937" y2="1498.3613" gradientTransform="matrix(1 0 0 1 8.2573 -1479.3516)">
+ <stop offset="0" style="stop-color:#FFFFFF"/>
+ <stop offset="0.1629" style="stop-color:#FFFFFF"/>
+ <stop offset="0.4554" style="stop-color:#FAFAFA"/>
+ <stop offset="0.8002" style="stop-color:#ECECEC"/>
+ <stop offset="1" style="stop-color:#E0E0E0"/>
+</linearGradient>
+<path fill="url(#SVGID_3_)" fill-opacity="0.5" d="M22.772,10.573L22.772,10.573c-3.517,0.007-6.378,2.867-6.378,6.376
+ c0,1.535,2.63,1.861,5.999,2.062c3.644-0.197,6.714-1.222,6.714-2.425C28.904,13.207,26.131,10.57,22.772,10.573z"/>
+<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="24.2915" y1="9332.8164" x2="38.4707" y2="9332.8164" gradientTransform="matrix(1 0 0 1 8.2573 -9317.2422)">
+ <stop offset="0" style="stop-color:#B2B2B2"/>
+ <stop offset="0.5" style="stop-color:#B0B0B0"/>
+ <stop offset="1" style="stop-color:#797878"/>
+</linearGradient>
+<path fill="url(#SVGID_4_)" d="M37.842,8.488c-0.24,0-0.436,0.195-0.436,0.434v4.395h-4.42c-0.279,0-0.438,0.23-0.438,0.435v3.615
+ c0,0.24,0.195,0.436,0.438,0.436h4.42v4.42c0,0.241,0.195,0.437,0.437,0.437h3.616c0.241,0,0.438-0.195,0.438-0.437v-4.42h4.396
+ c0.24,0,0.436-0.195,0.436-0.436V13.75c0-0.24-0.194-0.435-0.436-0.435h-4.396V8.921c0-0.243-0.192-0.434-0.438-0.434L37.842,8.488
+ L37.842,8.488z"/>
+<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="26.6006" y1="-13502.2988" x2="32.5521" y2="-13513.8125" gradientTransform="matrix(1 0 0 -1 8.2573 -13495.9805)">
+ <stop offset="0" style="stop-color:#FFFFFF"/>
+ <stop offset="1" style="stop-color:#D8D8D8"/>
+</linearGradient>
+<path fill="url(#SVGID_5_)" d="M46.283,17.366h-4.827v4.855h-3.614v-4.855h-4.857v-3.614h4.857V8.921h3.614v4.829h4.827V17.366
+ L46.283,17.366z"/>
+<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="14.5039" y1="1506.3008" x2="14.5039" y2="1518.3916" gradientTransform="matrix(1 0 0 1 8.2573 -1479.3516)">
+ <stop offset="0" style="stop-color:#E8E7E6"/>
+ <stop offset="0.0056" style="stop-color:#E8E7E6"/>
+ <stop offset="0.8933" style="stop-color:#9B9A9A"/>
+ <stop offset="1" style="stop-color:#9B9A9A"/>
+</linearGradient>
+<path fill="url(#SVGID_6_)" fill-opacity="0.5" d="M22.402,29.436c-1.952-0.101-3.693-0.981-4.927-2.331
+ c-2.824,1.581-4.872,4.385-5.423,7.698c0,2.004,5.314,4.238,10.711,4.238c5.389,0,10.663-2.227,10.708-4.227
+ c-0.646-3.938-3.197-6.568-5.682-7.864C26.425,28.396,24.528,29.333,22.402,29.436z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_graf_blid_det_circle.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="150px" version="1.1" viewBox="0 0 200 150" width="200px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<path d="M188,75c0-36.117-39.477-65.5-88-65.5S12,38.883,12,75c0,0.167,0.007,0.333,0.009,0.5 C12.007,75.667,12,75.833,12,76c0,36.117,39.477,65.5,88,65.5s88-29.383,88-65.5c0-0.167-0.007-0.333-0.009-0.5 C187.993,75.333,188,75.167,188,75z" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M13,76c0,35.565,39.028,64.5,87,64.5s87-28.935,87-64.5s-39.028-64.5-87-64.5S13,40.435,13,76z" fill-opacity="0.5" stroke-opacity="0.5"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="100" x2="100" y1="-13.6875" y2="268.3076">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#FCBA63"/>
+</linearGradient>
+<path d="M13,75c0,35.565,39.028,64.5,87,64.5s87-28.935,87-64.5s-39.028-64.5-87-64.5S13,39.435,13,75z" fill="url(#SVGID_1_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="100" x2="100" y1="-63.6826" y2="110.3163">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#FCBA63"/>
+</linearGradient>
+<ellipse cx="100" cy="75" fill="url(#SVGID_2_)" rx="67.5" ry="50.625"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="100" x2="100" y1="-31.0229" y2="184.9786">
+<stop offset="0" style="stop-color:#FFE23D"/>
+<stop offset="0.2239" style="stop-color:#FAD337"/>
+<stop offset="0.6537" style="stop-color:#EFAB26"/>
+<stop offset="1" style="stop-color:#E48717"/>
+</linearGradient>
+<ellipse cx="100" cy="75" fill="url(#SVGID_3_)" rx="45" ry="33.75"/>
+<ellipse cx="100" cy="75" fill="#E48717" rx="22.5" ry="16.875"/>
+<rect fill="none" height="150" width="200"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_graf_blid_time.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="32px" version="1.1" viewBox="0 0 32 32" width="32px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<path d="M26.311,11.072c0,0,0.286-0.339,0.592-0.702c0.474-0.562,0.661-1.684-0.205-2.409 c-0.373-0.313-2.18-1.827-2.18-1.827c-0.719-0.603-1.797-0.51-2.404,0.206c0,0-0.254,0.303-0.598,0.711 c-0.588-0.285-1.197-0.534-1.83-0.727c0.199-0.36,0.324-0.766,0.324-1.204V3.77c0-0.698-0.281-1.349-0.791-1.833 c-0.475-0.458-1.113-0.712-1.791-0.712h-2.869c-1.422,0-2.58,1.14-2.582,2.541l-0.006,1.343c0,0.432,0.123,0.849,0.328,1.221 c-0.631,0.192-1.234,0.442-1.82,0.726L9.873,6.332C9.871,6.33,8.709,5.726,8.709,5.726c0,0.001-1.246,0.394-1.246,0.394L5.289,7.943 C4.887,8.282,4.68,8.768,4.68,9.256c0,0.387,0.131,0.776,0.398,1.095l0.607,0.729c-1.508,2.091-2.408,4.65-2.408,7.42 c0,7.018,5.707,12.726,12.725,12.726c7.016,0,12.723-5.708,12.723-12.726C28.725,15.727,27.822,13.165,26.311,11.072z" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M25.037,11.031l1.1-1.305c0.257-0.305,0.215-0.747-0.086-1.001l-7.906-2.241 c0.51-0.256,0.865-0.768,0.865-1.363V3.77c0-0.42-6.031-0.854-6.033-0.003l-0.006,1.346c0,0.416,0.174,0.82,0.477,1.109 c0.115,0.11-7.516,2.488-7.516,2.488C5.633,8.961,5.594,9.409,5.844,9.708l1.113,1.331c-6.304,7.632-0.87,19.186,9.045,19.186 C25.957,30.225,31.339,18.647,25.037,11.031z" fill-opacity="0.5" stroke-opacity="0.5"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="15.9907" x2="15.9907" y1="3.6362" y2="7.4279">
+<stop offset="0" style="stop-color:#E3E3E3"/>
+<stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<polygon fill="url(#SVGID_1_)" points="18.139,6.402 13.834,6.399 13.84,4.682 18.148,4.683 "/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="15.9897" x2="15.9897" y1="1.1694" y2="6.3812">
+<stop offset="0" style="stop-color:#E3E3E3"/>
+<stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path d="M14.559,1.225c-0.871,0-1.58,0.691-1.582,1.542l-0.006,1.346c0,0.416,0.174,0.82,0.477,1.109 c0.295,0.282,0.688,0.438,1.105,0.438h2.869c0.875,0,1.588-0.69,1.588-1.54V2.77c0-0.42-0.17-0.813-0.479-1.107 c-0.293-0.281-0.686-0.438-1.104-0.438H14.559z" fill="url(#SVGID_2_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="23.377" x2="23.377" y1="5.6616" y2="12.5607">
+<stop offset="0" style="stop-color:#E3E3E3"/>
+<stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path d="M26.051,7.725L23.875,5.9c-0.299-0.251-0.744-0.213-0.998,0.086L20.449,8.87l3.262,2.736l2.426-2.88 c0.121-0.144,0.18-0.33,0.166-0.519C26.285,8.02,26.193,7.845,26.051,7.725z" fill="url(#SVGID_3_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="8.6069" x2="8.6069" y1="5.6465" y2="12.5806">
+<stop offset="0" style="stop-color:#E3E3E3"/>
+<stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path d="M11.535,8.877l-2.43-2.903C8.984,5.83,8.813,5.739,8.625,5.723C8.438,5.706,8.25,5.764,8.105,5.886 L5.932,7.709C5.633,7.961,5.594,8.409,5.844,8.708l2.436,2.913L11.535,8.877z" fill="url(#SVGID_4_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="16.0005" x2="16.0005" y1="5.4863" y2="33.038">
+<stop offset="0" style="stop-color:#E3E3E3"/>
+<stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path d="M27.725,17.499c0,6.477-5.248,11.726-11.723,11.726c-6.479,0-11.725-5.249-11.725-11.726 c0-6.476,5.246-11.722,11.725-11.722C22.477,5.777,27.725,11.023,27.725,17.499z" fill="url(#SVGID_5_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="16.0005" x2="16.0005" y1="10.6353" y2="34.4321">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#B2B2B2"/>
+</linearGradient>
+<circle cx="16.001" cy="17.499" fill="url(#SVGID_6_)" r="9.714"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_7_" x1="16.0005" x2="16.0005" y1="35.3066" y2="2.7685">
+<stop offset="0" style="stop-color:#E3E3E3"/>
+<stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path d="M5.951,17.499c0-5.552,4.5-10.048,10.051-10.048l0,0c5.549,0,10.045,4.497,10.045,10.048l0,0h0.002 c-0.002,5.551-4.498,10.049-10.047,10.05l0,0C10.451,27.548,5.951,23.05,5.951,17.499L5.951,17.499z M6.621,17.499 c0.008,5.181,4.199,9.37,9.381,9.379l0,0c5.18-0.009,9.367-4.198,9.377-9.379l0,0c-0.01-5.182-4.197-9.372-9.377-9.38l0,0 C10.82,8.127,6.629,12.317,6.621,17.499L6.621,17.499z" fill="url(#SVGID_7_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_8_" x1="20.4492" x2="20.4492" y1="7.4663" y2="52.9759">
+<stop offset="0" style="stop-color:#EA2227"/>
+<stop offset="0.3116" style="stop-color:#D22024"/>
+<stop offset="0.9676" style="stop-color:#94191C"/>
+<stop offset="1" style="stop-color:#91191C"/>
+</linearGradient>
+<path d="M16.045,8.654c-0.016,0-0.029,0.001-0.043,0.002v8.845l5.869,6.652 c1.85-1.623,3.025-3.998,3.025-6.648C24.896,12.625,20.926,8.654,16.045,8.654z" fill="url(#SVGID_8_)"/>
+<linearGradient gradientTransform="matrix(1 -0.0026 0.0026 1 -2.9697 1.1626)" gradientUnits="userSpaceOnUse" id="SVGID_9_" x1="17.6729" x2="25.3105" y1="19.2891" y2="19.2891">
+<stop offset="0" style="stop-color:#404040"/>
+<stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<path d="M22.4,23.839l-5.23-5.852c0.063-0.15,0.098-0.313,0.098-0.486c-0.002-0.695-0.568-1.259-1.264-1.257 c-0.699,0.001-1.26,0.567-1.258,1.264s0.566,1.259,1.264,1.257c0.129,0,0.252-0.025,0.373-0.063l5.227,5.845L22.4,23.839z" fill="url(#SVGID_9_)"/>
+<path d="M14.043,4.598c-0.135-0.129-0.209-0.302-0.209-0.482l0.006-1.348 c0.002-0.376,0.322-0.681,0.719-0.681h2.869c0.191,0,0.375,0.072,0.51,0.201l0.594-0.625c-0.293-0.281-0.686-0.438-1.104-0.438 h-2.869c-0.871,0-1.58,0.691-1.582,1.542l-0.006,1.346c0,0.416,0.174,0.82,0.477,1.109L14.043,4.598z" fill="#FFFFFF" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M18.531,1.663l-0.594,0.625c0.135,0.128,0.211,0.3,0.211,0.481v1.349c-0.002,0.374-0.328,0.679-0.727,0.679 h-2.869c-0.191,0-0.375-0.071-0.51-0.2l-0.596,0.624c0.295,0.282,0.688,0.438,1.105,0.438h2.869c0.875,0,1.588-0.69,1.588-1.54V2.77 C19.01,2.35,18.84,1.956,18.531,1.663z" fill-opacity="0.2" stroke-opacity="0.2"/>
+<path d="M12.288,9.465c-4.629,2.147-6.305,7.529-4.286,11.802l16.027-7.473 C21.954,9.318,16.695,7.421,12.288,9.465z" fill="#FFFFFF" fill-opacity="0.2" stroke-opacity="0.2"/>
+<rect fill="none" height="32" width="32"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_blocked.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="13" height="13" viewBox="-0.014 -0.048 13 13">
+<rect fill="none" height="13" width="13" x="-0.014" y="-0.048"/>
+<path d="M6.5,2.044c-2.462,0-4.457,1.996-4.457,4.455c0,2.46,1.995,4.457,4.457,4.457c2.46,0,4.457-1.995,4.457-4.457 C10.955,4.04,8.96,2.044,6.5,2.044z M3.222,7.575V5.426h6.555v2.149H3.222z"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_paired_add.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="13" height="13" viewBox="0 0 13 13">
+<path d="M7.313,3.31L4.796,0.792V3.67L3.717,2.59L3.223,3.085c0,0,1.117,1.117,1.574,1.573v0.18 C4.34,5.293,3.223,6.412,3.223,6.412l0.495,0.495l1.079-1.079v2.878l2.517-2.518c0,0-1.094-1.094-1.438-1.438 C6.219,4.404,7.313,3.31,7.313,3.31z M6.325,6.187C6.147,6.365,5.821,6.69,5.516,6.997V5.378 C5.822,5.685,6.159,6.021,6.325,6.187z M5.516,4.119V2.5c0.306,0.306,0.631,0.632,0.809,0.81 C6.159,3.476,5.822,3.813,5.516,4.119z"/>
+<path d="M12.823,6.973l-2.517-2.518v2.877l-1.079-1.08L8.732,6.749c0,0,1.117,1.117,1.574,1.573v0.18 c-0.457,0.456-1.574,1.573-1.574,1.573l0.495,0.494l1.079-1.079v2.877l2.517-2.518c0,0-1.094-1.094-1.438-1.438 C11.729,8.067,12.823,6.973,12.823,6.973z M11.834,6.973c-0.166,0.166-0.502,0.502-0.809,0.809V6.164 C11.331,6.47,11.657,6.795,11.834,6.973z M11.834,9.85c-0.178,0.178-0.503,0.504-0.809,0.81V9.042 C11.332,9.348,11.669,9.685,11.834,9.85z"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_indi_bt_trusted_add.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="13" height="13" viewBox="0 0 13 13">
+<path d="M11.036,3.501V1.162H3.964v2.339h-1V12.5h9.072V3.501H11.036z M10.036,3.417H4.964V2.162h5.072V3.417z M11.036,4.501 V11.5H3.964V4.501H11.036z"/>
+<path d="M7.188,8.097C6.851,8.434,6.024,9.261,6.024,9.261L6.39,9.626l0.798-0.798v1.397v0.731L9.05,9.095 c0,0-0.809-0.81-1.064-1.063C8.241,7.776,9.05,6.967,9.05,6.967L7.188,5.104v2.129L6.39,6.435L6.024,6.801 c0,0,0.827,0.827,1.164,1.164V8.097z M8.318,9.095c-0.131,0.132-0.373,0.373-0.599,0.6V8.497 C7.946,8.723,8.196,8.973,8.318,9.095z M8.318,6.967C8.196,7.089,7.946,7.338,7.72,7.565V6.367 C7.946,6.594,8.187,6.834,8.318,6.967z"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_audio.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<path d="M12.419,1.676v3.953c-0.055-0.017-0.095-0.048-0.158-0.057 c-0.648-0.09-1.453,0.32-1.798,0.914c-0.345,0.594-0.097,1.148,0.55,1.237c0.648,0.09,1.453-0.319,1.797-0.913 c0.09-0.155,0.136-0.306,0.148-0.448c0.001-0.002,0.002-0.002,0.003-0.005c0-0.144,0-3.131,0-3.131l1.374,0.734V2.826 L12.419,1.676z" fill="#496DA2"/>
+<path d="M2.718,6.217C3.72,6.211,4.533,6.235,4.533,6.235l-0.024,5.754 c0,0-1.093,0.005-1.773,0.005C1.32,11.697,1.299,6.572,2.718,6.217z" fill="#A2C2DD"/>
+<linearGradient id="_3" gradientUnits="userSpaceOnUse" x1="6.83" y1="3.67" x2="6.83" y2="13.89">
+<stop stop-color="#CEE1EF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.5"/>
+<stop stop-color="#496DA2" offset="1"/>
+</linearGradient>
+<path d="M8.146,3.86H7.216c-0.007,0-0.013,0.008-0.021,0.009 c-0.01,0-0.02-0.009-0.029-0.009c-0.993,0-1.798,2.343-1.798,5.231c0,2.89,0.805,5.231,1.798,5.231c0.016,0,1.006,0,1.006,0 C8.353,14.323,8.327,3.86,8.146,3.86z" fill="url(#_3)"/>
+<linearGradient id="_4" gradientUnits="userSpaceOnUse" x1="6.32" y1="9.09" x2="9.91" y2="9.09">
+<stop stop-color="#CEE1EF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<ellipse cx="8.116" cy="9.092" fill="url(#_4)" rx="1.798" ry="5.231"/>
+<ellipse cx="8.147" cy="9.092" fill="#A2C2DD" rx="1.529" ry="4.447"/>
+<path d="M6.74,10.781C8.343,9.891,8.343,7.898,6.776,7.19C6.598,8.052,6.615,9.66,6.74,10.781z" fill="#496DA2"/>
+<path d="M6.121,4.823L3.665,6.235L3.664,6.237c-1.16,0.736-1.16,4.934-0.026,5.709 c0.003,0.008,0.005,0.015,0.008,0.022c0.817,0.466,1.116,0.616,2.476,1.354C4.521,8.883,6.121,4.823,6.121,4.823z" fill="#496DA2"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_blocked_tab3.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="44" height="22" viewBox="29 27.393 44 22">
+<path d="M57.641,35.668c-3.277,0-5.934,2.657-5.934,5.934c0,3.273,2.656,5.932,5.934,5.932c3.275,0,5.933-2.656,5.933-5.932 C63.572,38.325,60.916,35.668,57.641,35.668z M53.275,43.034v-2.865h8.729v2.865H53.275z"/>
+<path d="M40.973,38.393c0.957-0.958,4-4,4-4l-7-7v8l-3-3l-1.375,1.375c0,0,3.092,3.094,4.375,4.375v0.5 c-1.283,1.281-4.375,4.375-4.375,4.375l1.375,1.375l3-3v8l7-7C44.973,42.393,41.93,39.352,40.973,38.393z M42.223,34.393l-2.25,2.25 v-4.5L42.223,34.393z M39.973,44.643v-4.5c0.853,0.854,1.791,1.79,2.25,2.25L39.973,44.643z"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_car_kit.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16px" version="1.1" viewBox="-0.012 -0.038 16 16" width="16px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<rect fill="none" height="16" width="16"/>
+<polygon fill="#CEE1EF" points="12.87,7.236 12.04,6.979 9.01,8.949 9.976,9.259 "/>
+<path d="M5.034,11.765c0.005-0.003,0.011-0.007,0.016-0.009c0.482-0.25,1.362-1.096,1.362-1.096 S3.317,9.071,3.291,9.91c-0.027,0.838,0.465,1.689,1.101,1.897c0.222,0.073,0.43,0.054,0.61-0.031v0.006 C5.012,11.778,5.023,11.77,5.034,11.765z" fill="#496DA2"/>
+<path d="M9.994,11.781c0,0-3.284-1.877-3.313-0.95c-0.027,0.928,0.517,1.866,1.218,2.097 c0.249,0.083,0.483,0.062,0.685-0.037v0.015C9.054,12.687,9.994,11.781,9.994,11.781z" fill="#496DA2"/>
+<polygon fill="#496DA2" points="9.217,9.008 12.04,6.979 10.879,4.431 8.289,5.777 "/>
+<polygon fill="#496DA2" points="10.455,11.982 13.327,9.541 12.861,7.22 9.94,9.219 "/>
+<polygon fill="#CEE1EF" points="10.937,4.453 6.985,3.806 4.288,4.797 8.307,5.785 "/>
+<polygon fill="#A2C2DD" points="9.16,8.851 9.988,9.212 10.455,11.984 2.051,9.408 2.529,7.396 3.146,7.257 4.261,4.805 8.299,5.779 "/>
+<polygon fill="#496DA2" points="4.676,5.74 3.88,7.515 8.339,8.807 7.823,6.486 "/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_carkit.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<path d="M4.994,11.816c0.006-0.003,0.012-0.007,0.018-0.01c0.546-0.283,1.542-1.24,1.542-1.24 S3.051,8.767,3.021,9.717c-0.031,0.949,0.526,1.913,1.246,2.148c0.251,0.083,0.486,0.061,0.69-0.036v0.007 C4.968,11.832,4.982,11.822,4.994,11.816z" fill="#496DA2"/>
+<path d="M10.609,11.835c0,0-3.718-2.125-3.75-1.075c-0.031,1.05,0.585,2.112,1.378,2.373 c0.282,0.094,0.547,0.07,0.775-0.042l0,0.016C9.544,12.86,10.609,11.835,10.609,11.835z" fill="#496DA2"/>
+<polygon fill="#496DA2" points="9.729,8.696 12.925,6.4 11.61,3.514 8.678,5.039 "/>
+<polygon fill="#496DA2" points="11.13,12.063 14.382,9.299 13.854,6.672 10.548,8.934 "/>
+<polygon fill="#CEE1EF" points="11.675,3.54 7.203,2.807 4.149,3.929 8.698,5.048 "/>
+<polygon fill="#CEE1EF" points="13.864,6.69 12.925,6.4 9.494,8.629 10.588,8.98 "/>
+<polygon fill="#A2C2DD" points="9.665,8.518 10.602,8.927 11.13,12.065 1.617,9.149 2.158,6.87 2.857,6.713 4.118,3.937 8.69,5.041 "/>
+<polygon fill="#496DA2" points="4.588,4.997 3.687,7.005 8.735,8.468 8.151,5.841 "/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_computer.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<polygon fill="#A2C2DD" points="8.984,14.184 2.357,12.119 2.211,9.661 8.961,11.244 "/>
+<polygon fill="#CEE1EF" points="14.003,8.848 6.92,8.078 2.211,9.66 8.92,11.25 "/>
+<polygon fill="#496DA2" points="8.984,14.184 13.899,11.202 14.003,8.827 8.95,11.244 "/>
+<polygon fill="#CEE1EF" points="14.107,2.749 6.79,1.816 1.892,3.293 9.003,4.567 "/>
+<polygon fill="#496DA2" points="9.033,4.561 4.055,8.145 4.04,9.613 8.88,10.725 12.415,8.988 12.415,8.729 13.961,7.978 14.086,2.749 "/>
+<polygon fill="#A2C2DD" points="9.067,10.355 2.205,8.687 1.892,3.293 9.045,4.562 "/>
+<polygon fill="#496DA2" points="8.072,9.375 2.924,8.12 2.654,4.211 8.016,5.179 "/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_connected.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16px" version="1.1" viewBox="0.054 -0.014 16 16" width="16px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<rect fill="none" height="16" width="16"/>
+<path d="M1.172,8.063c0-2.249,0.572-4.364,1.578-6.209H1.739C0.817,3.696,0.295,5.774,0.295,7.976 c0,2.424,0.633,4.702,1.739,6.678h0.935C1.829,12.72,1.172,10.468,1.172,8.063z" fill="#6695BD"/>
+<path d="M14.833,8.063c0-2.249-0.572-4.364-1.578-6.209h1.012c0.922,1.843,1.443,3.921,1.443,6.122 c0,2.424-0.633,4.702-1.738,6.678h-0.936C14.177,12.72,14.833,10.468,14.833,8.063z" fill="#6695BD"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_headset.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<linearGradient id="_5" gradientUnits="userSpaceOnUse" x1="8.89" y1="3.04" x2="4.1" y2="5.37">
+<stop stop-color="#CEE1EF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.5"/>
+<stop stop-color="#496DA2" offset="1"/>
+</linearGradient>
+<path d="M7.388,2.271C5.996,2.133,3.993,3.315,3.9,6.61l1.165,0.2 c0.074-1.4,1.086-3.7,2.424-3.842c0.396-0.044,1.014-0.077,1.606,0.407C9.096,3.375,8.878,2.419,7.388,2.271z" fill="url(#_5)"/>
+<path d="M6.325,9.855c-0.105,1.563-1.071,2.572-2.162,2.256 c-1.087-0.319-1.891-1.846-1.787-3.407c0.105-1.56,1.071-2.571,2.162-2.252C5.628,6.77,6.427,8.296,6.325,9.855z" fill="#496DA2"/>
+<linearGradient id="_6" gradientUnits="userSpaceOnUse" x1="5.01" y1="4.9" x2="3.62" y2="11.27">
+<stop stop-color="#CEE1EF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.5"/>
+<stop stop-color="#496DA2" offset="1"/>
+</linearGradient>
+<path d="M3.545,6.363C3.118,6.538,2.438,7.604,2.367,8.65 c-0.104,1.563,0.709,3.141,1.796,3.46c0.423,0.122,0.825,0.047,1.168-0.182c-1.495,0.54-3.472-3.269-1.259-5.402L3.545,6.363z" fill="url(#_6)"/>
+<path d="M12.615,8.292c-0.212-3.181-1.057-5.533-3.243-6.413 C7.998,1.326,6.809,1.539,5.5,2.366c0,0,1.481-0.373,2.437-0.045c1.961,0.672,2.93,3.877,3.021,5.705 c-0.668,0.23-1.295,0.824-1.688,1.72c-0.703,1.619-0.383,3.564,0.722,4.343c1.102,0.78,2.569,0.104,3.276-1.515 C13.958,10.991,13.657,9.102,12.615,8.292z" fill="#A2C2DD"/>
+<linearGradient id="_7" gradientUnits="userSpaceOnUse" x1="10.61" y1="8.66" x2="10.52" y2="14.3">
+<stop stop-color="#CEE1EF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.5"/>
+<stop stop-color="#496DA2" offset="1"/>
+</linearGradient>
+<path d="M12.181,14.006c-0.686,0.482-1.489,0.592-2.158,0.118 c-1.104-0.779-1.456-2.76-0.753-4.378c0.354-0.808,0.931-1.393,1.523-1.667l0.577,0.361 C9.335,10.192,9.704,14.871,12.181,14.006z" fill="url(#_7)"/>
+<linearGradient id="_8" gradientUnits="userSpaceOnUse" x1="5.35" y1="3.41" x2="9.4" y2="7.91">
+<stop stop-color="#CEE1EF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<path d="M11.363,8.481c-0.188-2.877-1.328-5.8-3.257-6.345 C5.426,1.375,3.948,3.083,3.545,6.363l0.527,0.163c0.17-2.525,1.301-4.599,3.794-3.947c1.692,0.443,2.449,3.271,2.676,5.685 L11.363,8.481z" fill="url(#_8)"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_keyboard.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16px" version="1.1" viewBox="-0.136 0.042 16 16" width="16px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<rect fill="none" height="16" width="16"/>
+<polygon fill="#CEE1EF" points="6.074,6.093 13.66,7.63 12.829,8.118 5.254,6.401 "/>
+<polygon fill="#496DA2" points="9.594,12.813 9.579,11.876 12.829,8.118 13.647,7.594 13.572,9.055 "/>
+<polygon fill="#A2C2DD" points="12.829,8.118 5.254,6.401 1.803,9.365 9.579,11.876 "/>
+<polygon fill="#6695BD" points="9.579,11.876 1.803,9.365 1.867,9.922 9.594,12.813 "/>
+<polygon fill="#496DA2" points="5.898,6.707 5.976,7.194 5.337,7.822 5.257,7.338 "/>
+<polygon fill="#6695BD" points="5.257,7.338 5.341,7.827 4.413,7.575 4.328,7.091 "/>
+<polygon fill="#E1EBF4" points="5.898,6.707 5.257,7.338 4.328,7.091 4.997,6.509 "/>
+<polygon fill="#496DA2" points="7.24,7.044 7.318,7.532 6.679,8.16 6.599,7.676 "/>
+<polygon fill="#6695BD" points="6.599,7.676 6.683,8.165 5.755,7.912 5.67,7.429 "/>
+<polygon fill="#E1EBF4" points="7.24,7.044 6.599,7.676 5.67,7.429 6.327,6.814 "/>
+<polygon fill="#496DA2" points="8.649,7.428 8.727,7.916 8.088,8.544 8.008,8.061 "/>
+<polygon fill="#6695BD" points="8.008,8.061 8.092,8.549 7.164,8.296 7.079,7.813 "/>
+<polygon fill="#E1EBF4" points="8.649,7.428 8.008,8.061 7.079,7.813 7.736,7.199 "/>
+<polygon fill="#496DA2" points="10.118,7.817 10.196,8.305 9.557,8.932 9.477,8.449 "/>
+<polygon fill="#6695BD" points="9.477,8.449 9.561,8.938 8.633,8.685 8.547,8.201 "/>
+<polygon fill="#E1EBF4" points="10.118,7.817 9.477,8.449 8.547,8.201 9.206,7.588 "/>
+<polygon fill="#496DA2" points="11.666,8.188 11.746,8.688 11.091,9.331 11.01,8.835 "/>
+<polygon fill="#6695BD" points="11.01,8.835 11.096,9.336 10.145,9.078 10.058,8.583 "/>
+<polygon fill="#E1EBF4" points="11.666,8.188 11.01,8.835 10.058,8.583 10.731,7.954 "/>
+<polygon fill="#496DA2" points="4.943,7.632 5.021,8.119 4.383,8.748 4.303,8.264 "/>
+<polygon fill="#6695BD" points="4.303,8.264 4.387,8.752 3.459,8.5 3.374,8.016 "/>
+<polygon fill="#E1EBF4" points="4.943,7.632 4.303,8.264 3.374,8.016 4.031,7.402 "/>
+<polygon fill="#496DA2" points="3.935,8.55 4.013,9.038 3.374,9.667 3.294,9.182 "/>
+<polygon fill="#6695BD" points="3.294,9.182 3.378,9.671 2.45,9.418 2.365,8.935 "/>
+<polygon fill="#E1EBF4" points="3.935,8.55 3.294,9.182 2.365,8.935 3.021,8.321 "/>
+<polygon fill="#496DA2" points="9.622,10.197 9.706,10.719 9.02,11.393 8.934,10.875 "/>
+<polygon fill="#6695BD" points="8.934,10.875 9.024,11.399 8.029,11.127 7.938,10.609 "/>
+<polygon fill="#E1EBF4" points="9.622,10.197 8.934,10.875 7.938,10.609 8.642,9.951 "/>
+<polygon fill="#496DA2" points="7.983,9.79 8.061,10.277 7.422,10.905 7.342,10.421 "/>
+<polygon fill="#6695BD" points="7.338,10.411 7.422,10.9 3.717,9.749 3.645,9.299 "/>
+<polygon fill="#E1EBF4" points="7.987,9.784 7.346,10.417 3.631,9.299 4.288,8.686 "/>
+<polygon fill="#496DA2" points="6.234,7.96 6.312,8.448 5.673,9.077 5.593,8.592 "/>
+<polygon fill="#6695BD" points="5.593,8.592 5.677,9.082 4.75,8.829 4.664,8.345 "/>
+<polygon fill="#E1EBF4" points="6.234,7.96 5.593,8.592 4.664,8.345 5.321,7.731 "/>
+<polygon fill="#496DA2" points="7.627,8.325 7.705,8.813 7.066,9.44 6.986,8.958 "/>
+<polygon fill="#6695BD" points="6.986,8.958 7.071,9.446 6.143,9.194 6.057,8.709 "/>
+<polygon fill="#E1EBF4" points="7.627,8.325 6.986,8.958 6.057,8.709 6.714,8.096 "/>
+<polygon fill="#496DA2" points="9.112,8.75 9.19,9.237 8.551,9.866 8.471,9.381 "/>
+<polygon fill="#6695BD" points="8.471,9.381 8.555,9.87 7.627,9.618 7.542,9.134 "/>
+<polygon fill="#E1EBF4" points="9.112,8.75 8.471,9.381 7.542,9.134 8.199,8.52 "/>
+<polygon fill="#496DA2" points="10.688,9.131 10.769,9.634 10.111,10.282 10.028,9.783 "/>
+<polygon fill="#6695BD" points="10.028,9.783 10.116,10.287 9.159,10.026 9.071,9.528 "/>
+<polygon fill="#E1EBF4" points="10.688,9.131 10.028,9.783 9.071,9.528 9.749,8.895 "/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_misc.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<path d="M12.527,10.281c0.349-0.349,1.455-1.455,1.455-1.455l-2.545-2.545v3.013l-1.169-1.169 l-0.5,0.5c0,0,1.269,1.269,1.669,1.669v0.025c-0.4,0.4-1.669,1.669-1.669,1.669l0.5,0.5l1.169-1.169v2.962l2.545-2.545 C13.982,11.736,12.876,10.63,12.527,10.281z M12.982,8.827c-0.167,0.167-0.508,0.508-0.818,0.818V8.008 C12.473,8.318,12.802,8.647,12.982,8.827z M12.164,12.554v-1.637c0.31,0.31,0.651,0.651,0.818,0.818 C12.802,11.916,12.473,12.245,12.164,12.554z" fill="#496DA2"/>
+<path d="M4.777,10.281c0.349-0.349,1.455-1.455,1.455-1.455L3.687,6.281v3.013L2.518,8.125 l-0.5,0.5c0,0,1.269,1.269,1.669,1.669v0.025c-0.4,0.4-1.669,1.669-1.669,1.669l0.5,0.5l1.169-1.169v2.962l2.545-2.545 C6.232,11.736,5.126,10.63,4.777,10.281z M5.232,8.827C5.064,8.994,4.724,9.335,4.414,9.645V8.008 C4.723,8.318,5.052,8.647,5.232,8.827z M4.414,12.554v-1.637c0.31,0.31,0.651,0.651,0.818,0.818 C5.052,11.916,4.723,12.245,4.414,12.554z" fill="#A2C2DD"/>
+<path d="M8.777,5.719c0.349-0.349,1.455-1.455,1.455-1.455L7.687,1.719v3.013L6.518,3.563 l-0.5,0.5c0,0,1.269,1.269,1.669,1.669v0.025c-0.4,0.4-1.669,1.669-1.669,1.669l0.5,0.5l1.169-1.169v2.962l2.545-2.545 C10.232,7.173,9.126,6.067,8.777,5.719z M9.232,4.264C9.064,4.432,8.724,4.772,8.414,5.083V3.446 C8.723,3.755,9.052,4.084,9.232,4.264z M8.414,7.992V6.355c0.31,0.31,0.651,0.651,0.818,0.818 C9.052,7.354,8.723,7.683,8.414,7.992z" fill="#A2C2DD"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_mouse.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16px" version="1.1" viewBox="-0.229 -0.035 16 16" width="16px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<rect fill="none" height="16" width="16"/>
+<path d="M13.5,7.189c0,0-0.349,1.197-0.888,1.922c-0.24,0.323-0.571,0.588-0.871,0.854 c-1.063,0.941-2.06,2.014-3.304,2.723c-0.981,0.559-2.318,0.605-3.391,0.301c-0.287-0.081-0.629-0.232-0.85-0.438 c-0.391-0.365-0.704-0.861-0.886-1.362c-0.199-0.552-0.263-1.1-0.256-1.665c0.011-0.961,5.899-3.915,5.899-3.915L13.5,7.189z" fill="#496DA2"/>
+<path d="M13.427,6.034c0,0,0.283,0.698,0.03,1.285c-0.151,0.351-1.001,0.653-1.798,1.124 c-0.536,0.316-1.092,0.838-1.229,1.013c-0.258,0.325-0.797,0.972-1.519,1.516c-0.815,0.613-1.845,1.112-2.588,1.182 c-1.4,0.133-2.174-0.479-2.396-0.669c-0.1-0.086-0.783-0.812-0.87-1.643C3.014,9.421,2.939,8.85,3.07,8.364 c0.182-0.672,0.597-1.209,0.597-1.209L13.427,6.034z" fill="#6695BD"/>
+<path d="M13.542,6.64c0,0-0.263,0.361-0.841,0.665c-0.579,0.303-1.473,0.549-2.104,1 c-0.665,0.477-0.634,0.747-1.325,1.41c-0.356,0.342-1.181,1.024-2.082,1.374c-0.852,0.33-1.661,0.293-2.309,0.01 c-0.646-0.283-1.044-0.531-1.33-1.064C3.066,9.132,3.134,7.83,3.735,7.104c0.956-1.155,4.641-2.781,5.79-2.767 c1.148,0.014,3.318,0.521,3.82,1.534C13.62,6.343,13.542,6.64,13.542,6.64z" fill="#E1EBF4"/>
+<path d="M11.996,7.569c0,0-2.256-1.45-2.404-1.502C9.443,6.017,7.824,4.74,7.824,4.74L7.682,4.788 c0,0,1.609,1.325,1.83,1.39c0.221,0.063,1.995,1.35,2.17,1.478C11.753,7.707,11.996,7.569,11.996,7.569z" fill="#6695BD"/>
+<path d="M12.335,5.036c0,0-0.688,0.147-1.323,0.422C10.444,5.704,9.924,6.074,9.9,6.155 c-0.05,0.172-0.375-0.144-0.375-0.144s0.82-0.505,1.379-0.744c0.558-0.239,1.191-0.348,1.191-0.348L12.335,5.036z" fill="#6695BD"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_phone.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<polygon fill="#A2C2DD" points="9.726,14.442 4.13,12.736 3.566,4.131 9.705,5.273 "/>
+<polygon fill="#CEE1EF" points="12.479,4.039 6.432,3.059 3.521,4.131 9.657,5.273 "/>
+<path d="M10.163,3.842l0.396-2.03c-0.509-0.355-1.241-0.322-1.777,0l0.301,2.119 C8.9,4.015,8.782,4.123,8.796,4.235c0.025,0.193,0.465,0.389,0.921,0.342c0.455-0.045,0.753-0.32,0.725-0.512 C10.43,3.967,10.323,3.889,10.163,3.842z" fill="#496DA2"/>
+<polygon fill="#496DA2" points="9.726,14.442 12.102,12.962 12.479,4.039 9.691,5.262 "/>
+<polygon fill="#496DA2" points="4.477,5.16 4.695,8.257 8.898,9.294 8.884,6.06 "/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_printer.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" height="16px" version="1.1" viewBox="-0.02 -0.029 16 16" width="16px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+<rect fill="none" height="16" width="16"/>
+<polygon fill="#A2C2DD" points="7.234,7.223 6.468,7.585 11.48,8.652 12.49,8.159 "/>
+<polygon fill="#CEE1EF" points="6.965,6.975 7.356,7.026 6.284,7.541 11.48,8.652 12.946,7.924 13.73,8.07 11.931,9.189 5.294,7.736 "/>
+<path d="M5.33,7.723c0,0-1.696,0.762-1.719,1.992c-0.003,0.159-0.009,0.979-0.009,0.979l6.828,2.104l1.521-3.605 L5.33,7.723z" fill="#A2C2DD"/>
+<path d="M13.73,8.07l-1.813,1.122c0,0-1.337,0.859-1.471,2.014c-0.029,0.245-0.016,1.592-0.016,1.592l3.06-1.895 L13.73,8.07z" fill="#496DA2"/>
+<polygon fill="#496DA2" points="4.642,10.733 4.617,9.733 9.344,11.03 9.343,12.137 "/>
+<polygon fill="#CEE1EF" points="13.227,4.78 8.463,4.227 7.559,7.431 11.98,8.221 "/>
+<polygon fill="#496DA2" points="13.227,4.78 11.98,8.221 12.279,8.123 13.221,5.419 "/>
+<polygon fill="#496DA2" points="6.284,7.541 6.571,7.601 7.316,7.237 7.356,7.026 "/>
+<path d="M10.338,10.145c0,0.271-0.246,0.491-0.55,0.491c-0.305,0-0.551-0.22-0.551-0.491s0.246-0.492,0.551-0.492 C10.092,9.652,10.338,9.873,10.338,10.145z" fill="#496DA2"/>
+<polygon fill="#A2C2DD" points="2.774,11.087 6.922,12.496 6.911,12.852 2.781,11.37 "/>
+<polygon fill="#CEE1EF" points="5.157,10.141 2.773,11.087 6.914,12.491 9.09,11.25 "/>
+<polygon fill="#496DA2" points="6.914,12.491 9.092,11.255 9.048,11.602 6.911,12.852 "/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btcpplugin/icons/qgn_prop_bt_unknown.svg Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg width="16" height="16" viewBox="0 0 16 16">
+<linearGradient id="_2" gradientUnits="userSpaceOnUse" x1="7.27" y1="4.59" x2="11.38" y2="9.5">
+<stop stop-color="#B3DDFF" offset="0"/>
+<stop stop-color="#5AA7E0" offset="0.5"/>
+<stop stop-color="#0046B7" offset="1"/>
+</linearGradient>
+<path fill="url(#_2)" d="M4.252,3.612l1.564-0.828C5.807,2.79,7.711,2.017,9.338,2.44 c1.574,0.409,2.516,1.266,3.422,2.664s1.119,3.848,0.52,5.15c-0.6,1.306-1,1.61-1.438,2.024l-2.045,1.479 c1.652-2.877,1.313-6.031,0.301-7.431C9.084,4.931,6.982,3.093,4.252,3.612z"/>
+<circle fill="#B3DDFF" cx="6.872" cy="8.774" r="5.328"/>
+<path fill="#0046B7" d="M6.982,13.864c0.629,0.137,1.115-0.256,1.115-0.828c0-0.611-0.486-1.173-1.115-1.287 c-0.617-0.117-1.102,0.26-1.102,0.839C5.881,13.144,6.381,13.733,6.982,13.864z"/>
+<path fill="#0046B7" d="M7.867,10.915c0-1.08-0.549-1.78-1.311-2.564C6.113,7.903,5.682,7.513,5.682,6.899 c0-0.701,0.613-1.252,1.361-1.177c0.865,0.083,1.428,0.786,1.441,1.606l1.691,0.184c0.025-1.767-1.352-3.293-3.146-3.421 C5.377,3.96,3.965,5.118,3.965,6.642c0,1.988,1.979,2.213,2.252,3.988L7.867,10.915z"/>
+<rect x="9.707" y="1.619" fill="#0046B7" width="1.4" height="2.436"/>
+<rect x="11.859" y="3.502" fill="#0046B7" width="2.429" height="1.4"/>
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btui.pro Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+
+TEMPLATE = subdirs
+
+# Directories
+SUBDIRS += btuimodel \
+btuidelegate \
+btcpplugin \
+tsrc
+
+CONFIG += ordered
+
+symbian: {
+
+ BLD_INF_RULES.prj_exports += \
+ "$${LITERAL_HASH}include<platform_paths.hrh>" \
+ "rom/btui.iby CORE_MW_LAYER_IBY_EXPORT_PATH(btui.iby)"
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btabstractdelegate.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "btabstractdelegate.h"
+#include "btuimodel.h"
+
+/*!
+ Constructor.
+ */
+BtAbstractDelegate::BtAbstractDelegate( BtuiModel& model, QObject *parent )
+ : QObject( parent ), mModel(model)
+{
+}
+
+/*!
+ Destructor.
+ */
+BtAbstractDelegate::~BtAbstractDelegate()
+{
+}
+
+BtuiModel &BtAbstractDelegate::model()
+{
+ return mModel;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btabstractdelegate.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTABSTRACTDELEGATE_H
+#define BTABSTRACTDELEGATE_H
+
+#include <QObject>
+#include <QVariant>
+
+class BtuiModel;
+
+#ifdef BUILD_BTUIDELEGATE
+#define BTUIDELEGATE_IMEXPORT Q_DECL_EXPORT
+#else
+#define BTUIDELEGATE_IMEXPORT Q_DECL_IMPORT
+#endif
+
+
+/*!
+ \class BtAbstractDelegate
+ \brief the base class for handling user requests from BT application.
+
+
+ \\sa btuidelegate
+ */
+class BTUIDELEGATE_IMEXPORT BtAbstractDelegate : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit BtAbstractDelegate( BtuiModel& model, QObject *parent = 0 );
+
+ virtual ~BtAbstractDelegate();
+
+ virtual void exec( const QVariant ¶ms ) = 0;
+
+signals:
+ void commandCompleted(int status, QVariant params = QVariant() );
+
+protected:
+
+ BtuiModel &model();
+
+public slots:
+
+private:
+
+ BtuiModel& mModel;
+
+ Q_DISABLE_COPY(BtAbstractDelegate)
+
+};
+
+#endif // BTABSTRACTDELEGATE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegateconsts.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTDELEGATECONSTS_H
+#define BTDELEGATECONSTS_H
+
+#include <QObject>
+
+namespace BtDelegate
+ {
+ enum Command
+ {
+ Undefined,
+ ManagePower,
+ DeviceName,
+ Visibility,
+ };
+ }
+
+#endif // BTDELEGATECONSTS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatedevname.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "btdelegatedevname.h"
+#include "btuimodel.h"
+#include <bluetoothuitrace.h>
+#include <QRegExp>
+
+BtDelegateDevName::BtDelegateDevName( BtuiModel& model, QObject *parent ) :
+ BtAbstractDelegate( model, parent )
+{
+ TRAP_IGNORE( mBtEngSettings = CBTEngSettings::NewL() );
+ Q_CHECK_PTR( mBtEngSettings );
+
+}
+
+BtDelegateDevName::~BtDelegateDevName()
+{
+ delete mBtEngSettings;
+}
+
+/*!
+ Validate the bluetooth device name given by the user:
+ Extra spaces (' ', '\n', '\t' and '\r') from the beginning,
+ middle and the end of the name are always removed;
+ the maximum lengthof a name is 30.
+ */
+bool BtDelegateDevName::validateName(QString &name )
+{
+ // remove spaces at the beginning and end:
+ name = name.trimmed();
+ // regular expression of one or more consecutive spaces:
+ QRegExp rx("[ \n\t\r]+");
+ name.replace( rx, " ");
+ if (name.length() > 30 ) {
+ name.resize( 30 );
+ }
+ return name.length() > 0;
+}
+
+void BtDelegateDevName::exec( const QVariant ¶ms )
+{
+ int error = KErrNone;
+ QString btDevName = params.toString();
+
+ validateName(btDevName);
+
+ TPtrC ptrName(reinterpret_cast<const TText*>(btDevName.constData()));
+
+ RBuf16 btName;
+ error = btName.Create(ptrName.Length());
+
+ if(error == KErrNone) {
+ btName.Copy(ptrName);
+ error = mBtEngSettings->SetLocalName(btName);
+ btName.Close();
+ }
+
+ emit commandCompleted(error, btDevName);
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatedevname.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTDELEGATEDEVNAME_H
+#define BTDELEGATEDEVNAME_H
+
+#include <e32base.h>
+#include <btengsettings.h>
+#include "btabstractdelegate.h"
+
+class BtuiModel;
+
+/*!
+ \class BtDelegateDevName
+ \brief the base class for handling Bluetooth Local Name.
+ */
+class BtDelegateDevName : public BtAbstractDelegate
+{
+ Q_OBJECT
+
+public:
+ explicit BtDelegateDevName( BtuiModel& model, QObject *parent = 0 );
+
+ virtual ~BtDelegateDevName();
+
+ virtual void exec( const QVariant ¶ms );
+
+public slots:
+
+private:
+ bool validateName(QString &name );
+
+ CBTEngSettings* mBtEngSettings;
+
+private:
+
+ Q_DISABLE_COPY(BtDelegateDevName)
+
+};
+
+#endif // BTDELEGATEDEVNAME_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatefactory.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "btdelegatefactory.h"
+#include "btdelegatepower.h"
+#include "btuimodel.h"
+#include "btdelegatedevname.h"
+#include "btdelegatevisibility.h"
+
+
+/*!
+ Constructor.
+ */
+BtAbstractDelegate * BtDelegateFactory::newDelegate(
+ BtDelegate::Command cmd, BtuiModel& model, QObject *parent )
+{
+ switch ( cmd ) {
+ case BtDelegate::ManagePower:
+ return new BtDelegatePower( model, parent );
+ case BtDelegate::DeviceName:
+ return new BtDelegateDevName( model, parent );
+ case BtDelegate::Visibility:
+ return new BtDelegateVisibility( model, parent );
+ }
+ return 0;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatefactory.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTDELEGATEFACTORY_H
+#define BTDELEGATEFACTORY_H
+
+#include <QObject>
+#include "btdelegateconsts.h"
+
+class BtAbstractDelegate;
+class BtuiModel;
+
+#ifdef BUILD_BTUIDELEGATE
+#define BTUIDELEGATE_IMEXPORT Q_DECL_EXPORT
+#else
+#define BTUIDELEGATE_IMEXPORT Q_DECL_IMPORT
+#endif
+
+/*!
+ \class BtDelegateFactory
+ \brief the base class for creating concrete delegate instances
+
+ \\sa btuidelegate
+ */
+class BTUIDELEGATE_IMEXPORT BtDelegateFactory
+{
+
+public:
+ static BtAbstractDelegate *newDelegate(
+ BtDelegate::Command cmd, BtuiModel& model, QObject *parent = 0 );
+
+};
+
+#endif // BTDELEGATEFACTORY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatepower.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "btdelegatepower.h"
+#include "btuimodel.h"
+#include <hbmessagebox.h>
+#include <bluetoothuitrace.h>
+#include <hbaction.h>
+
+/*!
+ Constructor.
+ */
+BtDelegatePower::BtDelegatePower( BtuiModel& model, QObject *parent )
+ : BtAbstractDelegate( model, parent )
+{
+ TRAP_IGNORE( mBtengSettings = CBTEngSettings::NewL(this) );
+ Q_CHECK_PTR( mBtengSettings );
+
+}
+
+/*!
+ Destructor.
+ */
+BtDelegatePower::~BtDelegatePower()
+{
+ delete mBtengSettings;
+
+}
+
+void BtDelegatePower::exec( const QVariant ¶ms )
+{
+ if (params.toInt()){//turn power OFF
+
+ switchBTOff();
+ }
+ else{//turn power ON
+
+ switchBTOn();
+ }
+}
+
+
+
+void BtDelegatePower::switchBTOn()
+{
+ int err = 0;
+
+ //check if device is in OFFLINE mode first
+ TBTEnabledInOfflineMode enabledInOffline = EBTDisabledInOfflineMode;
+ if (checkOfflineMode(enabledInOffline)){
+ //if (1){
+ if (enabledInOffline){
+ //if (1){
+ // BT is allowed to be enabled in offline mode, show query.
+ HbMessageBox::question( tr("Turn Bluetooth on in offline mode?"),this, SLOT(btOnQuestionClose(HbAction*)));
+
+ }
+ else{
+ //if BT is not allowed to be enabled in offline mode, show message and complete
+ HbMessageBox::warning(tr("Bluetooth not allowed to be turned on in offline mode"),this, SLOT(btOnWarningClose()));
+ }
+
+ }
+ else{
+ //set BT on if the not in offline mode
+ err = mBtengSettings->SetPowerState((TBTPowerStateValue)(1));
+ }
+
+ if ( err ) {
+ QString info = "Unable to switch BT power ON" ;
+ emit commandCompleted(KErrGeneral);
+ }
+
+}
+
+void BtDelegatePower::btOnQuestionClose(HbAction *action)
+{
+ HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
+ int err = 0;
+ if(action == dlg->actions().at(0))
+ {
+ //user chooses "yes" for using BT in offline
+ err = mBtengSettings->SetPowerState((TBTPowerStateValue)(1));
+ }
+ else
+ {
+ //if user chooses "NO", emits the signal
+ emit commandCompleted(KErrNone);
+
+ }
+ if ( err ) {
+ QString info = "Unable to switch BT power ON" ;
+ emit commandCompleted(KErrGeneral);
+ }
+}
+
+void BtDelegatePower::btOnWarningClose()
+{
+ emit commandCompleted(KErrNone);
+}
+
+
+
+void BtDelegatePower::switchBTOff()
+{
+ int err = 0;
+ err = mBtengSettings->SetPowerState((TBTPowerStateValue)(0));
+
+ if ( err ) {
+ QString info = "Unable to switch BT power OFF" ;
+ emit commandCompleted(KErrGeneral);
+ }
+
+}
+
+void BtDelegatePower::btOffDialogClose(HbAction *action)
+{
+ Q_UNUSED( action );
+
+}
+
+void BtDelegatePower::PowerStateChanged( TBTPowerStateValue aState )
+{
+ Q_UNUSED( aState );
+ emit commandCompleted(KErrNone);
+}
+
+//Method derived from MBTEngSettingsObserver, no need to be implemented here
+void BtDelegatePower::VisibilityModeChanged( TBTVisibilityMode aState )
+{
+ Q_UNUSED( aState );
+}
+
+bool BtDelegatePower::checkOfflineMode(TBTEnabledInOfflineMode& aEnabledInOffline)
+{
+ TCoreAppUIsNetworkConnectionAllowed offline = ECoreAppUIsNetworkConnectionAllowed;
+
+ mBtengSettings->GetOfflineModeSettings(offline, aEnabledInOffline);
+ return (!offline);
+
+}
+
+/*if (params.toBool()) { // turning power on
+
+ // find out if local device is in offline mode
+ QModelIndex idx = mModel->index( Btuim::OfflineMode, 0);
+ QVariant var = mModel->data( idx, Qt::EditRole );
+ bool offlineMode = var.toBool();
+
+ // find out whether BT is allowed in offline mode
+ var = mModel->data( idx, Btuim::SettingAdditionalParam );
+ bool activationAllowed = var.toBool();
+
+ if (offlineMode) {
+ // in offline mode
+ if (activationAllowed) {
+ HbMessageBox *messageBox = new HbMessageBox();
+ // BT is allowed to be enabled in offline mode, show query.
+ if (messageBox->question( tr("Activate Bluetooth in offline mode?") )) {
+ ret = mModel->setData(index, value, role);
+ }
+ delete messageBox;
+ }
+ else {
+ // BT is not allowed to be activated in offline mode, show note.
+
+ HbDialog *mShowOnlyPopup = new HbDialog();
+ mShowOnlyPopup->setAttribute(Qt::WA_DeleteOnClose);
+ mShowOnlyPopup->setModal(false);
+ mShowOnlyPopup->setBackgroundFaded(false);
+ mShowOnlyPopup->setDismissPolicy( HbPopup::NoDismiss );
+ mShowOnlyPopup->setTimeout( 5000 ); // 5 sec
+ HbLabel *label = new HbLabel( tr("Bluetooth is not allowed in offline mode") );
+ label->setAlignment(Qt::AlignCenter);
+ QSizeF popupSize(350,100);
+ mShowOnlyPopup->setMinimumSize(popupSize);
+ mShowOnlyPopup->setContentWidget(label);
+ mShowOnlyPopup->show();
+ }
+ }
+ else {
+ // not in offline mode, forward the request to model.
+ ret = mModel->setData(index, value, role);
+ }
+ }
+ else { // turning power off
+ // first check if existing connections
+ QModelIndex idx = mModel->index(Btuim::BtConnections, 0);
+ QVariant var = mModel->data(idx, Qt::EditRole);
+ bool ok;
+ TInt connNum = var.toInt( &ok );
+ BTUI_ASSERT_X( ok, "BtUiSettingsDelegate::setData", "wrong qvariant type");
+ if (connNum) {
+ // there is at least 1 active connection, show query.
+ HbMessageBox *messageBox = new HbMessageBox();
+ if (messageBox->question( tr("Turn Bluetooth off even though connections exist?") )) {
+ ret = mModel->setData(index, value, role);
+ }
+ delete messageBox;
+ }
+ else {
+ // no active connections exist, forward the request to model.
+ ret = mModel->setData(index, value, role);
+ }
+ }*/
+ //emit commandCompleted(err);
+ //return ret;
+ //return false;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatepower.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTDELEGATEPOWER_H
+#define BTDELEGATEPOWER_H
+
+#include <e32base.h>
+#include <btengsettings.h>
+#include "btabstractdelegate.h"
+
+class BtuiModel;
+class HbAction;
+
+/*!
+ \class BtDelegatePower
+ \brief the base class for handling Bluetooth power management.
+
+ \\sa btuidelegate
+ */
+class BtDelegatePower : public BtAbstractDelegate, public MBTEngSettingsObserver
+{
+ Q_OBJECT
+
+public:
+ explicit BtDelegatePower( BtuiModel& model, QObject *parent = 0 );
+
+ virtual ~BtDelegatePower();
+
+ virtual void exec( const QVariant ¶ms );
+
+ virtual void PowerStateChanged( TBTPowerStateValue aState );
+
+ virtual void VisibilityModeChanged( TBTVisibilityMode aState );
+
+public slots:
+ void btOnQuestionClose(HbAction *action);
+
+ void btOnWarningClose();
+
+ void btOffDialogClose(HbAction *action);
+
+private:
+ void switchBTOn();
+
+ void switchBTOff();
+
+ bool checkOfflineMode(TBTEnabledInOfflineMode& aEnabledInOffline);
+
+public slots:
+
+private:
+ CBTEngSettings* mBtengSettings;
+
+private:
+
+ Q_DISABLE_COPY(BtDelegatePower)
+
+};
+
+#endif // BTDELEGATEPOWER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatevisibility.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Delegate class for setting visibility mode
+*
+*/
+
+
+#include "btdelegatevisibility.h"
+#include "btuimodel.h"
+#include <bluetoothuitrace.h>
+#include "btqtconstants.h"
+#include <btengsettings.h>
+
+const int MAX_TEMPORARY_VISIBILITY = 60; // minutes, this value comes from the UI spec
+
+/*!
+ Constructor.
+ */
+BtDelegateVisibility::BtDelegateVisibility( BtuiModel& model, QObject *parent )
+ : BtAbstractDelegate( model, parent )
+{
+ TRAP_IGNORE( mBtengSettings = CBTEngSettings::NewL(this) );
+ Q_CHECK_PTR( mBtengSettings );
+ mOperationOngoing = false;
+}
+
+/*!
+ Destructor.
+ */
+BtDelegateVisibility::~BtDelegateVisibility()
+{
+ delete mBtengSettings;
+}
+/*!
+ * executes visibility delegate functionality, ie. calls CBTEngSettings to set the visibility mode;
+ * when operation completes, emits commandCompleted signal
+ * Parameters: Qlist<QVariant> where first item is VisibilityMode integer specifying operation;
+ * for BtTemporary a 2nd parameter is give which signifies the number of minutes to stay visible.
+ */
+void BtDelegateVisibility::exec( const QVariant ¶ms )
+{
+ int minutes, err = 0;
+
+ if (mOperationOngoing) {
+ // complete command with error
+ emit commandCompleted(KErrInUse);
+ return;
+ }
+ mOperationOngoing = true;
+
+ // read 1st parameter
+ BTUI_ASSERT_X(params.toList().at(0).isValid(), "BtDelegateVisibility::exec", "invalid parameter");
+ VisibilityMode btQtMode = (VisibilityMode)params.toList().at(0).toInt();
+ mOperation = BtEngVisibilityMode(btQtMode);
+
+ // verify that we are setting visibility to a new value, otherwise we won't get a callback
+ TBTVisibilityMode visibilityMode( EBTVisibilityModeNoScans );
+ err = mBtengSettings->GetVisibilityMode( visibilityMode );
+ if (err) {
+ mOperationOngoing = false;
+ emit commandCompleted(err);
+ return;
+ }
+ if (visibilityMode == mOperation) {
+ mOperationOngoing = false;
+ emit commandCompleted(KErrNone);
+ return;
+ }
+
+ switch (mOperation) {
+ case EBTVisibilityModeGeneral :
+ err = mBtengSettings->SetVisibilityMode(mOperation, 0);
+ break;
+ case EBTVisibilityModeHidden:
+ err = mBtengSettings->SetVisibilityMode(mOperation, 0);
+ break;
+ case EBTVisibilityModeTemporary:
+ BTUI_ASSERT_X(params.toList().at(1).isValid(), "BtDelegateVisibility::exec", "invalid time parameter");
+ minutes = params.toList().at(1).toInt();
+ BTUI_ASSERT_X(((minutes >= 0 ) && (minutes <= MAX_TEMPORARY_VISIBILITY)),
+ "BtDelegateVisibility::exec", "invalid time parameter");
+ err = mBtengSettings->SetVisibilityMode(mOperation, minutes);
+ break;
+ default:
+ // error
+ BTUI_ASSERT_X(false, "BtDelegateVisibility::exec", "invalid parameter");
+ }
+ if (err) {
+ // complete command with error
+ mOperationOngoing = false;
+ emit commandCompleted(err);
+ }
+}
+
+void BtDelegateVisibility::PowerStateChanged( TBTPowerStateValue aState )
+{
+ Q_UNUSED( aState );
+}
+
+/*!
+ * callback from BtEngine
+ * emits command complete with either:
+ * 1) KErrUnknown if something went wrong, or
+ * 2) KErrNone if everything ok
+ */
+void BtDelegateVisibility::VisibilityModeChanged( TBTVisibilityMode aState )
+{
+ if (mOperationOngoing) {
+ //Error handling has to be done, if value is not set properly.
+ mOperationOngoing = false;
+ if (mOperation == aState) {
+ emit commandCompleted(KErrNone);
+ }
+ else {
+ emit commandCompleted(KErrUnknown);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btdelegatevisibility.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTDELEGATEVISIBILITY_H
+#define BTDELEGATEVISIBILITY_H
+
+#include <e32base.h>
+#include <btengsettings.h>
+#include "btabstractdelegate.h"
+
+class BtuiModel;
+
+/*!
+ \class BtDelegateVisibility
+ \brief the base class for handling Bluetooth visibility management.
+
+ \\sa btuidelegate
+ */
+class BtDelegateVisibility : public BtAbstractDelegate, public MBTEngSettingsObserver
+{
+ Q_OBJECT
+
+public:
+ explicit BtDelegateVisibility( BtuiModel& model, QObject *parent = 0 );
+
+ virtual ~BtDelegateVisibility();
+
+ virtual void exec( const QVariant ¶ms );
+
+
+
+public slots:
+
+private:
+
+ virtual void PowerStateChanged( TBTPowerStateValue aState );
+ virtual void VisibilityModeChanged( TBTVisibilityMode aState );
+
+private:
+ CBTEngSettings* mBtengSettings;
+ bool mOperationOngoing;
+ TBTVisibilityMode mOperation;
+
+private:
+
+ Q_DISABLE_COPY(BtDelegateVisibility)
+
+};
+
+#endif // BTDELEGATEVISIBILITY_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuidelegate/btuidelegate.pro Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = lib
+TARGET = btuidelegate
+MOC_DIR = moc
+DEFINES += BUILD_BTUIDELEGATE
+INCLUDEPATH += . \
+ ../inc
+
+CONFIG += qt \
+ hb \
+ dll
+HEADERS += btdelegateconsts.h \
+ btdelegatepower.h \
+ btdelegatefactory.h \
+ btabstractdelegate.h \
+ btdelegatevisibility.h \
+ btdelegatedevname.h
+
+SOURCES += btdelegatepower.cpp \
+ btdelegatefactory.cpp \
+ btabstractdelegate.cpp \
+ btdelegatevisibility.cpp \
+ btdelegatedevname.cpp
+
+symbian: {
+ SYMBIAN_PLATFORMS = WINSCW \
+ ARMV5
+ BLD_INF_RULES.prj_exports += "btdelegatefactory.h |../inc/btdelegatefactory.h"
+ BLD_INF_RULES.prj_exports += "btabstractdelegate.h |../inc/btabstractdelegate.h"
+ BLD_INF_RULES.prj_exports += "btdelegateconsts.h |../inc/btdelegateconsts.h"
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.UID3 = 0xEE02434F
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+ LIBS += -lbtengsettings \
+ -lbtserviceutil \
+ -lbtdevice \
+ -lbtmanclient \
+ -lesock \
+ -lbluetooth \
+ -lbtengdevman \
+ -lbtengconnman \
+ -lcentralrepository \
+ -lflogger
+ //MMP_RULES -= EXPORTUNFROZEN
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/activewrapper.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* ============================================================================
+* Name : btuimsettings_p.cpp
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : Implements the data source settings class used by BluetoothUiDataModel.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include "activewrapper.h"
+
+/*!
+ Constructor.
+ */
+ActiveWrapper::ActiveWrapper( int id, int priority, QObject *parent )
+: QObject( parent ){
+ d = new ActiveWrapperPrivate( this, id, priority );
+}
+
+/*!
+ Destructor.
+ */
+ActiveWrapper::~ActiveWrapper(){
+ delete d;
+}
+
+int ActiveWrapper::getRequestId(){
+ return d->mRequestId;
+}
+
+void ActiveWrapper::setRequestId( int reqId ){
+ d->mRequestId = reqId;
+}
+
+
+void ActiveWrapper::setActive() {
+ d->SetActive();
+}
+
+void ActiveWrapper::cancel(){
+ d->Cancel();
+}
+
+bool ActiveWrapper::isActive(){
+ return (bool) d->IsActive();
+}
+
+void ActiveWrapper::emitRequestCompleted( int status, int id ) {
+ emit requestCompleted( status, id );
+}
+
+void ActiveWrapper::emitCancelRequest( int id ) {
+ emit cancelRequest( id );
+}
+
+inline void ActiveWrapper::emitError( int status, int id ) {
+ emit error( status, id );
+}
+
+/*!
+ Constructor.
+ */
+ActiveWrapperPrivate::ActiveWrapperPrivate(
+ ActiveWrapper *parent, int id, int priority )
+: CActive( (TInt) priority ),
+ q( parent ),
+ mRequestId( id ) {
+ CActiveScheduler::Add( this );
+}
+
+/*!
+ Destructor.
+ */
+ActiveWrapperPrivate::~ActiveWrapperPrivate() {
+ Cancel();
+}
+
+/*!
+ \reimp
+ Called by the active scheduler when the request has been cancelled.
+ */
+void ActiveWrapperPrivate::RunL() {
+ q->emitRequestCompleted( iStatus.Int(), mRequestId );
+}
+
+/*!
+ \reimp
+ Called by Cancel() when the request is outstanding.
+ */
+void ActiveWrapperPrivate::DoCancel() {
+ q->emitCancelRequest( mRequestId );
+}
+
+/*!
+ \reimp
+ Called by the active scheduler when an error in RunL has occurred.
+ */
+TInt ActiveWrapperPrivate::RunError( TInt error ) {
+ q->emitRequestCompleted( error, mRequestId );
+ return KErrNone;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/activewrapper.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef ACTIVEWRAPPER_H
+#define ACTIVEWRAPPER_H
+
+#include <QObject>
+#include <e32base.h>
+
+class ActiveWrapperPrivate;
+
+/*!
+ \class ActiveWrapper
+ \brief Helper class for using active objects in Qt classes.
+
+ ActiveWrapper is a helper class for using active objects
+ from any Qt class. It wraps a CActive-derived class in an interface
+ that uses Qt's signal-slot mechanism for communicating status changes
+ of the active object.
+
+ \\sa bluetoothuimodel
+ */
+class ActiveWrapper : public QObject
+{
+ Q_OBJECT
+ friend class ActiveWrapperPrivate;
+
+public:
+ explicit ActiveWrapper( int id,
+ int priority = CActive::EPriorityStandard, QObject *parent = NULL );
+ ~ActiveWrapper();
+
+ int getRequestId();
+ void setRequestId(int reqId);
+ void setActive();
+ void cancel();
+ bool isActive();
+
+signals:
+ void requestCompleted( int status, int id );
+ void cancelRequest( int id );
+ void error( int status, int id );
+
+private:
+ void emitRequestCompleted( int status, int id );
+ void emitCancelRequest( int id );
+ void emitError( int status, int id );
+
+private:
+ ActiveWrapperPrivate *d;
+
+};
+
+
+/*!
+ \class ActiveWrapperPrivate
+ \brief Private class of ActiveWrapper, for using active objects in Qt classes.
+
+ ActiveWrapperPrivate is a helper class for using active objects
+ from any Qt class. It derives from CActive and allows other classes to use
+ it for passing to asynchronous function calls through its RequestStatus method.
+
+ \\sa bluetoothuimodel
+ */
+class ActiveWrapperPrivate : public CActive
+{
+ friend class ActiveWrapper;
+
+public:
+ explicit ActiveWrapperPrivate( ActiveWrapper *parent, int id, int priority );
+ ~ActiveWrapperPrivate();
+
+private:
+ virtual void RunL();
+ virtual void DoCancel();
+ virtual TInt RunError( TInt error );
+
+private:
+ ActiveWrapper *q;
+ int mRequestId;
+};
+
+#endif // ACTIVEWRAPPER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btdevicedata.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "btdevicedata.h"
+
+/*!
+ Constructor.
+ */
+BtDeviceData::BtDeviceData(
+ const QSharedPointer<BtuiModelDataSource> &data,
+ QObject *parent)
+ : QObject( parent ), mData( data ), mBtengConnMan(0)
+{
+ TRAP_IGNORE({
+ mBtengConnMan = CBTEngConnMan::NewL( this );
+ mDeviceRepo = CBtDevRepository::NewL( );
+ });
+
+ Q_CHECK_PTR( mBtengConnMan );
+ Q_CHECK_PTR( mDeviceRepo );
+}
+
+/*!
+ Destructor.
+ */
+BtDeviceData::~BtDeviceData()
+{
+ delete mBtengConnMan;
+ delete mDeviceRepo;
+}
+
+void BtDeviceData::ConnectComplete( TBTDevAddr& addr, TInt err,
+ RBTDevAddrArray* conflicts )
+{
+ Q_UNUSED( addr );
+ Q_UNUSED( err );
+ Q_UNUSED( conflicts );
+}
+
+void BtDeviceData::DisconnectComplete( TBTDevAddr& addr, TInt err )
+{
+ Q_UNUSED( addr );
+ Q_UNUSED( err );
+}
+
+void BtDeviceData::BtDeviceDeleted( const TBTDevAddr& addr )
+{
+ Q_UNUSED( addr );
+}
+
+void BtDeviceData::BtDeviceAdded( const CBTDevice& device )
+{
+ Q_UNUSED( device );
+}
+
+void BtDeviceData::BtDeviceChanged( const CBTDevice& device, TUint similarity )
+{
+ Q_UNUSED( device );
+ Q_UNUSED( similarity );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btdevicedata.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTDEVICEDATA_H
+#define BTDEVICEDATA_H
+
+#include <qglobal.h>
+#include <e32base.h>
+#include <btengconnman.h>
+#include <btservices/btdevrepository.h>
+#include "btuimodel.h"
+
+/*!
+ \class BtDeviceData
+ \brief class for handling local Bluetooth setting updates.
+
+ BtDeviceData class is responsible for providing the latest information
+ regarding the properties of remote devices and the connection status.
+
+ \\sa bluetoothuimodel
+ */
+class BtDeviceData : public QObject,
+ public MBTEngConnObserver,
+ public MBtDevRepositoryObserver
+{
+ Q_OBJECT
+
+public:
+ BtDeviceData(
+ const QSharedPointer<BtuiModelDataSource> &data,
+ QObject *parent = 0
+ );
+
+ virtual ~BtDeviceData();
+
+private:
+ // from MBTEngConnObserver
+
+ void ConnectComplete( TBTDevAddr& addr, TInt err,
+ RBTDevAddrArray* conflicts );
+
+ void DisconnectComplete( TBTDevAddr& addr, TInt err );
+
+ // From MBtDeviceRepositoryObserver
+
+ void BtDeviceDeleted( const TBTDevAddr& addr );
+
+ void BtDeviceAdded( const CBTDevice& device );
+
+ void BtDeviceChanged( const CBTDevice& device, TUint similarity );
+
+public slots:
+ //void activeRequestCompleted( int status, int id );
+
+private:
+
+private:
+ QSharedPointer<BtuiModelDataSource> mData;
+
+ CBTEngConnMan *mBtengConnMan;
+
+ CBtDevRepository* mDeviceRepo;
+
+ Q_DISABLE_COPY(BtDeviceData)
+
+};
+
+#endif // BTLOCALSETTING_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btlocalsetting.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "btlocalsetting.h"
+#include <btdevice.h>
+//#include <QStringList>
+#include <btmanclient.h>
+#include <bt_subscribe.h>
+//#include <centralrepository.h>
+//#include <coreapplicationuissdkcrkeys.h>
+#include "btqtconstants.h"
+
+const int KLocalDeviceNameWatcher = 10;
+const int KBtLinkCountWatcher = 11;
+
+/*!
+ Constructor.
+ */
+BtLocalSetting::BtLocalSetting( BtuiModel& model, QObject *parent )
+ : QObject( parent ), mModel(model), mLocalDeviceWatcher(0)
+ {
+ int err( 0 );
+ if (!err ) {
+ err = mLocalDeviceKey.Attach( KPropertyUidBluetoothCategory,
+ KPropertyKeyBluetoothGetRegistryTableChange );
+ }
+
+ Q_CHECK_PTR( !err ); // other proper alternative?
+
+ TRAP_IGNORE({
+ mBtengSetting = CBTEngSettings::NewL( this );
+ mLocalDeviceWatcher = CBtSimpleActive::NewL(*this, KLocalDeviceNameWatcher );
+ });
+
+ Q_CHECK_PTR( mBtengSetting );
+ Q_CHECK_PTR( mLocalDeviceWatcher );
+
+ for ( int i = 0; i < BtuiModel::LocalSettingColCount; ++i ) {
+ // Initialize the list with empty values.
+ mData.append( BtuiModelDataItem() );
+ }
+
+ // subscribe to local device table change:
+ mLocalDeviceKey.Subscribe( mLocalDeviceWatcher->RequestStatus() );
+ mLocalDeviceWatcher->GoActive();
+
+ // Get the device name
+ TBTDeviceName deviceName;
+ (void) mBtengSetting->GetLocalName( deviceName );
+ updateDeviceName( QString::fromUtf16( deviceName.Ptr(), deviceName.Length() ) );
+
+ // Get the power setting.
+ TBTPowerStateValue power( EBTPowerOff );
+ (void) mBtengSetting->GetPowerState( power );
+ setPowerSetting( power );
+
+ // Get the visibility mode
+ TBTVisibilityMode visibilityMode( EBTVisibilityModeNoScans );
+ (void) mBtengSetting->GetVisibilityMode( visibilityMode );
+ setVisibilityMode( visibilityMode );
+}
+
+/*!
+ Destructor.
+ */
+BtLocalSetting::~BtLocalSetting()
+{
+ // delete main data structure
+ delete mBtengSetting;
+ delete mLocalDeviceWatcher;
+ mLocalDeviceKey.Close();
+
+ // delete mBtLinkCountWatcher;
+ //mBtLinkCountKey.Close();
+}
+
+
+bool BtLocalSetting::isValid( int column) const
+{
+ return column < mData.count();
+}
+
+int BtLocalSetting::itemCount() const
+{
+ return mData.count();
+}
+
+void BtLocalSetting::data(QVariant& val, int col, int role ) const
+{
+ if ( isValid( col ) ) {
+ val = mData.at( col ).value( role );
+ }
+ else {
+ val = QVariant( QVariant::Invalid );
+ }
+}
+
+BtuiModelDataItem BtLocalSetting::itemData( int col ) const
+{
+ if ( isValid( col ) ) {
+ return mData.at( col );
+ }
+ return BtuiModelDataItem();
+}
+
+
+/*!
+ Provides notification of changes in the power state
+ of the Bluetooth hardware.
+
+ @param state EBTPowerOff if the BT hardware has been turned off,
+ EBTPowerOn if it has been turned on.
+ */
+void BtLocalSetting::PowerStateChanged( TBTPowerStateValue state )
+{
+ setPowerSetting( state );
+ emit settingDataChanged( BtuiModel::LocalSettingRow, BtuiModel::PowerStateCol, this );
+}
+
+/*!
+ Provides notification of changes in the discoverability
+ mode of the Bluetooth hardware.
+ @param state EBTDiscModeHidden if the BT hardware is in hidden mode,
+ EBTDiscModeGeneral if it is in visible mode.
+ */
+void BtLocalSetting::VisibilityModeChanged( TBTVisibilityMode state )
+{
+ setVisibilityMode( state );
+ emit settingDataChanged( BtuiModel::LocalSettingRow, BtuiModel::VisibilityCol, this );
+}
+
+void BtLocalSetting::RequestCompletedL( CBtSimpleActive* active, TInt status ) {
+ Q_UNUSED( active );
+ Q_UNUSED( status );
+ if ( active->RequestId() == KLocalDeviceNameWatcher ) {
+ mLocalDeviceKey.Subscribe( mLocalDeviceWatcher->RequestStatus() );
+ mLocalDeviceWatcher->GoActive();
+ updateDeviceName( QString() );
+ }
+}
+
+void BtLocalSetting::CancelRequest( TInt requestId ) {
+ if ( requestId == KLocalDeviceNameWatcher ) {
+ mLocalDeviceKey.Cancel();
+ }
+ else if ( requestId == KBtLinkCountWatcher ) {
+ //mBtLinkCountKey.Cancel();
+ }
+}
+
+void BtLocalSetting::HandleError( CBtSimpleActive* active, TInt error ) {
+ Q_UNUSED( active );
+ Q_UNUSED( error );
+}
+
+/*!
+ Update local Bluetooth device name in the data store.
+ @param name the latest Bluetooth name.
+ */
+void BtLocalSetting::updateDeviceName( const QString &name )
+{
+ // To-do: the data structure initialization is not impled yet in the model
+ BtuiModelDataItem& item =
+ mData[ BtuiModel::BluetoothNameCol ];
+
+ if ( item.isEmpty() ) {
+ // Initialize with additional information on the setting
+ item[ BtuiModel::SettingIdentity ] = QVariant( tr( "Local Bluetooth name" ) );
+ }
+
+ bool setByUser = !name.isEmpty();
+
+ // The additional parameter is the flag indicating whether the
+ // Bluetooth name has been set by the user.
+ // The flag is set to true if the name has been set.
+ // requirement does not
+ //nitem[ BtuiModel::SettingValueParam ] = QVariant( setByUser );
+
+ QString resolvedName( name );
+ if ( resolvedName.isEmpty() ) {
+ // We get the default name as suggestion for the user to set.
+ getNameFromRegistry( resolvedName );
+ }
+ item[ BtuiModel::settingDisplay ] = QVariant( resolvedName );
+ item[ BtuiModel::SettingValue ] = QVariant( resolvedName );
+}
+
+/*!
+ Updates all values related to the power setting.
+ */
+void BtLocalSetting::setPowerSetting( TBTPowerStateValue state )
+{
+ BtuiModelDataItem& item =
+ mData[ BtuiModel::PowerStateCol ];
+ if ( item.isEmpty() ) {
+ // Initialize with additional information on the setting
+ item[ BtuiModel::SettingIdentity ] = QVariant( tr( "Bluetooth power" ) );
+ }
+
+ bool powerOn = ( state == EBTPowerOn );
+
+ item[ BtuiModel::settingDisplay ] =
+ powerOn ? QVariant( tr( "On" ) ) : QVariant( tr( "Off" ) );
+ item[ BtuiModel::SettingValue ] = QVariant( powerOn );
+}
+
+void BtLocalSetting::setVisibilityMode( TBTVisibilityMode state )
+{
+ BtuiModelDataItem& item = mData[ BtuiModel::VisibilityCol ];
+
+ if ( item.isEmpty() ) {
+ item[ BtuiModel::SettingIdentity ] = QVariant( tr( "Phone visibility" ) );
+ }
+
+ if ( state == EBTVisibilityModeHidden )
+ {
+ item [ BtuiModel::settingDisplay ] = QVariant( tr( "Hidden" ) );
+ }
+ else if ( state == EBTVisibilityModeGeneral )
+ {
+ item [ BtuiModel::settingDisplay ] = QVariant( tr( "Visible" ) );
+ }
+ else
+ {
+ item [ BtuiModel::settingDisplay ] = QVariant( tr( "Temporarily visible" ) );
+ }
+ item [ BtuiModel::SettingValue ] = QVariant( QtVisibilityMode(state) );
+}
+
+/*!
+ Get local Bluetooth device name from BTRegistry.
+ */
+void BtLocalSetting::getNameFromRegistry( QString &name )
+{
+ RBTRegServ btRegServ; // Session with BTMan
+ RBTLocalDevice btReg; // Subsession with local device table
+ TBTLocalDevice localDev;// Data structure holding local device information
+
+ TInt err = btRegServ.Connect();
+ if ( !err ) {
+ err = btReg.Open( btRegServ );
+ }
+ if ( !err ) {
+ // Read the BT local name from BT Registry.
+ err = btReg.Get( localDev );
+ }
+ if ( !err ) {
+ name = QString::fromUtf8( (const char*) localDev.DeviceName().Ptr(), (int) localDev.DeviceName().Length() );
+ }
+ btReg.Close();
+ btRegServ.Close();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btlocalsetting.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* ============================================================================
+* Name : btuimsettings.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : Declaration of the class representing the Bluetooth
+* settings source data.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTLOCALSETTING_H
+#define BTLOCALSETTING_H
+
+#include <qglobal.h>
+#include <e32base.h>
+#include <e32property.h>
+#include <btengsettings.h>
+#include <btservices/btsimpleactive.h>
+
+#include "btuimodel.h"
+
+/*!
+ \class BtuimSettings
+ \brief class for handling local Bluetooth setting updates.
+
+ BtLocalSetting class is responsible for providing the latest information
+ regarding the local Bluetooth settings such as device name and power state.
+
+ \\sa bluetoothuimodel
+ */
+class BtLocalSetting : public QObject,
+ public MBTEngSettingsObserver,
+ public MBtSimpleActiveObserver
+{
+ Q_OBJECT
+
+public:
+ explicit BtLocalSetting( BtuiModel& model, QObject *parent = 0 );
+
+ virtual ~BtLocalSetting();
+
+ bool isValid( int col) const;
+
+ int itemCount() const;
+
+ void data(QVariant& val, int col, int role ) const;
+
+ BtuiModelDataItem itemData( int col ) const;
+
+signals:
+
+ void settingDataChanged( int row, int column, void *parent );
+
+private:
+ // from MBTEngSettingsObserver
+
+ void PowerStateChanged( TBTPowerStateValue state );
+
+ void VisibilityModeChanged( TBTVisibilityMode state );
+
+ // from MBtSimpleActiveObserver
+
+ void RequestCompletedL( CBtSimpleActive* active, TInt status );
+
+ void CancelRequest( TInt requestId );
+
+ void HandleError( CBtSimpleActive* active, TInt error );
+
+
+
+public slots:
+ //void activeRequestCompleted( int status, int id );
+
+private:
+
+ void setVisibilityMode( TBTVisibilityMode state );
+ void updateDeviceName( const QString &name );
+
+ void setPowerSetting( TBTPowerStateValue state );
+
+ //void setOfflineSetting( bool state );
+ //void setBtConnectionsSetting( int connections );
+
+ void getNameFromRegistry( QString &name );
+
+private:
+ BtuiModelDataSource mData;
+
+ BtuiModel& mModel;
+
+ CBTEngSettings *mBtengSetting;
+
+ // For monitoring local device name change
+ RProperty mLocalDeviceKey;
+ CBtSimpleActive *mLocalDeviceWatcher;
+
+ //RProperty mBtLinkCountKey;
+ //CBTEngActive *mBtLinkCountWatcher;
+ Q_DISABLE_COPY(BtLocalSetting)
+
+};
+
+#endif // BTLOCALSETTING_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btuimodel.cpp Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "btuimodel.h"
+#include "btlocalsetting.h"
+
+/*!
+ This Constructor creates new instances of model data structure.
+ */
+BtuiModel::BtuiModel( QObject *parent )
+ : QAbstractItemModel( parent )
+{
+ mLocalSetting = QSharedPointer<BtLocalSetting>( new BtLocalSetting( *this ) );
+ bool b = connect( mLocalSetting.data(), SIGNAL(settingDataChanged(int,int,void*)), this, SLOT(btDataChanged(int,int,void*)));
+ Q_ASSERT( b );
+}
+
+/*!
+ This Constructor shares the instances of model data structure with the
+ given model.
+ */
+BtuiModel::BtuiModel( const BtuiModel &model, QObject *parent )
+ : QAbstractItemModel( parent )
+{
+ mLocalSetting = model.mLocalSetting;
+ bool b = connect( mLocalSetting.data(), SIGNAL(settingDataChanged(int,int,void*)), this, SLOT(btDataChanged(int,int,void*)));
+ Q_ASSERT( b );
+}
+
+/*!
+ Destructor.
+ */
+BtuiModel::~BtuiModel()
+{
+}
+
+/*!
+ \reimp
+ */
+QModelIndex BtuiModel::index( int row, int column, const QModelIndex &parent ) const
+{
+ Q_UNUSED( parent );
+ if ( row == LocalSettingRow
+ && mLocalSetting->isValid( column ) ) {
+ // local setting data:
+ return createIndex( row, column, mLocalSetting.data() );
+ }
+ else if ( row == RemoteDeviceRow ) {
+
+ }
+ // invalid row and column:
+ return QModelIndex();
+}
+
+/*!
+ \reimp
+ */
+QModelIndex BtuiModel::parent( const QModelIndex &child ) const
+{
+ Q_UNUSED( child );
+ // root level, no parent.
+ return QModelIndex();
+}
+
+/*!
+ \reimp
+ */
+int BtuiModel::rowCount( const QModelIndex &parent ) const
+{
+ Q_UNUSED( parent );
+ return ModelRowCount;
+}
+
+/*!
+ \reimp
+ */
+int BtuiModel::columnCount( const QModelIndex &parent ) const
+{
+ if ( parent.row() == LocalSettingRow
+ && mLocalSetting->isValid( parent.column() ) ) {
+ // local setting data:
+ return mLocalSetting->itemCount();
+ }
+ else if ( parent.row() == RemoteDeviceRow ) {
+ }
+ return 0;
+}
+
+/*!
+ \reimp
+ */
+QVariant BtuiModel::data( const QModelIndex &index, int role ) const
+{
+ QVariant val( QVariant::Invalid );
+ if ( index.row() == LocalSettingRow ) {
+ mLocalSetting.data()->data( val, index.column(), role );
+ }
+ else if ( index.row() == RemoteDeviceRow ) {
+ }
+ return val;
+}
+
+QMap<int, QVariant> BtuiModel::itemData( const QModelIndex & index ) const
+{
+ if ( index.row() == LocalSettingRow ) {
+ mLocalSetting.data()->itemData( index.column() );
+ }
+ else if ( index.row() == RemoteDeviceRow ) {
+ }
+ return QMap<int, QVariant>();
+}
+
+/*!
+ Slot for receiving notification of changes from the data source.
+ Forward the notification using dataChanged signal.
+ */
+void BtuiModel::btDataChanged( int row, int column, void *parent )
+{
+ (void) parent;
+ QModelIndex idx = createIndex( row, column, parent );
+ emit dataChanged( idx, idx );
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btuimodel.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTUIMODEL_H
+#define BTUIMODEL_H
+
+
+#include <qglobal.h>
+#include <QAbstractItemModel>
+#include <QSharedPointer>
+
+class BtLocalSetting;
+class BtDeviceStore;
+
+// A data item in this model. For example, power state item consists
+// of the information regarding the current Bluetooth power state.
+typedef QMap< int, QVariant > BtuiModelDataItem;
+
+// A category of the model data for specific group
+typedef QList< BtuiModelDataItem > BtuiModelDataSource;
+
+#ifdef BUILD_BTUIMODEL
+#define BTUIMODEL_IMEXPORT Q_DECL_EXPORT
+#else
+#define BTUIMODEL_IMEXPORT Q_DECL_IMPORT
+#endif
+
+/*!
+ \class BtuiModel
+ \brief The data model provided to Bluetooth UIs in QT
+
+ BtuiModel provides APIs for accessing certain BT data, such as local Bluetooth
+ settings and the properties of remote BT devices. In addition, signals from this
+ model are provided for being informed of data update.
+
+ This model is in two dimension (2 rows * n columns), i.e.,
+
+ row 0 (BT local setting)
+ col 0 (local device name)
+ col 1 (power state)
+ ...
+ row 1 (remote devices)
+ col 0 ( a remote device)
+ col 1 ( another device)
+ ...
+
+ The data in this model is non-modifiable from the user interface (except device
+ search may add a number of in-range devices temporarily) ,
+ determined by the characteristics of Bluetooth, the underline BT software
+ services and the BT application requirements.
+
+ Whenever feasible, the detailed description should contain a simple
+ example code example:
+ \code
+ // ...
+ \endcode
+
+ \sa \link model-view-programming.html Model/View Programming\endlink
+ */
+
+class BTUIMODEL_IMEXPORT BtuiModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ Q_ENUMS( RowId LocalSettingCol LocalSettingDataRole )
+
+public:
+
+ /**
+ * The parent row identifier of data model. Data in this model is grouped into
+ * two categories: the local Bluetooth settings and the remote device
+ * database. The data of each category is stored in multiple
+ * rows of a specified row.
+ */
+ enum RowId {
+ LocalSettingRow = 0,
+ RemoteDeviceRow = 1,
+ ModelRowCount = 2
+ };
+ //Q_DECLARE_FLAGS(Rows, BtuiModelRow)
+
+ /**
+ * child row identifiers of the local setting row
+ */
+ enum LocalSettingCol {
+ BluetoothNameCol = 0,
+ PowerStateCol ,
+ VisibilityCol,
+ SapModeCol,
+ AllowedInOfflineCol,
+ LocalSettingColCount,
+ };
+ //Q_DECLARE_FLAGS(BtuiModelLocalSettings, BtuiModelLocalSettingColumn)
+
+ /**
+ * Data roles that the items in the local setting row
+ */
+ enum LocalSettingDataRole {
+ SettingIdentity = Qt::WhatsThisRole,
+ settingDisplay = Qt::DisplayRole,
+ SettingValue = Qt::EditRole,
+ SettingValueParam = Qt::UserRole + 1, // e.g., temp visibility time
+ };
+
+public:
+
+ explicit BtuiModel( QObject *parent = 0 );
+
+ explicit BtuiModel( const BtuiModel &model, QObject *parent = 0 );
+
+ virtual ~BtuiModel();
+
+ // from QAbstractItemModel
+ virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
+
+ virtual QModelIndex parent( const QModelIndex &child ) const;
+
+ virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
+
+ virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
+
+ virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
+
+ virtual QMap<int, QVariant> itemData( const QModelIndex & index ) const;
+
+public slots:
+
+ void btDataChanged(int row, int column, void *parent );
+
+private:
+ QSharedPointer<BtLocalSetting> mLocalSetting;
+};
+
+//Q_DECLARE_OPERATORS_FOR_FLAGS(BtuiModel::Rows)
+
+Q_DECLARE_METATYPE(BtuiModelDataItem)
+Q_DECLARE_METATYPE(BtuiModelDataSource)
+
+#endif // BTUIMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btuimodel.pro Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE = lib
+TARGET = btuimodel
+
+MOC_DIR = moc
+DEFINES += BUILD_BTUIMODEL
+
+INCLUDEPATH += . \
+ ../inc
+
+CONFIG += qt \
+ hb \
+ dll
+
+HEADERS += btdevicedata.h \
+ btlocalsetting.h \
+ btuimodel.h \
+ activewrapper.h
+SOURCES += btdevicedata.cpp \
+ btlocalsetting.cpp \
+ btuimodel.cpp \
+ activewrapper.cpp
+
+symbian: {
+ SYMBIAN_PLATFORMS = WINSCW \
+ ARMV5
+ BLD_INF_RULES.prj_exports += "btuimodel.h |../inc/btuimodel.h"
+
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.UID3 = 0x2002434F
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+
+ LIBS += -lbtengsettings \
+ -lbtserviceutil \
+ -lbtdevice \
+ -lbtmanclient \
+ -lesock \
+ -lbluetooth \
+ -lbtengdevman \
+ -lbtengconnman \
+ -lcentralrepository \
+ -lflogger
+ //MMP_RULES -= EXPORTUNFROZEN
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/btuimodel/btuimodelutil.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,174 @@
+/*
+* ============================================================================
+* Name : btuimutil.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : utilities in the model for some often used functions,
+* e.g. conversions between Qt and Symbian types.
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BTUIMODELUTIL_H
+#define BTUIMODELUTIL_H
+
+#include <qglobal.h>
+#include <bt_sock.h>
+
+_LIT(KDefaultBTDevName, "Bluetooth Device" );
+
+/*!
+ Converts a QString which contains a BT device address in readable format to
+ Symbian native TBTDevAddr type.
+ */
+inline void addrReadbleStringToSymbian( const QString &readable, TBTDevAddr &addr)
+{
+ TBuf<KBTDevAddrSize * 2> buffer(readable.utf16());
+ addr.SetReadable( buffer );
+}
+
+/*!
+ Converts a Symbian native TBTDevAddr to
+ QString which contains the BT device address in readable format.
+ */
+inline void addrSymbianToReadbleString( QString &readable, const TBTDevAddr &addr)
+{
+ TBuf<KBTDevAddrSize * 2> buffer;
+ addr.GetReadable( buffer );
+ readable = QString::fromUtf16( buffer.Ptr(), buffer.Length() );
+}
+
+/*!
+ Decide the device name to display from the device information, and
+ converts the name if necessary. If the device doesn't have a valid name,
+ the given default name will be used.
+*/
+inline void getDeviceDisplayName( QString& dispName, const CBTDevice& device ,
+ const TDesC& defaultName )
+{
+ // friendly name is preferred if available
+ if( device.IsValidFriendlyName() && device.FriendlyName().Length()){
+ dispName = QString::fromUtf16(
+ device.FriendlyName().Ptr(), device.FriendlyName().Length() );
+ }
+ // next preferred is actual device name
+ else if( device.IsValidDeviceName() && device.DeviceName().Length() ) {
+ dispName = QString::fromUtf8(
+ (char*) device.DeviceName().Ptr(), device.DeviceName().Length() );
+ }
+ else {
+ // finally, use default name if nothing else is available
+ dispName = QString::fromUtf16(
+ defaultName.Ptr(), defaultName.Length() );
+ }
+}
+
+/*!
+ Decide the device name to display from the device information, and
+ converts the name if necessary. If the device doesn't have a valid name,
+ the given default name will be used.
+*/
+inline void getDeviceDisplayName( QString& dispName, const CBTDevice& device )
+{
+ getDeviceDisplayName( dispName, device, KDefaultBTDevName );
+}
+
+
+/*!
+ Guess if the given Class of Device indicates an Audio/Video device (headset and carkit)
+ or not.
+ Computer device supporting audio is not considered as AV device.
+*/
+inline bool isAVDevice( const TBTDeviceClass &cod )
+{
+ int majorDevCls = cod.MajorDeviceClass();
+ int minorDevCls = cod.MinorDeviceClass();
+ return ( ( majorDevCls == EMajorDeviceAV )
+ || ( cod.MajorServiceClass() == EMajorServiceRendering
+ && majorDevCls != EMajorDeviceImaging ) );
+}
+
+/*!
+ Guess if the given Class of Device indicates an input device (keyboard and mouse)
+ or not.
+*/
+inline bool isHIDDevice( const TBTDeviceClass &cod )
+{
+ int majorDevCls = cod.MajorDeviceClass();
+ int minorDevCls = cod.MinorDeviceClass();
+ return ( ( majorDevCls == EMajorDevicePeripheral ) &&
+ ( minorDevCls == EMinorDevicePeripheralKeyboard ||
+ minorDevCls == EMinorDevicePeripheralPointer ) );
+}
+
+/*!
+ Tells if the given device has been paired.
+*/
+inline bool isPaired( const CBTDevice &dev )
+{
+ return dev.IsValidPaired() && dev.IsPaired() &&
+ dev.LinkKeyType() != ELinkKeyUnauthenticatedUpgradable;
+}
+
+/*!
+ Tells if the given device supports file transfer.
+*/
+inline bool supportsFileTransfer( const TBTDeviceClass &cod )
+{
+ int majorDevCls = cod.MajorDeviceClass();
+ return ( majorDevCls == EMajorDevicePhone
+ || majorDevCls == EMajorDeviceComputer );
+}
+
+/*!
+ Tells if the given device is currently connected.
+*/
+inline bool isConnected( CBTEngConnMan &btConnMan,
+ const TBTDevAddr &addr )
+{
+ TBTEngConnectionStatus connectStatus( EBTEngNotConnected );
+ btConnMan.IsConnected( addr, connectStatus );
+ return connectStatus == EBTEngConnected;
+}
+
+/*!
+ Tells if the given device is currently connected.
+*/
+inline bool isConnected( CBTEngConnMan &btConnMan,
+ const CBTDevice &dev )
+{
+ return isConnected( btConnMan, dev.BDAddr() );
+}
+
+/*!
+ Tells if the given device is connectible with services managed by bteng.
+*/
+inline bool isConnectible( CBTEngConnMan &btConnMan,
+ const TBTDeviceClass &devClass )
+{
+ TBool connectible( false );
+ btConnMan.IsConnectable( devClass, connectible );
+ return connectible;
+}
+
+/*!
+ Tells if the given device is connectible with services managed by bteng.
+*/
+inline bool isConnectible( CBTEngConnMan &btConnMan,
+ const CBTDevice &dev )
+{
+ return isConnectible( btConnMan, dev.DeviceClass() );
+}
+#endif // BTUIMODELUTIL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/bwins/btuidelegateu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,17 @@
+EXPORTS
+ ?staticMetaObject@BtAbstractDelegate@@2UQMetaObject@@B @ 1 NONAME ; struct QMetaObject const BtAbstractDelegate::staticMetaObject
+ ?qt_metacall@BtAbstractDelegate@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 2 NONAME ; int BtAbstractDelegate::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?newDelegate@BtDelegateFactory@@SAPAVBtAbstractDelegate@@W4Command@BtDelegate@@AAVBtuiModel@@PAVQObject@@@Z @ 3 NONAME ; class BtAbstractDelegate * BtDelegateFactory::newDelegate(enum BtDelegate::Command, class BtuiModel &, class QObject *)
+ ??_EBtAbstractDelegate@@UAE@I@Z @ 4 NONAME ; BtAbstractDelegate::~BtAbstractDelegate(unsigned int)
+ ??1BtAbstractDelegate@@UAE@XZ @ 5 NONAME ; BtAbstractDelegate::~BtAbstractDelegate(void)
+ ?metaObject@BtAbstractDelegate@@UBEPBUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const * BtAbstractDelegate::metaObject(void) const
+ ?tr@BtAbstractDelegate@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString BtAbstractDelegate::tr(char const *, char const *, int)
+ ?commandCompleted@BtAbstractDelegate@@IAEXHVQVariant@@@Z @ 8 NONAME ; void BtAbstractDelegate::commandCompleted(int, class QVariant)
+ ?tr@BtAbstractDelegate@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString BtAbstractDelegate::tr(char const *, char const *)
+ ??0BtAbstractDelegate@@QAE@AAVBtuiModel@@PAVQObject@@@Z @ 10 NONAME ; BtAbstractDelegate::BtAbstractDelegate(class BtuiModel &, class QObject *)
+ ?getStaticMetaObject@BtAbstractDelegate@@SAABUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const & BtAbstractDelegate::getStaticMetaObject(void)
+ ?qt_metacast@BtAbstractDelegate@@UAEPAXPBD@Z @ 12 NONAME ; void * BtAbstractDelegate::qt_metacast(char const *)
+ ?model@BtAbstractDelegate@@IAEAAVBtuiModel@@XZ @ 13 NONAME ; class BtuiModel & BtAbstractDelegate::model(void)
+ ?trUtf8@BtAbstractDelegate@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString BtAbstractDelegate::trUtf8(char const *, char const *)
+ ?trUtf8@BtAbstractDelegate@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString BtAbstractDelegate::trUtf8(char const *, char const *, int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/bwins/btuimodelu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,22 @@
+EXPORTS
+ ??0BtuiModel@@QAE@PAVQObject@@@Z @ 1 NONAME ; BtuiModel::BtuiModel(class QObject *)
+ ?tr@BtuiModel@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString BtuiModel::tr(char const *, char const *)
+ ?qt_metacall@BtuiModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 3 NONAME ; int BtuiModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?itemData@BtuiModel@@UBE?AV?$QMap@HVQVariant@@@@ABVQModelIndex@@@Z @ 4 NONAME ; class QMap<int, class QVariant> BtuiModel::itemData(class QModelIndex const &) const
+ ?qt_metacast@BtuiModel@@UAEPAXPBD@Z @ 5 NONAME ; void * BtuiModel::qt_metacast(char const *)
+ ?getStaticMetaObject@BtuiModel@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & BtuiModel::getStaticMetaObject(void)
+ ??1BtuiModel@@UAE@XZ @ 7 NONAME ; BtuiModel::~BtuiModel(void)
+ ?parent@BtuiModel@@UBE?AVQModelIndex@@ABV2@@Z @ 8 NONAME ; class QModelIndex BtuiModel::parent(class QModelIndex const &) const
+ ?btDataChanged@BtuiModel@@QAEXHHPAX@Z @ 9 NONAME ; void BtuiModel::btDataChanged(int, int, void *)
+ ?trUtf8@BtuiModel@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString BtuiModel::trUtf8(char const *, char const *)
+ ?metaObject@BtuiModel@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * BtuiModel::metaObject(void) const
+ ?data@BtuiModel@@UBE?AVQVariant@@ABVQModelIndex@@H@Z @ 12 NONAME ; class QVariant BtuiModel::data(class QModelIndex const &, int) const
+ ?columnCount@BtuiModel@@UBEHABVQModelIndex@@@Z @ 13 NONAME ; int BtuiModel::columnCount(class QModelIndex const &) const
+ ??_EBtuiModel@@UAE@I@Z @ 14 NONAME ; BtuiModel::~BtuiModel(unsigned int)
+ ?trUtf8@BtuiModel@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString BtuiModel::trUtf8(char const *, char const *, int)
+ ?index@BtuiModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 16 NONAME ; class QModelIndex BtuiModel::index(int, int, class QModelIndex const &) const
+ ?staticMetaObject@BtuiModel@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const BtuiModel::staticMetaObject
+ ??0BtuiModel@@QAE@ABV0@PAVQObject@@@Z @ 18 NONAME ; BtuiModel::BtuiModel(class BtuiModel const &, class QObject *)
+ ?rowCount@BtuiModel@@UBEHABVQModelIndex@@@Z @ 19 NONAME ; int BtuiModel::rowCount(class QModelIndex const &) const
+ ?tr@BtuiModel@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString BtuiModel::tr(char const *, char const *, int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/eabi/btuidelegateu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,16 @@
+EXPORTS
+ _ZN17BtDelegateFactory11newDelegateEN10BtDelegate7CommandER9BtuiModelP7QObject @ 1 NONAME
+ _ZN18BtAbstractDelegate11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+ _ZN18BtAbstractDelegate11qt_metacastEPKc @ 3 NONAME
+ _ZN18BtAbstractDelegate16commandCompletedEi8QVariant @ 4 NONAME
+ _ZN18BtAbstractDelegate16staticMetaObjectE @ 5 NONAME DATA 16
+ _ZN18BtAbstractDelegate19getStaticMetaObjectEv @ 6 NONAME
+ _ZN18BtAbstractDelegate5modelEv @ 7 NONAME
+ _ZN18BtAbstractDelegateC2ER9BtuiModelP7QObject @ 8 NONAME
+ _ZN18BtAbstractDelegateD0Ev @ 9 NONAME
+ _ZN18BtAbstractDelegateD1Ev @ 10 NONAME
+ _ZN18BtAbstractDelegateD2Ev @ 11 NONAME
+ _ZNK18BtAbstractDelegate10metaObjectEv @ 12 NONAME
+ _ZTI18BtAbstractDelegate @ 13 NONAME
+ _ZTV18BtAbstractDelegate @ 14 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/eabi/btuimodelu.def Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,23 @@
+EXPORTS
+ _ZN9BtuiModel11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
+ _ZN9BtuiModel11qt_metacastEPKc @ 2 NONAME
+ _ZN9BtuiModel13btDataChangedEiiPv @ 3 NONAME
+ _ZN9BtuiModel16staticMetaObjectE @ 4 NONAME DATA 16
+ _ZN9BtuiModel19getStaticMetaObjectEv @ 5 NONAME
+ _ZN9BtuiModelC1EP7QObject @ 6 NONAME
+ _ZN9BtuiModelC1ERKS_P7QObject @ 7 NONAME
+ _ZN9BtuiModelC2EP7QObject @ 8 NONAME
+ _ZN9BtuiModelC2ERKS_P7QObject @ 9 NONAME
+ _ZN9BtuiModelD0Ev @ 10 NONAME
+ _ZN9BtuiModelD1Ev @ 11 NONAME
+ _ZN9BtuiModelD2Ev @ 12 NONAME
+ _ZNK9BtuiModel10metaObjectEv @ 13 NONAME
+ _ZNK9BtuiModel11columnCountERK11QModelIndex @ 14 NONAME
+ _ZNK9BtuiModel4dataERK11QModelIndexi @ 15 NONAME
+ _ZNK9BtuiModel5indexEiiRK11QModelIndex @ 16 NONAME
+ _ZNK9BtuiModel6parentERK11QModelIndex @ 17 NONAME
+ _ZNK9BtuiModel8itemDataERK11QModelIndex @ 18 NONAME
+ _ZNK9BtuiModel8rowCountERK11QModelIndex @ 19 NONAME
+ _ZTI9BtuiModel @ 20 NONAME
+ _ZTV9BtuiModel @ 21 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/inc/bluetoothtrace.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,455 @@
+/*
+* ============================================================================
+* Name : bluetoothtrace.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : API declaration of run-time debug tracing
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BLUETOOTHTRACE_H
+#define BLUETOOTHTRACE_H
+
+#include <e32base.h>
+#include "traceconfig.h"
+
+/*
+ * Common tracing utility definition to be used by Bluetooth projects.
+ * The configuration is loaded from traceconfig.h which shall be private for
+ * each individual project.
+ *
+ * In this utility, a set of OST-alike tracing macros are defined.
+ * (The purpose is to ease migration to OST in future.)
+ *
+ * Individual project can also define new macros based on this utility in
+ * its own space.
+ *
+ */
+
+#ifdef BLUETOOTHTRACE_ENABLED
+
+#ifdef BLUETOOTHTRACE_MEDIA_OST
+
+/**
+ * Convert own macros to OST macros when OST tracing is used.
+ * In OST tracing, aTraceName must be a unique identifier in scope of a module.
+ * Thus many OST compiling errors may occur if the same TraceName is used in multiple
+ * tracing lines where tracing is miigrated from non-OST to OST.
+ * The fix is to renaming the TraceName:s to be unique.
+ */
+#include <OpenSystemTrace.h>
+
+#define BOstrace0( aGroupName, aTraceName, aTraceText ) \
+ OstTrace0( aGroupName, aTraceName, aTraceText )
+
+#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \
+ OstTrace1( aGroupName, aTraceName, aTraceText, aParam )
+
+#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \
+ OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+
+#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \
+ OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam )
+
+#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \
+ OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
+
+#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \
+ OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
+
+#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \
+ OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
+
+#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \
+ OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
+
+#define BOstraceFunctionEntry0( aTraceName ) \
+ OstTraceFunctionEntry0( aTraceName )
+
+#define BOstraceFunctionEntry1( aTraceName, aInstance ) \
+ OstTraceFunctionEntry1( aTraceName, aInstance )
+
+#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \
+ OstTraceFunctionEntryExt(aTraceName, aInstance, aArg)
+
+#define BOstraceFunctionExit0( aTraceName ) \
+ OstTraceFunctionExit0( aTraceName )
+
+#define BOstraceFunctionExit1( aTraceName, aInstance ) \
+ OstTraceFunctionExit1( aTraceName, aInstance )
+
+#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \
+ OstTraceFunctionExitExt(aTraceName, aInstance, aRetval)
+
+#define BOstraceEventStart0( aTraceName, aEventName ) \
+ OstTraceEventStart0( aTraceName, aEventName )
+
+#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \
+ OstTraceEventStart1( aTraceName, aEventName, aParam )
+
+#define BOstraceEventStop( aTraceName, aEventName ) \
+ OstTraceEventStop( aTraceName, aEventName )
+
+#define BOstraceState0( aTraceName, aStateName, aNewState ) \
+ OstTraceState0( aTraceName, aStateName, aNewState )
+
+#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \
+ OstTraceState1( aTraceName, aStateName, aNewState, aInstance )
+
+#else // BLUETOOTHTRACE_MEDIA_OST
+
+#ifdef BLUETOOTHTRACE_MEDIA_FILE
+#include <flogger.h>
+#else
+#include <e32debug.h>
+#endif
+
+/**
+ * When tracing compilation with OST is disabled, the TraceName in each OST trace line
+ * is ignored, that is, the Trace Names are not checked at compiling time, neither
+ * are they written into the specified trace output media.
+ */
+
+/**
+ * Handlers below are used for tolerating overflow of formatting strings.
+ * to trucate rather than panic the caller.
+ */
+NONSHARABLE_CLASS( TBtTraceOflowTruncate8 ) : public TDes8Overflow
+ {
+public:
+ void Overflow( TDes8& /*aDes*/ ) {}
+ };
+
+NONSHARABLE_CLASS( TBtTraceOflowTruncate16 ) : public TDes16Overflow
+ {
+public:
+ void Overflow( TDes16& /*aDes*/ ) {}
+ };
+
+/**
+ * internal tracing implementation, do not use it out of this file.
+ */
+inline void Trace(const TDesC &trGrp, const TDesC &trTxt)
+{
+ _LIT(Format, "%S%S%S");
+ TBuf16<0x180> str;
+ TPtrC cp(KComponentName);
+ str.Format(Format, &cp, &trGrp, &trTxt);
+#ifdef BLUETOOTHTRACE_MEDIA_FILE
+ RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, str);
+#else
+ RDebug::Print( str );
+#endif
+}
+
+/*
+ * trace with no parameters
+ */
+#define BOstrace0( aGroupName, aTraceName, aTraceText ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ Trace( TrGrp, TrTxt ); \
+}
+
+/*
+ * trace with one 32-bit parameter
+ */
+#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with more than 32 bits of data. Not supported
+ */
+#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+
+/*
+ * trace with one parameter that is not 32-bit integer
+ */
+#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \
+ BOstrace1( aGroupName, aTraceName, aTraceText, aParam )
+
+/*
+ * trace with two parameters.
+ */
+#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with three parameters.
+ */
+#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with four parameters
+ */
+#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * trace with five parameters
+ */
+#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \
+{\
+ _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \
+ TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function entry trace without extra parameters.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionEntry0( aTraceName ) \
+{\
+ _LIT(TrGrp, "[ API ]"); \
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, ">> "); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry );\
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function entry trace with a parameter representing the instance identifier, e.g.
+ * "this" pointer.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionEntry1( aTraceName, aInstance ) \
+{\
+ _LIT(TrGrp, "[ API ]");\
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d)"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function entry trace, which traces function parameters.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \
+{ \
+ _LIT(TrGrp, "[ API ]");\
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d) arg %d"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aArg); \
+ Trace( TrGrp, buf ); \
+}
+/*
+ * Function exit trace without extra parameters.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionExit0( aTraceName ) \
+{\
+ _LIT(TrGrp, "[ API ]"); \
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, "<< "); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function exit trace with a parameter representing the instance identifier
+ * for example "this" pointer.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionExit1( aTraceName, aInstance ) \
+{\
+ _LIT(TrGrp, "[ API ]"); \
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d)"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Function exit trace with parameters representing the instance identifier,
+ * for example "this" pointer, and return value.
+ * The trace is mapped to TRACE_API group.
+ */
+#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \
+{\
+ _LIT(TrGrp, "[ API ]");\
+ TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \
+ _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d) ret %d"); \
+ TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aRetval); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Performance measurement event start trace without extra parameters.
+ * The trace is mapped to TRACE_PERFORMANCE group.
+ */
+#define BOstraceEventStart0( aTraceName, aEventName ) \
+{\
+ _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \
+ _LIT(Entry, "[Start] "); \
+ TBuf<512> buf(Entry); buf.Append( EvName ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Performance measurement event start trace with single 32-bit parameter.
+ * The trace is mapped to TRACE_PERFORMANCE group.
+ */
+#define BOstraceEventStart1( aTraceName, aEventName, aParam ) \
+{\
+ _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \
+ _LIT(Entry, "[Start] %S 0x%X(%d)"); \
+ TPtrC evt(EvName); TBuf<512> buf; \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Entry, &overflow, &evt, aParam, aParam ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * Performance measurement event end trace.
+ * The trace is mapped to TRACE_PERFORMANCE group.
+ */
+#define BOstraceEventStop( aTraceName, aEventName ) \
+{\
+ _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \
+ _LIT(Entry, "[Stop] "); \
+ TBuf<512> buf(Entry); buf.Append( EvName ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * State transition event.
+ * The trace is mapped to TRACE_STATE group.
+ */
+#define BOstraceState0( aTraceName, aStateName, aNewState ) \
+{\
+ _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \
+ _LIT(Entry, "%S 0x%X(%d)"); \
+ TPtrC evt(StName); TBuf<512> buf; \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState ); \
+ Trace( TrGrp, buf ); \
+}
+
+/*
+ * State transition event with instance identifier.
+ * The trace is mapped to TRACE_STATE group.
+ */
+#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \
+{\
+ _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \
+ _LIT(Entry, "%S 0x%X(%d) instance=0x%X(%d)"); \
+ TPtrC evt(StName); TBuf<512> buf; \
+ TBtTraceOflowTruncate16 overflow; \
+ buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \
+ Trace( TrGrp, buf ); \
+}
+
+#endif // BLUETOOTHTRACE_MEDIA_OST
+
+// Extended tracing macros facilitating domain specific tracing needs:
+
+/*
+ * A block of source code merely for tracing purpose.
+ */
+#define BtTraceBlock( exp ) {exp}
+
+/*
+ * trace macro for BT device address printing with an additional trace text.
+ * aParam must be TBTDevAddr type.
+ */
+#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam ) \
+{ \
+ _LIT(TrTxt, aTraceText); TPtrC p(TrTxt); \
+ TBuf<12> buf; \
+ aParam.GetReadable( buf ); TPtrC p2(buf);\
+ BOstraceExt2( aGroupName, aTraceName, "%S%S", &p, &p2 ); \
+}
+
+/*
+ * trace macro for BT device address printing with no additional trace text.
+ * aParam must be TBTDevAddr type.
+ */
+#define BtTraceBtAddr0( aGroupName, aTraceName, aParam ) \
+{ \
+ TBuf<12> buf; aParam.GetReadable( buf ); TPtrC p(buf); \
+ BOstraceExt1( aGroupName, aTraceName, "%S", &p ); \
+}
+
+#else // BLUETOOTHTRACE_ENABLED
+
+#define BOstrace0( aGroupName, aTraceName, aTraceText )
+#define BOstrace1( aGroupName, aTraceName, aTraceText, aParam )
+#define BOstraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength )
+#define BOstraceExt1( aGroupName, aTraceName, aTraceText, aParam )
+#define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
+#define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
+#define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
+#define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
+
+#define BOstraceFunctionEntry0( aTraceName )
+#define BOstraceFunctionEntry1( aTraceName, aInstance )
+#define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg)
+#define BOstraceFunctionExit0( aTraceName )
+#define BOstraceFunctionExit1( aTraceName, aInstance )
+#define BOstraceEventStart0( aTraceName, aEventName )
+#define BOstraceEventStart1( aTraceName, aEventName, aParam )
+#define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval)
+#define BOstraceEventStop( aTraceName, aEventName )
+#define BOstraceState0( aTraceName, aStateName, aNewState )
+#define BOstraceState1( aTraceName, aStateName, aNewState, aInstance )
+
+#define BtTraceBlock( exp )
+#define BtTraceBtAddr1( aGroupName, aTraceName, aTraceText, aParam )
+#define BtTraceBtAddr0( aGroupName, aTraceName, aParam )
+
+#endif // BLUETOOTHTRACE_ENABLED
+
+/*
+ * Additional general purpose definition, a hook for defining a friend class
+ * for unit testing to get access to class internals.
+ */
+#ifndef BTUNITTEST
+#define BTUNITTESTHOOK
+#endif
+
+#endif // BLUETOOTHTRACE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/inc/bluetoothuitrace.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* ============================================================================
+* Name : bluetoothuitrace.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : API declaration of run-time debug tracing in bluetoothui project
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef BLUETOOTHUITRACE_H
+#define BLUETOOTHUITRACE_H
+
+#include <bluetoothtrace.h>
+#include <QDateTime>
+
+#ifdef BLUETOOTHTRACE_ENABLED
+
+/*
+ * trace macro for Qt code with an additional trace text.
+ * param must be QString type.
+ */
+#define BtTraceQString1( groupName, traceName, traceText, param ) \
+{\
+ _LIT(TrTxt, traceText); TPtrC p(TrTxt); \
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(param.utf16()), param.length() ); \
+ BOstraceExt2( groupName, traceName, "%S%S", &p, &textPtr ); \
+}
+
+/*
+ * trace macro for Qt code with no additional trace text.
+ * param must be QString type.
+ */
+#define BtTraceQString0( groupName, traceName, param ) \
+{\
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(param.utf16()), param.length() ); \
+ BOstraceExt1( groupName, traceName, "%S", &textPtr ); \
+}
+
+/*
+ * Macro for tracing a Bluetooth device entry in btuimdevlist
+ * with no additional trace text.
+ */
+#define BtTraceDevListEntry0( groupName, traceName, dev ) \
+{\
+ QString info("["); \
+ info += dev[Btuim::DevAddrReadableRole].toString() + "]"; \
+ QString filterBinary; \
+ filterBinary.setNum( dev[Btuim::MajorFilterRole].toInt(), 16); \
+ info += "[" + filterBinary + "]"; \
+ info += "[" \
+ + dev[Btuim::LastUsedTimeRole].value<QDateTime>().toString(Qt::ISODate ) \
+ + "]" ; \
+ info += "[" + dev[Btuim::DevNameRoleRole].toString() + "]" ; \
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(info.utf16()), info.length() ); \
+ BOstraceExt1( groupName, traceName, "%S", &textPtr ); \
+}
+
+/*
+ * Macro for tracing a Bluetooth device entry in btuim
+ * with an additional trace text.
+ */
+#define BtTraceDevListEntry1( groupName, traceName, traceText, dev ) \
+{\
+ QString info("["); \
+ info += dev[Btuim::DevAddrReadableRole].toString() + "]"; \
+ QString cod; \
+ cod.setNum( dev[Btuim::ClassOfDeviceRole].toInt(), 16); \
+ info += "[" + cod + "]"; \
+ QString filterBinary; \
+ filterBinary.setNum( dev[Btuim::MajorFilterRole].toInt(), 16); \
+ info += "[" + filterBinary + "]"; \
+ info += "[" \
+ + dev[Btuim::LastUsedTimeRole].value<QDateTime>().toString(Qt::ISODate ) \
+ + "]" ; \
+ info += "[" + dev[Btuim::DevNameRole].toString() + "]" ; \
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(info.utf16()), info.length() ); \
+ _LIT(TrTxt, traceText); TPtrC p(TrTxt); \
+ BOstraceExt2( groupName, traceName, "%S%S", &p, &textPtr ); \
+}
+
+/*
+ * Macro for Qt code with additional trace text.
+ * list must be QStringList type.
+ */
+#define BtTraceQStringList1( groupName, traceName, traceText, list ) \
+{\
+ QString info(": ["); \
+ info += list.join(".") + "]"; \
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(info.utf16()), info.length() ); \
+ _LIT(TrTxt, traceText); TPtrC p(TrTxt); \
+ BOstraceExt2( groupName, traceName, "%S%S", &p, &textPtr ); \
+}
+
+/*
+ * Macro for Qt code with no additional trace text.
+ * list must be QStringList type.
+ */
+#define BtTraceQStringList0( groupName, traceName, list ) \
+{\
+ QString info(": ["); \
+ info += list.join(".") + "]"; \
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(info.utf16()), info.length() ); \
+ BOstraceExt1( groupName, traceName, "%S", &textPtr ); \
+}
+
+
+/*
+ * Macro for tracing Bluetooth DevData data source in btuimdevdata
+ * with no additional trace text.
+*/
+#define BtTraceDevDataEntry0( groupName, traceName, devData ) \
+{\
+ QString info("["); \
+ QMap< int, QVariant > val = devData.at( Btuim::DevDataIndexName ); \
+ info += val.value(Qt::EditRole).toString() + "]" ; \
+ val = devData.at( Btuim::DevDataIndexStatus ); \
+ int statusBits = val.value(Qt::EditRole).toInt(); \
+ info += "["; \
+ info += QString::number(statusBits, 16 ); \
+ info += "]"; \
+ QStringList strl = val.value(Qt::DisplayRole).toStringList(); \
+ info += "[" ; \
+ for ( int i = 0; i < strl.count(); ++i ) { \
+ info += strl.at(i) + ","; \
+ } \
+ info += "]" ; \
+ val = devData.at( Btuim::DevDataIndexOptionsMenu ); \
+ info += " opts:"; \
+ QList<QVariant> cmdItems = val.value( Btuim::DevDataCmdItemsRole ).toList(); \
+ for ( int i = 0; i < cmdItems.count(); i++ ) { \
+ const Btuim::DevDataCmdItem& item = cmdItems.at(i).value<Btuim::DevDataCmdItem>(); \
+ info += "[" + QString::number(item.mCmdId) + "," + QString::number(item.mEnabled) + "," + "]"; \
+ } \
+ val = devData.at( Btuim::DevDataIndexCmdList ); \
+ info += " cmds:"; \
+ cmdItems = val.value( Btuim::DevDataCmdItemsRole ).toList(); \
+ for ( int i = 0; i < cmdItems.count(); i++ ) { \
+ const Btuim::DevDataCmdItem& item = cmdItems.at(i).value<Btuim::DevDataCmdItem>(); \
+ info += "[" + QString::number(item.mCmdId) + "," + QString::number(item.mEnabled) + "," + "]"; \
+ } \
+ TPtrC textPtr(reinterpret_cast<const TUint16*>(info.utf16()), info.length() ); \
+ BOstraceExt1( groupName, traceName, "%S", &textPtr ); \
+}
+#else
+
+#define BtTraceQString1( aGroupName, aTraceName, aTraceText, aParam )
+#define BtTraceQString0( aGroupName, aTraceName, aParam )
+#define BtTraceDevListEntry0( groupName, traceName, dev )
+#define BtTraceDevListEntry1( groupName, traceName, traceText, dev )
+#define BtTraceQStringList1( groupName, traceName, traceText, list )
+#define BtTraceQStringList0( groupName, traceName, list )
+#define BtTraceDevDataEntry0( groupName, traceName, devData )
+#endif // BLUETOOTHTRACE_ENABLED
+
+// At early development phase, we force assertion in release build to find out
+// design and implementation issues.
+//#ifndef QT_NO_DEBUG
+#define BTUI_DEBUG
+//#endif
+
+#if !defined(BTUI_ASSERT_X)
+# ifdef BTUI_DEBUG
+#define BTUI_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
+# else
+# define BTUI_ASSERT_X(cond, where, what) qt_noop()
+# endif
+#endif
+
+#endif // BLUETOOTHUITRACE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/inc/btqtconstants.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef BTQTCONSTANTS_H
+#define BTQTCONSTANTS_H
+
+#include <btengconstants.h>
+
+
+enum VisibilityMode {
+ BtHidden = 0x10, // using a different number space than TBTVisibilityMode
+ BtVisible,
+ BtTemporary,
+ BtUnknown
+
+};
+
+// used for mapping between UI row and VisibilityMode item
+enum VisibilityModeUiRowMapping {
+ UiRowBtHidden = 0,
+ UiRowBtVisible,
+ UiRowBtTemporary
+};
+
+inline VisibilityMode QtVisibilityMode(TBTVisibilityMode btEngMode)
+{
+ VisibilityMode mode;
+ switch(btEngMode) {
+ case EBTVisibilityModeHidden:
+ mode = BtHidden;
+ break;
+ case EBTVisibilityModeGeneral:
+ mode = BtVisible;
+ break;
+ case EBTVisibilityModeTemporary:
+ mode = BtTemporary;
+ break;
+ default:
+ mode = BtUnknown;
+ }
+ return mode;
+}
+
+inline TBTVisibilityMode BtEngVisibilityMode(VisibilityMode btQtMode)
+{
+ TBTVisibilityMode mode;
+ switch(btQtMode) {
+ case BtHidden:
+ mode = EBTVisibilityModeHidden;
+ break;
+ case BtVisible:
+ mode = EBTVisibilityModeGeneral;
+ break;
+ case BtTemporary:
+ mode = EBTVisibilityModeTemporary;
+ break;
+ default:
+ mode = (TBTVisibilityMode)KErrUnknown;
+ }
+ return mode;
+}
+
+
+#endif // BTQTCONSTANTS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bluetoothengine/btui/inc/traceconfig.h Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* ============================================================================
+* Name : traceconfig_template.h
+* Part of : BluetoothUI / bluetoothuimodel *** Info from the SWAD
+* Description : Configuration of debug tracing in bluetoothuimodel
+*
+* Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+#ifndef BLUETOOTHTRACECONFIG_H
+#define BLUETOOTHTRACECONFIG_H
+
+/*
+Sample usage:
+ void testTracing()
+ {
+ BOstrace0( TRACE_FATAL, TNAME_DEVLIST_1, "BOstrace0" );
+ BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_2, "BOstrace1 %d", 123 );
+ _LIT(String, "\"Symbian Descriptor\"");
+ TPtrC ptr(String);
+ TBuf<20> buf(ptr);
+ BOstraceExt1( TRACE_NORMAL, TNAME_DEVLIST_3, "BOstraceExt1 %S", &ptr);
+ BOstraceExt2( TRACE_API, TNAME_DEVLIST_4, "BOstraceExt2 %d %S", 456, &ptr );
+ BOstraceExt3( TRACE_FLOW, TNAME_DEVLIST, "BOstraceExt3 0x%x %d %S", 128, 256, &ptr );
+ BOstraceExt4( TRACE_DETAILED, TNAME_DEVL_5IST, "BOstraceExt4 0x%x %d %S %S", 128, 256, &ptr, &buf );
+ BOstraceExt5( TRACE_DEBUG, TNAME_DEVLIST_6, "BOstraceExt5 0x%x %d %S %S, %b", 128, 256, &ptr, &buf, 512 );
+ BOstraceFunctionEntry0( TNAME_DEVLIST_7 );
+ BOstraceFunctionEntry1( TNAME_DEVLIST_8, 0x00abcdef );
+ BOstraceFunctionEntryExt(TNAME_DEVLIST_9, 0xdeadbeef, 123 );
+ BOstraceFunctionExit0( TNAME_DEVLIST_9 );
+ BOstraceFunctionExit1( TNAME_DEVLIST_10, 0x00beebee );
+ BOstraceFunctionExitExt(TNAME_DEVLIST_11, 0x00badbed, -1);
+ BOstraceEventStart0( TNAME_DEVLIST_12, "BOstraceEventStart0" );
+ BOstraceEventStart1( TNAME_DEVLIST_13, "BOstraceEventStart1", 789 );
+ BOstraceEventStop( TNAME_DEVLIST_14, "BOstraceEventStop" );
+ BOstraceState0( TNAME_DEVLIST_15, "connection state", 1 );
+ BOstraceState1( TNAME_DEVLIST_16, "audio state", 2, 0xdeadbeef );
+ BtTraceBlock(
+ for (int i = 0; i < 5; ++i) {
+ BOstrace1( TRACE_IMPORTANT, TNAME_DEVLIST_, "BtTraceBlock counter(1-5): %d", i+1 );
+ });
+ QString str("\"Qt String\"");
+ BtTraceQString0( TRACE_NORMAL, TNAME_DEVLIST_17, str);
+ BtTraceQString1( TRACE_NORMAL, TNAME_DEVLIST_18, "additioanl text;", str);
+ TBTDevAddr addr;
+ addr.SetReadable(_L("0060576ff376"));
+ BtTraceBtAddr0( TRACE_NORMAL, TNAME_DEVLIST_19, addr );
+ BtTraceBtAddr1( TRACE_NORMAL, TNAME_DEVLIST_20, "additional trace;", addr );
+ }
+
+ */
+
+// At early development phase, tracing is activated
+//#ifdef _DEBUG
+#define BLUETOOTHTRACE_ENABLED
+//#endif //_DEBUG
+
+/*
+ * Tracing media configuration
+ */
+#ifdef BLUETOOTHTRACE_ENABLED
+ #ifdef __WINS__
+ #define BLUETOOTHTRACE_MEDIA_FILE
+ #else
+ // RDEBUG is used for tracing output before we migrate to OST tracing.
+ #define BLUETOOTHTRACE_MEDIA_RDEBUG
+ //#define BLUETOOTHTRACE_MEDIA_OST
+ #endif // __WINS__
+#endif //BLUETOOTHTRACE_ENABLED
+
+/*
+ * Configuration of tracing to file
+ */
+#ifdef BLUETOOTHTRACE_MEDIA_FILE
+
+_LIT( KLogFile, "btuiqt.txt" );
+_LIT( KLogDir, "bt" );
+
+#endif //BLUETOOTHTRACE_MEDIA_FILE
+
+/*
+ * Configuration of tracing using RDebug
+ */
+#ifdef BLUETOOTHTRACE_MEDIA_RDEBUG
+
+#endif //BLUETOOTHTRACE_MEDIA_RDEBUG
+
+/*
+ * Configuration of tracing using OST
+ */
+#ifndef BLUETOOTHTRACE_MEDIA_OST
+
+/**
+ * Group-mapping aligning with OST groups.
+ * The purpose of using groups is to ease migrating tracing from legacy logging to OST.
+ */
+#define TRACE_FATAL "[FATAL]"
+#define TRACE_IMPORTANT "[IMPTT]"
+#define TRACE_NORMAL "[NORML]"
+#define TRACE_API "[ API ]"
+#define TRACE_FLOW "[FLOW ]"
+#define TRACE_STATE "[STATE]"
+#define TRACE_DETAILED "[DETLD]"
+#define TRACE_DEBUG "[DEBUG]"
+#define TRACE_PERFORMANCE "[PFMAN]"
+
+/**
+ * Component Identifier to be written into traces:
+ */
+_LIT(KComponentName, "[BtUi]");
+
+#endif //BLUETOOTHTRACE_MEDIA_OST
+
+#endif // BLUETOOTHTRACECONFIG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd Mon May 03 14:36:07 2010 +0300
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED
+ proFile CDATA #IMPLIED
+ qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>