|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "btsendserviceprovider.h" |
|
20 #include <btserviceapi.h> |
|
21 #include "btsssendlisthandler.h" |
|
22 #include <btfeaturescfg.h> // For Enterprise security settings |
|
23 #include <btnotif.h> // For Enterprise security notifier |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 CBtSendServiceProvider* CBtSendServiceProvider::NewL() |
|
29 { |
|
30 CBtSendServiceProvider* self = new( ELeave ) CBtSendServiceProvider(); |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop(); |
|
34 return self; |
|
35 } |
|
36 |
|
37 void CBtSendServiceProvider::ConstructL() |
|
38 { |
|
39 // Check features setting - if not completely enabled with enterprise settings then we are not allowed to send anything. |
|
40 // Fail here at the first fence, otherwise there are a number of other areas that need to be considered. |
|
41 if(BluetoothFeatures::EnterpriseEnablementL() != BluetoothFeatures::EEnabled) |
|
42 { |
|
43 RNotifier notifier; |
|
44 User::LeaveIfError(notifier.Connect()); |
|
45 CleanupClosePushL(notifier); |
|
46 User::LeaveIfError(notifier.StartNotifier(KBTEnterpriseItSecurityInfoNotifierUid, KNullDesC8)); |
|
47 CleanupStack::PopAndDestroy(¬ifier); |
|
48 |
|
49 //@TODO in old code we don't continue further what needs to be done here |
|
50 } |
|
51 iBTSendingService = CBTServiceAPI::NewL(); |
|
52 iConverter = CBTSSSendListHandler::NewL(); |
|
53 } |
|
54 |
|
55 CBtSendServiceProvider::CBtSendServiceProvider() |
|
56 { |
|
57 |
|
58 } |
|
59 |
|
60 |
|
61 CBtSendServiceProvider::~CBtSendServiceProvider() |
|
62 { |
|
63 if(iConverter) |
|
64 { |
|
65 delete iConverter; |
|
66 iConverter= NULL; |
|
67 } |
|
68 if(iBTSendingService) |
|
69 { |
|
70 delete iBTSendingService; |
|
71 iBTSendingService = NULL; |
|
72 } |
|
73 } |
|
74 |
|
75 |
|
76 int CBtSendServiceProvider::send(const QList<QVariant> &arguments) |
|
77 { |
|
78 TInt error = KErrNone; |
|
79 |
|
80 CBTServiceParameterList* parameterList = NULL; |
|
81 TRAP(error,parameterList= CBTServiceParameterList::NewL()); |
|
82 if (error) |
|
83 return error; |
|
84 iConverter->ConvertList( &arguments, parameterList); |
|
85 |
|
86 delete iConverter; |
|
87 iConverter = NULL; |
|
88 |
|
89 TRAP(error,iBTSendingService->StartSynchronousServiceL( EBTSendingService, parameterList )); |
|
90 if(error) |
|
91 return error; |
|
92 return error; |
|
93 } |