public Port(PortKey portKey, ePortType type, ioPortDirection ioDirection, string portmodelid = null) { this.PortKey = portKey; this.Type = type; this.ioDirection = ioDirection; this.State = null; this.PortModelId = portmodelid; }
//should be used only by deserializer public Port() { this.Type = ePortType.Undefined; this.ioDirection = ioPortDirection.Undefined; this.PortKey = default(PortKey); this.PortModelId = default(string); this.Color = "#0000FF"; this.Size = 18; }
public static Type ePortType2Type(ePortType PortType) { if (PortType == ePortType.Undefined) { return(null); //treat string as default } else if (PortType == ePortType.Integer) { return(typeof(Int64)); } else if (PortType == ePortType.Decimal || PortType == ePortType.DecimalHigh) { return(typeof(double)); } else if (PortType == ePortType.Boolean) { return(typeof(bool)); } else if (PortType == ePortType.Color) { return(typeof(YColor)); } else if (PortType == ePortType.String) { return(typeof(string)); //already string } else if (PortType == ePortType.VideoDescriptor) { return(typeof(VideoMediaDescriptor)); } else if (PortType == ePortType.AudioDescriptor) { return(typeof(AudioMediaDescriptor)); } else if (PortType == ePortType.BinaryResourceDescriptor) { return(typeof(BinaryResourceDescriptor)); } else if (PortType == ePortType.I2CDescriptor) { return(typeof(I2CCommand));//sos discuss with mits and gepa } else if (PortType == ePortType.JsonString) { return(typeof(string)); } else if (PortType == ePortType.Timestamp) { return(typeof(DateTime)); } else { DebugEx.Assert($"channel type {PortType} not accounted for"); return(null); } }
public Port(PortKey portKey, ePortType type, ioPortDirection ioDirection, string portmodelid = null) { this.PortKey = portKey; this.Type = type; this.State = null; this.PortModelId = portmodelid; DebugEx.Assert(ioDirection != ioPortDirection.Undefined, $"Undefined IO direction for port {portKey}"); this.ioDirection = ioDirection; }
public void Update_Except_States(Port otherPort) { this.Name = otherPort.Name; this.Description = otherPort.Description; this.Type = otherPort.Type; this.Semantics = otherPort.Semantics; this.ioDirection = otherPort.ioDirection; this.PortKey = otherPort.PortKey; this.ConfFlags = otherPort.ConfFlags; this.PortModelId = otherPort.PortModelId; }
public void Update_Except_States(Port otherPort) { this.Name = otherPort.Name; this.Description = otherPort.Description; this.Type = otherPort.Type; this.Semantics = otherPort.Semantics; DebugEx.Assert(otherPort.ioDirection != ioPortDirection.Undefined, $"Undefined IO direction for port {otherPort.PortKey}"); if (otherPort.ioDirection != ioPortDirection.Undefined) { this.ioDirection = otherPort.ioDirection; } this.PortKey = otherPort.PortKey; this.ConfFlags = otherPort.ConfFlags; this.PortModelId = otherPort.PortModelId; }
public static object State2Value(ePortType portType, string state) { if (portType == ePortType.Undefined) { return(state); //treat string as default } else if (portType == ePortType.String) { return(state); } else { var type = ePortType2Type(portType); if (type != null) { return(Yodiwo.ConvertEx.Convert(state, type)); } else { throw new Exception($"channel type {portType} not accounted for."); } } }
public static object State2Value(ePortType portType, string state) { if (portType == ePortType.Undefined) return state; //treat string as default else if (portType == ePortType.String) return state; else { var type = ePortType2Type(portType); if (type != null) return Yodiwo.ConvertEx.Convert(state, type); else throw new Exception($"channel type {portType} not accounted for."); } }
public static Type ePortType2Type(ePortType PortType) { if (PortType == ePortType.Undefined) return null; //treat string as default else if (PortType == ePortType.Integer) return typeof(Int64); else if (PortType == ePortType.Decimal || PortType == ePortType.DecimalHigh) return typeof(double); else if (PortType == ePortType.Boolean) return typeof(bool); else if (PortType == ePortType.Color) return typeof(YColor); else if (PortType == ePortType.String) return typeof(string); //already string else if (PortType == ePortType.VideoDescriptor) return typeof(VideoMediaDescriptor); else if (PortType == ePortType.AudioDescriptor) return typeof(AudioMediaDescriptor); else if (PortType == ePortType.BinaryResourceDescriptor) return typeof(BinaryResourceDescriptor); else if (PortType == ePortType.I2CDescriptor) return typeof(I2CCommand);//sos discuss with mits and gepa else if (PortType == ePortType.JsonString) return typeof(string); else { DebugEx.Assert($"channel type {PortType} not accounted for"); throw new Exception($"channel type {PortType} not accounted for"); } }