Exemplo n.º 1
0
 private void activityDetectionHandler(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     if (AuthenticatedLevel != AuthenticatedLevel.None && args.Sig.Type == eSigType.Bool && args.Sig.BoolValue)
     {
         _inactivityTimer.Reset(_inactivityTime);
     }
 }
        void SmartObject_DPad_SigChange(BasicTriListWithSmartObject currentDevice, SmartObjectEventArgs args)
        {
            if (args.Sig.BoolValue)
            {
                switch (args.Sig.Name.ToUpper())
                {
                case "UP": OnDebug(eDebugEventType.Info, "Up pressed"); break;             // up

                case "DOWN": OnDebug(eDebugEventType.Info, "Down pressed"); break;         // dn

                case "LEFT": OnDebug(eDebugEventType.Info, "Left pressed"); break;         // le

                case "RIGHT": OnDebug(eDebugEventType.Info, "Right pressed"); break;       // ri

                case "CENTER": OnDebug(eDebugEventType.Info, "Center pressed"); break;     // OK

                default:
                    OnDebug(eDebugEventType.Info, "Unhandled keypad button {0} pressed, name:{1}", args.Sig.Number, args.Sig.Name);
                    break;
                }
            }
            else // release
            {
            }
        }
Exemplo n.º 3
0
 private void SmartObjectOnSigChange(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     if (args.Sig.Name == "Is Moving" && args.Sig.Type == eSigType.Bool)
     {
         OnIsMovingChange(this, args.Sig.BoolValue);
     }
 }
Exemplo n.º 4
0
        void MyList_EventChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
            switch (args.Sig.Number)
            {
            case 1:
            {
                _MyList.BooleanInput[2].BoolValue = true;
                _MyList.BooleanInput[4].BoolValue = false;
                _MyList.BooleanInput[6].BoolValue = false;
                break;
            }

            case 3:
            {
                _MyList.BooleanInput[2].BoolValue = false;
                _MyList.BooleanInput[4].BoolValue = true;
                _MyList.BooleanInput[6].BoolValue = false;
                break;
            }

            case 5:
            {
                _MyList.BooleanInput[2].BoolValue = false;
                _MyList.BooleanInput[4].BoolValue = false;
                _MyList.BooleanInput[6].BoolValue = true;
                break;
            }

            default:
            {
                break;
            }
            }
        }
        private void SmartObject_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
            try
            {
                Dictionary <string, Action <SmartObjectEventArgs> > signals = null;
                switch (args.Sig.Type)
                {
                case eSigType.Bool:
                    signals = BooleanOutputs;
                    break;

                case eSigType.UShort:
                    signals = NumericOutputs;
                    break;

                case eSigType.String:
                    signals = StringOutputs;
                    break;
                }

                //Resolve and invoke the corresponding method
                Action <SmartObjectEventArgs> action;
                string key = GetKey(args.SmartObjectArgs.ID, args.Sig.Number);
                if (signals != null &&
                    signals.TryGetValue(key, out action) &&
                    action != null)
                {
                    action.Invoke(args);
                }
            }
            catch
            {
            }
        }
Exemplo n.º 6
0
 void so_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     //CrestronConsole.PrintLine("{0}: SO:{4} Event:{1} Type:{2} Number:{3}", currentDevice.Name, args.Event, args.Sig.Type, args.Sig.Number, args.SmartObjectArgs.ID);
     if (args.Sig.Type == eSigType.Bool && args.Sig.BoolValue)
     {
         CrestronConsole.PrintLine("Activity: {0}", args.Sig.Number);
     }
 }
Exemplo n.º 7
0
 internal static UIEventArgs CreateEventArgs(SmartObjectEventArgs eventArgs)
 {
     return(new UIEventArgs
     {
         Device = (BasicTriListWithSmartObject)eventArgs.SmartObjectArgs.Device,
         SigArgs = eventArgs
     });
 }
        private void ValueOnSigChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
#if DEBUG
            CrestronConsole.PrintLine("{0}.SmartObject[{3}].SigChange ID 0x{1:X2} {2}", currentDevice.GetType().Name,
                                      currentDevice.ID, args.Sig.ToString(), args.SmartObjectArgs.ID);
#endif
            OnPanelActivity(this, new UIControllerActivityEventArgs(args.Sig, args.Event));
        }
        void SmartObjectValue_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
            // Sets the string value for this signal to ALL signals in mySigGroup
            mySigGroup.StringValue = String.Format("Event Type: {0}, Signal {1}, from SmartObject: {2}",
                                                   args.Sig.Type, args.Sig.Name, args.SmartObjectArgs.ID);
            #region Execute methods dynamically using reflection
            if (args.SmartObjectArgs.ID == 1)
            {
                if (args.Sig.Name.ToUpper() == "OK")    // Press OK on smartobject
                {
                    if (args.Sig.BoolValue)             // If true, its a press
                    {
                        if (myAssembly.FullName.ToUpper().Contains("REFLECTIONLIB1"))
                        {
                            myInstance = myAssembly.CreateInstance("ReflectionLib1.RelayClicks");
                            myType     = myInstance.GetType();
                            FieldInfo field = myType.GetField("cs");
                            field.SetValue(myInstance, this);           // sets the controlsystem field (cs) to the current controlsystem (this)
                            // This is interesting and makes things quite powerful
                            MethodInfo method = myType.GetMethod("Initialize");
                            method.Invoke(myInstance, new object[] { });                        // No parameters

                            method = myType.GetMethod("StartClicking");
                            method.Invoke(myInstance, new object[] { 500 });            // 1 parameter
                        }
                        else if (myAssembly.FullName.Contains("ReflectionLib2"))        // no "ToUpper" since I eventually need real name anyway
                        {
                            myInstance = myAssembly.CreateInstance("ReflectionLib2.PrintToConsole");
                            myType     = myInstance.GetType();

                            MethodInfo method = myType.GetMethod("PrintSomething");
                            method.Invoke(myInstance, new object[] { "Hello World From Reflection \n" });
                        }
                    }
                    else                                                                // If false, its a release
                    {
                        if (myAssembly.FullName.Contains("ReflectionLib1"))
                        {
                            // NOTE: This works because myInstance and myType were created on press above
                            MethodInfo method = myType.GetMethod("StopClicking");
                            method.Invoke(myInstance, new object[] { });
                        }
                    }
                }
            }
            #endregion

            #region Use reflection to print all supported classes, methods etc
            if (args.SmartObjectArgs.ID == 2)
            {
                if (args.Sig.BoolValue)                         // If true, its a press
                {
                    PrintFullAssembly(args.Sig.Name);
                }
            }
            #endregion
        }
Exemplo n.º 10
0
        private void DisplayInputListChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
            if (_device != null && args.Sig.BoolValue && args.Sig.Name.Contains("Pressed"))
            {
                int joinValue = Int32.Parse(Regex.Match(args.Sig.Name, @"\d+").Value);

                _device.SetInputSource(_device.GetUsableInputs().ElementAt(joinValue - 1).InputType);
            }
        }
Exemplo n.º 11
0
        private void onSelectedDimmerIndex(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = SelectedDimmerIndex;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 12
0
 void PanelSmartObjectHandler(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     switch (args.SmartObjectArgs.ID)
     {
     default:
         Trace("PanelSmartObjectHandler() unhandled SmartObject ID: " + args.SmartObjectArgs.ID);
         break;
     }
 }
Exemplo n.º 13
0
        private void onCameraErrorMessage(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = CameraErrorMessage;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 14
0
        private void onVideoURLOfSelectedCamera(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = VideoURLOfSelectedCamera;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 15
0
        private void onItemSelect(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = ItemSelect;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 16
0
        private void onURLOfVideo(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = URLOfVideo;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 17
0
        private void onSourceTypeOfSelectedCamara(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = SourceTypeOfSelectedCamara;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 18
0
        private void onLastUpdateTimeOfSelectedCameraImage(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = LastUpdateTimeOfSelectedCameraImage;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 19
0
        private void onErrorMessageOfSelectedCamera(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = ErrorMessageOfSelectedCamera;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 20
0
        private void onSetSourceSelected(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = SetSourceSelected;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 21
0
        private void onTriggerSceneStart(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = TriggerSceneStart;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 22
0
        private void onPlayingCameraImageURL(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = PlayingCameraImageURL;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 23
0
        private void onOn(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = On;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
        void so_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
            if (SigChange != null)
            {
                SigChange(this, new UnifiedSigEventArgs(args));
            }

            OnSigChange(args);
        }
Exemplo n.º 25
0
        private void on_CameraVideoRetryCount(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = _CameraVideoRetryCount;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 26
0
        private void onPlayingCameraStillImageLastUpdateTime(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = PlayingCameraStillImageLastUpdateTime;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 27
0
        private void onCameraVideoResolution(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = CameraVideoResolution;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 28
0
        private void onSetLightLevel(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = SetLightLevel;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 29
0
        private void onTurnLightOff(SmartObjectEventArgs eventArgs)
        {
            EventHandler <UIEventArgs> handler = TurnLightOff;

            if (handler != null)
            {
                handler(this, UIEventArgs.CreateEventArgs(eventArgs));
            }
        }
Exemplo n.º 30
0
        private void SmartObjectsOnSigChange(GenericBase currentDevice, SmartObjectEventArgs args)
        {
#if DEBUG
            Debug.WriteInfo(currentDevice.Name + " SmartObjectsOnSigChange(), {0}, {1}", args.Event, args.Sig);
#endif
            if (args.Event == eSigEvent.BoolChange)
            {
                OnActivity(this);
            }
        }
Exemplo n.º 31
0
 /// <summary>
 /// Method to handle smart object events from the underscan list.
 /// </summary>
 /// <param name="currentDevice">Reference to the device raising this event.</param>
 /// <param name="args">Information about the event being raised.</param>
 void dmRmcUnderscanList_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     try
     {
         if (args.Sig.Name == "Item Clicked")
             dmRmc.Scaler.UnderscanMode = (eDmScanMode)(args.Sig.UShortValue - 1);
     }
     catch (Exception)
     {
         ErrorLog.Error(">>> invalid dm rmc output underscan selection");
     }
 }
Exemplo n.º 32
0
 /// <summary>
 /// Method to handle smart object events from the resolution list.
 /// </summary>
 /// <param name="currentDevice">Reference to the device raising this event.</param>
 /// <param name="args">Information about the event being raised.</param>
 void dmRmcOutputResList_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     try
     {
         if (args.Sig.Name == "Item Clicked")
             dmRmc.Scaler.Resolution = (EndpointScalerOutput.eResolution)(args.Sig.UShortValue - 1);
     }
     catch (Exception)
     {
         ErrorLog.Error(">>> invalid dm rmc output resolution selection");
     }
 }
Exemplo n.º 33
0
 /// <summary>
 /// Method to handle smart object events from the aspect list.
 /// </summary>
 /// <param name="currentDevice">Reference to the device raising this event.</param>
 /// <param name="args">Information about the event being raised.</param>
 void dmRmcAspectModeList_SigChange(GenericBase currentDevice, SmartObjectEventArgs args)
 {
     try
     {
     if (args.Sig.Name == "Item Clicked")
         dmRmc.Scaler.DisplayMode = (EndpointScalerOutput.eDisplayMode)(args.Sig.UShortValue - 1);
     }
     catch (Exception)
     {
         ErrorLog.Error(">>> invalid dm rmc output aspect selection");
     }
 }