Preparing to Use the LLCP Stack

Steps

  1. Create an instance of the CLlcpProvider class, which provides services to listen to LLCP-related events and creates connection objects between the local and remote devices.

  2. Add an LLCP-link listener and a connectionless-request listener to listen to the LLCP-link status, as shown in the following code snippet:

    // CMyOwnLlcpApplication::Start()
    // -----------------------------------------------------------------------------
    //
    void CMyOwnLlcpApplication::Start()
        {
        if ( !iStarted )
            {
            // Adding an LLCP link listener
            iLlcp->AddLlcpLinkListenerL( *this );
            
            // Adding a listener to SSAP 35. If any Connectionless transport 
            // messages are sent to SSAP 35, this listener will handle them.
            iLlcp->StartListeningConnLessRequestL( *this, KInterestingSsap );
            
            iStarted = ETrue;
            }
        }
    // -----------------------------------------------------------------------------
    // End of CMyOwnLlcpApplication::Start()
    
    

    The CMyOwnLlcpApplication object waits for notifications after the LLCP link between the local and the remote devices is established. CMyOwnLlcpApplication is also notified when connectionless requests with SSAP 35 (Source Service Access Point) are received.

  3. Remove all listeners from the CLlcpProvider instance.

    // CMyOwnLlcpApplication::Stop()
    // -----------------------------------------------------------------------------
    //
    void CMyOwnLlcpApplication::Stop()
        {
        if ( iStarted )
            {
            // Stopping listening to LLCP link
            iLlcp->RemoveLlcpLinkListener();
            
            // Stopping listening to SSAP 35.
            iLlcp->StopListeningConnLessRequest( KInterestingSsap );
            iStarted = EFalse;
            
            Cleanup();
            }
        }
    // -----------------------------------------------------------------------------
    // End of CMyOwnLlcpApplication::Stop()
    
    

    The following diagram illustrates how to prepare and use the LLCP stack:

    Figure: Sequence diagram for preparing to use the LLCP stack