コード例 #1
0
        void CheckDetectorChanges(Detection detection)
        {
            if (Tags[detection.TagId].Detector != null)
            {
                if (detection.HostName != Tags[detection.TagId].Detector.HostName)
                {
                    Tags[detection.TagId].Detector.DetachTag(Tags[detection.TagId]);
                    TagLeave(Tags[detection.TagId].Detector, new TagEventArgs(Tags[detection.TagId]));

                    Detectors[detection.HostName].AttachTag(Tags[detection.TagId]);
                    Tags[detection.TagId].Detector = Detectors[detection.HostName];
                    TagEnter(Detectors[detection.HostName], new TagEventArgs(Tags[detection.TagId]));
                }
            }
            else
            {
                if (!CheckIfTagExists(detection))
                {
                    return;
                }

                Detectors[detection.HostName].AttachTag(Tags[detection.TagId]);
                Tags[detection.TagId].Detector = Detectors[detection.HostName];
                TagEnter(Detectors[detection.HostName], new TagEventArgs(Tags[detection.TagId]));
            }
        }
コード例 #2
0
 void CheckBatteryData(Detection detection)
 {
     if (Tags[detection.TagId].BatteryStatus != detection.BatteryStatus)
     {
         Tags[detection.TagId].BatteryStatus = detection.BatteryStatus;
         TagBatteryDataReceived(Tags[detection.TagId], new TagEventArgs(Tags[detection.TagId]));
     }
 }
コード例 #3
0
 void CheckTagMove(Detection detection)
 {
     if (Tags[detection.TagId].MovingStatus != detection.MovingStatus)
     {
         Tags[detection.TagId].MovingStatus = detection.MovingStatus;
         TagMoved(Detectors[detection.HostName], new TagEventArgs(Tags[detection.TagId]));
     }
 }
コード例 #4
0
 private bool CheckIfTagExists(Detection detection)
 {
     if (!Detectors.ContainsKey(detection.HostName))
     {
         Tag removedTag;
         var removed = Tags.TryRemove(detection.TagId, out removedTag);
         //TODO: Shouldn't a TagRemoved event be fired here?
         return(false);
     }
     return(Tags.ContainsKey(detection.TagId));
 }
コード例 #5
0
        void CheckTagButtonData(Detection detection)
        {
            if (Tags[detection.TagId].ButtonA != detection.ButtonAState ||
                Tags[detection.TagId].ButtonB != detection.ButtonBState ||
                Tags[detection.TagId].ButtonC != detection.ButtonCState ||
                Tags[detection.TagId].ButtonD != detection.ButtonDState)
            {
                Tags[detection.TagId].ButtonA = detection.ButtonAState;
                Tags[detection.TagId].ButtonB = detection.ButtonBState;
                Tags[detection.TagId].ButtonC = detection.ButtonCState;
                Tags[detection.TagId].ButtonD = detection.ButtonDState;

                TagButtonDataReceived(Tags[detection.TagId], new TagEventArgs(Tags[detection.TagId]));
            }
        }
コード例 #6
0
 private bool CheckIfTagExists(Detection detection)
 {
     if (!Detectors.ContainsKey(detection.HostName))
     {
         Tag removedTag;
         var removed = Tags.TryRemove(detection.TagId, out removedTag);
         //TODO: Shouldn't a TagRemoved event be fired here?
         return false;
     }
     return Tags.ContainsKey(detection.TagId);
 }
コード例 #7
0
        void CheckDetectorChanges(Detection detection)
        {
            if (Tags[detection.TagId].Detector != null)
            {
                if (detection.HostName != Tags[detection.TagId].Detector.HostName)
                {
                    Tags[detection.TagId].Detector.DetachTag(Tags[detection.TagId]);
                    TagLeave(Tags[detection.TagId].Detector, new TagEventArgs(Tags[detection.TagId]));

                    Detectors[detection.HostName].AttachTag(Tags[detection.TagId]);
                    Tags[detection.TagId].Detector = Detectors[detection.HostName];
                    TagEnter(Detectors[detection.HostName], new TagEventArgs(Tags[detection.TagId]));
                }
            }
            else
            {
                if (!CheckIfTagExists(detection))
                    return;

                Detectors[detection.HostName].AttachTag(Tags[detection.TagId]);
                Tags[detection.TagId].Detector = Detectors[detection.HostName];
                TagEnter(Detectors[detection.HostName], new TagEventArgs(Tags[detection.TagId]));
            }
        }
コード例 #8
0
 void CheckBatteryData(Detection detection)
 {
     if (Tags[detection.TagId].BatteryStatus != detection.BatteryStatus)
     {
         Tags[detection.TagId].BatteryStatus = detection.BatteryStatus;
         TagBatteryDataReceived(Tags[detection.TagId], new TagEventArgs(Tags[detection.TagId]));
     }
 }
コード例 #9
0
        void CheckTagButtonData(Detection detection)
        {
            if (Tags[detection.TagId].ButtonA != detection.ButtonAState ||
                 Tags[detection.TagId].ButtonB != detection.ButtonBState ||
                 Tags[detection.TagId].ButtonC != detection.ButtonCState ||
                 Tags[detection.TagId].ButtonD != detection.ButtonDState)
            {
                Tags[detection.TagId].ButtonA = detection.ButtonAState;
                Tags[detection.TagId].ButtonB = detection.ButtonBState;
                Tags[detection.TagId].ButtonC = detection.ButtonCState;
                Tags[detection.TagId].ButtonD = detection.ButtonDState;

                TagButtonDataReceived(Tags[detection.TagId], new TagEventArgs(Tags[detection.TagId]));
            }
        }
コード例 #10
0
 void CheckTagMove(Detection detection)
 {
     if (Tags[detection.TagId].MovingStatus != detection.MovingStatus)
     {
         Tags[detection.TagId].MovingStatus = detection.MovingStatus;
         TagMoved(Detectors[detection.HostName], new TagEventArgs(Tags[detection.TagId]));
     }
 }