Ejemplo n.º 1
0
        public void ReceiveValue(float val, string time, bool isElbow)
        {
            Log("Received val: " + val + " at: " + time + " isElbow: " + isElbow);

            if (isElbow)
            {
                elbowValue = val.ToString();
                OnElbowValue?.Invoke(new MqttEntry("elbow", val, time));
            }
            else
            {
                wristValue = val.ToString();
                OnWristValue?.Invoke(new MqttEntry("wrist", val, time));
            }
        }
Ejemplo n.º 2
0
        void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e)
        {
            //Debug.Log("Received = " + Encoding.UTF8.GetString(e.Message) + " on topic " + e.Topic);

            if (e.Topic == _elbowTopic)
            {
                // Do anything with the value
                elbowValue = Encoding.UTF8.GetString(e.Message);

                //Pass on the value to all event subscribers
                OnElbowValue?.Invoke(MessageToEntry(_elbowTopic, elbowValue));
            }
            else if (e.Topic == _wristTopic)
            {
                // Do anything with the value
                wristValue = Encoding.UTF8.GetString(e.Message);

                //Pass on the value to all event subscribers
                OnWristValue?.Invoke(MessageToEntry(_wristTopic, wristValue));
            }
        }