Пример #1
0
        public static APIThingEnd fromThingEnd(ThingEnd sourceThingEnd, bool loadParents, bool loadChilds)
        {
            APIThingEnd result = new APIThingEnd();

            result.ID                 = sourceThingEnd.ID;
            result.LastIOID           = sourceThingEnd.LastIOID;
            result.LastIOTimeStamp    = sourceThingEnd.LastIOTimeStamp;
            result.LastIOTimeStampUTC = sourceThingEnd.LastIOTimeStampUTC;
            result.LastIOValue        = sourceThingEnd.LastIOValue;

            #region Load MasterTypes
            result.EndPointType = APIEndPointTypeAdapter.fromEndPointType(sourceThingEnd.EndPointType);

            #endregion

            #region Load Parents
            if (loadParents)
            {
                result.Thing          = TypesMapper.APIThingAdapter.fromThing(sourceThingEnd.Thing, false, false);
                result.LastIOEndPoint = TypesMapper.APIEndPointAdapter.fromEndpoint(sourceThingEnd.EndPointIO.Endpoint, false, false);
            }

            #endregion


            #region Load Childs

            #endregion


            return(result);
        }
Пример #2
0
        public static APIEndPoint fromEndpoint(Endpoint sourceEndpoint, bool loadDevice, bool loadThing)
        {
            APIEndPoint result = new APIEndPoint();

            result.ID      = sourceEndpoint.ID;
            result.GUID    = sourceEndpoint.GUID;
            result.KeyPass = sourceEndpoint.KeyPass;
            result.Title   = sourceEndpoint.Title;

            result.IsNumericOnly = sourceEndpoint.IsNumericOnly;
            result.MinValue      = sourceEndpoint.MinValue;
            result.MaxValue      = sourceEndpoint.MaxValue;
            result.LowRange      = sourceEndpoint.LowRange;
            result.HighRange     = sourceEndpoint.HighRange;

            result.LastIOID           = sourceEndpoint.LastIOID;
            result.LastIOValue        = sourceEndpoint.LastIOValue;
            result.LastIOTimeStamp    = sourceEndpoint.LastIOTimeStamp;
            result.LastIOTimeStampUTC = sourceEndpoint.LastIOTimeStampUTC;

            #region Load Master Types
            result.EndPointType = APIEndPointTypeAdapter.fromEndPointType(sourceEndpoint.EndPointType);
            #endregion

            #region Load Parents
            if (loadDevice)
            {
                #region Device
                result.Device = TypesMapper.APIDeviceAdapter.fromDevice(sourceEndpoint.Device, false, false);

                #endregion
            }
            if (loadThing)
            {
                #region Thing
                result.Thing = TypesMapper.APIThingAdapter.fromThing(sourceEndpoint.Thing, false, false, false, false);

                #endregion
            }

            #endregion

            return(result);
        }