|
|
|
Location:
k32std.h
Link against: ekern.lib
DPhysicalDevice
Supported from 5.0
The abstract base class for the PDD factory object.
This is also referred to as the physical device.
|
Defined in DPhysicalDevice:
CheckForSlowOpening(), CheckForSlowOpening(), CreateL(), DPhysicalDevice(), GetCaps(), Install(), IsAvailable(), Library(), QueryVersionSupported(), Remove(), iLibrary, iUnitsMask, iVersion, ~DPhysicalDevice()
Inherited from CBase:
operator new()
Inherited from CObject:
AccessCount(),
Close(),
Dec(),
FullName(),
Inc(),
Name(),
Open(),
Owner(),
SetName(),
SetNameL(),
SetOwner(),
UniqueID()
protected : DPhysicalDevice();
Default constructor.
The constructor is protected to prevent objects of this class from being constructed. This class is intended only as an abstract base for other classes.
Typically, a derived class constructor sets up the data
members: iVersion and iUnitsMask.
virtual TInt Install() = 0;
Completes the installation of this physical device.
The function is called by the Kernel after this factory object
has been successfully constructed on the Kernel heap as a result of a call to
User::LoadPhysicalDevice().
As a minimum, the function must define the name of the physical device; this is the way the physical device is identified. The name should be the same as the LDD name but followed by a dot and then a short string to represent the physical device; for example, ecomm.pccd for the comms PDD for the pc-card serial port. For example:
_LIT(KName,"Myname.xxxx");
return(SetName(&KName));
where CObject::SetName() is a member of the base
class, and the format of any name obeys the standard rules.
|
virtual void GetCaps(TDes8& aDes) const = 0;
Gets the capabilities of this physical device.
This function is not called by the device driver framework but is available to be called.
Symbian OS does not define how a device's capabilities are encoded. Any encoding scheme must be understood by the user side.
A common convention is simply to return the version of the PDD on the grounds that capabilities correlate with the version.
|
virtual CBase* CreateL(TInt aUnit,const TDesC* anInfo,const TVersion& aVer) = 0;
Creates a physical channel.
The function is called by the Kernel during the creation of a
logical channel as a consequence of a user side call to
RBusLogicalChannel::DoCreate() . This, in turn, is called by an
'open' type member function of a class derived from
RBusLogicalChannel supplied by the developer of the device
driver.
The physical channel is only created if the logical device
needs a physical device, i.e. if the KDeviceAllowPhysicalDevice
bit is set in the iParseMask data member of
DLogicalDevice.
The constructed object is always an instance of a class derived
from CBase. The device driver framework makes no particular
recommendation on the structure of this derived class.
For drivers which implement unit numbers, the implementation
should check that the device supports the specified unit number, either
directly in this function or in a delegated function which might be prototyped
as DoCreate(TInt aUnit), defined on the CBase derived
class. This function should also check the requested version number against the
version number with which this PDD is built.
A typical implementation might be:
{
if (!User::QueryVersionSupported(iVersion,aVer))
{
User::Leave(KErrNotSupported);
}
CBase* pD = new(ELeave) DSomePhysicalChannel();
TInt ret = pD->DoCreate(aUnit); // should also verify that this
// is valid for this device
if (ret != KErrNone)
{
delete pD;
User::Leave(ret);
}
return pD;
}
where DSomePhysicalChannel is a class is wholly
designed by the device driver writer.
|
|
KErrNotSupported if the combination of unit, version number and
additional information is not supported by the physical device.virtual TInt Remove();
Performs final processing before removing this physical device.
This function is called by the Kernel as a result of a call to
User::FreePhysicalDevice(). It is called before:
Close() is called on this object
Close() is called on the PDD library.
The function is also called by the Kernel if a call to
User::LoadPhysicalDevice() fails. Specifically, the function is
called if the attempt to add this DPhysicalDevice object to the
Kernel's list of physical devices fails. In this event, Remove()
is called before Close() is called on this object.
The function gives the logical device the opportunity to do any
further final processing before it is closed; it should return
KErrNone.
The default implementation just returns
KErrNone.
|
DPhysicalDevice object is
destroyed and the PDD library is unloaded when their respective reference
counts reach zero.virtual TBool QueryVersionSupported(const TVersion& aVer) const;
Tests whether the specified version is supported by this physical device.
The function is not called by device driver framework but is available to be called.
An implementation supplied by a derived class should decide whether the specified version is supported by this logical device and return true or false.
The default implementation returns the result of a call to
User::QueryVersionSupported() taking the version with which this
DPhysicalDevice object is built as the reference version and the
specified version as the test version; i.e. the default implementation returns
true if one of the following two conditions is true and returns false if
neither are true:
the aVer major number < this
DPhysicalDevice major number
the aVer major number == this
DPhysicalDevice major number && the
aVer minor number <= this DPhysicalDevice minor
number.
|
|
virtual TBool IsAvailable(TInt aUnit,const TDesC* anInfo) const;
Tests whether a unit is supported.
The function is not called by device driver framework but is available to be called.
An implementation supplied by a derived class should decide
whether the specified unit and the additional information specified by the
const TDesC* anInfo argument is supported, and return true if it
is or false if not.
The default implementation always returns true.
|
|
virtual TUint CheckForSlowOpening(TInt* aUnit);
Withdrawn in 6.1
Tests whether the device requires an asynchronous operation before and/or after opening a channel.
The function is called by the Kernel as part of the response to
the user side RBusLogicalChannel::DoCreate().
Such a function allows the power handling needs of the device to be addressed.
An implementation should decide whether the device needs an asynchronous operation and, if it does, whether it should be performed:
before opening the channel
after opening the channel
both before and after opening the channel.
The function must also put the unit number in
*aUnit and, if asynchronous operations are needed.
The default implementation returns zero which means that the device needs no asynchronous operations.
|
|
virtual TUint CheckForSlowOpening(TInt aUnit);
Supported from 6.1
Tests whether the device requires an asynchronous operation before and/or after opening a channel.
The function is called by the Kernel as part of the response to
the user side RBusLogicalChannel::DoCreate().
Such a function allows the power handling needs of the device to be addressed.
An implementation should decide whether the device needs an asynchronous operation and, if it does, whether it should be performed:
before opening the channel
after opening the channel
both before and after opening the channel.
The default implementation returns zero which means that the device needs no asynchronous operations.
|
|
DLibrary* Library();
Gets a pointer to the PDD library.
|
protected : TVersion iVersion;
The version of this physical device.
This is used to check that an LDD and PDD are compatible. Typically, this is set by the constructor of a derived class.
protected : TUint iUnitsMask;
Indicates which units are valid.
If units are allowed, i.e.
DLogicalDevice::iParseMask&KDeviceAllowMask returns true, then
this mask indicates which of the units (from 0 to 31) are valid.
The DLogicalDevice object associated with the LDD
has a similar mask, and both masks are used to indicate which units the LDD-PDD
pair can handle.
Typically, this is set by the constructor of a derived class.
private : DLibrary *iLibrary;
This is internal and is not intended for use.
It is a pointer to the PDD library.