Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Example of a SIP client resolver plugin

This is an example of a SIP Client Resolver plugin named CSimpleAppLauncher.

In this example, plugin capabilities are not defined in a resource file but are defined in the implementation as the KCapabilities literal descriptor.

If capabilities are defined in the resource file instead of within the implementation, then they are defined in the opaque_data field in XML format. See example of a capabilities definition in XML format.


Implementation of CSimpleAppLauncher


CSimpleAppLauncher.H

#include "SipResolvedClient.h"

class CSimpleAppLauncher : public CSIPResolvedClient
{
public: // Constructors and destructor
/**
 * Static constructor
 * @return An initialized instance of this class.
 */
static CSimpleAppLauncher* NewL();

/// Destructor
~CSimpleAppLauncher();

public: // from CSIPResolvedClient
TUid ChannelL(RStringF aMethod, 
      const TDesC8& aRequestUri,
      const RPointerArray<CSIPHeaderBase>& aHeaders,
      const TDesC8& aContent,
      const CSIPContentTypeHeader* aContentType=0);

void ConnectL(TUid aUid);

const TDesC8& Capabilities();

private: // Constructors

inline CSimpleAppLauncher() {}

// Second phase constructor
void ConstructL(); 
};


CSimpleAppLauncher.CPP

#include "CSimpleAppLauncher.h"

const TUid KMyApplicationUid = { 0x101F5D45 }; 

_LIT8(KCapabilities,
"<SIP_CLIENT ALLOW_STARTING=\"YES\"><SIP_HEADERS>\
<ACCEPT value=\"text/plain\"/></SIP_HEADERS></SIP_CLIENT>");

// -----------------------------------------------------------------------------
// CSimpleAppLauncher::NewL
// -----------------------------------------------------------------------------
//
CSimpleAppLauncher* CSimpleAppLauncher::NewL()
{
CSimpleAppLauncher* self = new( ELeave ) CSimpleAppLauncher;
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
return self;
}

// -----------------------------------------------------------------------------
// CSimpleAppLauncher::ConstructL
// -----------------------------------------------------------------------------
//
void CSimpleAppLauncher::ConstructL()
{
}

// -----------------------------------------------------------------------------
// CSimpleAppLauncher::~CSimpleAppLauncher
// -----------------------------------------------------------------------------
//
CSimpleAppLauncher::~CSimpleAppLauncher()
{
}

// -----------------------------------------------------------------------------
// CSimpleAppLauncher::ChannelL
// -----------------------------------------------------------------------------
//
TUid CSimpleAppLauncher::ChannelL(RStringF /*aMethod*/,
const TDesC8& /*aRequestUri*/,
const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
const TDesC8& /*aContent*/,
const CSIPContentTypeHeader* /*aContentType*/)
{
// In the basic case application wants all the requests to itself
return KMyApplicationUid;

}

// -----------------------------------------------------------------------------
// CSimpleAppLauncher::ConnectL
// -----------------------------------------------------------------------------
//
void CSimpleAppLauncher::ConnectL(TUid aUid)
{
// application specific starting logic that leads to 
// the connection with the SIP. The same UID must be
// provided to SIP while invoking CSIP::NewL().
}
    

// -----------------------------------------------------------------------------
// CSimpleAppLauncher::Capabilities
// -----------------------------------------------------------------------------
//
const TDesC8& CSimpleAppLauncher::Capabilities()
{
// if an application did not provide capabilities in the
// ECOM rsc-file this function will be invoked by the 
// resolution logic implementation.
return KCapabilities;
}


00000001.RSS

#include <RegistryInfo.rh>

RESOURCE REGISTRY_INFO theInfo
   {
   // UID for the DLL
   dll_uid = 0x00000001;
   // Declare array of interface info
   interfaces = 
      {
      INTERFACE_INFO
         {
         // UID of interface that is implemented
         interface_uid = 0x102010DD;
         implementations = 
            {
            IMPLEMENTATION_INFO
               {
               implementation_uid = 0x00000001;
               version_no = 1;
               default_data = "101F5D45"; // SIP client application UID SIPTestUI in this case)
               }
            };
         }
     };
 }

[Top]


Example of a capabilities definition in XML format

This is an example of the definition of capabilities in XML format. Note that the content of this XML file is not related to the CSimpleAppLauncher example plugin.

<SIP_CLIENT ALLOW_STARTING="YES">
<SIP_HEADERS>
<ACCEPT_CONTACT value="*;mobility="mobile";media="audio"" /> 
<ALLOW_EVENTS value="presence" /> 
<ACCEPT value="somecontent/type" /> 
<ACCEPT value="application/sdp" /> 
</SIP_HEADERS>
<SDP_LINES>
<LINE name="m" value="audio 30000 RTP/AVP 98" /> 
</SDP_LINES>
</SIP_CLIENT>