Esempio n. 1
0
static void dtls_handler(process_event_t ev, process_data_t data){
	if (ev == dtls_event){
		if (dtls_rehandshake()){
			etimer_stop(&et);
		} else
		if (dtls_connected()){
			connection = (Connection*)data;
			etimer_set(&et, SEND_INTERVAL);
			DTLS_Write(connection, hello_msg, 11);
		} else if (dtls_newdata()){
			dtls_appdata[dtls_applen] = 0;
		}
	} else if (ev == PROCESS_EVENT_TIMER){
		if (etimer_expired(&et)){
			DTLS_Write(connection, hello_msg, 11);
			etimer_reset(&et);
		}
		if (etimer_expired(&et2)){
			DTLS_Close(connection);
			etimer_stop(&et);
			etimer_stop(&et2);
		}
	}


}
Esempio n. 2
0
static void dtls_handler(process_event_t ev, process_data_t data){
	if (ev == dtls_event){
		if (dtls_connected()){
			//raven_lcd_show_text("conn");
			PRINTF("CONNECTED\n");
			connection = (Connection*)data;
		} else if (dtls_newdata()){
			dtls_appdata[dtls_applen] = 0;
			PRINTF("GOT NEW DATA: %s\n",dtls_appdata);
			//raven_lcd_show_text(dtls_appdata);
		}
	}

}
Esempio n. 3
0
static void dtls_handler(process_event_t ev, process_data_t data){

	if (ev == dtls_event){
		if (dtls_connected()){
			#if CONTIKI_TARGET_MINIMAL_NET
			PRINTF("CONNECTED\n");
			#endif
			connection = (Connection*)data;
		} else if (dtls_newdata()){
			dtls_appdata[dtls_applen] = 0;
			#if CONTIKI_TARGET_MINIMAL_NET
			PRINTF("GOT NEW DATA: %s\n\n", dtls_appdata);
			#endif
		}
	}

}