public async Task set_d2(double[] value, CancellationToken cancel = default(CancellationToken))
        {
            MessageEntry m = new MessageEntry(MessageEntryType.PropertySetReq, "d2");

            MessageElementUtil.AddMessageElement(m, MessageElementUtil.PackArray <double>("value", value));
            MessageEntry mr = await ProcessRequest(m, cancel);
        }
コード例 #2
0
        public virtual MessageElementPodArray PackPodToArray(ref T s2)
        {
            var mm = new List <MessageElement>();

            MessageElementUtil.AddMessageElement(mm,
                                                 MessageElementUtil.NewMessageElement(0, PackPod(ref s2))
                                                 );
            return(new MessageElementPodArray(TypeName, mm));
        }
        public async Task <double> add_val(double v, CancellationToken cancel = default(CancellationToken))
        {
            MessageEntry rr_m = new MessageEntry(MessageEntryType.FunctionCallReq, "add_val");

            MessageElementUtil.AddMessageElement(rr_m, MessageElementUtil.PackScalar <double>("v", v));
            MessageEntry rr_me = await ProcessRequest(rr_m, cancel);

            return(MessageElementUtil.UnpackScalar <double>(rr_me.FindElement("return")));
        }
コード例 #4
0
        public virtual MessageElementNamedArray PackNamedArrayStructToArray(ref T s2)
        {
            var mm = new List <MessageElement>();

            MessageElementUtil.AddMessageElement(mm,
                                                 MessageElementUtil.NewMessageElement("array", GetNumericArrayFromNamedArrayStruct(ref s2))
                                                 );

            return(new MessageElementNamedArray(TypeName, mm));
        }
        public async Task <double> func3(double d1, double d2, CancellationToken cancel = default(CancellationToken))
        {
            MessageEntry rr_m = new MessageEntry(MessageEntryType.FunctionCallReq, "func3");

            MessageElementUtil.AddMessageElement(rr_m, MessageElementUtil.PackScalar <double>("d1", d1));
            MessageElementUtil.AddMessageElement(rr_m, MessageElementUtil.PackScalar <double>("d2", d2));
            MessageEntry rr_me = await ProcessRequest(rr_m, cancel);

            return(MessageElementUtil.UnpackScalar <double>(rr_me.FindElement("return")));
        }
コード例 #6
0
        public virtual MessageElementNamedMultiDimArray PackNamedMultiDimArray(NamedMultiDimArray s3)
        {
            if (s3 == null)
            {
                return(null);
            }
            var l = new List <MessageElement>();

            MessageElementUtil.AddMessageElement(l, "dims", s3.Dims);
            MessageElementUtil.AddMessageElement(l, "array", PackNamedArray((T[])s3.namedarray_array));
            return(new MessageElementNamedMultiDimArray(TypeName, l));
        }
        public MessageElementStructure PackStructure(object s1)
        {
            List <MessageElement> m = new List <MessageElement>();

            if (s1 == null)
            {
                return(null);
            }
            ostruct2 s = (ostruct2)s1;

            MessageElementUtil.AddMessageElement(m, MessageElementUtil.PackArray <double>("a1", s.a1));
            return(new MessageElementStructure("com.robotraconteur.testing.TestService2.ostruct2", m));
        }
コード例 #8
0
        public virtual MessageElementPodMultiDimArray PackPodMultiDimArray(PodMultiDimArray s3)
        {
            if (s3 == null)
            {
                return(null);
            }
            var l = new List <MessageElement>();

            MessageElementUtil.AddMessageElement(l, "dims", s3.Dims);
            var s4 = PackPodArray((T[])s3.pod_array);

            MessageElementUtil.AddMessageElement(l, "array", s4);
            return(new MessageElementPodMultiDimArray(TypeName, l));
        }
コード例 #9
0
        public virtual MessageElementNamedArray PackNamedArray(T[] s2)
        {
            if (s2 == null)
            {
                return(null);
            }
            var mm = new List <MessageElement>();

            MessageElementUtil.AddMessageElement(mm,
                                                 MessageElementUtil.NewMessageElement("array", GetNumericArrayFromNamedArray(s2))
                                                 );

            return(new MessageElementNamedArray(TypeName, mm));
        }
コード例 #10
0
        public virtual MessageElementPodArray PackPodArray(T[] s2)
        {
            if (s2 == null)
            {
                return(null);
            }

            var mm = new List <MessageElement>();

            for (int i = 0; i < s2.Length; i++)
            {
                MessageElementUtil.AddMessageElement(mm,
                                                     MessageElementUtil.NewMessageElement(i, PackPod(ref s2[i]))
                                                     );
            }
            return(new MessageElementPodArray(TypeName, mm));
        }
        public override object GetCallbackFunction(uint rr_endpoint, string rr_membername)
        {
            switch (rr_membername)
            {
            case "cb2": {
                return(new Func <double, double, CancellationToken, Task>(async delegate(double d1, double d2, CancellationToken rr_cancel) {
                        MessageEntry rr_mm = new MessageEntry(MessageEntryType.CallbackCallReq, "cb2");
                        rr_mm.ServicePath = m_ServicePath;
                        MessageElementUtil.AddMessageElement(rr_mm, MessageElementUtil.PackScalar <double>("d1", d1));
                        MessageElementUtil.AddMessageElement(rr_mm, MessageElementUtil.PackScalar <double>("d2", d2));
                        MessageEntry rr_mr = await RRContext.ProcessCallbackRequest(rr_mm, rr_endpoint, rr_cancel);
                        MessageElement rr_me = rr_mr.FindElement("return");
                    }));
            }

            default:
                break;
            }
            throw new MemberNotFoundException("Member not found");
        }
        protected override async Task <MessageEntry> CallbackCall(MessageEntry rr_m)
        {
            string       rr_ename = rr_m.MemberName;
            MessageEntry rr_mr    = new MessageEntry(MessageEntryType.CallbackCallRet, rr_ename);

            rr_mr.ServicePath = rr_m.ServicePath;
            rr_mr.RequestID   = rr_m.RequestID;
            switch (rr_ename)
            {
            case "cb2": {
                double d1 = (MessageElementUtil.UnpackScalar <double>(rr_m.FindElement("d1")));
                double d2 = (MessageElementUtil.UnpackScalar <double>(rr_m.FindElement("d2")));
                await this.cb2.Function(d1, d2, default(CancellationToken));

                MessageElementUtil.AddMessageElement(rr_mr, MessageElementUtil.PackScalar <int>("return", 0));
                break;
            }

            default:
                throw new MemberNotFoundException("Member not found");
            }
            return(rr_mr);
        }