예제 #1
0
 /// <summary>
 /// Post HttpPost and return the response port.
 /// </summary>
 /// <param name="body"></param>
 /// <returns></returns>
 public virtual PortSet <Microsoft.Dss.Core.DsspHttp.HttpResponseType, Fault> HttpPost(Microsoft.Dss.Core.DsspHttp.HttpPostRequestType body)
 {
     Microsoft.Dss.Core.DsspHttp.HttpPost op = new Microsoft.Dss.Core.DsspHttp.HttpPost();
     op.Body = body ?? new Microsoft.Dss.Core.DsspHttp.HttpPostRequestType();
     this.Post(op);
     return(op.ResponsePort);
 }
예제 #2
0
        public void DriveHttpPostHandler(Microsoft.Dss.Core.DsspHttp.HttpPost httppost)
        {
            var request = httppost.GetHeader <HttpPostRequestData>();

            if (request == null || request.TranslatedOperation == null)
            {
                httppost.ResponsePort.Post(new HttpResponseType(HttpStatusCode.BadRequest, soap.Fault.FromException(new InvalidOperationException())));
            }

            var op            = request.TranslatedOperation;
            var enableddrive  = op as drive.EnableDrive;
            var setdrivepower = op as drive.SetDrivePower;
            var allstop       = op as drive.AllStop;
            var rotatedegrees = op as drive.RotateDegrees;
            var drivedistance = op as drive.DriveDistance;
            var setdrivespeed = op as drive.SetDriveSpeed;
            var update        = op as drive.Update;
            var resetencoders = op as drive.ResetEncoders;

            if (enableddrive != null)
            {
                this.drivePort.Post(enableddrive);
            }
            else if (resetencoders != null)
            {
                this.drivePort.Post(resetencoders);
            }
            else if (setdrivepower != null)
            {
                this.drivePort.Post(setdrivepower);
            }
            else if (allstop != null)
            {
                this.drivePort.Post(allstop);
            }
            else if (rotatedegrees != null)
            {
                this.drivePort.Post(rotatedegrees);
            }
            else if (drivedistance != null)
            {
                this.drivePort.Post(drivedistance);
            }
            else if (setdrivespeed != null)
            {
                this.drivePort.Post(setdrivespeed);
            }
            else if (update != null)
            {
                this.drivePort.Post(update);
            }
            else
            {
                httppost.ResponsePort.Post(new HttpResponseType(HttpStatusCode.BadRequest, soap.Fault.FromException(new InvalidOperationException())));
                return;
            }

            httppost.ResponsePort.Post(new HttpResponseType(HttpStatusCode.OK, this.state));
        }
        public void KinectServiceHttpPostHandler(Microsoft.Dss.Core.DsspHttp.HttpPost post)
        {
            var request = post.GetHeader <HttpPostRequestData>();

            if (request != null &&
                request.TranslatedOperation != null)
            {
                if (request.TranslatedOperation is kinect.UpdateTilt)
                {
                    var tilt = (kinect.UpdateTilt)request.TranslatedOperation;
                    this.KinectServiceUpdateTiltHandler(tilt);
                }
            }
            else
            {
                throw new InvalidOperationException();
            }

            post.ResponsePort.Post(new HttpResponseType(
                                       HttpStatusCode.OK,
                                       this.state,
                                       this.xslttransform));
        }
예제 #4
0
 public void DriveHttpPostHandler(Microsoft.Dss.Core.DsspHttp.HttpPost httppost)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public virtual IEnumerator <ITask> HttpPostHandler(dssphttp.HttpPost submit)
 {
     LogError("This service doesn't accept HttpPosts");
     submit.ResponsePort.Post(new dssphttp.HttpResponseType());
     yield break;
 }