src/ext/scriptext/inc/scriptextmodule.h
changeset 0 ca70ae20a155
equal deleted inserted replaced
-1:000000000000 0:ca70ae20a155
       
     1 /* Copyright (c) 2008 - 2009 Nokia Corporation
       
     2  *
       
     3  * Licensed under the Apache License, Version 2.0 (the "License");
       
     4  * you may not use this file except in compliance with the License.
       
     5  * You may obtain a copy of the License at
       
     6  *
       
     7  *     http://www.apache.org/licenses/LICENSE-2.0
       
     8  *
       
     9  * Unless required by applicable law or agreed to in writing, software
       
    10  * distributed under the License is distributed on an "AS IS" BASIS,
       
    11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    12  * See the License for the specific language governing permissions and
       
    13  * limitations under the License.
       
    14  */
       
    15 
       
    16 #ifndef SCRIPTEXTMODULE_H_
       
    17 #define SCRIPTEXTMODULE_H_
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32cons.h>
       
    21 #include <e32hashtab.h>
       
    22 #include <string.h>
       
    23 
       
    24 #include <liwvariant.h>
       
    25 #include <liwservicehandler.h>
       
    26 #include <liwgenericparam.h>
       
    27 #include <LiwVariantType.hrh>
       
    28 
       
    29 #include <RTSecManager.h>
       
    30 #include <RTSecMgrUtility.h>
       
    31 #include <RTSecMgrScriptSession.h>
       
    32 #include <RTSecMgrCommonDef.h>
       
    33 #include "serviceerrno.h"
       
    34 #include "symbian_python_ext_util.h"
       
    35 #include <Python.h>
       
    36 
       
    37 _LIT8(KErrCode, "ErrorCode");
       
    38 _LIT8(KErrMessage, "ErrorMessage");
       
    39 _LIT8(KReturnValue, "ReturnValue");
       
    40 _LIT8(KTransactionID, "TransactionID");
       
    41 _LIT8(KLiwCancelCmd, "Cancel");
       
    42 
       
    43 #define ERROR_CODE "ErrorCode"
       
    44 #define ERROR_MSG  "ErrorMessage"
       
    45 #define RETURN_VAL "ReturnValue"
       
    46 
       
    47 class CPyPromptHandler : public MSecMgrPromptHandler
       
    48 {      
       
    49     public:
       
    50     TInt Prompt(RPromptDataList& aPromptDataList , TExecutableID /*aExecID  = KAnonymousScript*/)
       
    51     {
       
    52         for(TInt i(0);i!=aPromptDataList.Count();++i)            
       
    53             aPromptDataList[i]->SetUserSelection(RTUserPrompt_OneShot);                
       
    54         return EPromptOk;
       
    55     }
       
    56         
       
    57     void SetPromptOption(TSecMgrPromptUIOption aPromptUiOption)
       
    58     {    
       
    59     }
       
    60               
       
    61     TSecMgrPromptUIOption PromptOption() const
       
    62     {
       
    63         return RTPROMPTUI_DEFAULT;
       
    64     }
       
    65     
       
    66 };
       
    67 
       
    68 class CLiwCallback : public MLiwNotifyCallback
       
    69 {
       
    70 public:   
       
    71     static CLiwCallback* NewL();
       
    72     void ConstructL();
       
    73     void RegisterCallbackL(TInt, PyObject *);
       
    74     TInt HandleNotifyL(TInt, TInt, CLiwGenericParamList&, const CLiwGenericParamList&);
       
    75     void Reset();
       
    76     ~CLiwCallback();
       
    77 
       
    78 private:
       
    79     PyObject *iPy_callback;
       
    80     RHashMap <TInt, PyObject*> *iCallbackRegister;
       
    81     CLiwCallback();
       
    82     PyObject* GetRegisteredCallbackL(TInt);
       
    83     TInt UnregisterCallback(TInt);
       
    84 };
       
    85 #endif /*SCRIPTEXTMODULE_H_*/