private void SendValue(BoolSensorValue data)
        {
            string            serializedValue = GetStringData(data);
            CommonSensorValue commonValue     = new CommonSensorValue();

            commonValue.TypedValue = serializedValue;
            commonValue.SensorType = SensorType.BooleanSensor;
            EnqueueData(commonValue);
        }
 public override CommonSensorValue GetLastValue()
 {
     try
     {
         IntBarSensorValue dataObject  = GetPartialDataObject();
         CommonSensorValue commonValue = ToCommonSensorValue(dataObject);
         return(commonValue);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Beispiel #3
0
        private void EnqueueValue(CommonSensorValue value)
        {
            lock (_lockObj)
            {
                _valuesQueue.Enqueue(value);
            }

            ++_internalCount;
            if (_internalCount == MAX_QUEUE_CAPACITY)
            {
                OnQueueOverflow();
            }
        }
        protected override void SmallTimerTick(object state)
        {
            IntBarSensorValue dataObject;

            try
            {
                dataObject = GetPartialDataObject();
            }
            catch (Exception e)
            {
                return;
            }
            CommonSensorValue commonValue = ToCommonSensorValue(dataObject);

            EnqueueData(commonValue);
        }
Beispiel #5
0
 protected void EnqueueData(CommonSensorValue value)
 {
     _queue.Enqueue(value);
 }
Beispiel #6
0
 public void Enqueue(CommonSensorValue value)
 {
     EnqueueValue(value);
 }
 internal static T Convert <T>(this CommonSensorValue sensorValue) =>
 JsonSerializer.Deserialize <T>(sensorValue.TypedValue);