public static IList <Edge> GetRoutesAnotherAPI(string url, Parcel parcel) { IList <Edge> edges = new List <Edge>(); Dimension dim = parcel.Dimensions; List <string> types = new List <string>(); foreach (var type in parcel.Type) { types.Add(type.Name); } EdgeRequest requestBody = new EdgeRequest((int)dim.Width, (int)dim.Height, (int)dim.Length, 39, types); HttpClient client = new HttpClient(); client.BaseAddress = new Uri(url); // Add an Accept header for JSON format. client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("").Result; // Blocking call! Program will wait here until a response is received or a timeout occurs. if (response.IsSuccessStatusCode) { // Parse the response body. var dataObjects = response.Content.ReadAsAsync <IEnumerable <System.Security.Cryptography.Xml.DataObject> >().Result; //Make sure to add a reference to System.Net.Http.Formatting.dll foreach (var d in dataObjects) { } EdgeResponse edgeResponse = JsonConvert.DeserializeObject <EdgeResponse>(""); } return(edges); }
private static void OnRegister(EdgeResponse response) { Console.WriteLine(response.message); if (response.status != StatusCodes.Status200OK) { Environment.Exit(1); } }
private void SendRFIDEvent(string incomingUID) { EdgeResponse resp = EdgeUtils.NewSuccessResponse(); rfidevent e = new rfidevent { Uid = incomingUID }; resp.Payload = e.ToByteString(); observer.SendEvent(resp); }