[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / LowBatterySignalType.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
18 namespace Tizen.NUI
19 {
20     /// <summary>
21     /// LowBatterySignalType.
22     /// </summary>
23     internal class LowBatterySignalType : Disposable
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26
27         /// <summary>
28         /// swigCMemOwn.
29         /// </summary>
30         protected bool swigCMemOwn;
31
32         internal LowBatterySignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
33         {
34             swigCMemOwn = cMemoryOwn;
35             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36         }
37
38         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LowBatterySignalType obj)
39         {
40             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41         }
42
43         /// <summary>
44         /// you can override it to clean-up your own resources.
45         /// </summary>
46         /// <param name="type">DisposeTypes</param>
47         /// <since_tizen> 3 </since_tizen>
48         protected override void Dispose(DisposeTypes type)
49         {
50             if (disposed)
51             {
52                 return;
53             }
54
55             //Release your own unmanaged resources here.
56             //You should not access any managed member here except static instance.
57             //because the execution order of Finalizes is non-deterministic.
58
59             if (swigCPtr.Handle != global::System.IntPtr.Zero)
60             {
61                 if (swigCMemOwn)
62                 {
63                     swigCMemOwn = false;
64                     Interop.LowBatterySignal.delete_LowBatterySignalType(swigCPtr);
65                 }
66                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
67             }
68             base.Dispose(type);
69         }
70
71         /// <summary>
72         /// Empty 
73         /// </summary>
74         /// <returns>true if there is no signal attached</returns>
75         public bool Empty()
76         {
77             bool ret = Interop.LowBatterySignal.LowBatterySignalType_Empty(swigCPtr);
78             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79             return ret;
80         }
81
82         /// <summary>
83         /// GetConnectionCount
84         /// </summary>
85         /// <returns>number of attached signals</returns>
86         public uint GetConnectionCount()
87         {
88             uint ret = Interop.LowBatterySignal.LowBatterySignalType_GetConnectionCount(swigCPtr);
89             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90             return ret;
91         }
92
93         /// <summary>
94         /// signal connect
95         /// </summary>
96         /// <param name="func"></param>
97         public void Connect(System.Delegate func)
98         {
99             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
100             {
101                 Interop.LowBatterySignal.LowBatterySignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
102                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
103             }
104         }
105
106         /// <summary>
107         /// signal disconnect
108         /// </summary>
109         /// <param name="func"></param>
110         public void Disconnect(System.Delegate func)
111         {
112             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
113             {
114                 Interop.LowBatterySignal.LowBatterySignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
115                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
116             }
117         }
118
119         internal void Emit(Application.BatteryStatus arg)
120         {
121             Interop.LowBatterySignal.LowBatterySignalType_Emit(swigCPtr, (int)arg);
122             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123         }
124
125         /// <summary>
126         /// LowBatterySignalType
127         /// </summary>
128         public LowBatterySignalType() : this(Interop.LowBatterySignal.new_LowBatterySignalType(), true)
129         {
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131         }
132     }
133 }
134