Exemple #1
0
//Returns true if given capability is available on entry to this function, or became
//available within the specified timeframe
bool awaitCallCapability (CC_CallPtr call, CC_CallCapabilityEnum::CC_CallCapability capToWaitFor, int timeoutMilliSeconds)
{
    int nTimeStart = GetTimeNow();
    int remainingTimeout = timeoutMilliSeconds;

    do
    {
        CC_CallInfoPtr info = call->getCallInfo();

        if (info != NULL)
        {
            if (info->hasCapability(capToWaitFor))
            {
                return true;
            }
        }
        else
        {
        	CSFLogDebugS(logTag, "CC_CallPtr->getCallInfo() failed");
            return false;
        }

        int nTimeElapsed = GetTimeElapsedSince( nTimeStart );
        remainingTimeout -= nTimeElapsed;
    } while (_callCapsMayHaveChanged.TimedWait(base::TimeDelta::FromMilliseconds(remainingTimeout)));

    return false;
}
Exemple #2
0
/**
  This function gets a snapshot of all calls and examines each one in turn. If it find a call that has the
  specified capability then it returns this call.

  @param [in] ccmPtr - 

  @param [in] cap - This is the capability being examined. All existing calls are examined and the first (in
                    no particular order) call that has this capability is returned, if there is one.
                    
  @return Returns a NULL_PTR if there are no calls with the given capability. If a call is found with the given
          capability then that CC_CallPtr is returned.
*/
static CC_CallPtr getFirstCallWithCapability (CallControlManagerPtr ccmPtr, CC_CallCapabilityEnum::CC_CallCapability cap)
{
    if (ccmPtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    CC_DevicePtr devicePtr = ccmPtr->getActiveDevice();

    if (devicePtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    CC_DeviceInfoPtr deviceInfoPtr = devicePtr->getDeviceInfo();

    if (deviceInfoPtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    vector<CC_CallPtr> calls = deviceInfoPtr->getCalls();

    for (vector<CC_CallPtr>::iterator it = calls.begin(); it != calls.end(); it++)
    {
        CC_CallPtr call = *it;

        if (call == NULL)
        {
            continue;
        }

        CC_CallInfoPtr callInfoPtr = call->getCallInfo();

        if (callInfoPtr == NULL)
        {
            continue;
        }

        if (callInfoPtr->hasCapability(cap))
        {
            return call;
        }
    }//end for (calls)

    return NULL_PTR(CC_Call);
}