Esempio n. 1
0
        public static DevicePayload FromDevice(Device device)
        {
            var item = new DevicePayload();

            ThingPayload.CopyFromThing(item, device);
            LogicableItemUtils.CopyFromLogicable(item, device);
            return(item);
        }
Esempio n. 2
0
        public static Dictionary <string, LogicValuePayload> GetLogicValues(ILogicable logicable)
        {
            var logicValues = new Dictionary <string, LogicValuePayload>();

            foreach (LogicType logicType in Enum.GetValues(typeof(LogicType)))
            {
                if (logicable.CanLogicRead(logicType))
                {
                    logicValues.Add(logicType.ToString(), LogicableItemUtils.GetLogicValue(logicable, logicType));
                }
            }

            return(logicValues);
        }
Esempio n. 3
0
 public static void CopyFromLogicable(ILogicablePayload item, ILogicable logicable)
 {
     item.displayName = logicable.DisplayName;
     item.logicTypes  = LogicableItemUtils.GetLogicValues(logicable);
     item.slotValues  = LogicableItemUtils.GetSlotValues(logicable);
 }