DeviceID.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //-----------------------------------------------------------------------------
  2. // (c) 2008 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Fritz Dierks
  6. // $Header$
  7. //
  8. // License: This file is published under the license of the EMVA GENICAM_NAMESPACE Standard Group.
  9. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  10. // If for some reason you are missing this file please contact the EMVA or visit the website
  11. // (http://www.GENICAM_NAMESPACE.org) for a full copy.
  12. //
  13. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM_NAMESPACE STANDARD GROUP "AS IS"
  14. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM_NAMESPACE STANDARD GROUP
  17. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  23. // POSSIBILITY OF SUCH DAMAGE.
  24. //-----------------------------------------------------------------------------
  25. /*!
  26. \file
  27. */
  28. #ifndef CLPROTOCOL_DEVICEID_H
  29. #define CLPROTOCOL_DEVICEID_H
  30. #include <Base/GCBase.h>
  31. #include <Base/GCUtilities.h>
  32. #include <GenApi/PortImpl.h>
  33. #include <CLProtocol/CLAllSerial.h>
  34. #include <CLProtocol/CLProtocol.h>
  35. #include <CLProtocol/ISerial.h>
  36. #include <CLProtocol/CVersion.h>
  37. #include <iostream>
  38. #include <fstream>
  39. namespace CLProtocol
  40. {
  41. //! Helper class which can split DeviceIDs strings into tokens
  42. /*! \ingroup PublicInterfaces */
  43. class CLPROTOCOL_DECL CDeviceID
  44. {
  45. public:
  46. //! returns the token separator string
  47. static const char* GetTokenSeparator();
  48. //! returns the token separator string
  49. /** \deprecated This function has been declared <b>deprecated</b> because of a typo in the functions name. Use <b>CDeviceID::GetTokenSeparator()</b> instead.
  50. */
  51. GENICAM_DEPRECATED( static const char* GetTokenSeperator() );
  52. public:
  53. //! Constructor
  54. CDeviceID();
  55. //! parse string
  56. bool FromString(const GENICAM_NAMESPACE::gcstring &DeviceID);
  57. //! retrieves the directory the CL protocol driver is located in
  58. /*!
  59. \param ReplaceEnvironmentVariables If true environment variables like $(GENICAM_CLPROTOCOL)
  60. are replaced by their value.
  61. */
  62. GENICAM_NAMESPACE::gcstring GetDriverDirectory(const bool ReplaceEnvironmentVariables = true) const;
  63. //! retrieves the file name of the CL protocol driver
  64. GENICAM_NAMESPACE::gcstring GetDriverFileName() const;
  65. //! retrieves the path of the CL protocol driver is located in
  66. GENICAM_NAMESPACE::gcstring GetDriverPath() const;
  67. //! retrieves the manufacturer name of the camera
  68. GENICAM_NAMESPACE::gcstring GetCameraManufacturer() const;
  69. //! retrieves the camera family (may return empty string in case of a template)
  70. GENICAM_NAMESPACE::gcstring GetCameraFamily() const;
  71. //! retrieves the camera model (may return empty string in case of a template)
  72. GENICAM_NAMESPACE::gcstring GetCameraModel() const;
  73. //! retrieves the camera model's version in any format (may return empty string in case of a template)
  74. GENICAM_NAMESPACE::gcstring GetCameraVersion() const;
  75. //! retrieves the camera model's serial number in any format (may return empty string in case of a template)
  76. GENICAM_NAMESPACE::gcstring GetCameraSerialNumber() const;
  77. //! retrieves the ShortDeviceID/DeviceIDTemplate without the DriverDriectory and the Driver FileName in front
  78. GENICAM_NAMESPACE::gcstring GetShortDeviceID() const;
  79. //! retrieves the DeviceID without the DriverDriectory and the Driver FileName in front
  80. GENICAM_NAMESPACE::gcstring GetDeviceID(const bool ReplaceEnvironmentVariables = true) const;
  81. private:
  82. //! The positions of the tokens within the DeviceID string
  83. typedef enum
  84. {
  85. didDriverDirectory = 0,
  86. didDriverFileName = 1,
  87. didCameraManufacturer = 2,
  88. didCameraFamily = 3,
  89. didCameraModel = 4,
  90. didCameraVersion = 5,
  91. didCameraSerialNumber = 6
  92. } EDeviceIDIndex;
  93. //! The tokens which form the DeviceID
  94. GENICAM_NAMESPACE::gcstring_vector m_DeviceIDTokens;
  95. };
  96. }
  97. #endif // CLPROTOCOL_DEVICEID_H