TransportLayer.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //-----------------------------------------------------------------------------
  2. // Basler pylon SDK
  3. // Copyright (c) 2006-2021 Basler AG
  4. // http://www.baslerweb.com
  5. // Author: AH
  6. //-----------------------------------------------------------------------------
  7. /*!
  8. \file
  9. \brief Definiton of Transportlayer interface and the common Transportlayer base class
  10. */
  11. #ifndef __TRANSPORTLAYER__
  12. #define __TRANSPORTLAYER__
  13. #if _MSC_VER>1000
  14. #pragma once
  15. #endif // _MSC_VER>1000
  16. #include <pylon/Platform.h>
  17. #ifdef _MSC_VER
  18. # pragma pack(push, PYLON_PACKING)
  19. #endif /* _MSC_VER */
  20. #include <GenICamFwd.h>
  21. #include <pylon/stdinclude.h>
  22. #include <pylon/PylonBase.h>
  23. #include <pylon/DeviceFactory.h>
  24. #include <pylon/TlInfo.h>
  25. #include <pylon/Interface.h>
  26. namespace Pylon
  27. {
  28. /*!
  29. \ingroup Pylon_TransportLayer
  30. \interface ITransportLayer
  31. \brief The interface of Transport Layer objects
  32. Transport Layer objects are used for enumerating and creating devices accessible
  33. by a specific transport layer (like the Pylon1394 or the PylonGigE transport layer).
  34. */
  35. interface PUBLIC_INTERFACE ITransportLayer : public IDeviceFactory
  36. {
  37. /*!
  38. \brief Returns a CTlInfo object holding information about the transport layer.
  39. \return Returns a CTlInfo object holding information about the transport layer.
  40. */
  41. virtual CTlInfo GetTlInfo() const = 0;
  42. /*!
  43. \brief Creates and returns an 'empty' Device Info object appropriate for the transport layer.
  44. Device Info objects returned by the CreateDeviceInfo() method are used to create
  45. devices from device info objects that are not the result of a device enumeration process but are
  46. provided by the user. The user is responsible for
  47. filling in the fields of the Device Info object that are needed to identify and create a device.
  48. Example: To open a GigE device for which the IP address is known, the user lets the Transport Layer object
  49. create a Device Info object, specifies the IP address and passes the device info object to the
  50. CreateDevice() method.
  51. */
  52. virtual CDeviceInfo CreateDeviceInfo() = 0;
  53. /*! \brief Returns the GenApi node map used for accessing parameters provided by the transport layer.
  54. \return NULL, if the transport layer doesn't provide parameters, a pointer to the parameter node map otherwise.
  55. */
  56. virtual GenApi::INodeMap* GetNodeMap() = 0;
  57. /*! \brief Retrieves a list of available interfaces. An interface may represent a frame grabber board, a network card, etc.
  58. \note Currently, this method is used mainly for the pylon GenTL Consumer transport layer, which is used for CoaXPress, for example.
  59. All other pylon transport layers return one default interface. The default interface will forward
  60. all IDeviceFactory methods to the transport layer that created the interface object. The default interface does not provide a node map.
  61. \param[out] list The list to be filled with interface info objects. The list contains Pylon::CInterfaceInfo objects used for the interface
  62. creation. It is ordered by device class and interface ID using the operator Pylon::CInterfaceInfo::operator<().
  63. \param[in] addToList If true, devices found will be added to the list instead of clearing the list.
  64. By default, the list passed in will be cleared.
  65. \return Number of interfaces provided by the transport layer.
  66. \threading
  67. This method is thread-safe.
  68. \error
  69. Can throw C++ exceptions.
  70. */
  71. virtual int EnumerateInterfaces( InterfaceInfoList_t& list, bool addToList = false ) = 0;
  72. /*! \brief Creates an interface object from an interface info object.
  73. \param[in] interfaceInfo The Interface info object. You can pass an interface info object returned by EnumerateInterfaces()
  74. or a user-provided interface info object.
  75. User-provided interface info objects can be preset with properties required for an interface, e.g.
  76. the interface ID. The implementation tries to find a matching interface.
  77. \return Returns the pointer to the interface created.
  78. \post The interface created must be freed by calling DestroyInterface(). The transport layer is not destroyed as long as the interface is not destroyed.
  79. Never try to delete a pointer to an interface object by calling free or delete. Always use the DestroyInterface() method.
  80. \error
  81. Throws an exception if creating the interface fails.
  82. \threading
  83. This method is thread-safe.
  84. */
  85. virtual IInterface* CreateInterface( const CInterfaceInfo& interfaceInfo ) = 0;
  86. /*! \brief Destroys an interface.
  87. \param[in] pInterface The pointer to an interface created by this transport layer.
  88. \pre The interface has been created by this transport layer using CreateInterface() and has not been destroyed using DestroyInterface() yet.
  89. \post The interface is deleted and must not be used any longer.
  90. \error
  91. Throws a C++ exception if the preconditions are not met.
  92. \threading
  93. This method is thread-safe.
  94. */
  95. virtual void DestroyInterface( IInterface* pInterface ) = 0;
  96. };
  97. }
  98. #ifdef _MSC_VER
  99. # pragma pack(pop)
  100. #endif /* _MSC_VER */
  101. #endif /* __TRANSPORTLAYER__ */