Esempio n. 1
0
        public void MergeFrom(Sensor other)
        {
            if (other == null)
            {
                return;
            }
            if (other.Pin != 0)
            {
                Pin = other.Pin;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Digital:
                if (Digital == null)
                {
                    Digital = new global::SensorsAndEngines.ProtobufModels.DigitalSensor();
                }
                Digital.MergeFrom(other.Digital);
                break;

            case TypeOneofCase.Analog:
                if (Analog == null)
                {
                    Analog = new global::SensorsAndEngines.ProtobufModels.AnalogSensor();
                }
                Analog.MergeFrom(other.Analog);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Esempio n. 2
0
        public void MergeFrom(pb::CodedInputStream input)
        {
            uint tag;

            while ((tag = input.ReadTag()) != 0)
            {
                switch (tag)
                {
                default:
                    _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
                    break;

                case 10: {
                    global::SensorsAndEngines.ProtobufModels.DigitalSensor subBuilder = new global::SensorsAndEngines.ProtobufModels.DigitalSensor();
                    if (typeCase_ == TypeOneofCase.Digital)
                    {
                        subBuilder.MergeFrom(Digital);
                    }
                    input.ReadMessage(subBuilder);
                    Digital = subBuilder;
                    break;
                }

                case 18: {
                    global::SensorsAndEngines.ProtobufModels.AnalogSensor subBuilder = new global::SensorsAndEngines.ProtobufModels.AnalogSensor();
                    if (typeCase_ == TypeOneofCase.Analog)
                    {
                        subBuilder.MergeFrom(Analog);
                    }
                    input.ReadMessage(subBuilder);
                    Analog = subBuilder;
                    break;
                }

                case 24: {
                    Pin = input.ReadUInt32();
                    break;
                }
                }
            }
        }