Beispiel #1
0
void CActiveReader::RunL ()
	{
	if (iStatus != KErrNone)
		iConsole->Printf(_L("Error %d\r\n"),iStatus.Int());
	else
		{
		if(!CompareBuffers(ReadBuf.Length()))
			iConsole->Printf(_L("Buffers dont compare!\r\n"));
		iConsole->Printf(_L("R:%d\r\n"),ReadBuf.Length());
/*		TInt len=ReadBuf.Length();
		for(TInt i=0;i<10;i++)
			{
			for (TInt j=0;j<16;j++)//print 16 bytes
				{
				if ((i*16)+j<len)
					{
					TInt v=ReadBuf[(i*16)+j];
					iConsole->Printf(_L("%02x "),v);
					}
				else
					iConsole->Printf(_L("   "));
				}
			iConsole->Printf(_L("\r\n"));
			}*/
		}

	ResetReadBuffer();
	if(iTimeDelay)
		User::After(iTimeDelay);
	iPort->Read(iStatus, ReadBuf, ReadBuf.Length());
	SetActive();
	}
Beispiel #2
0
XnStatus XnDataPacker::ReadCustomData(XnUInt32 nObjectType, void* pData, XnUInt32* pnDataSize)
{
    XnStatus nRetVal = XN_STATUS_OK;

    XN_VALIDATE_OBJECT_TYPE(nObjectType);

    // read buffer size
    XnUInt32 nSize = 0;
    nRetVal = ReadInternalBuffer((XnUChar*)&nSize, sizeof(XnUInt32));
    XN_IS_STATUS_OK(nRetVal);

    if (nSize > *pnDataSize)
    {
        return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
    }

    nRetVal = ReadInternalBuffer((XnUChar*)pData, nSize);
    XN_IS_STATUS_OK(nRetVal);

    *pnDataSize = nSize;

    ResetReadBuffer();

    return (XN_STATUS_OK);
}
Beispiel #3
0
//---------------------------------------------------------------------------
// Code
//---------------------------------------------------------------------------
XnDataPacker::XnDataPacker(XnIOStream* pStream, XnUInt32 nInternalBufferSize) :
    m_pStream(pStream),
    m_nBufferSize(nInternalBufferSize),
    m_nInternalBufferReadIndex(0),
    m_pCurrentHeader(NULL)
{
    ResetReadBuffer();
}
Beispiel #4
0
XnStatus XnDataPacker::ReadProperty(XnChar* pcsModule, XnChar* pcsProp, XnGeneralBuffer* pgbValue)
{
    XnStatus nRetVal = XN_STATUS_OK;

    nRetVal = ReadPropertyImpl(pcsModule, pcsProp, pgbValue);
    XN_IS_STATUS_OK(nRetVal);

    ResetReadBuffer();

    return (XN_STATUS_OK);
}
Beispiel #5
0
XnStatus XnDataPacker::ReadPropertySet(XnPropertySet* pPropertySet)
{
    XnStatus nRetVal = XN_STATUS_OK;

    nRetVal = ReadPropertySetImpl(pPropertySet);
    XN_IS_STATUS_OK(nRetVal);

    ResetReadBuffer();

    return (XN_STATUS_OK);
}
Beispiel #6
0
XnStatus XnDataPacker::ReadStreamData(XnStreamData* pStreamOutput, XnCodec* pCodec)
{
    XnStatus nRetVal = XN_STATUS_OK;

    XN_VALIDATE_OBJECT_TYPE(XN_PACKED_STREAM_DATA);

    // read stream name
    nRetVal = ReadStringFromBuffer(pStreamOutput->StreamName);
    XN_IS_STATUS_OK(nRetVal);

    // read timestamp
    nRetVal = ReadInternalBuffer((XnUChar*)&pStreamOutput->nTimestamp, sizeof(XnUInt64));
    XN_IS_STATUS_OK(nRetVal);

    // read frame-id
    nRetVal = ReadInternalBuffer((XnUChar*)&pStreamOutput->nFrameID, sizeof(XnUInt32));
    XN_IS_STATUS_OK(nRetVal);

    // read compression format
    XnCompressionFormats nFormat;
    nRetVal = ReadInternalBuffer((XnUChar*)&nFormat, sizeof(XnCompressionFormats));
    XN_IS_STATUS_OK(nRetVal);

    if (nFormat != pCodec->GetCompressionFormat())
    {
        XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Data in stream is packed with another codec than the one provided!");
    }

    // read original data size
    XnUInt32 nDataSize;
    nRetVal = ReadInternalBuffer((XnUChar*)&nDataSize, sizeof(XnUInt32));
    XN_IS_STATUS_OK(nRetVal);

    if (pStreamOutput->pInternal->bAllocated && pStreamOutput->pInternal->nAllocSize < nDataSize)
    {
        return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
    }

    pStreamOutput->nDataSize = nDataSize;

    // read compressed data size
    XnUInt32 nCompressedDataSize;
    nRetVal = ReadInternalBuffer((XnUChar*)&nCompressedDataSize, sizeof(XnUInt32));
    XN_IS_STATUS_OK(nRetVal);

    // decompress
    nRetVal = pCodec->Decompress(m_InternalBuffer.GetData() + m_nInternalBufferReadIndex, nCompressedDataSize, (XnUChar*)pStreamOutput->pData, &pStreamOutput->nDataSize);
    XN_IS_STATUS_OK(nRetVal);

    ResetReadBuffer();

    return (XN_STATUS_OK);
}
Beispiel #7
0
XnStatus XnDataPacker::ReadNextObject(XnPackedDataType* pType)
{
    XnStatus nRetVal = XN_STATUS_OK;

    ResetReadBuffer();

    nRetVal = ReadNextObjectImpl();
    XN_IS_STATUS_OK(nRetVal);

    *pType = m_pCurrentHeader->nType;

    return (XN_STATUS_OK);
}
Beispiel #8
0
XnStatus XnDataPacker::ReadStreamRemoved(XnChar* csStreamName)
{
    XnStatus nRetVal = XN_STATUS_OK;

    XN_VALIDATE_OBJECT_TYPE(XN_PACKED_STREAM_REMOVED);

    nRetVal = ReadStringFromBuffer(csStreamName);
    XN_IS_STATUS_OK(nRetVal);

    ResetReadBuffer();

    return (XN_STATUS_OK);
}