epoc32/include/networkemulator/cnetworkemulatorsetupcommdb.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/networkemulator/cnetworkemulatorsetupcommdb.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,101 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* CSetUpCommDb.h
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef _CSetUpCommDb_H
    1.24 +#define _CSetUpCommDb_H
    1.25 +
    1.26 +/*****************************************************************************
    1.27 + *
    1.28 + * System Includes 
    1.29 + *
    1.30 + ****************************************************************************/
    1.31 +#include <commdb.h> 
    1.32 +
    1.33 +/*****************************************************************************
    1.34 + *
    1.35 + * Local Includes
    1.36 + *
    1.37 + ****************************************************************************/
    1.38 +
    1.39 +/*****************************************************************************
    1.40 + *
    1.41 + *  Types
    1.42 + *
    1.43 + ****************************************************************************/
    1.44 +typedef enum {
    1.45 +	TCommDB_Success,
    1.46 +	TCommDB_ErrorInitCommDb,
    1.47 +	TCommDB_ErrorTableNotFound,
    1.48 +	TCommDB_ErrorUpdatingRecord,
    1.49 +	TCommDB_ErrorReadingRecord,
    1.50 +	TCommDB_ErrorColNotFound,
    1.51 +	TCommDB_ErrorColTypeValueNotSupported,
    1.52 +	TCommDB_ErrorConvertingToUnicode,
    1.53 +	TCommDB_ErrorUnexpectedColType,
    1.54 +	TCommDB_RecNotFound
    1.55 +}TCommDBError;
    1.56 +
    1.57 +typedef enum {
    1.58 +	TCOMMBD_IDLE,
    1.59 +	TCOMMBD_CONNECTED
    1.60 +}TCommDbStatus;
    1.61 +
    1.62 +/*****************************************************************************
    1.63 + *
    1.64 + * Class Definition
    1.65 + *
    1.66 + ****************************************************************************/
    1.67 +class CSetUpCommDb : public CBase
    1.68 +{
    1.69 +
    1.70 +public:
    1.71 +	// Constructor sets all member data to null
    1.72 +	IMPORT_C CSetUpCommDb();
    1.73 +
    1.74 +	// Deletes the pointer, sets it to null.
    1.75 +	IMPORT_C ~CSetUpCommDb();
    1.76 +
    1.77 +	// Method to initialise the database.
    1.78 +	IMPORT_C TCommDBError initialise(void);
    1.79 +	
    1.80 +	IMPORT_C TCommDBError updateEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);	
    1.81 +
    1.82 +	IMPORT_C TCommDBError getAsciiEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes8& aFieldValue, int* aErrCode);
    1.83 +	IMPORT_C TCommDBError getUnicodeEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TDes16& aFieldValue, int* aErrCode);
    1.84 +	IMPORT_C TCommDBError getIntEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TUint32& aFieldValue, int* aErrCode);
    1.85 +	IMPORT_C TCommDBError getBoolEntry(TPtrC aTable, TUint32 aRecordID, TPtrC aFieldName, TBool& aFieldValue, int* aErrCode);
    1.86 +
    1.87 +private:
    1.88 +	CCommsDbTableView* openTableL( CCommsDatabase *aDbComms, TPtrC aTable );
    1.89 +
    1.90 +	TCommDBError FindAndUpdateRecord( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
    1.91 +	TCommDBError UpdateField( CCommsDbTableView *aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode );
    1.92 +	int SetUnicodeString(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
    1.93 +	int SetUnicodeStringLong(CCommsDbTableView* aTable, TPtrC aFieldName, char* aFieldValue, int* aErrCode);
    1.94 +	HBufC16 *ConvertAsciiToUnicode( char *aAsciiString );
    1.95 +
    1.96 +	TCommDBError FindRecordAndGetType( CCommsDbTableView *aTable, TUint32 aRecordID, TPtrC aFieldName, TDbColType *aColType, int* aErrCode );
    1.97 +
    1.98 +
    1.99 +	CCommsDatabase *iDbComms;
   1.100 +	TCommDbStatus iStatus;
   1.101 +
   1.102 +};
   1.103 +
   1.104 +#endif