// ---------------------------------------------------------------------------- // This method is private and is called from the runReceiver again and again! void xpcc::tipc::Receiver::update() { xpcc::tipc::Header tipcHeader; uint32_t tipcPortId; // Set the mutex guard for the receiver socket MutexGuard receiverSocketGuard( this->receiverSocketLock_ ); // Get the TIPC header (typeId and instanceRange) - call by reference while( this->tipcReceiverSocket_.receiveHeader( tipcPortId, tipcHeader ) ) { // ignore messages, that are send by the port, that shoud be ignored if (tipcPortId != this->ignoreTipcPortId_) { XPCC_LOG_DEBUG << XPCC_FILE_INFO << "Header available." << xpcc::flush; // Try to allocate memory for the packet Payload payload ( tipcHeader.size ); // Get the payload by passing a void pointer by reference and the length // of the payload to be read from the socket. this->tipcReceiverSocket_.receivePayload( payload.getPointer(), tipcHeader.size); // Set the mutex guard for the packetQueue MutexGuard packetQueueGuard( this->packetQueueLock_); // add the packet to the queue this->packetQueue_.push( payload ); } // Clean the TIPC socket! ( That means removing the current data from the queue) this->tipcReceiverSocket_.popPayload(); } }
// ---------------------------------------------------------------------------- void xpcc::tipc::Receiver::addReceiverId(uint8_t id) { // Set the mutex guard for the receiver socket MutexGuard receiverSocketGuard(this->receiverSocketLock_); // TODO: Logging on which packet one is registered.. // Ranges dürfen sich nicht überschneiden. Eine Range gilt fürs gesamte TIPC, // daher ist es nicht möglich in die InstanceId auch die Komponenten ID // mit einzubeziehen this->tipcReceiverSocket_.registerOnPacket( REQUEST_OFFSET + id + TYPE_ID_OFFSET, 0x00, 0x00); }