Device Functions

The device library implements a variety of generally useful functions for handling multiprotocol devices, but it is not meant to completely replace the use of LayGO API functions. For example, the stack must be configured and initialized in the usual way.

Devices are then created using dev_New() and disposed of using dev_Dispose(). A typical sequence of actions is:

  1. dev_Initialize()
  2. dev_New()
  3. dev_Open()
  4. dev_Connect()
  5. dev_Detach()
  6. Transfer data through the read/write CID or minor devices
  7. dev_Attach()
  8. dev_Disconnect()
  9. dev_Close()
  10. dev_Dispose()
  11. dev_Uninitialize()

Generally, the name of the file to be used as the device database should be set by calling dev_Initialize() before any other device functions are called, but this step can be omitted if the default device database is used. Also, since dev_Disconnect() will automatically attach the device and dev_Dispose() will automatically close the device, the sequence may be abbreviated:

  1. dev_New()
  2. dev_Open()
  3. dev_Connect()
  4. dev_Detach()
  5. Transfer data through the read/write CID or minor devices
  6. dev_Disconnect()
  7. dev_Dispose()
  8. dev_Uninitialize()

A variety of enhancements to the library are possible. For instance, a configuration file could be optionally associated with each device, from which each service would be configured. You are free to modify the source code in any way you think would be useful.