void SensorUpdate()
    {
        if (inside)
        {
            sensorValue = env.inner_co2 + Random.Range(-0.1f, 0.1f);
        }
        else
        {
            sensorValue = env.outer_co2 + Random.Range(-0.1f, 0.1f);
        }

        if (amqp.IsConnected)
        {
            SensorData data = new SensorData
            {
                id     = sensorId,
                family = sensorFamily,
                value  = sensorValue,
                type   = "co2"
            };

            string json = JsonUtility.ToJson(data);
            amqp.PublishToExchange("sensorData", "", json);
        }
    }
Example #2
0
 public void sendData(SensorData data)
 {
     if (amqp.IsConnected)
     {
         string json = JsonUtility.ToJson(data);
         amqp.PublishToExchange("chairs", "", json);
     }
 }
Example #3
0
    void SensorUpdate()
    {
        if (inside)
        {
            sensorValue = env.inner_temperature + Random.Range(-0.1f, 0.1f);
        }
        else
        {
            sensorValue = env.outer_temperature + Random.Range(-0.1f, 0.1f);
        }

        if (amqp.IsConnected)
        {
            SensorData data = new SensorData();
            data.id     = sensorId;
            data.family = sensorFamily;
            data.value  = sensorValue;
            data.type   = "temp";

            string json = JsonUtility.ToJson(data);
            amqp.PublishToExchange("sensorData", "", json);
        }
    }