CMifareClassicSector Class Reference

#include <mw/mifareclassicsector.h>

Link against: nfctagextension.lib

class CMifareClassicSector : public CBase

Inherits from

  • CMifareClassicSector
Public Member Enumerations
enumTSectorType { E1KSector, E4KSector }
Public Member Functions
~CMifareClassicSector()
IMPORT_C const CMifareClassicAccessBits &AccessBits()
IMPORT_C MifareClassicCommon::TSectorTrailerAccessConditionAccessConditionForSectorTrailer()
IMPORT_C TIntCopy(const CMifareClassicSector &)
IMPORT_C HBufC8 *ExportDataL()
IMPORT_C HBufC8 *ExportDataLC()
IMPORT_C TIntGetAccessConditionForDataBlock(TUint8, MifareClassicCommon::TDataBlockAccessCondition &)
IMPORT_C TIntGetDataBlock(TUint8, CMifareClassicDataBlock &)
IMPORT_C TIntImportData(const TDesC8 &)
IMPORT_C CMifareClassicSector *NewL(TSectorType)
IMPORT_C CMifareClassicSector *NewL(CMifareClassicSector &)
IMPORT_C CMifareClassicSector *NewL(const TDesC8 &)
IMPORT_C CMifareClassicSector *NewL(const TDesC8 &, const TDesC8 &, const CMifareClassicAccessBits &, const RPointerArray< CMifareClassicDataBlock > &)
IMPORT_C CMifareClassicSector *NewLC(TSectorType)
IMPORT_C CMifareClassicSector *NewLC(CMifareClassicSector &)
IMPORT_C CMifareClassicSector *NewLC(const TDesC8 &)
IMPORT_C CMifareClassicSector *NewLC(const TDesC8 &, const TDesC8 &, const CMifareClassicAccessBits &, const RPointerArray< CMifareClassicDataBlock > &)
IMPORT_C TSectorTypeSectorType()
IMPORT_C voidSetAccessBits(const CMifareClassicAccessBits &)
IMPORT_C TIntSetAccessConditionForDataBlock(TUint8, const MifareClassicCommon::TDataBlockAccessCondition &)
IMPORT_C voidSetAccessConditionForSectorTrailer(const MifareClassicCommon::TSectorTrailerAccessCondition &)
IMPORT_C TIntSetDataBlock(TUint8, const CMifareClassicDataBlock &)
IMPORT_C TIntSetDataBlock(TUint8, const TDesC8 &)
IMPORT_C TIntSetSecretKey(MifareClassicCommon::TKeyType, const TDesC8 &)
IMPORT_C TBooloperator!=(const CMifareClassicSector &)
IMPORT_C TBooloperator==(const CMifareClassicSector &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
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()

Detailed Description

This class provides easy access to Mifare classic sectors.

Member Enumeration Documentation

Enum TSectorType

Describes whether sector size is 1 or 4 kilobytes

EnumeratorValueDescription
E1KSector1
E4KSector

Constructor & Destructor Documentation

~CMifareClassicSector ( )

IMPORT_C~CMifareClassicSector()

Destructor.

Member Function Documentation

AccessBits ( )

IMPORT_C const CMifareClassicAccessBits &AccessBits()const

Returns reference CMifareClassicAccessBits of this CMifareClassicSector.

Return Value
Reference to access bits.

AccessConditionForSectorTrailer ( )

IMPORT_C MifareClassicCommon::TSectorTrailerAccessConditionAccessConditionForSectorTrailer()

Return access condition for sector trailer.

Return Value
Access condition for sector trailer.

Copy ( const CMifareClassicSector & )

IMPORT_C TIntCopy(const CMifareClassicSector &aSector)

Copies data from specified CMifareClassicSector to this CMifareClassicSector by replacing any existing data.

Parameters
aSectorSector which content is copied to this CMifareClassicSector.

ExportDataL ( )

IMPORT_C HBufC8 *ExportDataL()const

Transforms this sector into raw data.

Return Value
Pointer to descriptor which contains raw data.

ExportDataLC ( )

IMPORT_C HBufC8 *ExportDataLC()const

Transforms this sector into raw data.

Return Value
Pointer to descriptor which contains raw data.

GetAccessConditionForDataBlock ( TUint8, MifareClassicCommon::TDataBlockAccessCondition & )

IMPORT_C TIntGetAccessConditionForDataBlock(TUint8aBlockNumber,
MifareClassicCommon::TDataBlockAccessCondition &aAccessCondition
)const

Gets access condition for specified data block.

Parameters
aBlockNumberBlock number.
aAccessConditionAccess condition.

Return Values

KErrArgument if block number is greater than 2.
KErrNone if successful.

GetDataBlock ( TUint8, CMifareClassicDataBlock & )

IMPORT_C TIntGetDataBlock(TUint8aBlockNumber,
CMifareClassicDataBlock &aDataBlock
)

Gets datablock.

Parameters
aBlockNumberBlock number.
Return Value
Pointer to Data block object.

ImportData ( const TDesC8 & )

IMPORT_C TIntImportData(const TDesC8 &aData)

Imports specified data to sector. All old data of the sector will be lost during the execution of this method. If import method fails, old data will be saved.

Parameters
aDataDescriptor for a buffer to read raw data from. Buffer must contain following attributes ( in the following order ):Secret key A ( 6 bytes )Access bits ( 4 bytes )Secret key B ( 6 bytes )DataBlock 0 ( 16 bytes )DataBlock 1 ( 16 bytes )DataBlock 2 ( 16 bytes )

Return Values

KErrArgument If size of the buffer differ from the size of the mifare classic sector.
KErrNone If successful.

NewL ( TSectorType )

IMPORT_C CMifareClassicSector *NewL(TSectorTypeaSize)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aSizeDescribes whether sector is 1 or 4 kilobytes.
Return Value
Pointer to the newly created instance.

NewL ( CMifareClassicSector & )

IMPORT_C CMifareClassicSector *NewL(CMifareClassicSector &aSector)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aSectorMifare classic sector which content is copied to this object.
Return Value
Pointer to the newly created instance.

NewL ( const TDesC8 & )

IMPORT_C CMifareClassicSector *NewL(const TDesC8 &aData)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aDataDescriptor which content will be copied to this object.
Return Value
Pointer to the newly created instance.

NewL ( const TDesC8 &, const TDesC8 &, const CMifareClassicAccessBits &, const RPointerArray< CMifareClassicDataBlock > & )

IMPORT_C CMifareClassicSector *NewL(const TDesC8 &aKeyA,
const TDesC8 &aKeyB,
const CMifareClassicAccessBits &aAccessBits,
const RPointerArray< CMifareClassicDataBlock > &aBlockArray
)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aKeyAKey A for sector.
aKeyBKey B for sector.
aAccessBitsAccessbits for sector.
aBlockArrayData block array for sector.
Return Value
Pointer to the newly created instance.

NewLC ( TSectorType )

IMPORT_C CMifareClassicSector *NewLC(TSectorTypeaSize)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aSizeDescribes whether sector is 1 or 4 kilobytes.
Return Value
Pointer to the newly created instance.

NewLC ( CMifareClassicSector & )

IMPORT_C CMifareClassicSector *NewLC(CMifareClassicSector &aSector)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aSectorMifare classic sector which content is copied to this object.
Return Value
Pointer to the newly created instance.

NewLC ( const TDesC8 & )

IMPORT_C CMifareClassicSector *NewLC(const TDesC8 &aData)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aDataDescriptor which content will be copied to this object.
Return Value
Pointer to the newly created instance.

NewLC ( const TDesC8 &, const TDesC8 &, const CMifareClassicAccessBits &, const RPointerArray< CMifareClassicDataBlock > & )

IMPORT_C CMifareClassicSector *NewLC(const TDesC8 &aKeyA,
const TDesC8 &aKeyB,
const CMifareClassicAccessBits &aAccessBits,
const RPointerArray< CMifareClassicDataBlock > &aBlockArray
)[static]

Creates a new instance of this class. May leave with one of the system wide error codes.

Parameters
aKeyAKey A for sector.
aKeyBKey B for sector.
aAccessBitsAccessbits for sector.
aBlockArrayData block array for sector.
Return Value
Pointer to the newly created instance.

SectorType ( )

IMPORT_C TSectorTypeSectorType()const

Returns TSectorType of this CMifareClassicSector.

Return Value
TSectorType of this CMifareClassicSector.

SetAccessBits ( const CMifareClassicAccessBits & )

IMPORT_C voidSetAccessBits(const CMifareClassicAccessBits &aAccessBits)

Sets specified CMifareClassicAccessBits for this CMifareClassicSector by replacing any existing data.

Parameters
aAccessBitsNew access bits for sector.

SetAccessConditionForDataBlock ( TUint8, const MifareClassicCommon::TDataBlockAccessCondition & )

IMPORT_C TIntSetAccessConditionForDataBlock(TUint8aBlockNumber,
const MifareClassicCommon::TDataBlockAccessCondition &aAccessCondition
)

Sets access condition for specified data block.

Parameters
aBlockNumberBlock number
aAccessConditionAccesscondition

Return Values

KErrArgument if block number is greater than 2.
KErrNone if successful.

SetAccessConditionForSectorTrailer ( const MifareClassicCommon::TSectorTrailerAccessCondition & )

IMPORT_C voidSetAccessConditionForSectorTrailer(const MifareClassicCommon::TSectorTrailerAccessCondition &aAccessCondition)

Sets access condition for sector trailer.

Parameters
aAccessConditionAccess condition for sector trailer.

SetDataBlock ( TUint8, const CMifareClassicDataBlock & )

IMPORT_C TIntSetDataBlock(TUint8aBlockNumber,
const CMifareClassicDataBlock &aDataBlock
)

Sets datablock.

Parameters
aBlockNumberBlock number.
aDataBlockData block.

Return Values

KErrArgument If block number is greater than 2.
KErrNone If successfull.

SetDataBlock ( TUint8, const TDesC8 & )

IMPORT_C TIntSetDataBlock(TUint8aBlockNumber,
const TDesC8 &aData
)

Sets datablock.

Parameters
aBlockNumberBlock number.
aDataData

Return Values

KErrArgument If aData parameter's size is not 16 bytes.
KErrNone If successfull.

SetSecretKey ( MifareClassicCommon::TKeyType, const TDesC8 & )

IMPORT_C TIntSetSecretKey(MifareClassicCommon::TKeyTypeaKeyType,
const TDesC8 &aKey
)

Sets secret key of the mifare classic sector.

Parameters
aKeyTypeaKeyType, the keytype of secret key.
aKeySecret key, which size of key must be 6 bytes.

Return Values

KErrArgument If size of aKeyType differ from 6 bytes.
KErrNone If successful

operator!= ( const CMifareClassicSector & )

IMPORT_C TBooloperator!=(const CMifareClassicSector &aSector)const

Determines whether this CMifareClassicSector is equal with specified CMifareClassicSector.

Parameters
aSectorCMifareClassicSector which is compared to this CMifareClassicSector.

operator== ( const CMifareClassicSector & )

IMPORT_C TBooloperator==(const CMifareClassicSector &aSector)const

Determines whether this CMifareClassicSector is equal with specified CMifareClassicSector.

Parameters
aSectorCMifareClassicSector which is compared to this CMifareClassicSector.