GrabBag/Device/GalaxyDevice/_Inc/GalaxySDKManager.h

71 lines
1.7 KiB
C
Raw Normal View History

2025-12-20 16:18:12 +08:00
#ifndef GALAXYSDKMANAGER_H
#define GALAXYSDKMANAGER_H
#include <mutex>
#include <atomic>
// Galaxy SDK 头文件
#ifdef _WIN32
// Windows 平台使用 C++ API
#define _WINSOCKAPI_ // 防止winsock.h被包含避免与winsock2.h冲突
#include "GXIAPIBase.h"
#include "IGXFactory.h"
using namespace GxIAPICPP;
#else
// Linux/ARM 平台使用 C API
#include "GxIAPI.h"
#endif
/**
* @brief GalaxySDKManager
* Galaxy SDK的全局初始化和反初始化
* 使SDK在所有设备关闭后才反初始化
*/
class GalaxySDKManager
{
public:
/**
* @brief
* @return
*/
static GalaxySDKManager& GetInstance();
/**
* @brief SDK+1
* @return 0--
*/
int InitSDK();
/**
* @brief SDK-10
* @return 0--
*/
int UninitSDK();
/**
* @brief SDK是否已初始化
* @return true-false-
*/
bool IsSDKInitialized() const;
/**
* @brief
* @return
*/
int GetRefCount() const;
private:
GalaxySDKManager();
~GalaxySDKManager();
// 禁止拷贝和赋值
GalaxySDKManager(const GalaxySDKManager&) = delete;
GalaxySDKManager& operator=(const GalaxySDKManager&) = delete;
std::mutex m_mutex; // 互斥锁
std::atomic<int> m_refCount; // 引用计数
bool m_bSDKInitialized; // SDK是否已初始化
};
#endif // GALAXYSDKMANAGER_H