public Beep ReadBeep(Stream stream)
        {
            Beep  beep               = null;
            Byte  bytesAmount        = 16 / 8;
            Int32 frequencyBlockCode = 1;
            Int32 durationBlockCode  = 1;

            Byte[] frequencyBytes = new Byte[bytesAmount];
            Byte[] durationBytes  = new Byte[bytesAmount];

            frequencyBlockCode = stream.Read(
                frequencyBytes,
                0,
                bytesAmount
                );
            durationBlockCode = stream.Read(
                durationBytes,
                0,
                bytesAmount
                );

            if (
                frequencyBlockCode != 0 &&
                durationBlockCode != 0
                )
            {
                beep = new Beep(
                    BitConverter.ToUInt16(frequencyBytes, 0),
                    BitConverter.ToUInt16(durationBytes, 0)
                    );
            }

            return(beep);
        }
 public void Beep(Beep beep)
 {
     Console.Beep(
         beep.Frequency,
         beep.Duration
         );
 }
Ejemplo n.º 3
0
        /// <summary>
        ///   beep
        /// </summary>
        internal void SoundBeep()
        {
#if !PocketPC
            SystemSounds.Beep.Play();
#else
            Beep.Play();
#endif
        }
Ejemplo n.º 4
0
 public void WriteBeep(Beep @object)
 {
     _beepWriter.WriteBeep(
         _stream,
         @object
         );
     _beeper.Beep(@object);
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please Enter The key");
            int  _key = int.Parse(Console.ReadLine());
            Beep beep = new Beep();

            beep.Start(_key);
        }
Ejemplo n.º 6
0
        public void BeepBadDuration()
        {
            Beep task = new Beep();
            task.BuildEngine = new MockBuild();
            task.Duration = 0;

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
        public Beep ReadBeep()
        {
            Beep beep = _beepReader.ReadBeep(_stream);

            _beeper.Beep(beep);

            return(beep);
        }
Ejemplo n.º 8
0
        public void BeepBadFrequency()
        {
            Beep task = new Beep();
            task.BuildEngine = new MockBuild();
            task.Frequency = 0;

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
        public void BeepBadFrequency()
        {
            Beep task = new Beep();

            task.BuildEngine = new MockBuild();
            task.Frequency   = 0;

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
        public void BeepBadDuration()
        {
            Beep task = new Beep();

            task.BuildEngine = new MockBuild();
            task.Duration    = 0;

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
Ejemplo n.º 11
0
        public void BeepCustom()
        {
            Beep task = new Beep();
            task.BuildEngine = new MockBuild();
            task.Frequency = 440;
            task.Duration = 400;

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
Ejemplo n.º 12
0
        public void TestCommandBeep()
        {
            var cmd = new Beep()
            {
                Duration = 500
            };

            Assert.AreEqual("{\"cmd\":\"beep\", \"arg\":\"500\"}", cmd.ToString());
        }
        public void BeepCustom()
        {
            Beep task = new Beep();

            task.BuildEngine = new MockBuild();
            task.Frequency   = 440;
            task.Duration    = 400;

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
Ejemplo n.º 14
0
        static void Main()
        {
            Beep beep = new Beep();

            beep.Count = 5;

            beep.Pause = 1;

            beep.multiBeep();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Inits this scanner.
        /// </summary>
        public void Init()
        {
            scanner          = new Scanner();
            scanner.RdMode   = "MB";  // M = Momentary switching mode -> On Code a time; B = Beeper -> beep after successful read
            scanner.RdType   = "A,M"; // A = UPC; M = Code-39
            scanner.OnDone  += new EventHandler(scanner_OnDone);
            scanner.PortOpen = true;

            beeper = new Beep();
        }
Ejemplo n.º 16
0
        public void BeepDefault()
        {
            Beep task = new Beep();
            task.BuildEngine = new MockBuild();

            // assert default values
            Assert.AreEqual(800, task.Frequency, @"Wrong default frequency");
            Assert.AreEqual(200, task.Duration, @"Wrong default duration");

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
        public void BeepDefault()
        {
            Beep task = new Beep();

            task.BuildEngine = new MockBuild();

            // assert default values
            Assert.AreEqual(800, task.Frequency, @"Wrong default frequency");
            Assert.AreEqual(200, task.Duration, @"Wrong default duration");

            Assert.IsTrue(task.Execute(), @"Beep task failed");
        }
Ejemplo n.º 18
0
 public BHTController()
 {
     try
     {
         MyBeep = new Beep();
         MyLed  = new LED();
     }
     catch (Exception ex)
     {
         MyScanner = (Scanner)null;
         MessageBox.Show("Error: Please make sure kbif software is not running " + ex.Message, "Scan Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
     }
 }
 public String this[Beep beep]
 {
     get
     {
         // This indexer is very simple, and just returns or sets
         // the corresponding element from the internal dictionary.
         return(this.Stuff[beep]);
     }
     set
     {
         this.Stuff[beep] = value;
     }
 }
Ejemplo n.º 20
0
        private void VbaBeepCallback()
        {
            if (_suppressed)
            {
                return;
            }

            var e = new BeepEventArgs();

            Beep?.Invoke(this, e);

            if (!e.Handled)
            {
                _vbeApi.Beep();
            }
        }
Ejemplo n.º 21
0
        public IEnumerable <Beep> ReadBeeps()
        {
            List <Beep> beeps = new List <Beep>();
            Beep        beep  = null;

            do
            {
                beep = _beepReader.ReadBeep(_stream);
                if (beep != null)
                {
                    beeps.Add(beep);
                    _beeper.Beep(beep);
                }
            }while (beep != null);

            return(beeps);
        }
        public void WriteBeep(
            Stream stream,
            Beep beep
            )
        {
            Byte bytesAmount = 16 / 8;

            byte[] frequencyBytes = BitConverter.GetBytes(beep.Frequency);
            byte[] durationBytes  = BitConverter.GetBytes(beep.Duration);

            stream.Write(
                frequencyBytes,
                0,
                bytesAmount
                );
            stream.Write(
                durationBytes,
                0,
                bytesAmount
                );
        }
        public void ReadBeep_ReadNormalBeep_WritedBeepAreEqualReadedBeep()
        {
            String fileName = "test.txt";
            {
                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
            }
            Beep beep = new Beep(
                40,
                133
                );
            Stream stream = new FileStream(
                fileName,
                FileMode.CreateNew
                );
            {
                IBeepStreamWriter streamWriter = new BeepStreamWriter();

                streamWriter.WriteBeep(
                    stream,
                    beep
                    );
            }
            IBeeper           beeper       = new StubConsoleBeeper();
            IBeepStreamReader streamReader = new BeepStreamReader();
            IBeepingReader    reader       = new BeepingReader(
                stream,
                beeper,
                streamReader
                );

            Beep readedBeep = reader.ReadBeep();

            Assert.AreEqual <Beep>(
                beep,
                readedBeep
                );
        }
Ejemplo n.º 24
0
 internal void OnBeep()
 {
     Beep?.Invoke();
 }
 public void Beep(Beep beep)
 {
     Console.WriteLine("Beep!");
 }
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.ToString()));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString()));
            }

            if (Muted != null)
            {
                p.Add(new KeyValuePair <string, string>("Muted", Muted.Value.ToString()));
            }

            if (Beep != null)
            {
                p.Add(new KeyValuePair <string, string>("Beep", Beep.ToString()));
            }

            if (StartConferenceOnEnter != null)
            {
                p.Add(new KeyValuePair <string, string>("StartConferenceOnEnter", StartConferenceOnEnter.Value.ToString()));
            }

            if (EndConferenceOnExit != null)
            {
                p.Add(new KeyValuePair <string, string>("EndConferenceOnExit", EndConferenceOnExit.Value.ToString()));
            }

            if (WaitUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitUrl", WaitUrl.ToString()));
            }

            if (WaitMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitMethod", WaitMethod.ToString()));
            }

            if (EarlyMedia != null)
            {
                p.Add(new KeyValuePair <string, string>("EarlyMedia", EarlyMedia.Value.ToString()));
            }

            if (MaxParticipants != null)
            {
                p.Add(new KeyValuePair <string, string>("MaxParticipants", MaxParticipants.Value.ToString()));
            }

            if (ConferenceRecord != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecord", ConferenceRecord.ToString()));
            }

            if (ConferenceTrim != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceTrim", ConferenceTrim));
            }

            if (ConferenceStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallback", ConferenceStatusCallback.ToString()));
            }

            if (ConferenceStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallbackMethod", ConferenceStatusCallbackMethod.ToString()));
            }

            if (ConferenceStatusCallbackEvent != null)
            {
                p.AddRange(ConferenceStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("ConferenceStatusCallbackEvent", prop)));
            }

            return(p);
        }
 public string this[Beep beep]
 {
     get { return(_stuff[beep]); }
     set { _stuff[beep] = value; }
 }
Ejemplo n.º 28
0
 public static void Main()
 {
     Beep.MessageBeep(Beep.BeepTypes.Exclamation);
 }
Ejemplo n.º 29
0
 public BeepConsoleCommand(IConnection connection)
     : base("Beep", "Beep the sound on the unit")
 {
     _connection = connection;
     _beep       = new Beep(connection);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// using static imports static members of types directly into scope.
 /// </summary>
 /// <example>
 /// using static System.Media.SystemSounds;
 /// </example>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUsingStaticMembers_Click(object sender, EventArgs e)
 {
     Beep.Play();
 }
 private void OnBeep()
 {
     Beep?.Invoke();
 }
 public string this[Beep beep]
 {
     get { return(_stuff[beep]); }
 }
Ejemplo n.º 33
0
 public virtual IEnumerator <ITask> BeepHandler(Beep beep)
 {
     return(PlaySound(beep.Body.Synchronous, beep.ResponsePort, SystemSounds.Beep));
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Start my timer.
 /// </summary>
 public void Start()
 {
     Thread.Sleep(_time);
     Beep?.Invoke(this, new TimerEventArgs($"{_time} ms have passed", _time));
 }