/*
 ****************************************************************************************
 * @brief Receives ble message from UART iface.
 *
 * @return void.
 ****************************************************************************************
*/
void BleReceiveMsg(void)
{
	unsigned char *msg;
	if(SPIRxQueue.First != NULL)
	{
		struct QueueElement *q = DeQueue(&SPIRxQueue); 
		msg = (unsigned char *) q->Data;
 		HandleBleMsg((ble_msg*)msg);
		free(msg);
	}
	
} 
/*
 ****************************************************************************************
 * @brief Receives ble message from UART iface.
 *
 * @return void.
 ****************************************************************************************
*/
void BleReceiveMsg(void)
{
    ble_msg *msg;
    WaitForSingleObject(UARTRxQueueSem, INFINITE);
    if(UARTRxQueue.First != NULL)
    {
        msg = (ble_msg*) DeQueue(&UARTRxQueue); 
        HandleBleMsg(msg);
        free(msg);
    }
    
    ReleaseMutex(UARTRxQueueSem);
}