0
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 1
// btservices.cpp
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 2
//
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 3
// Copyright (c) 2009 - 2010 Accenture. All rights reserved.
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 4
// This component and the accompanying materials are made available
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 5
// under the terms of the "Eclipse Public License v1.0"
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 6
// which accompanies this distribution, and is available
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 8
//
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 9
// Initial Contributors:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 10
// Accenture - Initial contribution
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 11
//
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 12
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 13
#include <e32std.h>
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 14
#include <BTExtNotifiers.h>
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 15
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 16
#include <fshell/common.mmh>
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 17
#include <fshell/ioutils.h>
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 18
using namespace IoUtils;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 19
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 20
#include "BtServicesEng.h"
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 21
#include "BtServiceView.h"
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 22
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 23
class CBTEngSettings;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 24
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 25
#if FSHELL_PLATFORM_S60 >= 5
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 26
// This is an S60-only API
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 27
#define SUPPORT_ONOFF
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 28
#endif
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 29
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 30
#ifdef SUPPORT_ONOFF
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 31
#include <btengsettings.h>
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 32
#endif
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 33
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 34
CBtServiceView::CBtServiceView()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 35
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 36
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 37
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 38
CBtServiceView::~CBtServiceView()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 39
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 40
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 41
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 42
void CBtServiceView::PrintTextMsg(TInt /*aVerboseLevel*/, const TDesC& /*aMsg*/)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 43
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 44
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 45
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 46
void CBtServiceView::AsyncCompleted()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 47
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 48
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 49
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 50
class CCmdBtsvc : public CCommandBase, public CBtServiceView
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 51
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 52
public:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 53
static CCommandBase* NewLC();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 54
~CCmdBtsvc();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 55
private:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 56
CCmdBtsvc();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 57
void DoScanDeviceL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 58
void DoListServiceL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 59
void DoAttributeL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 60
void DoLocalL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 61
void DoListUuidFilterL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 62
void SelectBTDeviceL(TBTDeviceName& aName, TBTDevAddr& aBDAddr, TBTDeviceClass& aDevClass);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 63
TBool GetBTDevClassFromRegistryL(TBTDevAddr& aBDAddr, TBTDeviceClass& aDevClass);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 64
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 65
#ifdef SUPPORT_ONOFF
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 66
void SetEnabledL(TBool aEnable);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 67
void ShowStatusL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 68
TBool GetPowerStateL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 69
#endif
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 70
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 71
private: // From CCommandBase.
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 72
virtual const TDesC& Name() const;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 73
virtual void DoRunL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 74
virtual void ArgumentsL(RCommandArgumentList& aArguments);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 75
virtual void OptionsL(RCommandOptionList& aOptions);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 76
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 77
private:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 78
virtual void PrintTextMsg(TInt aVerboseLevel, const TDesC& aMsg);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 79
virtual void AsyncCompleted();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 80
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 81
private:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 82
CBtServicesEng* iEngine;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 83
CActiveSchedulerWait* iActiveWait;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 84
RArray<TBool> iVerbose;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 85
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 86
HBufC* iOptBTAddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 87
HBufC* iOptSvcHandle; //service handle
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 88
HBufC* iOptUuidFilter; //uuid filter
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 89
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 90
enum TBtSvcCmd
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 91
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 92
ECmdDevice,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 93
ECmdService,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 94
ECmdAttribute,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 95
ECmdLocal,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 96
ECmdUuid,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 97
ECmdStatus,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 98
ECmdEnable,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 99
ECmdDisable,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 100
};
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 101
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 102
TBtSvcCmd iCommand;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 103
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 104
CBTEngSettings* iSettings;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 105
};
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 106
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 107
CCommandBase* CCmdBtsvc::NewLC()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 108
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 109
CCmdBtsvc* self = new(ELeave) CCmdBtsvc();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 110
CleanupStack::PushL(self);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 111
self->BaseConstructL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 112
return self;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 113
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 114
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 115
CCmdBtsvc::CCmdBtsvc()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 116
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 117
iActiveWait = new (ELeave) CActiveSchedulerWait;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 118
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 119
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 120
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 121
CCmdBtsvc::~CCmdBtsvc()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 122
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 123
#ifdef SUPPORT_ONOFF
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 124
delete iSettings;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 125
#endif
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 126
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 127
delete iOptBTAddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 128
delete iOptSvcHandle;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 129
delete iOptUuidFilter;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 130
delete iActiveWait;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 131
delete iEngine;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 132
iVerbose.Close();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 133
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 134
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 135
void CCmdBtsvc::PrintTextMsg(TInt aVerboseLevel, const TDesC& aMsg)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 136
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 137
TInt VerboseLevel = iVerbose.Count();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 138
if (aVerboseLevel <= VerboseLevel)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 139
Printf(aMsg);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 140
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 141
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 142
void CCmdBtsvc::AsyncCompleted()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 143
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 144
if (iActiveWait->IsStarted())
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 145
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 146
iActiveWait->AsyncStop();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 147
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 148
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 149
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 150
const TDesC& CCmdBtsvc::Name() const
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 151
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 152
_LIT(KName, "btservices");
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 153
return KName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 154
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 155
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 156
void CCmdBtsvc::ArgumentsL(RCommandArgumentList& aArguments)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 157
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 158
_LIT(KArgCommand, "command");
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 159
aArguments.AppendEnumL((TInt&)iCommand, KArgCommand);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 160
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 161
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 162
void CCmdBtsvc::OptionsL(RCommandOptionList& aOptions)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 163
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 164
aOptions.AppendStringL(iOptBTAddr, _L("address"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 165
aOptions.AppendStringL(iOptSvcHandle, _L("record"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 166
aOptions.AppendStringL(iOptUuidFilter, _L("uuid"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 167
aOptions.AppendBoolL(iVerbose, _L("verbose"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 168
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 169
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 170
void CCmdBtsvc::DoRunL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 171
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 172
switch (iCommand)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 173
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 174
case ECmdDevice:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 175
DoScanDeviceL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 176
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 177
case ECmdService:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 178
DoListServiceL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 179
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 180
case ECmdAttribute:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 181
DoAttributeL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 182
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 183
case ECmdLocal:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 184
DoLocalL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 185
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 186
case ECmdUuid:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 187
DoListUuidFilterL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 188
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 189
#ifdef SUPPORT_ONOFF
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 190
case ECmdStatus:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 191
ShowStatusL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 192
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 193
case ECmdEnable:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 194
SetEnabledL(ETrue);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 195
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 196
case ECmdDisable:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 197
SetEnabledL(EFalse);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 198
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 199
#endif
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 200
default:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 201
LeaveIfErr(KErrArgument, _L("Invalid command"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 202
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 203
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 204
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 205
void CCmdBtsvc::DoAttributeL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 206
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 207
TInt err;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 208
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 209
//if want to query full attribute set of one particular service,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 210
//call CBtServicesEng::GetAttributesL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 211
if (iOptSvcHandle && iOptSvcHandle->Length())
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 212
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 213
iEngine = CBtServicesEng::NewL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 214
iEngine->SetView(this);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 215
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 216
iEngine->CancelSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 217
iEngine->DeleteSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 218
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 219
err = iEngine->BluetoothReady();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 220
LeaveIfErr(err, _L("Bluetooth not ready"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 221
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 222
TBTDeviceName Name;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 223
TBTDevAddr BDAddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 224
TBTDeviceClass DevClass;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 225
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 226
//iOptSvcHandle should begin with "0x" (hex)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 227
if ((iOptSvcHandle->Left(2))==_L("0x"))
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 228
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 229
TSdpServRecordHandle Handle;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 230
TLex lex(*iOptSvcHandle);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 231
lex.SkipAndMark(2);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 232
err = lex.Val(Handle, EHex);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 233
LeaveIfErr(err, _L("Service Handle:\"%S\" is not in valid format"), iOptSvcHandle);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 234
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 235
SelectBTDeviceL(Name, BDAddr, DevClass);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 236
Printf(_L("==============================================\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 237
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 238
iEngine->GetDeviceAttributesL(BDAddr, Name, Handle);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 239
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 240
//wait for results
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 241
iActiveWait->Start();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 242
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 243
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 244
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 245
LeaveIfErr(KErrArgument, _L("Service Handle:\"%S\" is not in valid format"), iOptSvcHandle);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 246
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 247
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 248
LeaveIfErr(KErrArgument, _L("use -r to specify a service record handle"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 249
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 250
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 251
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 252
//do a BT device scan with RHostResolver,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 253
//and make a list of BT addresses, device name, and device class
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 254
//
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 255
void CCmdBtsvc::DoScanDeviceL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 256
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 257
TInt err;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 258
TInt ItemsFound = 0;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 259
TBTDevAddr BDAddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 260
TBTDeviceName Name;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 261
TBTDeviceClass DevClass;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 262
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 263
Printf(_L("Scanning for BT devices ...\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 264
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 265
RSocketServ SktSrv;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 266
CleanupClosePushL(SktSrv);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 267
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 268
err = SktSrv.Connect();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 269
LeaveIfErr(err, _L("Could not connect to socket server"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 270
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 271
RHostResolver Host;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 272
CleanupClosePushL(Host);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 273
RHostResolver HostForName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 274
CleanupClosePushL(HostForName);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 275
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 276
TProtocolDesc ProtocolInfo;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 277
err = SktSrv.FindProtocol(_L("BTLinkManager"), ProtocolInfo);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 278
User::LeaveIfError(err);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 279
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 280
err = Host.Open(SktSrv, ProtocolInfo.iAddrFamily , ProtocolInfo.iProtocol);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 281
LeaveIfErr(err, _L("Could not open host resolver"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 282
err = HostForName.Open(SktSrv, ProtocolInfo.iAddrFamily , ProtocolInfo.iProtocol);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 283
LeaveIfErr(err, _L("Could not open host resolver"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 284
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 285
TInquirySockAddr Inq;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 286
Inq.SetIAC(KGIAC);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 287
Inq.SetAction(KHostResInquiry/*|KHostResIgnoreCache*/);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 288
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 289
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 290
TNameEntry Result;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 291
err = Host.GetByAddress(Inq, Result);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 292
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 293
//this is for querying name
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 294
TInquirySockAddr InqName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 295
InqName.SetAction(KHostResName);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 296
TNameEntry ResultName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 297
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 298
Printf(_L("========================================================\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 299
Printf(_L("BTAddr | DeviceClass| Name\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 300
Printf(_L("========================================================\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 301
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 302
while(1)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 303
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 304
if (err == KErrNone)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 305
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 306
ItemsFound++;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 307
TInquirySockAddr& sa = TInquirySockAddr::Cast(Result().iAddr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 308
const TBTDevAddr& bdaddr = sa.BTAddr();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 309
BDAddr = bdaddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 310
Name = Result().iName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 311
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 312
TUint16 MajorServiceClass = sa.MajorServiceClass();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 313
DevClass = TBTDeviceClass(
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 314
MajorServiceClass, sa.MajorClassOfDevice(), sa.MinorClassOfDevice() );
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 315
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 316
TBuf<128> BTReadAddress;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 317
BDAddr.GetReadable(BTReadAddress);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 318
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 319
//query its name
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 320
InqName.SetBTAddr(bdaddr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 321
err = HostForName.GetByAddress(InqName, ResultName);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 322
if (err==KErrNone)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 323
Name = ResultName().iName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 324
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 325
Name.Format(_L("Unable to get the name, err=%d"), err);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 326
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 327
Printf(_L("0x%S | 0x%08x | \"%S\" \r\n"),
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 328
&BTReadAddress, DevClass.DeviceClass(), &Name);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 329
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 330
err = Host.Next(Result);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 331
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 332
else if (err == KErrEof)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 333
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 334
break;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 335
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 336
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 337
LeaveIfErr(err, _L("Resolving address failed"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 338
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 339
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 340
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 341
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 342
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 343
Printf(_L("%d devices found\r\n"),ItemsFound);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 344
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 345
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 346
//NOT TESTED YET, do not use
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 347
//aBDAddr:[in]
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 348
//aDevClass:[out]
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 349
TBool CCmdBtsvc::GetBTDevClassFromRegistryL(TBTDevAddr& aBDAddr, TBTDeviceClass& aDevClass)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 350
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 351
TInt err;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 352
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 353
TBuf<128> buf;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 354
aBDAddr.GetReadable(buf);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 355
Printf(_L("Query DeviceClass for BTAddr:0x%S\r\n"), &buf);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 356
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 357
RBTRegServ Srv;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 358
CleanupClosePushL(Srv);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 359
err = Srv.Connect();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 360
User::LeaveIfError(err);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 361
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 362
RBTRegistry Reg;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 363
CleanupClosePushL(Reg);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 364
err = Reg.Open(Srv);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 365
User::LeaveIfError(err);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 366
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 367
TBTNamelessDevice Dev;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 368
Dev.SetAddress(aBDAddr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 369
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 370
TRequestStatus status;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 371
Reg.GetDevice(Dev, status);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 372
User::WaitForRequest(status);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 373
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 374
err = status.Int();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 375
User::LeaveIfError(err);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 376
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 377
if (err == KErrNone )
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 378
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 379
aDevClass = Dev.DeviceClass();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 380
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 381
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 382
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 383
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 384
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 385
return ETrue;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 386
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 387
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 388
//select a BT device either from RNotifier,
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 389
//or using BT address string if it is specified
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 390
//aName: [out]
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 391
//aBDAddr: [out]
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 392
//aDevClass: [out]
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 393
void CCmdBtsvc::SelectBTDeviceL(TBTDeviceName& aName, TBTDevAddr& aBDAddr, TBTDeviceClass& aDevClass)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 394
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 395
TInt err;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 396
if (iOptBTAddr && iOptBTAddr->Length()>0)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 397
//use RHostResolver to get name and device class
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 398
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 399
Printf(_L("Querying name for \"%S\"...\r\n"), iOptBTAddr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 400
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 401
RSocketServ SktSrv;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 402
CleanupClosePushL(SktSrv);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 403
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 404
err = SktSrv.Connect();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 405
LeaveIfErr(err, _L("Could not connect to socket server"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 406
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 407
RHostResolver Host;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 408
CleanupClosePushL(Host);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 409
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 410
TProtocolDesc ProtocolInfo;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 411
err = SktSrv.FindProtocol(_L("BTLinkManager"), ProtocolInfo);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 412
User::LeaveIfError(err);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 413
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 414
err = Host.Open(SktSrv, ProtocolInfo.iAddrFamily , ProtocolInfo.iProtocol);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 415
LeaveIfErr(err, _L("Could not open host resolver"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 416
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 417
TBTDevAddr Addr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 418
err = Addr.SetReadable(*iOptBTAddr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 419
LeaveIfErr(err, _L("User-input BT address invalid"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 420
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 421
TInquirySockAddr Inq;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 422
Inq.SetAction(KHostResName);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 423
Inq.SetBTAddr(Addr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 424
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 425
TNameEntry Result;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 426
err = Host.GetByAddress(Inq, Result);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 427
if (err == KErrNone)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 428
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 429
TInquirySockAddr& sa = TInquirySockAddr::Cast(Result().iAddr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 430
const TBTDevAddr& bdaddr = sa.BTAddr();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 431
aBDAddr = bdaddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 432
aName = Result().iName;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 433
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 434
TUint16 MajorServiceClass = sa.MajorServiceClass();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 435
aDevClass = TBTDeviceClass(
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 436
MajorServiceClass, sa.MajorClassOfDevice(), sa.MinorClassOfDevice() );
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 437
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 438
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 439
LeaveIfErr(err, _L("Resolving address failed"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 440
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 441
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 442
CleanupStack::PopAndDestroy();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 443
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 444
TBuf<128> AddressStr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 445
aBDAddr.GetReadable(AddressStr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 446
Printf(_L("Device \"%S\" BTAddr:0x%S\r\n"),
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 447
&aName, &AddressStr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 448
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 449
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 450
//use RNotifier to select a BT device
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 451
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 452
//about the search device, prompting user about curret status
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 453
Printf(_L("Searching Bluetooth device through RNotifier,\r\nplease go to main UI screen to select a device...\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 454
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 455
////////////////////////////////////////////
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 456
RNotifier noti;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 457
User::LeaveIfError(noti.Connect());
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 458
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 459
// 2. Start the device selection plug-in
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 460
TBTDeviceSelectionParams selectionFilter;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 461
//TUUID targetServiceClass(0x2345);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 462
//selectionFilter.SetUUID(targetServiceClass);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 463
TBTDeviceSelectionParamsPckg pckg(selectionFilter);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 464
TBTDeviceResponseParams result;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 465
TBTDeviceResponseParamsPckg resultPckg(result);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 466
TRequestStatus status;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 467
noti.StartNotifierAndGetResponse(status, KDeviceSelectionNotifierUid, pckg, resultPckg);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 468
User::After(2000000);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 469
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 470
// 3. Extract device name if it was returned
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 471
User::WaitForRequest(status);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 472
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 473
if (status.Int() == KErrNone)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 474
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 475
if (resultPckg().IsValidDeviceName() &&
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 476
resultPckg().IsValidBDAddr() &&
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 477
resultPckg().IsValidDeviceClass()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 478
)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 479
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 480
aName = (resultPckg().DeviceName());
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 481
aBDAddr = resultPckg().BDAddr();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 482
aDevClass = resultPckg().DeviceClass();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 483
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 484
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 485
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 486
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 487
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 488
// 4. Clean up
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 489
noti.CancelNotifier(KDeviceSelectionNotifierUid);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 490
noti.Close();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 491
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 492
TBuf<128> AddressStr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 493
aBDAddr.GetReadable(AddressStr);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 494
Printf(_L("Device \"%S\" BTAddr:0x%S DeviceClass:0x%08X\r\n"),
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 495
&aName, &AddressStr, aDevClass.DeviceClass());
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 496
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 497
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 498
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 499
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 500
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 501
//search and make a list of results
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 502
void CCmdBtsvc::DoListServiceL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 503
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 504
TInt VerboseLevel = iVerbose.Count();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 505
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 506
if (VerboseLevel >= 2)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 507
Printf(_L("calling CBtServicesEng::NewL() ...\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 508
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 509
iEngine = CBtServicesEng::NewL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 510
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 511
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 512
if (VerboseLevel >= 2)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 513
Printf(_L("calling CBtServicesEng::SetView()... iEngine=0x%08x\r\n"),
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 514
iEngine);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 515
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 516
iEngine->SetView(this);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 517
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 518
if (VerboseLevel >= 2)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 519
Printf(_L("calling CBtServicesEng::CancelSdpAgent()...\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 520
iEngine->CancelSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 521
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 522
if (VerboseLevel >= 2)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 523
Printf(_L("calling CBtServicesEng::DeleteSdpAgent()...\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 524
iEngine->DeleteSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 525
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 526
TInt err = iEngine->BluetoothReady();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 527
LeaveIfErr(err, _L("Bluetooth not ready"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 528
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 529
TBTDeviceName Name;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 530
TBTDevAddr BDAddr;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 531
TBTDeviceClass DevClass;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 532
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 533
SelectBTDeviceL(Name, BDAddr, DevClass);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 534
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 535
//see if user has specified a UUID filter
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 536
if (iOptUuidFilter && iOptUuidFilter->Length())
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 537
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 538
TUint32 uuid;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 539
if ((iOptUuidFilter->Left(2))==_L("0x"))
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 540
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 541
TLex lex(*iOptUuidFilter);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 542
lex.SkipAndMark(2);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 543
err = lex.Val(uuid, EHex);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 544
if (err==KErrNone)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 545
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 546
iEngine->SetUUIDFilterL(uuid);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 547
goto QueryService;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 548
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 549
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 550
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 551
//the UUID could be in string form.
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 552
TBool Match = iEngine->StringToUUID(*iOptUuidFilter, uuid);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 553
if (Match==EFalse)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 554
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 555
Printf(_L("UUID filter not recognised. Ignored\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 556
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 557
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 558
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 559
QueryService:
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 560
iEngine->NewDeviceSelectedL(BDAddr, Name);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 561
iActiveWait->Start();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 562
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 563
iEngine->MakeTextServiceList();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 564
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 565
//test code: just to test if attributes query is OK
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 566
//iEngine->GetAttributesL(0);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 567
//iActiveWait->Start();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 568
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 569
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 570
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 571
void CCmdBtsvc::DoLocalL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 572
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 573
TInt err;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 574
iEngine = CBtServicesEng::NewL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 575
iEngine->SetView(this);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 576
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 577
iEngine->CancelSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 578
iEngine->DeleteSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 579
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 580
err = iEngine->BluetoothReady();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 581
LeaveIfErr(err, _L("Bluetooth not ready"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 582
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 583
iEngine->DisplayLocalInfoL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 584
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 585
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 586
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 587
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 588
//make a list of UUID filters, values and strings
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 589
void CCmdBtsvc::DoListUuidFilterL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 590
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 591
TInt err;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 592
iEngine = CBtServicesEng::NewL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 593
iEngine->SetView(this);
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 594
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 595
iEngine->CancelSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 596
iEngine->DeleteSdpAgent();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 597
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 598
err = iEngine->BluetoothReady();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 599
LeaveIfErr(err, _L("Bluetooth not ready"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 600
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 601
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 602
iEngine->MakeTextUUIDList();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 603
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 604
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 605
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 606
EXE_BOILER_PLATE(CCmdBtsvc)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 607
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 608
#ifdef SUPPORT_ONOFF
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 609
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 610
TBool CCmdBtsvc::GetPowerStateL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 611
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 612
if (!iSettings)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 613
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 614
TRAPL(iSettings = CBTEngSettings::NewL(NULL), _L("Couldn't construct CBTEngSettings"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 615
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 616
TBTPowerStateValue state;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 617
LeaveIfErr(iSettings->GetPowerState(state), _L("Couldn't read BT power state"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 618
return state == EBTPowerOn;
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 619
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 620
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 621
void CCmdBtsvc::ShowStatusL()
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 622
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 623
if (GetPowerStateL())
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 624
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 625
Printf(_L("Bluetooth is enabled.\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 626
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 627
else
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 628
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 629
Printf(_L("Bluetooth is disabled.\r\n"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 630
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 631
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 632
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 633
void CCmdBtsvc::SetEnabledL(TBool aEnable)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 634
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 635
TBool on = GetPowerStateL();
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 636
if (on && !aEnable)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 637
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 638
LeaveIfErr(iSettings->SetPowerState(EBTPowerOff), _L("Couldn't set power state"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 639
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 640
else if (!on && aEnable)
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 641
{
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 642
LeaveIfErr(iSettings->SetPowerState(EBTPowerOn), _L("Couldn't set power state"));
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 643
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 644
}
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 645
7f656887cf89
First submission to Symbian Foundation staging server.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
+ − 646
#endif