Esempio n. 1
0
        protected override void Radio_Interrupted(object sender, InterruptedEventArgs e)
        {
            base.Radio_Interrupted(sender, e);

            //lock (SyncRoot)
            {
                MaxRetries = e.StatusRegister.MaximunTransmitRetries;
                if (MaxRetries || e.StatusRegister.TransmitDataSent)
                {
                    _sendCompleteEvent.Set();
                }
                if (e.StatusRegister.ReceiveDataReady)
                {
                    DataArrived?.Invoke(this, Reader.ReadBufferAll());
                }
                lock (SyncRoot)
                {
                    Radio.OperatingMode = OperatingModes.StandBy;
                    e.StatusRegister.ResetToDefault();
                    e.StatusRegister.Save();
                    if (!_isSending)
                    {
                        Radio.OperatingMode = OperatingModes.ReceiveMode;
                    }
                }
            }
        }
Esempio n. 2
0
        private static void OnInterrupt <G>(string code, InstructionExecutor <G> _, InterruptedEventArgs <G> args) where G : IGroupState <G>, new()
        {
            PrintStackPointers(args.ExecutionState);
            PrintGroupPointers(args.ExecutionState);
            PrintStackRegister(args.ExecutionState);
            PrintListRegister(args.ExecutionState);

            Instruction <G> instruction = args.ExecutionState.GroupState.Group.Instructions[args.ExecutionState.InstructionIndex];

            Debug.WriteLine($"\nInstruction: {args.ExecutionState.InstructionIndex}. {instruction.Code} {string.Join(", ", instruction.Payload?.Select(item => ToValueString(item)) ?? Enumerable.Empty<string>())} \n {(instruction.SourcePosition != null ? EngineUtils.GetLineAtPosition(code, instruction.SourcePosition.Value, 100) : null)}");
        }
        protected override void Radio_Interrupted(object sender, InterruptedEventArgs e)
        {
            if (!e.StatusRegister.ReceiveDataReady) return;
            base.Radio_Interrupted(sender, e);

            DataArrived?.Invoke(this, Reader.ReadBufferAll());
            lock (SyncRoot)
            {
                Radio.OperatingMode = OperatingModes.StandBy;
                e.StatusRegister.ResetToDefault();
                e.StatusRegister.Save();
                Radio.OperatingMode = OperatingModes.ReceiveMode;
            }
        }
        protected override void Radio_Interrupted(object sender, InterruptedEventArgs e)
        {
            if (!e.StatusRegister.TransmitDataSent && !e.StatusRegister.MaximunTransmitRetries) return;
            base.Radio_Interrupted(sender, e);

            Writer.FlushBuffer();
            MaxRetries = e.StatusRegister.MaximunTransmitRetries;
            lock (SyncRoot)
            {
                Radio.OperatingMode = OperatingModes.StandBy;
                e.StatusRegister.ResetToDefault();
                e.StatusRegister.Save();
                Radio.OperatingMode = OperatingModes.TransmitMode;
                _sentEvent.Set();
            }
        }
        protected override void Radio_Interrupted(object sender, InterruptedEventArgs e)
        {
            if (!e.StatusRegister.ReceiveDataReady)
            {
                return;
            }
            base.Radio_Interrupted(sender, e);

            DataArrived?.Invoke(this, Reader.ReadBufferAll());
            lock (SyncRoot)
            {
                Radio.OperatingMode = OperatingModes.StandBy;
                e.StatusRegister.ResetToDefault();
                e.StatusRegister.Save();
                Radio.OperatingMode = OperatingModes.ReceiveMode;
            }
        }
        protected override void Radio_Interrupted(object sender, InterruptedEventArgs e)
        {
            if (!e.StatusRegister.TransmitDataSent && !e.StatusRegister.MaximunTransmitRetries)
            {
                return;
            }
            base.Radio_Interrupted(sender, e);

            Writer.FlushBuffer();
            MaxRetries = e.StatusRegister.MaximunTransmitRetries;
            lock (SyncRoot)
            {
                Radio.OperatingMode = OperatingModes.StandBy;
                e.StatusRegister.ResetToDefault();
                e.StatusRegister.Save();
                Radio.OperatingMode = OperatingModes.TransmitMode;
                _sentEvent.Set();
            }
        }
        protected override void Radio_Interrupted(object sender, InterruptedEventArgs e)
        {
            base.Radio_Interrupted(sender, e);

            //lock (SyncRoot)
            {
                MaxRetries = e.StatusRegister.MaximunTransmitRetries;
                if (MaxRetries || e.StatusRegister.TransmitDataSent)
                    _sendCompleteEvent.Set();
                if (e.StatusRegister.ReceiveDataReady)
                    DataArrived?.Invoke(this, Reader.ReadBufferAll());
                lock (SyncRoot)
                {
                    Radio.OperatingMode = OperatingModes.StandBy;
                    e.StatusRegister.ResetToDefault();
                    e.StatusRegister.Save();
                    if (!_isSending)
                        Radio.OperatingMode = OperatingModes.ReceiveMode;
                }
            }
        }
 protected virtual void Radio_Interrupted(object sender, InterruptedEventArgs e)
 {
 }
 protected virtual void Radio_Interrupted(object sender, InterruptedEventArgs e)
 {
 }