Пример #1
0
CSession2* CRemConBulkServer::NewSessionL(const TVersion& aVersion, 
	const RMessage2& aMessage) const
	{
	LOG_FUNC;
	LOG3(_L8("\taVersion = (%d,%d,%d)"), aVersion.iMajor, aVersion.iMinor, aVersion.iBuild);
		
	// Version number check...
	TVersion v(KRemConBulkSrvMajorVersionNumber,
		KRemConBulkSrvMinorVersionNumber,
		KRemConBulkSrvBuildNumber);

	if ( !User::QueryVersionSupported(v, aVersion) )
		{
		LEAVEIFERRORL(KErrNotSupported);
		}

	CRemConBulkServer* ncThis = const_cast<CRemConBulkServer*>(this);
	
	CRemConBulkSession* sess = NULL;
	TRAPD(err, sess = CRemConBulkSession::NewL(*ncThis, 
				aMessage)
			);
	if ( err != KErrNone )
		{
		// Session creation might have failed- if it has we need to check if 
		// we need to shut down again.
		const_cast<CRemConBulkServer*>(this)->StartShutdownTimerIfNoSessions();
		LEAVEIFERRORL(err);
		}

	LOG1(_L8("\tsess = 0x%08x"), sess);
	return sess;
	}
void CControllerInitialisationPluginImpl::SendNextScriptFileCommandL()
	{
	LOG_FUNC

	// Create default Vendor command.
	CVendorDebugCommand* cmd = CVendorDebugCommand::NewL(KVendorDebugOGF);
	CleanupStack::PushL(cmd);
	LEAVEIFERRORL(iCommandParser->GetNextVendorCommand(*cmd));

	// Make any command specific changes.
	switch(cmd->Opcode())
		{
		case KHciVSUpdateUartHCIBaudRate:
			{
			iDesiredBaudRate = LittleEndian::Get32(cmd->Command().Ptr());
			}
			break;

		case KHciVSSetBDAddr:
			{
			SetLocalBDAddr(cmd->Command());
			}
			break;

		default:
			// Nothing to do.
			break;			
		};
		
		
	// Send the command.
	CleanupStack::Pop();
	iHCICommandQueue->MhcqAddInitCommandL(cmd, *this);
	}
Пример #3
0
void CBulkReceiver::DoBindToCurrentThreadL()
	{
	LOG_FUNC;
	CActiveScheduler::Add(this);
	LEAVEIFERRORL(iConnectCall.Start());
	iThreadId = RThread().Id();
	}
Пример #4
0
void CBulkReceiver::ConstructL()
	{
	LOG_FUNC;
	TCallBack connectCb(StaticConnect, this);
	LEAVEIFERRORL(iConnectCall.Create(connectCb, EPriorityStandard));
	BindToCurrentThreadL();
	}
Пример #5
0
void CL2CapSDU::ConstructL(RMBufChain& aSDUData, TBool aIsBasicDataVersion, TUint16 aTimerDuration, TUint16 aPDUSize)
	{
	LOG_FUNC
	LEAVEIFERRORL(SegmentSDUIntoPDUs(aSDUData, aIsBasicDataVersion, aPDUSize));
	
	// Start the flush timer if required.
	StartFlushTimer(aTimerDuration);
	}
/** Second phase construction.

@leave System wide error code
*/	
void CRemConBearerAvrcp::ConstructL()
	{
	LOG_FUNC
	
	// Set-up TLS
	LEAVEIFERRORL(Dll::SetTls(reinterpret_cast<TAny*>(EControlThread)));
	
	// New up a router.  This opens and uses the RAvctp.
	// On initialisation it should begin listening.
	iRouter = CControlRouter::NewL(iAvctp, *this);
	iTimer = CDeltaTimer::NewL(CActive::EPriorityStandard);
	iPlayerInfoManager = CAvrcpPlayerInfoManager::NewL(Observer(), *this);
	iInternalHandler = &iPlayerInfoManager->InternalCommandHandler();
	
	// Create the bulk bearer - actual usage occurs in the bulk thread.
	iBulkBearer = CAvrcpBulkBearer::NewL(iAvctp, *iPlayerInfoManager);
	iConstructionComplete = ETrue;
	}
Пример #7
0
void CEirPublisher::RunL()
{
    LOG_FUNC
    LEAVEIFERRORL(iStatus.Int());

    switch(iState)
    {
    case EConnecting:
        iEirMan.RegisterTag(iEirTag, iStatus);
        iState = ERegisterTag;
        SetActive();
        break;
    case ERegisterTag:
        iNotifierAo->Start();
    // Fall through...
    case ENewData:
    // Fall through...
    case ESettingData:
        if(iPublishOutstanding)
        {
            iPublishOutstanding = EFalse;
            iState = ENewData;
            iEirMan.NewData(iRequiredBytes, iStatus);
            SetActive();
        }
        else if(iCallbackOutstanding)
        {
            iCallbackOutstanding = EFalse;
            iState = EDataCallback;
            LOG1(_L8("CEirPublisher::RunL: About to call back client with bytes available: %d"), iAvailableBytes);
            iNotifier.MepnSpaceAvailable(iAvailableBytes);
        }
        else
        {
            iState = EIdle;
        }
        break;
    default:
        // Unexpected
        __ASSERT_DEBUG(EFalse, Panic(EUnexpectedPublisherState));
        break;
    }
}
Пример #8
0
/**
Create the active scheduler and Rem Con bulk server instances, and start the 
server.
*/
static void RunBulkServerL(RMsgQueue<TBulkServerMsg>* aMsgQueue)
	{
	LOG_STATIC_FUNC;
	LEAVEIFERRORL(User::RenameThread(KRemConBulkServerName));

	// Create and install the active scheduler.
	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);

	// Create the server. NB Odd syntax in this line because we never refer to 
	// it directly- it's always owned by the cleanup stack!
	static_cast<void>(CRemConBulkServer::NewLC(*aMsgQueue));

	// Initialisation complete, now signal the client
	RThread().Rendezvous(KErrNone);

	// Ready to run. This only returns when the server is closing down.
	CActiveScheduler::Start();

	// Clean up the server and scheduler.
	CleanupStack::PopAndDestroy(2, scheduler);
	}
Пример #9
0
void CFdfTest::ProcessKeyL(TKeyCode aKeyCode)
	{
	iManager.Write(_L8("CFdfTest::ProcessKeyL"));

	switch ( aKeyCode )
		{
	case '0':
		{
		if ( iUsbHostStack.Handle() )
			{
			iManager.Write(_L8("\talready connected"));
			}
		else
			{

			iManager.Write(_L8("About to open LDD"));
			_LIT(KUsbOtgLDDName,"otgdi");
			TInt err = User::LoadLogicalDevice(KUsbOtgLDDName);
			if ( (err != KErrNone) && (err != KErrAlreadyExists) )
				{
				iManager.Write(_L8("Error %d: Unable to load driver: %S"), err, &KUsbOtgLDDName);
				LEAVEIFERRORL(err);
				}

			iManager.Write(_L8("About to open RUsbOtgDriver"));
			err = iOtgDriver.Open();
			if (err != KErrNone && err != KErrAlreadyExists)
				{
				iManager.Write(_L8("Error %d: Unable to open RUsbOtgDriver session"), err);
				LEAVEIFERRORL(err);
				}

			iManager.Write(_L8("About to start OTG stacks"));
			TInt iLastError = iOtgDriver.StartStacks();
			if (iLastError != KErrNone)
				{
				iManager.Write(_L8("Error %d: Unable to open start OTG stacks"), iLastError);
				LEAVEIFERRORL(err);
				}

			TInt errorBus = iOtgDriver.BusRequest();
			iManager.Write(_L8("Error %d: iOtgDriver.BusRequest()"), errorBus);
			if (errorBus == KErrNone)
				{
				iBusRequested = 1;
				}


			TInt error = iUsbHostStack.Connect();
			iManager.Write(_L8("\terror = %d"), error);
			if ( !error )
				{
				iManager.Write(_L8("\t Post() to wait for event "));
				iNotifyDeviceEvent->Post();
				iNotifyDevmonEvent->Post();
				iManager.Write(_L8("\t After Post() to wait for event "));
				}
			}
		}
		break;

	case '1':
		{
		TInt err = iUsbHostStack.EnableDriverLoading();
		iManager.Write(_L8("\terr = %d"), err);
		}
		break;

	case '2':
		iUsbHostStack.DisableDriverLoading();
		break;

	case '3':
		iNotifyDeviceEvent->Cancel();
		iNotifyDevmonEvent->Cancel();
		iUsbHostStack.Close();
		break;
	case '4':
		if(iBusRequested)
			{
			iManager.Write(_L8("Call BusDrop()"));
			TInt err = iOtgDriver.BusDrop();
			iManager.Write(_L8("Call BusDrop() err = %d "),err);
			}
		else
			{
			iManager.Write(_L8("Cannot Call BusDrop() as the bus has not been Requested()"));
			}
		break;

	default:
		iManager.Write(_L8("Unknown selection"));
		break;
		}
	}