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

C++ APPL_LOG函数代码示例

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

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



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

示例1: icmp6_handler

/**@brief ICMP6 module event handler.
 *
 * @details Callback registered with the ICMP6 module to receive asynchronous events from
 *          the module, if the ICMP6_ENABLE_ALL_MESSAGES_TO_APPLICATION constant is not zero
 *          or the ICMP6_ENABLE_ND6_MESSAGES_TO_APPLICATION constant is not zero.
 */
uint32_t icmp6_handler(iot_interface_t * p_interface,
                       ipv6_header_t   * p_ip_header,
                       icmp6_header_t  * p_icmp_header,
                       uint32_t          process_result,
                       iot_pbuffer_t   * p_rx_packet)
{
    APPL_LOG("[APPL]: Got ICMP6 Application Handler Event on interface 0x%p\r\n", p_interface);

    APPL_LOG("[APPL]: Source IPv6 Address: ");
    APPL_ADDR(p_ip_header->srcaddr);
    APPL_LOG("[APPL]: Destination IPv6 Address: ");
    APPL_ADDR(p_ip_header->destaddr);
    APPL_LOG("[APPL]: Process result = 0x%08lx\r\n", process_result);

    switch (p_icmp_header->type)
    {
        case ICMP6_TYPE_ECHO_REPLY:
            APPL_LOG("[APPL]: ICMP6 Message Type = Echo Reply\r\n");

            if (m_app_state != APP_STATE_IDLE)
            {
                // Invert LED_FOUR.
                LEDS_INVERT(LED_FOUR);
            }

            // Reset echo request retransmission number.
            m_echo_req_retry_count = 0;
            break;
        default:
            break;
    }

    return NRF_SUCCESS;
}
开发者ID:sische,项目名称:MasterThesis,代码行数:40,代码来源:main.c


示例2: main

/**@brief Function for application main entry.
 */
int main(void)
{
    // Initialize
    app_trace_init();
    leds_init();

    timers_init();
    buttons_init();
    ipv6_transport_init();
    ip_stack_init();

    uint32_t err_code = coap_init(17);
    APP_ERROR_CHECK(err_code);

    coap_endpoints_init();

    iot_timer_init();

    APPL_LOG("\r\n");
    APPL_LOG("[APPL]: Init complete.\r\n");

    // Start execution
    advertising_start();

    // Enter main loop
    for (;;)
    {
        power_manage();
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:32,代码来源:main.c


示例3: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    // Initialize.
    app_trace_init();
    leds_init();
    timers_init();
    gpiote_init();

    err_code = ipv6_transport_init();
    APP_ERROR_CHECK(err_code);

    // Initialize IP Stack.
    ip_stack_init();

    APPL_LOG("\r\n");
    APPL_LOG("[APPL]: Init complete.\r\n");

    // Start execution.
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        /* Sleep waiting for an application event. */
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:33,代码来源:main.c


示例4: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    bool erase_bonds;

#ifdef ENABLE_DEBUG_LOG_SUPPORT
    app_trace_init();
#endif

    APPL_LOG("START\r\n");

    // Initialize.
    timers_init();
    buttons_leds_init(&erase_bonds);
    adc_config();
    ble_stack_init();
    device_manager_init(erase_bonds);
    gap_params_init();
    advertising_init();
    services_init();
    conn_params_init();

    // Start execution.
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
    APPL_LOG("start advertising : %u\n", err_code);

    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
开发者ID:hirokuma,项目名称:nrf51822_adctest,代码行数:35,代码来源:main.c


示例5: on_ble_evt

/**@brief Function for handling the Application's BLE Stack events.
 *
 * @param[in] p_ble_evt  Bluetooth stack event.
 */
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t err_code;

    switch (p_ble_evt->header.evt_id)
            {
        case BLE_GAP_EVT_CONNECTED:
            APPL_LOG("BLE_GAP_EVT_CONNECTED : %u\n", p_ble_evt->header.evt_id);
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;

            //err_code = app_timer_start(m_app_timer_id, APP_TIMER_ADC_INTERVAL, NULL);
            //APP_ERROR_CHECK(err_code);
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            APPL_LOG("BLE_GAP_EVT_DISCONNECTED : %u\n", p_ble_evt->header.evt_id);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            //nrf_adc_stop();
            //app_timer_stop(m_app_timer_id);
            break;

        default:
            // No implementation needed.
            break;
    }
}
开发者ID:hirokuma,项目名称:nrf51822_adctest,代码行数:34,代码来源:main.c


示例6: app_mqtt_evt_handler

void app_mqtt_evt_handler(const mqtt_client_t * p_client, const mqtt_evt_t * p_evt)
{
    uint32_t err_code;
    switch(p_evt->id)
    {
        case MQTT_EVT_CONNECTED:
        {
            APPL_LOG ("[APPL]: >> MQTT_EVT_CONNECTED\r\n");
            if(p_evt->result == MQTT_SUCCESS)
            {
                m_connection_state = true;
                m_display_state = LEDS_CONNECTED_TO_BROKER;
                err_code = app_timer_start(m_led_blink_timer, LED_BLINK_INTERVAL, NULL);
                APP_ERROR_CHECK(err_code);
            }
            break;
        }
        case MQTT_EVT_DISCONNECTED:
        {
            APPL_LOG ("[APPL]: >> MQTT_EVT_DISCONNECTED\r\n");
            m_connection_state = false;
            m_display_state = LEDS_IPV6_IF_UP;
            err_code = app_timer_start(m_led_blink_timer, LED_BLINK_INTERVAL, NULL);
            APP_ERROR_CHECK(err_code);
            break;
        }
        default:
            break;
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:30,代码来源:main.c


示例7: ip_app_handler

static void ip_app_handler(iot_interface_t * p_interface, ipv6_event_t * p_event)
{
    uint32_t    err_code;
    ipv6_addr_t src_addr;

    APPL_LOG("[APPL]: Got IP Application Handler Event on interface 0x%p\r\n", p_interface);

    switch (p_event->event_id)
    {
        case IPV6_EVT_INTERFACE_ADD:
#ifdef COMMISSIONING_ENABLED
            commissioning_joining_mode_timer_ctrl(JOINING_MODE_TIMER_STOP_RESET);
#endif // COMMISSIONING_ENABLED
            APPL_LOG("[APPL]: New interface added!\r\n");
            mp_interface = p_interface;

            m_display_state = LEDS_IPV6_IF_UP;

            APPL_LOG("[APPL]: Sending Router Solicitation to all routers!\r\n");

            // Create Link Local addresses
            IPV6_CREATE_LINK_LOCAL_FROM_EUI64(&src_addr, p_interface->local_addr.identifier);

            // Delay first solicitation due to possible restriction on other side.
            nrf_delay_ms(APP_RTR_SOLICITATION_DELAY);

            // Send Router Solicitation to all routers.
            err_code = icmp6_rs_send(p_interface,
                                     &src_addr,
                                     &m_local_routers_multicast_addr);
            APP_ERROR_CHECK(err_code);
        break;

        case IPV6_EVT_INTERFACE_DELETE:
#ifdef COMMISSIONING_ENABLED
            commissioning_joining_mode_timer_ctrl(JOINING_MODE_TIMER_START);
#endif // COMMISSIONING_ENABLED
            APPL_LOG("[APPL]: Interface removed!\r\n");
            mp_interface = NULL;

            m_display_state = LEDS_IPV6_IF_DOWN;

            // Stop application state machine timer.
            m_app_state = APP_STATE_IDLE;
            err_code = app_timer_stop(m_app_timer);
            APP_ERROR_CHECK(err_code);
            break;

        case IPV6_EVT_INTERFACE_RX_DATA:
            APPL_LOG("[APPL]: Got unsupported protocol data!\r\n");
            break;

        default:
            // Unknown event. Should not happen.
            break;
    }
}
开发者ID:sische,项目名称:MasterThesis,代码行数:57,代码来源:main.c


示例8: button_event_handler

/**@brief Function for handling button events.
 *
 * @param[in]   pin_no         The pin number of the button pressed.
 * @param[in]   button_action  The action performed on button.
 */
static void button_event_handler(uint8_t pin_no, uint8_t button_action)
{
    uint32_t err_code;
#ifdef COMMISSIONING_ENABLED
    if ((button_action == APP_BUTTON_PUSH) && (pin_no == ERASE_BUTTON_PIN_NO))
    {
        APPL_LOG("[APPL]: Erasing all commissioning settings from persistent storage... \r\n");
        commissioning_settings_clear();
        return;
    }
#endif // COMMISSIONING_ENABLED

    // Check if interface is UP.
    if(mp_interface == NULL)
    {
        return;
    }

    if (button_action == APP_BUTTON_PUSH)
    {
        switch (pin_no)
        {
            case START_BUTTON_PIN_NO:
            {
                APPL_LOG("[APPL]: Start button has been pushed.\r\n");

                // Change application state in case being in IDLE state.
                if(m_app_state == APP_STATE_IDLE)
                {
                    m_app_state = APP_STATE_QUERYING;

                    // Start application state machine timer.
                    err_code = app_timer_start(m_app_timer, APP_STATE_INTERVAL, NULL);
                    APP_ERROR_CHECK(err_code);
                }

                break;
            }
            case STOP_BUTTON_PIN_NO:
            {
                APPL_LOG("[APPL]: Stop button has been pushed.\r\n");
                LEDS_OFF((LED_THREE | LED_FOUR));

                // Back to IDLE state.
                m_app_state = APP_STATE_IDLE;

                // Stop application state machine timer.
                err_code = app_timer_stop(m_app_timer);
                APP_ERROR_CHECK(err_code);
                break;
            }

            default:
              break;
        }
    }
}
开发者ID:sische,项目名称:MasterThesis,代码行数:62,代码来源:main.c


示例9: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    // Initialize
    app_trace_init();
    leds_init();

#ifdef COMMISSIONING_ENABLED
    err_code = pstorage_init();
    APP_ERROR_CHECK(err_code);
#endif // COMMISSIONING_ENABLED

    timers_init();
    buttons_init();

    static ipv6_medium_init_params_t ipv6_medium_init_params;
    memset(&ipv6_medium_init_params, 0x00, sizeof(ipv6_medium_init_params));
    ipv6_medium_init_params.ipv6_medium_evt_handler    = on_ipv6_medium_evt;
    ipv6_medium_init_params.ipv6_medium_error_handler  = on_ipv6_medium_error;
    ipv6_medium_init_params.use_scheduler              = false;
#ifdef COMMISSIONING_ENABLED
    ipv6_medium_init_params.commissioning_id_mode_cb   = commissioning_id_mode_cb;
    ipv6_medium_init_params.commissioning_power_off_cb = commissioning_power_off_cb;
#endif // COMMISSIONING_ENABLED

    err_code = ipv6_medium_init(&ipv6_medium_init_params, \
                                IPV6_MEDIUM_ID_BLE,       \
                                &m_ipv6_medium);
    APP_ERROR_CHECK(err_code);

    eui48_t ipv6_medium_eui48;
    err_code = ipv6_medium_eui48_get(m_ipv6_medium.ipv6_medium_instance_id, \
                                     &ipv6_medium_eui48);

    ipv6_medium_eui48.identifier[EUI_48_SIZE - 1] = 0x00;

    err_code = ipv6_medium_eui48_set(m_ipv6_medium.ipv6_medium_instance_id, \
                                     &ipv6_medium_eui48);
    APP_ERROR_CHECK(err_code);

    ip_stack_init();
    ip_stack_timer_init();
    dns_client_init();

    APPL_LOG("\r\n");
    APPL_LOG("[APPL]: Init complete.\r\n");

    // Start execution
    connectable_mode_enter();

    // Enter main loop
    for (;;)
    {
        power_manage();
    }
}
开发者ID:sische,项目名称:MasterThesis,代码行数:58,代码来源:main.c


示例10: ip_app_handler

/**@brief IP stack event handler.
 *
 * @details Callback registered with the ICMP6 to receive asynchronous events from the module.
 */
void ip_app_handler(iot_interface_t * p_interface, ipv6_event_t * p_event)
{
    uint32_t err_code;

    APPL_LOG("[APPL]: Got IP Application Handler Event on interface 0x%p\r\n", p_interface);

    switch(p_event->event_id)
    {
        case IPV6_EVT_INTERFACE_ADD:
            APPL_LOG("[APPL]: New interface added!\r\n");

            err_code = udp6_socket_allocate(&m_udp_socket);
            APP_ERROR_CHECK(err_code);

            err_code = udp6_socket_bind(&m_udp_socket, IPV6_ADDR_ANY, HTONS(UDP_PORT));
            APP_ERROR_CHECK(err_code);

            err_code = udp6_socket_recv(&m_udp_socket, rx_udp_port_app_handler);
            APP_ERROR_CHECK(err_code);

            memset(&m_packet_buffer[0][0], 0x00, sizeof(m_packet_buffer));
            m_node_state    = APP_STATE_IPV6_IF_UP;
            m_display_state = LEDS_TX_ECHO_REQUEST;

            // IPv6 interface is up, start sending Echo Requests to peer.
            err_code = app_timer_start(m_tx_node_timer, APP_PING_INTERVAL, NULL);
            APP_ERROR_CHECK(err_code);

            break;
        case IPV6_EVT_INTERFACE_DELETE:
            err_code = app_timer_stop(m_tx_node_timer);
            APP_ERROR_CHECK(err_code);

            APPL_LOG("[APPL]: Interface removed!\r\n");

            err_code = udp6_socket_free(&m_udp_socket);
            APP_ERROR_CHECK(err_code);

            memset(&m_packet_buffer[0][0], 0x00, sizeof(m_packet_buffer));
            m_node_state    = APP_STATE_IPV6_IF_DOWN;
            m_display_state = LEDS_IPV6_IF_DOWN;

            break;
        case IPV6_EVT_INTERFACE_RX_DATA:
            APPL_LOG("[APPL]: Got unsupported protocol data!\r\n");
            break;

        default:
            //Unknown event. Should not happen.
            break;
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:56,代码来源:main.c


示例11: bas_c_evt_handler

/**@brief Battery level Collector Handler. ****************************************
 */
static void bas_c_evt_handler(ble_bas_c_t * p_bas_c, ble_bas_c_evt_t * p_bas_c_evt)
{
    uint32_t err_code;

    switch (p_bas_c_evt->evt_type)
    {
        case BLE_BAS_C_EVT_DISCOVERY_COMPLETE:
            // Battery service discovered. Enable notification of Battery Level.
            APPL_LOG("[APPL]: Battery Service discovered. \r\n");

            APPL_LOG("[APPL]: Reading battery level. \r\n");

            err_code = ble_bas_c_bl_read(p_bas_c);
            APP_ERROR_CHECK(err_code);

            APPL_LOG("[APPL]: Enabling Battery Level Notification. \r\n");
            err_code = ble_bas_c_bl_notif_enable(p_bas_c);
            APP_ERROR_CHECK(err_code);
            printf("Battery service discovered \r\n");

            break;

        case BLE_BAS_C_EVT_BATT_NOTIFICATION:
        {
            APPL_LOG("[APPL]: Battery Level received %d %%\r\n", p_bas_c_evt->params.battery_level);
	    
	    uint8_t batteryLevel = p_bas_c_evt->params.battery_level;
	    // Normalize the battery level
	    //if(batteryLevel > 100) batteryLevel = 100;
	    batteryLevel = batteryLevel < 100 ? batteryLevel : 100;
            printf("batteryLevel = %d %%\r\n", batteryLevel);
	    while(app_pwm_channel_duty_set(&PWM1, 0, batteryLevel) == NRF_ERROR_BUSY)

            printf("Battery = %d %%\r\n", batteryLevel);
            break;
        }

        case BLE_BAS_C_EVT_BATT_READ_RESP:
        {
            APPL_LOG("[APPL]: Battery Level Read as %d %%\r\n", p_bas_c_evt->params.battery_level);

            //printf("Battery Read As = %d %%\r\n", p_bas_c_evt->params.battery_level);
            break;
        }

        default:
            break;
    }
}
开发者ID:rm2k3ru6ru6,项目名称:nRF51_SDK_8.1.0,代码行数:51,代码来源:main.c


示例12: on_ble_evt

/**@brief Function for handling the Application's BLE Stack events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 */
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            APPL_LOG ("[APPL]: Connected.\r\n");
            break;
        case BLE_GAP_EVT_DISCONNECTED:
            APPL_LOG ("[APPL]: Disconnected.\r\n");
            advertising_start();
            break;
        default:
            break;
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:19,代码来源:main.c


示例13: app_mqtt_publish

/**@brief Publishes LED state to MQTT broker.
 *
 * @param[in]   led_state   LED state being published.
 */
static void app_mqtt_publish(bool led_state)
{
    mqtt_topic_t topic;
    mqtt_data_t  data;

    char topic_desc[] = "led/state";

    topic.p_topic = (uint8_t *)topic_desc;
    topic.topic_len = strlen(topic_desc);

    data.data_len = 1;
    data.p_data = (uint8_t *)&led_state;

    uint32_t err_code = mqtt_publish(&m_app_mqtt_id,&topic, &data);
    APPL_LOG("[APPL]: mqtt_publish result 0x%08lx\r\n", err_code);
    if (err_code == MQTT_SUCCESS)
    {
        LEDS_INVERT(LED_FOUR);
        m_led_state = !m_led_state;
    }
    else
    {
        // Flash LED_THREE if error occurs.
        LEDS_ON(LED_THREE);
        err_code = app_timer_start(m_led_blink_timer, LED_BLINK_INTERVAL, NULL);
        APP_ERROR_CHECK(err_code);
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:32,代码来源:main.c


示例14: ble_stack_init

/**@brief Function for initializing the BLE stack.
 *
 * @details Initializes the SoftDevice and the BLE event interrupt.
 */
static void ble_stack_init(void)
{
    uint32_t err_code;

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC, NULL);

#if defined(S110) || defined(S130)
    // Enable BLE stack.
    ble_enable_params_t ble_enable_params;
    memset(&ble_enable_params, 0, sizeof(ble_enable_params));
#ifdef S130
    //ble_enable_params.gatts_enable_params.attr_tab_size   = BLE_GATTS_ATTR_TAB_SIZE_MIN;    //これだと自分のATTが出てこなかった
    ble_enable_params.gatts_enable_params.attr_tab_size   = BLE_GATTS_ATTR_TAB_SIZE_MIN;    //これだと自分のATTが出てこなかった
    ble_enable_params.gap_enable_params.periph_conn_count = 1;
#endif
    ble_enable_params.gatts_enable_params.service_changed = IS_SRVC_CHANGED_CHARACT_PRESENT;
#ifdef S130
    uint32_t app_ram_base = (uint32_t)m_ble_buf;
    err_code = sd_ble_enable(&ble_enable_params, &app_ram_base);
    APPL_LOG("app_ram_base : %x\n", app_ram_base);
#else
    err_code = sd_ble_enable(&ble_enable_params);
#endif
    APP_ERROR_CHECK(err_code);
#endif

    // Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
    APP_ERROR_CHECK(err_code);

    // Register with the SoftDevice handler module for BLE events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}
开发者ID:hirokuma,项目名称:nrf51822_adctest,代码行数:39,代码来源:main.c


示例15: ble_agsensor_configuration_send

/**@brief Function for sending the configuration. */
uint32_t ble_agsensor_configuration_send(ble_agsensor_t * p_agsensor, ble_agsensor_configuration_t * p_configuration)
{
    uint32_t err_code = NRF_SUCCESS;

    if (p_agsensor->conn_handle != BLE_CONN_HANDLE_INVALID)
    {
        ble_gatts_hvx_params_t hvx_params;
        uint8_t encoded_value[MAX_CONFIGURATION_LEN];
        uint16_t hvx_len;

        // Initialize value struct.
        memset(&hvx_params, 0, sizeof(hvx_params));

        hvx_len           = configuration_encode(p_configuration, encoded_value);
        hvx_params.handle = p_agsensor->configuration_handles.value_handle;
        hvx_params.type   = BLE_GATT_HVX_INDICATION;
        hvx_params.p_len  = &hvx_len;
        hvx_params.offset = 0;
        hvx_params.p_data = encoded_value;

        err_code = sd_ble_gatts_hvx(p_agsensor->conn_handle, &hvx_params);
		APPL_LOG("ble_agsensor_configuration_send %d %d\r\n", (int)err_code, p_agsensor->conn_handle);
//		APPL_LOG("ble_agsensor_configuration_send %d %d %d %d\r\n", hvx_params.handle, hvx_params.type, (int)*hvx_params.p_len, hvx_params.offset);
    }
    else
    {
        err_code = NRF_ERROR_INVALID_STATE;
    }

    return err_code;
}
开发者ID:dhavalengg06,项目名称:Probe-Dongle-Firmware,代码行数:32,代码来源:ble_agsensor.c


示例16: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;
    bool erase_bonds;

    app_trace_init();
    // Initialize.
    timers_init();
    buttons_leds_init(&erase_bonds);
    ble_stack_init();
    device_manager_init(erase_bonds);
    gap_params_init();
    advertising_init();
    services_init();
    conn_params_init();

    // Start execution.
    application_timers_start();
    APPL_LOG("Start Advertising \r\n");
    printf("Dhavaltest\r\n");
    SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);

    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
开发者ID:dhavalengg06,项目名称:Probe-Dongle-Firmware,代码行数:32,代码来源:main.c


示例17: ser_sd_transport_cmd_write

uint32_t ser_sd_transport_cmd_write(const uint8_t *                p_buffer,
                                    uint16_t                       length,
                                    ser_sd_transport_rsp_handler_t cmd_rsp_decode_callback)
{
    uint32_t err_code = NRF_SUCCESS;

    m_rsp_wait        = true;
    m_rsp_dec_handler = cmd_rsp_decode_callback;
    err_code          = ser_hal_transport_tx_pkt_send(p_buffer, length);
    APP_ERROR_CHECK(err_code);

    /* Execute callback for response decoding only if one was provided.*/
    if ((err_code == NRF_SUCCESS) && cmd_rsp_decode_callback)
    {
        if (m_ot_rsp_wait_handler)
        {
            m_ot_rsp_wait_handler();
            m_ot_rsp_wait_handler = NULL;
        }

        m_os_rsp_wait_handler();
        err_code = m_return_value;
    }
    else
    {
        m_rsp_wait = false;
    }
    APPL_LOG("\r\n[SD_CALL_ID]: 0x%X, err_code= 0x%X\r\n", p_buffer[1], err_code);
    return err_code;
}
开发者ID:HorseMa,项目名称:BLE2ETHERNET,代码行数:30,代码来源:ser_sd_transport.c


示例18: coap_response_handler

static void coap_response_handler(uint32_t status, void * arg, coap_message_t * p_response)
{
    if (status == NRF_SUCCESS)
    {
        if (coap_message_opt_present(p_response, COAP_OPT_OBSERVE) == NRF_SUCCESS)
        {
            // It is an notification or result of a GET response
            LEDS_ON(LED_FOUR);
        }
        else
        {
            LEDS_OFF(LED_FOUR);
        }


        APPL_LOG("[APPL]: Response Code : %d\r\n", p_response->header.code);
        if (p_response->header.code == COAP_CODE_205_CONTENT)
        {
            switch (p_response->p_payload[0])
            {
                case STATUS_ON:
                    LEDS_ON(LED_THREE);
                    break;

                case STATUS_OFF:
                    LEDS_OFF(LED_THREE);
                    break;

                default:
                    break;
            }
        }
    }
}
开发者ID:xueliu,项目名称:nRF51822,代码行数:34,代码来源:main.c


示例19: ble_agsensor_update_config

static uint32_t ble_agsensor_update_config (ble_agsensor_t * p_agsensor) {

    uint32_t err_code = NRF_SUCCESS;
	static ble_gatts_hvx_params_t hvx_params;
	if (isConfigSendWaiting) {

//		APPL_LOG("isConfigSendWaiting %d\r\n", (int)err_code, p_agsensor->conn_handle);
	    hvx_params.handle = p_agsensor->configuration_handles.value_handle;
	    hvx_params.type   = BLE_GATT_HVX_INDICATION;
	    hvx_params.p_len  = &hvx_p_config_len;
	    hvx_params.offset = 0;
	    hvx_params.p_data = hvx_encoded_buffer;

		err_code = sd_ble_gatts_hvx(p_agsensor->conn_handle, &hvx_params);
		isConfigSendWaiting = (!(err_code == NRF_SUCCESS));

		// TODO: this part does not work as it does not confirm that msg been sent
		if (err_code == NRF_ERROR_BUSY) {
			if (*(hvx_params.p_len) == hvx_p_config_len) {
				isConfigSendWaiting = false;
			}
		}

		APPL_LOG("ble_agsensor_update_config %d %d\r\n", (int)err_code, p_agsensor->conn_handle);

//		APPL_LOG("ble_agsensor_update_config %d %d %d %d\r\n", hvx_params.handle, hvx_params.type, (int)*hvx_params.p_len, hvx_params.offset);
//		APPL_LOG("ble_agsensor_update_config %d \r\n", (int)(*hvx_params.p_len));

	}
	return err_code;
}
开发者ID:dhavalengg06,项目名称:Probe-Dongle-Firmware,代码行数:31,代码来源:ble_agsensor.c


示例20: tcp_send_data

/**@brief Send test data on the port.
 *
  * @details Sends TCP data in Request of size 8 in format described in description above.
 *
 * @param[in]   p_pcb     PCB identifier of the port.
 */
static void tcp_send_data(struct tcp_pcb * p_pcb, uint32_t sequence_number)
{
    err_t  err = ERR_OK;

    if (m_tcp_state != TCP_STATE_DATA_TX_IN_PROGRESS)
    {
        //Register callback to get notification of data reception is complete.
        tcp_sent(p_pcb, tcp_write_complete);
        uint8_t tcp_data[TCP_DATA_SIZE];

        tcp_data[0] = (uint8_t )((sequence_number >> 24) & 0x000000FF);
        tcp_data[1] = (uint8_t )((sequence_number >> 16) & 0x000000FF);
        tcp_data[2] = (uint8_t )((sequence_number >> 8)  & 0x000000FF);
        tcp_data[3] = (uint8_t )(sequence_number         & 0x000000FF);

        tcp_data[4] = 'P';
        tcp_data[5] = 'o';
        tcp_data[6] = 'n';
        tcp_data[7] = 'g';

        //Enqueue data for transmission.
        err = tcp_write(p_pcb, tcp_data, TCP_DATA_SIZE, 1);

        if (err != ERR_OK)
        {
            APPL_LOG ("[APPL]: Failed to send TCP packet, reason %d\r\n", err);
        }
        else
        {
            m_tcp_state = TCP_STATE_DATA_TX_IN_PROGRESS;
        }
    }
开发者ID:xueliu,项目名称:nRF51822,代码行数:38,代码来源:main.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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