TInt CMediaClientWsEventObserver::FocusWindowGroupId(TInt& aFocusGroupId) { DEBUG_PRINTF("CMediaClientWsEventObserver::FocusWindowGroupId +++"); aFocusGroupId = iWgId; DEBUG_PRINTF3("CMediaClientWsEventObserver::FocusWindowGroupId --- WgId %d, Error %d", iWgId, iWgIdError); return iWgIdError; }
OMX_ERRORTYPE CSymbianOmxComponentLoader::LoadComponent( OMX_HANDLETYPE* pHandle, OMX_STRING cComponentName, OMX_PTR pAppData, OMX_CALLBACKTYPE* pCallBacks) { TInt index; TPtrC8 lComponentName(reinterpret_cast<TUint8 *>(cComponentName), strlen(cComponentName)); COmxILComponentIf* component = NULL; OMX_ERRORTYPE error = OMX_ErrorComponentNotFound; const TInt KComponentNameListCount = iComponentNameList.Count(); for( index = 0; index < KComponentNameListCount; ++index ) { TOmxComponentInfo& comp = iComponentNameList[index]; DEBUG_PRINTF3(_L8("CSymbianOmxComponentLoader::LoadComponent : comp [%index] [%S]"), index, &comp.iComponentName); if( comp.iComponentName.CompareF(lComponentName) == 0 ) { TRAPD(err, component = COmxILComponentIf::CreateImplementationL(iComponentNameList[index].iUid)); if( err != KErrNone ) { if ( err == KErrNoMemory ) { return OMX_ErrorInsufficientResources; } else { return OMX_ErrorInvalidComponent; } } *pHandle = component->Handle(); if( !*pHandle ) { return OMX_ErrorInvalidComponent; } error = (static_cast<OMX_COMPONENTTYPE*>(*pHandle))->SetCallbacks(*pHandle, pCallBacks, pAppData); if(error != OMX_ErrorNone) { (static_cast<OMX_COMPONENTTYPE*>(*pHandle))->ComponentDeInit(*pHandle); delete component; return error; } if( iComponents.Append(component) != KErrNone ) { (static_cast<OMX_COMPONENTTYPE*>(*pHandle))->ComponentDeInit(*pHandle); delete component; return OMX_ErrorInsufficientResources; } return error; } } return error; }
OMX_ERRORTYPE COmxILComponentImpl::SetConfig( OMX_HANDLETYPE aComponent, OMX_INDEXTYPE aIndex, OMX_PTR aComponentConfigStructure) { DEBUG_PRINTF3(_L8("COmxILComponentImpl::SetConfig : Handle[%X]; ConfigIndex[0x%X]"), aComponent, aIndex); OMX_ERRORTYPE omxError; omxError = (static_cast<COmxILFsm*> ((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))-> SetConfig(aIndex, const_cast<const TAny*>(aComponentConfigStructure)); return omxError; }
COmxILComponentImpl::COmxILComponentImpl(COmxILComponent* aComponent, OMX_HANDLETYPE aHandle) : ipComponent(aComponent), iComponentName(0), ipHandle(static_cast<OMX_COMPONENTTYPE*>(aHandle)), ipAppData(0), ipCallbacks(0), ipFsm(0), ipConfigManager(0), ipCallbackManager(0), ipPortManager(0), ipProcessingFunction(0) { DEBUG_PRINTF3(_L8("COmxILComponentImpl::COmxILComponentImpl : Comp[%X], Handle[%X]"), aComponent, ipHandle); }
OMX_ERRORTYPE COmxILComponentImpl::GetParameter( OMX_HANDLETYPE aComponent, OMX_INDEXTYPE aParamIndex, OMX_PTR aComponentParameterStructure) { DEBUG_PRINTF3(_L8("COmxILComponentImpl::GetParameter : Handle[%X]; ParamIndex[0x%X]"), aComponent, aParamIndex); OMX_ERRORTYPE omxError; omxError = (static_cast<COmxILFsm*> ((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))-> GetParameter(aParamIndex, aComponentParameterStructure); return omxError; }
APIRET EXPENTRY FS_FILEINFO ( USHORT flag, struct sffsi *psffsi, struct sffsd *psffsd, USHORT level, PCHAR pData, USHORT cbData, USHORT IOflag ) /* not used */ { int rc; POPENFILE pOpenfile; DIRENTRY Entry; UtilEnterRamfs(); DEBUG_PRINTF3 ("FS_FILEINFO sfn=%d, flag=%d, level=%d", psffsi->sfi_selfsfn, flag, level); pOpenfile = psffsd->pOpenfile; if (pOpenfile == NULL || pOpenfile->flatEntry == NULL) { /* Volume already detached */ rc = ERROR_FILE_NOT_FOUND; goto end; } VMRead (&Entry, pOpenfile->flatEntry, sizeof(Entry)-CCHMAXPATHCOMP); if (flag == 0) { /* retrieve information */ rc = InfoQuery (pData, cbData, level, &Entry); } else { /* set information */ rc = InfoSet (pData, cbData, level, &Entry, psffsi); if (rc == NO_ERROR) VMWrite (pOpenfile->flatEntry, &Entry, sizeof(Entry)-CCHMAXPATHCOMP); } end: DEBUG_PRINTF1 (" => %d\r\n", rc); UtilExitRamfs(); return rc; }
void CMediaClientWsEventObserver::ConstructL() { DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL +++"); DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWsSession Connect"); TInt err = iWs.Connect(); if (err != KErrNone) { DEBUG_PRINTF2("CMediaClientWsEventObserver::ConstructL Windows Server unavailable, err %d", err); User::Leave(err); } DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWindowGroup Create"); iWindowGroup = RWindowGroup(iWs); User::LeaveIfError(iWindowGroup.Construct((TUint32)this, EFalse)); // Send created window to the background and hide it from the // application switcher iWindowGroup.SetOrdinalPosition( -1, -1000 ); // -1000 = ECoeWinPriorityNeverAtFront DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWindowGroup EnableFocusChangeEvents"); User::LeaveIfError(iWindowGroup.EnableFocusChangeEvents()); UpdateFocusWindowGroupId(ETrue); DEBUG_PRINTF3("CMediaClientWsEventObserver::ConstructL Initial WgId %d Error %d", iWgId, iWgIdError); CActiveScheduler::Add(this); // register with window server to receive focus change notifications DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL iWs.EventReady()"); iWs.EventReady(&iStatus); DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL SetActive()"); SetActive(); DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL ---"); }
void IntegrityDeleteFileL(const TDesC& aPath, CIntegrityTreeLeaf* aLeaf, RFs& aFs, RLoader& aLoader, CFileMan& aFileMan) { _LIT(KSysBin, "\\sys\\bin"); RBuf name; name.CreateL(aPath, KMaxFileName); CleanupClosePushL(name); name.Append(aLeaf->Name()); TEntry entry; TInt err = aFs.Entry(name, entry); if (err == KErrNone) { aFs.SetAtt(name, 0, KEntryAttReadOnly); if(entry.IsDir()) { // Make sure to append slash before calling RmDir - otherwise it deletes the parent directory if (name[name.Length()-1] != KPathDelimiter) { name.Append(KPathDelimiter); } User::LeaveIfError(aFileMan.RmDir(name)); } else { if ( aLeaf->Type() == EBackupFile ) // Implies a commit operation is in progress { if ( IsBinary(entry) ) { // Forming the file name so the renamed file can be under sys/bin // for special delete mechanism using RLoader::Delete RBuf tmpName; TParsePtrC fileName(name); tmpName.CreateL(name.Length() + KSysBin.iTypeLength); CleanupClosePushL(tmpName); tmpName.Append(fileName.Drive()); tmpName.Append(KSysBin); tmpName.Append(fileName.Path()); tmpName.Append(fileName.NameAndExt()); DEBUG_PRINTF3(_L("Integrity Services - Renaming %S to %S"), &name, &tmpName); aFileMan.Rename(name,tmpName,CFileMan::EOverWrite); User::LeaveIfError(aLoader.Delete(tmpName)); // Using RLoader delete for paged binaries DEBUG_PRINTF2(_L("Integrity Services - Deleted renamed file %S"), &tmpName); // prune the directory tree if possible RemoveDirectoryTreeL(aFs, tmpName); CleanupStack::PopAndDestroy(&tmpName); } else { User::LeaveIfError(aFileMan.Delete(name)); } } else { // Need to use RLoader Delete which can be used during deletion of Added files during Rollback User::LeaveIfError(aLoader.Delete(name)); } } // prune the directory tree if possible RemoveDirectoryTreeL(aFs, name); } else if(err != KErrNotFound && err != KErrPathNotFound) { DEBUG_PRINTF3(_L("Integrity Services - error %d removing %S"), err, &name); User::Leave(err); } else { DEBUG_PRINTF3(_L("Integrity Services - error %d removing %S"), err, &name); // Check for any renamed files to move it to sys/bin for special delete mechanism RBuf tmpName; TParsePtrC fileName(name); tmpName.CreateL(name.Length() + KSysBin.iTypeLength); CleanupClosePushL(tmpName); tmpName.Append(fileName.Drive()); tmpName.Append(KSysBin); tmpName.Append(fileName.Path()); tmpName.Append(fileName.NameAndExt()); DEBUG_PRINTF2(_L("Integrity Services - Removing %S renamed binary files if any"), &tmpName); aLoader.Delete(tmpName); // prune the directory tree if possible RemoveDirectoryTreeL(aFs, tmpName); CleanupStack::PopAndDestroy(&tmpName); } CleanupStack::PopAndDestroy(&name); }
//计算角色在地图上的当前位置,并整理移动路径 // 剔除移动路径中已走过的关键点 // 并把当前位置作为新移动路径的第一个关键点 //@return 0 成功 非0 失败 int Creature::CalcCurrPos() { UInt32 uiTime = time(NULL); double dSpeed = ROLE_MOVE_SPEED*10/1000.0; //速度, dSpeed 单位: 格/秒, _moveSpeed单位: 微型格/0.1秒 // 其中 1格子=1000微型格 double dDistance = 0; //用户从起始时间到当前时间的理论累计行程 double dDisLeft = 0.0; ArchvPosition tmpPos1; ArchvPosition tmpPos2; double dPosDis; //坐标间距离 int iCalcFlag = 0; //计算标志, 为1说明角色仍在行走,需根据比例计算当前位置 int iCount = 0; //走过关键点的个数 /*DEBUG_PRINTF3( "1111111 ,Route.listPos.size()[%d], uiTime[%ld], _attrGeneral._route.time[%ld] \n", _attrGeneral._route.listPos.size(), uiTime, (long)_attrGeneral._route.time );*/ /*LOG(LOG_DEBUG,__FILE__,__LINE__,"-direct[%d],pos.X[%d],pos.Y[%d] ", _attrGeneral._direct, _attrGeneral._pos.X, _attrGeneral._pos.Y );*/ //关键坐标的数量 if( _attrGeneral._route.listPos.size() <=1 || uiTime <= _attrGeneral._route.time ) return 0; //计算用户累计行程 dDistance = ( time(NULL) - _attrGeneral._route.time ) * dSpeed; DEBUG_PRINTF1( "2222222 ,dDistance[%f] \n", dDistance ); if( dDistance <= 0.0 ) return 0; //计算用户当前坐标 List<ArchvPosition>::iterator it; tmpPos1 = *(_attrGeneral._route.listPos.begin()); tmpPos2 = *(_attrGeneral._route.listPos.begin()); dDisLeft = dDistance; for( it = _attrGeneral._route.listPos.begin(); it != _attrGeneral._route.listPos.end(); it++ ) { iCount++; //第一个略过 if( it == _attrGeneral._route.listPos.begin() ) continue; tmpPos2 = *(it); dPosDis = CalcPosDistance( tmpPos1, tmpPos2, _attrGeneral._direct ); if( (dPosDis - dDisLeft ) >= 0.1 ) { iCalcFlag = 1; break; } dDisLeft -= dPosDis; tmpPos1 = *(it); } //角色是否仍在行走 if( 1 == iCalcFlag ) { //角色仍在行走,根据比例计算当前位置 _attrGeneral._pos.X = tmpPos1.X + (Int16)(( dDisLeft/dPosDis )*( tmpPos2.X - tmpPos1.X )); _attrGeneral._pos.Y = tmpPos1.Y + (Int16)(( dDisLeft/dPosDis )*( tmpPos2.Y - tmpPos1.Y )); //剔除走过的关键点 iCount--; List<ArchvPosition>::iterator it; for( int i = 0; i < iCount; i++ ) { it = _attrGeneral._route.listPos.begin(); _attrGeneral._route.listPos.erase(it); } //当前位置作为新移动路径的第一个关键点 it = _attrGeneral._route.listPos.begin(); _attrGeneral._route.time = time(NULL); //当前时间 _attrGeneral._route.listPos.insert( it, _attrGeneral._pos ); DEBUG_PRINTF6( "333333 , dDisLeft[%f], dPosDis[%f], tmpPos1.X[%d], tmpPos1.Y[%d]; tmpPos2.X[%d], tmpPos2.Y[%d]; \n", dDisLeft, dPosDis, tmpPos1.X, tmpPos1.Y, tmpPos2.X, tmpPos2.Y ); DEBUG_PRINTF3( "4444 ,direct[%d],pos.X[%d],pos.Y[%d] \n", _attrGeneral._direct, _attrGeneral._pos.X, _attrGeneral._pos.Y ); } else { //角色不再移动,停在最后一个关键点 _attrGeneral._pos.X = tmpPos2.X; _attrGeneral._pos.Y = tmpPos2.Y; //整理移动路径 ArchvPosition posTmp = _attrGeneral._route.listPos.back(); _attrGeneral._route.time = time(NULL); //当前时间 _attrGeneral._route.listPos.clear(); _attrGeneral._route.listPos.push_back(posTmp); //仅保留最后一个关键点 DEBUG_PRINTF3( "5555 ,direct[%d],pos.X[%d],pos.Y[%d] \n", _attrGeneral._direct, _attrGeneral._pos.X, _attrGeneral._pos.Y ); } return 0; }