private ClientStateSingleton()
        {
            DcsPlayerRadioInfo = new DCSPlayerRadioInfo();
            DcsPlayerSideInfo  = new DCSPlayerSideInfo();

            DcsGameGuiLastReceived = 0;
            DcsExportLastReceived  = 0;

            FixedChannels = new PresetChannelsViewModel[10];

            for (int i = 0; i < FixedChannels.Length; i++)
            {
                FixedChannels[i] = new PresetChannelsViewModel(new FilePresetChannelsStore(), i + 1);
            }

            MicrophoneAvailable = true;

            LastSent = 0;

            IsConnected = false;

            InExternalAWACSMode = false;

            LastSeenName = Settings.SettingsStore.Instance.GetClientSetting(Settings.SettingsKeys.LastSeenName).StringValue;
        }
        } = new VAICOMMessageWrapper();                                                   //used to temporarily stop PTT for VAICOM

        private ClientStateSingleton()
        {
            ShortGUID                      = ShortGuid.NewGuid();
            DcsPlayerRadioInfo             = new DCSPlayerRadioInfo();
            PlayerCoaltionLocationMetadata = new DCSPlayerSideInfo();

            // The following members are not updated due to events. Therefore we need to setup a polling action so that they are
            // periodically checked.
            DcsGameGuiLastReceived = 0;
            DcsExportLastReceived  = 0;
            _timer.Interval        = TimeSpan.FromSeconds(1);
            _timer.Tick           += (s, e) => {
                NotifyPropertyChanged("IsGameConnected");
                NotifyPropertyChanged("IsLotATCConnected");
                NotifyPropertyChanged("ExternalAWACSModeConnected");
            };
            _timer.Start();

            FixedChannels = new PresetChannelsViewModel[10];

            for (int i = 0; i < FixedChannels.Length; i++)
            {
                FixedChannels[i] = new PresetChannelsViewModel(new FilePresetChannelsStore(), i + 1);
            }

            LastSent = 0;

            IsConnected = false;
            ExternalAWACSModelSelected = false;

            LastSeenName = Settings.GlobalSettingsStore.Instance.GetClientSetting(Settings.GlobalSettingsKeys.LastSeenName).StringValue;
        }
        private void StartDcsGameGuiBroadcastListener()
        {
            _dcsGameGuiudpListener = new UdpClient();
            _dcsGameGuiudpListener.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress,
                                                          true);
            _dcsGameGuiudpListener.ExclusiveAddressUse = false; // only if you want to send/receive on same machine.

            //    var multicastaddress = IPAddress.Parse("239.255.50.10");
            //   _dcsGameGuiudpListener.JoinMulticastGroup(multicastaddress);

            var localEp = new IPEndPoint(IPAddress.Any, 5068);

            _dcsGameGuiudpListener.Client.Bind(localEp);
            //   activeRadioUdpClient.Client.ReceiveTimeout = 10000;

            Task.Factory.StartNew(() =>
            {
                using (_dcsGameGuiudpListener)
                {
                    //    var count = 0;
                    while (!_stop)
                    {
                        var groupEp = new IPEndPoint(IPAddress.Any, 5068);
                        var bytes   = _dcsGameGuiudpListener.Receive(ref groupEp);

                        try
                        {
                            var playerInfo =
                                JsonConvert.DeserializeObject <DCSPlayerSideInfo>(Encoding.UTF8.GetString(
                                                                                      bytes, 0, bytes.Length));

                            if (playerInfo != null)
                            {
                                //update position
                                playerInfo.Position = DcsPlayerRadioInfo.pos;
                                DcsPlayerSideInfo   = playerInfo;
                                _clientSideUpdate();
                                //     count = 0;
                            }
                        }
                        catch (Exception e)
                        {
                            Logger.Error(e, "Exception Handling DCS GameGUI Message");
                        }
                    }

                    try
                    {
                        _dcsGameGuiudpListener.Close();
                    }
                    catch (Exception e)
                    {
                        Logger.Error(e, "Exception stoping DCS listener ");
                    }
                }
            });
        }
        private ClientStateSingleton()
        {
            DcsPlayerRadioInfo = new DCSPlayerRadioInfo();
            DcsPlayerSideInfo  = new DCSPlayerSideInfo();

            FixedChannels = new PresetChannelsViewModel[10];

            for (int i = 0; i < FixedChannels.Length; i++)
            {
                FixedChannels[i] = new PresetChannelsViewModel(new FilePresetChannelsStore(), i + 1);
            }
        }
Exemplo n.º 5
0
        public Client(AudioManager audioManager, DCSPlayerRadioInfo playerRadioInfo)
        {
            AudioManager       = audioManager;
            ShortGuid          = Ciribob.DCS.SimpleRadio.Standalone.Common.Network.ShortGuid.NewGuid();
            DcsPlayerRadioInfo = playerRadioInfo;
            PlayerCoalitionLocationMetadata = new DCSPlayerSideInfo();
            SrsDataClient = new SrsDataClient(this);

            LogClientId = audioManager.LogClientId;

            ExternalAwacsModePassword = playerRadioInfo.radios.First().coalitionPassword;

            LastSent = 0;

            IsDataConnected           = false;
            ExternalAwacsModeSelected = false;

            LastSeenName = playerRadioInfo.name;
        }
Exemplo n.º 6
0
        public Client(AudioManager audioManager, DCSPlayerRadioInfo playerRadioInfo)
        {
            AudioManager       = audioManager;
            ShortGuid          = Ciribob.DCS.SimpleRadio.Standalone.Common.Network.ShortGuid.NewGuid();
            DcsPlayerRadioInfo = playerRadioInfo;
            PlayerCoalitionLocationMetadata = new DCSPlayerSideInfo();
            SrsDataClient = new SrsDataClient(this);

            LogClientId = audioManager.LogClientId;

            ExternalAwacsModePassword = playerRadioInfo.radios.First().coalitionPassword;

            LastSent = 0;

            IsDataConnected           = false;
            ExternalAwacsModeSelected = false;

            LastSeenName = playerRadioInfo.name;

            _connectionMonitorTimer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };
            _connectionMonitorTimer.Tick += MonitorConnectionStatus;
        }