Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
67aae770
Commit
67aae770
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
fix(ess): Show how to update a characteristic without a callback
parent
f88d12f6
No related branches found
No related tags found
1 merge request
!428
Environmental Sensing Service
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/ble/ble_api.h
+2
-1
2 additions, 1 deletion
epicardium/ble/ble_api.h
epicardium/ble/ess.c
+18
-8
18 additions, 8 deletions
epicardium/ble/ess.c
with
20 additions
and
9 deletions
epicardium/ble/ble_api.h
+
2
−
1
View file @
67aae770
...
...
@@ -22,7 +22,8 @@
/*************************************************************************************************/
void
BleStart
(
void
);
/* ATT client module interface. Used by main BLE module */
void
bleValueUpdate
(
attEvt_t
*
pMsg
);
void
bleDiscCback
(
dmConnId_t
connId
,
uint8_t
status
);
void
bleESS_update
();
This diff is collapsed.
Click to expand it.
epicardium/ble/ess.c
+
18
−
8
View file @
67aae770
...
...
@@ -70,7 +70,7 @@ static const attsAttr_t ESSSvcAttrList[] = {
.
pValue
=
initTemperatureValue
,
.
pLen
=
&
initTemperatureLen
,
.
maxLen
=
sizeof
(
initTemperatureValue
),
.
settings
=
ATTS_SET_READ_CBACK
,
//
.settings = ATTS_SET_READ_CBACK,
.
permissions
=
ATTS_PERMIT_READ
|
ATTS_PERMIT_READ_ENC
|
ATTS_PERMIT_READ_AUTH
,
},
...
...
@@ -80,10 +80,14 @@ static const attsAttr_t ESSSvcAttrList[] = {
WSF_CT_ASSERT
(
((
sizeof
(
ESSSvcAttrList
)
/
sizeof
(
ESSSvcAttrList
[
0
]))
==
ESS_END_HDL
-
ESS_START_HDL
+
1
));
#if 0
/*
* BLE ESS read callback.
*
* Disabled at the moment as no dynamic handling of read requests
* is needed and all fields are updated by bleESS_update()
*/
static uint8_t readESSCB(
dmConnId_t connId,
uint16_t handle,
...
...
@@ -95,29 +99,35 @@ static uint8_t readESSCB(
switch (handle) {
// Temperature
case ESS_TEMPERATURE_VAL_HDL:
//pAttr->pValue[0] = i16 & 0xFF; //pAttr->pValue[1] = i16 >> 8;
*
((
int16_t
*
)
pAttr
->
pValue
)
=
i16
;
APP_TRACE_INFO1
(
"ble-ess: read temperature: %d
\n
"
,
i16
);
//*((int16_t *)pAttr->pValue) = i16;
//APP_TRACE_INFO1("ble-ess: read temperature: %d\n", i16);
return ATT_SUCCESS;
default:
APP_TRACE_INFO0("ble-card10: read no handler found\n");
return ATT_ERR_HANDLE;
}
}
#endif
static
attsGroup_t
svcESSGroup
=
{
.
pNext
=
NULL
,
.
pAttr
=
(
attsAttr_t
*
)
ESSSvcAttrList
,
.
readCback
=
readESSCB
,
.
readCback
=
NULL
,
//.readCback = readESSCB,
.
writeCback
=
NULL
,
.
startHandle
=
ESS_START_HDL
,
.
endHandle
=
ESS_END_HDL
,
};
void
bleESS_update
(
void
)
{
uint16_t
i16
=
0
;
AttsSetAttr
(
ESS_TEMPERATURE_VAL_HDL
,
sizeof
(
i16
),
(
uint8_t
*
)
&
i16
);
}
/*
* This registers and starts the
BLE card10
service.
* This registers and starts the
ESS
service.
*/
void
bleESS_init
(
void
)
{
AttsAddGroup
(
&
svcESSGroup
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment