193 lines
8.0 KiB
C++
193 lines
8.0 KiB
C++
/**
|
|||
|
|
* @file KglSystem.h
|
||
|
|
*
|
||
|
|
* Copyright (c) 2019 Keyence Corporation.
|
||
|
|
* All rights reserved.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <cstdint>
|
||
|
|
|
||
|
|
#include <KglDefine.h>
|
||
|
|
#include <KglResult.h>
|
||
|
|
|
||
|
|
|
||
|
|
namespace Keyence
|
||
|
|
{
|
||
|
|
class KglString;
|
||
|
|
class KglInterface;
|
||
|
|
class KglDeviceInfo;
|
||
|
|
|
||
|
|
//-------------------------------------------------------------------------
|
||
|
|
namespace Impl
|
||
|
|
{
|
||
|
|
class KglSystemImpl;
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Provides functions related to the entire Kglib.
|
||
|
|
* Its main tasks are to initialize Kglib, to detect the network adapter, and to detect cameras that can be connected.
|
||
|
|
* \~Japanese @brief Kglib全体に関する機能を提供する単一モジュールです。
|
||
|
|
* 主なタスクは、Kglibの初期化、ネットワークアダプタの検出、接続可能なカメラの検出です。
|
||
|
|
*/
|
||
|
|
class KGLLIB_API KglSystem
|
||
|
|
{
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieve the Kglib version.
|
||
|
|
* The Kglib version number is formatted as X.Y.Z. X is the major version, Y is the minor version, and Z is the sub-minor version.
|
||
|
|
* \~Japanese @brief Kglibのバージョン情報を取得します。
|
||
|
|
* kglibのバージョン番号は、X.Y.Zの形式です。Xはメジャーバージョン、Yはマイナーバージョン、Zはサブマイナーバージョンです。
|
||
|
|
* \~English @param [out] major Major version.
|
||
|
|
* \~Japanese @param [out] major メジャーバージョン。
|
||
|
|
* \~English @param [out] minor Minor version.
|
||
|
|
* \~Japanese @param [out] minor マイナーバージョン。
|
||
|
|
* \~English @param [out] subminor Sub-minor version.
|
||
|
|
* \~Japanese @param [out] subminor サブマイナーバージョン。
|
||
|
|
*/
|
||
|
|
static void getKglibVersion(int& major, int& minor, int& subminor);
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Initialize the entire Kglib.
|
||
|
|
* Make sure to execute this before using other class or function of Kglib.
|
||
|
|
* \~Japanese @brief Kglib全体を初期化します。
|
||
|
|
* 他のKglibのクラス・関数を使う前に必ず実行してください。
|
||
|
|
* \~English @retval KGL_GENERIC_ERROR An unexpected error has occurred. (Example: Loading a dll failed.)
|
||
|
|
* \~Japanese @retval KGL_GENERIC_ERROR 予期せぬエラーが発生しました。 (例: dllのロード失敗)
|
||
|
|
* \~English @retval KGL_SUCCESS Success.
|
||
|
|
* \~Japanese @retval KGL_SUCCESS 成功。
|
||
|
|
*/
|
||
|
|
static KglResult initialize();
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Default constructor.
|
||
|
|
* \~Japanese @brief デフォルトコンストラクタ。
|
||
|
|
*/
|
||
|
|
KglSystem();
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Destructor.
|
||
|
|
* \~Japanese @brief デストラクタ。
|
||
|
|
*/
|
||
|
|
~KglSystem();
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Search for cameras connected to the PC.
|
||
|
|
* This function does not return a value until the duration specified by setDetectionTimeout() elapses. The search result can be retrieved by using the getDeviceCount() or getDeviceInfo() function.
|
||
|
|
* \~Japanese @brief PCに接続されているカメラを検索します。
|
||
|
|
* この関数は、 setDetectionTimeout() で指定された時間が経つまでreturnしません。検索結果は、 getDeviceCount() や getDeviceInfo() で取得できます。
|
||
|
|
* \~English @retval KGL_SUCCESS Success.
|
||
|
|
* \~Japanese @retval KGL_SUCCESS 成功。
|
||
|
|
*/
|
||
|
|
KglResult find();
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves the waiting time to search for cameras.
|
||
|
|
*
|
||
|
|
* \~Japanese @brief カメラを検索するときの待ち時間を取得します。
|
||
|
|
*
|
||
|
|
* \~English @return Waiting time [ms].
|
||
|
|
* \~Japanese @return 待ち時間[ms]。
|
||
|
|
*/
|
||
|
|
uint32_t getDetectionTimeout() const;
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Specifies the waiting time [ms] to search for cameras.
|
||
|
|
* \~Japanese @brief カメラを検索するときの待ち時間[ms]を設定します。
|
||
|
|
* \~English @param [in] timeout Waiting time [ms].
|
||
|
|
* \~Japanese @param [in] timeout 待ち時間[ms]。
|
||
|
|
*/
|
||
|
|
void setDetectionTimeout(uint32_t timeout);
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves whether subnet broadcasts are used to search for cameras.
|
||
|
|
* \~Japanese @brief カメラを検索する際にsubnet broadcastsを使用するか否かを取得します。
|
||
|
|
* \~English @return True is returned when subnet broadcasts are used.
|
||
|
|
* \~Japanese @return 使用する場合はtrueを返します。
|
||
|
|
*/
|
||
|
|
bool getSubnetBroadcastEnabled() const;
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Sets whether subnet broadcasts are used to search for cameras.
|
||
|
|
* \~Japanese @brief カメラを検索する際にsubnet broadcastsを使用するか否かを設定します。
|
||
|
|
* \~English @param [in] bEnable Sets true to use subnet broadcasts.
|
||
|
|
* \~Japanese @param [in] bEnable 使用する場合はtrueを設定します。
|
||
|
|
*/
|
||
|
|
void setSubnetBroadcastEnabled(bool bEnable);
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves the version of the supported GigE Vision standard.
|
||
|
|
* \~Japanese @brief サポートしているGigEVision規格のバージョンを取得します。
|
||
|
|
* \~English @return GigE Vision standard version.
|
||
|
|
* The first 16 bits stores the major version, and the last 16 bits stores the minor version.
|
||
|
|
* \~Japanese @return GigEVision規格バージョン。
|
||
|
|
* 上位16bitにメジャーバージョン、下位16bitにマイナーバージョンを格納します。
|
||
|
|
*/
|
||
|
|
uint32_t getGEVSupportedVersion() const;
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves the number of cameras connected to the PC.
|
||
|
|
* \~Japanese @brief PCに接続されているカメラの数を取得します。
|
||
|
|
* \~English @return Number of cameras.
|
||
|
|
* \~Japanese @return カメラの数。
|
||
|
|
*/
|
||
|
|
uint32_t getDeviceCount() const;
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves the information on the cameras connected to the PC.
|
||
|
|
* \~Japanese @brief PCに接続されているカメラの情報を取得します。
|
||
|
|
* \~English @param [in] idx Index (0 <= idx < KglSystem::getDeviceCount() )
|
||
|
|
* \~Japanese @param [in] idx インデックス(0 <= idx < KglSystem::getDeviceCount() )
|
||
|
|
* \~English @return Pointer to the KglDeviceInfo object.
|
||
|
|
* Returns NULL if the index is out of range.
|
||
|
|
* \~Japanese @return KglDeviceInfoオブジェクトへのポインタ。
|
||
|
|
* もしインデックスが範囲外の場合はNULLを返します。
|
||
|
|
*/
|
||
|
|
const KglDeviceInfo* getDeviceInfo(uint32_t idx) const;
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves the number of interfaces connected to the PC.
|
||
|
|
* \~Japanese @brief PCに接続されているインターフェース数を取得します。
|
||
|
|
* \~English @return Number of interfaces.
|
||
|
|
* \~Japanese @return インターフェース数。
|
||
|
|
*/
|
||
|
|
uint32_t getInterfaceCount() const;
|
||
|
|
|
||
|
|
//------------------------------------------------------------
|
||
|
|
/**
|
||
|
|
* \~English @brief Retrieves the information on the interfaces connected to the PC.
|
||
|
|
* \~Japanese @brief PCに接続されているインターフェースの情報を取得します。
|
||
|
|
* \~English @param [in] idx Index (0 <= idx < KglSystem::getInterfaceCount() )
|
||
|
|
* \~Japanese @param [in] idx インデックス(0 <= idx < KglSystem::getInterfaceCount() )
|
||
|
|
* \~English @return Pointer to the KglInterface object.
|
||
|
|
* Returns NULL if the index is out of range.
|
||
|
|
* \~Japanese @return KglInterfaceオブジェクトへのポインタ。
|
||
|
|
* もしインデックスが範囲外の場合はNULLを返します。
|
||
|
|
*/
|
||
|
|
const KglInterface* getInterface(uint32_t idx) const;
|
||
|
|
|
||
|
|
private:
|
||
|
|
|
||
|
|
Impl::KglSystemImpl* _pImpl;
|
||
|
|
};
|
||
|
|
|
||
|
|
}; //end of namespace Keyence
|