|
1 /* |
|
2 * Name : Loader.h |
|
3 * Description : |
|
4 * Project : This file is part of OpenMAR, an Open Mobile Augmented Reality browser |
|
5 * Website : http://OpenMAR.org |
|
6 * |
|
7 * Copyright (c) 2010 David Caabeiro |
|
8 * |
|
9 * All rights reserved. This program and the accompanying materials are made available |
|
10 * under the terms of the Eclipse Public License v1.0 which accompanies this |
|
11 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html |
|
12 * |
|
13 */ |
|
14 |
|
15 #ifndef LOADER_H_ |
|
16 #define LOADER_H_ |
|
17 |
|
18 #include <e32base.h> |
|
19 #include <http/MHttpTransactionCallback.h> |
|
20 #include <xml/ContentHandler.h> |
|
21 #include <xml/Parser.h> |
|
22 |
|
23 #include <EPos_CPosLandmark.h> |
|
24 |
|
25 //class CPosLandmark; |
|
26 class TCoordinate; |
|
27 class CHttpClient; |
|
28 class CEntry; |
|
29 |
|
30 class MLandmarkLoaderObserver |
|
31 { |
|
32 public: |
|
33 virtual void LandmarkLoaderOpenedL(TInt aError) = 0; |
|
34 virtual void LandmarkLoaderItemCreatedL(const CPosLandmark& aLandmark) = 0; |
|
35 }; |
|
36 |
|
37 class CLoader : public CBase, public MHTTPTransactionCallback, public Xml::MContentHandler |
|
38 { |
|
39 public: |
|
40 static CLoader* NewL(MLandmarkLoaderObserver& aObserver); |
|
41 ~CLoader(); |
|
42 |
|
43 protected: |
|
44 CLoader(MLandmarkLoaderObserver& aObserver); |
|
45 void ConstructL(); |
|
46 |
|
47 public: |
|
48 void RequestL(const TCoordinate& aPosition, TReal32 aRadius); |
|
49 |
|
50 protected: |
|
51 // From MHTTPTransactionCallback |
|
52 void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
53 TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
54 |
|
55 protected: |
|
56 // from MContentHandler |
|
57 void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode); |
|
58 void OnEndDocumentL(TInt aErrorCode); |
|
59 void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode); |
|
60 void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode); |
|
61 void OnContentL(const TDesC8& aBytes, TInt aErrorCode); |
|
62 void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode); |
|
63 void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode); |
|
64 void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode); |
|
65 void OnSkippedEntityL(const RString& aName, TInt aErrorCode); |
|
66 void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode); |
|
67 void OnError(TInt aErrorCode); |
|
68 TAny* GetExtendedInterface(const TInt32 aUid); |
|
69 |
|
70 void NotifyPOIEntryL(); |
|
71 |
|
72 private: |
|
73 MLandmarkLoaderObserver& iObserver; |
|
74 |
|
75 CHttpClient* iClient; |
|
76 Xml::CParser* iParser; |
|
77 |
|
78 CEntry* iEntry; |
|
79 |
|
80 enum TState { |
|
81 EInvalid, |
|
82 EValid |
|
83 } iState; |
|
84 }; |
|
85 |
|
86 #endif |