Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
1978fdb2
Commit
1978fdb2
authored
Aug 08, 2016
by
Michael Ott
Browse files
Add toString() function for SensorId
parent
2589f831
Changes
2
Hide whitespace changes
Inline
Side-by-side
DCDBLib/include/sensorid.h
100644 → 100755
View file @
1978fdb2
...
...
@@ -104,6 +104,13 @@ public:
*/
std
::
string
serialize
()
const
;
/**
* @brief This function returns a hex string which corresponds to the
* supplied SensorId object.
* @return Returns a human-readable hex string of the SensorId.
*/
std
::
string
toString
()
const
;
/**
* @brief This function matches the sensor against a
* sensor pattern string.
...
...
DCDBLib/src/sensorid.cpp
View file @
1978fdb2
...
...
@@ -28,6 +28,7 @@
#include <algorithm>
#include <cstdint>
#include <cinttypes>
#include <cstdio>
#include <boost/algorithm/string.hpp>
...
...
@@ -150,6 +151,18 @@ std::string SensorId::serialize() const
return
std
::
string
((
char
*
)
ll
,
16
);
}
/**
* @details
* This function returns a hex representation of a SensorId as a
* 32-character std::string.
*/
std
::
string
SensorId
::
toString
()
const
{
char
buf
[
33
];
snprintf
(
buf
,
sizeof
(
buf
),
"%016lx%016lx"
,
data
.
raw
[
0
],
data
.
raw
[
1
]);
return
std
::
string
(
buf
);
}
/**
* @details
* This function strips all slashes from the pattern string and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment