BigW Consortium Gitlab

Commit 3ee97de2 by David Frey

Remove references to $MANGOH_ROOT from cdef files

The goal was to remove explicit paths where possible. In the case of the submodules, this helps to make them more useful as a standalone repository in case a use isn't interested in cloning the whole mangOH repository and all of the submodules. Also updated the developerDay2016 tutorial app to use AVC 2.0 so that it will work with Legato versions 17.05 and newer.
parent befd3ef7
Subproject commit 76f7560f98cb96b7e3f05797cfbdee0ed3f42c6b
Subproject commit 699e500ad32aaad5799a8b7e7b4244f67a13407a
Subproject commit e4ae027c9f447f84723f3fc1c872875166840cfa
Subproject commit e8395ae650c66c1ce044b7da7ea77a1e5e366171
Subproject commit 84b40089f470cd0574ca72bf1943c3bcb6f2842d
Subproject commit 96ca0364ccaf4c5ff8c7d6feaeb984c6958a6cf1
Subproject commit 6966f104db935ff771dcce229647255f0bb01fa2
Subproject commit 5b471995d594827c55cb7939b7e048b207080d68
Subproject commit 3c5de16d8c8390eb56b4961273877da43773f888
Subproject commit 6b24c67721832748c25d9a62751690afe52ed6fc
Subproject commit 24f0dc8aa1e2c19a6ac272d65be8a2e3085472e6
Subproject commit e71865bdd0cf367c99cdbaf62328ae230122ff27
Subproject commit 60da5e1c03b694ce9b45ccd61f67a4bfa3f0fee2
Subproject commit a16c7383f9077cde0249802931af12802313af2d
Subproject commit 7f669131d16ce30e05ef8406651a7a0965a6b8a4
Subproject commit d9bc976e11679435d53734538b96cdd69c84856a
......@@ -31,6 +31,14 @@ commands:
twitter = socialService:/bin/twitter
}
interfaceSearch:
{
$MANGOH_ROOT/apps/MqttClient
$MANGOH_ROOT/apps/DataRouter
$MANGOH_ROOT/apps/MuxControl
$MANGOH_ROOT/apps/SocialService/interfaces
}
kernelModules:
{
$MANGOH_ROOT/linux_kernel_modules/mangoh/9-mangoh_green_dv4
......
......@@ -31,6 +31,13 @@ commands:
twitter = socialService:/bin/twitter
}
interfaceSearch:
{
$MANGOH_ROOT/apps/MqttClient
$MANGOH_ROOT/apps/DataRouter
$MANGOH_ROOT/apps/MuxControl
$MANGOH_ROOT/apps/SocialService/interfaces
}
kernelModules:
{
......
Subproject commit 76962746606a8360c2030476ab8e25d072743a99
Subproject commit 74a620c30e78d56f0e38d1d752cd829df963a112
Subproject commit d8b9d40379bbc3ebdd12cb6a3e812283f6589253
Subproject commit 024ec5e45b5771a83c763a1d8125f6eaf83d02a8
......@@ -2,12 +2,12 @@ requires:
{
api:
{
${MANGOH_ROOT}/apps/SocialService/interfaces/twitter.api
twitter.api
le_ulpm.api
le_bootReason.api
le_adc.api
le_data.api
airVantage/legacy/le_avdata.api
airVantage/le_avdata.api
modemServices/le_info.api
}
}
......@@ -22,14 +22,3 @@ cxxflags:
{
-std=c++11
}
assets:
{
LightSensor =
{
variables:
{
int Reading
}
}
}
\ No newline at end of file
......@@ -21,12 +21,24 @@
#define LIGHT_SENSOR_SAMPLE_INTERVAL_MS 2000
static void SendTweet(const char* tweet);
static void LightSensorSampleTimerHandler(le_timer_Ref_t sampleTimer);
static void PushCallbackHandler(le_avdata_PushStatus_t status, void *context);
static void AvSessionStateHandler(le_avdata_SessionState_t state, void *context);
static void TryStartTimer(void);
static const uint32_t UnicodeTiredFace = 0x1F62B;
static const uint32_t UnicodeSleepingFace = 0x1F634;
static le_avdata_RequestSessionObjRef_t AvSession;
static le_timer_Ref_t LightSensorSampleTimer;
static bool TweetPending = false;
static bool AvDataSessionActive = false;
static uint32_t PushCount = 0;
static uint32_t ShutdownAfterPush = 0;
static le_avdata_AssetInstanceRef_t LightSensorAsset;
static const char *LightSensorReadingResource = "lightSensor/reading";
//--------------------------------------------------------------------------------------------------
......@@ -73,6 +85,7 @@ static void SendTweet
LE_FATAL("Unhandled tweet result (%d)", r);
}
} while (attempts < 3);
TweetPending = false;
}
//--------------------------------------------------------------------------------------------------
......@@ -98,15 +111,50 @@ static void LightSensorSampleTimerHandler
LE_DEBUG("Light sensor reports value %d", lightSensorReading);
}
le_avdata_SetInt(LightSensorAsset, "Reading", lightSensorReading);
if (lightSensorReading < ADC_LEVEL_SLEEP)
{
ShutdownAfterPush = PushCount + 1;
LE_INFO(
"Initiating shutdown due to light sensor value %d which is below the minimum %d",
lightSensorReading,
ADC_LEVEL_SLEEP);
}
auto setIntRes = le_avdata_SetInt(LightSensorReadingResource, lightSensorReading);
if (setIntRes != LE_OK)
{
LE_WARN("Failed to set light sensor resource");
}
else
{
PushCount++;
le_avdata_Push(LightSensorReadingResource, PushCallbackHandler, (void *)PushCount);
}
}
static void PushCallbackHandler
(
le_avdata_PushStatus_t status, ///< push status
void *context ///< The push count when the push was submitted
)
{
switch (status)
{
case LE_AVDATA_PUSH_SUCCESS:
break;
case LE_AVDATA_PUSH_FAILED:
LE_WARN("Failed to push push_button state");
break;
default:
LE_FATAL("Unexpected push status");
break;
}
if ((uint32_t)context == ShutdownAfterPush)
{
if (le_ulpm_BootOnAdc(
LIGHT_SENSOR_ADC_NUM,
LIGHT_SENSOR_SAMPLE_INTERVAL_MS,
......@@ -139,12 +187,51 @@ static void LightSensorSampleTimerHandler
}
}
static void AvSessionStateHandler
(
le_avdata_SessionState_t state,
void *context
)
{
switch (state)
{
case LE_AVDATA_SESSION_STARTED:
LE_DEBUG("AVData session started");
AvDataSessionActive = true;
TryStartTimer();
break;
case LE_AVDATA_SESSION_STOPPED:
LE_INFO("AVData session stopped. Push will fail.");
AvDataSessionActive = false;
le_timer_Stop(LightSensorSampleTimer);
break;
default:
LE_FATAL("Unsupported AV session state %d", state);
break;
}
}
static void TryStartTimer(void)
{
if (AvDataSessionActive && !TweetPending)
{
LE_ASSERT_OK(le_timer_Start(LightSensorSampleTimer));
}
}
COMPONENT_INIT
{
LE_DEBUG("wakeupAndTweetApp started");
LightSensorAsset = le_avdata_Create("LightSensor");
le_result_t r = le_avdata_CreateResource(LightSensorReadingResource, LE_AVDATA_ACCESS_VARIABLE);
LE_FATAL_IF(r != LE_OK && r != LE_DUPLICATE, "Couldn't create resource for light sensor reading");
le_avdata_AddSessionStateHandler(AvSessionStateHandler, NULL);
AvSession = le_avdata_RequestSession();
LE_FATAL_IF(AvSession == NULL, "Failed to request avdata session");
LightSensorSampleTimer = le_timer_Create("light sensor");
LE_ASSERT_OK(le_timer_SetHandler(LightSensorSampleTimer, LightSensorSampleTimerHandler));
......@@ -168,18 +255,20 @@ COMPONENT_INIT
std::ostringstream tweetStream;
tweetStream << emoji << " mangOH with IMEI=" << imei << " has woken up at " << dateTime;
auto tweet = std::make_shared<std::string>(tweetStream.str());
TweetPending = true;
if (wakeupAndTweet_ConnectAndRun([tweet]{
SendTweet(tweet->c_str());
LE_ASSERT_OK(le_timer_Start(LightSensorSampleTimer));
TryStartTimer();
}) != LE_OK)
{
TweetPending = false;
LE_ERROR("Couldn't create data connection to send tweet");
LE_ASSERT_OK(le_timer_Start(LightSensorSampleTimer));
TryStartTimer();
}
}
else
{
LE_DEBUG("Boot reason was not ADC %u", LIGHT_SENSOR_ADC_NUM);
LE_ASSERT_OK(le_timer_Start(LightSensorSampleTimer));
TryStartTimer();
}
}
......@@ -5,47 +5,20 @@
// Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
//--------------------------------------------------------------------------------------------------
#include "$LEGATO_ROOT/default.sdef"
apps:
{
// Platform services.
$LEGATO_SERVICE_AVC_APP
$LEGATO_ROOT/apps/platformServices/cellNetService
$LEGATO_ROOT/apps/platformServices/dataConnectionService
$LEGATO_ROOT/apps/platformServices/fwupdateService
$LEGATO_ROOT/apps/platformServices/modemService
$LEGATO_ROOT/apps/platformServices/positioningService
$LEGATO_ROOT/apps/platformServices/powerMgr
$LEGATO_ROOT/apps/platformServices/secStore
$LEGATO_ROOT/apps/platformServices/gpioService
$LEGATO_ROOT/apps/platformServices/fsService
$LEGATO_ROOT/apps/sample/lwm2mAirVantageControl/lwm2mControl
$MANGOH_ROOT/apps/SocialService/socialService
// Command-line tools.
$LEGATO_ROOT/apps/tools/tools
$MANGOH_ROOT/samples/tutorials/developerDay2016/apps/wakeupAndTweet
}
commands:
{
cm = tools:/scripts/cm
fwupdate = tools:/bin/fwupdate
secstore = tools:/bin/secstore
pmtool = tools:/bin/pmtool
twitter = socialService:/bin/twitter
}
bindings:
{
<root>.le_fwupdate -> fwupdateService.le_fwupdate
}
interfaceSearch:
{
interfaces/modemServices
interfaces/positioning
$MANGOH_ROOT/apps/SocialService/interfaces
}
......@@ -2,7 +2,7 @@ requires:
{
api:
{
${LEGATO_ROOT}/interfaces/modemServices/le_adc.api
modemServices/le_adc.api
}
}
......
......@@ -2,8 +2,8 @@ requires:
{
api:
{
le_sensorGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
le_sensorGpio = le_gpio.api
mangoh_ledGpio =le_gpio.api
}
}
......
......@@ -2,7 +2,7 @@ requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = le_gpio.api
}
}
......
......@@ -2,8 +2,8 @@ requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_pushButton = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = le_gpio.api
mangoh_pushButton = le_gpio.api
}
}
......
......@@ -2,7 +2,7 @@ requires:
{
api:
{
${LEGATO_ROOT}/interfaces/modemServices/le_adc.api
modemServices/le_adc.api
}
}
......
......@@ -2,8 +2,8 @@ requires:
{
api:
{
le_sensorGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
le_sensorGpio = le_gpio.api
mangoh_ledGpio = le_gpio.api
}
}
......
......@@ -2,7 +2,7 @@ requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = le_gpio.api
}
}
......
......@@ -2,8 +2,8 @@ requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_pushButton = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = le_gpio.api
mangoh_pushButton = le_gpio.api
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment