sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <ups/fingerprint.h>
|
sl@0
|
20 |
#include <ups/upsconst.h>
|
sl@0
|
21 |
#include <ups/upserr.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
using namespace UserPromptService;
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
EXPORT_C CFingerprint* CFingerprint::NewL(const TDesC8& aFingerprint, const TDesC& aDescription)
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
Creates a new fingerprint object.
|
sl@0
|
29 |
@param aFingerprint An 8-bit descriptor containing the raw fingerprint data.
|
sl@0
|
30 |
@param aDescription A human readable description of the fingerprint.
|
sl@0
|
31 |
@return A pointer to the new fingerprint object.
|
sl@0
|
32 |
@leave KErrUpsBadFingerprintLength if the fingerprint is empty or exceeds
|
sl@0
|
33 |
KUpsMaxFingerprintLength bytes in length.
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
{
|
sl@0
|
36 |
CFingerprint* self = CFingerprint::NewLC(aFingerprint, aDescription);
|
sl@0
|
37 |
CleanupStack::Pop(self);
|
sl@0
|
38 |
return self;
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
EXPORT_C CFingerprint* CFingerprint::NewLC(const TDesC8& aFingerprint, const TDesC& aDescription)
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
Creates a new fingerprint object.
|
sl@0
|
44 |
@param aFingerprint An 8-bit descriptor containing the raw fingerprint data.
|
sl@0
|
45 |
@param aDescription A human readable description of the fingerprint.
|
sl@0
|
46 |
@return A pointer to the new fingerprint object.
|
sl@0
|
47 |
@leave KErrUpsBadFingerprintLength if the fingerprint is empty or exceeds
|
sl@0
|
48 |
KUpsMaxFingerprintLength bytes in length.
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
{
|
sl@0
|
51 |
CFingerprint* self = new(ELeave) CFingerprint();
|
sl@0
|
52 |
CleanupStack::PushL(self);
|
sl@0
|
53 |
self->ConstructL(aFingerprint, aDescription);
|
sl@0
|
54 |
return self;
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
void CFingerprint::ConstructL(const TDesC8& aFingerprint, const TDesC& aDescription)
|
sl@0
|
58 |
/**
|
sl@0
|
59 |
Second phase constructor
|
sl@0
|
60 |
@param aFingerprint The raw fingerprint data.
|
sl@0
|
61 |
@param aDescription A description of the fingerprint data.
|
sl@0
|
62 |
@leave KErrUpsBadFingerprintLength if the fingerprint exceeds
|
sl@0
|
63 |
KUpsMaxFingerprintLength bytes in length.
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
{
|
sl@0
|
66 |
if (aFingerprint.Length() > KUpsMaxFingerprintLength)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
User::Leave(KErrUpsBadFingerprintLength);
|
sl@0
|
69 |
}
|
sl@0
|
70 |
iFingerprint = aFingerprint.AllocL();
|
sl@0
|
71 |
iDescription = aDescription.AllocL();
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
EXPORT_C const TDesC8& CFingerprint::Fingerprint() const
|
sl@0
|
75 |
/**
|
sl@0
|
76 |
Gets the raw fingerprint data.
|
sl@0
|
77 |
@return An 8-bit descriptor containing the raw fingerprint data.
|
sl@0
|
78 |
*/
|
sl@0
|
79 |
{
|
sl@0
|
80 |
return *iFingerprint;
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
EXPORT_C const TDesC& CFingerprint::Description() const
|
sl@0
|
84 |
/**
|
sl@0
|
85 |
Gets the description of the fingerprint.
|
sl@0
|
86 |
@return A 16-bit description containing the description of the fingerprint.
|
sl@0
|
87 |
*/
|
sl@0
|
88 |
{
|
sl@0
|
89 |
return *iDescription;
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
CFingerprint::CFingerprint()
|
sl@0
|
93 |
/**
|
sl@0
|
94 |
Constructor
|
sl@0
|
95 |
*/
|
sl@0
|
96 |
{
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
CFingerprint::~CFingerprint()
|
sl@0
|
100 |
/**
|
sl@0
|
101 |
Destructor
|
sl@0
|
102 |
*/
|
sl@0
|
103 |
{
|
sl@0
|
104 |
delete iFingerprint;
|
sl@0
|
105 |
delete iDescription;
|
sl@0
|
106 |
}
|