private void OnTagMessage(TagMessage message) { MainThread.BeginInvokeOnMainThread(() => { foreach (var tag in message.TagReadDataReading) { TagDisplayItem displayTag = null; if (!_scannedTags.ContainsKey(tag.EpcHexStr)) { displayTag = new TagDisplayItem(); _scannedTags[tag.EpcHexStr] = displayTag; displayTag.Epc = tag.EpcHexStr; displayTag.Count += tag.ReadCount; } else { displayTag = _scannedTags[tag.EpcHexStr]; displayTag.Epc = tag.EpcHexStr; displayTag.Count += tag.ReadCount; } } _tagListAdapter.NotifyDataSetChanged(); }); }
public string pushTagMessage(TagMessage message, string requestId) { if (string.IsNullOrEmpty(requestId)) { requestId = Guid.NewGuid().ToString(); } return(httpPostJSON(new Dictionary <string, object> { { "action", "pushMessageByTagAction" }, { "appkey", appKey }, { "clientData", Convert.ToBase64String(message.Data.getTransparent().ToByteArray()) }, { "transmissionContent", message.Data.getTransmissionContent() }, { "isOffline", message.IsOffline }, { "offlineExpireTime", message.OfflineExpireTime }, { "pushNetWorkType", message.PushNetWorkType }, { "appIdList", message.AppIdList }, { "speed", message.Speed }, { nameof(requestId), requestId }, { "tag", message.Tag } })); }
public async Task GetTagsStream(Empty e, IServerStreamWriter <TagMessage> s, ServerCallContext context) { for (int i = 0; i < 6; i++) { TagMessage tag = new TagMessage(); tag.Description = "Prova tag " + i; tag.Id = "15"; tag.Name = "TAG-" + i; tag.Value = "Valore test"; await Task.Delay(3000); await s.WriteAsync(tag); } }
public async Task AddTagMessage(TagMessage message) { _persistenceTagRecordModel.AddTagMessage(message); }
/// <summary> /// Allow the viewer to run logic such as updating the world, /// and gathering input. /// </summary> /// <param name="time">Provides a snapshot of timing values.</param> /// <param name="keyboard">Current keyboard state information.</param> /// <param name="prevkeyboard">Old keyboard state information. Used to get newly pressed keys.</param> /// <param name="multiplier">Movement scale multiplier.</param> protected override void Update(GameTime time, KeyboardState keyboard, KeyboardState prevkeyboard, double multiplier) { if (FrameIndex >= Estimate.Count) { if (ScreenshotMode) { Exit(); return; } FrameIndex = Estimate.Count - 1; Paused = true; } else if (FrameIndex < 0) { FrameIndex = 0; Paused = true; } bool speedup = keyboard.IsKeyDown(Keys.LeftShift); preframeindex = FrameIndex; Explorer.WayPoints = VehicleWaypoints[FrameIndex].Item2; Explorer.Pose = new PoseT().FromState(Explorer.WayPoints[Explorer.WayPoints.Count - 1].Item2); xnavigator.MapModel = Map[mapindices[FrameIndex]].Item2; xnavigator.WayTrajectories[0] = Estimate[FrameIndex]; xnavigator.Vehicle.WayPoints = Estimate[FrameIndex].Item2; xnavigator.Vehicle.Pose = new PoseT().FromState(Navigator.BestEstimate.WayPoints[Navigator.BestEstimate.WayPoints.Count - 1].Item2); if (xnavigator.Online) { MeasurementT dummy = new MeasurementT(); Explorer.MappedMeasurements.Clear(); foreach (double[] z in Measurements[mapindices[FrameIndex]].Item2) { Explorer.MappedMeasurements.Add(Explorer.Measurer.MeasureToMap(Explorer.Pose, dummy.FromLinear(z))); } } if (!taggone) { TagColor = tagupdater.Current; taggone = !tagupdater.MoveNext(); } double viewtime = Estimate[FrameIndex].Item1; int tagindex = Tags.BinarySearch(Tuple.Create(viewtime, "")); if (tagindex != ~Tags.Count) { if (tagindex < 0) { tagindex = ~tagindex; } if (Math.Abs(Tags[tagindex].Item1 - viewtime) < 1e-5) { TagMessage = Tags[tagindex].Item2; tagupdater = smoothFader(Color.White, Color.DimGray); taggone = !tagupdater.MoveNext(); } } Message = string.Format("time = {0,12:N4} frame = {1,5:N0}", viewtime, FrameIndex); if (ScreenshotMode) { // tag format: "screenshot theta_value phi_value zoom_value" // e.g. "screenshot 12 -0.4 0.97" if (TagMessage.StartsWith("screenshot")) { double[] parameters = FileParser.ParseDoubleList(TagMessage.Substring("screenshot".Length)); if (parameters.Length == 3) { double theta = parameters[0]; double phi = parameters[1]; double zoom = parameters[2]; SetCamera(theta, phi, zoom); Draw(time); Screenshot(); } } FrameIndex++; } else { // frame-by-frame fine time lookup, reverse if (keyboard.IsKeyDown(Keys.Q) && !prevkeyboard.IsKeyDown(Keys.Q)) { FrameIndex -= (speedup) ? 8 : 1; Paused = true; } // frame-by-frame, forward if (keyboard.IsKeyDown(Keys.W) && !prevkeyboard.IsKeyDown(Keys.W)) { FrameIndex += (speedup) ? 8 : 1; Paused = true; } // normal speed, reverse if (keyboard.IsKeyDown(Keys.A)) { FrameIndex -= (speedup) ? 8 : 1; Paused = true; } // normal speed, forward if (keyboard.IsKeyDown(Keys.S)) { Paused = false; } // add a new tag if (keyboard.IsKeyDown(Keys.G) && !prevkeyboard.IsKeyDown(Keys.G)) { Tags.Add(Tuple.Create(viewtime, "User tag")); Tags.Sort(); TagChanged = true; } if (!Paused) { FrameIndex += (speedup) ? 8 : 1; } } }
public void AddTagMessage(TagMessage tagMessage) { this.TagMessages.Add(tagMessage); }
public string pushTagMessage(TagMessage message) { return(pushTagMessage(message, null)); }