Пример #1
0
static void prv_monitor_callback(uint16_t clientID,
                                 lwm2m_uri_t * uriP,
                                 int status,
                                 uint8_t * data,
                                 int dataLength,
                                 void * userData)
{
    lwm2m_context_t * lwm2mH = (lwm2m_context_t *) userData;
    lwm2m_client_t * targetP;
    lwm2m_client_object_t * objectP;

    switch (status)
	{
	case CREATED_2_01:
	    fprintf(stdout, "\r\nNew client #%d registered.\r\n", clientID);

	    targetP = (lwm2m_client_t *)lwm2m_list_find((lwm2m_list_t *)lwm2mH->clientList, clientID);

        prv_dump_client(targetP);
	    break;

	case DELETED_2_02:
	    fprintf(stdout, "\r\nClient #%d unregistered.\r\n", clientID);
	    break;

	default:
		fprintf(stdout, "\r\nMonitor callback called with an unknown status: %d.\r\n", status);
		break;
	}

    fprintf(stdout, "\r\n> ");
    fflush(stdout);
}
Пример #2
0
static void prv_output_clients(char * buffer,
                               void * user_data)
{
    lwm2m_context_t * lwm2mH = (lwm2m_context_t *) user_data;
    lwm2m_client_t * targetP;

    targetP = lwm2mH->clientList;

    if (targetP == NULL)
    {
        fprintf(stdout, "No client.\r\n");
        return;
    }

    for (targetP = lwm2mH->clientList ; targetP != NULL ; targetP = targetP->next)
    {
        prv_dump_client(targetP);
    }
}