AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/bacnet.c
void bacnet_task(void)
{
    struct mstp_rx_packet pkt = {{0}};
    bool pdu_available = false;

    /* hello, World! */
    if (Device_ID != Device_Object_Instance_Number()) {
        Device_ID = Device_Object_Instance_Number();
        Send_I_Am(&Handler_Transmit_Buffer[0]);
    }
    /* handle the timers */
    if (timer_interval_expired(&DCC_Timer)) {
        timer_interval_reset(&DCC_Timer);
        dcc_timer_seconds(DCC_CYCLE_SECONDS);
        led_on_interval(LED_DEBUG,500);
    }
    if (timer_interval_expired(&TSM_Timer)) {
        timer_interval_reset(&TSM_Timer);
        tsm_timer_milliseconds(timer_interval(&TSM_Timer));
    }
    reinit_task();
	bacnet_test_task();
    /* handle the messaging */
    if ((!dlmstp_send_pdu_queue_full()) &&
        (!Ringbuf_Empty(&Receive_Queue))) {
        Ringbuf_Pop(&Receive_Queue, (uint8_t *)&pkt);
        pdu_available = true;
    }
    if (pdu_available) {
        led_on_interval(LED_APDU,125);
        npdu_handler(&pkt.src, &pkt.buffer[0], pkt.length);
    }
}
/**************************************************************************
* Description: handles recurring task
* Returns: none
* Notes: none
**************************************************************************/
handles recurring task
Returns: none
Notes: none
handles recurring task Returns : none Notes : none
void bacnet_task(void)
{
    struct mstp_rx_packet pkt = {{0}};
    bool pdu_available = false;
    if (Device_ID != Device_Object_Instance_Number()) {
        Device_ID = Device_Object_Instance_Number();
        Send_I_Am(&Handler_Transmit_Buffer[0]);
    }
    if (timer_interval_expired(&DCC_Timer)) {
        timer_interval_reset(&DCC_Timer);
        dcc_timer_seconds(DCC_CYCLE_SECONDS);
        led_on_interval(LED_DEBUG,500);
    }
    if (timer_interval_expired(&TSM_Timer)) {
        timer_interval_reset(&TSM_Timer);
        tsm_timer_milliseconds(timer_interval(&TSM_Timer));
    }
    reinit_task();
	bacnet_test_task();
    if ((!dlmstp_send_pdu_queue_full()) &&
        (!Ringbuf_Empty(&Receive_Queue))) {
        Ringbuf_Pop(&Receive_Queue, (uint8_t *)&pkt);
        pdu_available = true;
    }
    if (pdu_available) {
        led_on_interval(LED_APDU,125);
        npdu_handler(&pkt.src, &pkt.buffer[0], pkt.length);
    }
}
void bacnet_task ( void ) { struct mstp_rx_packet pkt = { { 0 } } ; bool pdu_available = false ; if ( Device_ID != Device_Object_Instance_Number ( ) ) { Device_ID = Device_Object_Instance_Number ( ) ; Send_I_Am ( & Handler_Transmit_Buffer [ 0 ] ) ; } if ( timer_interval_expired ( & DCC_Timer ) ) { timer_interval_reset ( & DCC_Timer ) ; dcc_timer_seconds ( DCC_CYCLE_SECONDS ) ; led_on_interval ( LED_DEBUG , 500 ) ; } if ( timer_interval_expired ( & TSM_Timer ) ) { timer_interval_reset ( & TSM_Timer ) ; tsm_timer_milliseconds ( timer_interval ( & TSM_Timer ) ) ; } reinit_task ( ) ; bacnet_test_task ( ) ; if ( ( ! dlmstp_send_pdu_queue_full ( ) ) && ( ! Ringbuf_Empty ( & Receive_Queue ) ) ) { Ringbuf_Pop ( & Receive_Queue , ( uint8_t * ) & pkt ) ; pdu_available = true ; } if ( pdu_available ) { led_on_interval ( LED_APDU , 125 ) ; npdu_handler ( & pkt . src , & pkt . buffer [ 0 ] , pkt . length ) ; } }
Description: handles recurring task
Returns: none
Notes: none
Description : handles recurring task Returns : none Notes : none
/* hello, World! */ /* handle the timers */ /* handle the messaging */