コード例 #1
0
ファイル: OnSipTapi.cpp プロジェクト: jkasaudhan/jn-tapi
// Virtual notify from OnSipCallStateMachine of state changes
//    virtual call will occur during Poll() method
void OnSipTapi::CallStateChange(OnSipXmppStates::CallStates state,OnSipCallStateData stateData,StateChangeReason::eOnStateChangeReason reason)
{	
	Logger::log_debug( _T("OnSipTapi::CallStateChange state=%d reason=%d"), state, reason );
	OnSipXmpp::CallStateChange( state, stateData, reason );
	// Keep event data
	OnSipTapiCall callInfo( state, stateData, reason );
	m_lstCallEvents.push_back( callInfo );
}
コード例 #2
0
void CPhoneCallMonitor::RunL()
	{
  	CTelephony::TCallStatus status = iCallStatus.iStatus;
  	
  	// use callback function to tell owner that call status has changed
  	//iCallBack.NotifyChangeInCallStatusL(status,errVal);
  	if(iStatus.Int() == KErrNone)
  	{
  	if(status == CTelephony::EStatusConnected)
  		{
		CTelephony::TRemotePartyInfoV1 remInfoUse;
  		CTelephony::TCallInfoV1		   callInfoUse;
  		CTelephony::TCallSelectionV1   callSelectionUse;
  		
  		// we are interested only voice lines
  		callSelectionUse.iLine = CTelephony::EVoiceLine;
  		// and calls that are currently connected
  		callSelectionUse.iSelect = CTelephony::EActiveCall;  //EHeldCall, EInProgressCall
  		
  		CTelephony::TRemotePartyInfoV1Pckg 	remParty(remInfoUse);
  		CTelephony::TCallInfoV1Pckg 		callInfo(callInfoUse);
  		CTelephony::TCallSelectionV1Pckg 	callSelection(callSelectionUse);
  		
  		// Some S60 devices have a bug that requires some delay in here
  		// othervise the telephone application gets "Out of Memory" error
  		User::After(100000);
  		if(KErrNone == iTelephony->GetCallInfo(callSelection,callInfo,remParty))
  			{
			if(remInfoUse.iDirection == CTelephony::EMobileOriginated) //outgoign call
				{
				iCallBack.NotifyConnectedCallStatusL(callInfoUse.iDialledParty.iTelNumber);
				}
			else   //incoming call
				{
				// if the call is mobile terminated then the remote party is the calling party.
				// TCallRemoteIdentityStatus::ERemoteIdentityUnknown, ERemoteIdentityAvailable, ERemoteIdentitySuppressed
				if(remInfoUse.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable)
					{
					iCallBack.NotifyConnectedCallStatusL(remInfoUse.iRemoteNumber.iTelNumber);
					}
				else  // private number
					{
					TBuf16<1> privNum;
					privNum.Zero();
					iCallBack.NotifyConnectedCallStatusL(privNum);
					}
				}
  			}
  		}
  	if(status == CTelephony::EStatusIdle)
  		{
		iCallBack.NotifyDisconnectedCallStatusL();
  		}
  	//iPreviousStatus = status;
  	}
	StartListeningForEvents();
	}
コード例 #3
0
bool ModifiedBeforeReadCFGTraversal::visitStmt(ShPtr<Statement> stmt) {
	ShPtr<ValueData> stmtData(va->getValueData(stmt));

	// If the variable is read, we are done.
	if (stmtData->isDirRead(var) || stmtData->mayBeIndirRead(var)) {
		wasModifiedBeforeEveryRead = false;
		stopTraversal = true;
		return false;
	}

	if (stmtData->hasCalls()) {
		bool isModifiedInAllCalls(true);
		for (auto i = stmtData->call_begin(), e = stmtData->call_end();
				i != e; ++i) {
			ShPtr<CallInfo> callInfo(cio->getCallInfo(*i,
				cfg->getCorrespondingFunction()));

			// If the variable may be read before modifying in a
			// call, we are done.
			if (!callInfo->isAlwaysModifiedBeforeRead(var)) {
				wasModifiedBeforeEveryRead = false;
				stopTraversal = true;
				return false;
			}

			if (!callInfo->isAlwaysModified(var)) {
				isModifiedInAllCalls = false;
			}
		}

		// If the variable is always modified in all the calls, we are done.
		if (isModifiedInAllCalls) {
			wasModifiedBeforeEveryRead = true;
			currRetVal = true;
			return false;
		}
	}

	// If the variable is modified, we are done.
	if (stmtData->isDirWritten(var) || stmtData->mustBeIndirWritten(var)) {
		wasModifiedBeforeEveryRead = true;
		currRetVal = true;
		return false;
	}

	return true;
}
コード例 #4
0
/**
* @brief Precomputes @c funcInfo->isAlwaysModifiedBeforeRead for @c traversedFunc.
*/
void OptimFuncInfoCFGTraversal::precomputeAlwaysModifiedVarsBeforeRead() {
	// Initialization.
	funcInfo->varsAlwaysModifiedBeforeRead.clear();
	// Global variables which are read during the computation.
	VarSet readVars;

	// Currently, we only traverse the function's body up to the first compound
	// statement. Moreover, we only consider global variables as the computed
	// piece of information is useless for local variables.
	// TODO Use a CFG traversal for this to improve the analysis.
	ShPtr<Statement> stmt(traversedFunc->getBody());
	while (stmt) {
		if (stmt->isCompound()) {
			// As we are not using a CFG traversal, this is the end of the
			// computation.
			break;
		}

		ShPtr<ValueData> stmtData(va->getValueData(stmt));

		// Handle directly read variables.
		addToSet(stmtData->getDirReadVars(), readVars);

		// Handle function calls (indirectly accessed variables).
		for (auto i = stmtData->call_begin(), e = stmtData->call_end(); i != e; ++i) {
			ShPtr<CallInfo> callInfo(cio->computeCallInfo(*i, traversedFunc));
			for (const auto &var : globalVars) {
				if (callInfo->mayBeRead(var)) {
					readVars.insert(var);
				}
			}
		}

		// Handle directly written variables.
		for (auto i = stmtData->dir_written_begin(), e = stmtData->dir_written_end();
				i != e; ++i) {
			if (hasItem(globalVars, *i) && !hasItem(readVars, *i)) {
				// This global variable is modified before read.
				funcInfo->varsAlwaysModifiedBeforeRead.insert(*i);
			}
		}

		// TODO What about indirectly accessed variables?

		stmt = stmt->getSuccessor();
	}
}
コード例 #5
0
/**
* @brief Updates @c funcInfo by the information obtained from the given
*        statement.
*/
void OptimFuncInfoCFGTraversal::updateFuncInfo(ShPtr<Statement> stmt) {
	// Update the set of variables that are read and modified in the function.
	// Currently, we put also must-be-{read,modified} variables into
	// funcInfo->mayBe{Read,Modified}Vars. The reason is that we do not perform
	// any kind of analysis which variables are truly always accessed. For
	// example, if there is an if statement in the function, its body may never
	// be entered etc.
	ShPtr<ValueData> stmtData(va->getValueData(stmt));
	addToSet(stmtData->getDirReadVars(), funcInfo->mayBeReadVars);
	addToSet(stmtData->getMayBeReadVars(), funcInfo->mayBeReadVars);
	addToSet(stmtData->getMustBeReadVars(), funcInfo->mayBeReadVars);
	addToSet(stmtData->getDirWrittenVars(), funcInfo->mayBeModifiedVars);
	addToSet(stmtData->getMayBeWrittenVars(), funcInfo->mayBeModifiedVars);
	addToSet(stmtData->getMustBeWrittenVars(), funcInfo->mayBeModifiedVars);

	// Update storedGlobalVars. If the statement writes into a variable in
	// storedGlobalVars, we have to remove it from storedGlobalVars. Indeed, we
	// require that no local variable storing a global variable is written-into,
	// just read.
	const VarSet &dirWrittenVars(stmtData->getDirWrittenVars());
	const VarSet &mayBeWrittenVars(stmtData->getMayBeWrittenVars());
	const VarSet &mustBeWrittenVars(stmtData->getMustBeWrittenVars());
	for (auto i = storedGlobalVars.begin(), e = storedGlobalVars.end();
			i != e; ++i) {
		if (hasItem(dirWrittenVars, i->second) ||
				hasItem(mayBeWrittenVars, i->second) ||
				hasItem(mustBeWrittenVars, i->second)) {
			storedGlobalVars.erase(i);
			break;
		}
	}

	// Handle function calls.
	// TODO What if a call modifies a local variable from storedGlobalVars?
	for (const auto &call : stmtData->getCalls()) {
		ShPtr<OptimCallInfo> callInfo(cast<OptimCallInfo>(
			cio->computeCallInfo(call, traversedFunc)
		));

		addToSet(callInfo->mayBeReadVars, funcInfo->mayBeReadVars);
		addToSet(callInfo->mayBeModifiedVars, funcInfo->mayBeModifiedVars);
	}
}
コード例 #6
0
/*
 * ActiveCall() detects if there's a connected call. Only in that case aNumber is meaningfull; and only 
 * in that case, if aNumber.Length() == 0, then aNumber is a private number.
 */
TBool CPhoneCallMonitor::ActiveCall(TDes& aNumber)
	{
	CTelephony::TRemotePartyInfoV1 remInfoUse;
	CTelephony::TCallInfoV1		   callInfoUse;
	CTelephony::TCallSelectionV1   callSelectionUse;
	  		
	// we are interested only voice lines
	callSelectionUse.iLine = CTelephony::EVoiceLine;
	// and calls that are currently connected
	callSelectionUse.iSelect = CTelephony::EActiveCall;  //EHeldCall, EInProgressCall
	  		
	CTelephony::TRemotePartyInfoV1Pckg 	remParty(remInfoUse);
	CTelephony::TCallInfoV1Pckg 		callInfo(callInfoUse);
	CTelephony::TCallSelectionV1Pckg 	callSelection(callSelectionUse);
	  	
	// TCallRemoteIdentityStatus::ERemoteIdentityUnknown, ERemoteIdentityAvailable, ERemoteIdentitySuppressed
	if(iTelephony->GetCallInfo(callSelection,callInfo,remParty) == KErrNone)
		{
		if(remInfoUse.iDirection == CTelephony::EMobileOriginated) //outgoing call
			{
			aNumber.Copy(callInfoUse.iDialledParty.iTelNumber);
			}
		else   //incoming call
			{
			if(remInfoUse.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable)
				{
				aNumber.Copy(remInfoUse.iRemoteNumber.iTelNumber);
				}
			else  // private number
				{
				aNumber.Zero();
				}
			}
		return ETrue;
		}
	
	return EFalse;
	}
    void JsBuiltInEngineInterfaceExtensionObject::InjectJsBuiltInLibraryCode(ScriptContext * scriptContext)
    {
        JavascriptExceptionObject *pExceptionObject = nullptr;
        if (jsBuiltInByteCode != nullptr)
        {
            return;
        }

        try {
            EnsureJsBuiltInByteCode(scriptContext);
            Assert(jsBuiltInByteCode != nullptr);

            Js::ScriptFunction *functionGlobal = scriptContext->GetLibrary()->CreateScriptFunction(jsBuiltInByteCode);

            // If we are in the debugger and doing a GetProperty of arguments, then Js Builtins code will be injected on-demand
            // Since it is a cross site call, we marshall not only functionGlobal but also its entire prototype chain
            // The prototype of functionGlobal will be shared by a normal Js function,
            // so marshalling will inadvertantly transition the entrypoint of the prototype to a crosssite entrypoint
            // So we set the prototype to null here
            functionGlobal->SetPrototype(scriptContext->GetLibrary()->nullValue);

#ifdef ENABLE_SCRIPT_PROFILING
            // If we are profiling, we need to register the script to the profiler callback, so the script compiled event will be sent.
            if (scriptContext->IsProfiling())
            {
                scriptContext->RegisterScript(functionGlobal->GetFunctionProxy());
            }
#endif

#ifdef ENABLE_SCRIPT_DEBUGGING
            // Mark we are profiling library code already, so that any initialization library code called here won't be reported to profiler.
            // Also tell the debugger not to record events during intialization so that we don't leak information about initialization.
            AutoInitLibraryCodeScope autoInitLibraryCodeScope(scriptContext);
#endif

            Js::Var args[] = { scriptContext->GetLibrary()->GetUndefined(), scriptContext->GetLibrary()->GetEngineInterfaceObject() };
            Js::CallInfo callInfo(Js::CallFlags_Value, _countof(args));

            // Clear disable implicit call bit as initialization code doesn't have any side effect
            Js::ImplicitCallFlags saveImplicitCallFlags = scriptContext->GetThreadContext()->GetImplicitCallFlags();
            scriptContext->GetThreadContext()->ClearDisableImplicitFlags();
            JavascriptFunction::CallRootFunctionInScript(functionGlobal, Js::Arguments(callInfo, args));
            scriptContext->GetThreadContext()->SetImplicitCallFlags((Js::ImplicitCallFlags)(saveImplicitCallFlags));

            Js::ScriptFunction *functionBuiltins = scriptContext->GetLibrary()->CreateScriptFunction(jsBuiltInByteCode->GetNestedFunctionForExecution(0));
            functionBuiltins->SetPrototype(scriptContext->GetLibrary()->nullValue);

            // Clear disable implicit call bit as initialization code doesn't have any side effect
            saveImplicitCallFlags = scriptContext->GetThreadContext()->GetImplicitCallFlags();
            scriptContext->GetThreadContext()->ClearDisableImplicitFlags();
            JavascriptFunction::CallRootFunctionInScript(functionBuiltins, Js::Arguments(callInfo, args));
            scriptContext->GetThreadContext()->SetImplicitCallFlags((Js::ImplicitCallFlags)(saveImplicitCallFlags));

            InitializePrototypes(scriptContext);
#if DBG_DUMP
            if (PHASE_DUMP(Js::ByteCodePhase, functionGlobal->GetFunctionProxy()) && Js::Configuration::Global.flags.Verbose)
            {
                DumpByteCode();
            }
#endif
        }
        catch (const JavascriptException& err)
        {
            pExceptionObject = err.GetAndClear();
        }

        if (pExceptionObject)
        {
            jsBuiltInByteCode = nullptr;
            if (pExceptionObject == ThreadContext::GetContextForCurrentThread()->GetPendingSOErrorObject())
            {
                JavascriptExceptionOperators::DoThrowCheckClone(pExceptionObject, scriptContext);
            }
            Js::Throw::FatalJsBuiltInError();
        }
    }