76 lines
2.6 KiBLFS
C++
76 lines
2.6 KiBLFS
C++
/**
|
|
* @file
|
|
*
|
|
* @author Max Lammers <max@senseglove.com>
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* Copyright (c) 2020 - 2023 SenseGlove
|
|
*
|
|
* @section DESCRIPTION
|
|
*
|
|
* Used to retrieve serial port information on this PC, before actually
|
|
* connecting.
|
|
* Placed in a separate class because so that this is the only one accessing
|
|
* the Serial library.
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "PortInfo.hpp"
|
|
#include "Platform.hpp"
|
|
|
|
namespace SGConnect
|
|
{
|
|
class SerialPorts;
|
|
}// namespace SGConnect
|
|
|
|
/// <summary> Utility Class to retrieve serial ports and their relevant information. </summary>
|
|
class SGConnect::SerialPorts
|
|
{
|
|
public:
|
|
/// <summary> Retrieve detailed port into of everything connected to this system </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static std::vector<std::string> GetPorts();
|
|
|
|
/// <summary> Get ports that represent Sense Glove connections, Optional Bluetooth filter </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static std::vector<PortInfo> GetSGPorts(bool bWithBluetooth);
|
|
|
|
/// <summary> Get all bluetooth ports that represent Sense Glove connections, Optional Bluetooth filter </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static std::vector<PortInfo> GetBluetoothPorts(bool bWithWired);
|
|
|
|
/// <summary> Returns true if a hardware_id indicated that is a Bluetooth connection </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static bool IsBluetoothPort(const std::string& hardwareId);
|
|
|
|
/// <summary> Returns true if this Bluetooth port can be opened without locking the application. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static bool IsValidBluetoothPort(const std::string& hardwareId);
|
|
|
|
/// <summary> Returns true if this hardware id belongs to a Sense Glove Device. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
static bool IsSenseGlovePort(const std::string& hardwareId);
|
|
|
|
public:
|
|
SerialPorts() = delete;
|
|
virtual ~SerialPorts() = delete;
|
|
}; |