void ConfigUserInterfaces()
 {
     OnDebug(eDebugEventType.Info, "Configuring UserInterfaces");
     // create the user interfaces that you want in the project
     ui_01 = new Tsw1060(0x03, this);
     ui_02 = new XpanelForSmartGraphics(0x04, this);
     ConfigUserInterface(ui_01);
     ConfigUserInterface(ui_02);
 }
 /// <summary>
 /// InitializeSystem - this method gets called after the constructor
 /// has finished.
 ///
 /// Use InitializeSystem to:
 /// * Start threads
 /// * Configure ports, such as serial and verisports
 /// * Start and initialize socket connections
 /// Send initial device configurations
 ///
 /// Please be aware that InitializeSystem needs to exit quickly also;
 /// if it doesn't exit in time, the SIMPL#Pro program will exit.
 /// </summary>
 public override void InitializeSystem()
 {
     try
     {
         _tsw = new Tsw1060(0x03, this);
         _tsw.OnlineStatusChange += new OnlineStatusChangeEventHandler(_tsw_OnlineStatusChange);
         _tsw.SigChange          += new SigEventHandler(_tsw_SigChange);
     }
     catch (Exception e)
     {
         ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Config constructor
        /// </summary>
        public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id)
            : base(key, name)
        {
            Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating touchpanel hardware...");
            type = type.ToLower();
            try
            {
                if (type == "crestronapp")
                {
                    var app = new CrestronApp(id, Global.ControlSystem);
                    app.ParameterProjectName.Value = props.ProjectName;
                    Panel = app;
                }
                else if (type == "tsw550")
                {
                    Panel = new Tsw550(id, Global.ControlSystem);
                }
                else if (type == "tsw552")
                {
                    Panel = new Tsw552(id, Global.ControlSystem);
                }
                else if (type == "tsw560")
                {
                    Panel = new Tsw560(id, Global.ControlSystem);
                }
                else if (type == "tsw750")
                {
                    Panel = new Tsw750(id, Global.ControlSystem);
                }
                else if (type == "tsw752")
                {
                    Panel = new Tsw752(id, Global.ControlSystem);
                }
                else if (type == "tsw760")
                {
                    Panel = new Tsw760(id, Global.ControlSystem);
                }
                else if (type == "tsw1050")
                {
                    Panel = new Tsw1050(id, Global.ControlSystem);
                }
                else if (type == "tsw1052")
                {
                    Panel = new Tsw1052(id, Global.ControlSystem);
                }
                else if (type == "tsw1060")
                {
                    Panel = new Tsw1060(id, Global.ControlSystem);
                }
                else
                {
                    Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type);
                    return;
                }
            }
            catch (Exception e)
            {
                Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message);
                return;
            }

            // Reserved sigs
            if (Panel is TswFt5ButtonSystem)
            {
                var tsw = Panel as TswFt5ButtonSystem;
                tsw.ExtenderSystemReservedSigs.Use();
                tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange
                    += ExtenderSystemReservedSigs_DeviceExtenderSigChange;

                tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
            }

            if (Panel.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
            {
                Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason);
            }

            // Give up cleanly if SGD is not present.
            var sgdName = Global.FilePathPrefix + "sgd" + Global.DirectorySeparator + props.SgdFile;

            if (!File.Exists(sgdName))
            {
                Debug.Console(0, this, "Smart object file '{0}' not present in User folder. Looking for embedded file", sgdName);

                sgdName = Global.ApplicationDirectoryPathPrefix + Global.DirectorySeparator + "SGD" + Global.DirectorySeparator + props.SgdFile;

                if (!File.Exists(sgdName))
                {
                    Debug.Console(0, this, "Unable to find SGD file '{0}' in User sgd or application SGD folder. Exiting touchpanel load.", sgdName);
                    return;
                }
            }

            Panel.LoadSmartObjects(sgdName);
            Panel.SigChange += Panel_SigChange;
        }
Esempio n. 4
0
        public override void InitializeSystem()
        {
            try
            {
                // List of all Touchscreens in system
                IList <BasicTriListWithSmartObject> panelList = new List <BasicTriListWithSmartObject>();

                Tsw1060 touchScreen1060 = new Tsw1060(0x0C, this);
                touchScreen1060.Register();

                Tsw760 touchScreen760 = new Tsw760(0x0A, this);
                touchScreen760.Register();

                Tsw560 touchScreen560 = new Tsw560(0x0E, this);
                touchScreen560.Register();

                Tsw560P touchScreen560P = new Tsw560P(0x0D, this);
                touchScreen560P.Register();

                CrestronApp mobileApp = new CrestronApp(0x0B, this);
                mobileApp.ParameterProjectName.Value = "ch5-sample-project";
                mobileApp.Register();

                panelList.Add(touchScreen1060);
                panelList.Add(touchScreen760);
                panelList.Add(touchScreen560);
                panelList.Add(touchScreen560P);
                panelList.Add(mobileApp);

                // ---------------------------------------------------------------------------------------------------------------
                // Create Contract Instance to program all touchscreens in system. This Contract Reference will globablly program
                // Lights, Source Selection, and ContactList
                // ---------------------------------------------------------------------------------------------------------------

                // Contract Instance
                var globalContract = new Contract(panelList.ToArray());

                // Sample Programming of Lights/Scenes for all Touchscreens
                var demoLightingLogic = new DemoRoomLogic(globalContract.Room);

                // Sample Programming of Contact List for all Touchscreens
                var demoContactListingLogic = new DemoContactListingLogic(globalContract.ContactList);

                // Sample Programming of Source Selection for all Touchscreens
                var demoSourceSelectionLogic = new DemoSourceSelectLogic(globalContract.SourceList);


                // --------------------------------------------------------------------------------------------------------------
                // Creating Multiple Contract Instances for each Touchscreen to program VIDEO CAMERA PAGE.
                // This will allow each Touchscreen Device to independantly play a different video camera.
                // For example TSW1060 can watch camera 2 while TSW760 can watch camera 1 and so on.
                // --------------------------------------------------------------------------------------------------------------

                //Contract Instance for TSW1060
                Touchscreen1060Contract    = new Contract(touchScreen1060);
                Touchscreen1060VideoCamera = new DemoVideoCameraLogic(Touchscreen1060Contract.CameraList);

                // Contact Instance for TSW760
                Touchscreen760Contract    = new Contract(touchScreen760);
                Touchscreen760VideoCamera = new DemoVideoCameraLogic(Touchscreen760Contract.CameraList);

                // Contact Instance for TSW560
                Touchscreen560Contract    = new Contract(touchScreen560);
                Touchscreen560VideoCamera = new DemoVideoCameraLogic(Touchscreen560Contract.CameraList);

                // Contact Instance for TSW560P
                Touchscreen560PContract    = new Contract(touchScreen560P);
                Touchscreen560PVideoCamera = new DemoVideoCameraLogic(Touchscreen560PContract.CameraList);

                // Contact Instance for MobileApp
                MobileAppContract    = new Contract(mobileApp);
                MobileAppVideoCamera = new DemoVideoCameraLogic(MobileAppContract.CameraList);
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
            }
        }