public ETWindowViewModel()
        {
            _fittingFramework         = new FittingFramework();
            SelectedCommunicationType = DeviceCommunicationType.Simulation;
            SelectedEarType           = Ear.Both;
            _fittingFramework.SwitchCommunicationType(SelectedCommunicationType);

            ConnectCommand    = new DelegateCommand(Connect, CanConnect);
            DisConnectCommand = new DelegateCommand(DisConnect, CanDisConnect);

            ReadMDACommand = new DelegateCommand(ReadMDA, CanReadMDA);
        }
        private void InitializeDevice(Ear ear, DeviceCommunicationType deviceConnectionType)
        {
            SwitchCommInterface(ear, deviceConnectionType);

            //Create the Module and Initialize here
            // Need memory map or json file to create and initialize all modules
            _deviceModules = new Dictionary <string, IModule>
            {
                { ModuleName.MDA_MODULE, new MDAModule(_communicator) },

                { ModuleName.WDRC_MODULE, new WDRCModule(_communicator) }
            };
        }
        public bool SwitchCommInterface(Ear ear, DeviceCommunicationType deviceConnectionType)
        {
            bool isCommSwitched = false;

            try
            {
                if (DeviceCommType != deviceConnectionType || _communicator == null)
                {
                    //Diconnect Current Communication
                    _communicator?.Disconnect();

                    switch (deviceConnectionType)
                    {
                    case DeviceCommunicationType.Simulation:
                    {
                        _communicator = new SimulatedCommunication(ear);
                        break;
                    }

                    case DeviceCommunicationType.Wired:
                    {
                        _communicator = new WiredCommunication(ear);
                        break;
                    }

                    case DeviceCommunicationType.WiredCTK:
                    {
                        _communicator = new WiredCTKCommunication(ear);
                        break;
                    }

                    case DeviceCommunicationType.Wireless:
                    {
                        _communicator = new WirelessCommunication(ear);
                        break;
                    }
                    }
                    DeviceCommType = deviceConnectionType;
                    isCommSwitched = true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                isCommSwitched = false;
            }
            return(isCommSwitched);
        }
示例#4
0
        public bool SwitchCommunicationMode(DeviceCommunicationType deviceConnectionType)
        {
            bool isCommSwitched = false;

            try
            {
                _leftHearinAid.Disconnect();
                _righttHearinAid.Disconnect();
                _leftHearinAid   = new Processor(Ear.Left, deviceConnectionType);
                _righttHearinAid = new Processor(Ear.Right, deviceConnectionType);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                isCommSwitched = false;
            }
            return(isCommSwitched);
        }
 public bool SwitchCommunicationType(DeviceCommunicationType connectionType)
 {
     return(DeviceController.SwitchCommunicationMode(connectionType));
 }
示例#6
0
 public DeviceController(DeviceCommunicationType deviceConnectionType)
 {
     _leftHearinAid   = new Processor(Ear.Left, deviceConnectionType);
     _righttHearinAid = new Processor(Ear.Right, deviceConnectionType);
 }
 public Processor(Ear ear, DeviceCommunicationType deviceConnectionType)
 {
     InitializeDevice(ear, deviceConnectionType);
 }