예제 #1
0
        private void LoadDeviceInfo(MusiaDeviceInfo deviceInfo)
        {
            _deviceInfo = deviceInfo;

            tbFirmware.Text        = deviceInfo.Version.ToString(2);
            tbHardware.Text        = deviceInfo.HardwareRevision.ToString();
            tbMCUId.Text           = _intf.GetDevice().GetSerialNumber();
            tbMicroController.Text = deviceInfo.DeviceTypeName;

            rbOutputPS2.Checked             = deviceInfo.Output == MusiaDeviceInfo.OutputMode.PS2;
            rbOutputPC.Checked              = deviceInfo.Output == MusiaDeviceInfo.OutputMode.PC;
            cbPollingFrequency.SelectedItem = deviceInfo.PollingFrequency;
        }
예제 #2
0
        public MusiaSettingsDialog(MusiaConfigInterface intf) : this()
        {
            _intf = intf;

            using (HidStream stream = intf.Open()) {
                var frInfo = new byte[9];
                frInfo[0] = MusiaDeviceInfo.CFG_CMD_INFO;
                stream.GetFeature(frInfo);

                var frConfig = new byte[9];
                frConfig[0] = MusiaDeviceInfo.CFG_CMD_READ;
                stream.GetFeature(frConfig);

                var deviceInfo = new MusiaDeviceInfo();
                if (deviceInfo.Parse(frInfo, frConfig))
                {
                    LoadDeviceInfo(deviceInfo);
                }
                else
                {
                    throw new InvalidOperationException("Invalid settings container received from MUNIA device");
                }
            }
        }