Exemple #1
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(coap_engine, ev, data, buf)
{
  PROCESS_BEGIN();
#if 0
  /* This is not used in Zephyr. */
  PRINTF("Starting %s receiver...\n", coap_rest_implementation.name);

  rest_activate_resource(&res_well_known_core, ".well-known/core");

  coap_register_as_transaction_handler();
  coap_init_connection(SERVER_LISTEN_PORT);

  while(1) {
    PROCESS_YIELD();

    if(ev == tcpip_event) {
      coap_engine_receive(COAP_CONTEXT_NONE);

    } else if(ev == PROCESS_EVENT_TIMER) {
      /* retransmissions are handled here */
      coap_check_transactions();
    }
  } /* while (1) */
#endif /* 0 */
  PROCESS_END();
}
Exemple #2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(coap_engine, ev, data)
{
  PROCESS_BEGIN();
  PRINTF("Starting %s receiver...\n", coap_rest_implementation.name);

#if WITH_WELL_KNOWN_CORE
  rest_activate_resource(&res_well_known_core, ".well-known/core");
#endif

  coap_register_as_transaction_handler();
  coap_init_connection(SERVER_LISTEN_PORT);

  while(1) {
    PROCESS_YIELD();

    if(ev == tcpip_event) {
      coap_handle_receive(coap_default_context);
    } else if(ev == PROCESS_EVENT_TIMER) {
      /* retransmissions are handled here */
      coap_check_transactions();
    }
  } /* while (1) */

  PROCESS_END();
}
/*----------------------------------------------------------------------------*/
PROCESS_THREAD(coap_receiver, ev, data)
{
  PROCESS_BEGIN();
  PRINTF("Starting CoAP-13 receiver...\n");

  rest_activate_resource(&resource_well_known_core);

#if ! COAP_CEU
  coap_register_as_transaction_handler();
#endif

  coap_init_connection(SERVER_LISTEN_PORT);

  while(1) {
    PROCESS_YIELD();

    if(ev == tcpip_event) {
      coap_receive();
    } else if (ev == PROCESS_EVENT_TIMER) {
      /* retransmissions are handled here */
#if ! COAP_CEU
      coap_check_transactions();
#endif
    }
  } /* while (1) */

  PROCESS_END();
}
Exemple #4
0
coap_context_t *coap_init_server(uip_ipaddr_t *server_addr,
				 uint16_t server_port,
				 uip_ipaddr_t *peer_addr,
				 uint16_t peer_port)
{
  PRINTF("Starting %s receiver...\n", coap_rest_implementation.name);

  rest_activate_resource(&res_well_known_core, ".well-known/core");

  coap_register_as_transaction_handler();
  return coap_init_connection(server_addr, server_port, peer_addr, peer_port);
}