Developing a Writer Plug-in

This section guides you through the process of developing a writer plug-in.

A writer plug-in is an ECOM plug-in that implements the Data Save API. The writer plug-in is used by formatter plug-ins to write core dump information captured by the Core Dump Subsystem (CDS) to a particular medium, such as File, USB, MMS, and so on.

By default, CDS provides a file writer plug-in that is used by the Symbian ELF and D_EXC formatter plug-ins to write core dump information to a file.

The following guidelines must be followed while developing a writer plug-in:

  • There must be a link to the cdssupport.lib library.

  • The plug-in must implement the CCrashDataSave interface, which provides the basic functionality required by a writer plug-in.

  • The ECOM plug-in API ID must be 0x102831e3. This ID is specified in the interface_uid field of the plug-in's .rss file.

  • Add the UID of the ECOM plug-in to one of the .plugin files located in the CDS private directory of each drive. The core dump server scans these .plugin files when it is started, and loads only those plug-ins whose UIDs are listed in the file.

Example

The following is an example ECOM writer plug-in (header file) implementing the Data Save API:

// my_writer.h

#ifndef __MY_WRITER_H__
#define __MY_WRITER_H__

#include "crashdatasave.h"

class CMyWriter : public CCrashDataSave
{
public:
    static CMyWriter* NewL();
    static CMyWriter* NewLC();
    ~CMyWriter();

public:
//Implement all the pure virtual functions defined by CCrashDataSave interface

    void GetDescription( TDes & aPluginDescription );

    TInt GetNumberConfigParametersL( );

    COptionConfig * GetConfigParameterL( const TInt aIndex );

    TInt SetConfigParameterL( const TInt aIndex, const TInt32 & aValue, const TDesC & aDescValue );

    
    // Calls by formatter to start the creation of a dump. Can be called several times to create several dumps 
    void OpenL( const TDesC& aFileName );
    TInt Open( const TDesC& aFileName );
    
    // Calls by formatter to end the creation of a dump. Open() and Close() must be paired calls 
    void CloseL();
    TInt Close();
    
    // Save aData - binary
    void WriteL( const TDesC8& aData );
    TInt Write( const TDesC8& aData );

    // Save aData - raw
    void WriteL( TAny* aData, TUint aSize );
    TInt Write( TAny* aData, TUint aSize );

    // Save aData at the specific position - binary
    // Implementation needed 
    void WriteL( TInt aPos, const TDesC8& aData );
    TInt Write( TInt aPos, const TDesC8& aData );

    // Save aData at the specific position - raw
    void WriteL( TInt aPos, TAny* aData, TUint aSize );
    TInt Write( TInt aPos, TAny* aData, TUint aSize );
    
};

#endif // __MY_WRITER_H__