예제 #1
0
        private void processVmsUnit(VmsUnit vmsUnit, DateTime publicationTime, bool fullRefresh)
        {
            string vmsIdentifier = vmsUnit.vmsUnitReference.id;

            if (logWrapper.isInfo())
            {
                logWrapper.Info("Processing VMSIdentifier(" + vmsIdentifier + ")");
            }

            VMSData vmsData = new VMSData(vmsIdentifier, publicationTime, vmsUnit);

            vMSDataStore.updateData(vmsData);
        }
예제 #2
0
        public putDatex2DataResponse GetDeliverVMSTrafficDataResponse(D2LogicalModel VMSTrafficData)
        {
            log.Info("Handling VMS Traffic Data");
            // Validate the D2Logical Model
            if (!ExampleDataCheckOk(VMSTrafficData))
            {
                throw new SoapException("Incoming request does not appear to be valid!", SoapException.ClientFaultCode);
            }


            VmsPublication payloadPublication = VMSTrafficData.payloadPublication as VmsPublication;

            if (payloadPublication != null)
            {
                VmsUnit vmsUnit = payloadPublication.vmsUnit[0];
                if (vmsUnit != null)
                {
                    log.Info(string.Format("Vmsunit GUID: {0}", vmsUnit.vmsUnitReference.id));

                    IList<_VmsUnitVmsIndexVms> vmsIndexList = vmsUnit.vms;
                    if (vmsIndexList != null && vmsIndexList.Count > 0)
                    {
                        _VmsUnitVmsIndexVms vmsUnitVmsIndexVms = vmsIndexList[0];
                        IList<_VmsMessageIndexVmsMessage> vmsMessageList = vmsUnitVmsIndexVms.vms.vmsMessage;
                        if (vmsMessageList.Count > 0)
                        {
                            VmsMessage vmsMessage = vmsMessageList[0].vmsMessage;
                            IList<_TextPage> textPageList = vmsMessage.textPage;
                            if (textPageList.Count > 0)
                            {
                                _TextPage textPage = textPageList[0];
                                VmsText vmsText = textPage.vmsText;
                                IList<_VmsTextLineIndexVmsTextLine> vmsTextLineList = vmsText.vmsTextLine;
                                if (vmsTextLineList.Count > 0)
                                {
                                    _VmsTextLineIndexVmsTextLine vmsTextLineIndexVmsTextLine = vmsTextLineList[0];
                                    log.Info(string.Format("vms text line {0}", vmsTextLineIndexVmsTextLine.vmsTextLine.vmsTextLine));
                                }
                            }
                        }
                    }
                }
            }

            log.Info("VMSTraffic Data Request: Processing Completed Successfuly");

            return new putDatex2DataResponse { d2LogicalModel = new D2LogicalModel() };

        }
예제 #3
0
        public override void processMessage(D2LogicalModel d2LogicalModel)
        {
            if (logWrapper.isInfo())
            {
                logWrapper.Info("VMSAndMatrix Update");
            }

            bool   fullRefresh = false;
            string feedType    = d2LogicalModel.payloadPublication.feedType;

            if (feedType.ToLower().Contains(FULL_REFRESH_TEXT))
            {
                if (logWrapper.isInfo())
                {
                    logWrapper.Info("VMS Full Refresh received");
                }
                fullRefresh = true;
                vMSDataStore.clearDataStore();
            }

            VmsPublication payloadPublication = (VmsPublication)d2LogicalModel.payloadPublication;
            DateTime       publicationTime    = payloadPublication.publicationTime;

            if (payloadPublication != null)
            {
                VmsUnit[] vmsUnits = payloadPublication.vmsUnit;

                if (logWrapper.isInfo())
                {
                    logWrapper.Info("VMS Update(" + vmsUnits.Length + " objects)");
                }

                for (int vmsUnitsPos = 0; vmsUnitsPos < vmsUnits.Length; vmsUnitsPos++)
                {
                    VmsUnit vmsUnit = vmsUnits[vmsUnitsPos];
                    processVmsUnit(vmsUnit, publicationTime, fullRefresh);
                }
            }

            if (logWrapper.isInfo())
            {
                logWrapper.Info("VMSAndMatrix Update Complete");
            }
        }
예제 #4
0
 public VMSData(String vmsIdentifier, DateTime publicationTime, VmsUnit vmsData)
 {
     this.vmsIdentifier   = vmsIdentifier;
     this.publicationTime = publicationTime;
     this.vmsData         = vmsData;
 }
        private void extractStatusInformationFromUnitData(VmsUnit vmsUnit)
        {
            // Typically, the service should refer to the NTIS reference Model to
            // determine what type (VMS or Matrix Signal) the unit is; and hence how
            // to process the data. For this simple example, however, the ID of the
            // unit table reference is used.
            String vmsUnitType = vmsUnit.vmsUnitTableReference.id;

            if ("NTIS_VMS_Units".CompareTo(vmsUnitType) == 0)
            {
                log.Info("VMS Unit ID: " + vmsUnit.vmsUnitReference.id);

                // There is only ever 1 VMS/Matrix unit per vmsUnit element - at
                // index 0
                _VmsUnitVmsIndexVms unit = vmsUnit.vms[0];

                // There is only ever 1 message per unit
                VmsMessage message = unit.vms.vmsMessage[0].vmsMessage;

                log.Info("Message type: " + message.vmsMessageInformationType);
                log.Info("Set by: " + message.messageSetBy.values[0].Value);
                log.Info("Last set at: " + message.timeLastSet);
                log.Info("Related event: " + message.situationToWhichMessageIsRelated.id);


                // There is only ever 1 text page specified, with multiple text lines
                _TextPage textPage = message.textPage[0];
                _VmsTextLineIndexVmsTextLine[] textLines = textPage.vmsText.vmsTextLine;
                foreach (_VmsTextLineIndexVmsTextLine textLine in textLines)
                {
                    log.Info("Text Line #" + (textLine.lineIndex + 1) + ": " + textLine.vmsTextLine.vmsTextLine);
                }

                // There is only ever 1 pictogram display area, with 1 pictogram
                log.Info("Pictogram Displayed: " + message.vmsPictogramDisplayArea[0].vmsPictogramDisplayArea.vmsPictogram[0].vmsPictogram.pictogramDescription[0].ToString());
            }
            else if ("NTIS_Matrix_Units".CompareTo(vmsUnitType) == 0)
            {
                log.Info("Matrix Unit ID: " + vmsUnit.vmsUnitReference.id);

                // There is only ever 1 VMS/Matrix unit per vmsUnit element - at
                // index 0
                _VmsUnitVmsIndexVms unit = vmsUnit.vms[0];

                // There is only ever 1 message per unit
                VmsMessage message = unit.vms.vmsMessage[0].vmsMessage;

                log.Info("Last set at: " + message.timeLastSet);

                // There is only ever 1 pictogram display area, with 1 pictogram
                VmsPictogram pictogram = message.vmsPictogramDisplayArea[0].vmsPictogramDisplayArea.vmsPictogram[0].vmsPictogram;

                // If the pictogram is 'other', then the actual pictogram displayed is defined by the vmsPictogramEUK
                // extension (applies to Matrix Signals only)
                VmsDatexPictogramEnum pictogramType = pictogram.pictogramDescription[0];

                String pictogramDesc = null;
                if (pictogramType.CompareTo(VmsDatexPictogramEnum.other) == 0)
                {
                    pictogramDesc = pictogram.vmsPictogramExtension.vmsPictogramUK.pictogramDescriptionUK.ToString();
                }
                else
                {
                    pictogramDesc = pictogramType.ToString();
                }
                log.Info("Pictogram Displayed: " + pictogramDesc);
            }
            else
            {
                log.Error("Invalid unit type received in publication: " + vmsUnitType);
            }
        }
예제 #6
0
        private void extractStatusInformationFromUnitData(VmsUnit vmsUnit)
        {
            // Typically, the service should refer to the NTIS reference Model to
            // determine what type (VMS or Matrix Signal) the unit is; and hence how
            // to process the data. For this simple example, however, the ID of the
            // unit table reference is used.
            String vmsUnitType = vmsUnit.vmsUnitTableReference.id;

            if ("NTIS_VMS_Units".CompareTo(vmsUnitType) == 0) {

                log.Info("VMS Unit ID: " + vmsUnit.vmsUnitReference.id);

                // There is only ever 1 VMS/Matrix unit per vmsUnit element - at
                // index 0
                _VmsUnitVmsIndexVms unit = vmsUnit.vms[0];

                // There is only ever 1 message per unit
                VmsMessage message = unit.vms.vmsMessage[0].vmsMessage;

                log.Info("Set by: " + message.messageSetBy.values[0].Value);
                log.Info("Last set at: " + message.timeLastSet);

                // There is only ever 1 text page specified, with multiple text lines
                _TextPage textPage = message.textPage[0];
                _VmsTextLineIndexVmsTextLine[] textLines = textPage.vmsText.vmsTextLine;
                foreach (_VmsTextLineIndexVmsTextLine textLine in textLines)
                    log.Info("Text Line #" + (textLine.lineIndex + 1) + ": " + textLine.vmsTextLine.vmsTextLine);

                // There is only ever 1 pictogram display area, with 1 pictogram
                log.Info("Pictogram Displayed: " + message.vmsPictogramDisplayArea[0].vmsPictogramDisplayArea.vmsPictogram[0].vmsPictogram.pictogramDescription[0].ToString());

            } else if ("NTIS_Matrix_Units".CompareTo(vmsUnitType) == 0) {

                log.Info("Matrix Unit ID: " + vmsUnit.vmsUnitReference.id);

                // There is only ever 1 VMS/Matrix unit per vmsUnit element - at
                // index 0
                _VmsUnitVmsIndexVms unit = vmsUnit.vms[0];

                // There is only ever 1 message per unit
                VmsMessage message = unit.vms.vmsMessage[0].vmsMessage;

                log.Info("Last set at: " + message.timeLastSet);

                // There is only ever 1 pictogram display area, with 1 pictogram
                VmsPictogram pictogram = message.vmsPictogramDisplayArea[0].vmsPictogramDisplayArea.vmsPictogram[0].vmsPictogram;

                // If the pictogram is 'other', then the actual pictogram displayed is defined by the vmsPictogramEUK
                // extension (applies to Matrix Signals only)
                VmsDatexPictogramEnum pictogramType = pictogram.pictogramDescription[0];

                String pictogramDesc = null;
                if (pictogramType.CompareTo(VmsDatexPictogramEnum.other) == 0) {
                    pictogramDesc = pictogram.vmsPictogramExtension.vmsPictogramUK.pictogramDescriptionUK.ToString();
                } else {
                    pictogramDesc = pictogramType.ToString();
                }
                log.Info("Pictogram Displayed: " + pictogramDesc);

            } else {
                log.Error("Invalid unit type received in publication: " + vmsUnitType);
            }
        }