コード例 #1
0
DataBus::Packet DataBus::PacketParser::takePacket()
{
    // Check if packet is available
    if (isPacketAvailable() == false)
    {
        // Error, packet is not available
        return Packet();
    }

    // Start reading next packet
    m_state = State_WaitForStartOfFrame;

    // Return packet
    return m_packetList.takeFirst();
}
コード例 #2
0
ファイル: ca2.c プロジェクト: srikraj8341/srikanthrepo
/*
 * First thread "pck_collec"  implementation for Packet collection
 */
void *pck_collec(void *tr){
    while(endOfPackets()==0){
       		if(isPacketAvailable()){
       			pthread_mutex_lock( &mutexip );
       			packets[pck_counter] = getPacket();
       			pck_counter++;
       			recv_pck++;
       			pthread_mutex_unlock( &mutexip );
       		}
       		pthread_mutex_lock( &mutexip );
       		if(pck_counter>=max_pck)
       			pck_counter=0;
       		pthread_mutex_unlock( &mutexip );
    }
     pthread_exit(NULL);
}