Example #1
0
        private CrestronJoins getSmartObject(CrestronDevice device, byte id)
        {
            var so = device.smartObjects.Find(x => x.id == id);

            if (so == null)
            {
                so = new CrestronJoins(id);
                device.smartObjects.Add(so);
            }
            return(so);
        }
Example #2
0
        private void setOutputSigState(CrestronDevice device, byte id, ushort idx, bool val)
        {
            CrestronJoins joins = id > 0 ? getSmartObject(device, id) : device;
            var           sig   = joins.digitalOutputs.Find(x => x.pos == idx);

            if (sig == null)
            {
                sig = new Digital(idx, val);
                joins.digitalOutputs.Add(sig);
            }
            else
            {
                sig.value = val;
            }
        }
Example #3
0
        private void setInputSigState(CrestronDevice device, byte id, ushort idx, ushort val)
        {
            CrestronJoins joins = id > 0 ? getSmartObject(device, id) : device;
            var           sig   = joins.analogInputs.Find(x => x.pos == idx);

            if (sig == null)
            {
                sig = new Analog(idx, val);
                joins.analogInputs.Add(sig);
            }
            else
            {
                sig.value = val;
            }
        }
Example #4
0
        public void ToggleDigitalSmartObject(CrestronDevice device, byte id, ushort idx)
        {
            OnDebug(eDebugEventType.Info, "ToggleDigitalSmartObject:{0}:{1} ", id, idx);
            CrestronJoins smartObject = device.smartObjects.Find(x => x.id == id);

            if (smartObject == null)
            {
                smartObject = new CrestronJoins(id);
                device.smartObjects.Add(smartObject);
            }
            Digital dig = smartObject.digitalOutputs.Find(x => x.pos == idx);

            if (dig == null)
            {
                dig = new Digital(idx, false);
                device.smartObjects.Add(smartObject);
            }
            SendDigitalSmartObject(device, id, idx, !dig.value);
        }