public TopicManager(ISession session, DataGenerators.ICarControlsDataGenerator carControlsDataGenerator, DataGenerators.ICarStateDataGenerator carStateDataGenerator, RefreshIntervalManager refreshIntervalManager, Metrics metrics)
        {
            this.carControlsDataGenerator = carControlsDataGenerator;
            this.carStateDataGenerator = carStateDataGenerator;
            this.refreshIntervalManager = refreshIntervalManager;
            this.metrics = metrics;

            topics = session.GetTopicsFeature();
            topicControl = session.GetTopicControlFeature();
            topicUpdateControl = session.GetTopicUpdateControlFeature();

            topicPathsPendingAddition = new List<string>();

            // The first thing we need to do is kick of an asynchronous request to see
            // whether our root topic path already exists.
            var topicDetailsHandler = new Handlers.TopicDetailsHandler();
            topicDetailsHandler.Success += topicDetailsHandler_Success;
            topics.GetTopicDetails(rootTopicPath, TopicDetailsLevel.BASIC, topicDetailsHandler);
        }
Пример #2
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();
        }
Пример #3
0
 public MetricEventArgs(Metrics.Types type, UInt64 value)
 {
     this.Type = type;
     this.Value = value;
 }
Пример #4
0
 private void Increment(Metrics.Types type)
 {
     lock(locker)
     {
         ++values[(int)type];
     }
 }