BAOS SDK v2  1.2.1
An SDK providing access to IP-BAOS devices through BAOS binary protocol version 2.x
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1//
2// Copyright (c) 2002-2026 WEINZIERL ENGINEERING GmbH
3// All rights reserved.
4//
5// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
7// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
8// SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY,
9// WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
10// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
11//
12
13#ifndef __BAOSLIB_CONFIG_H__
14#define __BAOSLIB_CONFIG_H__
15
16#include "baos/BaosLib_export.h"
17
18
20#include <cstdint>
21#include <string>
22#include <vector>
24
25
31/*******************************************
32** Platform specific defines
33********************************************/
34
35//
36// Define WIN32_LEAN_AND_MEAN for windows to avoid include problems
37// with duplicate defines.
38//
39// From msdn: https://learn.microsoft.com/en-us/windows/win32/winsock/creating-a-basic-winsock-application
40// The Winsock2.h header file internally includes core elements from the Windows.h header file.
41// For historical reasons, the Windows.h header defaults to including the Winsock.h header file for Windows Sockets 1.1.
42// The declarations in the Winsock.h header file will conflict with the declarations in the Winsock2.h header file
43// required by Windows Sockets 2.0. The WIN32_LEAN_AND_MEAN macro prevents the Winsock.h from being included by the
44// Windows.h header.
45//
46// One solution is to include Winsock2.h before include Windows.h but other libraries (e.g. fmt) could include Windows.h
47// before we include Winsock2.h in TcpDriver_win.h.
48// So we use the secound solution: Define here WIN32_LEAN_AND_MEAN.
49//
50
51#ifdef WZPLATFORM_WIN32
52#if !defined(WIN32_LEAN_AND_MEAN)
53#define WIN32_LEAN_AND_MEAN
54#endif
55#endif
56
57// Disables Windows-specific min/max macros to prevent C++20 conflicts (C2589)
58#if defined(_WIN32)
59 #if !defined(NOMINMAX)
60 #define NOMINMAX
61 #endif
62#endif
63
64/*******************************************
65** Global types
66********************************************/
67
68namespace wz::baos
69{
70
71using Buffer = std::vector<std::uint8_t>;
72constexpr std::uint16_t MAX_TELEGRAM_LENGTH{4096};
73
74} // namespace wz::baos
75
76#endif // __BAOSLIB_CONFIG_H__
Global BAOS sdk namespace.
Definition config.h:69
std::vector< std::uint8_t > Buffer
An alias type for a byte buffer.
Definition config.h:71
constexpr std::uint16_t MAX_TELEGRAM_LENGTH
The maximum supported length for one BAOS telegram.
Definition config.h:72