Spew() public static method

public static Spew ( String m ) : void
m String
return void
 private void addTopicHandler_Success(object sender, Handlers.TopicEventArgs e)
 {
     // At least one of our topics has been added.
     Log.Spew("Topic Added: \"" + e.TopicPath + "\"");
     while (topicPathsPendingAddition.Remove(e.TopicPath))
     {
         ;
     }
     if (0 == topicPathsPendingAddition.Count)
     {
         AddTopicSources();
     }
 }
Exemplo n.º 2
0
        private void session_StateChanged(object sender, SessionListenerEventArgs e)
        {
            Log.Spew("session_StateChanged:\n\tfrom " + e.OldState + "\n\tto   " + e.NewState);

            var justConnected    = e.NewState.Connected && !e.OldState.Connected;
            var justDisconnected = !e.NewState.Connected && e.OldState.Connected;

            if (justConnected)
            {
                topicManager = new TopicManager(e.Session, directInputManager, car, refreshIntervalManager, metrics);
            }

            if (justDisconnected)
            {
                topicManager = null;
            }
        }
        private void topicDetailsHandler_Success(object sender, Handlers.TopicDetailsEventArgs e)
        {
            Log.Spew("Queried Topic: \"" + e.TopicPath + "\"");

            if (!rootTopicPath.Equals(e.TopicPath))
            {
                throw new InvalidOperationException("Topic details received for unexpected topic path.");
            }

            if (null == e.TopicDetails)
            {
                // The root topic path does not yet exist so we need to create it implicitly
                // by creating the child nodes.
                Log.Spew("Creating topic tree...");

                var addTopicHandler = new Handlers.AddTopicHandler();
                addTopicHandler.Success += addTopicHandler_Success;

                AddTopic(addTopicHandler, steeringTopicPath);
                AddTopic(addTopicHandler, brakingTopicPath);
                AddTopic(addTopicHandler, accelerationTopicPath);
                AddTopic(addTopicHandler, gearTopicPath);
                AddTopic(addTopicHandler, refreshIntervalTopicPath, TopicType.RECORD);
                AddTopic(addTopicHandler, buttonStatesTopicPath, TopicType.RECORD);
                AddTopic(addTopicHandler, buttonNamesTopicPath, TopicType.RECORD);

                AddTopic(addTopicHandler, countOfUpdatesMetricTopicPath);
                AddTopic(addTopicHandler, upTimeInSecondsMetricTopicPath);
                AddTopic(addTopicHandler, countOfSuccessfulTopicSourceUpdatesMetricTopicPath);
                AddTopic(addTopicHandler, countOfFailedTopicSourceUpdatesMetricTopicPath);
                AddTopic(addTopicHandler, rateOfUpdatesPerSecondMetricTopicPath);
                AddTopic(addTopicHandler, rateOfSuccessfulTopicSourceUpdatesPerSecond);
            }
            else
            {
                // The root topic path exists so we need to start updating it.
                // (I am making the assumption that all of the topics I need to have added
                // below this root will be there... this could break if I add a new topic to the
                // tree in this codebase without restarting the Diffusion server or removing the
                // root topic first.)
                AddTopicSources();
            }
        }
        private void AddTopicSources()
        {
            Log.Spew("Adding topic sources...");

            topicUpdateControl.AddTopicSource(steeringTopicPath, new TopicSources.SteeringTopicSource(carControlsDataGenerator));
            topicUpdateControl.AddTopicSource(brakingTopicPath, new TopicSources.BrakingTopicSource(carControlsDataGenerator));
            topicUpdateControl.AddTopicSource(accelerationTopicPath, new TopicSources.AccelerationTopicSource(carControlsDataGenerator));
            topicUpdateControl.AddTopicSource(gearTopicPath, new TopicSources.GearTopicSource(carStateDataGenerator));
            topicUpdateControl.AddTopicSource(refreshIntervalTopicPath, new TopicSources.RefreshIntervalTopicSource(refreshIntervalManager));
            topicUpdateControl.AddTopicSource(buttonStatesTopicPath, new TopicSources.ButtonStatesTopicSource(carControlsDataGenerator));
            topicUpdateControl.AddTopicSource(buttonNamesTopicPath, new TopicSources.ButtonNamesTopicSource());

            Handlers.TopicSourceUpdateHandler.Singleton.Metrics = metrics;

            topicUpdateControl.AddTopicSource(countOfUpdatesMetricTopicPath, new TopicSources.MetricsTopicSource(metrics, Metrics.Types.CountOfUpdates));
            topicUpdateControl.AddTopicSource(upTimeInSecondsMetricTopicPath, new TopicSources.MetricsTopicSource(metrics, Metrics.Types.UpTimeInSeconds));
            topicUpdateControl.AddTopicSource(countOfSuccessfulTopicSourceUpdatesMetricTopicPath, new TopicSources.MetricsTopicSource(metrics, Metrics.Types.CountOfSuccessfulTopicSourceUpdates));
            topicUpdateControl.AddTopicSource(countOfFailedTopicSourceUpdatesMetricTopicPath, new TopicSources.MetricsTopicSource(metrics, Metrics.Types.CountOfFailedTopicSourceUpdates));
            topicUpdateControl.AddTopicSource(rateOfUpdatesPerSecondMetricTopicPath, new TopicSources.MetricsTopicSource(metrics, Metrics.Types.RateOfUpdatesPerSecond));
            topicUpdateControl.AddTopicSource(rateOfSuccessfulTopicSourceUpdatesPerSecond, new TopicSources.MetricsTopicSource(metrics, Metrics.Types.RateOfSuccessfulTopicSourceUpdatesPerSecond));
        }
Exemplo n.º 5
0
        Program()
        {
            directInputManager     = new DataGenerators.DirectInputManager();
            metrics                = new Metrics();
            refreshIntervalManager = new RefreshIntervalManager();
            car = new DataGenerators.Car(directInputManager, refreshIntervalManager);

            // In order for us to see Exception instances thrown from our own (application) code
            // executing within a callback from the Diffusion SDK, we need to direct log output
            // to the Console.
            LogService.ActiveLoggerType = LoggerType.Console;
            LogService.SetThresholdForLogger(LoggerType.Console, LogSeverity.Error);

            var sessionFactory = Diffusion.Sessions
                                 .ConnectionTimeout(5000) // milliseconds
                                 .SessionErrorHandler(session_Error)
                                 .SessionStateChangedHandler(session_StateChanged);

            // I get SessionStateChanged event before this method returns
            string diffusionServerURL = Properties.Settings.Default.DiffusionServerURL;

            Log.Spew("Connecting to Diffusion Server at \"" + diffusionServerURL + "\"...");
            sessionFactory.Open(diffusionServerURL).Start();
        }
Exemplo n.º 6
0
 private void session_Error(object sender, SessionErrorHandlerEventArgs e)
 {
     Log.Spew("session_Error: " + e.Error);
 }