/// <summary>
        /// Constructor of the Control System Class. Make sure the constructor always exists.
        /// If it doesn't exit, the code will not run on your 3-Series processor.
        /// </summary>
        public ControlSystem() : base()
        {
            // Set the number of system and user threads which you want to use in your program .
            // User threads are created using the CrestronThread class
            // System threads are used for CTimers/CrestronInvoke/Async Socket operations
            // At this point the threads cannot be created but we should
            // define the max number of threads which we will use in the system.
            // the right number depends on your project; do not make this number unnecessarily large
            Thread.MaxNumberOfUserThreads = 20;

#if UseStaticGUID
            // Create the room object (parent of the assets and attributes). this contains all of the events you will need
            myRoom = new FusionRoom(0xf0, this, "SSP Fusion Room (Static)", "BA65B6F1-DC9B-47f5-8577-F32782045380");                    // this uses a status guid i created with the "Create GUID" tool (Tools Menu >> Create GUID). Select "Registry Format"

            // Add some assets, there are several types you can add
            myRoom.AddAsset(eAssetType.OccupancySensor, 1, "Occupancy Sensor", "Occupancy Sensor", "540E4FA9-97BE-4e21-A87E-C37E5B150FD0");
            myRoom.AddAsset(eAssetType.StaticAsset, 2, "Xpanel", "UI", "8081EA14-4869-4b86-877B-0075366BA8C6");
            myRoom.AddAsset(eAssetType.LightingLoad, 3, "Lights", "Lighting Load", "A74A1501-78E6-4a19-B0A8-F004C999F896");
#endif
#if !UseStaticGUID
            // Create the room object (parent of the assets and attributes). this contains all of the events you will need
            myRoom = new FusionRoom(0xf1, this, "SSP Fusion Room (Dynamic)", GuidManager.GetGuid("FusionRoom"));                // this is the same as above but will create a unique guid at first start up, then read from file after that

            // Add some assets, there are several types you can add
            myRoom.AddAsset(eAssetType.OccupancySensor, 1, "Occupancy Sensor", "Occupancy Sensor", GuidManager.GetGuid("SensorAsset"));
            myRoom.AddAsset(eAssetType.StaticAsset, 2, "Xpanel", "UI", GuidManager.GetGuid("XpanelAsset"));
            myRoom.AddAsset(eAssetType.LightingLoad, 3, "Lights", "Lighting Load", GuidManager.GetGuid("Lights"));
#endif

            // assign a more friendly reference to these assets and cast to the propper type
            mySensorAsset      = (FusionOccupancySensor)myRoom.UserConfigurableAssetDetails[1].Asset;
            myTouchScreenAsset = (FusionStaticAsset)myRoom.UserConfigurableAssetDetails[2].Asset;
            myLightingLoad     = (FusionLightingLoad)myRoom.UserConfigurableAssetDetails[3].Asset;

            // adjust parameters for the assets, some have required parameters
            myTouchScreenAsset.ParamMake.Value  = "Crestron";
            myTouchScreenAsset.ParamModel.Value = "TSW-1052-B-S";

            myLightingLoad.ParamDimmable  = false;
            myLightingLoad.ParamMeterType = eMeterType.Simulated;

            // Add some custom sigs (attributes)
            // the attribute IDs start at 50, just like in simpl, but the SDK will add 49 to the number you provide here. The following three lines create one attribute of each type with ID "50"
            myRoom.AddSig(eSigType.Bool, 1, "_Digital Attribute", eSigIoMask.InputOutputSig);                   // bool = digital, this is set for InputOutputSig (i.e. read from fusion / write to fusion)
            myRoom.AddSig(eSigType.String, 1, "_Serial Attribute", eSigIoMask.InputSigOnly);                    // string = serial, this is set for InputSigOnly (i.e. write to fusion)
            myRoom.AddSig(eSigType.UShort, 1, "_Analog Attribyte", eSigIoMask.OutputSigOnly);                   // ushort = analog, this is set for OutputSigOnly (i.e. read from fusion)

            // subscribe to events
            myRoom.FusionAssetStateChange += new FusionAssetStateEventHandler(myRoom_FusionAssetStateChange);
            myRoom.FusionStateChange      += new FusionStateEventHandler(myRoom_FusionStateChange);
            myRoom.OnlineStatusChange     += new OnlineStatusChangeEventHandler(myRoom_OnlineStatusChange);

            myRoom.Register();             // I usually add some sort of check to make sure it is registered okay, but i'm lazy today

            TouchscreenOnlineToggleTimer = new CTimer(TouchScreenOnlineToggleCallback, null, Timeout.Infinite, Timeout.Infinite);
        }
Ejemplo n.º 2
0
        public FusionManager(CrestronControlSystem cs, uint ipid, string roomName)
        {
            try
            {
                this.cs = cs;

                Trace("Constructor running.");

                // create new FusionRoom object
                string roomID = new Guid().ToString();
                room = new FusionRoom(ipid, cs, roomName, roomID);

                // add assets
                AddAssets();

                // add event handlers
                room.OnlineStatusChange     += new OnlineStatusChangeEventHandler(OnlineStatusChange);
                room.FusionStateChange      += new FusionStateEventHandler(FusionStateChange);
                room.FusionAssetStateChange += new FusionAssetStateEventHandler(AssetStateChange);

                // generate rvi file
                FusionRVI.GenerateFileForAllFusionDevices();

                // attempt to register
                eDeviceRegistrationUnRegistrationResponse response = room.Register();
                if (response == eDeviceRegistrationUnRegistrationResponse.Success)
                {
                    Trace("Room registered successfully.");
                }
                else
                {
                    Trace("Room failed to register: " + response);
                }
            }
            catch (Exception e)
            {
                string traceMessage = "Exception caught in constructor: " + e.Message + e.StackTrace;
                Trace(traceMessage);
                ErrorLog.Error(traceMessage);
            }
        }
Ejemplo n.º 3
0
        // These methods are overridden because they access the room class which is of a different type

        protected override void CreateSymbolAndBasicSigs(uint ipId)
        {
            Debug.Console(1, this, "Creating Fusion Room symbol with GUID: {0}", RoomGuid);

            FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
            FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
            FusionRoom.ExtenderFusionRoomDataReservedSigs.Use();

            FusionRoom.Register();

            FusionRoom.FusionStateChange += FusionRoom_FusionStateChange;

            FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.DeviceExtenderSigChange += FusionRoomSchedule_DeviceExtenderSigChange;
            FusionRoom.ExtenderFusionRoomDataReservedSigs.DeviceExtenderSigChange         += ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange;
            FusionRoom.OnlineStatusChange += FusionRoom_OnlineStatusChange;

            CrestronConsole.AddNewConsoleCommand(RequestFullRoomSchedule, "FusReqRoomSchedule", "Requests schedule of the room for the next 24 hours", ConsoleAccessLevelEnum.AccessOperator);
            CrestronConsole.AddNewConsoleCommand(ModifyMeetingEndTimeConsoleHelper, "FusReqRoomSchMod", "Ends or extends a meeting by the specified time", ConsoleAccessLevelEnum.AccessOperator);
            CrestronConsole.AddNewConsoleCommand(CreateAsHocMeeting, "FusCreateMeeting", "Creates and Ad Hoc meeting for on hour or until the next meeting", ConsoleAccessLevelEnum.AccessOperator);

            // Room to fusion room
            Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);

            // Moved to
            CurrentRoomSourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Display 1 - Current Source", eSigIoMask.InputSigOnly);
            // Don't think we need to get current status of this as nothing should be alive yet.
            (Room as EssentialsHuddleVtc1Room).CurrentSourceChange += Room_CurrentSourceInfoChange;


            FusionRoom.SystemPowerOn.OutputSig.SetSigFalseAction((Room as EssentialsHuddleVtc1Room).PowerOnToDefaultOrLastSource);
            FusionRoom.SystemPowerOff.OutputSig.SetSigFalseAction(() => (Room as EssentialsHuddleVtc1Room).RunRouteAction("roomOff"));
            // NO!! room.RoomIsOn.LinkComplementInputSig(FusionRoom.SystemPowerOff.InputSig);


            CrestronEnvironment.EthernetEventHandler += CrestronEnvironment_EthernetEventHandler;
        }