|
50 | 50 |
|
51 | 51 | #include "lwm2m-client-flow-object.h" |
52 | 52 | #include "lwm2m-client-flow-access-object.h" |
53 | | -#include "lwm2m-client-ipso-presence-sensor.h" |
| 53 | +#include "lwm2m-client-ipso-presence.h" |
54 | 54 | #include "lwm2m-client-device-object.h" |
55 | 55 | /*************************************************************************************************** |
56 | 56 | * Definitions |
@@ -106,7 +106,7 @@ void ConstructObjectTree(AwaStaticClient *client) |
106 | 106 | DefineDeviceObject(client); |
107 | 107 | DefineFlowObject(client); |
108 | 108 | DefineFlowAccessObject(client); |
109 | | - DefinePresenceSensorObject(client); |
| 109 | + PresenceObject_DefineObjectsAndResources(client, 100, 100); |
110 | 110 | } |
111 | 111 |
|
112 | 112 | void AwaStaticClient_Start(AwaStaticClient *client) |
@@ -162,17 +162,16 @@ PROCESS_THREAD(lwm2m_client, ev, data) |
162 | 162 | while(1) |
163 | 163 | { |
164 | 164 | static struct etimer et; |
165 | | - static int WaitTime; |
| 165 | + static int WaitTime = 0; |
166 | 166 | WaitTime = AwaStaticClient_Process(client); |
167 | 167 | etimer_set(&et, (WaitTime * CLOCK_SECOND) / 1000); |
168 | 168 | PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et) || (ev == sensors_event)); |
169 | | - |
170 | 169 | if (data == &motion_sensor) |
171 | 170 | { |
172 | | - printf("Motion event received\n"); |
173 | | - PresenceSensor_IncrementCounter(client, 0); |
| 171 | + printf("Motion event received: %d\n", motion_sensor.value(0)); |
| 172 | + PresenceObject_SetPresence(client, motion_sensor.value(0) ? true : false); |
174 | 173 | } |
175 | | - } |
| 174 | + } |
176 | 175 |
|
177 | 176 | PROCESS_END(); |
178 | 177 | } |
0 commit comments