/// <summary> /// Send data to the client home page about location of joints for currently tracked skeleton, as well as state of current exercise being monitored /// </summary> /// <param name="skeleton"></param> /// <param name="jointPoints"></param> static void sendSkeletonAndExerciseData(Body skeleton, Dictionary <JointType, Point> jointPoints) { int frameCount = observationSequences.Count > 0 ? observationSequences[0].Count() : 0; double avgFramesForCurrExc = 0; if (exercisesToMonitor.Count() > 0) { if (avgFramesPerLabel_Training != null) { avgFramesForCurrExc = avgFramesPerLabel_Training.ContainsKey(exercisesToMonitor.ElementAt(0)) ? avgFramesPerLabel_Training[exercisesToMonitor.ElementAt(0)] : 0; } } String json = CustomJsonSerializer.SerializeHomePageData(skeleton, jointPoints, alarmRinging, avgFramesForCurrExc, frameCount, exercisesToMonitor); broadcastMessage(json); }
/// <summary> /// Send observation sequences to be animated on the front end canvas, after a user has done a training sample /// </summary> static void sendObservationSequences() { String data = CustomJsonSerializer.SerializeObservationSequences(observationSequences); broadcastMessage(createJsonString("train", "animate", data)); }