[NUI] Add DispatchParentTouchEvent
[platform/core/csapi/tizenfx.git] / src / Tizen.Sensor / Tizen.Sensor / BatchSensor.cs
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Collections.Generic;
19
20 namespace Tizen.Sensor
21 {
22     /// <summary>
23     /// Abstract sensor for series of sensor data
24     /// </summary>
25     /// <since_tizen> 8 </since_tizen>
26     public abstract class BatchSensor<TData> : Sensor where TData : Tizen.Sensor.BatchData
27     {
28         /// <summary>
29         /// Create BatchSensor
30         /// </summary>
31         /// <since_tizen> 8 </since_tizen>
32         public BatchSensor(uint index = 0) : base(index) {
33             UpdateBatchData((IntPtr)null, 0);
34         }
35
36         /// <summary>
37         /// Get general batch data
38         /// </summary>
39         /// <since_tizen> 8 </since_tizen>
40         public IReadOnlyList<TData> Data { get; protected set; }
41
42         /// <summary>
43         /// Convert general batch data to specific batch data
44         /// </summary>
45         /// <since_tizen> 8 </since_tizen>
46         /// <returns> List of converted specific batch data </returns>
47         protected abstract IReadOnlyList<TData> ConvertBatchData();
48
49         /// <summary>
50         /// Update the internal batch data using the latest events
51         /// </summary>
52         /// <param name="eventsPtr">
53         /// General batch data's raw pointer
54         /// </param>
55         /// <param name="eventsCount">
56         /// Number of general batch events
57         /// </param>
58         protected void UpdateBatchData(IntPtr eventsPtr, uint eventsCount)
59         {
60             updateBatchEvents(eventsPtr, eventsCount);
61             Data = ConvertBatchData();
62         }
63     }
64 }