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

C++ process_post函数代码示例

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

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



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

示例1: rx_callback

static void
rx_callback(uint32_t id, uint32_t len)
{
    struct sol_i2c *i2c = buses[id];
    uint32_t offset;
    qm_rc_t ret;
    bool stop;

    if (i2c->xfer.type != READ_REG_MULTIPLE) {
        i2c->xfer.status = len;
        process_post(&soletta_app_process, i2c_irq_event, i2c);
        return;
    }

    if (i2c->xfer.multiple_done == i2c->xfer.multiple_count) {
        i2c->xfer.status = i2c->xfer.length * i2c->xfer.multiple_count;
        process_post(&soletta_app_process, i2c_irq_event, i2c);
        return;
    }

    offset = i2c->xfer.multiple_done * i2c->xfer.length;
    i2c->xfer.multiple_done++;
    stop = i2c->xfer.multiple_done == i2c->xfer.multiple_count;

    ret = begin_transfer(i2c->bus, i2c->slave_addr, id, &i2c->xfer.reg, 1,
        i2c->xfer.data + offset, i2c->xfer.length, stop);

    if (ret == QM_RC_OK)
        return;

    i2c->xfer.status = -ret;
    process_post(&soletta_app_process, i2c_irq_event, i2c);
}
开发者ID:ibriano,项目名称:soletta,代码行数:33,代码来源:sol-i2c-impl-contiki-qmsi.c


示例2: tx_callback

static void
tx_callback(uint32_t id, uint32_t len)
{
    struct sol_i2c *i2c = buses[id];
    qm_rc_t ret;

    if ((i2c->xfer.type != WRITE) && (i2c->xfer.type != WRITE_REG))
        return;

    if (i2c->xfer.multiple_count != i2c->xfer.multiple_done) {
        ret = begin_transfer(i2c->bus, i2c->slave_addr, id, i2c->xfer.data,
            i2c->xfer.length, NULL, 0, true);
        if (ret != QM_RC_OK) {
            i2c->xfer.status = -ret;
            process_post(&soletta_app_process, i2c_irq_event, i2c);
            return;
        }
        i2c->xfer.multiple_done++;
        return;
    }

    i2c->xfer.status = len;

    process_post(&soletta_app_process, i2c_irq_event, i2c);
}
开发者ID:ibriano,项目名称:soletta,代码行数:25,代码来源:sol-i2c-impl-contiki-qmsi.c


示例3: pollhandler

static void pollhandler()
{
    U8 status;

    if (dcb.data_rx)
    {
        process_post(&mac_process, event_mac_rx, NULL);
        dcb.data_rx = false;
    }
    else if (dcb.status_avail)
    {
        switch (dcb.status)
        {
        case RADIO_SUCCESS:
            status = MAC_SUCCESS;
            break;
        case RADIO_NO_ACK:
            status = MAC_NO_ACK;
            break;
        case RADIO_CHANNEL_ACCESS_FAILURE:
            status = MAC_CHANNEL_ACCESS_FAILURE;
            break;
        default:
            status = MAC_UNSPECIFIED_FAILURE;
            break;
        }
        process_post(&mac_process, event_drvr_conf, &dcb);
        dcb.status_avail = false;
    }

    process_poll(&drvr_process);
}
开发者ID:abhinavgupta,项目名称:IEEE-802.15.4,代码行数:32,代码来源:drvr_avr_at86.c


示例4: forwarderActivity

/*---------------------------------------------------------------------------*/
void forwarderActivity() {

	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);

	//When the forwarder not initialized, do nothing
	if(!isRunningForwardingEngine) {
		return;
	}
	else if(rootControl_isRoot()) {
		//As soon as we are root, should have zero virtual queue
		virtualQueueSize = 0;

		//The root should always be beaconing
		if(ctimer_expired(&beacon_timer)) {
			// 	If this is the start of the beacon, be agressive! Beacon fast
			//	so neighbors can re-direct rapidly.
			isBeaconTimerPeriodic = false;
			ctimer_set(&beacon_timer, FAST_BEACON_TIME, beacon_timer_fired, NULL);
     		timer_reset(&beacon_timerTime);  // Reset the tandem timer
		}

		//	If there are packets sitting in the forwarding queue, get them to the reciever
		if(list_length(send_stack) == 0) {
			//	 Don't need sending set to true here? Not using radio?
			//	NO_SNOOP: set beacon type
			beaconType = NORMAL_BEACON;

			process_post(&sendDataTask, NULL, NULL);
		}
		return;
	}
	else if (sending) {
		pmesg(100, "ForwardingEngine is already sending\n");
		return;
	}
	else if (!(list_length(send_stack) == 0) || virtualQueueSize > 0 || sendQeOccupied ) {
		//Stop Beacon, not needed if we are sending data packets (snoop)
#ifndef BEACON_ONLY
		ctimer_stop(&beacon_timer);
    // Stop the tandem timer here, but can't because API doesnt provide that functionality
#endif
		//	Start sending a data packet
		sending = true;

		//NO_SNOOP: set beacon type
		beaconType = NORMAL_BEACON;
		process_post(&sendDataTask, NULL, NULL);
		return;
	}
	else{
	//	Nothing to do but start the beacon!
#ifndef BEACON_ONLY
		isBeaconTimerPeriodic = true;
		ctimer_set(&beacon_timer, BEACON_TIME, beacon_timer_fired, NULL);
    	timer_reset(&beacon_timerTime);  // Reset the tandem timer
#endif
	}

	pmesg(200, "%s :: %s :: Line #%d\n", __FILE__, __func__, __LINE__);
}
开发者ID:RanHuang,项目名称:nick-project-contiki,代码行数:61,代码来源:BcpForwardingEngine.c


示例5: event

/*---------------------------------------------------------------------------*/
static int
event(struct dtls_context_t *ctx, session_t *session,
      dtls_alert_level_t level, unsigned short code)
{
  coap_context_t *coap_ctx;
  coap_ctx = dtls_get_app_data(ctx);

  if(coap_ctx == COAP_CONTEXT_NONE || coap_ctx->is_used == 0) {
    /* The context is no longer in use */
  } else if(code == DTLS_EVENT_CONNECTED) {
    coap_ctx->status = STATUS_CONNECTED;
    PRINTF("coap-context: DTLS CLIENT CONNECTED!\n");
    process_post(coap_ctx->process, coap_context_event, coap_ctx);
  } else if(code == DTLS_EVENT_CONNECT || code == DTLS_EVENT_RENEGOTIATE) {
    coap_ctx->status = STATUS_CONNECTING;
    PRINTF("coap-context: DTLS CLIENT NOT CONNECTED!\n");
    process_post(coap_ctx->process, coap_context_event, coap_ctx);
  } else if(level == DTLS_ALERT_LEVEL_FATAL && code < 256) {
    /* Fatal alert */
    if (coap_ctx && coap_ctx->buf) {
      ip_buf_unref(coap_ctx->buf);
      coap_ctx->buf = NULL;
    }
    coap_ctx->status = STATUS_ALERT;
    PRINTF("coap-context: DTLS CLIENT ALERT %u!\n", code);
    process_post(coap_ctx->process, coap_context_event, coap_ctx);
  }
  return 0;
}
开发者ID:CurieBSP,项目名称:zephyr,代码行数:30,代码来源:er-coap-context.c


示例6: EXTI0_IRQHandler

void EXTI0_IRQHandler(void)
{
   if(EXTI_GetITStatus(DIO0_IRQ) != RESET)
    {
      EXTI_ClearITPendingBit(DIO0_IRQ);
      
      hal_DIOx_ITConfig(all,DISABLE);
      
      if(g_fsk.states == RF_STATE_TX_RUNNING)
      {
        SX1276FskSetOpMode( RF_OPMODE_STANDBY ); 
        g_fsk.states = RF_STATE_TX_DONE;
        process_post(&hal_RF_process, PROCESS_EVENT_MSG, (void *)(&g_fsk.states));
       
      }
      
      if(g_fsk.states == RF_STATE_RX_SYNC) 
      {
        SX1276FskSetOpMode( RF_OPMODE_STANDBY ); 
        read_fifo(true);
        etimer_stop(&timer_rf);
        g_fsk.states = RF_STATE_RX_DONE;
        process_post(&hal_RF_process, PROCESS_EVENT_MSG, (void *)(&g_fsk.states));
      }
    } 
}
开发者ID:bearxiong99,项目名称:lamp_project_master,代码行数:26,代码来源:sx1276-Fsk.c


示例7: ISR

/* ADC10 ISR */
ISR(ADC10, adc10_interrupt)
{
  /* check for how adc was called */
  switch(state) {
  case POLL:
    if(calling_process != NULL) {
      *dest = ADC10MEM;
      process_poll(calling_process);
    }
    break;

  case EVENT:
    adcbuf = ADC10MEM;
    if(calling_process == NULL) {
      /* if no calling process was specified, notify all processes */
      process_post(PROCESS_BROADCAST, adc_event, &adcbuf);
    } else {
      /* just this single process should get the event */
      process_post(calling_process, adc_event, &adcbuf);
    }
    break;

  case ASYNCH:
    *dest = ADC10MEM;
    break;

  case SYNCH:
  default:
    break;
  }

  /* wake the mcu up so the event can be handled */
  state = OFF;
  LPM4_EXIT;
}
开发者ID:dirtwillfly,项目名称:contiki-launchpad,代码行数:36,代码来源:adc.c


示例8: weather_meter_interrupt_handler

/*---------------------------------------------------------------------------*/
static void
weather_meter_interrupt_handler(uint8_t port, uint8_t pin)
{
  uint32_t aux;

  /* Prevent bounce events */
  if(!timer_expired(&debouncetimer)) {
    return;
  }

  timer_set(&debouncetimer, DEBOUNCE_DURATION);

  /* We make a process_post() to check in the pollhandler any specific threshold
   * value
   */

  if((port == ANEMOMETER_SENSOR_PORT) && (pin == ANEMOMETER_SENSOR_PIN)) {
    weather_sensors.anemometer.ticks++;
    process_post(&weather_meter_int_process, anemometer_int_event, NULL);
  } else if((port == RAIN_GAUGE_SENSOR_PORT) && (pin == RAIN_GAUGE_SENSOR_PIN)) {
    weather_sensors.rain_gauge.ticks++;
    aux = weather_sensors.rain_gauge.ticks * WEATHER_METER_AUX_RAIN_MM;
    aux /= 1000;
    weather_sensors.rain_gauge.value = (uint16_t)aux;
    process_post(&weather_meter_int_process, rain_gauge_int_event, NULL);
  }
}
开发者ID:13416795,项目名称:contiki,代码行数:28,代码来源:weather-meter.c


示例9: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(serial_line_process, ev, data)
{
  static char buf[BUFSIZE];
  static int ptr;

  PROCESS_BEGIN();

  serial_line_event_message = process_alloc_event();


  ptr = 0;

  while(1) {
    /* Fill application buffer until newline or empty */
    
    printf("Inside serial_line_process : serial_line_event_message = %d\n", serial_line_event_message);
  
    int c = ringbuf_get(&rxbuf);
    
    if(c == -1) {
      printf("rxbuf empty, process yeilding\n") ;
      /* Buffer empty, wait for poll */
      PROCESS_YIELD();
    } else {
      if(c != END) {
        if(ptr < BUFSIZE-1) {
          buf[ptr++] = (uint8_t)c;
        } else {
          /* Ignore character (wait for EOL) */
        }
      } else {
        /* Terminate */
        buf[ptr++] = (uint8_t)'\0';

        /* Broadcast event */
   
       printf("Broadcast event serial_line_event_message\n");
       process_post(PROCESS_BROADCAST, serial_line_event_message, buf);

        /* Wait until all processes have handled the serial line event */
        if(PROCESS_ERR_OK ==
          process_post(PROCESS_CURRENT(), PROCESS_EVENT_CONTINUE, NULL)) {
          PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_CONTINUE);
        }
        ptr = 0;
      }
    }
  }

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


示例10: tcp_event

/*
 * Handles TCP events from Simple TCP
 */
static void
tcp_event(struct tcp_socket *s, void *ptr, tcp_socket_event_t event)
{
  struct mqtt_connection *conn = ptr;

  /* Take care of event */
  switch(event) {

  /* Fall through to manage different disconnect event the same way. */
  case TCP_SOCKET_CLOSED:
  case TCP_SOCKET_TIMEDOUT:
  case TCP_SOCKET_ABORTED: {

    DBG("MQTT - Disconnected by tcp event %d\n", event);
    process_post(&mqtt_process, mqtt_abort_now_event, conn);
    conn->state = MQTT_CONN_STATE_NOT_CONNECTED;
    ctimer_stop(&conn->keep_alive_timer);
    call_event(conn, MQTT_EVENT_DISCONNECTED, &event);
    abort_connection(conn);

    /* If connecting retry */
    if(conn->auto_reconnect == 1) {
      connect_tcp(conn);
    }
    break;
  }
  case TCP_SOCKET_CONNECTED: {
    conn->state = MQTT_CONN_STATE_TCP_CONNECTED;
    conn->out_buffer_sent = 1;

    process_post(&mqtt_process, mqtt_do_connect_mqtt_event, conn);
    break;
  }
  case TCP_SOCKET_DATA_SENT: {
    DBG("MQTT - Got TCP_DATA_SENT\n");

    if(conn->socket.output_data_len == 0) {
      conn->out_buffer_sent = 1;
      conn->out_buffer_ptr = conn->out_buffer;
    }

    ctimer_restart(&conn->keep_alive_timer);
    break;
  }

  default: {
    DBG("MQTT - TCP Event %d is currently not managed by the tcp event callback\n",
        event);
  }
  }
}
开发者ID:Anagalcala,项目名称:contiki-upstream-unstable,代码行数:54,代码来源:mqtt.c


示例11: PROCESS_THREAD

PROCESS_THREAD(sdcard_process, ev , data)
{
  static struct etimer timer;
  PROCESS_BEGIN();
  *AT91C_PIOA_PER = AT91C_PIO_PA20 | AT91C_PIO_PA1;
  *AT91C_PIOA_ODR = AT91C_PIO_PA20 | AT91C_PIO_PA1;
  
  
  /* Card not inserted */
  sdcard_efs.myCard.sectorCount = 0;
  init_spi();
  
  while(1) {
    if (!(*AT91C_PIOA_PDSR & AT91C_PA20_IRQ0)) {
      if (sdcard_efs.myCard.sectorCount == 0) {
	if (efs_init(&sdcard_efs,0) == 0) {
	  if (event_process) {
	    process_post(event_process, sdcard_inserted_event, NULL);
	  }
	  printf("SD card inserted\n");
	} else {
	  printf("SD card insertion failed\n");
	}
      }
    } else {
      if (sdcard_efs.myCard.sectorCount != 0) {
	/* Card removed */
	  fs_umount(&sdcard_efs.myFs);
	  sdcard_efs.myCard.sectorCount = 0;
	  if (event_process) {
	    process_post(event_process, sdcard_removed_event, NULL);
	  }
	  printf("SD card removed\n");
      }
    }
    
    etimer_set(&timer, CLOCK_SECOND);
    PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT ||
			     ev == PROCESS_EVENT_TIMER);
    if (ev == PROCESS_EVENT_EXIT) break;
    if (!(*AT91C_PIOA_PDSR & AT91C_PA20_IRQ0)) {
      /* Wait for card to be preperly inserted */
      etimer_set(&timer,CLOCK_SECOND/2);
      PROCESS_WAIT_EVENT_UNTIL(ev== PROCESS_EVENT_TIMER);
    }
    
  }
  PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:49,代码来源:efs-sdcard-arch.c


示例12: PROCESS_THREAD

PROCESS_THREAD(sdcard_process, ev , data)
{
  int fd;
  static struct etimer timer;
  PROCESS_BEGIN();
  /* Mark all file descriptors as free */
  for (fd = 0; fd < MAX_FDS; fd++) {
    file_setAttr(&file_descriptors[fd], FILE_STATUS_OPEN,0);
  }
  /* Card not inserted */
  sdcard_efs.myCard.sectorCount = 0;
  init_spi();

  etimer_set(&timer, CLOCK_SECOND);
  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT ||
			     ev== PROCESS_EVENT_TIMER || ev == PROCESS_EVENT_POLL);
    if (ev == PROCESS_EVENT_EXIT) break;
    if (ev == PROCESS_EVENT_TIMER) {
      if (!(GPIOA->IDR & (1<<0))) {
	if (sdcard_efs.myCard.sectorCount == 0) {
	  etimer_set(&timer,CLOCK_SECOND/2);
	  PROCESS_WAIT_EVENT_UNTIL(ev== PROCESS_EVENT_TIMER);
	  if (efs_init(&sdcard_efs,0) == 0) {
	    if (event_process) {
	      process_post(event_process, sdcard_inserted_event, NULL);
	    }
	    printf("SD card inserted\n");
	  } else {
	    printf("SD card insertion failed\n");
	  }
	}
      } else {
	if (sdcard_efs.myCard.sectorCount != 0) {
	  /* Card removed */
	  fs_umount(&sdcard_efs.myFs);
	  sdcard_efs.myCard.sectorCount = 0;
	  if (event_process) {
	    process_post(event_process, sdcard_removed_event, NULL);
	  }
	  printf("SD card removed\n");
	}
      }
      etimer_set(&timer, CLOCK_SECOND);
      
    }
  }
  PROCESS_END();
}
开发者ID:gnkarn,项目名称:Contiki,代码行数:49,代码来源:sdcard-arch.c


示例13: accm_ff_cb

void
accm_ff_cb(u8_t reg){
  L_ON(LEDS_B);
  process_post(&led_process, ledOff_event, NULL);
  printf("~~[%u] Freefall detected! (0x%02X) -- ", ((u16_t) clock_time())/128, reg);
  print_int(reg);
}
开发者ID:chanhemow,项目名称:contiki-fork,代码行数:7,代码来源:test-adxl345.c


示例14: cack_handler

void cack_handler(ChannelState *state, DataPayload *dp){
	if (state->state != STATE_CONNECT){
		PRINTF("Not in Connecting state\n");
		return;
	}
	ConnectACKMsg *ck = (ConnectACKMsg*)dp->data;
	if (ck->accept == 0){
		PRINTF("SCREAM! THEY DIDN'T EXCEPT!!");
	}
	PRINTF("%s accepts connection request on channel %d\n",ck->name,dp->hdr.src_chan_num);
	state->remote_chan_num = dp->hdr.src_chan_num;

	DataPayload *new_dp = &(state->packet);
	clean_packet(new_dp);
	new_dp->hdr.src_chan_num = state->chan_num;
	new_dp->hdr.dst_chan_num = state->remote_chan_num;
	//dp_complete(new_dp,10,QACK,1);
    (new_dp)->hdr.cmd = CACK; 
    (new_dp)->dhdr.tlen = UIP_HTONS(0);
	send_on_knot_channel(state,new_dp);
	state->state = STATE_CONNECTED;
	state->ticks = 100;
	DeviceInfo di;
	strcpy(di.name, ck->name);
	di.channelID = state->chan_num; 
	process_post(state->ccb.client_process, KNOT_EVENT_CONNECTED_DEVICE, &di);
	printf("Timeout in %ds\n",state->rate * PING_WAIT );
	ctimer_set(&(state->timer),CLOCK_CONF_SECOND * (state->rate * PING_WAIT) ,ping_callback, state); 
}
开发者ID:fergul,项目名称:KNoT,代码行数:29,代码来源:knot-controller.c


示例15: rpl_update_forwarder_set

void
rpl_update_forwarder_set(rpl_instance_t *instance)
{
  if(!we_are_root) {
    process_post(&rpl_forwarder_set_update_process, PROCESS_EVENT_CONTINUE, instance);
  }
}
开发者ID:mlwymore,项目名称:contiki,代码行数:7,代码来源:rpl-opp-routing.c


示例16: lookup

static uip_ipaddr_t *
lookup(uip_ipaddr_t *destipaddr, uip_ipaddr_t *nexthop)
{
  static rimeaddr_t rimeaddr;
  struct route_entry *route;
  int i;

  for(i = 1; i < sizeof(rimeaddr); i++) {
    rimeaddr.u8[i] = destipaddr->u8[sizeof(*destipaddr) - sizeof(rimeaddr) + i];
  }
  rimeaddr.u8[0] = 0;

  PRINTF("rimeroute: looking up ");
  PRINT6ADDR(destipaddr);
  PRINTF(" with Rime address ");
  PRINTRIMEADDR((&rimeaddr));
  PRINTF("\n");

  route = route_lookup(&rimeaddr);
  if(route == NULL) {
    process_post(&rimeroute_process, rimeroute_event, &rimeaddr);
    return NULL;
  }

  uip_ip6addr(nexthop, 0xfe80, 0, 0, 0, 0, 0, 0, 0);
  uip_netif_addr_autoconf_set(nexthop, (uip_lladdr_t *)&route->nexthop);
  PRINTF("rimeroute: ");
  PRINT6ADDR(destipaddr);
  PRINTF(" can be reached via ");
  PRINT6ADDR(nexthop);
  PRINTF("\n");

  return nexthop;
}
开发者ID:soohyunc,项目名称:contiki-2.x,代码行数:34,代码来源:rimeroute.c


示例17: read_chunk

static int
read_chunk(struct rucb_conn *c, int offset, char *to, int maxsize)
{
  int size;
  /*  printf("-");*/
  size = maxsize;
  if(bytecount + maxsize >= filesize) {
    size = filesize - bytecount;
  }
  if(size > packetsize) {
    size = packetsize;
  }
  bytecount += size;
  if(bytecount == filesize) {
    end_time_rucb = clock_time();
    download_complete = 1;
    process_post(&shell_sendtest_process, PROCESS_EVENT_CONTINUE, NULL);
    /*     profile_aggregates_print(); */
/*     profile_print_stats(); */
//    print_stats();
  }

  /*  printf("bytecount %lu\n", bytecount);*/
  return size;
}
开发者ID:1uk3,项目名称:contiki,代码行数:25,代码来源:shell-sendtest.c


示例18: mqtt_connect

/*
 * Connect to MQTT broker.
 *
 * N.B. Non-blocking call.
 */
mqtt_status_t
mqtt_connect(struct mqtt_connection *conn, char *host, uint16_t port,
             uint16_t keep_alive)
{
  uip_ip6addr_t ip6addr;
  uip_ipaddr_t *ipaddr;
  ipaddr = &ip6addr;

  /* Check if we are already trying to connect */
  if(conn->state > MQTT_CONN_STATE_NOT_CONNECTED) {
    return MQTT_STATUS_OK;
  }

  conn->server_host = host;
  conn->keep_alive = keep_alive;
  conn->server_port = port;
  conn->out_buffer_ptr = conn->out_buffer;
  conn->out_packet.qos_state = MQTT_QOS_STATE_NO_ACK;
  conn->connect_vhdr_flags |= MQTT_VHDR_CLEAN_SESSION_FLAG;

  /* convert the string IPv6 address to a numeric IPv6 address */
  uiplib_ip6addrconv(host, &ip6addr);

  uip_ipaddr_copy(&(conn->server_ip), ipaddr);

  /*
   * Initiate the connection if the IP could be resolved. Otherwise the
   * connection will be initiated when the DNS lookup is finished, in the main
   * event loop.
   */
  process_post(&mqtt_process, mqtt_do_connect_tcp_event, conn);

  return MQTT_STATUS_OK;
}
开发者ID:Anagalcala,项目名称:contiki-upstream-unstable,代码行数:39,代码来源:mqtt.c


示例19: mqtt_publish

/*----------------------------------------------------------------------------*/
mqtt_status_t
mqtt_publish(struct mqtt_connection *conn, uint16_t *mid, char *topic,
             uint8_t *payload, uint32_t payload_size,
             mqtt_qos_level_t qos_level, mqtt_retain_t retain)
{
  if(conn->state != MQTT_CONN_STATE_CONNECTED_TO_BROKER) {
    return MQTT_STATUS_NOT_CONNECTED_ERROR;
  }

  DBG("MQTT - Call to mqtt_publish...\n");

  /* Currently don't have a queue, so only one item at a time */
  if(conn->out_queue_full) {
    DBG("MQTT - Not accepted!\n");
    return MQTT_STATUS_OUT_QUEUE_FULL;
  }
  conn->out_queue_full = 1;
  DBG("MQTT - Accepted!\n");

  conn->out_packet.mid = INCREMENT_MID(conn);
  conn->out_packet.retain = retain;
  conn->out_packet.topic = topic;
  conn->out_packet.topic_length = strlen(topic);
  conn->out_packet.payload = payload;
  conn->out_packet.payload_size = payload_size;
  conn->out_packet.qos = qos_level;
  conn->out_packet.qos_state = MQTT_QOS_STATE_NO_ACK;

  process_post(&mqtt_process, mqtt_do_publish_event, conn);
  return MQTT_STATUS_OK;
}
开发者ID:Anagalcala,项目名称:contiki-upstream-unstable,代码行数:32,代码来源:mqtt.c


示例20: uaodv_request_route_to

struct uaodv_rt_entry *
uaodv_request_route_to(uip_ipaddr_t *host)
{
  struct uaodv_rt_entry *route = uaodv_rt_lookup(host);

  if(route != NULL) {
    uaodv_rt_lru(route);
    return route;
  }

  /*
   * Broadcast protocols must be rate-limited!
   */
  if(!timer_expired(&next_time)) {
    return NULL;
  }

  if(command != COMMAND_NONE) {
    return NULL;
  }

  uip_ipaddr_copy(&rreq_addr, host);
  command = COMMAND_SEND_RREQ;
  process_post(&uaodv_process, PROCESS_EVENT_MSG, NULL);
  timer_set(&next_time, CLOCK_SECOND/8); /* Max 10/s per RFC3561. */
  return NULL;
}
开发者ID:Ammar-85,项目名称:osd-contiki,代码行数:27,代码来源:uaodv.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ process_post_synch函数代码示例发布时间:2022-05-30
下一篇:
C++ process_packet函数代码示例发布时间: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