Esempio n. 1
0
        /// <summary>
        /// Links the plugin device to the EISC bridge
        /// </summary>
        /// <param name="trilist"></param>
        /// <param name="joinStart"></param>
        /// <param name="joinMapKey"></param>
        /// <param name="bridge"></param>
        public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
        {
            var joinMap = new RVCDisplayBridgeJoinMap(joinStart);

            // This adds the join map to the collection on the bridge
            if (bridge != null)
            {
                bridge.AddJoinMap(Key, joinMap);
            }

            // TODO: figure out how best way to handle base and override class maps and ranges
            LinkDisplayToApi(this, trilist, joinStart, joinMapKey, null);

            var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey);

            if (customJoins != null)
            {
                joinMap.SetCustomJoinData(customJoins);
            }

            Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
            Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name);

            // links to bridge

            /// eJoinCapabilities.ToFromSIMPL - FromSIMPL action
            //trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, sig => Connect = sig);
            /// eJoinCapabilities.ToFromSIMPL - ToSIMPL subscription
            //ConnectFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Connect.JoinNumber]);

            /// eJoinCapabilities.ToFromSIMPL - ToSIMPL subscription
            StatusFeedback.LinkInputSig(trilist.UShortInput[joinMap.Status.JoinNumber]);

            /// eJoinCapabilities.ToSIMPL - set string once as this is not changeble info
            trilist.SetString(joinMap.Driver.JoinNumber, _display.GetType().AssemblyQualifiedName);

            UpdateFeedbacks();

            /// Propagate String/Serial values through eisc when it becomes online
            trilist.OnlineStatusChange += (o, a) =>
            {
                if (!a.DeviceOnLine)
                {
                    return;
                }

                trilist.SetString(joinMap.Driver.JoinNumber, _display.GetType().AssemblyQualifiedName);
                UpdateFeedbacks();
            };
        }
        public CrestronConnectedDisplay(uint ipId, CrestronControlSystem controlSystem, string name) : base(name)
        {
            _display = new RoomViewConnectedDisplay(ipId, controlSystem)
            {
                Description = name
            };

            _display.OnlineStatusChange += DisplayOnOnlineStatusChange;

            IpIdFactory.Block(ipId, IpIdFactory.DeviceType.Other);

            _display.BaseEvent += DisplayOnBaseEvent;
            var result = _display.Register();

            if (result != eDeviceRegistrationUnRegistrationResponse.Success)
            {
                CloudLog.Error("Error trying to register device {0} with Id {1}, {2}", _display.GetType().Name, ipId,
                               result);
            }
        }