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
dbf21c66
Commit
dbf21c66
authored
Dec 05, 2016
by
David Frey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not start AV session since lwm2mControl starts it
parent
b1c86963
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
49 deletions
+5
-49
wakeupAndTweet.adef
samples/tutorials/developerDay2016/apps/wakeupAndTweet.adef
+1
-1
main.cpp
...s/developerDay2016/components/wakeupAndTweet/src/main.cpp
+4
-48
No files found.
samples/tutorials/developerDay2016/apps/wakeupAndTweet.adef
View file @
dbf21c66
version:
2.0
version:
1.1
sandboxed: true
start: auto
...
...
samples/tutorials/developerDay2016/components/wakeupAndTweet/src/main.cpp
View file @
dbf21c66
...
...
@@ -26,8 +26,6 @@ static const uint32_t UnicodeSleepingFace = 0x1F634;
static
le_timer_Ref_t
LightSensorSampleTimer
;
static
bool
TweetPending
;
static
bool
AvConnecting
;
static
le_avdata_AssetInstanceRef_t
LightSensorAsset
;
...
...
@@ -150,52 +148,12 @@ static void LightSensorSampleTimerHandler
}
}
static
bool
TryStartTimer
(
void
)
{
const
bool
start
=
(
!
TweetPending
&&
!
AvConnecting
);
if
(
start
)
{
LE_ASSERT_OK
(
le_timer_Start
(
LightSensorSampleTimer
));
}
return
start
;
}
static
void
AvDataSessionStateHandler
(
le_avdata_SessionState_t
sessionState
,
void
*
contextPtr
)
{
switch
(
sessionState
)
{
case
LE_AVDATA_SESSION_STARTED
:
LE_DEBUG
(
"AV data session started"
);
AvConnecting
=
false
;
LightSensorAsset
=
le_avdata_Create
(
"LightSensor"
);
TryStartTimer
();
break
;
case
LE_AVDATA_SESSION_STOPPED
:
LE_WARN
(
"AirVantage session has stopped, but this was not requested"
);
break
;
default:
LE_FATAL
(
"Unhandled AV data session state (%d)"
,
sessionState
);
break
;
}
}
COMPONENT_INIT
{
LE_DEBUG
(
"wakeupAndTweetApp started"
);
TweetPending
=
true
;
AvConnecting
=
true
;
le_avdata_AddSessionStateHandler
(
AvDataSessionStateHandler
,
NULL
);
le_avdata_RequestSession
();
LightSensorAsset
=
le_avdata_Create
(
"LightSensor"
);
LightSensorSampleTimer
=
le_timer_Create
(
"light sensor"
);
LE_ASSERT_OK
(
le_timer_SetHandler
(
LightSensorSampleTimer
,
LightSensorSampleTimerHandler
));
...
...
@@ -205,7 +163,6 @@ COMPONENT_INIT
if
(
le_bootReason_WasAdc
(
LIGHT_SENSOR_ADC_NUM
))
{
TweetPending
=
true
;
LE_DEBUG
(
"Boot reason was ADC %u"
,
LIGHT_SENSOR_ADC_NUM
);
size_t
emojiLength
=
4
;
char
emoji
[
emojiLength
]
=
{
0
};
...
...
@@ -216,17 +173,16 @@ COMPONENT_INIT
auto
tweet
=
std
::
make_shared
<
std
::
string
>
(
tweetStream
.
str
());
if
(
wakeupAndTweet_ConnectAndRun
([
tweet
]{
SendTweet
(
tweet
->
c_str
());
TweetPending
=
false
;
TryStartTimer
();
LE_ASSERT_OK
(
le_timer_Start
(
LightSensorSampleTimer
));
})
!=
LE_OK
)
{
LE_ERROR
(
"Couldn't create data connection to send tweet"
);
TweetPending
=
false
;
LE_ASSERT_OK
(
le_timer_Start
(
LightSensorSampleTimer
))
;
}
}
else
{
LE_DEBUG
(
"Boot reason was not ADC %u"
,
LIGHT_SENSOR_ADC_NUM
);
TweetPending
=
false
;
LE_ASSERT_OK
(
le_timer_Start
(
LightSensorSampleTimer
))
;
}
}
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