uiacceltk/hitchcock/goommonitor/src/goomconfigparser.cpp
branchRCL_3
changeset 11 46927d61fef3
parent 3 d8a3531bc6b8
child 60 5dafecb0892a
equal deleted inserted replaced
10:88b23e2e82e1 11:46927d61fef3
    55 KGOomErrBadOrMissingPriorityInAppCloseConfig,
    55 KGOomErrBadOrMissingPriorityInAppCloseConfig,
    56 KGOomErrBadLowThresholdValueForAppConfig,
    56 KGOomErrBadLowThresholdValueForAppConfig,
    57 KGOomErrBadGoodThresholdValueForAppConfig,
    57 KGOomErrBadGoodThresholdValueForAppConfig,
    58 KGOomErrBadTargetFreeValueForAppConfig,
    58 KGOomErrBadTargetFreeValueForAppConfig,
    59 KGOomErrBadSkipPluginValueForAppConfig,
    59 KGOomErrBadSkipPluginValueForAppConfig,
       
    60 KGOomErrBadUseSwRenderingValueForAppConfig,
    60 KGOomErrSystemPluginSettingsMustComeAfterAppCloseSettings,
    61 KGOomErrSystemPluginSettingsMustComeAfterAppCloseSettings,
    61 KGOomErrAppPluginSettingsMustComeAfterSystemPluginSettings,
    62 KGOomErrAppPluginSettingsMustComeAfterSystemPluginSettings,
    62 KGOomErrAppPluginIdleTimeRulesMustComeAfterAppPluginSettings,
    63 KGOomErrAppPluginIdleTimeRulesMustComeAfterAppPluginSettings,
    63 KGOomErrBadOrMissingUidInAppCloseConfig,
    64 KGOomErrBadOrMissingUidInAppCloseConfig,
    64 KGOomErrBadOrMissingUidInSystemPluginConfig,
    65 KGOomErrBadOrMissingUidInSystemPluginConfig,
    78 KGOomErrBadPluginWaitTime,
    79 KGOomErrBadPluginWaitTime,
    79 KGOomErrBadXml,
    80 KGOomErrBadXml,
    80 KGOomErrAppCloseIdleRuleOutsideAppCloseElement,
    81 KGOomErrAppCloseIdleRuleOutsideAppCloseElement,
    81 KGOomErrForegroundAppRuleOutsideAppCloseElement,
    82 KGOomErrForegroundAppRuleOutsideAppCloseElement,
    82 KGOomErrPluginIdleRuleOutsideAppPluginElement,
    83 KGOomErrPluginIdleRuleOutsideAppPluginElement,
    83 KGOomErrPluginForegroundRuleOutsidePluginElement
    84 KGOomErrPluginForegroundRuleOutsidePluginElement,
       
    85 KGOomErrInvalidSwRendConfig
    84 };
    86 };
    85 
    87 
    86 
    88 
    87 const TInt KGOomXmlFileBufferSize = 1024;
    89 const TInt KGOomXmlFileBufferSize = 1024;
    88 
    90 
   125 _LIT8(KGOomAttributeDefaultWaitAfterPlugin, "default_wait_after_plugin");
   127 _LIT8(KGOomAttributeDefaultWaitAfterPlugin, "default_wait_after_plugin");
   126 
   128 
   127 //App specific
   129 //App specific
   128 _LIT8(KGOomAttributeTargetFreeOnStartup, "target_free_on_startup");
   130 _LIT8(KGOomAttributeTargetFreeOnStartup, "target_free_on_startup");
   129 _LIT8(KGOomAttributeSkipPlugin, "skip_plugin");
   131 _LIT8(KGOomAttributeSkipPlugin, "skip_plugin");
       
   132 _LIT8(KGOomAttributeUseSwRendering, "use_sw_rend");
       
   133 _LIT8(KGOomConfigUseSwRend, "Yes");
       
   134 _LIT8(KGOomConfigNotUseSwRend, "No");
   130 
   135 
   131 // System plugins 
   136 // System plugins 
   132 
   137 
   133 _LIT8(KGOomAttributeSystemPluginSettings, "system_plugin_settings");
   138 _LIT8(KGOomAttributeSystemPluginSettings, "system_plugin_settings");
   134 _LIT8(KGOomAttributeSystemPlugin, "system_plugin");
   139 _LIT8(KGOomAttributeSystemPlugin, "system_plugin");
   170 _LIT8(KGOomConfigDefaultPluginUid, "DEFAULT_PLUGIN");
   175 _LIT8(KGOomConfigDefaultPluginUid, "DEFAULT_PLUGIN");
   171 _LIT8(KGOomConfigTargetAppValue, "TARGET_APP");
   176 _LIT8(KGOomConfigTargetAppValue, "TARGET_APP");
   172 
   177 
   173 _LIT8(KGOomConfigBusyAppUid, "BUSY_APP");
   178 _LIT8(KGOomConfigBusyAppUid, "BUSY_APP");
   174 _LIT8(KGOomConfigHighPriorityAppUid, "HIGH_PRIORITY_APP");
   179 _LIT8(KGOomConfigHighPriorityAppUid, "HIGH_PRIORITY_APP");
       
   180 
       
   181 _LIT8(KGOomAttibuteSwRend, "sw_rend");
       
   182 _LIT8(KGOomConfigSwRendSupported, "supported");
       
   183 _LIT8(KGOomConfigSwRendNotSupported, "not_supported");
   175 
   184 
   176 CGOomConfigParser::CGOomConfigParser(CGOomConfig& aConfig, RFs& aFs) : iConfig(aConfig), iFs(aFs), iState(EGOomParsingStateNone)
   185 CGOomConfigParser::CGOomConfigParser(CGOomConfig& aConfig, RFs& aFs) : iConfig(aConfig), iFs(aFs), iState(EGOomParsingStateNone)
   177     {
   186     {
   178     }
   187     }
   179 
   188 
   499             
   508             
   500             if (err != KErrNone)
   509             if (err != KErrNone)
   501                 ConfigError(KGOomErrBadSkipPluginValueForAppConfig);
   510                 ConfigError(KGOomErrBadSkipPluginValueForAppConfig);
   502             }
   511             }
   503                 
   512                 
   504     
   513         // Get the software rendering config
       
   514         if (err == KErrNone)
       
   515             {
       
   516             TPtrC8 swrendString;
       
   517             TInt err = GetValueFromAttributeList(aAttributes, KGOomAttributeUseSwRendering, swrendString);
       
   518             if (err == KErrNone)
       
   519                 {
       
   520                 if (swrendString == KGOomConfigUseSwRend)
       
   521                     {
       
   522                     TRACES1("Sw Rend configured for App %x", uid); 
       
   523                     appConfig->iUseSwRendering = ETrue;
       
   524                     }
       
   525                 else
       
   526                     {
       
   527                     appConfig->iUseSwRendering = EFalse;
       
   528                     }
       
   529                 }
       
   530             else if (err == KErrNotFound)
       
   531                 {
       
   532                 err = KErrNone;
       
   533                 appConfig->iUseSwRendering = EFalse;
       
   534                 }
       
   535             
       
   536             if (err != KErrNone)
       
   537                 ConfigError(KGOomErrBadUseSwRenderingValueForAppConfig);
       
   538             }
       
   539         
   505     // Add the applciation config to the main config
   540     // Add the applciation config to the main config
   506     if ((err == KErrNone) && (appConfig))
   541     if ((err == KErrNone) && (appConfig))
   507         {
   542         {
   508         iConfig.AddApplicationConfigL(appConfig);
   543         iConfig.AddApplicationConfigL(appConfig);
   509         }
   544         }
   770      
   805      
   771      if (err == KErrNone)
   806      if (err == KErrNone)
   772          {
   807          {
   773          // Get the config for the sync mode for this plugin (if one is specified) and set it
   808          // Get the config for the sync mode for this plugin (if one is specified) and set it
   774          SetPluginSyncMode(aAttributes, *pluginConfig);
   809          SetPluginSyncMode(aAttributes, *pluginConfig);
       
   810         
       
   811          TPtrC8 swrendString;
       
   812          TInt err = GetValueFromAttributeList(aAttributes, KGOomAttibuteSwRend, swrendString);
       
   813          if (err == KErrNone)
       
   814              {
       
   815              if (swrendString == KGOomConfigSwRendSupported)
       
   816                  pluginConfig->SetSwRend(ETrue);
       
   817              else if (swrendString == KGOomConfigSwRendNotSupported)
       
   818                  pluginConfig->SetSwRend(EFalse);
       
   819              else
       
   820                  ConfigError(KGOomErrInvalidSwRendConfig);
       
   821              }
       
   822          
   775          }
   823          }
   776 
   824           
   777      iConfig.AddPluginConfigL(pluginConfig);
   825      iConfig.AddPluginConfigL(pluginConfig);
   778      
   826      
   779      CleanupStack::Pop(pluginConfig);
   827      CleanupStack::Pop(pluginConfig);
   780     }
   828     }
   781 
   829