public override void LoadFromXml(XmlElement element) { // Base load first base.LoadFromXml(element); try { NodeType = (SensorType)int.Parse(element.GetAttribute(XmlTag.ATTR_SENSOR_TYPE)); if (NodeType == SensorType.Source) { initialState = true; } ID = int.Parse(element.GetAttribute(XmlTag.ATTR_ID)); SendingRate = int.Parse(element.GetAttribute(XmlTag.ATTR_MAX_SENDING_RATE)); ProcessingRate = int.Parse(element.GetAttribute(XmlTag.ATTR_MAX_PROCESSING_RATE)); string cngLevel = element.GetAttribute(XmlTag.ATTR_CONGESTION_LEVEL); CongestionLevel = (CGNLevel)Enum.Parse(typeof(CGNLevel), cngLevel); } catch (Exception ex) { DevLog.d(TAG, ex.ToString()); } }
public WSNSensor(int id) : base(false, "Sensor " + id) { ID = id; SendingRate = 10; ProcessingRate = 10; NodeType = SensorType.Intermediate; CongestionLevel = CGNLevel.Low; }
private static int computeSize(CGNLevel level, int msize) { int ret = 0; switch (level) { case CGNLevel.Low: break; case CGNLevel.Medium: ret = (int)(msize * 0.9f); break; case CGNLevel.High: ret = (int)(msize * 1.1f); break; default: break; } return(ret); }
private static int computeSize(CGNLevel level, int msize) { int ret = 0; switch (level) { case CGNLevel.Low: break; case CGNLevel.Medium: ret = (int) (msize * 0.9f); break; case CGNLevel.Heigh: ret = (int)(msize * 1.1f); break; default: break; } return ret; }