public void OnInputClicked(InputClickedEventData eventData)
 {
     //Debug.LogFormat("OnInputClicked\r\nSource: {0}  SourceId: {1} TapCount: {2}", eventData.InputSource, eventData.SourceId, eventData.TapCount);
     Actuator a = (Actuator)ItemManager.getInstance().getItem(itemName);
     if (a == null)
         Debug.Log("actuator " + itemName + " could not be found");
     //fetch instruction type and send appropriate request
     switch (this.gameObject.name)
     {
         case "ButtonON":
             StartCoroutine(a.sendON());
             break;
         case "ButtonOFF":
             StartCoroutine(a.sendOFF());
             break;
         case "ButtonINCREASE":
             {
                 if (a is DimmerActuator)
                 {
                     StartCoroutine(((DimmerActuator)a).sendINCREASE());
                     break;
                 } else
                 {
                     if (a is HueDimmer)
                     {
                         StartCoroutine(((HueDimmer)a).sendINCREASE());
                         break;
                     }
                 }
                 break;    
             }
             
         case "ButtonDECREASE":
             {
                 if (a is DimmerActuator)
                 {
                     StartCoroutine(((DimmerActuator)a).sendDECREASE());
                     break;
                 }
                 else
                 {
                     if (a is HueDimmer)
                     {
                         StartCoroutine(((HueDimmer)a).sendDECREASE());
                         break;
                     }
                 }
                 break;
             }
         default:
             return;
     }
 }
        void Update()
        {
            if (c != null || nc != null || mc != null)
            {
                updateCounter++;

                if (updateCounter >= Settings.requestUpdateNumber)
                {
                    if (c != null)
                    {
                        if (c.connState.Equals(Connection.States.Active))
                        {
                            Item     source = ItemManager.getInstance().getItem(SourceNamelong);
                            Actuator target = (Actuator)ItemManager.getInstance().getItem(TargetNamelong);

                            string leftSide = source.state;

                            float leftValue  = float.Parse(leftSide);
                            float rightValue = rightSide;

                            switch (c.condOperator)
                            {
                            case LogicSenActInput.Operatoren.kleiner:
                            {
                                if (leftValue < rightValue)
                                {
                                    if (c.targetCommand.Equals(SensActConnection.commands.ON))
                                    {
                                        StartCoroutine(target.sendON());
                                        ConnectionManager.getInstance().stopConnection(c.id);
                                        SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                        SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                    }
                                    else
                                    {
                                        StartCoroutine(target.sendOFF());
                                        ConnectionManager.getInstance().stopConnection(c.id);
                                        SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                        SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                    }
                                }
                                break;
                            }

                            case LogicSenActInput.Operatoren.gleich:
                            {
                                if (leftValue == rightValue)
                                {
                                    if (c.targetCommand.Equals(SensActConnection.commands.ON))
                                    {
                                        StartCoroutine(target.sendON());
                                        ConnectionManager.getInstance().stopConnection(c.id);
                                        SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                        SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                    }
                                    else
                                    {
                                        StartCoroutine(target.sendOFF());
                                        ConnectionManager.getInstance().stopConnection(c.id);
                                        SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                        SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                    }
                                }
                                break;
                            }

                            case LogicSenActInput.Operatoren.groesser:
                            {
                                if (leftValue > rightValue)
                                {
                                    if (c.targetCommand.Equals(SensActConnection.commands.ON))
                                    {
                                        StartCoroutine(target.sendON());
                                        ConnectionManager.getInstance().stopConnection(c.id);
                                        SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                        SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                    }
                                    else
                                    {
                                        StartCoroutine(target.sendOFF());
                                        ConnectionManager.getInstance().stopConnection(c.id);
                                        SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                        SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                    }
                                }
                                break;
                            }

                            default:
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (nc != null)
                        {
                            if (nc.connState.Equals(Connection.States.Active))
                            {
                                Item     source = ItemManager.getInstance().getItem(SourceNamelong);
                                Actuator target = (Actuator)ItemManager.getInstance().getItem(TargetNamelong);

                                NfcReader nfcr     = (NfcReader)source;
                                string    leftSide = nfcr.niceState;

                                if (nc.condOperator.Equals(LogicSenActInput.Operatoren.gleich))
                                {
                                    if (leftSide.Equals(nc.rightSide))
                                    {
                                        if (nc.targetCommand.Equals(SensActConnection.commands.ON))
                                        {
                                            StartCoroutine(target.sendON());
                                            ConnectionManager.getInstance().stopConnection(nc.id);
                                            SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                            SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                        }
                                        else
                                        {
                                            StartCoroutine(target.sendOFF());
                                            ConnectionManager.getInstance().stopConnection(nc.id);
                                            SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                            SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (mc != null)
                            {
                                if (mc.connState.Equals(Connection.States.Active))
                                {
                                    Item     source = ItemManager.getInstance().getItem(SourceNamelong);
                                    Actuator target = (Actuator)ItemManager.getInstance().getItem(TargetNamelong);

                                    MyoArmband myoa = (MyoArmband)source;

                                    string leftSide = myoa.niceState;

                                    if (mc.condOperator.Equals(LogicSenActInput.Operatoren.gleich))
                                    {
                                        if (leftSide.Equals(mc.rightSide))
                                        {
                                            if (mc.targetCommand.Equals(SensActConnection.commands.ON))
                                            {
                                                StartCoroutine(target.sendON());
                                                ConnectionManager.getInstance().stopConnection(mc.id);
                                                SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                                SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                            }
                                            else
                                            {
                                                StartCoroutine(target.sendOFF());
                                                ConnectionManager.getInstance().stopConnection(mc.id);
                                                SenActFenster.transform.GetChild(3).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                                                SenActFenster.transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    updateCounter = 0;
                }
            }
        }
        public void OnInputClicked(InputClickedEventData eventData)
        {
            //Needs: LineID, Source Name, Target Name, Source Operation, Target Operation

            bool exists = false;

            if (ConnectionManager.getInstance().getConnections().ContainsKey(LineID))
            {
                exists = true;
            }

            ActActFensterName = this.gameObject.transform.parent.name;
            ActActFenster     = this.gameObject.transform.parent.gameObject;

            ActActConnection.commands sourceCommand;
            ActActConnection.commands targetCommand;

            bool opSource = ActActFenster.GetComponent <LogicActActInput>().GetSourceStatus(); //false = off, true = on
            bool opTarget = ActActFenster.GetComponent <LogicActActInput>().GetTargetStatus(); //false = off, true = on

            if (!opSource)
            {
                sourceCommand = ActActConnection.commands.OFF;
            }
            else
            {
                sourceCommand = ActActConnection.commands.ON;
            }
            if (!opTarget)
            {
                targetCommand = ActActConnection.commands.OFF;
            }
            else
            {
                targetCommand = ActActConnection.commands.ON;
            }

            Item source = ItemManager.getInstance().getItem(SourceNamelong);
            Item target = ItemManager.getInstance().getItem(TargetNamelong);

            if (source is Actuator && target is Actuator)
            {
                Actuator aSource = (Actuator)source;
                Actuator aTarget = (Actuator)target;
                if (!exists)
                {
                    ActActConnection c = ConnectionCreator.createActActConnection(LineID, SourceNamelong, TargetNamelong, sourceCommand, targetCommand);
                }

                ConnectionManager.getInstance().startConnection(LineID);
                if (sourceCommand.Equals(ActActConnection.commands.ON))
                {
                    StartCoroutine(aSource.sendON());
                    ConnectionManager.getInstance().stopConnection(LineID);
                }
                else if (sourceCommand.Equals(ActActConnection.commands.OFF))
                {
                    StartCoroutine(aSource.sendOFF());
                    ConnectionManager.getInstance().stopConnection(LineID);
                }

                if (targetCommand.Equals(ActActConnection.commands.ON))
                {
                    StartCoroutine(aTarget.sendON());
                    ConnectionManager.getInstance().stopConnection(LineID);
                }
                else if (targetCommand.Equals(ActActConnection.commands.OFF))
                {
                    StartCoroutine(aTarget.sendOFF());
                    ConnectionManager.getInstance().stopConnection(LineID);
                }
            }

            //ActActFenster.transform.GetChild(1).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
            //this.transform.localScale = new Vector3(0, 0, 0);
        }