Esempio n. 1
0
 public override PDU Create(DataUnitType dataUnitType)
 {
     return(dataUnitType switch
     {
         DataUnitType.AssociateRequestPDU => new AssociateRequestPDU(),
         DataUnitType.AssociateAcceptPDU => new AssociateAcceptPDU(),
         DataUnitType.AssociateRejectPDU => new AssociateRejectPDU(),
         DataUnitType.DataTransferPDU => new DataTransferPDUHeader(),
         DataUnitType.ReleaseRequestPDU => new ReleaseRequestPDU(),
         DataUnitType.ReleaseResponsePDU => new ReleaseResponsePDU(),
         DataUnitType.AbortPDU => new AbortPDU(),
         _ => throw new NotSupportedException($"Expected PDU but got {dataUnitType}"),
     });
Esempio n. 2
0
        public override SubItem Create(DataUnitType subItemType)
        {
            switch (subItemType)
            {
            case DataUnitType.AbstractSyntaxSubItem:
                return(new AbstractSyntaxSubItem());

            case DataUnitType.TransferSyntaxSubItem:
                return(new TransferSyntaxSubItem());

            case DataUnitType.MaximumLengthSubItem:
                return(new MaximumLengthSubItem());

            case DataUnitType.ImplementationClassUIDSubItem:
                return(new ImplementationClassUIDSubItem());

            case DataUnitType.AsynchronousOperationsWindowSubItem:
                return(new AsynchronousOperationsWindowSubItem());

            case DataUnitType.SCPSCURoleSelectionSubItem:
                return(new SCPSCURoleSelectionSubItem());

            case DataUnitType.ImplementationVersionNameSubItem:
                return(new ImplementationVersionNameSubItem());

            case DataUnitType.SOPClassExtendedNegotiationSubItem:
                return(new SOPClassExtendedNegotiationSubItem());

            case DataUnitType.UserIdentityNegotiationSubItem0:
                return(new UserIdentityNegotiationSubItem0());

            case DataUnitType.UserIdentityNegotiationSubItem1:
                return(new UserIdentityNegotiationSubItem1());
            }

            if (SubItem.IsUserInformationSubItemType(subItemType))
            {
                return(new UnrecognizedUserInformationSubItem(subItemType));
            }
            else
            {
                throw new NotSupportedException($"Expected SubItem but got {subItemType}");
            }
        }
Esempio n. 3
0
        public override Item Create(DataUnitType dataUnitType)
        {
            switch (dataUnitType)
            {
            case DataUnitType.ApplicationContextItem:
                return(new ApplicationContextItem());

            case DataUnitType.PresentationContextItemRequest:
                return(new PresentationContextRequestItem());

            case DataUnitType.PresentationContextItemResponse:
                return(new PresentationContextResponseItem());

            case DataUnitType.UserInformationItem:
                return(new UserInformationItem());

            default:
                throw new NotSupportedException($"Expected Item but got {dataUnitType}");
            }
        }
Esempio n. 4
0
        public static string CombinePath(string name, DataUnitType type)
        {
            string fullpath = "";

            switch (type)
            {
            case DataUnitType.CODE_CS:
                fullpath = Path.Combine(CLINET_CODE_PATH, name + ".cs");
                break;

            case DataUnitType.CODE_CPP:
                fullpath = SERVER_CODE_PATH;
                break;

            case DataUnitType.CODE_PROTO:
                fullpath = Path.Combine(PROTO_PATH, name + ".proto");
                break;

            case DataUnitType.DATA_BIN:
                fullpath = Path.Combine(SERVER_BIN_DATA_PATH, name + ".bin");
                break;

            case DataUnitType.DATA_XLS:
                fullpath = Path.Combine(XLS_PATH, name + ".xls");
                break;

            case DataUnitType.DATA_ASSET:
                fullpath = Path.Combine(CLIENT_DATA_PATH, name + ".asset");
                break;

            case DataUnitType.DATA_TEXT:
                fullpath = Path.Combine(SERVER_TEXT_DATA_PATH, name + ".txt");
                break;

            default:
                break;
            }

            return(fullpath);
        }
Esempio n. 5
0
 protected PDU(DataUnitType pduType)
     : base(pduType)
 {
 }
Esempio n. 6
0
 public static bool IsUserInformationSubItemType(DataUnitType dataUnitType)
 {
     return((dataUnitType >= DataUnitType.UserInformationSubItemRangeStart) &&
            (dataUnitType <= DataUnitType.UserInformationSubItemRangeEnd));
 }
Esempio n. 7
0
 internal DataUnit(DataUnitType dataUnitType)
 {
     DataUnitType = dataUnitType;
 }
Esempio n. 8
0
 internal SubItem(DataUnitType subItemType)
     : base(subItemType)
 {
 }
Esempio n. 9
0
 protected Item(DataUnitType itemType)
     : base(itemType)
 {
 }
Esempio n. 10
0
 public UnrecognizedUserInformationSubItem(DataUnitType subItemType)
     : base(subItemType)
 {
     Debug.Assert(IsUserInformationSubItemType(subItemType));
 }
Esempio n. 11
0
        public override Dictionary <string, object> ToUpdate(IMemoryCache memoryCache, out BaseModel updatedElement)
        {
            Dictionary <string, object> changes = new Dictionary <string, object>();
            Sensor refInCache = null;

            if (Id != Guid.Empty)
            {
                refInCache = CacheHelper.GetSensorFromCache(memoryCache, Id);

                if (refInCache != null)
                {
                    if (!DeviceId.Equals(refInCache.DeviceId))
                    {
                        changes.Add("DeviceId", DeviceId);
                        refInCache.DeviceId = DeviceId;
                    }
                    if (HardwareId != null && !HardwareId.Equals(refInCache.HardwareId))
                    {
                        changes.Add("HardwareId", HardwareId);
                        refInCache.HardwareId = HardwareId;
                    }
                    if (SpaceId != null && !SpaceId.Equals(refInCache.SpaceId))
                    {
                        changes.Add("SpaceId", SpaceId);
                        refInCache.SpaceId = SpaceId;
                    }
                    if (!PollRate.Equals(refInCache.PollRate))
                    {
                        changes.Add("PollRate", PollRate);
                        refInCache.PollRate = PollRate;
                    }
                    if (PortType != null && !PortType.Equals(refInCache.PortType))
                    {
                        changes.Add("PortType", PortType);
                        refInCache.PortType = PortType;
                    }
                    if (DataType != null && !DataType.Equals(refInCache.DataType))
                    {
                        changes.Add("DataType", DataType);
                        refInCache.DataType = DataType;
                    }
                    if (DataUnitType != null && !DataUnitType.Equals(refInCache.DataUnitType))
                    {
                        changes.Add("DataUnitType", DataUnitType);
                        refInCache.DataUnitType = DataUnitType;
                    }
                    if (DataSubtype != null && !DataSubtype.Equals(refInCache.DataSubtype))
                    {
                        changes.Add("DataSubtype", DataSubtype);
                        refInCache.DataSubtype = DataSubtype;
                    }
                }
                else
                {
                    refInCache = this;
                    if (DeviceId != null)
                    {
                        changes.Add("DeviceId", DeviceId);
                    }
                    if (HardwareId != null)
                    {
                        changes.Add("HardwareId", HardwareId);
                    }
                    if (SpaceId != null)
                    {
                        changes.Add("SpaceId", SpaceId);
                    }
                    if (PollRate != 0)
                    {
                        changes.Add("PollRate", PollRate);
                    }
                    if (PortType != null)
                    {
                        changes.Add("PortType", PortType);
                    }
                    if (DataType != null)
                    {
                        changes.Add("DataType", DataType);
                    }
                    if (DataUnitType != null)
                    {
                        changes.Add("DataUnitType", DataUnitType);
                    }
                    if (DataSubtype != null)
                    {
                        changes.Add("DataSubTypeId", DataSubTypeId);
                    }
                }
            }
            updatedElement = refInCache;
            return(changes);
        }
 public abstract T Create(DataUnitType dataUnitType);