Skip to content

Commit 7e30976

Browse files
authored
Merge pull request #3 from ESP32Async/version
Introduce AsyncTCPVersion.h to more easily manage and use library version
2 parents 4fbabcf + 45cf45c commit 7e30976

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

src/AsyncTCP.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
#ifndef ASYNCTCP_H_
2323
#define ASYNCTCP_H_
2424

25-
#define ASYNCTCP_VERSION "3.3.2"
26-
#define ASYNCTCP_VERSION_MAJOR 3
27-
#define ASYNCTCP_VERSION_MINOR 3
28-
#define ASYNCTCP_VERSION_REVISION 2
25+
#include "AsyncTCPVersion.h"
2926
#define ASYNCTCP_FORK_ESP32Async
3027

3128
#include "IPAddress.h"

src/AsyncTCPVersion.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// SPDX-License-Identifier: LGPL-3.0-or-later
2+
// Copyright 2016-2025 Hristo Gochkov, Mathieu Carbou, Emil Muratov
3+
4+
#pragma once
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
/** Major version number (X.x.x) */
11+
#define ASYNCTCP_VERSION_MAJOR 3
12+
/** Minor version number (x.X.x) */
13+
#define ASYNCTCP_VERSION_MINOR 3
14+
/** Patch version number (x.x.X) */
15+
#define ASYNCTCP_VERSION_PATCH 2
16+
17+
/**
18+
* Macro to convert version number into an integer
19+
*
20+
* To be used in comparisons, such as ASYNCTCP_VERSION >= ASYNCTCP_VERSION_VAL(2, 0, 0)
21+
*/
22+
#define ASYNCTCP_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
23+
24+
/**
25+
* Current version, as an integer
26+
*
27+
* To be used in comparisons, such as ASYNCTCP_VERSION_NUM >= ASYNCTCP_VERSION_VAL(2, 0, 0)
28+
*/
29+
#define ASYNCTCP_VERSION_NUM ASYNCTCP_VERSION_VAL(ASYNCTCP_VERSION_MAJOR, ASYNCTCP_VERSION_MINOR, ASYNCTCP_VERSION_PATCH)
30+
31+
/**
32+
* Current version, as string
33+
*/
34+
#define df2xstr(s) #s
35+
#define df2str(s) df2xstr(s)
36+
#define ASYNCTCP_VERSION df2str(ASYNCTCP_VERSION_MAJOR) "." df2str(ASYNCTCP_VERSION_MINOR) "." df2str(ASYNCTCP_VERSION_PATCH)
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif

0 commit comments

Comments
 (0)