Пример #1
0
        public void InitKeyboard(Device p_Device, IHidDevice p_IHidDevice)
        {
            m_Device = p_Device;
            m_HidDeviceEvents_HidDataReceivedEventHandler = new EventHandler<HidDataReceivedEventArgs>(HidDataReceived);
            m_IHidDevice = p_IHidDevice;
            m_IHidDevice.DataReceived += m_HidDeviceEvents_HidDataReceivedEventHandler;

            m_Keys = 2;
            m_ProgrammableKeys = 0;

            #region Feature Report??
            //////////////////////////////////////////////
            // hier muss vom Aerion abgefragt werden, wieviele Tasten er hat
            // und der InitKeyboard entsprechend aufgerufen werden.
            // irgendwie so:
            // HidReport m_HIDFeatureReport = p_IHidDevice.ReadFeatureReport();
            /*
            try
            {
                byte[] buffer = {
                        p_HidDataReceivedEventArgs[1],
                        p_HidDataReceivedEventArgs[2],
                        p_HidDataReceivedEventArgs[3],
                        p_HidDataReceivedEventArgs[4],
                        p_HidDataReceivedEventArgs[5],
                        p_HidDataReceivedEventArgs[6],
                    };

                System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer, 0, buffer.Length);
                System.IO.BinaryReader reader = new System.IO.BinaryReader(stream);

                m_keys = Convert.ToInt64(reader.ReadInt16());
                bool status = reader.ReadBoolean();

            }

            catch (Exception e)
            {
                Console.Out.WriteLine("Exception: {0}", e.GetType());
            }
            */
            #endregion

            m_KeyDownList = new BitArray(8, false);
            m_KeyNameList = new string[m_Keys];
            m_KeyLabelList = new string[m_Keys];
        }
Пример #2
0
        /// <summary>
        /// Clean up managed and unmanged ressources by hand.
        /// </summary>
        /// <param name="Disposing"></param>
        protected void Dispose(bool Disposing)
        {
            if (!IsDisposed)
            {
                if (Disposing)
                {
                    //Clean Up managed resources
                    m_IHidDevice = null;
                    m_Device = null;

                    //Ensure we clean-up references to event
                    m_KeyUp = null;
                    m_KeyDown = null;
                }
                //Clean up unmanaged resources

            }
            IsDisposed = true;
        }
Пример #3
0
 public void InitSensor(Device p_Device, IHidDevice p_IHidDevice)
 {
     m_Device = p_Device;
     m_HidDeviceEvents_HidDataReceivedEventHandler = new EventHandler<HidDataReceivedEventArgs>(HidDataReceived);
     m_IHidDevice = p_IHidDevice;
     m_IHidDevice.DataReceived += m_HidDeviceEvents_HidDataReceivedEventHandler;
 }