Ejemplo n.º 1
0
/** RFCOMM layer callback event for when a packet is received on an open RFCOMM channel.
 *
 *  \param[in] ACLChannel  RFCOMM ACL channel that the data was directed to
 *  \param[in] DataLen     Length of the received data, in bytes
 *  \param[in] Data        Pointer to a buffer where the received data is stored
 */
void RFCOMM_DataReceived(RFCOMM_Channel_t* const ACLChannel, uint16_t DataLen, const uint8_t* Data)
{
    /* Write the received bytes to the serial port */
    for (uint8_t i = 0; i < DataLen; i++)
        putchar(Data[i]);

    /* Echo the data back to the sending device */
    RFCOMM_SendData(DataLen, Data, SerialChannel_RFCOMM, SerialChannel_ACL);
}
void rfcomm_send_data(void)
{
	char    LineBuffer[200];
	static uint16_t cnt=0;
	uint8_t LineLength = 10;
	if (RFCOMM_SensorStream && (RFCOMM_SensorStream->DataLink.RemoteSignals & RFCOMM_SIGNAL_RTR)){
		RFCOMM_SendData(RFCOMM_SensorStream, LineLength, LineBuffer);
		cnt++;
		if(cnt>=1000){
			cnt = 0;
			sendFlag = 0;
		}
	}
}