public static string SerializeHomePageData(Body skeleton, Dictionary<JointType, Point> jointPoints, Boolean alarmOn, double avgFrames, int currFrames, List<String> excRemaining)
        {
            JSONSkeleton jsonSkeleton = new JSONSkeleton
            {
                ID = skeleton.TrackingId.ToString(),
                Joints = new List<JSONJoint>()
            };

            foreach (JointType jointType in jointPoints.Keys)
            {
                jsonSkeleton.Joints.Add(new JSONJoint
                {
                    Name = jointType.ToString().ToLower(),
                    X = jointPoints[jointType].X,
                    Y = jointPoints[jointType].Y
                });
            }

            JSONHomePageData jsonHomePageData = new JSONHomePageData
            {
                Skeleton = jsonSkeleton,
                AlarmOn = alarmOn,
                AvgFrames = avgFrames,
                CurrFrames = currFrames,
                ExcRemaining = excRemaining
            };

            JSONHomePage jsonHomePage = new JSONHomePage{
                Page = "home",
                Operation = "default",
                Data = jsonHomePageData
            };

            return Serialize(jsonHomePage);
        }
Example #2
0
        public static string SerializeHomePageData(Body skeleton, Dictionary <JointType, Point> jointPoints, Boolean alarmOn, double avgFrames, int currFrames, List <String> excRemaining)
        {
            JSONSkeleton jsonSkeleton = new JSONSkeleton
            {
                ID     = skeleton.TrackingId.ToString(),
                Joints = new List <JSONJoint>()
            };

            foreach (JointType jointType in jointPoints.Keys)
            {
                jsonSkeleton.Joints.Add(new JSONJoint
                {
                    Name = jointType.ToString().ToLower(),
                    X    = jointPoints[jointType].X,
                    Y    = jointPoints[jointType].Y
                });
            }

            JSONHomePageData jsonHomePageData = new JSONHomePageData
            {
                Skeleton     = jsonSkeleton,
                AlarmOn      = alarmOn,
                AvgFrames    = avgFrames,
                CurrFrames   = currFrames,
                ExcRemaining = excRemaining
            };

            JSONHomePage jsonHomePage = new JSONHomePage {
                Page      = "home",
                Operation = "default",
                Data      = jsonHomePageData
            };


            return(Serialize(jsonHomePage));
        }