forked from domoticz/domoticz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindowsHelper.h
54 lines (44 loc) · 1.29 KB
/
WindowsHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#if defined WIN32
#include <fstream>
class console
{
public:
console();
~console();
void OpenHideConsole();
BOOL IsConsoleVisible();
private:
BOOL SetConsoleWindowSize(const SHORT x, const SHORT y);
std::ofstream m_out;
std::ofstream m_err;
std::ifstream m_in;
std::streambuf* m_old_cout;
std::streambuf* m_old_cerr;
std::streambuf* m_old_cin;
};
bool InitWindowsHelper(HINSTANCE hInstance, HINSTANCE hPrevInstance, int nShowCmd, const std::string& address, const int iWebPort, const bool bStartWebBrowser);
void ShowSystemTrayNotification(const char *szMessage);
void RedirectIOToConsole();
BOOL TrayMessage(DWORD dwMessage, const char *szInfo);
//utsname
#define SYS_NMLN 32
struct utsname {
char sysname[SYS_NMLN]; /* Name of this OS. */
char nodename[SYS_NMLN]; /* Name of this network node. */
char release[SYS_NMLN]; /* Release level. */
char version[SYS_NMLN]; /* Version level. */
char machine[SYS_NMLN]; /* Hardware type. */
};
int uname(struct utsname *);
struct SerialPortInfo
{
std::string szDevPath;
std::string szFriendlyName;
std::string szPortName;
std::string szPortDesc;
bool bUsbDevice;
};
void EnumSerialPortsWindows(std::vector<SerialPortInfo> &serialports);
void EnumSerialFromWMI(std::vector<int> &ports, std::vector<std::string> &friendlyNames);
#endif