本文整理汇总了C++中PROCESS_WAIT_EVENT函数的典型用法代码示例。如果您正苦于以下问题:C++ PROCESS_WAIT_EVENT函数的具体用法?C++ PROCESS_WAIT_EVENT怎么用?C++ PROCESS_WAIT_EVENT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PROCESS_WAIT_EVENT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PROCESS_THREAD
//Reads button presses and adds to variable for LEDs
PROCESS_THREAD(authority_process, ev, data){
PROCESS_BEGIN();
#ifdef DEBUG
volatile unsigned int *resetreas_reg = (unsigned int*) 0x40000400;
if(*resetreas_reg != 1){
printf("\n Reset reason: %d \n", *resetreas_reg);
PROCESS_WAIT_EVENT(); //This single line made things work and not crash? What is this unstable hell-machine?
}
*resetreas_reg = 0xF00F;
#endif
rest_init_engine();
#if WITH_IPSO
ipso_objects_init();
#endif
rest_activate_resource(&res_door, "doors/door");
while(1){
PROCESS_WAIT_EVENT();
//wait for requests and process data
}
PROCESS_END();
}
开发者ID:johangas,项目名称:contiki,代码行数:26,代码来源:authority.c
示例2: PROCESS_THREAD
PROCESS_THREAD(cetic_6lbr_process, ev, data)
{
PROCESS_BEGIN();
cetic_6lbr_startup = clock_seconds();
#if CONTIKI_TARGET_NATIVE
slip_config_handle_arguments(contiki_argc, contiki_argv);
#endif
load_nvm_config();
platform_init();
process_start(ð_drv_process, NULL);
while(!ethernet_ready) {
PROCESS_PAUSE();
}
process_start(&tcpip_process, NULL);
PROCESS_PAUSE();
#if CETIC_NODE_INFO
node_info_init();
#endif
packet_filter_init();
cetic_6lbr_init();
#if WEBSERVER
process_start(&webserver_nogui_process, NULL);
#endif
#if UDPSERVER
process_start(&udp_server_process, NULL);
#endif
printf("CETIC 6LBR Started\n");
#if CONTIKI_TARGET_NATIVE
PROCESS_WAIT_EVENT();
etimer_set(&reboot_timer, CLOCK_SECOND);
PROCESS_WAIT_EVENT();
printf("Exiting...\n");
exit(0);
#endif
PROCESS_END();
}
开发者ID:denghongcai,项目名称:6lbr,代码行数:50,代码来源:cetic-6lbr.c
示例3: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_server_process, ev, data)
{
struct process *p;
struct shell_command *c;
static struct etimer etimer;
PROCESS_BEGIN();
etimer_set(&etimer, CLOCK_SECOND * 10);
while(1) {
PROCESS_WAIT_EVENT();
if(ev == PROCESS_EVENT_EXITED) {
p = data;
/* printf("process exited '%s' (front '%s')\n", p->name,
front_process->name);*/
for(c = list_head(commands);
c != NULL && c->process != p;
c = c->next);
while(c != NULL) {
if(c->child != NULL && c->child->process != NULL) {
/* printf("Killing '%s'\n", c->process->name);*/
input_to_child_command(c->child, "", 0, "", 0);
/* process_exit(c->process);*/
}
c = c->child;
}
} else if(ev == PROCESS_EVENT_TIMER) {
etimer_reset(&etimer);
shell_set_time(shell_time());
}
}
PROCESS_END();
}
开发者ID:uoaerg,项目名称:wise,代码行数:34,代码来源:shell.c
示例4: PROCESS_THREAD
/*-----------------------------------------------------------------------*/
PROCESS_THREAD(udp_sender_process, ev, data)
{
static struct etimer period_timer, wait_timer;
PROCESS_BEGIN();
set_global_address();
PRINTF("UDP sender process started\n");
print_local_address();
/* new connection with remote host */
sender_conn = udp_new(NULL, UIP_HTONS(UDP_SINK_PORT), NULL);
udp_bind(sender_conn, UIP_HTONS(UDP_SENDER_PORT));
PRINTF("Created a connection with the sink ");
PRINT6ADDR(&sender_conn->ripaddr);
PRINTF(" local/remote port %u/%u\n",
UIP_HTONS(sender_conn->lport), UIP_HTONS(sender_conn->rport));
etimer_set(&period_timer, CLOCK_SECOND * PERIOD);
while(1) {
PROCESS_WAIT_EVENT();
if(ev == PROCESS_EVENT_TIMER) {
if(data == &period_timer) {
etimer_reset(&period_timer);
etimer_set(&wait_timer,
random_rand() % (CLOCK_SECOND * RANDWAIT));
} else if(data ==&wait_timer) {
/* Time to send a data. */
collect_common_send();
}
}
}
PROCESS_END();
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:35,代码来源:udp-sender.c
示例5: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_wget_process, ev, data)
{
PROCESS_BEGIN();
strncpy(url, data, sizeof(url));
open_url(url);
running = 1;
while(running) {
PROCESS_WAIT_EVENT();
if(ev == tcpip_event) {
webclient_appcall(data);
} else if(ev == resolv_event_found) {
/* Either found a hostname, or not. */
if((char *)data != NULL &&
resolv_lookup((char *)data) != NULL) {
open_url(url);
} else {
shell_output_str(&wget_command, "Host not found.", "");
}
}
}
PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:28,代码来源:shell-wget.c
示例6: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(udp_server_process, ev, data)
{
PROCESS_BEGIN();
dtls_init();
init_dtls();
print_local_addresses();
if (!dtls_context) {
dtls_emerg("cannot create context\n");
PROCESS_EXIT();
}
#ifdef ENABLE_POWERTRACE
powertrace_start(CLOCK_SECOND * 2);
#endif
while(1) {
PROCESS_WAIT_EVENT();
if(ev == tcpip_event) {
dtls_handle_read(dtls_context);
}
}
PROCESS_END();
}
开发者ID:jamella,项目名称:MyRepository,代码行数:28,代码来源:dtls-server-len.c
示例7: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sensors_process, ev, data)
{
static int i;
static int events;
PROCESS_BEGIN();
sensors_event = process_alloc_event();
for(i = 0; sensors[i] != NULL; ++i) {
sensors_flags[i] = 0;
sensors[i]->configure(SENSORS_HW_INIT, 0);
}
num_sensors = i;
while(1) {
PROCESS_WAIT_EVENT();
do {
events = 0;
for(i = 0; i < num_sensors; ++i) {
if(sensors_flags[i] & FLAG_CHANGED) {
if(process_post(PROCESS_BROADCAST, sensors_event, sensors[i]) == PROCESS_ERR_OK) {
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
}
sensors_flags[i] &= ~FLAG_CHANGED;
events++;
}
}
} while(events);
}
PROCESS_END();
}
开发者ID:Dawooga,项目名称:contiki-jn51xx-1,代码行数:36,代码来源:sensors.c
示例8: PROCESS_THREAD
/*-----------------------------------------------------------------------------------*/
PROCESS_THREAD(webserver_process, ev, data)
{
PROCESS_BEGIN();
ctk_window_new(&mainwindow, LOG_WIDTH, LOG_HEIGHT+1, "Web server");
CTK_WIDGET_ADD(&mainwindow, &message);
CTK_WIDGET_ADD(&mainwindow, &loglabel);
httpd_init();
ctk_window_open(&mainwindow);
while(1) {
PROCESS_WAIT_EVENT();
if(ev == ctk_signal_window_close ||
ev == PROCESS_EVENT_EXIT) {
ctk_window_close(&mainwindow);
process_exit(&webserver_process);
LOADER_UNLOAD();
} else if(ev == tcpip_event) {
httpd_appcall(data);
}
}
PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:29,代码来源:webserver.c
示例9: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(stest_process, ev, data)
{
static struct etimer timer;
PROCESS_BEGIN();
clrscr_arch();
#ifdef RS232_INTR
rs232_arch_init(serial_line_input_byte, 0);
#endif
etimer_set(&timer, CLOCK_SECOND);
log_message("Starting serial test process");
while(1) {
PROCESS_WAIT_EVENT();
if (etimer_expired(&timer)) {
log_message("Sending serial data now");
rs232_print("GNU's not Unix\n");
etimer_reset(&timer);
}
if(ev == serial_line_event_message) {
log_message(data);
}
}
PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:30,代码来源:contiki-serial-main.c
示例10: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(hello_world_process, ev, data)
{
static struct etimer timer;
static int count=0;
etimer_set(&timer, CLOCK_CONF_SECOND);
PROCESS_BEGIN();
while(1)
{
PROCESS_WAIT_EVENT();
if (ev==PROCESS_EVENT_TIMER)
{
// DDRB |= (1<<PORTB4);
// PORTB ^= (1<<PORTB4);
printf("Hello World # %i\n", count);
count++;
// etimer_reset(&timer);
}
}
PROCESS_END();
}
开发者ID:umotes,项目名称:avr-clean-new,代码行数:29,代码来源:hello-world.c
示例11: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(burn_process, ev, data)
{
PROCESS_BEGIN();
etimer_set(&etimer, 5*CLOCK_SECOND);
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
watchdog_stop();
leds_on(LEDS_RED);
#if NODEID
printf("Burning node id %d\n", NODEID);
node_id_burn(NODEID);
leds_on(LEDS_BLUE);
node_id_restore();
printf("Restored node id %d\n", node_id);
#else
#error "burn-nodeid must be compiled with nodeid=<the ID of the node>"
node_id_restore();
printf("Restored node id %d\n", node_id);
#endif
leds_off(LEDS_RED + LEDS_BLUE);
watchdog_start();
while(1) {
PROCESS_WAIT_EVENT();
}
PROCESS_END();
}
开发者ID:Inscribe,项目名称:msp430xf1611,代码行数:28,代码来源:burn-nodeid.c
示例12: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(wget_process, ev, data)
{
PROCESS_BEGIN();
PRINTF("wget: fetching %s\n", file);
#if STATS
fetch_counter = 0;
fetch_started = clock_time();
#endif /* STATS */
LEDS_ON(LEDS_YELLOW);
if(webclient_get(server, port, file) == 0) {
PRINTF("wget: failed to connect\n");
LEDS_OFF(LEDS_YELLOW);
fetch_running = 0;
call_done(WGET_CONNECT_FAILED);
} else {
while(fetch_running) {
PROCESS_WAIT_EVENT();
if(ev == tcpip_event) {
webclient_appcall(data);
}
}
}
PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:27,代码来源:wget.c
示例13: PROCESS_THREAD
/* --------------------------------------------------------------- */
PROCESS_THREAD(node_process, ev, data)
{
// All the process start with this
PROCESS_BEGIN();
PRINTF("# Starting...\n");
// Configure the network
network_config();
if (!conn) {
printf("E01\n");
PROCESS_EXIT();
}
#if IS_RPL_ROOT
create_dag();
#endif
// Main, infinite, loop of the process
PRINTF("# Ready!\n");
while (1) {
// Wait, block the process, until an event happens.
// Meanwhile, other process will continue running.
PROCESS_WAIT_EVENT();
// Check the type of event that unblock the process
if (ev == tcpip_event)
tcpip_handler();
else if (ev == serial_line_event_message)
input_handler((char*)data);
}
// All the process ends with this
PROCESS_END();
}
开发者ID:RauPerez25,项目名称:Wall-E,代码行数:35,代码来源:node.c
示例14: PROCESS_THREAD
PROCESS_THREAD(ir_receiver_process, ev, data) {
PROCESS_BEGIN();
while(1) {
PROCESS_WAIT_EVENT();
if(ev == PROCESS_EVENT_POLL) {
if(ir_repeat) {
PRINTF("Got repeat signal \n");
ir_repeat = 0;
} else {
if(*(int32_t*)ir_prev_data != *(int32_t*)ir_last_data || timer_expired(&ir_rep_timer) || to_be_repeated()) {
memcpy(ir_prev_data, ir_last_data, 4);
timer_restart(&ir_rep_timer);
PRINTF("Got new command %d,%d,%d,%d!\n", ir_last_data[0],ir_last_data[1],ir_last_data[2],ir_last_data[3]);
broadcast_value(30);
} else {
timer_restart(&ir_rep_timer);
}
}
}
}
PROCESS_END();
}
开发者ID:stschake,项目名称:hexabus,代码行数:26,代码来源:ir_receiver.c
示例15: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(telnetd_process, ev, data)
{
PROCESS_BEGIN();
shell_init();
#if TELNETD_CONF_GUI
telnetd_gui_init();
#endif /* TELNETD_CONF_GUI */
petsciiconv_toascii(telnetd_reject_text, strlen(telnetd_reject_text));
tcp_listen(UIP_HTONS(23));
while(1) {
PROCESS_WAIT_EVENT();
if(ev == tcpip_event) {
telnetd_appcall(data);
} else if(ev == PROCESS_EVENT_EXIT) {
telnetd_quit();
} else {
#if TELNETD_CONF_GUI
telnetd_gui_eventhandler(ev, data);
#endif /* TELNETD_CONF_GUI */
}
}
PROCESS_END();
}
开发者ID:Abdellazizhammami,项目名称:contiki,代码行数:30,代码来源:telnetd.c
示例16: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(udp_server_process, ev, data)
{
PROCESS_BEGIN();
print_local_addresses();
dtls_init();
init_dtls();
if (!dtls_context) {
dsrv_log(LOG_EMERG, "cannot create context\n");
PROCESS_EXIT();
}
while(1) {
PROCESS_WAIT_EVENT();
if(ev == tcpip_event) {
dtls_handle_read(dtls_context);
}
#if 0
if (bytes_read > 0) {
/* dtls_handle_message(dtls_context, &the_session, readbuf, bytes_read); */
read_from_peer(dtls_context, &the_session, readbuf, bytes_read);
}
dtls_handle_message(ctx, &session, uip_appdata, bytes_read);
#endif
}
PROCESS_END();
}
开发者ID:Thonex,项目名称:tinydtls,代码行数:31,代码来源:dtls-server.c
示例17: PROCESS_THREAD
PROCESS_THREAD(button_process, ev, data)
{
static struct etimer etimer;
PROCESS_EXITHANDLER(goto exit);
PROCESS_BEGIN();
printf("button_process starting\n");
while(1) {
PROCESS_WAIT_EVENT();
if(ev == PROCESS_EVENT_MSG && data != NULL
&& ((struct button_msg *)data)->type == BUTTON_MSG_TYPE) {
printf("button press\n");
leds_toggle(LEDS_ALL);
etimer_set(&etimer, CLOCK_SECOND);
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
leds_toggle(LEDS_ALL);
}
}
exit:
printf("button_process exiting\n");
PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:27,代码来源:dhclient.c
示例18: PROCESS_THREAD
PROCESS_THREAD(rest_server_example, ev, data)
{
PROCESS_BEGIN();
PRINTF("Starting Erbium Example Server\n");
#ifdef RF_CHANNEL
PRINTF("RF channel: %u\n", RF_CHANNEL);
#endif
#ifdef IEEE802154_PANID
PRINTF("PAN ID: 0x%04X\n", IEEE802154_PANID);
#endif
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
PRINTF("LL header: %u\n", UIP_LLH_LEN);
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);
PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE);
/* Initialize the REST engine. */
rest_init_engine();
/* Activate the application-specific resources. */
rest_activate_resource(&resource_helloworld);
rest_activate_resource(&resource_leds);
rest_activate_resource(&resource_toggle);
leds_on(0);
/* Define application-specific events here. */
while(1) {
PROCESS_WAIT_EVENT();
} /* while (1) */
PROCESS_END();
}
开发者ID:zachary0101,项目名称:6lbr,代码行数:33,代码来源:er-example-server.c
示例19: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_telnetd_process, ev, data)
{
PROCESS_BEGIN();
PROCESS_PAUSE();
shell_blink_init();
/* shell_file_init();
shell_netfile_init();*/
shell_ps_init();
shell_reboot_init();
/*shell_rime_init();*/
/*shell_rime_ping_init();*/
/*shell_rime_netcmd_init();*/
/*shell_rime_sniff_init();*/
shell_sky_init();
shell_text_init();
shell_time_init();
shell_register_command(&id_command);
while(1) {
PROCESS_WAIT_EVENT();
}
PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:29,代码来源:sky-telnet-server.c
示例20: PROCESS_THREAD
PROCESS_THREAD(rest_server_example, ev, data)
{
PROCESS_BEGIN();
PRINTF("Starting Erbium Example Server\n");
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
PRINTF("LL header: %u\n", UIP_LLH_LEN);
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);
PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE);
/* if static routes are used rather than RPL */
#if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET) && !defined (CONTIKI_TARGET_NATIVE)
set_global_address();
configure_routing();
#endif
/* Initialize the OSD Hardware. */
hw_init();
/* Initialize the REST engine. */
rest_init_engine();
/* Activate the application-specific resources. */
rest_activate_resource(&resource_info);
SENSORS_ACTIVATE(t4_servo_sensor);
rest_activate_resource(&resource_t4_servo);
/* Define application-specific events here. */
while(1) {
PROCESS_WAIT_EVENT();
}
PROCESS_END();
}
开发者ID:osdomotics,项目名称:osd-contiki,代码行数:33,代码来源:er-example-server.c
注:本文中的PROCESS_WAIT_EVENT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论