Skip to content

Commit 97d7edc

Browse files
committed
initial import
0 parents  commit 97d7edc

21 files changed

+2904
-0
lines changed

.gitignore

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
8+
*.sln.docstates
9+
10+
# User-specific files (MonoDevelop/Xamarin Studio)
11+
*.userprefs
12+
13+
# Build results
14+
[Dd]ebug/
15+
[Dd]ebugPublic/
16+
[Rr]elease/
17+
[Rr]eleases/
18+
x64/
19+
x86/
20+
bld/
21+
[Bb]in/
22+
[Oo]bj/
23+
[Ll]og/
24+
25+
# Visual Studio 2015 cache/options directory
26+
.vs/
27+
# Uncomment if you have tasks that create the project's static files in wwwroot
28+
#wwwroot/
29+
30+
# MSTest test Results
31+
[Tt]est[Rr]esult*/
32+
[Bb]uild[Ll]og.*
33+
34+
# NUNIT
35+
*.VisualState.xml
36+
TestResult.xml
37+
38+
# Build Results of an ATL Project
39+
[Dd]ebugPS/
40+
[Rr]eleasePS/
41+
dlldata.c
42+
43+
# DNX
44+
project.lock.json
45+
artifacts/
46+
47+
*_i.c
48+
*_p.c
49+
*_i.h
50+
*.ilk
51+
*.meta
52+
*.obj
53+
*.pch
54+
*.pdb
55+
*.pgc
56+
*.pgd
57+
*.rsp
58+
*.sbr
59+
*.tlb
60+
*.tli
61+
*.tlh
62+
*.tmp
63+
*.tmp_proj
64+
*.log
65+
*.vspscc
66+
*.vssscc
67+
.builds
68+
*.pidb
69+
*.svclog
70+
*.scc
71+
72+
# Chutzpah Test files
73+
_Chutzpah*
74+
75+
# Visual C++ cache files
76+
ipch/
77+
*.aps
78+
*.ncb
79+
*.opendb
80+
*.opensdf
81+
*.sdf
82+
*.cachefile
83+
84+
# Visual Studio profiler
85+
*.psess
86+
*.vsp
87+
*.vspx
88+
*.sap
89+
90+
# TFS 2012 Local Workspace
91+
$tf/
92+
93+
# Guidance Automation Toolkit
94+
*.gpState
95+
96+
# ReSharper is a .NET coding add-in
97+
_ReSharper*/
98+
*.[Rr]e[Ss]harper
99+
*.DotSettings.user
100+
101+
# JustCode is a .NET coding add-in
102+
.JustCode
103+
104+
# TeamCity is a build add-in
105+
_TeamCity*
106+
107+
# DotCover is a Code Coverage Tool
108+
*.dotCover
109+
110+
# NCrunch
111+
_NCrunch_*
112+
.*crunch*.local.xml
113+
nCrunchTemp_*
114+
115+
# MightyMoose
116+
*.mm.*
117+
AutoTest.Net/
118+
119+
# Web workbench (sass)
120+
.sass-cache/
121+
122+
# Installshield output folder
123+
[Ee]xpress/
124+
125+
# DocProject is a documentation generator add-in
126+
DocProject/buildhelp/
127+
DocProject/Help/*.HxT
128+
DocProject/Help/*.HxC
129+
DocProject/Help/*.hhc
130+
DocProject/Help/*.hhk
131+
DocProject/Help/*.hhp
132+
DocProject/Help/Html2
133+
DocProject/Help/html
134+
135+
# Click-Once directory
136+
publish/
137+
138+
# Publish Web Output
139+
*.[Pp]ublish.xml
140+
*.azurePubxml
141+
# TODO: Comment the next line if you want to checkin your web deploy settings
142+
# but database connection strings (with potential passwords) will be unencrypted
143+
*.pubxml
144+
*.publishproj
145+
146+
# NuGet Packages
147+
*.nupkg
148+
# The packages folder can be ignored because of Package Restore
149+
**/packages/*
150+
# except build/, which is used as an MSBuild target.
151+
!**/packages/build/
152+
# Uncomment if necessary however generally it will be regenerated when needed
153+
#!**/packages/repositories.config
154+
# NuGet v3's project.json files produces more ignoreable files
155+
*.nuget.props
156+
*.nuget.targets
157+
158+
# Microsoft Azure Build Output
159+
csx/
160+
*.build.csdef
161+
162+
# Microsoft Azure Emulator
163+
ecf/
164+
rcf/
165+
166+
# Microsoft Azure ApplicationInsights config file
167+
ApplicationInsights.config
168+
169+
# Windows Store app package directories and files
170+
AppPackages/
171+
BundleArtifacts/
172+
Package.StoreAssociation.xml
173+
_pkginfo.txt
174+
175+
# Visual Studio cache files
176+
# files ending in .cache can be ignored
177+
*.[Cc]ache
178+
# but keep track of directories ending in .cache
179+
!*.[Cc]ache/
180+
181+
# Others
182+
ClientBin/
183+
~$*
184+
*~
185+
*.dbmdl
186+
*.dbproj.schemaview
187+
*.pfx
188+
*.publishsettings
189+
node_modules/
190+
orleans.codegen.cs
191+
192+
# Since there are multiple workflows, uncomment next line to ignore bower_components
193+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
194+
#bower_components/
195+
196+
# RIA/Silverlight projects
197+
Generated_Code/
198+
199+
# Backup & report files from converting an old project file
200+
# to a newer Visual Studio version. Backup files are not needed,
201+
# because we have git ;-)
202+
_UpgradeReport_Files/
203+
Backup*/
204+
UpgradeLog*.XML
205+
UpgradeLog*.htm
206+
207+
# SQL Server files
208+
*.mdf
209+
*.ldf
210+
211+
# Business Intelligence projects
212+
*.rdl.data
213+
*.bim.layout
214+
*.bim_*.settings
215+
216+
# Microsoft Fakes
217+
FakesAssemblies/
218+
219+
# GhostDoc plugin setting file
220+
*.GhostDoc.xml
221+
222+
# Node.js Tools for Visual Studio
223+
.ntvs_analysis.dat
224+
225+
# Visual Studio 6 build log
226+
*.plg
227+
228+
# Visual Studio 6 workspace options file
229+
*.opt
230+
231+
# Visual Studio LightSwitch build output
232+
**/*.HTMLClient/GeneratedArtifacts
233+
**/*.DesktopClient/GeneratedArtifacts
234+
**/*.DesktopClient/ModelManifest.xml
235+
**/*.Server/GeneratedArtifacts
236+
**/*.Server/ModelManifest.xml
237+
_Pvt_Extensions
238+
239+
# Paket dependency manager
240+
.paket/paket.exe
241+
242+
# FAKE - F# Make
243+
.fake/
244+
245+
# JetBrains Rider
246+
.idea/
247+
*.sln.iml
248+
249+
# Visual Micro
250+
__vm/*

BufferInfo.cpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* The MIT License(MIT)
3+
* Copyright(c) 2016 Lorenzo Delana, https://searchathing.com
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a
6+
* copy of this software and associated documentation files (the "Software"),
7+
* to deal in the Software without restriction, including without limitation
8+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
* and/or sell copies of the Software, and to permit persons to whom the
10+
* Software is furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*/
23+
24+
#include "DebugMacros.h"
25+
#include "BufferInfo.h"
26+
27+
namespace SearchAThing
28+
{
29+
30+
namespace Arduino
31+
{
32+
33+
BufferInfo::BufferInfo()
34+
{
35+
}
36+
37+
BufferInfo::BufferInfo(byte *_buf, uint16_t _capacity)
38+
{
39+
buf = _buf;
40+
len = capacity = _capacity;
41+
}
42+
43+
byte *BufferInfo::Buf() { return buf; }
44+
const byte *BufferInfo::ConstBuf() const { return buf; }
45+
46+
void BufferInfo::SetLength(uint16_t newLength)
47+
{
48+
if (newLength > capacity)
49+
{
50+
#if defined DEBUG && defined DEBUG_ASSERT
51+
DPrintln(F("* Fatal : len>capacity"));
52+
#endif
53+
newLength = capacity;
54+
}
55+
len = newLength;
56+
}
57+
uint16_t BufferInfo::Length() const { return len; }
58+
uint16_t BufferInfo::Capacity() const { return capacity; }
59+
60+
}
61+
62+
}

BufferInfo.h

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* The MIT License(MIT)
3+
* Copyright(c) 2016 Lorenzo Delana, https://searchathing.com
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a
6+
* copy of this software and associated documentation files (the "Software"),
7+
* to deal in the Software without restriction, including without limitation
8+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
* and/or sell copies of the Software, and to permit persons to whom the
10+
* Software is furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
* DEALINGS IN THE SOFTWARE.
22+
*/
23+
24+
#ifndef _SEARCHATHING_ARDUINO_UTILS_BUFFER_INFO_H
25+
#define _SEARCHATHING_ARDUINO_UTILS_BUFFER_INFO_H
26+
27+
#if defined(ARDUINO) && ARDUINO >= 100
28+
#include "arduino.h"
29+
#else
30+
#include "WProgram.h"
31+
#endif
32+
33+
#include "DebugMacros.h"
34+
35+
namespace SearchAThing
36+
{
37+
38+
namespace Arduino
39+
{
40+
41+
// Container object for informations about a buffer its maximum
42+
// length ( capacity ) and its actual length.
43+
// There aren't provided functions for allocation/deallocation,
44+
// so any memory management has to be provided out of the box.
45+
class BufferInfo
46+
{
47+
byte *buf = NULL;
48+
uint16_t len = 0;
49+
uint16_t capacity = 0;
50+
51+
public:
52+
// Default constructor ( note: buf is NULL )
53+
BufferInfo();
54+
55+
// Constructor : initialize the container with given buffer
56+
// pointer and the capacity it has been already allocated
57+
// out of the box.
58+
BufferInfo(byte *_buf, uint16_t _capacity);
59+
60+
// Buffer pointer.
61+
byte *Buf();
62+
63+
// Buffer pointer ( const ).
64+
const byte *ConstBuf() const;
65+
66+
// Sets the length object variable.
67+
// Note this not change anything in the allocation storage.
68+
// If DEBUG;DEBUG_ASSERT defined a warning results if capacity
69+
// will exceeded.
70+
void SetLength(uint16_t _newLength);
71+
72+
// Actual length of the buffer.
73+
uint16_t Length() const;
74+
75+
// Capacity of the buffer.
76+
uint16_t Capacity() const;
77+
78+
};
79+
80+
}
81+
82+
}
83+
84+
#endif

0 commit comments

Comments
 (0)