Beispiel #1
0
        /// <summary>
        /// Reads a property from the object
        /// </summary>
        /// <typeparam name="T1">The type of property to read</typeparam>
        /// <param name="property1Expr">The property expression</param>
        public async Task <Tuple <ErrorOr <T1> > > ReadPropertiesSafeAsync <T1>(Expression <Func <TObj, T1> > property1Expr)
        {
            var results = await Client.SendRPMForReadResultsAsync(DeviceInstance,
                                                                  ObjectHelpers.GetObjectPropertyReference(ObjectIdentifier, property1Expr));

            return(new Tuple <ErrorOr <T1> >(
                       Client.FromReadResult <T1>(results[0])));
        }
Beispiel #2
0
        /// <summary>
        /// Reads three properties from the object
        /// </summary>
        /// <typeparam name="T1">The type of the first property</typeparam>
        /// <typeparam name="T2">The type of the second property</typeparam>
        /// <typeparam name="T3">The type of the third property</typeparam>
        /// <param name="property1Expr">The expression for the first property</param>
        /// <param name="property2Expr">The expression for the second property</param>
        /// <param name="property3Expr">The expression for the third property</param>
        /// <returns>The three property tuple</returns>
        public async Task <Tuple <ErrorOr <T1>, ErrorOr <T2>, ErrorOr <T3> > > ReadPropertiesSafeAsync <T1, T2, T3>(
            Expression <Func <TObj, T1> > property1Expr,
            Expression <Func <TObj, T2> > property2Expr,
            Expression <Func <TObj, T3> > property3Expr)
        {
            var values = await Client.SendRPMForReadResultsAsync(DeviceInstance,
                                                                 ObjectHelpers.GetObjectPropertyReference(ObjectIdentifier, property1Expr),
                                                                 ObjectHelpers.GetObjectPropertyReference(ObjectIdentifier, property2Expr),
                                                                 ObjectHelpers.GetObjectPropertyReference(ObjectIdentifier, property3Expr));

            return(new Tuple <ErrorOr <T1>, ErrorOr <T2>, ErrorOr <T3> >(
                       Client.FromReadResult <T1>(values[0]),
                       Client.FromReadResult <T2>(values[1]),
                       Client.FromReadResult <T3>(values[2])));
        }