Ejemplo n.º 1
0
 public MqttProtocol()
 {
     Broker = new MqttController
     {
         ProtocolInstance = this,
     };
     ProtocolProxy           = new MqttProtocolProxy();
     _authenticationPipeline = Composable.GetExport <IXSocketAuthenticationPipeline>();
 }
Ejemplo n.º 2
0
    void Start()
    {
        // Find mqtt controller object
        mqtt = GameObject.FindGameObjectWithTag("MqttController").GetComponent <MqttController>();

        actions.Add("good job", GoodJob);
        actions.Add("let's go", LetsGo);
        actions.Add("yes", Yes);
        actions.Add("no", No);
        actions.Add("nice putt", NicePutt);
        actions.Add("gee gee", GG);

        keywordRecognizer = new KeywordRecognizer(actions.Keys.ToArray());
        keywordRecognizer.OnPhraseRecognized += RecognizedSpeech;
        keywordRecognizer.Start();
        Debug.Log("Listening for speech...");
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        // Find mqtt controller object
        mqtt = GameObject.FindGameObjectWithTag("MqttController").GetComponent <MqttController>();

        if (!mqtt)
        {
            Debug.Log("ScoreboardManager: Mqtt controller not found");
        }
        else
        {
            // write names into scoreboard
            if (mqtt.playerNames.Count > 0)
            {
                name1.text = mqtt.playerNames[0];
            }
            if (mqtt.playerNames.Count > 1)
            {
                name2.text = mqtt.playerNames[1];
            }
            if (mqtt.playerNames.Count > 2)
            {
                name3.text = mqtt.playerNames[2];
            }
            if (mqtt.playerNames.Count > 3)
            {
                name4.text = mqtt.playerNames[3];
            }
        }

        // instantiate score list
        for (int i = 0; i < GameConstants.MAX_PLAYERS; i++)
        {
            List <int> sublist = new List <int>();
            for (int j = 0; j < 9; j++)
            {
                sublist.Add(0);
            }
            scores.Add(sublist);
        }
    }
Ejemplo n.º 4
0
    void Start()
    {
        leftArrowDownTime  = 0.0f;
        rightArrowDownTime = 0.0f;
        spaceDownTime      = 0.0f;

        // Find mqtt controller object
        mqtt = GameObject.FindGameObjectWithTag("MqttController").GetComponent <MqttController>();

        // Get state controller object
        sc = GameObject.FindGameObjectWithTag("StateController").GetComponent <StateController>();

        if (!mqtt)
        {
            Debug.Log("HotkeyManager: Mqtt controller not found");
        }
        if (!sc)
        {
            Debug.Log("HotkeyManager: State controller not found");
        }
    }
Ejemplo n.º 5
0
        private static void InitializeApplication()
        {
            var configController = new ConfigurationController(FullConfigPath);

            var scheduler = new DeviceScheduler();

            var deviceController = new DeviceController(configController, scheduler);

            var mqttController = new MqttController(configController);

            mqttController.ReceivedDeviceMessage += deviceController.DeviceMessageIncoming;

            if (deviceController.AllDevices.Any())
            {
                var allConfigNotifiers = deviceController.AllDevices.OfType <INotifyConfigPropertyChanged>();
                foreach (var notifier in allConfigNotifiers)
                {
                    notifier.ConfigPropertyChanged += configController.ConfigEntryChanged;
                }
            }
        }
Ejemplo n.º 6
0
 public MqttProtocol()
 {
     Broker = new MqttController
     {
         ProtocolInstance = this,                
     };
     ProtocolProxy = new MqttProtocolProxy();
     _authenticationPipeline = Composable.GetExport<IXSocketAuthenticationPipeline>();
 }
Ejemplo n.º 7
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment environment, MqttController mqttController)
        {
            app.UseRouting();

            app.UseEndpoints(
                endpoints =>
            {
                endpoints.MapConnectionHandler <MqttConnectionHandler>(
                    "/mqtt",
                    httpConnectionDispatcherOptions => httpConnectionDispatcherOptions.WebSockets.SubProtocolSelector =
                        protocolList => protocolList.FirstOrDefault() ?? string.Empty);
            });

            app.UseMqttServer(
                server =>
            {
                /*
                 * Attach event handlers etc. if required.
                 */

                server.ValidatingConnectionAsync += mqttController.ValidateConnection;
                server.ClientConnectedAsync      += mqttController.OnClientConnected;
            });
        }