Example #1
0
    public void readSession()
    {
        DateTime dateTime = DateTime.Now.ToUniversalTime();

        dateTime = dateTime.AddDays(-5.0f);
        long startTime = (long)dateTime.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

        long endTime = (long)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

        SA.Fitness.ReadSessionRequest.Builder builder = new SA.Fitness.ReadSessionRequest.Builder();
        builder.SetIdentifier(SESSION_ID);
        builder.SetDataTypeToRead(SA.Fitness.DataType.TYPE_STEP_COUNT_DELTA);
        builder.SetTimeinterval(startTime, endTime, SA.Fitness.TimeUnit.Milliseconds);
        SA.Fitness.ReadSessionRequest request = builder.Build();
        request.OnSessionReadFinished += Request_OnSessionReadFinished;
        SA.Fitness.Sessions.Instance.ReadSession(request);
    }
        public void ReadSession(ReadSessionRequest request)
        {
            //TODO: Read session implementation will be added soon
            StringBuilder builder = new StringBuilder();

            builder.Append(request.Id);
            builder.Append(Connection.SEPARATOR1);
            builder.Append(request.SessionId);
            builder.Append(Connection.SEPARATOR1);
            builder.Append(request.StartTime);
            builder.Append(Connection.SEPARATOR1);
            builder.Append(request.EndTime);
            builder.Append(Connection.SEPARATOR1);
            builder.Append(request.TimeUnit.ToString());
            builder.Append(Connection.SEPARATOR1);
            builder.Append(request.DataType.Value);

            readSessionRequests.Add(request.Id, request);
            Proxy.ReadSession(builder.ToString());
        }