Ejemplo n.º 1
0
        public void Initialize(PulseSource *producer)
        {
            producer->UpdateMask(_mask);

            // Keep producer pointer here to notify when the input trigger
            _pulseSource = producer;

            // Build links and callbacks
            Outputs = _outputs.Select(p => p.Value.Output).ToArray();

            IsInitialized = true;
        }
Ejemplo n.º 2
0
 public InputRuntime(
     PulseSource *pulseSource,
     IRelayInput input,
     Action <DateTime>[] callbacks,
     ArrayEx <Action <DateTime>[]> callbackQueue)
 {
     _callbacks     = callbacks;
     _callbackQueue = callbackQueue;
     _pulseSource   = pulseSource;
     _subscription  = _callbacks.Length > 0
         ? input.Subscribe(PulseWithCallbacks)
         : input.Subscribe(Pulse);
 }
Ejemplo n.º 3
0
        private static void InstallPulseSources(
            PulseSource *pPulseSource,
            byte *pFlags,
            byte *pImpulseMask,
            Dictionary <string, InputInitializer> initializers)
        {
            var p          = pPulseSource;
            var maskOffset = 0;

            foreach (var pair in initializers)
            {
                var initializer = pair.Value;
                p->Initialize(
                    pFlags + initializer.FlagsOffset,
                    (int)(pImpulseMask - pFlags - initializer.FlagsOffset + maskOffset),
                    initializer.MaskLength);
                maskOffset += initializer.MaskLength;

                initializer.Initialize(p);

                p++;
            }
        }