Skip to content

Commit e1f3d5f

Browse files
sveljkovveljko
authored andcommitted
Support for ESP32 and 'message crackers'
The `WiFiClient` of ESP32 has non-standard behavior. When the (TCP/IP) connection is closed, it will start returning 0 as the result of `available()`, even though not all octets were read, and one can actually still `read()` them. So, we need "a middle-man" to keep track of how many octets are actually available for reading. This is, unfortunately, a slightly incompatible change. You need to use the new class `PubNonSubClient` for this to work. So, even though you don't _have_ to (and then ESP32 will not work, but it didn't work either in v2), it is different and warrants a major version bump. Also, for ease of use, we introduced "message crackers", which should inspire users to avoid the old `Client` based interface, making it easier to do similar upgrades/changes in the future. Examples were also cleaned-up: * Use new high-level API (message crackers) * Use ArduinoJson library in the Josn example * Update comments * Remove not-very-useful examples * Reformat with Clang format
1 parent 56edae6 commit e1f3d5f

File tree

11 files changed

+1552
-926
lines changed

11 files changed

+1552
-926
lines changed

.clang-format

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: WebKit
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Right
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: true
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
SplitEmptyFunction: true
36+
SplitEmptyRecord: true
37+
SplitEmptyNamespace: true
38+
BreakBeforeBinaryOperators: NonAssignment
39+
BreakBeforeBraces: Stroustrup
40+
BreakBeforeInheritanceComma: false
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializersBeforeComma: false
43+
BreakConstructorInitializers: BeforeComma
44+
BreakAfterJavaFieldAnnotations: false
45+
BreakStringLiterals: true
46+
ColumnLimit: 80
47+
CommentPragmas: '^ IWYU pragma:'
48+
CompactNamespaces: false
49+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
50+
ConstructorInitializerIndentWidth: 4
51+
ContinuationIndentWidth: 4
52+
Cpp11BracedListStyle: false
53+
DerivePointerAlignment: false
54+
DisableFormat: false
55+
ExperimentalAutoDetectBinPacking: false
56+
FixNamespaceComments: true
57+
ForEachMacros:
58+
- foreach
59+
- Q_FOREACH
60+
- BOOST_FOREACH
61+
IncludeCategories:
62+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
63+
Priority: 2
64+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
65+
Priority: 3
66+
- Regex: '.*'
67+
Priority: 1
68+
IncludeIsMainRegex: '(Test)?$'
69+
IndentCaseLabels: false
70+
IndentWidth: 4
71+
IndentWrappedFunctionNames: false
72+
JavaScriptQuotes: Leave
73+
JavaScriptWrapImports: true
74+
KeepEmptyLinesAtTheStartOfBlocks: true
75+
MacroBlockBegin: ''
76+
MacroBlockEnd: ''
77+
MaxEmptyLinesToKeep: 2
78+
NamespaceIndentation: None
79+
ObjCBlockIndentWidth: 4
80+
ObjCSpaceAfterProperty: true
81+
ObjCSpaceBeforeProtocolList: true
82+
PenaltyBreakAssignment: 2
83+
PenaltyBreakBeforeFirstCallParameter: 19
84+
PenaltyBreakComment: 300
85+
PenaltyBreakFirstLessLess: 120
86+
PenaltyBreakString: 1000
87+
PenaltyExcessCharacter: 4
88+
PenaltyReturnTypeOnItsOwnLine: 100
89+
PointerAlignment: Left
90+
ReflowComments: true
91+
SortIncludes: false
92+
SortUsingDeclarations: true
93+
SpaceAfterCStyleCast: false
94+
SpaceAfterTemplateKeyword: true
95+
SpaceBeforeAssignmentOperators: true
96+
SpaceBeforeParens: ControlStatements
97+
SpaceInEmptyParentheses: false
98+
SpacesBeforeTrailingComments: 1
99+
SpacesInAngles: false
100+
SpacesInContainerLiterals: true
101+
SpacesInCStyleCastParentheses: false
102+
SpacesInParentheses: false
103+
SpacesInSquareBrackets: false
104+
Standard: Cpp11
105+
TabWidth: 4
106+
UseTab: Never
107+
...
108+

0 commit comments

Comments
 (0)