コード例 #1
0
/** Create the module information depending on module id(i'e either agps_manager or network location manager) 
    Fills a module info class/structure with values depending on the module id. 

    @param  aModuleId       module id within the ini file
    @param  aModInfo		The modified module info structure.
*/
EXPORT_C void T_LbsUtils::Create_ModuleInfoL(TPositionModuleId aModuleId, TPositionModuleInfo& aModInfo)

	{  
	   TPositionQuality posQuality;
	
	// Use these values if the module is a-gps manager 
		if (aModuleId == (TUid::Uid(APGS_MODINFO_MODULE_ID)))
		 {
		 aModInfo.SetModuleId(TUid::Uid(APGS_MODINFO_MODULE_ID));
	     aModInfo.SetIsAvailable(AGPS_MODINFO_IS_AVAILABLE);
	     aModInfo.SetModuleName(AGPS_MODINFO_MOD_NAME);
	     aModInfo.SetTechnologyType(AGPS_MODINFO_TECHNOLOGY_TYPE);
	     aModInfo.SetDeviceLocation(AGPS_MODINFO_DEVICE_LOCATION);
	     aModInfo.SetCapabilities(AGPS_MODINFO_CAPABILITIES);
	      
	     // Classes Supported - this is a binary bitmap, but support for each class 
    	// has to be set individually.
		
	 	TInt supportedClasses = AGPS_MODINFO_CLASSES_SUPPORTED_POSITION_FAMILY; 
    	TPositionClassFamily currentClass = EPositionInfoFamily;
    	while(currentClass <= EPositionUpdateOptionsFamily)
        	{
        	aModInfo.SetClassesSupported(currentClass, supportedClasses & 1); 
        	supportedClasses >>= 1;
        	currentClass = static_cast<TPositionClassFamily>(static_cast<TInt>(currentClass) + 1);   		
        	}
	     	     
	     aModInfo.SetVersion(AGPS_MODINFO_VERSION);
    	 posQuality.SetTimeToFirstFix(AGPS_MODINFO_TIME_TO_FIRST_FIX);
	     posQuality.SetTimeToNextFix(AGPS_MODINFO_TIME_TO_NEXT_FIX);
    	 posQuality.SetHorizontalAccuracy(AGPS_MODINFO_HORIZONTAL_ACCURACY);
	     posQuality.SetVerticalAccuracy(AGPS_MODINFO_VERTICAL_ACCURACY);
    	 posQuality.SetCostIndicator(AGPS_MODINFO_COST_INDICATOR);
	     posQuality.SetPowerConsumption(AGPS_MODINFO_POWER_CONSUMPTION);
       	 aModInfo.SetPositionQuality(posQuality);
      	 }
コード例 #2
0
/* Read in ModuleInfo from an .ini file
*/
void CTe_LbsIniFileReader::ReadModuleInfoL(TPositionModuleInfo& aModuleInfo)
{
    TInt    intValue;
    TBool    success;

    // Technology-type - this is a binary bitmap.
    FindVar(KTechnologyTypeStr, intValue);
    TPositionModuleInfo::TTechnologyType technologyType = DecimalToBitmask(intValue);
    aModuleInfo.SetTechnologyType(technologyType);

    // Classes Supported - this is a binary bitmap, but support for each class
    // has to be set individually.
    FindVar(KClassesSupportedStr, intValue);
    TInt supportedClasses = DecimalToBitmask(intValue);

    TPositionClassFamily currentClass = EPositionInfoFamily;
    while(currentClass <= EPositionUpdateOptionsFamily)
    {
        aModuleInfo.SetClassesSupported(currentClass, supportedClasses & 1);
        supportedClasses >>= 1;
        currentClass = static_cast<TPositionClassFamily>(static_cast<TInt>(currentClass) + 1);
    }

    // Capabilities - this is a binary bitmap.
    FindVar(KCapabilitiesStr, intValue);
    TPositionModuleInfo::TCapabilities capabilities = DecimalToBitmask(intValue);
    aModuleInfo.SetCapabilities(capabilities);

    // Module Name
    TUint16* buffer = new (ELeave) TUint16[KPositionModuleMaxNameLength];
    CleanupStack::PushL(buffer);

    TPtrC16 modulePtr(reinterpret_cast<const TUint16*>(buffer),KPositionModuleMaxNameLength);
    success = FindVar(KModuleNameStr, modulePtr);

    TBuf<KPositionModuleMaxNameLength> moduleName;
    if(success)
    {
        moduleName.Copy(modulePtr);
    }
    else
    {
        moduleName.Copy(KNullDesC);
    }
    // Get rid of any delimiting " characters.
    TInt length = moduleName.Length();
    if(length > 0)
    {
        TInt lastPos = length - 1;
        TChar quote('\"');
        if(moduleName[lastPos] == quote)
        {
            moduleName.Delete(lastPos, 1);
        }
        if(modulePtr[0] == quote)
        {
            moduleName.Delete(0, 1);
        }
    }
    aModuleInfo.SetModuleName(moduleName);
    CleanupStack::PopAndDestroy(buffer);

    // Module Id
    TUid moduleUid = TUid::Uid(0);
    FindVar(KModuleIdStr,intValue);
    if(intValue>0)
    {
        moduleUid = (TUid::Uid(intValue));
    }
    aModuleInfo.SetModuleId(moduleUid);

    // Module Version
    TVersion version(0,0,0);
    FindVar(KVersionStr,version);
    aModuleInfo.SetVersion(version);

    // Device Location
    TPositionModuleInfo::TDeviceLocation deviceLocation;
    FindVar(KDeviceLocationStr,intValue);
    switch(intValue)
    {
    case 1:
        deviceLocation = TPositionModuleInfo::EDeviceInternal;
        break;
    case 2:
        deviceLocation = TPositionModuleInfo::EDeviceExternal;
        break;
    default:
        deviceLocation = TPositionModuleInfo::EDeviceUnknown;
        break;
    }
    aModuleInfo.SetDeviceLocation(deviceLocation);

    // IsAvailable - to be read from .ini file but for now ...
    aModuleInfo.SetIsAvailable(ETrue);

}