Google Custom Search     

LayGO® Device Library

Much of the work associated with building and using LayGO® devices is routine and can be automated to a considerable extent. The LayGO® device library demonstrates one approach to implementing the ability to conveniently handle multiprotocol devices and can be seen as an example of a LayGO® implementation. The C-source code of the Device Library is included in the LayGO® Toolkit distribution

The approach is based on using a device database. The database associates a symbolic device name with an ordered list of protocol services. (The services typically represent a major device, beginning with the physical layer, but the lowest layer might be a virtual circuit. If the lowest layer is a virtual circuit, the major device to which it belongs must be opened and connected first.) The order of the list determines the order in which the protocol services will be stacked.

Once the device is constructed, it can be treated as a single connection, despite the fact that it might make use of multiple CIDs (Connection IDentifiers) internally. A device can be opened, connected, detached, attached, disconnected and closed just as individual CIDs are. However, stacking and unstacking are done automatically.

If the top layer in a device is not multiplexed, it is the layer through which data is read and written. Once the device is connected, dev_GetReadWriteCid() will return the CID on which data transfer can take place using normal LayGO® API functions.

If the top layer is multiplexed, it is expected that lgo_Open() will be used to obtain minor device CIDs through which data transfer will take place. Alternatively, devices can be defined which consist solely of a virtual circuit or which have a virtual circuit as the lowest layer.

All the Library's functions are listed below. For detailed descriptions and examples, download the LayGO® documentation.

LayGO® Device Functions
dev_Attach Attach all layers in the device.
dev_Check Check if any layer in a device is not in data transfer state.
dev_Close Close all layers in the device.
dev_Connect Connect all layers in the device.
dev_Detach Detaches all layers in the device.
dev_Disconnect Disconnect all layers in the device.
dev_Dispose Dispose of a device and free all allocated memory associated with it.
dev_ErrorMessage Retrieve a human-readable string describing a device error code.
dev_Fix Fix a device reported broken by dev_Check
dev_GetLastError Retrieve the last LayGO® error code.
dev_GetProtocolCid Retrieve the CID of a given protocol layer.
dev_GetReadWriteCid Retrieve the CID of the top layer in a device.
dev_Initialize Initialize the library with the name of the device database.
dev_IsConnected Predicate to determine if all layers in a device are connected.
dev_New Create a new device.
dev_Open Open all layers in a device.
dev_Reopen Reopen all layers in a device.
dev_Unblock Reconnect any layers below the top layer which are not in data transfer state.
dev_Uninitialize Uninitialize the device library.

Go to top