public RemoteEditor(Common.ConfigObjects.Remote remoteConfig, string remoteName)
 {
     if (remoteConfig == null)
     {
         throw new ArgumentNullException(nameof(remoteConfig));
     }
     RemoteConfig = remoteConfig;
     _remoteName  = remoteName;
 }
示例#2
0
        public CachedRemote(Common.ConfigObjects.Remote remoteConfig)
        {
            Frequency = remoteConfig.Frequency;
            DutyCycle = remoteConfig.DutyCycle;
            if (remoteConfig.InterButtonSleepMilliseconds > Common.ConfigObjects.Remote.InterButtonSleepMilliseconds_Max)
            {
                throw new Exception("Inter-button sleep period too long.");
            }
            InterButtonSleep = TimeSpan.FromMilliseconds(remoteConfig.InterButtonSleepMilliseconds);

            foreach (var buttonConfig in remoteConfig.Buttons)
            {
                var irData = new RaspberryIRDotNet.IRPulseMessage(buttonConfig.ReadData(), remoteConfig.UnitDuration);
                _cachedButtons.Add(buttonConfig.Name, irData);
            }
        }