Ejemplo n.º 1
0
        //--------------------------------------
        // PUBLIC API CALL METHODS
        //--------------------------------------

        public void RequestSensors(SensorRequest request)
        {
            if (request.DataTypes.Count == 0 || request.DataSourceTypes.Count == 0)
            {
                Debug.LogWarning("[SA.Fitness] Sensore Request should be setup correctly!");
                return;
            }

            StringBuilder builder = new StringBuilder();

            builder.Append(request.Id);
            builder.Append(Connection.SEPARATOR2);

            builder.Append(request.DataTypes[0].Value);
            for (int i = 1; i < request.DataTypes.Count; i++)
            {
                builder.Append(Connection.SEPARATOR1);
                builder.Append(request.DataTypes[i].Value);
            }
            builder.Append(Connection.SEPARATOR2);

            builder.Append((int)request.DataSourceTypes[0]);
            for (int i = 1; i < request.DataSourceTypes.Count; i++)
            {
                builder.Append(Connection.SEPARATOR1);
                builder.Append((int)request.DataSourceTypes[i]);
            }

            requests.Add(request.Id, request);
            Proxy.RequestDataSources(builder.ToString());
        }
Ejemplo n.º 2
0
 private void requestSensors()
 {
     SA.Fitness.SensorRequest.Builder builder = new SA.Fitness.SensorRequest.Builder()
                                                .AddDataType(SA.Fitness.DataType.TYPE_LOCATION_SAMPLE)
                                                .AddDataType(SA.Fitness.DataType.TYPE_LOCATION_TRACK)
                                                .AddDataType(SA.Fitness.DataType.TYPE_STEP_COUNT_DELTA)
                                                .AddDataType(SA.Fitness.DataType.TYPE_DISTANCE_DELTA)
                                                .AddDataSourceType(SA.Fitness.DataSourceType.RAW)
                                                .AddDataSourceType(SA.Fitness.DataSourceType.DERIVED);
     SA.Fitness.SensorRequest request = builder.Build();
     request.OnRequestFinished += Request_OnRequestFinished;
     SA.Fitness.Sensors.Instance.RequestSensors(request);
 }