public RequestProcessor(SchedulingCore scheduler, KnobSet knob, AudioCore audio, FileCore files)
 {
     _audio = audio;
     _knob = knob;
     _scheduler = scheduler;
     _fileSystem = files;
 }
Пример #2
0
        public void AddItem(AudioCore.MediaEntry item, SchedulingCore.InsertMode insertMode, int index)
        {
            item.TaskSource = AudioCore.MediaEntry.Source.Knob;
            item.EndTime = TimeSpan.MinValue;

            if (index == -1)
            {
                lock (_lock)
                    KnobEntries.Add(item);

                SaveSchedule();

                return;
            }

            try
            {
                switch (insertMode)
                {
                    case SchedulingCore.InsertMode.After:
                        KnobEntries.Insert(index + 1, item);
                        break;

                    case SchedulingCore.InsertMode.Before:
                        KnobEntries.Insert(index, item);
                        break;

                    case SchedulingCore.InsertMode.Replace:
                        KnobEntries[index] = item;
                        break;
                }
            }
            catch
            {
                lock (_lock)
                    KnobEntries.Add(item);
            }

            SaveSchedule();
        }
Пример #3
0
        public KnobSet(IRotaryEncoder rotaryEncoder, ILCDCharDisplay charDisplay, AudioCore audio, SchedulingCore scheduler, LocalControlModule lcm)
        {
            PlayModeActivated = true;
            _audio = audio;
            _lcm = lcm;
            _currentButtonState = (ButtonState) (-1);
            _position = -1;
            _playingPosition = -1;
            _playing = false;
            _isKnobPressed = false;
            KnobEntries = new ArrayList();

            _encoder = rotaryEncoder;

            // TODO : Optimize is to not to install eventhandlers when knob is disabled by user settings
            // TODO : also no need to load the knob file
            _encoder.RotaryMoved += EncoderMoved;
            _encoder.ButtonStateChanged += EncoderButtonStateChanged;
            _encoder.RotaryMoved += _lcm.EncoderMoved;

            Parse();
        }
Пример #4
0
 public WebServer(SchedulingCore scheduler, KnobSet knob, AudioCore audio, FileCore files)
 {
     _processor = new RequestProcessor(scheduler, knob, audio, files);
 }
 public void SetScheduler(SchedulingCore scheduler)
 {
     _scheduler = scheduler;
 }
Пример #6
0
        public Scii()
        {
            _lcdDisplay = new CharDisplay();

            PrintScreen("Schedulon II", "by Technomad LLC");
            Thread.Sleep(1000);
            PrintScreen("Audio.", "       Anywhere.");
            Thread.Sleep(1000);
            _lcdDisplay.Clear();
            PrintScreen("Schedulon II");

            Log.LogFileName = Settings.FileSystem.RootDir + Settings.FileSystem.SystemDir + @"log\logfile.txt";
            Log.InsertBlankLine();
            Log.WriteString(LogMessageType.Info, "Application start");

            IRotaryEncoder rotaryEncoder = new RotaryEncoder();
            IAudioRecordPlayer audioplayer = new AudioPlayer();

            var audioCore = new AudioCore(audioplayer);
            audioCore.NowPlaying += OnNowPlaying;
            audioCore.NowRecording += OnNowRecording;

            var lcm = new LocalControlModule(_lcdDisplay, rotaryEncoder, audioCore);
            var schedulingCore = new SchedulingCore(audioCore, _lcdDisplay, lcm);

            var knobSet = new KnobSet(rotaryEncoder, _lcdDisplay, audioCore, schedulingCore, lcm);

            var fileCore = new FileCore();

            try
            {
                Settings.Load();
            }
            catch (Exception e)
            {
                Log.WriteException(e, "Error loading system settings. System locked");
                PrintScreen("System halted", "Settings error");
                Thread.Sleep(Timeout.Infinite);
            }

            if (Settings.Web.UseLlmnr)
            {
                _llmnr = new LinkLocalMultiCastNameResolution("Schedulon");
                _llmnr.Start(IPAddress.Parse("10.0.0.110"));
            }

            var webServer = new WebServer(schedulingCore, knobSet, audioCore, fileCore);

            var webserverThread = new Thread(webServer.Run);
            webserverThread.Start();
        }