Revert "Added Null Checks and Rearranged Source Code"
authorShinHui Kang <sinikang@samsung.com>
Thu, 6 Oct 2016 01:16:53 +0000 (10:16 +0900)
committerShinHui Kang <sinikang@samsung.com>
Thu, 6 Oct 2016 01:16:53 +0000 (10:16 +0900)
This reverts commit 8dd0b28603cdb0cc25664d7fc98a065bc94abee8.

Change-Id: I2be7d5d9f81803d7a935bd84f1ac4680ebb7dd0e

src/Tizen.Telephony/Tizen.Telephony.Net45.csproj
src/Tizen.Telephony/Tizen.Telephony.csproj
src/Tizen.Telephony/Tizen.Telephony/Call.cs
src/Tizen.Telephony/Tizen.Telephony/CallHandle.cs
src/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs
src/Tizen.Telephony/Tizen.Telephony/Modem.cs
src/Tizen.Telephony/Tizen.Telephony/Network.cs
src/Tizen.Telephony/Tizen.Telephony/Sim.cs
src/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs
src/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs
src/Tizen.Telephony/Tizen.Telephony/Telephony.cs

index 860b485..c5da583 100755 (executable)
     <AssemblyOriginatorKeyFile>Tizen.Telephony.snk</AssemblyOriginatorKeyFile>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
     <Compile Include="Interop\Interop.Libraries.cs" />
     <Compile Include="Interop\Interop.Telephony.cs" />
     <Compile Include="Interop\Interop.Call.cs" />
index 503118d..5929b10 100755 (executable)
     <None Include="Tizen.Telephony.project.json" />
     <None Include="Tizen.Telephony.snk" />
   </ItemGroup>
-  <ItemGroup />
-  <ItemGroup>
-    <Reference Include="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
-  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath)\Tizen\Tizen.CSharp.GBS.targets" Condition="Exists('$(MSBuildExtensionsPath)\Tizen\Tizen.CSharp.GBS.targets')" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
index f86a283..c1317c1 100755 (executable)
@@ -19,28 +19,14 @@ namespace Tizen.Telephony
     /// </summary>
     public class Call
     {
-        internal IntPtr _handle;
-        private List<IntPtr> _callHandle = new List<IntPtr>();
-        private List<CallHandle> _list = new List<CallHandle>();
-        private IntPtr _callList;
-        private Interop.Call.SafeCallList _safeCallList;
-
         /// <summary>
         /// Public Constructor
         /// </summary>
         /// <param name="handle">
         /// SlotHandle received in the Manager.Init API
         /// </param>
-        /// <exception cref="ArgumentNullException">
-        /// This exception occurs if handle provided is null
-        /// </exception>
         public Call(SlotHandle handle)
         {
-            if (handle == null)
-            {
-                throw new ArgumentNullException();
-            }
-
             _handle = handle._handle;
         }
 
@@ -78,12 +64,6 @@ namespace Tizen.Telephony
         /// <returns>
         /// List of CallHandle for existing calls.
         /// </returns>
-        /// <exception cref="InvalidOperationException">
-        /// This exception can occur due to one of the following reasons:
-        /// 1. Permission Denied
-        /// 2. Not Supported
-        /// 3. Operation Failed
-        /// </exception>
         public List<CallHandle> GetCallHandleList()
         {
             uint count;
@@ -93,23 +73,26 @@ namespace Tizen.Telephony
             if (error != TelephonyError.None)
             {
                 Tizen.Log.Error(Interop.Telephony.LogTag, "GetCallList Failed with error " + error);
-                throw ExceptionFactory.CreateException(error);
+                return _list;
             }
 
             _callHandle.Clear();
-            if (count > 0)
+            IntPtr[] handleArray = new IntPtr[count];
+            Marshal.Copy(_callList, handleArray, 0, (int)count);
+            foreach (IntPtr handle in handleArray)
             {
-                IntPtr[] handleArray = new IntPtr[count];
-                Marshal.Copy(_callList, handleArray, 0, (int)count);
-                foreach (IntPtr handle in handleArray)
-                {
-                    CallHandle info = new CallHandle(handle);
-                    _list.Add(info);
-                }
-
-                _safeCallList = new Interop.Call.SafeCallList(_callList, count);
+                CallHandle info = new CallHandle(handle);
+                _list.Add(info);
             }
+
+            _safeCallList = new Interop.Call.SafeCallList(_callList, count);
             return _list;
         }
+
+        internal IntPtr _handle;
+        private List<IntPtr> _callHandle = new List<IntPtr>();
+        private List<CallHandle> _list = new List<CallHandle>();
+        private IntPtr _callList;
+        private Interop.Call.SafeCallList _safeCallList;
     }
 }
index 6be7936..fc2c2d1 100755 (executable)
@@ -16,8 +16,6 @@ namespace Tizen.Telephony
     /// </summary>
     public class CallHandle
     {
-        private IntPtr _callHandle;
-
         /// <summary>
         /// Enumeration for the call status.
         /// </summary>
@@ -239,5 +237,7 @@ namespace Tizen.Telephony
         {
             _callHandle = handle;
         }
+
+        private IntPtr _callHandle;
     }
 }
index bfc3703..3856f8a 100755 (executable)
@@ -14,12 +14,6 @@ namespace Tizen.Telephony
     /// </summary>
     public class ChangeNotificationEventArgs : EventArgs
     {
-        internal ChangeNotificationEventArgs(Notification noti, object data)
-        {
-            NotificationType = noti;
-            NotificationData = data;
-        }
-
         /// <summary>
         /// Enumeration for Telephony notification.
         /// </summary>
@@ -262,19 +256,17 @@ namespace Tizen.Telephony
         /// <summary>
         /// Telephony notification type
         /// </summary>
-        public Notification NotificationType
-        {
-            get;
-            internal set;
-        }
+        public Notification notificationType;
 
         /// <summary>
         /// Data as per the Notification type
         /// </summary>
-        public object NotificationData
+        public object notificationData;
+
+        internal ChangeNotificationEventArgs(Notification noti, object data)
         {
-            get;
-            internal set;
+            notificationType = noti;
+            notificationData = data;
         }
     }
 }
index 23001b9..856aed8 100755 (executable)
@@ -15,24 +15,14 @@ namespace Tizen.Telephony
     /// </summary>
     public class Modem
     {
-        internal IntPtr _handle;
-
         /// <summary>
         /// Modem Class Constructor
         /// </summary>
         /// <param name="handle">
         /// SlotHandle received in the Manager.Init API
         /// </param>
-        /// <exception cref="ArgumentNullException">
-        /// This exception occurs if handle provided is null
-        /// </exception>
         public Modem(SlotHandle handle)
         {
-            if (handle == null)
-            {
-                throw new ArgumentNullException();
-            }
-
             _handle = handle._handle;
         }
 
@@ -142,5 +132,7 @@ namespace Tizen.Telephony
             }
 
         }
+
+        internal IntPtr _handle;
     }
 }
index 25cf220..45c6728 100755 (executable)
@@ -15,27 +15,6 @@ namespace Tizen.Telephony
     /// </summary>
     public class Network
     {
-        internal IntPtr _handle;
-
-        /// <summary>
-        /// Network Class Constructor
-        /// </summary>
-        /// <param name="handle">
-        /// SlotHandle received in the Manager.Init API
-        /// </param>
-        /// <exception cref="ArgumentNullException">
-        /// This exception occurs if handle provided is null
-        /// </exception>
-        public Network(SlotHandle handle)
-        {
-            if (handle == null)
-            {
-                throw new ArgumentNullException();
-            }
-
-            _handle = handle._handle;
-        }
-
         /// <summary>
         /// Enumeration for RSSI (Receive Signal Strength Indicator).
         /// Rssi6 indicates the highest strength.
@@ -274,6 +253,17 @@ namespace Tizen.Telephony
         }
 
         /// <summary>
+        /// Network Class Constructor
+        /// </summary>
+        /// <param name="handle">
+        /// SlotHandle received in the Manager.Init API
+        /// </param>
+        public Network(SlotHandle handle)
+        {
+            _handle = handle._handle;
+        }
+
+        /// <summary>
         /// Gets the LAC (Location Area Code) of the current location.
         /// </summary>
         /// <priviledge>
@@ -836,5 +826,7 @@ namespace Tizen.Telephony
                 return baseStationLongitude;
             }
         }
+
+        internal IntPtr _handle;
     }
 }
index 242949a..143e73f 100755 (executable)
@@ -16,27 +16,6 @@ namespace Tizen.Telephony
     /// </summary>
     public class Sim
     {
-        internal IntPtr _handle;
-
-        /// <summary>
-        /// Sim Class Constructor
-        /// </summary>
-        /// <param name="handle">
-        /// SlotHandle received in the Manager.Init API
-        /// </param>
-        /// <exception cref="ArgumentNullException">
-        /// This exception occurs if handle provided is null
-        /// </exception>
-        public Sim(SlotHandle handle)
-        {
-            if (handle == null)
-            {
-                throw new ArgumentNullException();
-            }
-
-            _handle = handle._handle;
-        }
-
         /// <summary>
         /// Enumeration for the state of SIM card.
         /// </summary>
@@ -111,6 +90,17 @@ namespace Tizen.Telephony
         }
 
         /// <summary>
+        /// Sim Class Constructor
+        /// </summary>
+        /// <param name="handle">
+        /// SlotHandle received in the Manager.Init API
+        /// </param>
+        public Sim(SlotHandle handle)
+        {
+            _handle = handle._handle;
+        }
+
+        /// <summary>
         /// Gets the Integrated Circuit Card IDentification (ICC-ID).
         /// The Integrated Circuit Card Identification number internationally identifies SIM cards.
         /// </summary>
@@ -462,5 +452,7 @@ namespace Tizen.Telephony
                 return callForwardingIndicatorState;
             }
         }
+
+        internal IntPtr _handle;
     }
 }
index 8fb6a1d..e19b4ab 100755 (executable)
@@ -14,28 +14,12 @@ namespace Tizen.Telephony
 {
     public class SlotHandle
     {
-        internal IntPtr _handle;
-        private List<Interop.Telephony.NotificationCallback> _changeNotificationList = new List<Interop.Telephony.NotificationCallback>();
-
-        internal SlotHandle(IntPtr handle)
-        {
-            _handle = handle;
-        }
-
         /// <summary>
         /// Event Handler for Receiving the Telephony State Changes
         /// this event will be triggered for the NotificationId's given in the SetNotificationId API
         /// </summary>
         public event EventHandler<ChangeNotificationEventArgs> ChangeNotification;
 
-        internal IntPtr Handle
-        {
-            get
-            {
-                return _handle;
-            }
-        }
-
         /// <summary>
         /// The Notification Id's for which the ChangeNotification event will be triggered
         /// </summary>
@@ -86,6 +70,20 @@ namespace Tizen.Telephony
             }
         }
 
+        internal SlotHandle(IntPtr handle)
+        {
+            _handle = handle;
+        }
+
+        internal IntPtr Handle
+        {
+            get
+            {
+                return _handle;
+            }
+        }
+
+        internal IntPtr _handle;
         private void SetCallback(ChangeNotificationEventArgs.Notification n)
         {
             Interop.Telephony.NotificationCallback NotificationDelegate = (IntPtr handle, ChangeNotificationEventArgs.Notification notiId, IntPtr data, IntPtr userData) =>
@@ -288,5 +286,7 @@ namespace Tizen.Telephony
                 throw e;
             }
         }
+
+        private List<Interop.Telephony.NotificationCallback> _changeNotificationList = new List<Interop.Telephony.NotificationCallback>();
     }
 }
index 9468bca..3be5c31 100755 (executable)
@@ -14,18 +14,14 @@ namespace Tizen.Telephony
     /// </summary>
     public class StateEventArgs : EventArgs
     {
-        internal StateEventArgs(State s)
-        {
-            CurrentState = s;
-        }
-
         /// <summary>
         /// The Current State
         /// </summary>
-        public State CurrentState
+        public State currentState;
+
+        internal StateEventArgs(State s)
         {
-            get;
-            internal set;
+            currentState = s;
         }
     }
 }
index 5e6b5ed..8093ed4 100755 (executable)
@@ -65,16 +65,6 @@ namespace Tizen.Telephony
     /// </summary>
     public static class Manager
     {
-        internal static List<SlotHandle> _telephonyHandle = new List<SlotHandle>();
-        private static HandleList _handleList;
-        private static bool _isInitialized = false;
-        private static event EventHandler<StateEventArgs> _stateChanged;
-        private static StateChangedCallback stateDelegate = delegate(State state, IntPtr userData)
-        {
-            StateEventArgs args = new StateEventArgs(state);
-            _stateChanged?.Invoke(null, args);
-        };
-
         /// <summary>
         /// Event Handler to be invoked when the telephony state changes.
         /// </summary>
@@ -113,28 +103,6 @@ namespace Tizen.Telephony
         }
 
         /// <summary>
-        /// Acquires the telephony state value.
-        /// </summary>
-        /// <returns>
-        /// The state value of telephony.
-        /// </returns>
-        public static State CurrentState
-        {
-            get
-            {
-                State state = State.NotReady;
-                TelephonyError error = Interop.Telephony.TelephonyGetState(out state);
-                if (error != TelephonyError.None)
-                {
-                    Tizen.Log.Error(Interop.Telephony.LogTag, "GetState Failed with Error " + error);
-                    return State.Unavailable;
-                }
-
-                return state;
-            }
-        }
-
-        /// <summary>
         /// Acquires the Number of available handles to use the telephony API.
         /// </summary>
         /// <returns>
@@ -177,7 +145,7 @@ namespace Tizen.Telephony
             }
 
             _isInitialized = true;
-            //Tizen.Log.Info(Interop.Telephony.LogTag, "Returning the number of sims " + _handleList.Count);
+            Tizen.Log.Info(Interop.Telephony.LogTag, "Returning the number of sims " + _handleList.Count);
             return _telephonyHandle;
         }
 
@@ -208,6 +176,28 @@ namespace Tizen.Telephony
             _telephonyHandle.Clear();
         }
 
+        /// <summary>
+        /// Acquires the telephony state value.
+        /// </summary>
+        /// <returns>
+        /// The state value of telephony.
+        /// </returns>
+        public static State CurrentState
+        {
+            get
+            {
+                State state = State.NotReady;
+                TelephonyError error = Interop.Telephony.TelephonyGetState(out state);
+                if (error != TelephonyError.None)
+                {
+                    Tizen.Log.Error(Interop.Telephony.LogTag, "GetState Failed with Error " + error);
+                    return State.Unavailable;
+                }
+
+                return state;
+            }
+        }
+
         internal static SlotHandle FindHandle(IntPtr handle)
         {
             SlotHandle temp = _telephonyHandle[0];
@@ -221,5 +211,16 @@ namespace Tizen.Telephony
 
             return temp;
         }
+
+        internal static List<SlotHandle> _telephonyHandle = new List<SlotHandle>();
+
+        private static StateChangedCallback stateDelegate = delegate(State state, IntPtr userData)
+        {
+            StateEventArgs args = new StateEventArgs(state);
+            _stateChanged?.Invoke(null, args);
+        };
+        private static HandleList _handleList;
+        private static bool _isInitialized = false;
+        private static event EventHandler<StateEventArgs> _stateChanged;
     }
 }