/** Returns the drivers capabilities. This is not used by the Symbian OS device driver framework but may be useful for the LDD to use. @param aDes Descriptor to write capabilities information into */ void DZeroCopyLoopbackPddFactory::GetCaps(TDes8& aDes) const { // Create a capabilities object DZeroCopyLoopback::TCaps caps; caps.iVersion = iVersion; // Zero the buffer TInt maxLen = aDes.MaxLength(); aDes.FillZ(maxLen); // Copy cpabilities TInt size=sizeof(caps); if(size>maxLen) size=maxLen; aDes.Copy((TUint8*)&caps,size); }
void DMediaDriverTest::Caps(TDes8& aCapsBuf) // // Return the capabilities of the media { TLocalDriveCapsV2 caps; caps.iType=EMediaRam; caps.iConnectionBusType=EConnectionBusInternal; caps.iDriveAtt=KDriveAttLocal|KDriveAttRemovable; caps.iMediaAtt=KMediaAttFormattable; caps.iFileSystemId=KDriveFileSysFAT; caps.iHiddenSectors=0; aCapsBuf.FillZ(aCapsBuf.MaxLength()); aCapsBuf.Copy((TUint8 *)&caps,Min(aCapsBuf.MaxLength(),sizeof(caps))); }
/** Get the capabilities of the device. This function is not called by the Symbian OS. However can be used by the LDD to get the capabilities from the device/hardware. There is no definition for encoding capabilities, and is a matter of convention between the LDD and the PDD. @param aDes descriptor returned after filling with capabilities */ void DExDriverPhysicalDevice::GetCaps(TDes8& aDes) const { // Package buffer of TCommCapsV03. This creates a descriptor // for the commcaps structure, and provide compatibility // to use with API using descriptors // TCommCaps3 capsBuf; // Retrieves the data structure from the package buffer // TCommCapsV03 &caps=capsBuf(); // Baud rates supported by the UART device. However, channel may // be designed to support a subset of them as choice (applies to // other configurations as well). // caps.iRate=KCapsBps110|KCapsBps150|KCapsBps300|KCapsBps600\ |KCapsBps1200|KCapsBps2400|KCapsBps4800|KCapsBps9600\ |KCapsBps19200|KCapsBps38400|KCapsBps57600|KCapsBps115200; // Databit size caps.iDataBits=KCapsData5|KCapsData6|KCapsData7|KCapsData8; // Stop bits size supported caps.iStopBits=KCapsStop1|KCapsStop2; // Parity supported caps.iParity=KCapsParityNone|KCapsParityEven|KCapsParityOdd|KCapsParityMark|KCapsParitySpace; // Handshaking protocol supported by device caps.iHandshake=KCapsObeyXoffSupported|KCapsSendXoffSupported| KCapsObeyCTSSupported|KCapsFailCTSSupported| KCapsObeyDSRSupported|KCapsFailDSRSupported| KCapsObeyDCDSupported|KCapsFailDCDSupported| KCapsFreeRTSSupported|KCapsFreeDTRSupported; // Infrared mode caps.iSIR=1; // Signals supported caps.iSignals=KCapsSignalCTSSupported|KCapsSignalRTSSupported|KCapsSignalDTRSupported| KCapsSignalDSRSupported|KCapsSignalDCDSupported|KCapsSignalRNGSupported; // FIFO enable/disable caps.iFifo=KCapsHasFifo; // Notifications supported caps.iNotificationCaps=KNotifyDataAvailableSupported|KNotifySignalsChangeSupported; caps.iRoleCaps=0; caps.iFlowControlCaps=0; // Break supported caps.iBreakSupported=ETrue; // [TDes8::MaxLength()] - Get the descriptor's length. TInt len = aDes.MaxLength(); // [TDes8::FillZ(len)] -Fill the descriptor's data area with binary // zeroes, replacing any existing data and change its length. aDes.FillZ(len); TInt size = sizeof(caps); if (size>len) size=len; // [TDes8::Copy()] - Copy the data of length (size) into aDes descriptor // replacing any existing data in the descriptor. aDes.Copy((TUint8*)&caps, size); aDes=capsBuf.Left(Min(capsBuf.Length(),aDes.MaxLength())); }