Symbian
 Developer Library

DEVELOPER LIBRARY

[Index] [Glossary] [Previous] [Next]



Location: cfax32.h
Link against: faxcli.lib

Class CFaxTransfer

CFaxTransfer

Support

Supported from 5.0

Description

Send or receive a fax

Contains the public Fax Client API.

The API includes a number of functions for setting up a fax, and then for sending it. Functions to set up a fax allow the client to launch a fax client session, set the fax mode, set the fax destination number, define the fax pages to be sent, and declare a file in which received faxes are to be stored. After setting up, the client can send, cancel and monitor the progress of the fax.

This class is not intended for user derivation.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CFaxTransferSend or receive a fax

Defined in CFaxTransfer:
AddSourceL(), Cancel(), NewL(), NewLC(), Progress(), RemoveAllSources(), SetMode(), SetPhoneNumber(), SetPhoneNumberL(), SetReceiveFileName(), Start(), Stop(), iProgress, ~CFaxTransfer()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CFaxTransfer* NewL(const TFaxSettings& aFaxSettings);

Description

Constructs a CFaxTransfer object, which offers the publicly exported Symbian OS Fax Client API.

Parameters

const TFaxSettings& aFaxSettings

A reference to a TFaxSettings object, which contains persistent information applicable to all fax sessions.

Return value

CFaxTransfer*

A pointer to the newly created object.

Leave codes

KErrNoMemory

There is insufficient memory to perform the operation.


NewLC()

static CFaxTransfer* NewLC(const TFaxSettings& aFaxSettings);

Description

Constructs a CFaxTransfer object, which offers the publicly exported Symbian OS Fax Client API. As is usual in Symbian OS, the only difference between this function and NewL() is that this variant pushes the object to the cleanup stack.

Parameters

const TFaxSettings& aFaxSettings

A reference to a TFaxSettings object which contains persistent information applicable to all fax sessions.

Return value

CFaxTransfer*

Pointer to the newly created object.

Leave codes

KErrNoMemory

There is insufficient memory to perform the operation.


~CFaxTransfer()

~CFaxTransfer();

Description

Destructor

Frees all resources owned by the object, prior to its destruction.

[Top]


Preparing to send and receive faxes

Description

Sets up the fax system to send or receive. The functions must be called before the sending and receiving functions.


SetMode()

void SetMode(TFaxMode aMode);

Description

Sets the mode of operation during the fax session.

There are three possible transmission modes:

There are four possible reception modes:

Parameters

TFaxMode aMode

Type of fax operation for the current session.

Notes:


SetPhoneNumberL()

void SetPhoneNumberL(TDesC8& aNumber);

Description

Resolves a local telephone number into an international number by taking account of the current location and country.

The resolved number is then set as the actual phone number to dial.

Parameters

TDesC8& aNumber

Descriptor containing the phone number to be resolved.

Notes:


SetPhoneNumber()

void SetPhoneNumber(TDesC8& aNumber);

Description

Sets the telephone number to be dialled when sending a fax.

This function does not check the validity of the number, which is simply sent to the modem as part of an ATD dial command in its raw state.

Parameters

TDesC8& aNumber

Descriptor containing the phone number to be dialled.

Notes:


AddSourceL()

void AddSourceL(const TFileName& aFaxPageStore);
void AddSourceL(const TFileName& aFaxPageStore, TInt aStartPage);
void AddSourceL(const TFileName& aFaxPageStore, TInt aStartPage, TInt aEndPage);

Description

Specifies which pages of a fax store file should be sent.

It can be called more than once to add multiple pages from different files. Typically, this function is called twice for each transmission: once to queue the cover sheet, and a second time to queue the remainder of the fax.

The overloaded variants are supplied primarily to help error recovery in cases when a fax transmission is either incomplete or when specific pages need to be resent. When transmitting a fax, at least one variant of this function must be called before CFaxTransfer::Start().

Parameters

const TFileName& aFaxPageStore

Name of the fax store file from which to take pages.

TInt aStartPage

Page in file to start from. If omitted, the file is sent from the start.

TInt aEndPage

Page in file to stop sending. If omitted, transmission continues to the end.

Notes:


RemoveAllSources()

void RemoveAllSources();

Description

Clears the complete list of pages previously selected for faxing using one of the variants of AddSourceL().

Removal of individual items from the list of pages to be fax is not possible.

This function must be used between successive fax transmissions if previously sent pages aren't to be sent again.


SetReceiveFileName()

void SetReceiveFileName(const TFileName& aName);

Description

Specifies the name of the fax store file in which to save incoming pages.

If the file already exists the previous contents are lost.

Parameters

const TFileName& aName

The name of a file in which to save received faxes.

[Top]


Sending and receiving faxes


Start()

TInt Start(TRequestStatus& aThreadStat);

Description

Starts the fax session by detaching a high priority fax thread which runs independently of the user thread.

This function can only be called asynchronously. The same function is used for both sending and receiving, with the precise operation having been determined by a prior call to SetMode().

Start() calls RThread::Create() to launch a thread and returns with either KErrNone if successful or KFaxThreadError if the thread could not be launched. The possible reasons for session termination are trapped in the TRequestStatus which the caller should be waiting on in an asynchronous loop or active object. This can return a wide variety of error codes as well as any of the usual system error codes.

The function must always be paired with a call to CFaxTransfer::Stop() to kill the thread after the fax session terminates.

Parameters

TRequestStatus& aThreadStat

A request status indicating the reason for the termination of the fax thread. A value of KErrNone indicates a successful session, with fax specific errors listed in error codes.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Progress()

TInt Progress();

Description

Causes ETel to update the fax progress information in RFax::TProgress.

It should be called prior to displaying the fax progress information.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


Cancel()

void Cancel();

Description

Tells the fax engine to cancel the fax session at the first convenient opportunity.

The caller should wait for cancellation to complete, which will usually be signalled by the fax thread's TRequestStatus completing with a KFaxCancelRequested error code. After the fax thread completes, Stop() should be called in the normal way.

The function can be called at any time after the call to Start().


Stop()

void Stop();

Description

Kills the fax thread once it has completed.

Fax threads do not kill themselves, so every successful call to CFaxTransfer::Start() must be paired with a call to CFaxTransfer::Stop().

[Top]


Data members

Description

There are a number of data members with public access, however only the progress information variable is part of the public API.


iProgress

RFax::TProgress iProgress

Description

The fax progress.