コード例 #1
0
ファイル: app_com.c プロジェクト: haby77/fireble_passthrough
void dev_send_to_app(struct app_uart_data_ind *param)
{
    uint8_t *buf_20;
    int16_t len = param->len;
    int16_t send_len = 0;
	
		uint8_t packet_len = get_bit_num(app_qpps_env->char_status)*20;
#ifdef	CATCH_LOG
    QPRINTF("\r\n@@@len %d\r\n@@@data\r\n",len);

    for(uint8_t j = 0; j<len; j++)
        QPRINTF("%c",param->data[j]);
    QPRINTF("\r\n");
#endif
    if(app_qpps_env->char_status)
    {
        for(uint8_t i =0; send_len < len; i++)
        {
            if (len > packet_len) //Split data into package when len longger than 20
            {
                if (len - send_len > packet_len)	
                {
                    buf_20 = (uint8_t*)ke_msg_alloc(0, 0, 0, packet_len);
                    if(buf_20 != NULL)
                    {
                        memcpy(buf_20,param->data+send_len,packet_len);
                        send_len+=packet_len;
                    }
                }
                else
                {
                    buf_20 = (uint8_t *)ke_msg_alloc(0,0,0,len-send_len);
                    if (buf_20 != NULL)
                    {
                        memcpy(buf_20,param->data+send_len,len-send_len);
                        send_len = len;
                    }
                }
            }
            else	//not longger ther 20 send data directely
            {
								buf_20 = (uint8_t *)ke_msg_alloc(0,0,0,len);
								if (buf_20 != NULL)
								{
										memcpy(buf_20,param->data,len);
										send_len = len;
								}
                //app_qpps_data_send(app_qpps_env->conhdl,0,len,param->data);
            }
						//push the package to kernel queue.
						app_push(ke_param2msg(buf_20));
				}
    }
}
コード例 #2
0
ファイル: app_com.c プロジェクト: haby77/fireble_passthrough
/**
 ****************************************************************************************
 * @brief EACI send PDU
 *
 ****************************************************************************************
 */
void com_pdu_send(uint8_t len, uint8_t *par)
{
    // Allocate one msg for EACI tx
    uint8_t *msg_param = (uint8_t*)ke_msg_alloc(0, 0, 0, len);

    // Save the PDU in the MSG
    memcpy(msg_param, par, len);

    //extract the ke_msg pointer from the param passed and push it in HCI queue
    com_push(ke_param2msg(msg_param));
}
コード例 #3
0
ファイル: app_neb.c プロジェクト: GumpYangchh/wuzhuangbo
void app_neb_msg_tx_insp_thr(struct app_neb_msg_insp_thr* msg)
{
    uint8_t * p_msg = ke_msg_alloc(GTL_NEB_MSG_TX, TASK_GTL, TASK_APP_NEB, NEB_MSG_PAR_LEN_INSP_THR + 1);

    // Pack parameters
    *(p_msg + 0) = NEB_MSG_ID_INSP_THR;
    *(p_msg + 1) = msg->flow_min;
    *(p_msg + 2) = msg->flow_max;
    *(p_msg + 3) = msg->duration_min;
    *(p_msg + 4) = msg->duration_max;

    // Send message
    ke_msg_send(p_msg);
}
コード例 #4
0
ファイル: app_com.c プロジェクト: haby77/fireble_passthrough
void com_event_uart_rx_frame_handler(void)
{
    uart_rx_int_enable(QN_COM_UART, MASK_DISABLE);  //disable uart rx interrupt
    struct app_uart_data_ind *com_data = ke_msg_alloc(APP_COM_UART_RX_DONE_IND,
                                         TASK_APP,
                                         TASK_APP,
                                         com_env.com_rx_len+1);
    com_data->len=com_env.com_rx_len;
    memcpy(com_data->data,com_env.com_rx_buf,com_env.com_rx_len);
    ke_msg_send(com_data);

    ke_timer_clear(APP_COM_RX_TIMEOUT_TIMER, TASK_APP);
    ke_evt_clear(1UL << EVENT_UART_RX_FRAME_ID);
}
コード例 #5
0
ファイル: app_com.c プロジェクト: haby77/fireble_passthrough
int app_com_rx_timeout_handler(ke_msg_id_t const msgid, void const *param,
                               ke_task_id_t const dest_id, ke_task_id_t const src_id)
{
    uart_rx_int_enable(QN_COM_UART, MASK_DISABLE);  //disable uart rx interrupt
    struct app_uart_data_ind *com_data = ke_msg_alloc(APP_COM_UART_RX_DONE_IND,
                                         TASK_APP,
                                         TASK_APP,
                                         com_env.com_rx_len+1);
    com_data->len=com_env.com_rx_len;
    memcpy(com_data->data,com_env.com_rx_buf,com_env.com_rx_len);
    ke_msg_send(com_data);

    return (KE_MSG_CONSUMED);
}
コード例 #6
0
ファイル: app_neb.c プロジェクト: GumpYangchh/wuzhuangbo
void app_neb_msg_tx_confirm_basic(uint8_t id, uint8_t status)
{
    uint8_t * p_msg = ke_msg_alloc(GTL_NEB_MSG_TX, TASK_GTL, TASK_APP_NEB, 4);

    // Pack parameters
    *(p_msg + 0) = NEB_MSG_ID_CONFIRM;
    *(p_msg + 1) = id;
    *(p_msg + 2) = status;

    // Add CRC
    app_neb_msg_tx_insert_CRC(p_msg ,4);

    // Send message
    ke_msg_send(p_msg);
}
コード例 #7
0
ファイル: app_neb.c プロジェクト: GumpYangchh/wuzhuangbo
void app_neb_msg_tx_confirm(struct app_neb_msg_confirm* msg)
{
    uint8_t * p_msg = ke_msg_alloc(GTL_NEB_MSG_TX, TASK_GTL, TASK_APP_NEB, msg->param_length + 4);

    // Pack parameters
    *(p_msg + 0) = NEB_MSG_ID_CONFIRM;
    *(p_msg + 1) = msg->id;
    *(p_msg + 2) = msg->status;

    if(msg->param_length > 0)
    {
        memcpy(p_msg + 3, &msg->ret_params[0], msg->param_length);
    }

    // Add CRC
    app_neb_msg_tx_insert_CRC(p_msg ,msg->param_length + 4);

    // Send message
    ke_msg_send(p_msg);
}
コード例 #8
0
ファイル: customer_prod.c プロジェクト: yangchengxcy/da14580
void app_init(void)
{
    app_disable_sleep();
    
	test_state			= STATE_IDLE;
	test_data_pattern 	= 2;	
	test_freq			= 0;	
	test_data_len		= 37;	
	text_tx_nr_of_packets = 50; 	
	test_tx_packet_nr = 0;	
	test_rx_packet_nr = 0;
	test_rx_packet_nr_syncerr = 0;
	test_rx_packet_nr_crcerr = 0;
	test_rx_irq_cnt = 0;
	rx_test_rssi_1 = 0;
	rx_test_rssi_2 = 0;

	SetBits32(BLE_CNTL2_REG, BLE_RSSI_SEL, 1); //SELECT CURRENT AVERAGE RSSI.    
    
	rf_calibration_request_cbt = 0;
	init_TXEN_RXEN_irqs();    
    
#if 0 //test starts automatically see mail Yannis, George
{
	
	// allocate the complete event message
    struct llm_le_tx_test_cmd *event = ke_msg_alloc(LLM_LE_TEST_TX_CMD, TASK_LLM, TASK_GTL, 3);
    ///TX frequency for Tx test
    event->tx_freq = 0;
    ///TX test data length
    event->test_data_len = 4;
    ///TX test payload type - see enum
    event->pk_payload_type = 0;
    // send the message
    ke_msg_send(event);   
	
}
#endif    
}