ProcessCommand() public method

public ProcessCommand ( String method_name, String parameter_1, String parameter_2 ) : void
method_name String
parameter_1 String
parameter_2 String
return void
Beispiel #1
0
        public override void ProcessCommand(OSAEMethod method)
        {
            try {
                string object_name = method.ObjectName;
                string method_name = method.MethodName;
                string parameter_1 = method.Parameter1;
                string parameter_2 = method.Parameter2;

                Log.Debug("Found Command: " + method_name + " | param1: " + parameter_1 + " | param2: " + parameter_2);

                if (object_name == pName)
                {
                    switch (method_name)
                    {
                    case "NOTIFYALL":
                        Log.Debug("NOTIFYALL event triggered");
                        Log.Debug("NOTIFYALL devices to loop:" + mdevices.Count);

                        foreach (AndroidDevice d in mdevices)
                        {
                            Log.Debug("NOTIFYALL loop for device:" + d.Name);
                            d.ProcessCommand("NOTIFY", parameter_1, parameter_2);
                        }

                        break;

                    case "EXECUTEALL":
                        Log.Debug("EXECUTEALL event triggered");
                        Log.Debug("EXECUTEALL devices to loop:" + mdevices.Count);

                        foreach (AndroidDevice d in mdevices)
                        {
                            Log.Debug("EXECUTEALL loop for device:" + d.Name);
                            d.ProcessCommand("EXECUTE", parameter_1, parameter_2);
                        }
                        break;
                    }
                }
                else
                {
                    AndroidDevice d = getAndroidDevice(object_name);

                    if (d == null)
                    {
                        OSAEObject obj = OSAEObjectManager.GetObjectByName(object_name);
                        createdevice(obj);
                        d = getAndroidDevice(object_name);
                    }

                    if (d != null)
                    {
                        d.ProcessCommand(method_name, parameter_1, parameter_2);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error processing command!", ex);
            }
        }
        public override void ProcessCommand(OSAEMethod method)
        {
            String object_name = method.ObjectName;
            String method_name = method.MethodName;
            String parameter_1 = method.Parameter1;
            String parameter_2 = method.Parameter2;

            log("Found Command: " + method_name + " | param1: " + parameter_1 + " | param2: " + parameter_2, true);

            if (object_name == pName)
            {
                switch (method_name)
                {
                case "NOTIFYALL":
                    log("NOTIFYALL event triggered", false);

                    log("NOTIFYALL devices to loop:" + mdevices.Count, false);

                    foreach (AndroidDevice d in mdevices)
                    {
                        log("NOTIFYALL loop for device:" + d.Name, false);
                        d.ProcessCommand("NOTIFY", parameter_1, parameter_2);
                    }

                    break;

                case "EXECUTEALL":
                    log("EXECUTEALL event triggered", false);

                    log("EXECUTEALL devices to loop:" + mdevices.Count, false);

                    foreach (AndroidDevice d in mdevices)
                    {
                        log("EXECUTEALL loop for device:" + d.Name, false);
                        d.ProcessCommand("EXECUTE", parameter_1, parameter_2);
                    }

                    break;
                }
            }
            else
            {
                AndroidDevice d = getAndroidDevice(object_name);

                if (d == null)
                {
                    OSAEObject obj = OSAEObjectManager.GetObjectByName(object_name);
                    createdevice(obj);
                    d = getAndroidDevice(object_name);
                }

                if (d != null)
                {
                    d.ProcessCommand(method_name, parameter_1, parameter_2);
                }
            }
        }