示例#1
0
        private void NotifyPassing(MDP_NOTIFY_TYPE type, List <Passing> passings, EventData sender)
        {
            if (type == MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT)
            {
                transponderResendDataReceived = true;
            }
            else if (type != MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT)
            {
                return;
            }

            try
            {
                var sent     = client.Device.GetUTCTimeAsDateTime();
                var received = DateTime.UtcNow;

                foreach (var passing in passings)
                {
                    var filteredEvent = filter.FilterTransponderPassing(passing.ID, passing.LoopID, passing.TransponderID, passing.GetStrength(), passing.UTCTimeAsDateTime, sent,
                                                                        received, passing.IsResend() && !passing.IsDecoderResend());
                    if (filteredEvent != null)
                    {
                        ProcessEvent(filteredEvent);
                    }
                }
            }
            catch (Exception e)
            {
                //events.OnError(e);
                Disconnect();
            }
        }
示例#2
0
        private void NotifyAuxEvent(MDP_NOTIFY_TYPE type, List <AuxEvent> auxEvents, EventData sender)
        {
            if (type == MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT)
            {
                auxiliaryResendDataReceived = true;
            }
            else if (type != MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT)
            {
                return;
            }

            try
            {
                var sent     = client.Device.GetUTCTimeAsDateTime();
                var received = DateTime.UtcNow;

                foreach (var auxEvent in from e in auxEvents
                         where e.IsInputChange() && e.IsEdgeRising()
                         select e)
                {
                    var filteredEvent = filter.FilterAuxiliaryEvent(auxEvent.ID, auxEvent.GetChannel(), auxEvent.UTCTimeAsDateTime, sent, received,
                                                                    auxEvent.IsResend() && !auxEvent.IsDecoderResend());
                    if (filteredEvent != null)
                    {
                        ProcessEvent(filteredEvent);
                    }
                }
            }
            catch (Exception e)
            {
                //events.OnError(e);
                Disconnect();
            }
        }
示例#3
0
        protected void HandleNotify(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr array, uint count, IntPtr context)
        {
            var notifyObjects = FromNativePointerArray(array, count);

            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                notifyObjects.ForEach(obj => _objects.Add(obj.ID, obj));
                _allDataAvailable = true;
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                notifyObjects.ForEach(obj => _objects[obj.ID] = obj);
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                notifyObjects.ForEach(obj => _objects.Remove(obj.ID));
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                _allDataAvailable = false;
                _objects.Clear();
                break;
            }

            if (NotifyHandlers != null)
            {
                NotifyHandlers(nType, notifyObjects, _mta);
            }
        }
        private void HandleNotifyLapSectorCell(IntPtr tableDataHandle, MDP_NOTIFY_TYPE nType, System.IntPtr laprow, uint cellindex, System.IntPtr sequencesegmentcell, System.IntPtr context)
        {
            var row  = new LapRow(laprow, base.Handle);
            var cell = new LapSectorCell(sequencesegmentcell, base.Handle);

            if (base.Cache)
            {
                switch (nType)
                {
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                    _lapSectorCells[row.ID][cellindex] = cell;
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                    /* not handled */
                    break;
                }
            }

            if (NotifyLapSectorCellHandlers != null)
            {
                NotifyLapSectorCellHandlers(nType, row, cell, cellindex, base.Handle);
            }
        }
示例#5
0
        protected void HandleNotify(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr nativeArray, uint count, IntPtr context)
        {
            if (handle != _eventData.Handle)
            {
                return;
            }

            var events = FromNativePointerArray(nativeArray, count, _eventData);

            if (_cache)
            {
                switch (nType)
                {
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
                    events.ForEach(e => {
                        _events.Add(e);
                        Select(e);
                    });
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                    events.ForEach(e => {
                        _events.Add(e);
                        Insert(e);
                    });
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                    foreach (var e in events)
                    {
                        int index = _events.FindIndex(eventObject => eventObject.ID == e.ID);

                        if (index != -1)
                        {
                            _events[index] = e;
                        }
                        Update(e);
                    }
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                    events.ForEach(deletedEvent =>
                    {
                        _events.RemoveAll(e => e.ID == deletedEvent.ID);
                        Delete(deletedEvent);
                    });
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                    _events.Clear();
                    Clear();
                    break;
                }
            }

            if (EventHandlers != null)
            {
                EventHandlers(nType, events, _eventData);
            }
        }
示例#6
0
        private void NotifyAppliance(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr appliancePtr, IntPtr context)
        {
            var availableAppliance = new AvailableAppliance(appliancePtr, null);

            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                _availableAppliances[availableAppliance.MacAddress] = availableAppliance;
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                _availableAppliances.Remove(availableAppliance.MacAddress);
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                _availableAppliances.Clear();
                break;
            }

            if (_notifyApplianceHandlers != null)
            {
                _notifyApplianceHandlers(nType, availableAppliance, _sdk);
            }
        }
        private void HandleNotify(IntPtr eventDataHandle, MDP_NOTIFY_TYPE nType, IntPtr beaconlogPtr, IntPtr beacondataArray, uint count, IntPtr context)
        {
            var       data      = BeaconData.FromNativePointerArray(beacondataArray, count, _eventData);
            BeaconLog beaconLog = null;

            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                beaconLog = new BeaconLog(beaconlogPtr, _eventData);
                Insert(beaconLog, data);
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                Clear();
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                /* not handled */
                break;
            }
            if (NotifyHandlers != null)
            {
                NotifyHandlers(nType, beaconLog, data, _eventData);
            }
        }
        private void NotifyTrackSolutionGroup(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr tracksolutiongrouparray, uint count, IntPtr context)
        {
            var trackSolutionGroups = TrackSolutionGroup.FromNativePointerArray(tracksolutiongrouparray, count,
                                                                                _mta);

            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                trackSolutionGroups.ForEach(tsg => _tracksolutionGroups[tsg.ID] = tsg);
                _allTrackSolutionGroupDataAvailable = true;
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                trackSolutionGroups.ForEach(tsg => _tracksolutionGroups.Remove(tsg.ID));
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                _allTrackSolutionGroupDataAvailable = false;
                _tracksolutionGroups.Clear();
                break;
            }

            if (NotifyTrackSolutionGroupHandlers != null)
            {
                NotifyTrackSolutionGroupHandlers(nType, trackSolutionGroups, _mta);
            }
        }
        private void DefaultNotifyMultiObjectHandler(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr nativeArray, uint count, IntPtr context)
        {
            Debug.Assert(_defaultNativeNotifyMultiObjectDelegate != null);

            if (_nativeHandle != handle)
            {
                return;
            }

            var objects = _fromNativePointerArrayDelegate(nativeArray, count, _handleWrapper);

            if (_cache)
            {
                switch (nType)
                {
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
                    objects.ForEach(obj => {
                        _objects[this.GetKeyOfObject(obj)] = obj;
                        this.HandleSelect(obj);
                    });
                    _allDataAvailable = true;
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                    objects.ForEach(obj => {
                        _objects[this.GetKeyOfObject(obj)] = obj;
                        this.HandleInsert(obj);
                    });
                    _allDataAvailable = true;
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                    objects.ForEach(obj => {
                        _objects[this.GetKeyOfObject(obj)] = obj;
                        this.HandleUpdate(obj);
                    });
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                    objects.ForEach(obj => {
                        _objects.Remove(this.GetKeyOfObject(obj));
                        this.HandleDelete(obj);
                    });
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                    ClearData();
                    this.HandleClear();
                    break;
                }
            }

            if (NotifyHandlers != null)
            {
                NotifyHandlers(nType, objects, _handleWrapper);
            }
        }
        protected void HandleNotify(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr nativePointer, IntPtr context)
        {
            if (handle != _eventData.Handle)
            {
                return;
            }

            var obj = (nativePointer == IntPtr.Zero) ? default(EventClass) : FromNativePointer(nativePointer, _eventData);

            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
                if (obj != null)
                {
                    Select(obj);
                }
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                if (obj != null)
                {
                    Insert(obj);
                }
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                if (obj != null)
                {
                    Update(obj);
                }
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                if (obj != null)
                {
                    Delete(obj);
                }
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                Clear();
                break;
            }

            if (EventHandlers != null)
            {
                EventHandlers(nType, obj, _eventData);
            }
        }
        private void DefaultNotifySingleObjectHandler(System.IntPtr handle, MDP_NOTIFY_TYPE nType, System.IntPtr ptrToStruct, System.IntPtr context)
        {
            Debug.Assert(_defaultNativeNotifySingleObjectDelegate != null);

            if (_nativeHandle != handle)
            {
                return;
            }

            var obj = _fromNativePointerDelegate(ptrToStruct, _handleWrapper);

            if (_cache)
            {
                switch (nType)
                {
                case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
                    _objects[this.GetKeyOfObject(obj)] = obj;
                    this.HandleSelect(obj);
                    _allDataAvailable = true;
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                    _objects[this.GetKeyOfObject(obj)] = obj;
                    this.HandleInsert(obj);
                    _allDataAvailable = true;
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                    _objects[this.GetKeyOfObject(obj)] = obj;
                    this.HandleUpdate(obj);
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                    _objects.Remove(this.GetKeyOfObject(obj));
                    this.HandleDelete(obj);
                    break;

                case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                    Clear();
                    break;
                }
            }

            if (NotifyHandlers != null)
            {
                NotifyHandlers(nType, obj, _handleWrapper);
            }
        }
        private void NotifySequenceSegments(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr sequencsegmentearray, uint count, IntPtr context)
        {
            var sequenceSegments = SequenceSegment.FromNativePointerArray(sequencsegmentearray, count, _mta);

            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
                sequenceSegments.ForEach(sequenceSegment =>
                {
                    if (!_sequenceSegments.ContainsKey(sequenceSegment.TrackSolutionID))
                    {
                        _sequenceSegments[sequenceSegment.TrackSolutionID] = new SortedDictionary <uint, SequenceSegment>();
                    }
                    _sequenceSegments[sequenceSegment.TrackSolutionID][sequenceSegment.ID] = sequenceSegment;
                });
                _allSequenceSegmentDataAvailable = true;
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
                sequenceSegments.ForEach(sequenceSegment =>
                {
                    if (_sequenceSegments.ContainsKey(sequenceSegment.TrackSolutionID))
                    {
                        _sequenceSegments[sequenceSegment.TrackSolutionID].Remove(sequenceSegment.ID);
                        if (_sequenceSegments[sequenceSegment.TrackSolutionID].Count == 0)
                        {
                            _sequenceSegments.Remove(sequenceSegment.TrackSolutionID);
                        }
                    }
                });
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                _allSequenceSegmentDataAvailable = false;
                _sequenceSegments.Clear();
                break;
            }

            if (NotifySequenceSegmentHandlers != null)
            {
                NotifySequenceSegmentHandlers(nType, sequenceSegments, _mta);
            }
        }
示例#13
0
        public void NotifySystemSetupPicture(IntPtr handle, MDP_NOTIFY_TYPE nType, IntPtr systemsetuppicturePtr, IntPtr context)
        {
            switch (nType)
            {
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_SELECT:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_UPDATE:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_INSERT:
                _currentSystemSetupPicture = new SystemSetupPicture(systemsetuppicturePtr, base.Handle);
                break;

            case MDP_NOTIFY_TYPE.MDP_NOTIFY_DELETE:
            case MDP_NOTIFY_TYPE.MDP_NOTIFY_CLEAR:
                _currentSystemSetupPicture = null;
                break;
            }

            if (NotifySystemSetupPictureHandlers != null)
            {
                NotifySystemSetupPictureHandlers(nType, _currentSystemSetupPicture, base.Handle);
            }
        }