|
1 /* |
|
2 * Copyright (c) 2002 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: Used to check if sending of bio message is supported. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <coemain.h> |
|
22 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR |
|
23 #include <barsread.h> |
|
24 #include <sendnorm.rsg> |
|
25 #include "CBioMsgBlacklist.h" |
|
26 |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KLoopStartIndex = 0; |
|
30 const TInt KBioMsgArrayGranularity = 4; |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS ============================== |
|
34 |
|
35 |
|
36 // --------------------------------------------------------- |
|
37 // CBioMsgBlacklist::NewL |
|
38 // |
|
39 // --------------------------------------------------------- |
|
40 // |
|
41 CBioMsgBlacklist* CBioMsgBlacklist::NewL(CCoeEnv* aCoeEnv ) |
|
42 { |
|
43 CBioMsgBlacklist* self = new (ELeave) CBioMsgBlacklist( aCoeEnv ); |
|
44 CleanupStack::PushL( self ); |
|
45 self->ConstructL(); |
|
46 |
|
47 CleanupStack::Pop( self ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // CBioMsgBlacklist::~CBioMsgBlacklist |
|
54 // |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 CBioMsgBlacklist::~CBioMsgBlacklist( ) |
|
58 { |
|
59 delete iBioMsgBlacklistArray; |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------- |
|
64 // CBioMsgBlacklist::CBioMsgBlacklist |
|
65 // |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 CBioMsgBlacklist::CBioMsgBlacklist( CCoeEnv* aCoeEnv ) |
|
69 : |
|
70 iCoeEnv( aCoeEnv ) |
|
71 { |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // CBioMsgBlacklist::ConstructL |
|
77 // |
|
78 // --------------------------------------------------------- |
|
79 // |
|
80 void CBioMsgBlacklist::ConstructL() |
|
81 { |
|
82 iBioMsgBlacklistArray = new ( ELeave ) CArrayFixFlat<TInt32>( KBioMsgArrayGranularity ); |
|
83 |
|
84 TResourceReader reader; |
|
85 iCoeEnv->CreateResourceReaderLC( reader, R_BIOMSGBLACKLIST_ARRAY ); |
|
86 const TInt count = reader.ReadInt16(); |
|
87 for ( TInt loop = KLoopStartIndex; loop < count; loop++ ) |
|
88 { |
|
89 iBioMsgBlacklistArray->AppendL( reader.ReadInt32() ); |
|
90 } |
|
91 CleanupStack::PopAndDestroy( /*&reader*/ ); |
|
92 } |
|
93 |
|
94 |
|
95 |
|
96 // --------------------------------------------------------- |
|
97 // CBioMsgBlacklist::CanSendBioMsg |
|
98 // |
|
99 // --------------------------------------------------------- |
|
100 // |
|
101 TBool CBioMsgBlacklist::CanSendBioMsg( TUid aBioMessageUid ) |
|
102 { |
|
103 if ( aBioMessageUid.iUid != 0 ) |
|
104 { |
|
105 const TInt count = iBioMsgBlacklistArray->Count(); |
|
106 for ( TInt loop = KLoopStartIndex; loop < count; loop++ ) |
|
107 { |
|
108 if ( (*iBioMsgBlacklistArray)[loop] == aBioMessageUid.iUid ) |
|
109 { |
|
110 return EFalse; |
|
111 } |
|
112 } |
|
113 } |
|
114 return ETrue; |
|
115 } |
|
116 |
|
117 // End of file |