public void DispatchResult(string[] bundle)
        {
            int resultCode = Int32.Parse(bundle [1]);
            ReadDailyTotalResult result = resultCode == 0 ? new ReadDailyTotalResult(id) : new ReadDailyTotalResult(id, resultCode, bundle [2]);

            if (result.IsSucceeded)
            {
                DataSet dataSet = new DataSet(dataType);
                if (bundle.Length > 3)
                {
                    //Parse DataSet here
                    for (int i = 4; i < bundle.Length; i++)
                    {
                        string[]      pointsData = bundle[i].Split(new string[] { Connection.SEPARATOR2 }, StringSplitOptions.None);
                        List <string> dp         = new List <string> ();
                        dp.Add(pointsData[0]);
                        dp.Add(pointsData[1]);
                        dp.Add(pointsData[2]);
                        dp.Add(pointsData[3]);

                        DataPoint p = new DataPoint(new DataType(pointsData [0]), dp.ToArray(), Connection.SEPARATOR3);
                        dataSet.AddDataPoint(p);
                    }
                }
                result.SetData(dataSet);
            }
            OnRequestFinished(result);
        }
コード例 #2
0
    void Request_OnReadDailyTotalRequestFinished(SA.Fitness.ReadDailyTotalResult result)
    {
        Debug.Log("[OnReadDailyTotalRequestFinished] result status: " + result.IsSucceeded);
        if (result.IsSucceeded)
        {
            int k = 0;
            foreach (SA.Fitness.DataPoint dp in result.DataSet.DataPoints)
            {
                Debug.Log("Data Point #" + k.ToString() +
                          "\n\t Data Type: " + dp.DataType.Value +
                          "\n\t Start Time: " + dp.StartTime.ToString() +
                          "\n\t End Time: " + dp.EndTime.ToString()
                          );

                Debug.Log("Fields Count: " + dp.Fields.Count);
                foreach (KeyValuePair <string, object> pair in dp.Fields)
                {
                    Debug.Log("\t\t\t\t " + pair.Key + " : " + pair.Value.ToString());
                }

                k++;
            }
        }
    }