Click or drag to resize
BioRadioDeviceEventMarkerButtonPushed Event
Event Handler for Event Marker Push Button

Namespace: GLNeuroTech.Devices.BioRadio
Assembly: BioRadioAPI (in BioRadioAPI.dll) Version: 1.0.266.19973 (1.0.266.19973)
Syntax
public event EventHandler<BioRadioButtonEventArgs> EventMarkerButtonPushed

Value

Type: SystemEventHandlerBioRadioButtonEventArgs
Examples
C#
using System;
using GLNeuroTech.Devices.BioRadio;

namespace BioRadioAPIExamples
{
    public class EventButtonPress
    {

        /// <summary>
        /// This sample method will connect to a device at the given mac ID and subscribe to the BioRadio button pressed event.
        /// The subscribed method will output the time of each button press to the console.
        /// </summary>
        public static void SubscribeToButtonPressEvent(long macID)
        {
            var bioRadioDeviceManager = new BioRadioDeviceManager();
            var connectedBioRadio = bioRadioDeviceManager.GetBluetoothDevice(macID);

            // Subscribe to be notified when the BioRadio event button is pressed
            connectedBioRadio.EventMarkerButtonPushed += new EventHandler<BioRadioButtonEventArgs>(ButtonPressed);

            connectedBioRadio.StartAcquisition();
            while (!Console.KeyAvailable)
            {
                ClearBuffers(connectedBioRadio);
            }
            connectedBioRadio.StopAcquisition();
            connectedBioRadio.Disconnect();
            connectedBioRadio.Dispose();
        }

        private static void ClearBuffers(BioRadioDevice connectedBioRadio)
        {
            foreach (var signalGroup in connectedBioRadio.SignalGroups)
            {
                foreach (BioRadioSignal signal in signalGroup)
                {
                    var samples = signal.GetScaledValueArray();
                }
            }
        }

        // Raised when BioRadio button is Pressed
        public static void ButtonPressed(object o, BioRadioButtonEventArgs e)
        {
            Console.WriteLine("The BioRadio hardware button was pressed at: " + e.PressedTime);
        }
    }
}
See Also