void Start() { amqp = this.gameObject.AddComponent <AmqpClient>(); amqp.OnConnected = new AmqpClientUnityEvent(); amqp.OnDisconnected = new AmqpClientUnityEvent(); amqp.OnReconnecting = new AmqpClientUnityEvent(); amqp.OnBlocked = new AmqpClientUnityEvent(); amqp.OnSubscribedToExchange = new AmqpExchangeSubscriptionUnityEvent(); amqp.OnUnsubscribedFromExchange = new AmqpExchangeSubscriptionUnityEvent(); amqp.OnConnected.AddListener(HandleConnected); amqp.OnDisconnected.AddListener(HandleDisconnected); amqp.OnReconnecting.AddListener(HandleReconnecting); amqp.OnBlocked.AddListener(HandleBlocked); amqp.OnSubscribedToExchange.AddListener(HandleExchangeSubscribed); amqp.OnUnsubscribedFromExchange.AddListener(HandleExchangeUnsubscribed); amqp.Connection = "localhost"; amqp.WriteToConsole = false; if (inside) { sensorFamily = sensorType + "_inside"; } else { sensorFamily = sensorType + "_outside"; } sensorId = (transform.parent.name + this.gameObject.name).GetHashCode(); amqp.ConnectToHost(); SensorUpdate(); }
public void Start() { // Load the config file from StreamingAssets. string configText = ""; bool configError = false; try { configText = File.ReadAllText(Path.Combine(Application.streamingAssetsPath, CONFIG_FILE)); } catch { configError = true; } if (string.IsNullOrEmpty(configText)) { configError = true; } var amqpConnection = new AmqpConnection(); if (!configError) { var config = StompConfig.ConvertToObject(configText); amqpConnection.Name = "StompConfig"; amqpConnection.Host = "localhost"; amqpConnection.AmqpPort = 5672; // int.Parse(config.port); amqpConnection.Username = "******"; //config.username; amqpConnection.Password = "******"; //config.password; amqpConnection.VirtualHost = vhost; //config.virtual_host; amqpConnection.WebPort = 15674; amqpConnection.ReconnectInterval = 5; amqpConnection.RequestedHeartBeat = 30; } else { print("ERROR : Config file invalid!!!!!!!!"); } AmqpClient.AddConnection(amqpConnection); client = GetComponent <AmqpClient>(); client.enabled = true; client.Connection = amqpConnection.Name; client.ConnectToHost(); _watson_listener = GetComponent <WatsonListener>(); }
//float temperature; //float humidity; //float CO2; // Start is called before the first frame update void Start() { amqp = this.gameObject.AddComponent <AmqpClient>(); amqp.OnConnected = new AmqpClientUnityEvent(); amqp.OnDisconnected = new AmqpClientUnityEvent(); amqp.OnReconnecting = new AmqpClientUnityEvent(); amqp.OnBlocked = new AmqpClientUnityEvent(); amqp.OnSubscribedToExchange = new AmqpExchangeSubscriptionUnityEvent(); amqp.OnUnsubscribedFromExchange = new AmqpExchangeSubscriptionUnityEvent(); amqp.OnConnected.AddListener(HandleConnected); amqp.OnDisconnected.AddListener(HandleDisconnected); amqp.OnReconnecting.AddListener(HandleReconnecting); amqp.OnBlocked.AddListener(HandleBlocked); amqp.OnSubscribedToExchange.AddListener(HandleExchangeSubscribed); amqp.OnUnsubscribedFromExchange.AddListener(HandleExchangeUnsubscribed); amqp.Connection = "localhost"; amqp.ConnectToHost(); // Uncomment to create new seating plan // Serialize(newSeatingPlan, "Assets/SeatingPlans/conway.sp"); var ledRows = display.gameObject.transform.Find("LEDs"); var seatRows = seat_rows.gameObject.transform; // Build arrays to access chairs and seating display for (int i = 0; i < 19; i++) { var seatRow = seatRows.GetChild(i); var ledRow = ledRows.GetChild(i); for (int j = 0; j < 14; j++) { chairs[i, j] = seatRow.gameObject.transform.GetChild(j).GetComponent <Chair>(); displayLEDs[i, j] = ledRow.gameObject.transform.GetChild(j).GetComponent <Led>(); occupancie[i, j] = false; } } // Wait for objects to be loaded before loading first seating plan StartCoroutine(WaitForLoading()); }
// Start is called before the first frame update void Start() { amqp = this.gameObject.AddComponent <AmqpClient>(); amqp.OnConnected = new AmqpClientUnityEvent(); amqp.OnDisconnected = new AmqpClientUnityEvent(); amqp.OnReconnecting = new AmqpClientUnityEvent(); amqp.OnBlocked = new AmqpClientUnityEvent(); amqp.OnSubscribedToExchange = new AmqpExchangeSubscriptionUnityEvent(); amqp.OnUnsubscribedFromExchange = new AmqpExchangeSubscriptionUnityEvent(); amqp.OnConnected.AddListener(HandleConnected); amqp.OnDisconnected.AddListener(HandleDisconnected); amqp.OnReconnecting.AddListener(HandleReconnecting); amqp.OnBlocked.AddListener(HandleBlocked); amqp.OnSubscribedToExchange.AddListener(HandleExchangeSubscribed); amqp.OnUnsubscribedFromExchange.AddListener(HandleExchangeUnsubscribed); amqp.Connection = "localhost"; amqp.WriteToConsole = false; amqp.ConnectToHost(); }