Exemple #1
0
 public static OnOffSample DequeueNextSampleValue()
 {
     lock (theLock)
     {
         OnOffSample Value = DequeueSampleValue(false);
         return(Value);
     }
 }
Exemple #2
0
 public static OnOffSample PreViewNextSampleValue()
 {
     lock (theLock)
     {
         OnOffSample Value = DequeueSampleValue(true);
         return(Value);
     }
 }
        private new ArrayList createOnOffPropertyArrayList(OnOffSample nextSampleValue, int azureSends)
        {
            string TimeOffsetUTCString = nextSampleValue.TimeOffsetUTC < 0 ? nextSampleValue.TimeOffsetUTC.ToString("D3") : "+" + nextSampleValue.TimeOffsetUTC.ToString("D3");

            ArrayList           propertiesAL = new System.Collections.ArrayList();
            TableEntityProperty property;

            //Add properties to ArrayList (Name, Value, Type)
            property = new TableEntityProperty("Status", nextSampleValue.Status, "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("LastStatus", nextSampleValue.LastStatus, "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("Location", nextSampleValue.Location, "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("SampleTime", nextSampleValue.TimeOfSample.ToString() + " " + TimeOffsetUTCString, "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("TimeFromLast", nextSampleValue.TimeFromLast.Days.ToString("D3") + "-" + nextSampleValue.TimeFromLast.Hours.ToString("D2") + ":" + nextSampleValue.TimeFromLast.Minutes.ToString("D2") + ":" + nextSampleValue.TimeFromLast.Seconds.ToString("D2"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("OnTimeDay", nextSampleValue.OnTimeDay.Days.ToString("D3") + "-" + nextSampleValue.OnTimeDay.Hours.ToString("D2") + ":" + nextSampleValue.OnTimeDay.Minutes.ToString("D2") + ":" + nextSampleValue.OnTimeDay.Seconds.ToString("D2"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("CD", nextSampleValue.CD.ToString("D3"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("OnTimeWeek", nextSampleValue.OnTimeWeek.Days.ToString("D3") + "-" + nextSampleValue.OnTimeWeek.Hours.ToString("D2") + ":" + nextSampleValue.OnTimeWeek.Minutes.ToString("D2") + ":" + nextSampleValue.OnTimeWeek.Seconds.ToString("D2"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("CW", nextSampleValue.CW.ToString("D3"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("OnTimeMonth", nextSampleValue.OnTimeMonth.Days.ToString("D3") + "-" + nextSampleValue.OnTimeMonth.Hours.ToString("D2") + ":" + nextSampleValue.OnTimeMonth.Minutes.ToString("D2") + ":" + nextSampleValue.OnTimeMonth.Seconds.ToString("D2"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("CM", nextSampleValue.CM.ToString("D4"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("OnTimeYear", nextSampleValue.OnTimeYear.Days.ToString("D3") + "-" + nextSampleValue.OnTimeYear.Hours.ToString("D2") + ":" + nextSampleValue.OnTimeYear.Minutes.ToString("D2") + ":" + nextSampleValue.OnTimeYear.Seconds.ToString("D2"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("CY", nextSampleValue.CY.ToString("D5"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("Val1", nextSampleValue.Val_1, "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("Info", nextSampleValue.SendInfo.ToString("D4"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("Iterations", nextSampleValue.Iterations.ToString("D6"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("Sends", azureSends.ToString("D6"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("RemainRam", nextSampleValue.RemainingRam.ToString("D7"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("forcedReboots", nextSampleValue.ForcedReboots.ToString("D6"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("badReboots", nextSampleValue.BadReboots.ToString("D6"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("sendErrors", nextSampleValue.SendErrors.ToString("D4"), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("bR", nextSampleValue.BootReason.ToString(), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("fS", nextSampleValue.ForceSend ? "X" : ".", "Edm.String");
            propertiesAL.Add(property.propertyArray());
            property = new TableEntityProperty("Message", nextSampleValue.Message.ToString(), "Edm.String");
            propertiesAL.Add(property.propertyArray());
            return(propertiesAL);
        }
Exemple #4
0
 public static void EnqueueSampleValue(OnOffSample SampleValue)
 {
     lock (theLock)
     {
         if (_count == _capacity)
         {
             Grow();
             //Debug.Print("New Capacity: " + _buffer.Length);
         }
         _buffer[_head] = SampleValue;
         _head          = (_head + 1) % _capacity;
         _count++;
     }
 }
Exemple #5
0
        private static void Grow()
        {
            int newCapacity = _capacity << 1;

            OnOffSample[] newBuffer = new OnOffSample[newCapacity];

            if (_tail < _head)
            {
                Array.Copy(_buffer, _tail, newBuffer, 0, _count);
            }
            else
            {
                Array.Copy(_buffer, _tail, newBuffer, 0, _capacity - _tail);
                Array.Copy(_buffer, 0, newBuffer, _capacity - _tail, _head);
            }
            _buffer   = newBuffer;
            _head     = _count;
            _tail     = 0;
            _capacity = newCapacity;
        }
Exemple #6
0
        private static OnOffSample DequeueSampleValue(bool PreView)
        {
            lock (theLock)
            {
                if (_count > 0)
                {
                    OnOffSample value = _buffer[_tail];

                    if (!PreView)
                    {
                        _tail = (_tail + 1) % _capacity;
                        _count--;
                    }
                    return(value);
                }
                else
                {
                    return(null);
                }
            }
        }