本文整理汇总了C++中PROCESS_END函数的典型用法代码示例。如果您正苦于以下问题:C++ PROCESS_END函数的具体用法?C++ PROCESS_END怎么用?C++ PROCESS_END使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PROCESS_END函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_timestamp_process, ev, data)
{
struct msg {
uint16_t len;
uint16_t time[2];
uint16_t timesynch;
uint8_t data[MAX_COMMANDLENGTH];
} msg;
PROCESS_BEGIN();
while(1) {
struct shell_input *input;
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
input = data;
if(input->len1 + input->len2 == 0) {
PROCESS_EXIT();
}
msg.len = 3 + *(uint16_t *)input->data1;
msg.time[0] = (uint16_t)(shell_time() >> 16);
msg.time[1] = (uint16_t)(shell_time());
#if TIMESYNCH_CONF_ENABLED
msg.timesynch = timesynch_time();
#else /* TIMESYNCH_CONF_ENABLED */
msg.timesynch = 0;
#endif /* TIMESYNCH_CONF_ENABLED */
memcpy(msg.data, input->data1 + 2,
input->len1 - 2 > MAX_COMMANDLENGTH?
MAX_COMMANDLENGTH: input->len1 - 2);
shell_output(×tamp_command, &msg, 6 + input->len1,
input->data2, input->len2);
}
PROCESS_END();
}
开发者ID:EDAyele,项目名称:wsn430,代码行数:38,代码来源:shell-time.c
示例2: PROCESS_THREAD
PROCESS_THREAD(cc26xx_demo_process, ev, data)
{
PROCESS_EXITHANDLER(broadcast_close(&bc))
PROCESS_BEGIN();
gpio_relay_init();
relay_all_clear();
counter = 0;
broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx);
etimer_set(&et, CLOCK_SECOND);
while(1) {
PROCESS_YIELD();
if(ev == PROCESS_EVENT_TIMER) {
leds_on(LEDS_PERIODIC);
etimer_set(&et, CLOCK_SECOND*5);
rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1,
rt_callback, NULL);
counter = Get_ADC_reading();
packetbuf_copyfrom(&counter, sizeof(counter));
broadcast_send(&bc);
// printf("adc data value : %d \r\n",counter);
}
watchdog_periodic();
}
PROCESS_END();
}
开发者ID:kimjongsik72,项目名称:SKT,代码行数:36,代码来源:SKT-Current-brodcast-demo.c
示例3: PROCESS_THREAD
/* Process to get ht sensor value.
ht sensor is sampled. Sampling stopped when sensor is de-activated.
Event is generated if temp and/or hum value changed at least the value DELTA_TEMP_SENSOR_VALUE
or DELTA_HUM_SENSOR_VALUE since last event. */
PROCESS_THREAD(HTSensorSampling, ev, data)
{
PROCESS_BEGIN();
static struct etimer et;
etimer_set(&et, CLOCK_SECOND);
while(1) {
PROCESS_WAIT_EVENT_UNTIL((ev == PROCESS_EVENT_TIMER) || (ev == PROCESS_EVENT_MSG));
if(ev == PROCESS_EVENT_TIMER) {
/* Handle sensor reading. */
vHTSstartReadTemp();
temp_sensor_value = u16HTSreadTempResult();
PRINTF("Temperature sample: %d\n", temp_sensor_value);
vHTSstartReadHumidity();
hum_sensor_value = u16HTSreadHumidityResult();
PRINTF("Humidity sample: %d\n", hum_sensor_value);
if((abs(temp_sensor_value - prev_temp_event_val) > DELTA_TEMP_SENSOR_VALUE) ||
(abs(hum_sensor_value - prev_hum_event_val) > DELTA_HUM_SENSOR_VALUE)) {
prev_temp_event_val = temp_sensor_value;
prev_hum_event_val = hum_sensor_value;
sensors_changed(&ht_sensor);
}
etimer_reset(&et);
} else {
/* ev == PROCESS_EVENT_MSG */
if(*(int *)data == HT_SENSOR_STATUS_NOT_ACTIVE) {
/* Stop sampling */
etimer_stop(&et);
} else if((*(int *)data == HT_SENSOR_STATUS_ACTIVE)) {
/* restart sampling */
etimer_restart(&et);
}
}
}
PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:40,代码来源:ht-sensor.c
示例4: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(wpcap_process, ev, data)
{
PROCESS_POLLHANDLER(pollhandler());
PROCESS_BEGIN();
wpcap_init();
#if !UIP_CONF_IPV6
tcpip_set_outputfunc(wpcap_output);
#else
#if !FALLBACK_HAS_ETHERNET_HEADERS
tcpip_set_outputfunc(wpcap_send);
#endif
#endif /* !UIP_CONF_IPV6 */
process_poll(&wpcap_process);
PROCESS_WAIT_UNTIL(ev == PROCESS_EVENT_EXIT);
wpcap_exit();
PROCESS_END();
}
开发者ID:fanakin,项目名称:contiki-mirror,代码行数:25,代码来源:wpcap-drv.c
示例5: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sensor_output_process, ev, data)
{
struct sensors_sensor *s;
PROCESS_BEGIN();
/* Activate some sensors to get sensor events */
button_sensor.configure(SENSORS_ACTIVE, 1);
pir_sensor.configure(SENSORS_ACTIVE, 1);
vib_sensor.configure(SENSORS_ACTIVE, 1);
while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
s = (struct sensors_sensor *)data;
printf("%s %d\n", s->type, s->value(0));
if (data == &button_sensor) leds_invert(LEDS_YELLOW);
if (data == &pir_sensor) leds_invert(LEDS_GREEN);
if (data == &vib_sensor) leds_invert(LEDS_RED);
}
PROCESS_END();
}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:25,代码来源:sensor-output.c
示例6: PROCESS_THREAD
PROCESS_THREAD(accel_process, ev, data) {
PROCESS_BEGIN();
{
int16_t x, y, z;
serial_shell_init();
shell_ps_init();
shell_file_init(); // for printing out files
shell_text_init(); // for binprint
/* Register the event used for lighting up an LED when interrupt strikes. */
ledOff_event = process_alloc_event();
/* Start and setup the accelerometer with default values, eg no interrupts enabled. */
accm_init();
/* Register the callback functions for each interrupt */
ACCM_REGISTER_INT1_CB(accm_ff_cb);
ACCM_REGISTER_INT2_CB(accm_tap_cb);
/* Set what strikes the corresponding interrupts. Several interrupts per pin is
possible. For the eight possible interrupts, see adxl345.h and adxl345 datasheet. */
accm_set_irq(ADXL345_INT_FREEFALL, ADXL345_INT_TAP + ADXL345_INT_DOUBLETAP);
while (1) {
x = accm_read_axis(X_AXIS);
y = accm_read_axis(Y_AXIS);
z = accm_read_axis(Z_AXIS);
printf("x: %d y: %d z: %d\n", x, y, z);
etimer_set(&et, ACCM_READ_INTERVAL);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
}
}
PROCESS_END();
}
开发者ID:chanhemow,项目名称:contiki-fork,代码行数:36,代码来源:test-adxl345.c
示例7: PROCESS_THREAD
/* periodic broadcast light sensor data */
PROCESS_THREAD(spam_process, ev, data) {
PROCESS_BEGIN();
SENSORS_ACTIVATE(light_sensor);
// init
leds_off(LEDS_ALL);
int light_val = 0;
while(1) {
// wait a bit
static struct etimer et;
etimer_set(&et, 1 * CLOCK_SECOND / 2);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
// send packet
light_val = light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC);
packetbuf_copyfrom(&light_val, sizeof(int));
broadcast_send(&broadcast_connection);
}
SENSORS_DEACTIVATE(light_sensor);
PROCESS_END();
}
开发者ID:bastibl,项目名称:gr-ieee802-15-4,代码行数:25,代码来源:sdr_shell.c
示例8: PROCESS_THREAD
/**
* \brief A process that handles adding/removing
* BLE IPSP interfaces.
*/
PROCESS_THREAD(ble_iface_observer, ev, data)
{
static struct etimer led_timer;
PROCESS_BEGIN();
etimer_set(&led_timer, CLOCK_SECOND/2);
while(1) {
PROCESS_WAIT_EVENT();
if(ev == ble_event_interface_added) {
etimer_stop(&led_timer);
leds_off(LEDS_1);
leds_on(LEDS_2);
} else if(ev == ble_event_interface_deleted) {
etimer_set(&led_timer, CLOCK_SECOND/2);
leds_off(LEDS_2);
} else if(ev == PROCESS_EVENT_TIMER && etimer_expired(&led_timer)) {
etimer_reset(&led_timer);
leds_toggle(LEDS_1);
}
}
PROCESS_END();
}
开发者ID:1847123212,项目名称:contiki,代码行数:28,代码来源:contiki-main.c
示例9: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_send_process, ev, data)
{
struct shell_input *input;
int len;
struct collect_msg *msg;
PROCESS_BEGIN();
while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
input = data;
len = input->len1 + input->len2;
if(len == 0) {
PROCESS_EXIT();
}
if(len < PACKETBUF_SIZE) {
packetbuf_clear();
packetbuf_set_datalen(len + COLLECT_MSG_HDRSIZE);
msg = packetbuf_dataptr();
memcpy(msg->data, input->data1, input->len1);
memcpy(msg->data + input->len1, input->data2, input->len2);
#if TIMESYNCH_CONF_ENABLED
msg->timestamp = timesynch_time();
#else
msg->timestamp = 0;
#endif
msg->crc = crc16_data(msg->data, len, 0);
/* printf("Sending %d bytes\n", len);*/
collect_send(&collect, COLLECT_REXMITS);
}
}
PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:37,代码来源:shell-rime.c
示例10: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(udp_process_sender, ev, data)
{
uip_ipaddr_t ipaddr;
PROCESS_BEGIN();
PRINTF("Process test UDP sender started\n");
PRINTF("Local IPv6 address: ");
PRINT6ADDR(&uip_netif_physical_if.addresses[0].ipaddr);
PRINTF("\n");
#ifdef UDP_ADDR_A
uip_ip6addr(&ipaddr,
UDP_ADDR_A,UDP_ADDR_B,UDP_ADDR_C,UDP_ADDR_D,
UDP_ADDR_E,UDP_ADDR_F,UDP_ADDR_G,UDP_ADDR_H);
#else /* UDP_ADDR_A */
uip_ip6addr(&ipaddr,0xfe80,0,0,0,0x6466,0x6666,0x6666,0x6666);
#endif /* UDP_ADDR_A */
/* new connection with remote host */
udpconn = udp_new(&ipaddr, HTONS(0xF0B0), NULL);
udp_bind(udpconn, HTONS(0xF0B0+1));
PRINTF("Created connection with remote peer ");
PRINT6ADDR(&udpconn->ripaddr);
PRINTF("local/remote port %u/%u\n", HTONS(udpconn->lport),HTONS(udpconn->rport));
etimer_set(&udp_periodic_timer, 15*CLOCK_SECOND);
while(1) {
PROCESS_YIELD();
udphandler(ev, data);
}
PROCESS_END();
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:37,代码来源:example-udp-sender.c
示例11: 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, (void *)sensors[i]) == PROCESS_ERR_OK) {
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event);
}
sensors_flags[i] &= ~FLAG_CHANGED;
events++;
}
}
} while(events);
}
PROCESS_END();
}
开发者ID:AWGES,项目名称:StormSAMR21,代码行数:37,代码来源:sensors.c
示例12: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(settings_delete_process, ev, data)
{
PROCESS_BEGIN();
#if (APP_SETTINGS_DELETE == 1)
// Delete all Settings if no value is defined
#if !defined(NODE_CONF_ID) && !defined(RADIO_CONF_PAN_ID) && !defined(RADIO_CONF_CHANNEL) && !defined(RADIO_CONF_TX_POWER) && !defined(NODE_CONF_EUI64)
PRINTF("Wiping settings...");
settings_wipe();
PRINTF("done.\n");
#else /* !defined(NODE_CONF_ID) && !defined(RADIO_CONF_CHANNEL) && !defined(RADIO_CONF_TX_POWER) */
// NOTE: currently deleting single items is disabled as the library does not provide it!
// TODO: Check Roberts implementation for delete function
#error Settings manager does not support deleting single items yet. Try wipe instead.
#ifdef NODE_CONF_ID
PRINTF("[APP.settings-delete] node id delete status: %s\n", settings_delete(SETTINGS_KEY_PAN_ADDR, 0) == SETTINGS_STATUS_OK ? "OK" : "FAILED");
//_do_delete("node id", SETTINGS_KEY_PAN_ADDR);
#endif
#ifdef RADIO_CONF_PAN_ID
PRINTF("[APP.settings-delete] pan id delete status: %d\n", settings_delete(SETTINGS_KEY_PAN_ID, 0) == SETTINGS_STATUS_OK ? 1 : 0);
#endif
#ifdef RADIO_CONF_CHANNEL
PRINTF("[APP.settings-delete] channel delete status: %d\n", settings_delete(SETTINGS_KEY_CHANNEL, 0) == SETTINGS_STATUS_OK ? 1 : 0);
#endif
#ifdef RADIO_CONF_TX_POWER
PRINTF("[APP.settings-delete] tx power delete status: %d\n", settings_delete(SETTINGS_KEY_TXPOWER, 0) == SETTINGS_STATUS_OK ? 1 : 0);
#endif
#ifdef NODE_CONF_EUI64
PRINTF("[APP.settings-delete] EUI64 delete status: %d\n", settings_delete(SETTINGS_KEY_EUI64, 0) == SETTINGS_STATUS_OK ? 1 : 0);
#endif
#endif /* !defined(NODE_CONF_ID) && !defined(RADIO_CONF_PAN_ID) && !defined(RADIO_CONF_CHANNEL) && !defined(RADIO_CONF_TX_POWER) && !defined(NODE_CONF_EUI64) */
#endif /* (APP_SETTINGS_DELETE == 1) */
PROCESS_END();
}
开发者ID:ibr-cm,项目名称:contiki-inga,代码行数:37,代码来源:settings_delete.c
示例13: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(tcpip_process, ev, data)
{
PROCESS_BEGIN();
#if UIP_TCP
{
static unsigned char i;
for(i = 0; i < UIP_LISTENPORTS; ++i) {
s.listenports[i].port = 0;
}
s.p = PROCESS_CURRENT();
}
#endif
tcpip_event = process_alloc_event();
#if UIP_CONF_ICMP6
tcpip_icmp6_event = process_alloc_event();
#endif /* UIP_CONF_ICMP6 */
etimer_set(&periodic, CLOCK_SECOND / 2);
uip_init();
#ifdef UIP_FALLBACK_INTERFACE
UIP_FALLBACK_INTERFACE.init();
#endif
/* initialize RPL if configured for using RPL */
#if UIP_CONF_IPV6 && UIP_CONF_IPV6_RPL
rpl_init();
#endif /* UIP_CONF_IPV6_RPL */
while(1) {
PROCESS_YIELD();
eventhandler(ev, data);
}
PROCESS_END();
}
开发者ID:ajwlucas,项目名称:lib_xtcp,代码行数:37,代码来源:tcpip.c
示例14: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(netperf_shell_process, ev, data)
{
PROCESS_BEGIN();
serial_shell_init();
shell_blink_init();
/* shell_file_init();
shell_coffee_init();*/
/* shell_download_init();
shell_rime_sendcmd_init();*/
shell_ps_init();
shell_reboot_init();
shell_rime_init();
shell_rime_netcmd_init();
shell_rime_ping_init();
shell_rime_debug_init();
shell_rime_sniff_init();
shell_text_init();
shell_time_init();
shell_sendtest_init();
shell_netperf_init();
PROCESS_END();
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:25,代码来源:netperf-shell.c
示例15: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(stm32w_radio_process, ev, data)
{
int len;
PROCESS_BEGIN();
PRINTF("stm32w_radio_process: started\r\n");
while(1) {
PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL);
PRINTF("stm32w_radio_process: calling receiver callback\r\n");
#if DEBUG > 1
for(uint8_t c=1; c <= RCVD_PACKET_LEN; c++){
PRINTF("%x",stm32w_rxbuf[c]);
}
PRINTF("\r\n");
#endif
packetbuf_clear();
len = stm32w_radio_read(packetbuf_dataptr(), PACKETBUF_SIZE);
if(len > 0) {
packetbuf_set_datalen(len);
NETSTACK_RDC.input();
}
if(!RXBUFS_EMPTY()){
// Some data packet still in rx buffer (this happens because process_poll doesn't queue requests),
// so stm32w_radio_process need to be called again.
process_poll(&stm32w_radio_process);
}
}
PROCESS_END();
}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:37,代码来源:stm32w-radio.c
示例16: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(fixed_process, ev, data)
{
static struct etimer et;
static uip_ipaddr_t ipaddr;
PROCESS_BEGIN();
conn = udp_new(NULL, UIP_HTONS(0), NULL);
udp_bind(conn, UIP_HTONS(3000));
memset(history,0,sizeof(history));
etimer_set(&et, SEND_INTERVAL);
cur_time = 1;
while(1) {
PROCESS_YIELD();
if(etimer_expired(&et)) {
timeout_handler();
etimer_restart(&et);
} else if(ev == tcpip_event) {
tcpip_handler();
}
}
PROCESS_END();
}
开发者ID:vitorqa,项目名称:CC2530_Contiki,代码行数:25,代码来源:fixo.c
示例17: PROCESS_THREAD
PROCESS_THREAD(coap_app_client, ev, data)
{
PROCESS_BEGIN();
uip_ip6addr_u8(&server_ipaddr,0xfe,0x80,0,0,0,0,0,0,0xc0,0xa0,0x08,0x39,0xd1,0xe4,0x02,0x05);
/* new connection with server */
client_conn = udp_new(&server_ipaddr, UIP_HTONS(REMOTE_PORT), NULL);
udp_bind(client_conn, UIP_HTONS(LOCAL_PORT));
// UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
while(1) {
PROCESS_YIELD();
if (ev == PROCESS_EVENT_CONTINUE) {
send_data();
} else if (ev == tcpip_event) {
sprintf(outStr_buf,"\r\nPacket received\r\n\r\n");
sendData_inBackground((uint8_t*)outStr_buf,strlen(outStr_buf),1,0);
//handle_incoming_data();
}
}
PROCESS_END();
}
开发者ID:serflosa,项目名称:torrija_gateway,代码行数:24,代码来源:coap_app_client.c
示例18: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(temp_filter_process, ev, data)
{
static struct etimer et;
#define NUMBER_TO_AVERAGE 20
static uint8_t avg = 0;
static uint8_t n = 0;
static uint8_t fake_temp = 17;
PROCESS_BEGIN();
while (1) {
//pretend measurement
if (n == 0) {
avg = fake_temp;
} else {
avg = (avg * n + fake_temp) / (n + 1);
}
n++;
if (n == NUMBER_TO_AVERAGE) {
// send here, then reset this crap
avg = 0;
n = 0;
}
etimer_set(&et, (CLOCK_SECOND * 0.1));
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
}
PROCESS_END();
}
开发者ID:warreee,项目名称:wv,代码行数:37,代码来源:temp_filter.c
示例19: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(ethernode_uip_process, ev, data)
{
PROCESS_BEGIN();
while(1) {
process_poll(ðernode_uip_process);
PROCESS_WAIT_EVENT();
/* Poll Ethernet device to see if there is a frame avaliable. */
uip_len = ethernode_read(uip_buf, UIP_BUFSIZE);
if(uip_len > 0) {
/* printf("%d: new packet len %d\n", node_id, uip_len);*/
/* if((random_rand() % drop) <= drop / 2) {
printf("Bropp\n");
} else*/ {
uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len);
#ifdef __CYGWIN__
wpcap_send();
#else /* __CYGWIN__ */
tapdev_send();
#endif /* __CYGWIN__ */
/* if(uip_fw_forward() == UIP_FW_LOCAL)*/ {
/* A frame was avaliable (and is now read into the uip_buf), so
we process it. */
tcpip_input();
}
}
}
}
PROCESS_END();
}
开发者ID:Asterios,项目名称:contiki-econotag,代码行数:37,代码来源:ethernode-uip.c
示例20: PROCESS_THREAD
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_reboot_process, ev, data)
{
static struct etimer etimer;
PROCESS_BEGIN();
shell_output_str(&reboot_command,
"Rebooting the node in four seconds...", "");
etimer_set(&etimer, CLOCK_SECOND);
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
leds_on(LEDS_RED);
etimer_reset(&etimer);
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
leds_on(LEDS_GREEN);
etimer_reset(&etimer);
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
leds_on(LEDS_BLUE);
etimer_reset(&etimer);
PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
watchdog_reboot();
PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:25,代码来源:shell-reboot.c
注:本文中的PROCESS_END函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论