Exemplo n.º 1
0
        internal void Say(
            string who,
            string what,
            Vector3 where,
            AssignedVoice v,
            bool doRotate,
            BeepType beep)
        {
            if (queue == null)
            {
                return;
            }

            QueuedSpeech e = new QueuedSpeech(
                subs.FixExpressions(who),
                subs.FixExpressions(what),
                where, v, false, doRotate, beep);

            // Put that on the queue and wake up the background thread.
            lock (queue)
            {
                queue.Enqueue(e);
                Monitor.Pulse(queue);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Play the specified sound (as defined in the Sound control panel).
 /// </summary>
 public static void MessageBeep(BeepType type = BeepType.SimpleBeep)
 {
     if (!Imports.MessageBeep(type))
     {
         throw Errors.GetIoExceptionForLastError();
     }
 }
Exemplo n.º 3
0
        public void Beep_Template(EngineState s, string rawCode, BeepType beepType)
        {
            CodeParser  parser = new CodeParser(EngineTests.DummySection(), Global.Setting, EngineTests.Project.Compat);
            CodeCommand cmd    = parser.ParseStatement(rawCode);

            CodeInfo_Beep info = cmd.Info.Cast <CodeInfo_Beep>();

            Assert.IsTrue(info.Type == beepType);
        }
Exemplo n.º 4
0
 void OnBeep(BeepType type)
 {
     if (Beeped != null)
     {
         var e = new BeepEventArgs();
         e.Type = type;
         Beeped(this, e);
     }
 }
Exemplo n.º 5
0
        public void Beep_Template(EngineState s, string rawCode, BeepType beepType)
        {
            SectionAddress addr = EngineTests.DummySectionAddress();
            CodeCommand    cmd  = CodeParser.ParseStatement(rawCode, addr);

            Debug.Assert(cmd.Info.GetType() == typeof(CodeInfo_Beep));
            CodeInfo_Beep info = cmd.Info as CodeInfo_Beep;

            Assert.IsTrue(info.Type == beepType);
        }
Exemplo n.º 6
0
 internal QueuedSpeech(string who, string what,
                       Vector3 where, AssignedVoice v, bool action,
                       bool doRotate, BeepType b)
 {
     speaker   = who;
     message   = what;
     position  = where;
     voice     = v;
     isAction  = action;
     isSpatial = doRotate;
     beep      = b;
 }
Exemplo n.º 7
0
 internal QueuedSpeech(string who, string what,
     Vector3 where, AssignedVoice v, bool action,
     bool doRotate, BeepType b)
 {
     speaker = who;
     message = what;
     position = where;
     voice = v;
     isAction = action;
     isSpatial = doRotate;
     beep = b;
 }
Exemplo n.º 8
0
        public static void Beep(BeepType type)
        {
            uint beeptype = 0;

            if (type == BeepType.Default)
            {
                beeptype = 0xffffffff;
            }
            else
            {
                beeptype = Convert.ToUInt32(type);
            }
            MessageBeep(beeptype);
        }
Exemplo n.º 9
0
        private MifareResponse sendBeepRequest(BeepType beepType)
        {
            byte[] readBuffer  = new byte[64];
            int    offset      = 0;
            int    bytesToRead = 0;

            WriteCommand(Command.SET_BUZZER_BEEP, NODE_BROADCAST, (byte)beepType);

            // Naive busy way. Rewrite to consumer stream pull!
            do
            {
                Thread.Sleep(50);
                bytesToRead = port.BytesToRead;
            } while (bytesToRead == 0);

            // TODO: Use callback, make response parser able to read lazily from input stream
            int bytesRead = port.Read(readBuffer, offset, bytesToRead);

            // Evaluate data in buffer

            MifareResponse response = new MifareResponse();

            ushort length = readBuffer.Subset(2, 2).ToUInt16();
            //Console.WriteLine ("Length: {0} ( {1})", length, readBuffer.Subset (2, 2).ToHex ());

            ushort nodeID = readBuffer.Subset(4, 2).ToUInt16();

            //Console.WriteLine ("NodeID: {0} ( {1})", nodeID, readBuffer.Subset (4, 2).ToHex ());
            response.NodeId = nodeID;

            ushort commandCode = readBuffer.Subset(6, 2).ToUInt16();

            //Console.WriteLine ("Command: {0} ( {1})", Enum.GetName (typeof(CommandCode), commandCode), readBuffer.Subset (6, 2).ToHex ());
            response.Command = (Command)commandCode;

            byte responseCode = readBuffer[8];

            //Console.WriteLine ("Response Code: {0} ( {1})", Enum.GetName (typeof(ResponseCode), responseCode), responseCode.ToHex ());
            response.Response = (Response)responseCode;

            //byte checksum = readBuffer [readBuffer.Length-1];
            byte checksum = readBuffer[4 + length];

            byte calculatedChecksum = CalcCheckSum(readBuffer, 4, 4 + length);

            validateChecksum(checksum, calculatedChecksum);

            return(response);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Beeps the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        public void Beep(BeepType type)
        {
            Thread beeperThread = new Thread(new ThreadStart(delegate()
            {
                switch (type)
                {
                case BeepType.TicketRedeemed:
                    beeper.OnTime    = 1;
                    beeper.OffTime   = 2;
                    beeper.Count     = 2;
                    beeper.Frequency = 1;
                    DNWA.BHTCL.Beep.Settings.Volume = DNWA.BHTCL.Beep.Settings.EN_VOLUME.LEVEL3;
                    beeper[DNWA.BHTCL.Beep.Settings.EN_DEVICE.BUZZER] = DNWA.BHTCL.Beep.EN_CTRL.ON;
                    break;

                case BeepType.Error:
                    beeper.OnTime    = 5;
                    beeper.OffTime   = 5;
                    beeper.Count     = 1;
                    beeper.Frequency = 0;
                    DNWA.BHTCL.Beep.Settings.Volume = DNWA.BHTCL.Beep.Settings.EN_VOLUME.LEVEL5;
                    beeper[DNWA.BHTCL.Beep.Settings.EN_DEVICE.BUZZER] = DNWA.BHTCL.Beep.EN_CTRL.ON;
                    break;

                case BeepType.Attention:
                    beeper.OnTime    = 1;
                    beeper.OffTime   = 1;
                    beeper.Count     = 10;
                    beeper.Frequency = 2;
                    DNWA.BHTCL.Beep.Settings.Volume = DNWA.BHTCL.Beep.Settings.EN_VOLUME.LEVEL5;
                    beeper[DNWA.BHTCL.Beep.Settings.EN_DEVICE.BUZZER] = DNWA.BHTCL.Beep.EN_CTRL.ON;
                    break;

                default:
                    beeper.OnTime    = 10;
                    beeper.Count     = 1;
                    beeper.Frequency = 1;
                    DNWA.BHTCL.Beep.Settings.Volume = DNWA.BHTCL.Beep.Settings.EN_VOLUME.LEVEL1;
                    beeper[DNWA.BHTCL.Beep.Settings.EN_DEVICE.BUZZER] = DNWA.BHTCL.Beep.EN_CTRL.ON;
                    break;
                }
            }));

            beeperThread.IsBackground = true;
            beeperThread.Start();
        }
Exemplo n.º 11
0
        /// <summary>
        /// Beeps the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        public void Beep(BeepType type)
        {
            Thread beeper = new Thread(new ThreadStart(delegate()
            {
                switch (type)
                {
                case BeepType.TicketRedeemed:
                    beep.Duration  = 100;
                    beep.Frequency = 5000;
                    beep.Volume    = 3;
                    beep.State     = NotifyState.CYCLE;
                    Thread.Sleep(150);
                    beep.State = NotifyState.CYCLE;
                    break;

                case BeepType.Error:
                    beep.Duration  = 500;
                    beep.Frequency = 1000;
                    beep.Volume    = 5;
                    beep.State     = NotifyState.CYCLE;
                    break;

                case BeepType.Attention:
                    beep.Duration  = 50;
                    beep.Frequency = 7500;
                    beep.Volume    = 5;
                    for (int i = 0; i < 10; ++i)
                    {
                        beep.State = NotifyState.CYCLE;
                        Thread.Sleep(75);
                    }
                    break;

                default:
                    beep.Duration  = 1000;
                    beep.Frequency = 3000;
                    beep.Volume    = 1;
                    beep.State     = NotifyState.CYCLE;
                    break;
                }
            }));

            beeper.IsBackground = true;
            beeper.Start();
        }
Exemplo n.º 12
0
 public static void Beep(BeepType type = BeepType.SimpleBeep)
 {
     MessageBeep((uint)type);
 }
Exemplo n.º 13
0
		public static void Beep(BeepType type)
		{
			uint beeptype = 0;
			if(type==BeepType.Default)
			{
				beeptype = 0xffffffff;
			}
			else
			{
				beeptype = Convert.ToUInt32(type);
			}
			MessageBeep(beeptype);
		}
Exemplo n.º 14
0
 /// <summary>
 /// Method to call interop for system beep
 /// </summary>
 /// <remarks>Calls Windows to make computer beep</remarks>
 /// <param name="type">The kind of beep you would like to hear</param>
 public static void MessageBeep(BeepType type)
 {
     MessageBeep((uint)type);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Play the specified sound (as defined in the Sound control panel).
 /// </summary>
 public static void MessageBeep(BeepType type = BeepType.SimpleBeep)
 => Error.ThrowLastErrorIfFalse(Imports.MessageBeep(type));
Exemplo n.º 16
0
        internal void Say(
            string who,
            string what,
            Vector3 where,
            AssignedVoice v,
            bool doRotate,
            BeepType beep)
        {
            if (queue == null) return;

            QueuedSpeech e = new QueuedSpeech(
                subs.FixExpressions(who),
                subs.FixExpressions(what),
                where, v, false, doRotate, beep);

            // Put that on the queue and wake up the background thread.
            lock (queue)
            {
                queue.Enqueue(e);
                Monitor.Pulse(queue);
            }
        }
Exemplo n.º 17
0
		public static extern bool MessageBeep(BeepType beepType);
Exemplo n.º 18
0
 public static extern bool Play(BeepType BeepType);
Exemplo n.º 19
0
 internal void SayMore(string message, BeepType beep)
 {
     FirstCheck();
     Say(null, message, SYSTEMPOSITION, SystemVoice, false, beep);
 }
Exemplo n.º 20
0
 public static void MessageBeep(BeepType type = BeepType.SimpleBeep) => ErrorMethods.MessageBeep(type);
Exemplo n.º 21
0
 internal static extern bool MessageBeep(BeepType type);
Exemplo n.º 22
0
 public static extern bool Play(BeepType BeepType);
Exemplo n.º 23
0
 public void BasicMessageBeep(BeepType type)
 {
     ErrorMethods.MessageBeep(type);
 }
		/// <summary>
		/// Method to call interop for system beep
		/// </summary>
		/// <remarks>Calls Windows to make computer beep</remarks>
		/// <param name="type">The kind of beep you would like to hear</param>
		public static void MessageBeep(BeepType type)
		{
			MessageBeep((uint)type);
		}
Exemplo n.º 25
0
 static extern bool MessageBeep(BeepType uType);
Exemplo n.º 26
0
 internal static extern bool MessageBeep(BeepType type);
Exemplo n.º 27
0
 public void BasicMessageBeep(BeepType type)
 {
     Windows.MessageBeep(type);
 }
Exemplo n.º 28
0
 void OnBeep(BeepType type)
 {
     if (Beeped != null)
     {
         var e = new BeepEventArgs();
         e.Type = type;
         Beeped(this, e);
     }
 }
Exemplo n.º 29
0
 internal void SayMore(string message, BeepType beep)
 {
     FirstCheck();
     Say(null, message, SYSTEMPOSITION, SystemVoice, false, beep);
 }
Exemplo n.º 30
0
 public static extern bool MessageBeep(BeepType Type);
Exemplo n.º 31
0
 /* Methode zur Ausgabe eines Piepstons */
 public static bool MessageBeep(BeepType beepType)
 {
     return(MessageBeep((uint)beepType) != 0);
 }