void AsemanLinuxNativeNotification::notificationClosed(const QDBusMessage &dmsg)
{
    if( dmsg.type() != QDBusMessage::SignalMessage )
        return ;

    const QVariantList & args = dmsg.arguments();
    if( args.isEmpty() )
        return ;

    uint id = args.at(0).toUInt();
    if( !p->notifies.contains(id) )
        return;

    if( args.count() == 1 )
    {
        Q_EMIT notifyClosed(id);
        p->notifies.remove(id);
        return;
    }

    int type = args.at(1).toInt();
    switch (type) {
    case 1:
        Q_EMIT notifyTimedOut( id );
        break;

    case 2:
    default:
        Q_EMIT notifyClosed( id );
        p->notifies.remove(id);
        break;
    }
}
Example #2
0
void QAmqpChannelPrivate::close(const QAmqpMethodFrame &frame)
{
    Q_Q(QAmqpChannel);
    qAmqpDebug(">> CLOSE");
    QByteArray data = frame.arguments();
    QDataStream stream(&data, QIODevice::ReadOnly);
    qint16 code = 0, classId, methodId;
    stream >> code;
    QString text =
        QAmqpFrame::readAmqpField(stream, QAmqpMetaType::ShortString).toString();

    stream >> classId;
    stream >> methodId;

    QAMQP::Error checkError = static_cast<QAMQP::Error>(code);
    if (checkError != QAMQP::NoError) {
        error = checkError;
        errorString = qPrintable(text);
        Q_EMIT q->error(error);
    }

    qAmqpDebug(">> code: %d", code);
    qAmqpDebug(">> text: %s", qPrintable(text));
    qAmqpDebug(">> class-id: %d", classId);
    qAmqpDebug(">> method-id: %d", methodId);
    Q_EMIT q->closed();

    // complete handshake
    QAmqpMethodFrame closeOkFrame(QAmqpFrame::Channel, miCloseOk);
    closeOkFrame.setChannel(channelNumber);
    sendFrame(closeOkFrame);

    // notify everyone that the channel was closed on us.
    notifyClosed();
}
Example #3
0
void EMUUSBInputStream::readCompleted ( void * frameListNrPtr,
                                       IOReturn result, IOUSBLowLatencyIsocFrame * pFrames) {
    
    // HACK we have numUSBFramesPerList frames, which one to check?? Print frame 0 info.
    debugIOLogR("+ readCompleted framelist %d  result %x ", currentFrameList, result);
    
    
    startingEngine = FALSE; // HACK this is old code...
    
    /*An "underrun error" occurs when the UART transmitter has completed sending a character and the transmit buffer is empty. In asynchronous modes this is treated as an indication that no data remains to be transmitted, rather than an error, since additional stop bits can be appended. This error indication is commonly found in USARTs, since an underrun is more serious in synchronous systems.
     */
    
	if (kIOReturnAborted != result) {
        GatherInputSamples(); // also check if there is more in the buffer. 
	}
	
    // Data collection from the USB read is complete.
    // Now start the read on the next block.
	if (!shouldStop) {
        
		// (orig doc) keep incrementing until limit of numUSBFrameLists - 1 is reached.
        // also, we can wonder if we want to do it this way. Why not just check what comes in instead
        nextCompleteFrameList =(nextCompleteFrameList + 1) % RECORD_NUM_USB_FRAME_LISTS;
        
        // now we have already numUSBFrameListsToQueue-1 other framelist queues running.
        // We set our current list to the next one that is not yet running
        // CHECK can we just use ALL framelists instead of queueing only part of them?
        
        UInt32 frameListToRead = nextCompleteFrameList - 1 + numUSBFrameListsToQueue;
        frameListToRead -= numUSBFrameLists * (frameListToRead >= numUSBFrameLists);// crop the number of framesToRead
        // seems something equal to frameListToRead = (frameListnr + usbstream->numUSBFrameListsToQueue) % usbstream->numUSBFrameLists;
        readFrameList(frameListToRead); // restart reading (but for different framelist).
        
	} else  {
		debugIOLogR("++EMUUSBAudioEngine::readCompleted() - stopped: %d", shouldStop);
		shouldStop++;
	}
    
    if (shouldStop > RECORD_NUM_USB_FRAME_LISTS) {
        debugIOLogC("EMUUSBInputStream::readCompleted all input streams stopped");
        started = false;
        notifyClosed();
    }

// HACK attempt to read feedback from device.
//    if (counter++==100) {
//
//        CheckForAssociatedEndpoint( interfaceNumber, alternateSettingID);
//    }
    
	debugIOLogR("- readCompleted currentFrameList=%d",currentFrameList);
	return;
}
void AsemanNativeNotification::itemClosed()
{
    AsemanNativeNotificationItem *item = static_cast<AsemanNativeNotificationItem*>(sender());
    if(!item)
        return;

    uint id = p->items.key(item);
    if(!id)
        return;

    p->items.remove(id);
    emit notifyClosed(id);
}
Example #5
0
void QAmqpChannelPrivate::closeOk(const QAmqpMethodFrame &)
{
    notifyClosed();
}