2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
20 namespace Tizen.Sensor
23 /// Abstract sensor for series of sensor data
25 /// <since_tizen> 8 </since_tizen>
26 public abstract class BatchSensor<TData> : Sensor where TData : Tizen.Sensor.BatchData
29 /// Create BatchSensor
31 /// <since_tizen> 8 </since_tizen>
32 public BatchSensor(uint index = 0) : base(index) {
33 UpdateBatchData((IntPtr)null, 0);
37 /// Get general batch data
39 /// <since_tizen> 8 </since_tizen>
40 public IReadOnlyList<TData> Data { get; protected set; }
43 /// Convert general batch data to specific batch data
45 /// <since_tizen> 8 </since_tizen>
46 /// <returns> List of converted specific batch data </returns>
47 protected abstract IReadOnlyList<TData> ConvertBatchData();
50 /// Update the internal batch data using the latest events
52 /// <param name="eventsPtr">
53 /// General batch data's raw pointer
55 /// <param name="eventsCount">
56 /// Number of general batch events
58 protected void UpdateBatchData(IntPtr eventsPtr, uint eventsCount)
60 updateBatchEvents(eventsPtr, eventsCount);
61 Data = ConvertBatchData();