示例#1
0
        private void ParseAxaBeaconData(BluetoothLEAdvertisementReceivedEventArgs btAdv)
        {
            BeaconFrameBase beaconFrame = null;

            if (btAdv.Advertisement.DataSections.Any(_ => _.DataType == 9))
            {
                var data = btAdv.Advertisement.DataSections.First(_ => _.DataType == 9).Data.ToArray();

                beaconFrame = new AxaCompleteNameFrame(data);
            }
            else if (btAdv.Advertisement.DataSections.Any(_ => _.DataType == 22))
            {
                var data = btAdv.Advertisement.DataSections.First(_ => _.DataType == 22).Data.ToArray();

                beaconFrame = new AxaBatTempHumFrame(data);
            }

            if (beaconFrame != null)
            {
                var existingFrame = BeaconFrames.FirstOrDefault(_ => _.GetType() == beaconFrame.GetType());

                if (existingFrame != null)
                {
                    existingFrame.Update(beaconFrame);
                }
                else
                {
                    BeaconFrames.Add(beaconFrame);
                }
            }
        }
示例#2
0
 /// <summary>
 /// Update the information stored in this frame with the information from the other frame.
 /// Useful for example when binding the UI to beacon information, as this will emit
 /// property changed notifications whenever a value changes - which would not be possible if
 /// you would overwrite the whole frame.
 /// </summary>
 /// <param name="otherFrame">Frame to use as source for updating the information in this beacon
 /// frame.</param>
 public override void Update(BeaconFrameBase otherFrame)
 {
     base.Update(otherFrame);
     ParsePayload();
 }
 public virtual void Update(BeaconFrameBase otherFrame)
 {
     Payload = otherFrame.Payload;
 }
 protected BeaconFrameBase(BeaconFrameBase other)
 {
     Payload = other.Payload;
 }
 public override void Update(BeaconFrameBase otherFrame)
 {
     base.Update(otherFrame);
     ParsePayload();
 }
 public virtual void Update(BeaconFrameBase otherFrame)
 {
     Payload = otherFrame.Payload;
 }
 protected BeaconFrameBase(BeaconFrameBase other)
 {
     Payload = other.Payload;
 }