public void Track_sim1_Verify_Tracking_Data() { _st = new SimulationTracker(); TrackingData td = _st.GetTrackingData("sim1"); Assert.AreEqual(2, td.Activity.Count); }
public void Parse_Sample_Response_Verify_Activities() { string xml = getSampleResponse("StandardResponse.xml"); TrackingData td = TrackingResponse.GetCommonTrackingData(xml); Assert.AreEqual(5, td.Activity.Count); Assert.AreEqual(DateTime.Parse("4-20-2001 8:12:00 am"), td.Activity[0].Timestamp); Assert.AreEqual("Picked up by DHL.", td.Activity[0].ShortDescription); Assert.AreEqual(DateTime.Parse("2001-04-19 9:46 am"), td.Activity[1].Timestamp); Assert.AreEqual("NORCROSS, GA, UNITED STATES", td.Activity[1].LocationDescription); Assert.AreEqual("Arrived at DHL facility.", td.Activity[1].ShortDescription); Assert.AreEqual(DateTime.Parse("2001-04-19 6:32 pm"), td.Activity[2].Timestamp); Assert.AreEqual("NORCROSS, GA, UNITED STATES", td.Activity[2].LocationDescription); Assert.AreEqual("Departing origin.", td.Activity[2].ShortDescription); Assert.AreEqual(DateTime.Parse("2001-04-20 11:45 am"), td.Activity[3].Timestamp); Assert.AreEqual("MACON, GA, UNITED STATES", td.Activity[3].LocationDescription); Assert.AreEqual("Delivery Attempted.", td.Activity[3].ShortDescription); Assert.AreEqual(DateTime.Parse("2001-04-23 12:18 pm"), td.Activity[4].Timestamp); Assert.AreEqual("MACON, GA, UNITED STATES", td.Activity[4].LocationDescription); Assert.AreEqual("Shipment delivered.", td.Activity[4].ShortDescription); }
private TrackingData RetrieveTrackingData(int skeletonID, Skeleton skel) { TrackingData result; trackingMapper.TryGetValue(skeletonID, out result); if (result == null) { IGesture[] gestures = new IGesture[] { new RHSWaveGesture(), new JumpGesture(skel) }; gestures[0].OnRecognized += OnWaveRecognized; /* Give the kalman filter some time to converge before firing events */ var kalman_wait_time = 1; // in seconds var dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += (sender, e) => { Debug.WriteLine("Delayed subscription on JUMP"); gestures[1].OnRecognized += OnJumpRecognized; dispatcherTimer.Stop(); }; dispatcherTimer.Interval = new TimeSpan(0, 0, kalman_wait_time); dispatcherTimer.Start(); result = new TrackingData(skeletonID, gestures); trackingMapper[skeletonID] = result; } return(result); }
private static TrackingData getSim1TrackingData() { var td = new TrackingData(); td.UsageRequirements = "The simulation tracker is for internal use only"; td.TrackerName = "Simulation Tracker"; td.EstimatedDelivery = DateTime.Parse("1-7-15"); td.Activity = new List <Activity>(); var activity = new Activity(); activity.Timestamp = DateTime.Parse("1-6-15 1:30 am"); activity.ShortDescription = "Picked Up"; activity.LocationDescription = "Atlanta, GA"; td.Activity.Add(activity); activity = new Activity(); activity.Timestamp = DateTime.Parse("1-6-15 2:53 pm"); activity.ShortDescription = "Processed"; activity.LocationDescription = "Richmond, VA"; td.Activity.Add(activity); return(td); }
public void Invalid_Simulation_Number_Verify_Null_Tracking_Data() { _st = new SimulationTracker(); TrackingData td = _st.GetTrackingData("simz"); Assert.IsNull(td); }
private bool FillBuffer(TrackingData td, uint buffer) { var stream = td.Player.Source; var read = stream.Read(_sampleBuffer, 0, td.BufferSize); if (td.Player.Loop) { // loop around and keep reading until the buffer is full while (read < td.BufferSize) { stream.SamplePosition = 0; read += stream.Read(_sampleBuffer, read, td.BufferSize - read); } } else if (read < td.BufferSize) { // should finish when leftover buffers are processed td.PendingFinish = true; } var format = stream.Format; if (read > 0) { AlBuffer.BufferData(buffer, (Channels)format.Channels, _sampleBuffer, read, format.SampleRate); } return(td.PendingFinish); }
public void Test() { var baseTracker = A.Fake <ITracker>(); var geocodeDb = A.Fake <IGeocodeDb>(); var baseTrackingData = new TrackingData(); baseTrackingData.Activity.Add(new Activity { LocationDescription = "Green Bay, WI" }); baseTrackingData.Activity.Add(new Activity { LocationDescription = "Seattle, WA" }); A.CallTo(() => baseTracker.GetTrackingData("abc")).Returns(baseTrackingData); A.CallTo(() => geocodeDb.GetCity("Green Bay", "WI")).Returns(new CityRecord() { Latitude = 10, Longitude = 11 }); A.CallTo(() => geocodeDb.GetCity("Seattle", "WA")).Returns(new CityRecord() { Latitude = 12, Longitude = 13 }); var gt = new GeocodingTracker(baseTracker, geocodeDb); var td = gt.GetTrackingData("abc"); Assert.AreEqual(10, td.Activity[0].Latitude); Assert.AreEqual(11, td.Activity[0].Longitude); Assert.AreEqual(12, td.Activity[1].Latitude); Assert.AreEqual(13, td.Activity[1].Longitude); }
/// <inheritdoc /> public void Untrack(IAudioPlayer player) { TrackingData td = null; lock (_trackedStreams) { for (var i = 0; i < _trackedStreams.Count; i++) { if (_trackedStreams[i].Player == player) { td = _trackedStreams[i]; _trackedStreams.RemoveAt(i); break; } } } if (td != null) { var buffers = td.Player.AlSource.QueuedBuffers(); for (var i = 0; i < buffers; i++) { td.Player.AlSource.UnqueueBuffer(); } td.Player.Device.DeleteBuffers(td.Buffers, td.BufferCount); } }
/// <inheritdoc /> public void EnsureBuffers(IAudioPlayer player, int n) { lock (_trackedStreams) { TrackingData td = null; for (var i = 0; i < _trackedStreams.Count; i++) { if (_trackedStreams[i].Player == player) { td = _trackedStreams[i]; break; } } if (td == null) { throw new Exception("Player is not tracked."); } var source = td.Player.AlSource; var queued = source.QueuedBuffers(); var toQueue = Math.Min(n, td.BufferCount) - queued; for (var i = 0; i < toQueue; i++) { var idx = (td.NextBuffer + i) % td.BufferCount; var bufName = td.Buffers[idx]; FillBuffer(td, bufName); source.QueueBuffer(bufName); } } }
/// <summary> /// Puts the tracking response data into the common /// <see cref="TrackingData"/> format. /// </summary> /// <returns> /// Gets the <see cref="TrackingData"/> that contains the tracking /// information for this response. /// </returns> public static TrackingData GetCommonTrackingData(string xml) { _log.Debug("Processing DHL tracking response data: " + xml); try { var td = new TrackingData(); var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); var response = GetResponseCode(xmlDoc); //Response code 0 = Package found if (response.Key != 0) { //Response code 1 = Not found, anything else should log the message if (response.Key != 1) { _log.InfoFormat("Received a response code of {0} from DHL, message: {1}", response.Key, response.Value); } return(null); } td.Activity = getActivities(xmlDoc); td.TrackerName = TRACKER_NAME; td.UsageRequirements = DhlTracker.USAGE_REQUIREMENTS; return(td); } catch (Exception ex) { throw new ResponseParseException(xml, ex); } }
/// <summary> /// Gets the tracking information from the child trackers, and passes /// back the tracking data from the first one to respond with data. /// </summary> /// <param name="trackingNumber"> /// The tracking number to request tracking data from the upstream trackers. /// </param> /// <returns> /// If one of the upstream trackers returns data, the first one in the list with /// non-null data will have it's data returned. If none of the upstream trackers /// returns data, NULL will be returned. /// </returns> public TrackingData GetTrackingData(string trackingNumber) { var trackerDelegates = new List <getTrackDataDelegate>(); var asyncResults = new List <IAsyncResult>(); TrackingData trackingData = null; foreach (ITracker currTracker in _trackers) { getTrackDataDelegate currDelegate = currTracker.GetTrackingData; trackerDelegates.Add(currDelegate); IAsyncResult result = currDelegate.BeginInvoke(trackingNumber, null, null); asyncResults.Add(result); } for (int i = 0; i < trackerDelegates.Count; i++) { TrackingData td = trackerDelegates[i].EndInvoke(asyncResults[i]); if (trackingData == null) { trackingData = td; } } return(trackingData); }
public void Intercept <TPayload>(TrackingData <TPayload> trackingData) { if (_isConfigured && ShouldSendPostClick <TPayload>(trackingData)) { var email = HttpUtility.UrlEncode(GetEmail(trackingData)); switch (trackingData.EventType) { case TrackEventPageView: HostingEnvironment.QueueBackgroundWorkItem(t => TrackPageView(trackingData, email)); break; case TrackEventBasket: HostingEnvironment.QueueBackgroundWorkItem(t => TrackBasket(trackingData, email)); break; case TrackEventCategory: HostingEnvironment.QueueBackgroundWorkItem(t => TrackCategoryView(trackingData, email)); break; case TrackEventOrder: HostingEnvironment.QueueBackgroundWorkItem(t => TrackOrder(trackingData, email)); break; case TrackEventProduct: HostingEnvironment.QueueBackgroundWorkItem(t => TrackProductView(trackingData, email)); break; } } }
private static TrackingData getSim2TrackingData() { var td = new TrackingData(); td.UsageRequirements = "The simulation tracker is for internal use only"; td.TrackerName = "Simulation Tracker"; td.EstimatedDelivery = DateTime.Parse("1-7-15"); td.Activity = new List <Activity>(); DateTime baseTime = DateTime.Now; baseTime = baseTime.AddMinutes(-baseTime.Minute); var activity = new Activity(); activity.Timestamp = baseTime.AddHours(-1); activity.ShortDescription = string.Format("Simulated activity at {0}", activity.Timestamp); activity.LocationDescription = "Simulated, SI"; td.Activity.Add(activity); activity = new Activity(); activity.Timestamp = baseTime; activity.ShortDescription = string.Format("Simulated activity at {0}", activity.Timestamp); activity.LocationDescription = "Simulated, SI"; td.Activity.Add(activity); return(td); }
public void TestNearestNeighborInterpolationDoubleEntry() { TrackingData data = new TrackingData(2); TrackingEntry expected1 = new TrackingEntry(0.0, new Point3(0.0f, 1.0f, 2.0f), new Point3(3.0f, 4.0f, 5.0f)); TrackingEntry expected2 = new TrackingEntry(0.0, new Point3(6.0f, 7.0f, 8.0f), new Point3(4.0f, 3.0f, 2.0f)); data.PushEntry(2.0, expected1.Position, expected1.Rotation); data.PushEntry(1.0, expected2.Position, expected2.Rotation); // t = 0.0 expected1.TimeStamp = 0.0; PerformEntryComparison(expected1, data.GetDataAtTime(expected1.TimeStamp, InterpolationMethod.NearestNeighbor)); // t = 0.5 expected1.TimeStamp = 0.5; PerformEntryComparison(expected1, data.GetDataAtTime(expected1.TimeStamp, InterpolationMethod.NearestNeighbor)); // t = 1.0 expected2.TimeStamp = 1.0; PerformEntryComparison(expected2, data.GetDataAtTime(expected2.TimeStamp, InterpolationMethod.NearestNeighbor)); // t = 1.5 expected2.TimeStamp = 1.5; PerformEntryComparison(expected2, data.GetDataAtTime(expected2.TimeStamp, InterpolationMethod.NearestNeighbor)); // t = 2.0 expected2.TimeStamp = 2.0; PerformEntryComparison(expected2, data.GetDataAtTime(expected2.TimeStamp, InterpolationMethod.NearestNeighbor)); // t = 3.0 expected2.TimeStamp = 3.0; PerformEntryComparison(expected2, data.GetDataAtTime(expected2.TimeStamp, InterpolationMethod.NearestNeighbor)); }
private void SessionStarted(int number) { _currentSessionData = new TrackingData(); _currentSessionData.VisualizationNumber = number; _timer.StartTimer(); _isSessionInProgress = true; }
/// <summary> /// Puts the tracking response data into the common /// <see cref="TrackingData"/> format. /// </summary> /// <returns> /// Gets the <see cref="TrackingData"/> that contains the tracking /// information for this response. /// </returns> public static TrackingData GetCommonTrackingData(string xml) { _log.Debug("Processing UPS tracking response data: " + xml); try { var td = new TrackingData(); var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); //Verify that the shipment information is available //in the XML, if it isn't, they must not have any //tracking data yet. var node = xmlDoc.SelectSingleNode("/TrackResponse/Shipment"); if (node == null) { return(null); } node = xmlDoc.SelectSingleNode("/TrackResponse/Shipment/ScheduledDeliveryDate/text()"); if (node != null) { td.EstimatedDelivery = UpsFormatConversions.parseUpsDate(node.Value); } var nodes = xmlDoc.SelectNodes("/TrackResponse/Shipment/ReferenceNumber/Value/text()"); for (var i = 0; i < nodes.Count; i++) { td.ReferenceNumbers.Add(nodes[i].Value); } node = xmlDoc.SelectSingleNode("/TrackResponse/Shipment/Service/Description/text()"); if (node != null) { td.ServiceType = node.Value; } node = xmlDoc.SelectSingleNode("/TrackResponse/Shipment/Package/PackageWeight/Weight/text()"); if (node != null) { td.Weight = decimal.Parse(node.Value); } td.Activity = getActivities(xmlDoc); td.TrackerName = SHIPPER_NAME; td.UsageRequirements = USAGE_REQUIREMENTS; td.LastUpdated = DateTime.Now; return(td); } catch (Exception ex) { throw new ResponseParseException(xml, ex); } }
private void TrackPageView <TPayload>(TrackingData <TPayload> trackingData, string email) { var pageView = trackingData as TrackingData <EpiPageViewWrapper>; if (pageView != null) { PostClickRequest(email, trackingData, gvalue1: pageView.PageUri, fvalue1: 1); } }
public void TestIsEmpty() { TrackingData emptyData = new TrackingData(0); TrackingData nonEmptyData = new TrackingData(1); nonEmptyData.PushEntry(1.0, new Point3(), new Point3()); Assert.IsTrue(emptyData.IsEmpty); Assert.IsFalse(nonEmptyData.IsEmpty); }
public ServerService() { InitializeComponent(); // VMSServerServiceEventLog logAccess = new SystemLogData(); moduleAccess = new ModuleData(); trackingAccess = new TrackingData(); }
public object Convert(object value, Type targetType, object parameter, string language) #endif { TrackingData trackingData = (TrackingData)value; return((trackingData.IsNoData) ? "-" : trackingData.PredictedArrivalInMinutes.ToString()); }
public void Non_Empty_Tracking_Number_Verify_Upstream_Tracker_Used() { var expectedTrackingData = new TrackingData(); _mockUpstreamTracker.Expect(x => x.GetTrackingData("abc")).Return(expectedTrackingData); var td = _t.GetTrackingData("abc"); Assert.AreEqual(td, expectedTrackingData); }
public object Convert(object value, Type targetType, object parameter, string language) #endif { TrackingData trackingData = (TrackingData)value; return((trackingData.IsFiltered) ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Colors.Black)); }
/// <summary> /// 查询订单物流信息 /// </summary> /// <param name="orderSysNo">订单号</param> /// <returns></returns> /// <remarks>2016-04-09 陈海裕 创建</remarks> public override Result <string> GetLogisticsTracking(int orderSysNo) { Result <string> result = new Result <string>(); //var tempResult = GetOrderExpressno(orderSysNo.ToString()); //result.Status = tempResult.Status; //result.Message = tempResult.Message; //if (result.Status == false) //{ // return result; //} CrossBorderLogisticsOrder cbLogiOrder = BLL.CrossBorderLogistics.CrossBorderLogisticsOrderBo.Instance.GetEntityByOrderSysNo(Convert.ToInt32(orderSysNo)); if (cbLogiOrder == null) { return(result); } string apiurl = "http://183.11.227.9:90/bdtsys/services/htapi/track/" + cbLogiOrder.LogisticsOrderId; System.Net.WebRequest request = System.Net.WebRequest.Create(apiurl); request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; System.Net.WebResponse response = request.GetResponse(); System.IO.Stream stream = response.GetResponseStream(); System.Text.Encoding encode = System.Text.Encoding.UTF8; System.IO.StreamReader reader = new System.IO.StreamReader(stream, encode); result.Message = reader.ReadToEnd(); JObject jObj = JObject.Parse(result.Message); List <TrackingData> logisticsTrackList = new List <TrackingData>(); if (jObj != null) { if (jObj.Property("trackSize") != null) { TrackingData trackingData = null; int trackSize = TConvert.ToInt32(jObj["trackSize"].ToString()); for (int i = trackSize - 1; i >= 0; i--) { trackingData = new TrackingData(); trackingData.time = TConvert.ToString(jObj["track" + i]["statustime"].ToString()); trackingData.content = TConvert.ToString(jObj["track" + i]["place"].ToString()) + TConvert.ToString(jObj["track" + i]["reason"].ToString()); logisticsTrackList.Add(trackingData); } StringBuilder htmlStr = new StringBuilder(); foreach (var item in logisticsTrackList) { htmlStr.Append("<tr><td width=\"25%\">" + item.time + "</td><td width=\"75%\">" + item.content + "</td></tr>"); } result.Data = htmlStr.ToString(); result.Status = true; } } return(result); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { List <Curve> crvList = new List <Curve>(); double threshold = new double(); double projectionDistance = new double(); double radius = new double(); bool trigger = new bool(); int maxChildren = new int(); if (!DA.GetDataList(0, crvList)) { return; } if (!DA.GetData(1, ref threshold)) { return; } if (!DA.GetData(2, ref projectionDistance)) { return; } if (!DA.GetData(3, ref radius)) { return; } if (!DA.GetData(4, ref trigger)) { return; } if (!DA.GetData(5, ref maxChildren)) { return; } List <Polyline> polylineList = new List <Polyline>(); foreach (Curve crv in crvList) { Polyline polyline = new Polyline(); bool convert = crv.TryGetPolyline(out polyline); if (!convert) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Could not convert curve to polyline, please ensure that you do not input a 3 degree nurbs curve"); } polylineList.Add(polyline); } if (polylineList.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "None of the curves converted to polylines properly, please check your input curves or polylines"); return; } java.util.List jData = CulebraData.Utilities.Convert.PolylinesToMultiShapes(polylineList); TrackingData trackingData = new TrackingData(jData, (float)threshold, (float)projectionDistance, (float)radius, trigger, maxChildren); DA.SetData(0, trackingData); }
public TrackingDataEntity(string trackingNumber, TrackingData trackingData) { PartitionKey = trackingNumber; RowKey = DateTime.UtcNow.ToString("O"); TrackingNumber = trackingNumber; //What is the performance impact here? TrackingDataJson = JsonConvert.SerializeObject(trackingData); }
/// <summary> /// You can update data cache manualy with this function. It will be apply after internal process /// Your modification will not be overwrite. /// </summary> /// <param name="asset"></param> /// <param name="data"></param> public void UpdateManualyDataCache(string asset, string field, ITracking data) { TrackingData currentHistory = null; if (_fieldsCache.ContainsKey(asset)) { currentHistory = _fieldsCache[asset]; UpdateCache(currentHistory, field, data); } }
//replays the drive from the data points public void SetData(TrackingData data) { recordedData = data; if (WestdriveSettings.SimulationMode == mode.visualize) { firstFrame = recordedData.Data.Keys.First(); lastFrame = recordedData.Data.Keys.Last(); currentFrame = firstFrame; } }
private void UpdateCache(TrackingData history, string field, ITracking data) { if (!history.fields.ContainsKey(field)) { history.fields.Add(field, ((TrackingData)data).fields[field]); } else { history.fields[field] = ((TrackingData)data).fields[field]; } }
public void TryLog(TrackedObjectData[] tod, Dictionary <int, string> lastDict) { if (State != LogState.Recording) { return; } var timeStamp = Time.unscaledTime; TrackingData currentData = new TrackingData(tod, lastDict, Time.unscaledTime); _data.Add(currentData); }
public void UsesTrackingNumberUtilities() { var downstreamTracker = MockRepository.GenerateMock <ITracker>(); var expectedTrackingData = new TrackingData(); downstreamTracker.Expect(x => x.GetTrackingData("abc123")).Return(expectedTrackingData); var t = new TrackingNumberStandardizerTracker(downstreamTracker); var actualTrackingData = t.GetTrackingData("abc 123"); downstreamTracker.VerifyAllExpectations(); }
public ConversationData() { CurrentResponse = null; TrackingData = new TrackingData(); PronounTrackingData = new PronounTrackingData(); HighTrackingData = new HighTrackingData(); HighTrackingData.HighContextList.Add( new HighContext { Element = "When", Value = ConversationalItems.GetCurrentTime() }); }