src/ext/amaretto/gps/inc/locationacqmodule.h
changeset 0 ca70ae20a155
equal deleted inserted replaced
-1:000000000000 0:ca70ae20a155
       
     1 /*
       
     2  * ====================================================================
       
     3  *  locationacqmodule.h
       
     4  *
       
     5  *  Python API to Series 60 Location Acquisition API.
       
     6  *
       
     7  * Copyright (c) 2007 Nokia Corporation
       
     8  *
       
     9  * Licensed under the Apache License, Version 2.0 (the "License");
       
    10  * you may not use this file except in compliance with the License.
       
    11  * You may obtain a copy of the License at
       
    12  *
       
    13  *     http://www.apache.org/licenses/LICENSE-2.0
       
    14  *
       
    15  * Unless required by applicable law or agreed to in writing, software
       
    16  * distributed under the License is distributed on an "AS IS" BASIS,
       
    17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    18  * See the License for the specific language governing permissions and
       
    19  * limitations under the License.
       
    20  * ====================================================================
       
    21  */
       
    22 
       
    23 #ifndef __LOCATIONACQMODULE
       
    24 #define __LOCATIONACQMODULE
       
    25 
       
    26 #include "Python.h"
       
    27 
       
    28 #include "symbian_python_ext_util.h"
       
    29 
       
    30 #include <Lbs.h> 
       
    31 #include <LbsSatellite.h> 
       
    32 
       
    33 //////////////CONSTANTS//////////////
       
    34 
       
    35 #define COURSE_INFO   0x01
       
    36 #define SATELLITE_INFO   0x02
       
    37 
       
    38 // values of requestor dictionary
       
    39 _LIT8(KServiceRequestor, "service");
       
    40 _LIT8(KContactRequestor, "contact");
       
    41 _LIT8(KApplicationFormat, "application");
       
    42 _LIT8(KTelephoneFormat, "telephone");
       
    43 _LIT8(KUrlFormat, "url");
       
    44 _LIT8(KMailFormat, "mail");
       
    45 
       
    46 //////////////CLASSES////////////////
       
    47 
       
    48 class TPyPosCallBack
       
    49   {
       
    50   public:
       
    51     TInt PositionUpdated(TPositionInfo* aPositionInfo, 
       
    52                          TInt aFlags);
       
    53   public:
       
    54     PyObject* iCb; // Not owned.
       
    55   };
       
    56 
       
    57 #ifndef EKA2
       
    58 class CPosDataFetcher:public CActive
       
    59 #else
       
    60 NONSHARABLE_CLASS(CPosDataFetcher):public CActive
       
    61 #endif
       
    62 {
       
    63 public:
       
    64 	static CPosDataFetcher* NewL(RPositioner& aPositioner);
       
    65 	~CPosDataFetcher();
       
    66 public:
       
    67 	void DoCancel();
       
    68 	void RunL();
       
    69 	TInt CreatePositionType(TInt);
       
    70 	void FetchData(TRequestStatus& aStatus, 
       
    71 	               TTimeIntervalMicroSeconds aInterval,
       
    72 	               TBool aPartial);
       
    73   void SetCallBack(TPyPosCallBack &aCb);
       
    74 private:
       
    75   RPositioner& iPositioner;
       
    76   TPositionInfo* iPositionInfo;
       
    77   TInt iFlags;
       
    78   TBool iCallBackSet;
       
    79   TBool iCancelled;
       
    80   TPyPosCallBack iCallMe;
       
    81   void ConstructL();
       
    82   CPosDataFetcher(RPositioner& aPositioner);
       
    83 };
       
    84 
       
    85 //////////////TYPE DEFINITION//////////////
       
    86 
       
    87 /*
       
    88  * PositionServer (RPositionServer).
       
    89  */
       
    90 #define PositionServer_type ((PyTypeObject*)SPyGetGlobalString("PositionServerType"))
       
    91 struct PositionServer_object {
       
    92   PyObject_VAR_HEAD
       
    93   RPositionServer* posServ; 
       
    94 };
       
    95 
       
    96 /*
       
    97  * Positioner (RPositioner).
       
    98  */
       
    99 #define Positioner_type ((PyTypeObject*)SPyGetGlobalString("PositionerType"))
       
   100 struct Positioner_object {
       
   101   PyObject_VAR_HEAD
       
   102   PositionServer_object* positionServer;
       
   103   RPositioner* positioner;
       
   104   RRequestorStack* requestorStack;
       
   105   CPosDataFetcher* dataFetcher;
       
   106   TPyPosCallBack myCallBack;
       
   107   TBool callBackSet;
       
   108   TUid  moduleid;
       
   109   TBool isSubSessionOpen;
       
   110 };
       
   111 
       
   112 //////////////MACRO DEFINITION///////////////
       
   113 
       
   114 //////////////METHODS///////////////
       
   115 
       
   116 /*
       
   117  * Create new Positioner object.
       
   118  */
       
   119 extern "C" PyObject *
       
   120 new_Positioner_object(PositionServer_object* posServ, TPositionModuleId moduleId);
       
   121 
       
   122 void deleteRequestorStack(Positioner_object *positioner);
       
   123 
       
   124 TInt opensubsession(Positioner_object *self);
       
   125 #endif