int AnalogVideoSensorConfiguration::ReadMessageBody(const Packet& packet) 
{
    UInt startPos = packet.GetReadPos();
    packet.Read(mSensorId);
    packet.Read(mAnalogFormat);
    return packet.GetReadPos() - startPos;
}
示例#2
0
int DigitalVideoSensor::ReadMessageBody(const Packet& packet) 
{
    UInt startPos = packet.GetReadPos();
    packet.Read(mSensorId);
    packet.Read(mStreamState);
    return packet.GetReadPos() - startPos;
}
int ReportVisualSensorCapabilities::ReadMessageBody(const Packet& packet)
{
    UInt startPos = packet.GetReadPos();
    UShort count = 0;
    packet.Read(count);
    for(int i = 0; i < (int)count; i++)
    {
        VisualSensorCapabilities vsc = VisualSensorCapabilities();
        vsc.ReadMessageBody(packet);
        mSensorList.push_back(vsc);
    }
    return packet.GetReadPos() - startPos;
}
int ReportAnalogVideoSensorCapabilities::ReadMessageBody(const Packet& packet)
{
    UInt startPos = packet.GetReadPos();
    UShort count = 0;
    packet.Read(count);
    for(int i = 0; i < (int)count; i++)
    {
        AnalogVideoSensorCapabilities avsc = AnalogVideoSensorCapabilities();
        avsc.ReadMessageBody(packet);
        mSensorList.push_back(avsc);
    }
    return packet.GetReadPos() - startPos;
}
int StillImageSensorCapabilities::ReadMessageBody(const Packet& packet) 
{
    UInt startPos = packet.GetReadPos();
    packet.Read(mPresenceVector);
    packet.Read(mSensorId);
    if((mPresenceVector & StillImageSensorCapabilities::PresenceVector::SupportedFrameSizes) > 0)
    {
        packet.Read(mSupportedFrameSizes);
    }
    if((mPresenceVector & StillImageSensorCapabilities::PresenceVector::SupportedImageFormats) > 0)
    {
        packet.Read(mSupportedImageFormats);
    }
    return packet.GetReadPos() - startPos;
}
int SetVisualSensorConfigurations::ReadMessageBody(const Packet& packet)
{
    UInt startPos = packet.GetReadPos();
    Byte requestId = 0;
    UShort count = 0;
    packet.Read(requestId);
    packet.Read(count);
    for(int i = 0; i < (int)count; i++)
    {
        VisualSensorConfiguration vsc = VisualSensorConfiguration();
        vsc.ReadMessageBody(packet);
        mSensorList.push_back(vsc);
    }
    return packet.GetReadPos() - startPos;
}
int QueryRangeSensorCapabilities::ReadMessageBody(const Packet& packet)
{
    UInt startPos = packet.GetReadPos();
    UShort count = 0;
    packet.Read(count);
    for(int i = 0; i < (int)count; i++)
    {   
        UShort sensorID = 0;
        UShort presenceVector = 0;
        packet.Read(sensorID);
        packet.Read(presenceVector);
        RangeSensorCapabilities rsc = RangeSensorCapabilities(presenceVector, sensorID);
        mSensorList.push_back(rsc);
    }
    return packet.GetReadPos() - startPos;
}
int QueryStillImageSensorConfigurations::ReadMessageBody(const Packet& packet)
{
    UInt startPos = packet.GetReadPos();
    UShort count = 0;
    packet.Read(count);
    for(int i = 0; i < (int)count; i++)
    {   
        UShort sensorID = 0;
        Byte presenceVector = 0;
        packet.Read(sensorID);
        packet.Read(presenceVector);
        StillImageSensorConfiguration sisc = StillImageSensorConfiguration(presenceVector,sensorID);
        mSensorList.push_back(sisc);
    }
    return packet.GetReadPos() - startPos;
}
示例#9
0
int GeometricProperties::ReadMessageBody(const Packet& packet) 
{
    UInt startPos = packet.GetReadPos();
    packet.Read(mSensorId);
    packet.Read(mGeometricVariant);
    if(mGeometricVariant == 0)
    {
        //Do nothing because the sensor doesn't know anything abou it's geometric properties
    }
    if(mGeometricVariant == 1) //Set the static property
    {
        mStaticGeometric.ReadMessageBody(packet);
    }
    if(mGeometricVariant == 2) //Set the Manipulatible property
    {
        mManipulatorGeometric.ReadMessageBody(packet);
    }
    return packet.GetReadPos() - startPos;
}
int SetAnalogVideoSensorConfigurations::ReadMessageBody(const Packet& packet)
{
    UInt startPos = packet.GetReadPos();
    Byte requestId = 0;
    UShort count = 0;
    packet.Read(requestId);
    packet.Read(count);
    mRequestId = requestId;
    for(int i = 0; i < (int)count; i++)
    {
        UShort sensorID = 0;
        Byte analogFormat = 0;
        packet.Read(sensorID);
        packet.Read(analogFormat);
        AnalogVideoSensorConfiguration avsc = AnalogVideoSensorConfiguration(sensorID, analogFormat);
        mSensorList.push_back(avsc);
    }
    return packet.GetReadPos() - startPos;
}
示例#11
0
////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Reads transport header and payload data from packet, saving to
///          data members of class.
///
///   \param[in] packet Serialized JAUS packet data to read.
///   \param[in] transportHeader Transport header data in front of general
///                              transport header.
///
///   \return Number of bytes read on success, FAILURE on error.
///
////////////////////////////////////////////////////////////////////////////////////
int Message::Read(const Packet& packet,
                  const Packet* transportHeader)
{
    unsigned int readPos = packet.GetReadPos();
    
    Header header;
    int total = 0;
    
    if(transportHeader && transportHeader->Length() > 0)
    {
        packet.SetReadPos(readPos + transportHeader->Length());
        total = transportHeader->Length();
    }
    
    // Try read message transport header data
    if(header.Read(packet) > 0)
    {
        UShort messageCode;
        total += Header::MinSize;
        total += packet.Read(messageCode);
        // Verify this is a message we can actually read.
        if(messageCode == mMessageCode)
        {
            int payloadSize = 0;
            if( (payloadSize = ReadMessageBody(packet)) >= 0)
            {
                total += payloadSize;
                mSourceID = header.mSourceID;
                mDestinationID = header.mDestinationID;
                mPriority = header.mPriorityFlag;
                return total;
            }
        }
    }
    
    // Reset read position on failure.
    packet.SetReadPos(readPos);
    
    return FAILURE;
}
int VisualSensorConfiguration::ReadMessageBody(const Packet& packet) 
{
    UInt startPos = packet.GetReadPos();
    packet.Read(mPresenceVector);
    packet.Read(mSensorId);
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::SensorState) > 0)
    {
        packet.Read(mSensorState);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::ZoomMode) > 0)
    {
        packet.Read(mZoomMode);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::ZoomLevel) > 0)
    {
        packet.Read(mZoomLevel);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::FocalLength) > 0)
    {
        packet.Read(mFocalLength);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::HorizontalFieldOfView) > 0)
    {
        packet.Read(mHorizontalFieldOfView);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::VerticalFieldOfView) > 0)
    {
        packet.Read(mVerticalFieldOfView);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::FocusMode) > 0)
    {
        packet.Read(mFocusMode);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::FocusValue) > 0)
    {
        packet.Read(mFocusValue);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::WhiteBalance) > 0)
    {
        packet.Read(mWhiteBalance);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::ImagingMode) > 0)
    {
        packet.Read(mImagingMode);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::ExposureMode) > 0)
    {
        packet.Read(mExposureMode);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::MeteringMode) > 0)
    {
        packet.Read(mMeteringMode);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::ShutterSpeed) > 0)
    {
        packet.Read(mShutterSpeed);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::Aperture) > 0)
    {
        packet.Read(mAperture);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::LightSensitivity) > 0)
    {
        packet.Read(mLightSensitivity);
    }
    if((mPresenceVector & VisualSensorConfiguration::PresenceVector::ImageStabilization) > 0)
    {
        packet.Read(mImageStabilization);
    }
    return packet.GetReadPos() - startPos;
}