예제 #1
0
파일: Data.cs 프로젝트: Egipto87/DOOP.ec
        public Data(EntityId readerId, EntityId writerId, long seqNum, ParameterList inlineQosParams, DataEncapsulation dEnc)
            : base(SubMessageKind.DATA)
        {
            this.readerId = readerId;
            this.writerId = writerId;
            this.writerSN = new SequenceNumber(seqNum);

            if (inlineQosParams != null && inlineQosParams.Count > 0)
            {
                Header.FlagsValue |= 0x2;
                this.inlineQosParams = inlineQosParams;
            }

            if (dEnc.ContainsData())
            {
                Header.FlagsValue |= Flags.DataFlag; // dataFlag
            }
            else
            {
                Header.FlagsValue |= Flags.KeyFlag; // keyFlag
            }



            this.dataEncapsulation = dEnc;
        }
예제 #2
0
        public static void GetParameterList(this IoBuffer buffer, ref ParameterList obj)
        {
            log.Debug("Reading ParameterList from buffer");

            while (true)
            {
                int pos1 = buffer.Position;

                Parameter param = buffer.GetParameter();
                obj.Add(param);
                int length = buffer.Position - pos1;

                log.DebugFormat("Read Parameter {0}, length {1} from position {2}", param, length, pos1);

                if (param.ParameterId == ParameterId.PID_SENTINEL)
                {
                    break;
                }
            }
        }
예제 #3
0
        public static void PutParameterList(this IoBuffer buffer, ParameterList obj)
        {
            buffer.Align(4); // @see 9.4.2.11

            obj.Add(new Sentinel()); // Sentinel must be the last Parameter
            foreach (Parameter param in obj)
            {
                buffer.PutInt16((short)param.ParameterId);
                buffer.PutInt16(0); // length will be calculated

                int pos = buffer.Position;
                buffer.PutParameter(param);

                buffer.Align(4); // Make sure length is multiple of 4 & align for
                // next param

                int paramLength = buffer.Position - pos;
                buffer.PutInt16(pos - 2, (short)paramLength);
            }

            // TODO: last Parameter must be PID_SENTINEL
        }
예제 #4
0
 public static ParameterList GetParameterList(this IoBuffer buffer)
 {
     ParameterList obj = new ParameterList();
     buffer.GetParameterList(ref obj);
     return obj;
 }