CPSRequestHandler Class Reference

class CPSRequestHandler : public CActive

CPSRequestHandler An instance of the request handler object for the Predicitve Search application

PsServerClientAPI.lib
Since
S60 v3.2

Inherits from

Public Member Functions
~CPSRequestHandler ()
IMPORT_C void AddObserverL (MPsResultsObserver *)
IMPORT_C void CancelSearch ()
IMPORT_C void ChangeSortOrderL (const TDesC &, RArray < TInt > &)
IMPORT_C MVPbkContactLink * ConvertToVpbkLinkLC (const CPsClientData &, CVPbkContactManager &)
IMPORT_C void GetAdaptiveGridCharactersL (const MDesCArray &, const TDesC &, const TBool , TDes &)
IMPORT_C void GetAllContentsL ()
IMPORT_C TInt GetCachingStatusL ( TCachingStatus &)
IMPORT_C void GetDataOrderL (const TDesC &, RArray < TInt > &)
IMPORT_C void GetSortOrderL (const TDesC &, RArray < TInt > &)
IMPORT_C TBool IsLanguageSupportedL (const TLanguage )
IMPORT_C void LookupL (const CPsQuery &, const TDesC &, CDesCArray &, RArray < TPsMatchLocation > &)
IMPORT_C void LookupMatchL (const CPsQuery &, const TDesC &, TDes &)
IMPORT_C CPSRequestHandler * NewL ()
IMPORT_C CPSRequestHandler * NewLC ()
void NotifyCachingStatus ( TCachingStatus , TInt )
IMPORT_C TInt RemoveObserver (MPsResultsObserver *)
IMPORT_C void SearchL (const CPsQuery &)
IMPORT_C void SearchL (const CPsQuery &, RPointerArray < CPsClientData > &, CVPbkContactManager *)
IMPORT_C void SetSearchSettingsL (const CPsSettings &)
IMPORT_C void ShutdownServerL ()
IMPORT_C TVersion Version ()
Protected Member Functions
void DoCancel ()
void RunL ()
Private Member Functions
CPSRequestHandler ()
TInt AddMarkedContactsL ( RPointerArray < CPsClientData > &)
void ConstructL ()
void HandleBufferOverFlowL ()
void HandleErrorL ( TInt )
void HandleSearchResultsL ()
void RunSearchFromBufferL ()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::RunError(TInt)
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Inherited Enumerations
CActive:TPriority
Private Attributes
CVPbkContactManager * iBookMarkContactManager
CPsUpdateHandler * iContactAddedHandler
CPsUpdateHandler * iContactModifiedHandler
CPsUpdateHandler * iContactRemovedHandler
CVPbkContactIdConverter * iConverter
RPointerArray < CPsClientData > iMarkedContacts
RPointerArray < MPsResultsObserver > iObservers
HBufC8 * iPendingSearchQueryBuffer
CPsPropertyHandler * iPropertyHandler
HBufC8 * iSearchDataBuffer
HBufC8 * iSearchQueryBuffer
TBool iSearchRequestCancelled
HBufC8 * iSearchResultsBuffer
RPsSession iSession
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CPSRequestHandler()

CPSRequestHandler ( ) [private]

CPSRequestHandler . Performs the first phase of two phase construction.

~CPSRequestHandler()

~CPSRequestHandler ( ) [virtual]

~CPSRequestHandler. Destructor. Destroys the object and release all memory objects.

Member Functions Documentation

AddMarkedContactsL(RPointerArray< CPsClientData > &)

TInt AddMarkedContactsL ( RPointerArray < CPsClientData > & searchResults ) [private]

AddMarkedContacts Filters the bookmark results and adds them to final search result set

Parameters

RPointerArray < CPsClientData > & searchResults

AddObserverL(MPsResultsObserver *)

IMPORT_C void AddObserverL ( MPsResultsObserver * aObserver )

AddObserver.

Parameters

MPsResultsObserver * aObserver The object to be used to handle updates from the server.

CancelSearch()

IMPORT_C void CancelSearch ( )

CancelSearch. Cancels ongoing search.

ChangeSortOrderL(const TDesC &, RArray< TInt > &)

IMPORT_C void ChangeSortOrderL ( const TDesC & aDataStore,
RArray < TInt > & aSortOrder
)

ChangeSortOrderL. This function sets the sort order of data fields (mapped to VPbk identifiers) on a datastore. This is a synchronous request.

Parameters

const TDesC & aDataStore The data store URI.
RArray < TInt > & aSortOrder This array has the field identifiers to be set for this store.

ConstructL()

void ConstructL ( ) [private]

ConstructL. Performs the second phase construction of a CPSRequestHandler object.

ConvertToVpbkLinkLC(const CPsClientData &, CVPbkContactManager &)

IMPORT_C MVPbkContactLink * ConvertToVpbkLinkLC ( const CPsClientData & aSearchResult,
CVPbkContactManager & aContactManager
)

ConvertToVpbkLinkLC. Extract the VPBK contact link associated with the search result. This is a synchronous request.

Parameters

const CPsClientData & aSearchResult PS result for which contact link is required.
CVPbkContactManager & aContactManager An instance of contact manager used for link extraction.

DoCancel()

void DoCancel ( ) [protected, virtual]

From CActive , DoCancel. Cancels any outstanding operation.

GetAdaptiveGridCharactersL(const MDesCArray &, const TDesC &, const TBool, TDes &)

IMPORT_C void GetAdaptiveGridCharactersL ( const MDesCArray & aDataStores,
const TDesC & aSearchText,
const TBool aCompanyName,
TDes & aAdaptiveGrid
)

GetAdaptiveGridCharactersL. This is a support method for Adaptive Search functionality. As Predictive Search Engine is well suited for keeping an maintaining data structures related to contacts and updated according to contacts additions/modifications/deletions, like it is done already in Predictive Search Engine.

Parameters

const MDesCArray & aDataStores The data store URIs.
const TDesC & aSearchText The text in the find box.
const TBool aCompanyName The info if Company Name is required.
TDes & aAdaptiveGrid The returned Adaptive Grid.

GetAllContentsL()

IMPORT_C void GetAllContentsL ( )

GetAllContentsL. Sends a request to the predictive search server to get all cached contents. This is a asynchronous request.

GetCachingStatusL(TCachingStatus &)

IMPORT_C TInt GetCachingStatusL ( TCachingStatus & aStatus )

GetCachingStatusL Gets the status of the caching synchronously

Parameters

TCachingStatus & aStatus

GetDataOrderL(const TDesC &, RArray< TInt > &)

IMPORT_C void GetDataOrderL ( const TDesC & aDataStore,
RArray < TInt > & aDataOrder
)

GetDataOrderL. This function returns the list of supported data fields (mapped to VPbk identifiers) supported by a datastore. This is a synchronous request.

Parameters

const TDesC & aDataStore The data store URI.
RArray < TInt > & aDataOrder This array has the field identifiers returned from the server.

GetSortOrderL(const TDesC &, RArray< TInt > &)

IMPORT_C void GetSortOrderL ( const TDesC & aDataStore,
RArray < TInt > & aSortOrder
)

GetSortOrderL. This function returns the sort order of data fields (mapped to VPbk identifiers) set on a datastore. This is a synchronous request.

Parameters

const TDesC & aDataStore The data store URI.
RArray < TInt > & aSortOrder This array has the field identifiers returned from the server.

HandleBufferOverFlowL()

void HandleBufferOverFlowL ( ) [private]

HandleBufferOverFlowL. Handles internal buffer overflow event.

HandleErrorL(TInt)

void HandleErrorL ( TInt aErrorCode ) [private]

HandleErrorL. Handles error events.

Parameters

TInt aErrorCode

HandleSearchResultsL()

void HandleSearchResultsL ( ) [private]

ParseResultsL. Parses the results buffer and converts them to data elements.

IsLanguageSupportedL(const TLanguage)

IMPORT_C TBool IsLanguageSupportedL ( const TLanguage aLanguage )

IsLanguageSupportedL. Checks if the language variant is supported by the predictive search engine. This is a synchronous request.

Parameters

const TLanguage aLanguage The language which has to be checked

LookupL(const CPsQuery &, const TDesC &, CDesCArray &, RArray< TPsMatchLocation > &)

IMPORT_C void LookupL ( const CPsQuery & aSearchQuery,
const TDesC & aSearchData,
CDesCArray & aMatchSet,
RArray < TPsMatchLocation > & aMatchLocation
)

LookupL. Sends a request to the predictive search server. Does a predictive search in aSearchData for aSearchQuery and return the matches. This is a synchronous request.

Parameters

const CPsQuery & aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen)
const TDesC & aSearchData The input data to be searched.
CDesCArray & aMatchSet The list of matches.
RArray < TPsMatchLocation > & aMatchLocation The list matched index and length of match

LookupMatchL(const CPsQuery &, const TDesC &, TDes &)

IMPORT_C void LookupMatchL ( const CPsQuery & aSearchQuery,
const TDesC & aSearchData,
TDes & aMatch
)

LookupMatchL. Sends a request to the predictive search server. Does a predictive search in aSearchData for aSearchQuery and return the match string in aMatch. If there is no full match aMatch will be empty (Length()==0) This is a synchronous request.

Parameters

const CPsQuery & aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen)
const TDesC & aSearchData The input data to be searched.
TDes & aMatch The matched result

NewL()

IMPORT_C CPSRequestHandler * NewL ( ) [static]

NewL. Two-phased constructor. Creates a CPSRequestHandler object using two phase construction, and return a pointer to the created object.

NewLC()

IMPORT_C CPSRequestHandler * NewLC ( ) [static]

NewLC. Two-phased constructor. Creates a CPSRequestHandler object using two phase construction, and return a pointer to the created object.

NotifyCachingStatus(TCachingStatus, TInt)

void NotifyCachingStatus ( TCachingStatus aStatus,
TInt aError
)

Notify observers about the cahcing status

Parameters

TCachingStatus aStatus
TInt aError

RemoveObserver(MPsResultsObserver *)

IMPORT_C TInt RemoveObserver ( MPsResultsObserver * aObserver )

RemoveObserverL.

Parameters

MPsResultsObserver * aObserver The object used to handle updates from the server.

RunL()

void RunL ( ) [protected, virtual]

From CActive , RunL. Callback function. Invoked to handle responses from the server.

RunSearchFromBufferL()

void RunSearchFromBufferL ( ) [private]

RunSearchFromBufferL Runs search if search query buffer ( iPendingSearchQueryBuffer ) is not empty

SearchL(const CPsQuery &)

IMPORT_C void SearchL ( const CPsQuery & aSearchQuery )

SearchL. Sends a request to the predictive search server. This is a asynchronous request.

Parameters

const CPsQuery & aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen)

SearchL(const CPsQuery &, RPointerArray< CPsClientData > &, CVPbkContactManager *)

IMPORT_C void SearchL ( const CPsQuery & aSearchQuery,
RPointerArray < CPsClientData > & aMarkedContacts,
CVPbkContactManager * aContactManager
)

SearchL. Sends a request to the predictive search server. This is a asynchronous request. It considers bookmarked contacts while sending the results back to the client

Parameters

const CPsQuery & aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen)
RPointerArray < CPsClientData > & aMarkedContacts Array of marked contacts
CVPbkContactManager * aContactManager Contact manager instance

SetSearchSettingsL(const CPsSettings &)

IMPORT_C void SetSearchSettingsL ( const CPsSettings & aSettings )

SetSearchSettingsL. Set the databases and fields to be included in search. Databases ids are mapped to virtual phone book URLs. Fields to be searched are mapped to virutal phonebook identifiers.

Parameters

const CPsSettings & aSettings Holds the search settings.

ShutdownServerL()

IMPORT_C void ShutdownServerL ( )

ShutdownServerL Shuts down the predictive search engine.

CAUTION: Shutdown of predictive search server shouldn't be done for each session. It should be done only when the search engine needs to be completely shutdown.

Version()

IMPORT_C TVersion Version ( ) const

Version. Returns the predictive search server version.

Member Data Documentation

CVPbkContactManager * iBookMarkContactManager

CVPbkContactManager * iBookMarkContactManager [private]

Not Owned iBookMarkContactManager, contact manager reference received from the client To be used only for handling marked contacts.

CPsUpdateHandler * iContactAddedHandler

CPsUpdateHandler * iContactAddedHandler [private]

iContactAddedHandler, handler for reacting to contact being added to cache

CPsUpdateHandler * iContactModifiedHandler

CPsUpdateHandler * iContactModifiedHandler [private]

iContactModifiedHandler, handler for reacting to contact being modified in cache

CPsUpdateHandler * iContactRemovedHandler

CPsUpdateHandler * iContactRemovedHandler [private]

iContactRemovedHandler, handler for reacting to contact being removed from cache

CVPbkContactIdConverter * iConverter

CVPbkContactIdConverter * iConverter [private]

iConverter, instance of contact id converter

RPointerArray< CPsClientData > iMarkedContacts

RPointerArray < CPsClientData > iMarkedContacts [private]

iMarkedContacts, stores the bookmarked contacts if any, sent by the client

RPointerArray< MPsResultsObserver > iObservers

RPointerArray < MPsResultsObserver > iObservers [private]

iObservers, observers which handles updates from the server.

HBufC8 * iPendingSearchQueryBuffer

HBufC8 * iPendingSearchQueryBuffer [private]

iPendingSearchQueryBuffer, the buffer that holds the pending search query.

CPsPropertyHandler * iPropertyHandler

CPsPropertyHandler * iPropertyHandler [private]

iPropertyHandler, the handler to property which is asynchronously monitored

HBufC8 * iSearchDataBuffer

HBufC8 * iSearchDataBuffer [private]

iSearchDataBuffer, the buffer that holds the search data.

HBufC8 * iSearchQueryBuffer

HBufC8 * iSearchQueryBuffer [private]

iSearchQueryBuffer, the buffer that holds the search query.

TBool iSearchRequestCancelled

TBool iSearchRequestCancelled [private]

ETrue, if search request was cancelled

HBufC8 * iSearchResultsBuffer

HBufC8 * iSearchResultsBuffer [private]

iSearchResultsBuffer, the buffer that holds the search results.

RPsSession iSession

RPsSession iSession [private]

iSession, the predictive search server session.