Compartir a través de


Socket Class (Windows CE 5.0)

Send Feedback

The socket class for the PC Card socket service shared code library can be found in %_WINCEROOT%\Public\Common\Oak\Drivers\PCCard\Common\Pcmciacardlib.h. This class template is used as a base for the socket class.

The socket class is a set of software that implements a socket service for an inserted PC Card. This class should be created by the PC Card bridge base class when a card is inserted. It should also be deleted once the card has been removed from the socket. Since a card can be removed and then re-instered quickly, the socket class should use a unique reference number when a new socket class is created.

The CPCMCIASocketBase template class is responsible for implementing the socket class. The following table shows the class template parameters for the socket class.

Parameter Description
TPcmciaMemWindowClass Memory window class
TPcmciaIOWindowClass I/O window class
TBridgeClass Bridge class
TBaseClass Base class for the CPCMCIASocketBase template class.

The TBaseClass parameter is useful for hardware that supports various socket types. For example, the TI1250 platform dependent driver (PDD) has two socket classes. The first class is for 16-bit PCMCIA cards, while the second class is for 32-bit CardBus cards. Both sockets are manipulated by the same bridge class. In order to simplify the design, the classes derive from a common base class that is used as the interface. This is accomplished using virtual functions that are implemented in the derived classes. Since the implementation of the two socket classes may be completely different, the CPCMCIASocketBase class will derive from the TBaseClass, where the TBaseClass is the common base class.

The CPCMCIASocketBase template also implements the CardSetWindow, CardGetWindow, CardInquireWindow and CardInitWindow socket service functions. This template creates and manages instances for memory or I/O window classes athrough the CPcmciaMemWindowImpl and CPcmciaIoWindowImpl classes.

In case a common base class is not needed, an example base class template is provided in %_WINCEROOT%\Public\Common\Oak\Drivers\PCCard\Common\Pcmciacardlibex.h. The following code example shows the example base class template.

template <class TBridgeClass>
class CStaticWindowBridgeContainer : public CRefObject, public ClockObject
{
protected:
     CStaticWindowBridgeContainer(TBridgeClass* pBridge)
     {
          m_pBridge=pBridge;
     }
     TBridgeClass* m_pBridge;
};

The only requirement for the base class is that the constructor must take a parameter of type TBridgeClass* and store it in the m_pBridge member. The CPCMCIASocketBase class can then access the bridge object using the m_pBridge pointer.

The CPCMCIASocketBase class creates and initializes memory and I/O windows. The initialization parameters are typically read from the registry. The CPCMCIASocketBaseClass accesses those parameters by calling the following TBridgeClass member functions. The following code example shows the TBridgeClass member functions.

BOOL LoadWindowsSettings ();
DWORD GetMemWindowCount() const{return m_nMemWindowCount;}
DWORD GetIoWindowCount() const{return m_nIoWindowCount;}
DWORD GetEntriesCount() const{return m_dwCount;}
DWORD GetEntryRepeatCount(DWORD dwEntry) const
const SS_Window_INFO* GetEntryWindowInfo(DWORD dwEntry) const
const SS_WINDOW_STATE* GetEntryWindowState(DWORD dwEntry) const

The TBridgeClass member functions are provided in the CPCCardBusBridgeClass. For more information, see Bridge Base Class.

See Also

PC Card Socket Service Shared Code Library | Window Classes | Bridge Base Class | Static Window Classes | PC Card Socket Service Shared Code Library Registry Settings

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.