Skip to content

Commit

Permalink
Merge pull request #8 from CreatorKit/dev
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
nikhil-zinjurde-imgtec authored Aug 11, 2016
2 parents f60e6aa + 783dcbf commit ff0d7e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.hex
*.mikro-e
*.map
*.a
obj_mikro-e/**/*.*
13 changes: 6 additions & 7 deletions lwm2m-client-motion-sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#include "lwm2m-client-flow-object.h"
#include "lwm2m-client-flow-access-object.h"
#include "lwm2m-client-ipso-presence-sensor.h"
#include "lwm2m-client-ipso-presence.h"
#include "lwm2m-client-device-object.h"
/***************************************************************************************************
* Definitions
Expand Down Expand Up @@ -106,7 +106,7 @@ void ConstructObjectTree(AwaStaticClient *client)
DefineDeviceObject(client);
DefineFlowObject(client);
DefineFlowAccessObject(client);
DefinePresenceSensorObject(client);
PresenceObject_DefineObjectsAndResources(client, 100, 100);
}

void AwaStaticClient_Start(AwaStaticClient *client)
Expand Down Expand Up @@ -162,17 +162,16 @@ PROCESS_THREAD(lwm2m_client, ev, data)
while(1)
{
static struct etimer et;
static int WaitTime;
static int WaitTime = 0;
WaitTime = AwaStaticClient_Process(client);
etimer_set(&et, (WaitTime * CLOCK_SECOND) / 1000);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et) || (ev == sensors_event));

if (data == &motion_sensor)
{
printf("Motion event received\n");
PresenceSensor_IncrementCounter(client, 0);
printf("Motion event received: %d\n", motion_sensor.value(0));
PresenceObject_SetPresence(client, motion_sensor.value(0) ? true : false);
}
}
}

PROCESS_END();
}
7 changes: 7 additions & 0 deletions scripts/awa_server_define_objects.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
awa-server-define -o 3302 -j "Presence" -y single \
-r 5500 -n "Digital Input State" -t boolean -u single -q mandatory -k r \
-r 5501 -n "Digital Input Counter" -t integer -u single -q optional -k r \
-r 5505 -n "Digital Input Counter Reset" -t none -u single -q optional -k e \
-r 5751 -n "Sensor Type" -t string -u single -q optional -k r \
-r 5903 -n "Busy To Clear Delay" -t integer -u single -q optional -k rw \
-r 5904 -n "Clear To Busy Delay" -t integer -u single -q optional -k rw

0 comments on commit ff0d7e3

Please sign in to comment.