• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PROCESS_EXIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PROCESS_EXIT函数的典型用法代码示例。如果您正苦于以下问题:C++ PROCESS_EXIT函数的具体用法?C++ PROCESS_EXIT怎么用?C++ PROCESS_EXIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PROCESS_EXIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(batmon_process, ev, data)
{

  PROCESS_BEGIN();

  PRINTF("BatMon\n", sizeof(r));

  s = sensors_find(ADC_SENSOR);
  if (!s) {
    PRINTF("BatMon: ADC not found\n");
    PROCESS_EXIT();
  }

  n740_analog_deactivate();
  m25p16_res();
  n740_analog_activate();

  /* Find last written location */
  if(find_gap() == -1) {
    PRINTF("BatMon: Flash storage full\n");
    PROCESS_EXIT();
  }

  etimer_set(&et, BATMON_LOG_PERIOD * CLOCK_SECOND);

  while(1) {
    PROCESS_YIELD();
    if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et)) {
      batmon_log(LOG_TRIGGER_PERIODIC);
    }
  }

  PROCESS_END();
}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:35,代码来源:batmon.c


示例2: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_leds_process, ev, data)
{
    struct acc_msg *msg;
    struct shell_input *input;
    int val, i;
    static int num;
    const char *args, *next;

    PROCESS_BEGIN();

    args = data;
    if(args == NULL) {
        shell_output_str(&acc_command, "usage 0", "");
        PROCESS_EXIT();
    }

    num = shell_strtolong(args, &next);
    if(next == args) {
        shell_output_str(&acc_command, "usage 1", "");
        PROCESS_EXIT();
    }

    PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
    input = data;
    msg = (struct acc_msg *)input->data1;
    val = 0;
    for(i = 0; i < msg->acc[num] >> 9; ++i) {
        val = (val << 1) | 1;
    }
    leds_on(val & 0xff);
    leds_off(~(val & 0xff));

    PROCESS_END();
}
开发者ID:PorterNan,项目名称:RPLSecurity,代码行数:35,代码来源:jcreate-shell.c


示例3: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_udpsend_process, ev, data)
{
  const char *next, *nextptr;
  struct shell_input *input;
  uint16_t port, local_port;
  
  PROCESS_BEGIN();

  next = strchr(data, ' ');
  if(next == NULL) {
    shell_output_str(&udpsend_command,
		     "udpsend <server> <port> [localport]: server as address", "");
    PROCESS_EXIT();
  }
  ++next;
  strncpy(server, data, sizeof(server));
  port = shell_strtolong(next, &nextptr);

  uiplib_ipaddrconv(server, (u8_t *)&serveraddr);
  udpconn = udp_new(&serveraddr, htons(port), NULL);
  
  if(next != nextptr) {
    local_port = shell_strtolong(nextptr, &nextptr);
    udp_bind(udpconn, htons(local_port));
  }
  running = 1;


  while(running) {
    PROCESS_WAIT_EVENT();

    if(ev == shell_event_input) {
      input = data;
      if(input->len1 + input->len2 == 0) {
	PROCESS_EXIT();
      }

      if(input->len1 > 0) {
	send_line(input->data1, input->len1);
      }
    } else if(ev == tcpip_event) {
      if(uip_newdata()) {
	newdata(uip_appdata, uip_datalen());
      }
#if 0
    } else if(ev == resolv_event_found) {
      /* Either found a hostname, or not. */
      if((char *)data != NULL &&
	 resolv_lookup((char *)data) != NULL) {
	uip_ipaddr_copy(serveraddr, ipaddr);
	telnet_connect(&s, server, serveraddr, nick);
      } else {
	shell_output_str(&udpsend_command, "Host not found.", "");
      }
#endif /* 0 */
    }
  }

  PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:61,代码来源:shell-udpsend.c


示例4: PROCESS_THREAD

PROCESS_THREAD(shell_ruc_close_process, ev, data)
{
  uint16_t channel;
  long channel_long;
  const char *next;
  char buf[6];
  PROCESS_BEGIN();

  channel_long = shell_strtolong((char *)data, &next);
  if(channel_long <= 0 || channel_long > 65535){
    shell_output_str(&ruc_close_command, "channel has to be in range of [1-65535]", "");
    PROCESS_EXIT();
  }
  channel = (uint16_t) channel_long;
  snprintf(buf, sizeof(buf), "%d", channel);
  struct runicast_entry *e = list_head(runicast_list);
  while(e != NULL){
    if(e->channel == channel){
      struct runicast_entry *to_remove = e;
      e = e->next;
      runicast_close(&to_remove->c);
      list_remove(runicast_list, to_remove);
      memb_free(&runicast_mem, to_remove);
      shell_output_str(&ruc_close_command, "closed unicast connection on channel: ", buf);
      PROCESS_EXIT();
    }
  }
  shell_output_str(&ruc_close_command, "uc_close error: channel not open","");

  PROCESS_END();
}
开发者ID:bastibl,项目名称:gr-ieee802-15-4,代码行数:31,代码来源:sdr_shell.c


示例5: PROCESS_THREAD

PROCESS_THREAD(shell_sendfile_process, ev, data)
{
	const char *nextptr;
	static rimeaddr_t addr;
	int len;
	char buf[32];
	PROCESS_BEGIN();
	/* Parse node addr */
	addr.u8[0] = shell_strtolong(data, &nextptr);
	if(nextptr == data || *nextptr != '.') {
	    printf("sendfile <node addr> <filename>: need node address\n");
	    PROCESS_EXIT();
	}
	++nextptr;
	addr.u8[1] = shell_strtolong(nextptr, &nextptr);
	printf("\nnode address: %d.%d\n", addr.u8[0], addr.u8[1]);

	while(nextptr[0] == ' ') nextptr++;
	len = strlen(nextptr);
	//snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);
	if(len > MAX_FILENAME_SIZE) {
	    snprintf(buf, sizeof(buf), "%d", len);
	    printf("filename too large: ", buf);
	    PROCESS_EXIT();
	}
	sendfile_filename = nextptr;
	printf("filename: %s\n", sendfile_filename);
	sprintf(filenameOriginatorSent.name, "%s", sendfile_filename);
	filenameOriginatorSent.originator = node_id;
	packetbuf_copyfrom(&filenameOriginatorSent, sizeof(filenameOriginatorSent));
	runicast_send(&runicastSendCommand, &addr, MAX_RETRANSMISSIONS);
    PROCESS_END();
}
开发者ID:sebyx31,项目名称:contiki-exercises,代码行数:33,代码来源:contiki_exercise12.c


示例6: PROCESS_THREAD

/*-----------------------------------------------------------------------------------*/
PROCESS_THREAD(about_process, ev, data)
{
    unsigned char width;

    PROCESS_BEGIN();

    width = ctk_desktop_width(NULL);

    strcpy(abouturl_ascii, abouturl_petscii);
    petsciiconv_toascii(abouturl_ascii, sizeof(abouturl_ascii));

    if(width > 34) {
        ctk_dialog_new(&aboutdialog, 32, 9);
    } else {
        ctk_dialog_new(&aboutdialog, width - 2, 9);
    }
    CTK_WIDGET_ADD(&aboutdialog, &aboutlabel1);
    CTK_WIDGET_ADD(&aboutdialog, &aboutlabel2);
    CTK_WIDGET_ADD(&aboutdialog, &aboutlabel3);
    CTK_WIDGET_ADD(&aboutdialog, &aboutlabel4);
    if(width > 34) {
        CTK_WIDGET_ADD(&aboutdialog, &abouturl);
        CTK_WIDGET_SET_FLAG(&abouturl, CTK_WIDGET_FLAG_MONOSPACE);
    } else {
        CTK_WIDGET_SET_XPOS(&aboutlabel1, 0);
        CTK_WIDGET_SET_XPOS(&aboutlabel2, 0);
        CTK_WIDGET_SET_XPOS(&aboutlabel3, 0);
        CTK_WIDGET_SET_XPOS(&aboutlabel4, 0);

        CTK_WIDGET_SET_XPOS(&aboutclose, 0);
    }
    CTK_WIDGET_ADD(&aboutdialog, &aboutclose);
    CTK_WIDGET_FOCUS(&aboutdialog, &aboutclose);

    ctk_dialog_open(&aboutdialog);

    while(1) {
        PROCESS_WAIT_EVENT();
        if(ev == PROCESS_EVENT_EXIT) {
            about_quit();
            PROCESS_EXIT();
        } else if(ev == ctk_signal_button_activate) {
            if(data == (process_data_t)&aboutclose) {
                about_quit();
                PROCESS_EXIT();
            }
        } else if(ev == ctk_signal_hyperlink_activate) {
            if((struct ctk_widget *)data == (struct ctk_widget *)&abouturl) {
                about_quit();
                PROCESS_EXIT();
            }
        }
    }

    PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:57,代码来源:about.c


示例7: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_download_process, ev, data)
{
  const char *nextptr;
  static rimeaddr_t addr;
  int len;
  char buf[32];

  PROCESS_BEGIN();

  /* Parse node addr */
  addr.u8[0] = shell_strtolong(data, &nextptr);
  if(nextptr == data || *nextptr != '.') {
    shell_output_str(&download_command,
        "download <node addr> <filename>: need node address", "");
    PROCESS_EXIT();
  }
  ++nextptr;
  addr.u8[1] = shell_strtolong(nextptr, &nextptr);

  /* Get the length of the file, excluding a terminating NUL character. */
  while(nextptr[0] == ' ') {
    nextptr++;
  }
  len = strlen(nextptr);

  /*snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);*/
  /*shell_output_str(&download_command, "Downloading from: ", buf);*/

  if(len > PACKETBUF_SIZE - 32) {
    snprintf(buf, sizeof(buf), "%d", len);
    shell_output_str(&download_command, "filename too large: ", buf);
    PROCESS_EXIT();
  }

  /*shell_output_str(&download_command, "Downloading file: ", nextptr);*/

  /* Send file request */
  downloading = 1;
  rucb_open(&rucb, RUCB_CHANNEL, &rucb_call);
  packetbuf_clear();
  *((uint8_t *)packetbuf_dataptr()) = ++req_seq_counter;
  memcpy(((char *)packetbuf_dataptr()) + 1, nextptr, len + 1);
  packetbuf_set_datalen(len + 2);
  PRINTF("requesting '%s'\n", nextptr);
  runicast_send(&runicast, &addr, MAX_RETRANSMISSIONS);

  /* Wait for download to finish */
  leds_on(LEDS_BLUE);
  PROCESS_WAIT_UNTIL(!runicast_is_transmitting(&runicast) && !downloading);
  leds_off(LEDS_BLUE);

  rucb_close(&rucb);
  /*shell_output_str(&download_command, "Done!", "");*/

  PROCESS_END();
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:57,代码来源:shell-download.c


示例8: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_tcpsend_process, ev, data)
{
  char *next;
  const char *dummy; 
  struct shell_input *input;
  uint16_t port;
  
  PROCESS_BEGIN();

  next = strchr(data, ' ');
  if(next == NULL) {
    shell_output_str(&tcpsend_command,
		     "tcpsend <server> <port>: server as address", "");
    PROCESS_EXIT();
  }
  *next = 0;
  ++next;
  strncpy(server, data, sizeof(server));
  port = shell_strtolong(next, &dummy);
  
  running = 1;

  uiplib_ipaddrconv(server, &serveraddr);
  telnet_connect(&s, &serveraddr, port);
  while(running) {
    PROCESS_WAIT_EVENT();

    if(ev == shell_event_input) {
      input = data;
      if(input->len1 + input->len2 == 0) {
	PROCESS_EXIT();
      }

      if(input->len1 > 0) {
	send_line(&s, input->data1, input->len1);
      }
    } else if(ev == tcpip_event) {
      telnet_app(data);
#if 0            
    } else if(ev == resolv_event_found) {
      /* Either found a hostname, or not. */
      if((char *)data != NULL &&
	 resolv_lookup((char *)data) != NULL) {
	uip_ipaddr_copy(serveraddr, ipaddr);
	telnet_connect(&s, server, serveraddr, nick);
      } else {
	shell_output_str(&tcpsend_command, "Host not found.", "");
      }
#endif /* 0 */
    }
  }

  PROCESS_END();
}
开发者ID:AWRyder,项目名称:contiki,代码行数:55,代码来源:shell-tcpsend.c


示例9: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_unicast_send_process, ev, data)
{
  struct shell_input *input;
  static linkaddr_t receiver;
  int len;
  const char *nextptr;
  struct unicast_msg *msg;
  
  PROCESS_BEGIN();
  
  receiver.u8[0] = shell_strtolong(data, &nextptr);
  if(nextptr == data || *nextptr != '.') {
    shell_output_str(&unicast_send_command,
		     "unicast <receiver>: recevier must be specified", "");
    PROCESS_EXIT();
  }
  ++nextptr;
  receiver.u8[1] = shell_strtolong(nextptr, &nextptr);

  /*  snprintf(buf, sizeof(buf), "%d.%d", receiver.u8[0], receiver.u8[1]);
      shell_output_str(&unicast_send_command, "Sending unicast packets to ", buf);*/

  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
    input = data;

    len = input->len1 + input->len2;

    if(len == 0) {
      PROCESS_EXIT();
    }
    
    if(len < MAX_DATALEN) {
      packetbuf_clear();
      packetbuf_set_datalen(len + UNICAST_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
      /*      printf("Sending %d bytes\n", len);*/
      unicast_send(&uc, &receiver);
    }
  }
  PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:52,代码来源:shell-rime-unicast.c


示例10: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_remote_rtcc_process, ev, data)
{
  PROCESS_BEGIN();

  printf("RE-Mote RTC test\n");

  /* Map interrupt callback handler */
  RTCC_REGISTER_INT1(rtcc_interrupt_callback);

  /* Wait a bit */
  etimer_set(&et, (CLOCK_SECOND * 2));
  PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));

  /* Retrieve the configured time and date, this doesn't overwrites the
   * mode and century values
   */
  if(rtcc_get_time_date(simple_td) == AB08_ERROR) {
    printf("Fail: Couldn't read time and date\n");
    PROCESS_EXIT();
  }

  /* ...or for visualization only, just print the date directly from the RTCC */
  printf("Configured time: ");
  rtcc_print(RTCC_PRINT_DATE_DEC);

#if TEST_ALARM_MATCH_MIN
  /* Configure the RTCC to trigger an alarm every TEST_ALARM_SECOND match */
  printf("Setting an alarm to tick every %u seconds match\n", TEST_ALARM_SECOND);

  simple_td->seconds = TEST_ALARM_SECOND;

  /* Notice the arguments, we want to trigger the alarm every time the clock
   * matches the seconds values, so the alarm would have to be repeated every
   * minute.  In case we would want to trigger the alarm on a specific time,
   * then we would want to set a daily repeat interval
   */
  if(rtcc_set_alarm_time_date(simple_td, RTCC_ALARM_ON, RTCC_REPEAT_MINUTE,
                              RTCC_TRIGGER_INT1) == AB08_ERROR) {
    printf("Fail: couldn't set the alarm\n");
    PROCESS_EXIT();
  }

#else
  /* Configure the RTCC to trigger an alarm every TEST_ALARM_SECOND tick */
  printf("Setting an alarm to tick every %u seconds\n", TEST_ALARM_SECOND);

  configure_new_alarm();
#endif

  PROCESS_END();
}
开发者ID:1847123212,项目名称:contiki,代码行数:52,代码来源:test-rtcc.c


示例11: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_sendcmd_process, ev, data)
{
  struct cmd_msg  *msg;
  int len;
  linkaddr_t addr;
  const char *nextptr;
  char buf[32];

  PROCESS_BEGIN();

  addr.u8[0] = shell_strtolong(data, &nextptr);
  if(nextptr == data || *nextptr != '.') {
    shell_output_str(&sendcmd_command,
             "sendcmd <node addr>: receiver must be specified", "");
    PROCESS_EXIT();
  }
  ++nextptr;
  addr.u8[1] = shell_strtolong(nextptr, &nextptr);

  snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);
  shell_output_str(&sendcmd_command, "Sending command to ", buf);

  /* Get the length of the command line, excluding a terminating NUL character. */
  len = strlen((char *)nextptr);

  /* Check the length of the command line to see that it is small
     enough to fit in a packet. We count with 32 bytes of header,
     which may be a little too much, but at least we are on the safe
     side. */
  if(len > PACKETBUF_SIZE - 32) {
    snprintf(buf, sizeof(buf), "%d", len);
    shell_output_str(&sendcmd_command, "command line too large: ", buf);
    PROCESS_EXIT();
  }

  packetbuf_clear();
  msg = packetbuf_dataptr();
  packetbuf_set_datalen(len + 1 + CMDMSG_HDR_SIZE);
  strcpy(msg->sendcmd, nextptr);

  /* Terminate the string with a NUL character. */
  msg->sendcmd[len] = 0;
  msg->crc = crc16_data((unsigned char *)msg->sendcmd, len, 0);
  /*    printf("sendcmd sending '%s'\n", msg->sendcmd);*/
  unicast_send(&uc, &addr);

  PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:49,代码来源:shell-rime-sendcmd.c


示例12: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(mcast_sink_process, ev, data)
{
  PROCESS_BEGIN();

  PRINTF("Multicast Engine: '%s'\n", UIP_MCAST6.name);

  if(join_mcast_group() == NULL) {
    PRINTF("Failed to join multicast group\n");
    PROCESS_EXIT();
  }

  count = 0;

  sink_conn = udp_new(NULL, UIP_HTONS(0), NULL);
  udp_bind(sink_conn, UIP_HTONS(MCAST_SINK_UDP_PORT));

  PRINTF("Listening: ");
  PRINT6ADDR(&sink_conn->ripaddr);
  PRINTF(" local/remote port %u/%u\n",
        UIP_HTONS(sink_conn->lport), UIP_HTONS(sink_conn->rport));

  while(1) {
    PROCESS_YIELD();
    if(ev == tcpip_event) {
      tcpip_handler();
    }
  }

  PROCESS_END();
}
开发者ID:PureEngineering,项目名称:contiki,代码行数:31,代码来源:sink.c


示例13: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(border_router_process, ev, data)
{
  static struct etimer et;

  PROCESS_BEGIN();
  PRINTF("Border Router started\n");
  prefix_set = 0;

  leds_on(LEDS_RED);

  /* Request prefix until it has been received */
  while(!prefix_set) {
    leds_on(LEDS_GREEN);
    PRINTF("Prefix request.\n");
    etimer_set(&et, CLOCK_SECOND);
    request_prefix();
    leds_off(LEDS_GREEN);
    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
  }

  /* We have created a new DODAG when we reach here */
  PRINTF("On Channel %u\n", (uint8_t)((FREQCTRL + 44) / 5));

  print_local_addresses();

  leds_off(LEDS_RED);

  PROCESS_EXIT();

  PROCESS_END();
}
开发者ID:GDanii,项目名称:contiki-mirror-MICAz-IPv6,代码行数:32,代码来源:border-router.c


示例14: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_sensors_process, ev, data)
{
  char str_buf[22];

  PROCESS_BEGIN();
  if(data == NULL) {
    shell_output_str(&sensors_command,
                     "sensors {temp|acc}: a sensor must be specified", "");
    PROCESS_EXIT();
  }

  if(strcmp(data, "temp") == 0) {
    unsigned int temp = temperature_sensor.value(0);
    snprintf(str_buf, sizeof(str_buf), "%d.%d degC", temp / 10,
             temp - (temp / 10) * 10);
    shell_output_str(&sensors_command, "Temp: ", str_buf);
  } else {
    if(strcmp(data, "acc") == 0) {
      snprintf(str_buf, sizeof(str_buf), "%d,%d,%d) mg",
               acc_sensor.value(ACC_X_AXIS), acc_sensor.value(ACC_Y_AXIS),
               acc_sensor.value(ACC_Z_AXIS));
      shell_output_str(&sensors_command, "(X,Y,Z): (", str_buf);
    }
  }
  PROCESS_END();
}
开发者ID:Amwam,项目名称:contiki,代码行数:27,代码来源:shell-sensors.c


示例15: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(broadcast_example_process, ev, data)
{
  static struct etimer periodic_timer;
  static struct etimer send_timer;
  uip_ipaddr_t addr;
 
  PROCESS_BEGIN();
//set_global_address();
 udp_bconn = udp_broadcast_new(UIP_HTONS(BROADCAST_PORT),NULL);
    //uip_create_unspecified(&udp_bconn->ripaddr);	
    if(udp_bconn == NULL) {
        printf("NUC E\n");
        PROCESS_EXIT();
    }

  etimer_set(&periodic_timer, SEND_INTERVAL);
  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
    etimer_reset(&periodic_timer);
    etimer_set(&send_timer, SEND_TIME);

    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&send_timer));
    printf("Sending broadcast\n");
    send_broadcast("hi",sizeof("hi"));
  }

  PROCESS_END();
}
开发者ID:alirezapourbahram,项目名称:IoT-Wormhole-IDS,代码行数:29,代码来源:b.c


示例16: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_kill_process, ev, data)
{
  struct shell_command *c;
  char *name;
  PROCESS_BEGIN();

  name = data;
  if(name == NULL || strlen(name) == 0) {
    shell_output_str(&kill_command,
		     "kill <command>: command name must be given", "");
  }

  for(c = list_head(commands);
      c != NULL;
      c = c->next) {
    if(strcmp(name, c->command) == 0 &&
       c != &kill_command &&
       process_is_running(c->process)) {
      command_kill(c);
      PROCESS_EXIT();
    }
  }

  shell_output_str(&kill_command, "Command not found: ", name);
  
  PROCESS_END();
}
开发者ID:uoaerg,项目名称:wise,代码行数:28,代码来源:shell.c


示例17: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_append_process, ev, data)
{
  static int fd = 0;
  struct shell_input *input;

  PROCESS_EXITHANDLER(cfs_close(fd));
  
  PROCESS_BEGIN();

  fd = cfs_open(data, CFS_WRITE | CFS_APPEND);

  if(fd < 0) {
    shell_output_str(&append_command,
		     "append: could not open file for writing: ", data);
  } else {
    while(1) {
      PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
      input = data;
      /*    printf("cat input %d %d\n", input->len1, input->len2);*/
      if(input->len1 + input->len2 == 0) {
	cfs_close(fd);
	PROCESS_EXIT();
      }
      
      cfs_write(fd, input->data1, input->len1);
      cfs_write(fd, input->data2, input->len2);
      
      shell_output(&append_command,
		   input->data1, input->len1,
		   input->data2, input->len2);
    }
  }
  
  PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:36,代码来源:shell-file.c


示例18: 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


示例19: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_pm10_sensor_process, ev, data)
{
  PROCESS_BEGIN();

  static uint16_t pm10_value;

  /* Use pin number not mask, for uart_demo if using the PA5 pin then use 2 */
  pm10.configure(SENSORS_ACTIVE, ADC_PIN);

  /* And periodically poll the sensor */

  while(1) {
    etimer_set(&et, SENSOR_READ_INTERVAL);
    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));

    leds_toggle(LEDS_GREEN);
    pm10_value = pm10.value(1);

    if(pm10_value != ADC_WRAPPER_ERROR) {
      printf("PM10 value = %u ppm\n", pm10_value);
    } else {
      printf("Error, enable the DEBUG flag in adc-wrapper.c for info\n");
      PROCESS_EXIT();
    }
  }
  PROCESS_END();
}
开发者ID:PureEngineering,项目名称:contiki,代码行数:28,代码来源:test-pm10-sensor.c


示例20: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sniffer_process, ev, data)
{
  PROCESS_BEGIN();
  PRINTF("Sniffer started\n");
  PROCESS_EXIT();
  PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:8,代码来源:sniffer.c



注:本文中的PROCESS_EXIT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PROCESS_WAIT_EVENT函数代码示例发布时间:2022-05-30
下一篇:
C++ PROCESS_END函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap