예제 #1
0
void RemoteSignals::transmitSignalAsync(const QByteArray &msgData)
{
    QByteArray sizeData(4,0);
    qToLittleEndian<int>(msgData.size(), (uchar*)sizeData.data());
    QMutexLocker lock(&mMutex);
	if(!mWriteDevice)
		throw std::runtime_error("Could not send signal: no worte device was specified!");
    mWriteDevice->write(sizeData);
    mWriteDevice->write(msgData);
}
예제 #2
0
//******************************************************************************
void *Strand::data( void *componentData,
                    void *propertyData,
                    size_t numItems,
                    size_t itemWidth,
                    size_t numBytes,
                    ReaderPhase rp )
{
    if ( rp == READER_REF )
    {
        if ( (( int )propertyData) == POINTS_POSITION_P )
        {
            if ( itemWidth != 3 ||
                 ( numItems * 3 * sizeof( float ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "points.position" );
            }
            
            return positionsRefData( numItems * 3 );
        }
        else if ( (( int )propertyData) == STRAND_WIDTH_P )
        {
            if ( itemWidth != 1 ||
                 ( numItems * 1 * sizeof( float ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "strand.width" );
            }
            return constantWidthData();
        }
        else if ( (( int )propertyData) == STRAND_TYPE_P )
        {
            if ( itemWidth != 1 ||
                 ( numItems * 1 * sizeof( int ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "strand.type" );
            }
            
            return typeData();
        }
        else if ( (( int )propertyData) == ELEMENTS_SIZE_P )
        {
            if ( itemWidth != 1 ||
                 ( numItems * 1 * sizeof( int ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "elements.size" );
            }
            
            return sizeData( numItems * 1 );
        }
        else if ( (( int )propertyData) == ELEMENTS_WIDTH_P )
        {
            if ( itemWidth != 2 ||
                 ( numItems * 2 * sizeof( float ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "elements.width" );
            }
            return widthData( numItems * 2 );
        }
    }
    else if ( rp == READER_OPEN )
    {
        if ( (( int )propertyData) == POINTS_POSITION_P )
        {
            if ( itemWidth != 3 ||
                 ( numItems * 3 * sizeof( float ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "points.position" );
            }

            return positionsOpenData( numItems * 3 );
        }
    }
    else if ( rp == READER_CLOSE )
    {
        if ( (( int )propertyData) == POINTS_POSITION_P )
        {
            if ( itemWidth != 3 ||
                 ( numItems * 3 * sizeof( float ) ) != numBytes )
            {
                WEIRD_SIZE( m_name, "points.position" );
            }
            
            return positionsCloseData( numItems * 3 );
        }
    }

    // Superclass
    return Object::data( componentData, propertyData,
                         numItems, itemWidth, numBytes, rp );
}