diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-DA382265-232F-40F4-92ED-C90E6DE3D709.dita --- a/Symbian3/PDK/Source/GUID-DA382265-232F-40F4-92ED-C90E6DE3D709.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-DA382265-232F-40F4-92ED-C90E6DE3D709.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,74 +1,74 @@ - - - - - -VersionThis document describes how to set the interface version used by -an LDD or a PDD and how to check version compatibility. -

An LDD and a PDD each have a version number which helps to identify the -interface. In order to communicate, an LDD and a PDD must have the same version -number.

-
Version -definition

Each LDD and PDD has their own version number. -LDDs and PDDs must set their version numbers in their respective factory objects, -using a TVersion object. TVersion specifies -a major number, a minor number and a build number.

A version number -defines the interface version supported by the LDD or PDD. It is used to check -that an LDD and PDD are compatible. It is also checked against the version -requested by a client when it opens a channel.

The following shows -how the example device drivers set their version numbers:

inline TVersion RExDriverChannel::VersionRequired() - { - return (TVersion(EUartMajorVersionNumber, - EUartMinorVersionNumber, - EUartBuildVersionNumber)); - } // LDD Factory object Constructor -DExDriverLogicalDevice::DExDriverLogicalDevice () - { - iVersion = RExDriverChannel::VersionRequired(); - } // PDD Factory object Constructor -DExH4PhysicalDevice::DExH4PhysicalDevice () - { - iVersion= RExDriverChannel::VersionRequired(); - }
-
Version compatibility

The -Kernel provides the Kern::QueryVersionSupported() API to -enforce a consistent set of rules for checking version compatibility. It returns -true if one of the following conditions is true:

    -
  • the major version of -the client is less than the major version of the driver.

  • -
  • the major version of -the client is equal to the major version of the driver, and the minor version -of the client is less than or equal to the minor version of the driver.

  • -

DLogicalChannel::DoCreate() typically checks -the client version against the driver using this API.

// Logical Channel Second stage constructor -TInt DExDriverLogicalChannel::DoCreate(TInt /*aUnit*/, const TDesC8* -/*anInfo*/, const TVersion& aVer) - { - ... - // Version check - if(!Kern::QueryVersionSupported(RExDriver::VersionRequired(), -aVer)) - return KErrNotSupported; - ... - }

When the device framework searches for a corresponding -PDD factory object for an LDD, it calls DPhysicalDevice::Validate() on -each matching PDD factory object, passing the unit number and the optional -extra information block. The first PDD to return KErrNone is -accepted as the required PDD.

The example PDD's Validate() implementation -checks the version of the LDD against the PDD, using the Kern::QueryVersionSupported() API:

// PDD: Validate -TInt DExH4PhysicalDevice::Validate(TInt aUnit, const TDesC8* -/*aInfo*/, const TVersion& aVer) - { - ... - // Version check - if (!Kern::QueryVersionSupported(iVersion,aVer)) - return KErrNotSupported; - ... - }
+ + + + + +VersionThis document describes how to set the interface version used by +an LDD or a PDD and how to check version compatibility. +

An LDD and a PDD each have a version number which helps to identify the +interface. In order to communicate, an LDD and a PDD must have the same version +number.

+
Version +definition

Each LDD and PDD has their own version number. +LDDs and PDDs must set their version numbers in their respective factory objects, +using a TVersion object. TVersion specifies +a major number, a minor number and a build number.

A version number +defines the interface version supported by the LDD or PDD. It is used to check +that an LDD and PDD are compatible. It is also checked against the version +requested by a client when it opens a channel.

The following shows +how the example device drivers set their version numbers:

inline TVersion RExDriverChannel::VersionRequired() + { + return (TVersion(EUartMajorVersionNumber, + EUartMinorVersionNumber, + EUartBuildVersionNumber)); + } // LDD Factory object Constructor +DExDriverLogicalDevice::DExDriverLogicalDevice () + { + iVersion = RExDriverChannel::VersionRequired(); + } // PDD Factory object Constructor +DExH4PhysicalDevice::DExH4PhysicalDevice () + { + iVersion= RExDriverChannel::VersionRequired(); + }
+
Version compatibility

The +Kernel provides the Kern::QueryVersionSupported() API to +enforce a consistent set of rules for checking version compatibility. It returns +true if one of the following conditions is true:

    +
  • the major version of +the client is less than the major version of the driver.

  • +
  • the major version of +the client is equal to the major version of the driver, and the minor version +of the client is less than or equal to the minor version of the driver.

  • +

DLogicalChannel::DoCreate() typically checks +the client version against the driver using this API.

// Logical Channel Second stage constructor +TInt DExDriverLogicalChannel::DoCreate(TInt /*aUnit*/, const TDesC8* +/*anInfo*/, const TVersion& aVer) + { + ... + // Version check + if(!Kern::QueryVersionSupported(RExDriver::VersionRequired(), +aVer)) + return KErrNotSupported; + ... + }

When the device framework searches for a corresponding +PDD factory object for an LDD, it calls DPhysicalDevice::Validate() on +each matching PDD factory object, passing the unit number and the optional +extra information block. The first PDD to return KErrNone is +accepted as the required PDD.

The example PDD's Validate() implementation +checks the version of the LDD against the PDD, using the Kern::QueryVersionSupported() API:

// PDD: Validate +TInt DExH4PhysicalDevice::Validate(TInt aUnit, const TDesC8* +/*aInfo*/, const TVersion& aVer) + { + ... + // Version check + if (!Kern::QueryVersionSupported(iVersion,aVer)) + return KErrNotSupported; + ... + }
\ No newline at end of file