Create, process and free a basic Observe request on a single resource and receive notifications containing the initial and changed value.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#define IPC_PORT (54321)
#define IPC_ADDRESS "127.0.0.2"
#define OPERATION_PERFORM_TIMEOUT 1000
#define CLIENT_ID "TestClient1"
static void observeCallback(
const AwaChangeSet * changeSet,
void * context)
{
int * notificationCount = (int *)context;
printf("Callback received, notification count = %d\n", *notificationCount);
const char * value;
if (*notificationCount == 0)
printf("Initial value of resource /3/0/15 is: %s\n", value);
else
printf("Value of resource /3/0/15 changed to: %s\n", value);
(*notificationCount)++;
}
int main(void)
{
int notificationCount = 0;
(void *)¬ificationCount);
sleep(1);
return 0;
}