BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
6d005738
Commit
6d005738
authored
Mar 24, 2019
by
Ashish Syal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated bsec file
parent
2bba5e29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
component.c
apps/YellowSensorToCloud/components/sensors/bsec/component.c
+13
-12
No files found.
apps/YellowSensorToCloud/components/sensors/bsec/component.c
View file @
6d005738
...
...
@@ -3,10 +3,11 @@
#include <jansson.h>
/// Input resource path
#define RES_PATH_VALUE "value"
#define RES_PATH_CONFIG "Bmeconfig"
#define JSON_EXAMPLE "{\"samplingRate\":\"SAMPLING_RATE_LP\",\"enableIaq\":true,\"enableCo2Equivalent\":true,\"enableBreathVoc\":true,"\
"\"enablePressure\":true,\"enableTemperature\":false,\"enableHumidity\":false}"
#define RES_PATH_VALUE "bme/value"
#define RES_PATH_CONFIG "bme/config"
#define JSON_EXAMPLE "{\"timestamp\":1,\"iaqValue\":1,\"iaqAccuracy\":1,\"co2EquivalentValue\":1,"\
"\"co2EquivalentAccuracy\":1,\"breathVocValue\":1,\"breathVocAccuracy\":1,"\
"\"pressure\":1,\"temperature\":1,\"humidity\":1 }"
static
void
BmeConfigPushHandler
(
double
timestamp
,
const
char
*
jsonStr
,
void
*
context
)
{
...
...
@@ -95,21 +96,21 @@ static void SensorReadingHandler(
if
(
reading
->
iaq
.
valid
)
{
json_object_set_new
(
jsonBme
,
"iaq
_v
alue"
,
json_real
(
reading
->
iaq
.
value
));
json_object_set_new
(
jsonBme
,
"iaq
_a
ccuracy"
,
json_integer
(
reading
->
iaq
.
accuracy
));
json_object_set_new
(
jsonBme
,
"iaq
V
alue"
,
json_real
(
reading
->
iaq
.
value
));
json_object_set_new
(
jsonBme
,
"iaq
A
ccuracy"
,
json_integer
(
reading
->
iaq
.
accuracy
));
}
if
(
reading
->
co2Equivalent
.
valid
)
{
json_object_set_new
(
jsonBme
,
"co2
_equivalent_v
alue"
,
json_real
(
reading
->
co2Equivalent
.
value
));
json_object_set_new
(
jsonBme
,
"co2
_equivalent_a
ccuracy"
,
json_integer
(
reading
->
co2Equivalent
.
accuracy
));
json_object_set_new
(
jsonBme
,
"co2
EquivalentV
alue"
,
json_real
(
reading
->
co2Equivalent
.
value
));
json_object_set_new
(
jsonBme
,
"co2
EquivalentA
ccuracy"
,
json_integer
(
reading
->
co2Equivalent
.
accuracy
));
}
if
(
reading
->
breathVoc
.
valid
)
{
json_object_set_new
(
jsonBme
,
"breath
_voc_v
alue"
,
json_real
(
reading
->
breathVoc
.
value
));
json_object_set_new
(
jsonBme
,
"breath
_voc_a
ccuracy"
,
json_integer
(
reading
->
breathVoc
.
accuracy
));
json_object_set_new
(
jsonBme
,
"breath
VocV
alue"
,
json_real
(
reading
->
breathVoc
.
value
));
json_object_set_new
(
jsonBme
,
"breath
VocA
ccuracy"
,
json_integer
(
reading
->
breathVoc
.
accuracy
));
}
if
(
reading
->
pressure
.
valid
)
...
...
@@ -149,10 +150,10 @@ COMPONENT_INIT
LE_FATAL_IF
(
res
!=
LE_OK
,
"Couldn't create config data hub output - %s"
,
LE_RESULT_TXT
(
res
));
// io_MarkOptional(RES_PATH_CONFIG);
io_AddJsonPushHandler
(
RES_PATH_CONFIG
,
BmeConfigPushHandler
,
NULL
);
io_SetJsonExample
(
RES_PATH_CONFIG
,
JSON_EXAMPLE
);
LE_ASSERT_OK
(
io_CreateInput
(
RES_PATH_VALUE
,
IO_DATA_TYPE_JSON
,
""
));
io_SetJsonExample
(
RES_PATH_VALUE
,
JSON_EXAMPLE
);
mangOH_bme680_AddSensorReadingHandler
(
SensorReadingHandler
,
NULL
);
}
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