Location Manager Implementation
authorAbhijit RD <abhijit.rd@samsung.com>
Thu, 26 May 2016 06:08:43 +0000 (11:38 +0530)
committerSeunghyun Choi <sh4682.choi@samsung.com>
Thu, 2 Jun 2016 05:37:24 +0000 (14:37 +0900)
Change-Id: I6fbab6d266e1d1ed5ed7807a1a9964fe00beaf11
Signed-off-by: Abhijit RD <abhijit.rd@samsung.com>
21 files changed:
LICENSE [new file with mode: 0644]
packaging/csapi-location.manifest [new file with mode: 0644]
packaging/csapi-location.pc.in [new file with mode: 0644]
packaging/csapi-location.spec [new file with mode: 0755]
src/Tizen.Location/Interop/Interop.Libraries.cs [new file with mode: 0644]
src/Tizen.Location/Interop/Interop.Location.cs [new file with mode: 0644]
src/Tizen.Location/Properties/AssemblyInfo.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location.csproj [new file with mode: 0644]
src/Tizen.Location/Tizen.Location.snk [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/GpsSatellite.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/Location.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/LocationBoundary.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/LocationError.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/Locator.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/LocatorHelper.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs [new file with mode: 0644]
src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs [new file with mode: 0644]

diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/packaging/csapi-location.manifest b/packaging/csapi-location.manifest
new file mode 100644 (file)
index 0000000..75b0fa5
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
diff --git a/packaging/csapi-location.pc.in b/packaging/csapi-location.pc.in
new file mode 100644 (file)
index 0000000..41b6556
--- /dev/null
@@ -0,0 +1,5 @@
+Name: csapi-location
+Description: Tizen location API's for C#
+Version: @version@
+Libs: -r:@dllpath@/@dllname@
+Requires:
diff --git a/packaging/csapi-location.spec b/packaging/csapi-location.spec
new file mode 100755 (executable)
index 0000000..a94a0c4
--- /dev/null
@@ -0,0 +1,83 @@
+%define dllpath %{_libdir}/mono/tizen
+%define dllname Tizen.Location.dll
+
+Name:       csapi-location
+Summary:    Tizen Location API's for C#
+Version:    1.0.0
+Release:    1
+Group:      Development/Libraries
+License:    Apache-2.0
+URL:        https://www.tizen.org
+Source0:    %{name}-%{version}.tar.gz
+Source1:    %{name}.manifest
+Source2:    %{name}.pc.in
+
+# TODO: replace mono-compiler, mono-devel to mcs, mono-shlib-cop
+BuildRequires: mono-compiler
+BuildRequires: mono-devel
+# TODO: replace mono-core to gacutil.
+#       mono-core should provide the symbol 'gacutil'
+Requires(post): mono-core
+Requires(postun): mono-core
+
+# P/Invoke Dependencies
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(csapi-tizen)
+
+# P/Invoke Runtime Dependencies
+# TODO: It should be removed after fix tizen-rpm-config
+Requires: glib-2.0
+BuildRequires: pkgconfig(capi-location-manager)
+# DLL Dependencies
+#BuildRequires: ...
+
+%description
+Tizen API for C#
+
+%package devel
+Summary:    Development package for %{name}
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Development package for %{name}
+
+%prep
+%setup -q
+
+cp %{SOURCE1} .
+
+%build
+# build dll
+mcs -target:library -out:%{dllname} -keyfile:Tizen.Location/Tizen.Location.snk -pkg:'csapi-tizen'\
+  Tizen.Location/Properties/AssemblyInfo.cs \
+  Tizen.Location/Interop/*.cs \
+  Tizen.Location/Tizen.Location/*.cs
+
+# check p/invoke
+if [ -x %{dllname} ]; then
+  RET=`mono-shlib-cop %{dllname}`; \
+  CNT=`echo $RET | grep -E "^error:" | wc -l`; \
+  if [ $CNT -gt 0 ]; then exit 1; fi
+fi
+
+%install
+# copy dll
+mkdir -p %{buildroot}%{dllpath}
+install -p -m 644 %{dllname} %{buildroot}%{dllpath}
+
+# generate pkgconfig
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
+sed -e "s#@version@#%{version}#g" \
+    -e "s#@dllpath@#%{dllpath}#g" \
+    -e "s#@dllname@#%{dllname}#g" \
+    %{SOURCE2} > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
+
+%post
+gacutil -i %{dllpath}/%{dllname}
+
+%files
+%{dllpath}/%{dllname}
+
+%files devel
+%{_libdir}/pkgconfig/%{name}.pc
diff --git a/src/Tizen.Location/Interop/Interop.Libraries.cs b/src/Tizen.Location/Interop/Interop.Libraries.cs
new file mode 100644 (file)
index 0000000..df6e61f
--- /dev/null
@@ -0,0 +1,16 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+internal static partial class Interop
+{
+    internal static partial class Libraries
+    {
+        public const string Location = "libcapi-location-manager.so.0";
+        public const string Libc = "libc.so.6";
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Location/Interop/Interop.Location.cs b/src/Tizen.Location/Interop/Interop.Location.cs
new file mode 100644 (file)
index 0000000..fe72212
--- /dev/null
@@ -0,0 +1,170 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Runtime.InteropServices;
+using Tizen.Location;
+
+internal static partial class Interop
+{
+    internal static partial class Locator
+    {
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_create")]
+        public static extern int Create(int locationMethod, out IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_destroy")]
+        public static extern int Destroy(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_start")]
+        public static extern int Start(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_stop")]
+        public static extern int Stop(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_enable_mock_location")]
+        public static extern int EnableMock(bool enable);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_set_mock_location")]
+        public static extern int SetMockLocation(IntPtr handle, double latitude, double longitude, double altitude, double speed, double direction, double accuracy);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_clear_mock_location")]
+        public static extern int ClearMock(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_get_method")]
+        public static extern int GetLocationType(IntPtr handle, out LocationType method);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_get_location")]
+        public static extern int GetLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out LocationAccuracy level, out double horizontal, out double vertical, out int timestamp);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_get_last_location")]
+        public static extern int GetLastLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out LocationAccuracy level, out double horizontal, out double vertical, out int timestamp);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_add_boundary")]
+        public static extern int AddBoundary(IntPtr managerHandle, IntPtr boundsHandle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_remove_boundary")]
+        public static extern int RemoveBoundary(IntPtr managerHandle, IntPtr boundsHandle);
+    }
+
+    internal static partial class LocatorHelper\r
+    {\r
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_is_enabled_method")]
+        public static extern int IsEnabled(int locationMethod, out bool status);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_is_supported_method")]
+        public static extern bool IsSupported(int locationMethod);\r
+    }
+
+    internal static partial class Location
+    {
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_get_distance")]
+        public static extern int GetDistanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, out double distance);
+    }
+
+    internal static partial class LocatorEvent
+    {
+        public delegate void ServiceStatechangedCallback(ServiceState state, IntPtr userData);
+        public delegate void ZonechangedCallback(BoundaryState state, double latitude, double longitude, double altitude, int timesatmp, IntPtr userData);
+        public delegate void SettingchangedCallback(LocationType method, bool enable, IntPtr userData);
+        public delegate void LocationchangedCallback(double latitude, double longitude, double altitude, double speed, double direction, double horizontalAcc, int timeStamp, IntPtr userData);
+        public delegate void LocationUpdatedCallback(LocationError error, double latitude, double longitude, double altitude, int timestamp, double speed, double direction, double climb, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_set_service_state_changed_cb")]
+        public static extern int SetServiceStateChangedCallback(IntPtr handle, ServiceStatechangedCallback callback, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_service_state_changed_cb")]
+        public static extern int UnSetServiceStateChangedCallback(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_set_zone_changed_cb")]
+        public static extern int SetZoneChangedCallback(IntPtr handle, ZonechangedCallback callback, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_zone_changed_cb")]
+        public static extern int UnSetZoneChangedCallback(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_set_setting_changed_cb")]
+        public static extern int SetSettingChangedCallback(int method, SettingchangedCallback callback, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_setting_changed_cb")]
+        public static extern int UnSetSettingChangedCallback(int method);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_set_distance_based_location_changed_cb")]
+        public static extern int SetDistanceBasedLocationChangedCallback(IntPtr handle, LocationchangedCallback callback, int interval, double distance, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_distance_based_location_changed_cb")]
+        public static extern int UnSetDistanceBasedLocationChangedCallback(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_set_location_changed_cb")]
+        public static extern int SetLocationChangedCallback(IntPtr handle, LocationchangedCallback callback, int interval, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_location_changed_cb")]
+        public static extern int UnSetLocationChangedCallback(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_manager_request_single_location")]
+        public static extern int GetSingleLocation(IntPtr handle, int timeout, LocationUpdatedCallback callback, IntPtr userData);
+    }
+
+    internal static partial class LocationBoundary
+    {
+        public delegate bool PolygonCoordinatesCallback(Coordinate coordinates, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_create_rect")]
+        public static extern int CreateRectangularBoundary(Coordinate topLeft, Coordinate bottomLeft, out IntPtr boundsHandle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_create_circle")]
+        public static extern int CreateCircleBoundary(Coordinate center, double radius, out IntPtr boundsHandle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_create_polygon")]
+        public static extern int CreatePolygonBoundary(IntPtr list, int listLength, out IntPtr boundsHandle);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_get_rect_coords")]
+        public static extern int GetRectangleCoordinates(IntPtr handle, out Coordinate topLeft, out Coordinate bottomRight);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_get_circle_coords")]
+        public static extern int GetCircleCoordinates(IntPtr handle, out Coordinate center, out double radius);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_foreach_polygon_coords")]
+        public static extern int GetForEachPolygonCoordinates(IntPtr handle, PolygonCoordinatesCallback callback, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_contains_coordinates")]
+        public static extern bool IsValidCoordinates(IntPtr handle, Coordinate coordinate);
+
+        [DllImport(Libraries.Location, EntryPoint = "location_bounds_destroy")]
+        public static extern bool DestroyBoundary(IntPtr handle);
+    }
+
+    internal static partial class GpsSatellite
+    {
+        public delegate void SatelliteStatuschangedCallback(uint numActive, uint numInView, int timeStamp, IntPtr userData);
+        public delegate bool SatelliteStatusinfomationCallback(uint azimuth, uint elevation, uint prn, uint snr, bool isActive, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "gps_status_get_nmea")]
+        public static extern int GetNMEAData(IntPtr handle, out string nmea);
+
+        [DllImport(Libraries.Location, EntryPoint = "gps_status_get_satellite")]
+        public static extern int GetSatelliteStatus(IntPtr handle, out uint numberOfActive, out uint numberInView, out int timestamp);
+
+        [DllImport(Libraries.Location, EntryPoint = "gps_status_set_satellite_updated_cb")]
+        public static extern int SetSatelliteStatusChangedCallback(IntPtr handle, SatelliteStatuschangedCallback callback, int interval, IntPtr userData);
+
+        [DllImport(Libraries.Location, EntryPoint = "gps_status_unset_satellite_updated_cb")]
+        public static extern int UnSetSatelliteStatusChangedCallback(IntPtr handle);
+
+        [DllImport(Libraries.Location, EntryPoint = "gps_status_foreach_satellites_in_view")]
+        public static extern int GetForEachSatelliteInView(IntPtr handle, SatelliteStatusinfomationCallback callback, IntPtr userData);
+    }
+
+    internal static DateTime ConvertDateTime(int timestamp)
+    {
+        DateTime dateTime = DateTime.Now;
+
+        DateTime start = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(timestamp), DateTimeKind.Utc);
+        dateTime = start.ToLocalTime();
+
+        return dateTime;
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Location/Properties/AssemblyInfo.cs b/src/Tizen.Location/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..129ae48
--- /dev/null
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tizen.Location")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Samsung India Software Operations")]
+[assembly: AssemblyProduct("Tizen.Location")]
+[assembly: AssemblyCopyright("Copyright © Samsung India Software Operations 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e4841028-010d-4a77-85fe-5bb1beb04404")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Tizen.Location/Tizen.Location.csproj b/src/Tizen.Location/Tizen.Location.csproj
new file mode 100644 (file)
index 0000000..db5f93f
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProjectGuid>{EADC6F38-9C99-4294-8F65-63D0E73012E8}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>Tizen.Location</RootNamespace>\r
+    <AssemblyName>Tizen.Location</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <FileAlignment>512</FileAlignment>\r
+    <TargetFrameworkProfile />\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <Optimize>false</Optimize>\r
+    <OutputPath>bin\Debug\</OutputPath>\r
+    <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+    <Prefer32Bit>false</Prefer32Bit>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <Optimize>true</Optimize>\r
+    <OutputPath>bin\Release\</OutputPath>\r
+    <DefineConstants>TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+    <Prefer32Bit>false</Prefer32Bit>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <SignAssembly>true</SignAssembly>\r
+  </PropertyGroup>\r
+  <PropertyGroup>\r
+    <AssemblyOriginatorKeyFile>Tizen.Location.snk</AssemblyOriginatorKeyFile>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <Reference Include="System" />\r
+    <Reference Include="System.Core" />\r
+    <Reference Include="System.Xml.Linq" />\r
+    <Reference Include="System.Data.DataSetExtensions" />\r
+    <Reference Include="Microsoft.CSharp" />\r
+    <Reference Include="System.Data" />\r
+    <Reference Include="System.Xml" />\r
+    <Reference Include="Tizen">\r
+      <HintPath>..\..\..\..\uifw\tizen\Tizen\bin\Debug\Tizen.dll</HintPath>\r
+    </Reference>\r
+    <Reference Include="Tizen.Internals">\r
+      <HintPath>..\..\..\..\uifw\tizen\Tizen.Internals\bin\Debug\Tizen.Internals.dll</HintPath>\r
+    </Reference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Compile Include="Tizen.Location\GpsSatellite.cs" />\r
+    <Compile Include="Interop\Interop.Libraries.cs" />\r
+    <Compile Include="Interop\Interop.Location.cs" />\r
+    <Compile Include="Tizen.Location\Location.cs" />\r
+    <Compile Include="Tizen.Location\LocationBoundary.cs" />\r
+    <Compile Include="Tizen.Location\LocationChangedEventArgs.cs" />\r
+    <Compile Include="Tizen.Location\LocationError.cs" />\r
+    <Compile Include="Tizen.Location\Locator.cs" />\r
+    <Compile Include="Tizen.Location\LocatorEnumerations.cs" />\r
+    <Compile Include="Tizen.Location\LocatorHelper.cs" />\r
+    <Compile Include="Properties\AssemblyInfo.cs" />\r
+    <Compile Include="Tizen.Location\SatelliteStatusChangedEventArgs.cs" />\r
+    <Compile Include="Tizen.Location\ServiceStateChangedEventArgs.cs" />\r
+    <Compile Include="Tizen.Location\SettingChangedEventArgs.cs" />\r
+    <Compile Include="Tizen.Location\ZoneChangedEventArgs.cs" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="Tizen.Location.snk" />\r
+  </ItemGroup>\r
+  <ItemGroup />\r
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->\r
+</Project>
\ No newline at end of file
diff --git a/src/Tizen.Location/Tizen.Location.snk b/src/Tizen.Location/Tizen.Location.snk
new file mode 100644 (file)
index 0000000..b2dee2b
Binary files /dev/null and b/src/Tizen.Location/Tizen.Location.snk differ
diff --git a/src/Tizen.Location/Tizen.Location/GpsSatellite.cs b/src/Tizen.Location/Tizen.Location/GpsSatellite.cs
new file mode 100644 (file)
index 0000000..9225949
--- /dev/null
@@ -0,0 +1,276 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace Tizen.Location
+{
+    /// <summary>
+    /// A class which contains the functionality for obtaining information about Gps satellites in range and in use.
+    /// </summary>
+    public class GpsSatellite
+    {
+        private int _interval = 120;
+        private Locator _locator;
+        private EventHandler<SatelliteStatusChangedEventArgs> _satelliteStatusChanged;
+        private IntPtr _handle = IntPtr.Zero;
+
+        /// <summary>
+        /// The time interval between callback updates.
+        /// Should be in the range [1~120] seconds.
+        /// </summary>
+        public int Interval
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting the Callback Interval");
+                return _interval;
+            }
+            set
+            {
+                Log.Info(Globals.LogTag, "Setting the Callback Interval");
+                if (value >= 0 && value <= 120)
+                {
+                    _interval = value;
+                    if (_satelliteStatusChanged != null)
+                    {
+                        SetSatelliteStatusChangeCallback();
+                    }
+                    else
+                    {
+                        Log.Error(Globals.LogTag, "Error Setting the Callback Interval");
+                        LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// The NMEAData from the Satellite.
+        /// </summary>
+        public string Nmea
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting NMEAData");
+                return GetNmea();
+            }
+        }
+
+        private string GetNmea()
+        {
+            string value = null;
+            Interop.GpsSatellite.GetNMEAData(_handle, out value);
+
+            return value;
+        }
+
+
+        /// <summary>
+        /// The Count of Active satellites.
+        /// </summary>
+        public int ActiveCount
+        {
+            get
+            {
+                return (int)GetActiveCount();
+            }
+        }
+
+        private uint GetActiveCount()
+        {
+            Log.Info(Globals.LogTag, "Getting the ActiveCount of satellites");
+            uint numActive = 0;
+            uint numInView;
+            int timestamp;
+            Interop.GpsSatellite.GetSatelliteStatus(_handle, out numActive, out numInView, out timestamp);
+            return numActive;
+        }
+
+        /// <summary>
+        /// The Count of satellites in view.
+        /// </summary>
+        public int InViewCount
+        {
+            get
+            {
+                return (int)GetInViewCount();
+            }
+        }
+
+        private uint GetInViewCount()
+        {
+            Log.Info(Globals.LogTag, "Getting the In view count of satellites");
+            uint numActive;
+            uint numInView = 0;
+            int timestamp;
+            Interop.GpsSatellite.GetSatelliteStatus(_handle, out numActive, out numInView, out timestamp);
+            return numInView;
+        }
+
+        /// <summary>
+        /// The list of satellites/last recorded satellites in view.
+        /// </summary>
+        public IList<SatelliteInformation> Satellites
+        {
+            get
+            {
+                return GetSatellites();
+            }
+        }
+
+        private IList<SatelliteInformation> GetSatellites()
+        {
+            List<SatelliteInformation> satelliteList = new List<SatelliteInformation>();
+            Log.Info(Globals.LogTag, "Getting the list of satellites");
+            Interop.GpsSatellite.SatelliteStatusinfomationCallback callback = (uint azimuth, uint elevation, uint prn, uint snr, bool isActive, IntPtr userData) =>
+            {
+                SatelliteInformation satellite = new SatelliteInformation(azimuth, elevation, prn, snr, isActive);
+                satelliteList.Add(satellite);
+                return true;
+            };
+            Interop.GpsSatellite.GetForEachSatelliteInView(_handle, callback, IntPtr.Zero);
+            return satelliteList;
+        }
+
+        /// <summary>
+        /// The constructor of GpsSatellite class.
+        /// <param name="locator"> Locator object initilized using Gps.</param>
+        /// </summary>
+        public GpsSatellite(Locator locator)
+        {
+            Log.Info(Globals.LogTag, "Calling GpsSatellite constructor");
+            LocationType method = locator.LocationType;
+            if (method.Equals(LocationType.Gps) || method.Equals(LocationType.Hybrid))
+            {
+                _locator = locator;
+                _handle = _locator.GetHandle();
+            }
+            else
+            {
+                Log.Error(Globals.LogTag, "Error constructing GpsSatellite class");
+                LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+            }
+        }
+
+        /// <summary>
+        /// (event) SatelliteStatusUpdated is raised whenever satellite information is updated.
+        /// The callback will be invoked periodically (every Interval seconds).
+        /// </summary>
+        public event EventHandler<SatelliteStatusChangedEventArgs> SatelliteStatusUpdated
+        {
+            add
+            {
+                Log.Info(Globals.LogTag, "SatelliteStatusUpdated Add called");
+                if (_satelliteStatusChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "SetSatelliteStatusChangeCallback called");
+                    SetSatelliteStatusChangeCallback();
+                }
+                _satelliteStatusChanged += value;
+            }
+            remove
+            {
+                Log.Info(Globals.LogTag, "SatelliteStatusUpdated remoove called");
+                _satelliteStatusChanged -= value;
+                if (_satelliteStatusChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "UnSetSatelliteStatusChangeCallback called");
+                    UnSetSatelliteStatusChangeCallback();
+                }
+            }
+        }
+
+        private void SetSatelliteStatusChangeCallback()
+        {
+            Log.Info(Globals.LogTag, "SetSatelliteStatusChangeCallback");
+            GCHandle handle = GCHandle.Alloc(this);
+            int ret = Interop.GpsSatellite.SetSatelliteStatusChangedCallback(_handle, SatelliteStatusChangedCallback, _interval, GCHandle.ToIntPtr(handle));
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in setting satellite status changed callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void UnSetSatelliteStatusChangeCallback()
+        {
+            Log.Info(Globals.LogTag, "UnSetSatelliteStatusChangeCallback");
+            int ret = Interop.GpsSatellite.UnSetSatelliteStatusChangedCallback(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Getting Unsetting satellite status changed callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void SatelliteStatusChangedCallback(uint numActive, uint numInView, int timestamp, IntPtr userData)
+        {
+            Log.Info(Globals.LogTag, "Inside SatelliteStatusChangedCallback");
+            DateTime timeStamp = DateTime.Now;
+
+            if (timestamp != 0)
+            {
+                DateTime start = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(timestamp), DateTimeKind.Utc);
+                timeStamp = start.ToLocalTime();
+            }
+
+            _satelliteStatusChanged?.Invoke(_handle, new SatelliteStatusChangedEventArgs(numActive, numInView, timeStamp));
+        }
+    }
+
+    /// <summary>
+    /// A class which contains the information of the Satellite under consideration.
+    /// </summary>
+    public class SatelliteInformation
+    {
+        /// <summary>
+        /// Class Constructor for SatelliteInformation class.
+        /// </summary>
+        /// <param name="azimuth"> The azimuth value of the satellite in degrees.</param>
+        /// <param name="elevation"> The elevation of the satellite in meters.</param>
+        /// <param name="prn"> The Prn value of the satellite.</param>
+        /// <param name="snr"> The SNR value of the satellite in dB.</param>
+        /// <param name="isActive"> The flag signaling if satellite is in use.</param>
+        public SatelliteInformation(uint azimuth, uint elevation, uint prn, uint snr, bool isActive)
+        {
+            Azimuth = azimuth;
+            Elevation = elevation;
+            Prn = prn;
+            Snr = snr;
+            Active = isActive;
+        }
+
+        /// <summary>
+        /// The Azimuth information of the Satellite.
+        /// </summary>
+        public uint Azimuth { get; private set; }
+
+        /// <summary>
+        /// The Elevation information of the Satellite.
+        /// </summary>
+        public uint Elevation { get; private set; }
+
+        /// <summary>
+        /// The PRN of the Satellite.
+        /// </summary>
+        public uint Prn { get; private set; }
+
+        /// <summary>
+        /// The SNR of the Satellite.
+        /// </summary>
+        public uint Snr { get; private set; }
+
+        /// <summary>
+        /// The operational status of the Satellite.
+        /// </summary>
+        public bool Active { get; private set; }
+    }
+}
diff --git a/src/Tizen.Location/Tizen.Location/Location.cs b/src/Tizen.Location/Tizen.Location/Location.cs
new file mode 100644 (file)
index 0000000..c7ccb90
--- /dev/null
@@ -0,0 +1,201 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Location
+{
+    /// <summary>
+    /// A class which contains the details of the location rrequested.
+    /// Includes the functionality to get the distance between locations.
+    /// </summary>
+    public class Location
+    {
+        private double _altitude;
+        private double _latitude;
+        private double _longitude;
+        private double _direction;
+        private double _speed;
+        private double _horizontal;
+        internal int _timestamp;
+
+        /// <summary>
+        /// The default constructor of Location Class.
+        /// </summary>
+        public Location()
+        {
+        }
+
+        /// <summary>
+        /// The parameterized constructor of Location Class.
+        /// <param name="latitude"> Latitude component of the device co-ordinate.</param>
+        /// <param name="longitude"> Longitude component of the device co-ordinate.</param>
+        /// <param name="altitude"> Altitude value.</param>
+        /// <param name="horizontalAccuracy"> Horizontal Accuracy in meters.</param>
+        /// <param name="speed"> Devie Speed.</param>
+        /// <param name="direction"> Device direction with respect to north.</param>
+        /// <param name="timestamp"> Time when the measurement took place.</param>
+        /// </summary>
+        public Location(double latitude, double longitude, double altitude, double horizontalAccuracy, double direction, double speed, int timestamp)
+        {
+            _altitude = altitude;
+            _latitude = latitude;
+            _longitude = longitude;
+            _direction = direction;
+            _speed = speed;
+            _horizontal = horizontalAccuracy;
+            _timestamp = timestamp;
+        }
+
+        /// <summary>
+        /// The current altitude (meters).
+        /// </summary>
+        public double Altitude
+        {
+            get
+            {
+                return _altitude;
+            }
+            set
+            {
+                _altitude = value;
+            }
+        }
+
+        /// <summary>
+        /// The current latitude [-90.0 ~ 90.0] (degrees).
+        /// </summary>
+        public double Latitude
+        {
+            get
+            {
+                return _latitude;
+            }
+            set
+            {
+                _latitude = value;
+            }
+        }
+
+        /// <summary>
+        /// The current longitude [-180.0 ~ 180.0] (degrees).
+        /// </summary>
+        public double Longitude
+        {
+            get
+            {
+                return _longitude;
+            }
+            set
+            {
+                _longitude = value;
+            }
+        }
+
+        /// <summary>
+        /// The direction, degrees from the north.
+        /// </summary>
+        public double Direction
+        {
+            get
+            {
+                return _direction;
+            }
+            set
+            {
+                _direction = value;
+            }
+        }
+
+        /// <summary>
+        /// The Device Speed (km/h).
+        /// </summary>
+        public double Speed
+        {
+            get
+            {
+                return _speed;
+            }
+            set
+            {
+                _speed = value;
+            }
+        }
+
+        /// <summary>
+        /// The horizontal accuracy.
+        /// </summary>
+        public double HorizontalAccuracy
+        {
+            get
+            {
+                return _horizontal;
+            }
+            set
+            {
+                _horizontal = value;
+            }
+        }
+
+        /// <summary>
+        /// The timestamp (time when measurement took place or 0 if valid).
+        /// </summary>
+        public DateTime Timestamp
+        {
+            get
+            {
+                return Interop.ConvertDateTime(_timestamp);
+            }
+            internal set
+            {
+                Timestamp = value;
+            }
+
+        }
+
+        /// <summary>
+        /// Gets the distance between the two given coordinates.
+        /// </summary>
+        /// <param name="startLatitude"> The latitude of the source location.</param>
+        /// <param name="startLongitude"> The Longitude of the source location.</param>
+        /// <param name="endLatitude"> The latitude of the source location.</param>
+        /// <param name="endLongitude"> The longitude of the source location.</param>
+        /// <returns>Returns the distance between source and destination.</returns>
+        public static double GetDistanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude)
+        {
+            double result;
+            Log.Info(Globals.LogTag, "Calling GetDistanceBetween");
+            int ret = Interop.Location.GetDistanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, out result);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error getting single distance information ," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Gets the distance between the current and specified location.
+        /// </summary>
+        /// <param name="location"> The location object to which distance is to be calculated.</param>
+        /// <returns>Returns the distance to the specified location.</returns>
+        public double GetDistanceTo(Location location)
+        {
+            double result;
+            Log.Info(Globals.LogTag, "Calling GetDistanceTo");
+            int ret = Interop.Location.GetDistanceBetween(this.Latitude, this.Longitude, location.Latitude, location.Longitude, out result);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error getting distance information to the specifed location," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+            return result;
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Location/Tizen.Location/LocationBoundary.cs b/src/Tizen.Location/Tizen.Location/LocationBoundary.cs
new file mode 100644 (file)
index 0000000..7b2a5bd
--- /dev/null
@@ -0,0 +1,245 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace Tizen.Location
+{
+    /// <summary>
+    /// Abstract class which provides functions related to geographic bounds information.
+    /// </summary>
+    public abstract class LocationBoundary
+    {
+        internal IntPtr handle;
+        /// <summary>
+        /// Gets the location boundary type.
+        /// </summary>
+        public BoundaryType BoundaryType{ get; internal set;}
+
+        internal IntPtr GetHandle()
+        {
+            return handle;
+        }
+
+        /// <summary>
+        /// Checks if the boundary contains the specified geographical coordinates.
+        /// </summary>
+        /// <param name="coordinate"> The coordinate which needs to be checked.</param>
+        /// <returns>Returns a boolean value indicating whether or not the specified coordinate lies in the geographical area.</returns>
+        public bool BoundaryContainsCoordinates(Coordinate coordinate)
+        {
+            Log.Info(Globals.LogTag, "Checking if coordinates are contained within boundary");
+            return Interop.LocationBoundary.IsValidCoordinates(handle, coordinate);
+        }
+    }
+
+    /// <summary>
+    /// Class representing a rectangular location boundary.
+    /// Inherits the Abstract LocationBoundary class.
+    /// </summary>
+    public class RectangleBoundary : LocationBoundary
+    {
+        /// <summary>
+        /// Constructor of the Rectangle boundary class.
+        /// </summary>
+        /// <param name="topLeft"> The coordinate which constitute the top left handside of the rectangular boundary.</param>
+        /// <param name="bottomRight"> The coordinate which constitute the bottom right handside of the rectangular boundary.</param>
+        public RectangleBoundary(Coordinate topLeft, Coordinate bottomRight)
+        {
+            Log.Info(Globals.LogTag, "Calling RectangleBoundary constructor");
+            BoundaryType = BoundaryType.Rectangle;
+            IntPtr boundsHandle;
+            int ret = Interop.LocationBoundary.CreateRectangularBoundary(topLeft, bottomRight, out boundsHandle);
+            if ((LocationBoundError)ret != LocationBoundError.None)
+            {
+                Log.Error(Globals.LogTag, "Error Creating Rectangular Boundary," + (LocationBoundError)ret);
+                LocationErrorFactory.ThrowLocationBoundaryException(ret);
+            }
+            handle = boundsHandle;
+        }
+
+        /// <summary>
+        /// Gets the Top Left handside coordinate of a rectangular boundary.
+        /// </summary>
+        public Coordinate TopLeft
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Calling to get CoordinateItem TopLeft");
+                return GetRectangleCoordinate("TopLeft");
+            }
+        }
+
+        /// <summary>
+        /// Gets the Bottom Right handside coordinate of a rectangular boundary.
+        /// </summary>
+        public Coordinate BottomRight
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Calling to get CoordinateItem BottomRight");
+                return GetRectangleCoordinate("BottomRight");
+            }
+        }
+
+        private Coordinate GetRectangleCoordinate(string tag)
+        {
+            Coordinate topLeft;
+            Coordinate bottomRight;
+
+            Interop.LocationBoundary.GetRectangleCoordinates(handle, out topLeft, out bottomRight);
+
+            if (tag.Equals("TopLeft"))
+            {
+                return topLeft;
+            }
+            else
+            {
+                return bottomRight;
+            }
+        }
+    }
+
+    /// <summary>
+    /// Class representing a circular location boundary.
+    /// Inherits the Abstract LocationBoundary class.
+    /// </summary>
+    public class CircleBoundary : LocationBoundary
+    {
+        /// <summary>
+        /// Constructor of the Circular boundary class.
+        /// </summary>
+        /// <param name="coordinate"> The coordinates which constitute the center of the circular boundary.</param>
+        /// <param name="radius"> The radius value of the circular boundary.</param>
+        public CircleBoundary(Coordinate coordinate, double radius)
+        {
+            Log.Info(Globals.LogTag, "Calling CircleBoundary constructor");
+            BoundaryType = BoundaryType.Circle;
+            IntPtr boundsHandle;
+            int ret = Interop.LocationBoundary.CreateCircleBoundary(coordinate, radius, out boundsHandle);
+            if ((LocationBoundError)ret != LocationBoundError.None)
+            {
+                Log.Error(Globals.LogTag, "Error Creating Circular Boundary," + (LocationBoundError)ret);
+                LocationErrorFactory.ThrowLocationBoundaryException(ret);
+            }
+            handle = boundsHandle;
+        }
+
+        /// <summary>
+        /// Gets the coordinate of the center of a circular boundary.
+        /// </summary>
+        public Coordinate Center
+        {
+            get
+            {
+                return GetCircleCenter();
+            }
+        }
+
+        /// <summary>
+        /// Gets the radius of a circular boundary.
+        /// </summary>
+        public double Radius
+        {
+            get
+            {
+                return GetRadius();
+            }
+        }
+
+        private Coordinate GetCircleCenter()
+        {
+            Log.Info(Globals.LogTag, "Calling to get CoordinateItem Center");
+            Coordinate center;
+            double radius;
+            Interop.LocationBoundary.GetCircleCoordinates(handle, out center, out radius);
+            return center;
+        }
+
+        private double GetRadius()
+        {
+            Coordinate center;
+            double radius = 0;
+            Interop.LocationBoundary.GetCircleCoordinates(handle, out center, out radius);
+            return radius;
+        }
+    }
+
+    /// <summary>
+    /// Class representing a polygonal location boundary.
+    /// Inherits the Abstract LocationBoundary class.
+    /// </summary>
+    public class PolygonBoundary : LocationBoundary
+    {
+        /// <summary>
+        /// Constructor of the polygon boundary class.
+        /// </summary>
+        /// <param name="coordinates"> The coordinates which constitute the polgonal boundary.</param>
+        public PolygonBoundary(IList<Coordinate> coordinates)
+        {
+            Log.Info(Globals.LogTag, "Calling PolygonBoundary Constructor");
+            BoundaryType = BoundaryType.Polygon;
+            IntPtr[] pointers = new IntPtr[coordinates.Count];
+            IntPtr listPointer = Marshal.AllocHGlobal(Marshal.SizeOf(coordinates[0]) * coordinates.Count);
+            IntPtr boundsHandle;
+            for (int i = 0; i < coordinates.Count; i++)
+            {
+                pointers[i] = Marshal.AllocHGlobal(Marshal.SizeOf(coordinates[0]));
+                Marshal.StructureToPtr(coordinates[i], pointers[i], true);
+                Marshal.WriteIntPtr(listPointer, i * Marshal.SizeOf(coordinates[0]), pointers[i]);
+            }
+            int ret = Interop.LocationBoundary.CreatePolygonBoundary(listPointer, coordinates.Count, out boundsHandle);
+            if ((LocationBoundError)ret != LocationBoundError.None)
+            {
+                Log.Error(Globals.LogTag, "Error Creating Polygon Boundary," + (LocationBoundError)ret);
+                LocationErrorFactory.ThrowLocationBoundaryException(ret);
+            }
+            handle = boundsHandle;
+        }
+
+        /// <summary>
+        /// Gets the list of coordinates which constitute a polygonal boundary
+        /// </summary>
+        public IList<Coordinate> Coordinates
+        {
+            get
+            {
+                return GetCoordinates();
+            }
+        }
+
+        private IList<Coordinate> GetCoordinates()
+        {
+            Log.Info(Globals.LogTag, "Calling to get Polygon coordinates");
+            List<Coordinate> coordinateList = new List<Coordinate>();
+            Interop.LocationBoundary.PolygonCoordinatesCallback callback = (Coordinate coordinate, IntPtr userData) =>
+            {
+                Coordinate item;
+                item.Latitude = coordinate.Latitude;
+                item.Longitude = coordinate.Longitude;
+                coordinateList.Add(item);
+                return true;
+            };
+
+            Interop.LocationBoundary.GetForEachPolygonCoordinates(handle, callback, IntPtr.Zero);
+            return coordinateList;
+        }
+    }
+
+    /// <summary>
+    /// The structure which represents the  co-ordinates of a geographical location.
+    /// </summary>
+    [StructLayout(LayoutKind.Sequential)]
+    public struct Coordinate
+    {
+        public double Latitude;
+        public double Longitude;
+    }
+}
diff --git a/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..d17261b
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.\r
+\r
+using System;\r
+\r
+\r
+namespace Tizen.Location\r
+{\r
+    /// <summary>
+    /// An extended EventArgs class which contains the changed location information.
+    /// </summary>
+    public class LocationChangedEventArgs : EventArgs
+    {
+
+        /// <summary>
+        /// Class Constructor for LocationUpdatedEventArgs class.
+        /// </summary>
+        /// <param name="locationUpdate"> Object of Location class.</param>
+        public LocationChangedEventArgs(Location updatatedLocation)
+        {
+            Location = updatatedLocation;
+        }
+
+        /// <summary>
+        /// Get the Location Update information.
+        /// </summary>
+        public Location Location { get; private set; }
+    }\r
+}\r
diff --git a/src/Tizen.Location/Tizen.Location/LocationError.cs b/src/Tizen.Location/Tizen.Location/LocationError.cs
new file mode 100644 (file)
index 0000000..59ac119
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+
+using System;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Location
+{
+    public static class LocationManagerError
+    {
+        public const int Base = -0x02C00000;
+        public const int BoundsBase = -0x02C00000 | 0x20;
+    }
+
+    /// <summary>
+    /// Location Manager error codes
+    /// </summary>
+    public enum LocationError
+    {
+        None = ErrorCode.None,/**< Successful */
+        OutOfMemoryError = ErrorCode.OutOfMemory,/**< Out of memory error */
+        InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */
+        AcessibilityNotallowed = ErrorCode.PermissionDenied,/**< Permission denied */
+        NotSupported = ErrorCode.NotSupported,/**< Address family not supported */
+        IncorrectMethod = LocationManagerError.Base | 0x01,/**< Location manager contains incorrect method for a given call */
+        NetworkFailed = LocationManagerError.Base | 0x02,/**< Network unavailable */
+        ServiceNotAvailable = LocationManagerError.Base | 0x03,/**< Location service is not available */
+        GPSSettingOff = LocationManagerError.Base | 0x04,/**< GPS/WPS, or MOCK setting is not enabled */
+        SecuirtyRestricted = LocationManagerError.Base | 0x05,/**< Restricted by security system policy */
+        SettingOff = GPSSettingOff/**< GPS/WPS, or MOCK setting is not enabled */
+    }
+
+    /// <summary>
+    /// Location Boundary error codes
+    /// </summary>
+    public enum LocationBoundError
+    {
+        None = ErrorCode.None,/**< Successful */
+        OutOfMemoryError = ErrorCode.OutOfMemory,/**< Out of memory error */
+        InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */
+        NotSupported = ErrorCode.NotSupported,/**< Not supported */
+        IncorrectType = LocationManagerError.BoundsBase | 0x01,/**< Incorrect bounds type for a given call */
+        IsAdded = LocationManagerError.BoundsBase | 0x02/**< Cannot remove bounds handle from location manager   */
+    }
+
+    internal static class LocationErrorFactory
+    {
+        internal static Exception ThrowLocationException(int errCode)
+        {
+            LocationError error = (LocationError)errCode;
+            switch (error)
+            {
+                case LocationError.AcessibilityNotallowed:
+                    return new InvalidOperationException("Accesibility not allowed");
+                case LocationError.SettingOff:
+                    return new InvalidOperationException("Current locationtype setting is off");
+                case LocationError.IncorrectMethod:
+                    return new InvalidOperationException("Incorrect method used");
+                case LocationError.InvalidParameter:
+                    return new ArgumentException("Invalid Parameter passed");
+                case LocationError.NetworkFailed:
+                    return new InvalidOperationException("Network failed");
+                case LocationError.NotSupported:
+                    return new InvalidOperationException("Operation not supported");
+                case LocationError.OutOfMemoryError:
+                    return new InvalidOperationException("Out of memory error");
+                case LocationError.SecuirtyRestricted:
+                    return new InvalidOperationException("Security Restricted");
+                case LocationError.ServiceNotAvailable:
+                    return new InvalidOperationException("Service not available");
+                default:
+                    return new InvalidOperationException("Unknown Error");
+            }
+        }
+
+        internal static Exception ThrowLocationBoundaryException(int errCode)
+        {
+            LocationBoundError error = (LocationBoundError)errCode;
+            switch (error)
+            {
+                case LocationBoundError.IncorrectType:
+                    return new InvalidOperationException("Incorrect type passed");
+                case LocationBoundError.InvalidParameter:
+                    return new ArgumentException("Invalid parameter passed");
+                case LocationBoundError.IsAdded:
+                    return new InvalidOperationException("Boundary is not addded");
+                case LocationBoundError.NotSupported:
+                    return new InvalidOperationException("Operation Not supported");
+                case LocationBoundError.OutOfMemoryError:
+                    return new InvalidOperationException("Out of memory exception");
+                default:
+                    return new InvalidOperationException("Unknown Error");
+            }
+        }
+    }
+}
diff --git a/src/Tizen.Location/Tizen.Location/Locator.cs b/src/Tizen.Location/Tizen.Location/Locator.cs
new file mode 100644 (file)
index 0000000..30d3698
--- /dev/null
@@ -0,0 +1,734 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Tizen.Internals.Errors;
+using System.Runtime.InteropServices;
+
+namespace Tizen.Location
+{
+    static internal class Globals
+    {
+        internal const string LogTag = "Tizen.Location";
+    }
+
+    /// <summary>
+    /// A class which contains the functionality for obtaining geographical infomation and setting boundary condition.
+    /// Notifications on events like service becoming enabled or disabled, new position data being available
+    /// and others can also be acquired.
+    /// </summary>
+    public class Locator:IDisposable
+    {
+        private int _interval = 1;
+        private int _stayInterval = 120;
+        private double _distance = 120.0;
+        private bool _isEnableMock;
+        private IntPtr _handle;
+        private LocationType _locationType;
+        private Location _location = null;
+        private bool _disposed = false;
+        private bool _isStarted = false;
+        private static Locator s_locatorReference;
+        private int _requestId = 0;
+        private Dictionary<IntPtr, Interop.LocatorEvent.LocationUpdatedCallback> _callback_map = new Dictionary<IntPtr, Interop.LocatorEvent.LocationUpdatedCallback>();
+
+        private EventHandler<ZoneChangedEventArgs> _zoneChanged;
+        private EventHandler<ServiceStateChangedEventArgs> _serviceStateChanged;
+        private EventHandler<SettingChangedEventArgs> _settingChanged;
+        private EventHandler<LocationChangedEventArgs> _distanceBasedLocationChanged;
+        private EventHandler<LocationChangedEventArgs> _locationChanged;
+
+        /// <summary>
+        /// The constructor of Locator class.
+        /// </summary>
+        /// <param name="locationType"> The back-end positioning method to be used for LBS.</param>
+        public Locator(LocationType locationType)
+        {
+            Log.Info(Globals.LogTag, "Locator Constructor");
+            int ret = Interop.Locator.Create((int)locationType, out _handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error creating Location Manager," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+            _location = new Location();
+            _locationType = locationType;
+        }
+
+        /// <summary>
+        /// The destructor of Locator class.
+        /// </summary>
+        ~Locator()
+        {
+            Dispose(false);
+        }
+
+        /// <summary>
+        /// The time interval between callback updates.
+        /// Should be in the range [1~120] seconds.
+        /// </summary>
+        public int Interval
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting the Callback Interval");
+                return _interval;
+            }
+            set
+            {
+                Log.Info(Globals.LogTag, "Setting the Callback Interval");
+                if (value > 0 && value <= 120)
+                {
+                    _interval = value;
+                    if (_locationChanged != null)
+                    {
+                        SetLocationChangedCallback();
+                    }
+                }
+                else
+                {
+                    Log.Error(Globals.LogTag, "Error setting Callback Interval");
+                    LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+                }
+            }
+        }
+
+        /// <summary>
+        /// The time interval between Distance based location callback updates.
+        /// Should be in the range [1~120] seconds.
+        /// </summary>
+        public int StayInterval
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting the StayInterval");
+                return _stayInterval;
+            }
+            set
+            {
+                Log.Info(Globals.LogTag, "Setting the StayInterval");
+                if (value > 0 && value <= 120)
+                {
+                    _stayInterval = value;
+                    if (_distanceBasedLocationChanged != null)
+                    {
+                        SetDistanceBasedLocationChangedCallback();
+                    }
+                }
+                else
+                {
+                    Log.Error(Globals.LogTag, "Error Setting the StayInterval");
+                    LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+                }
+            }
+        }
+
+        /// <summary>
+        /// The distance between callback updates.
+        /// Should be in the range [1-120] meters.
+        /// </summary>
+        public double Distance
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting the Distance Interval");
+                return _distance;
+            }
+            set
+            {
+                Log.Info(Globals.LogTag, "Setting the Distance Interval");
+                if (value > 0 && value <= 120)
+                {
+                    _distance = value;
+                    if (_distanceBasedLocationChanged != null)
+                    {
+                        SetDistanceBasedLocationChangedCallback();
+                    }
+                }
+                else
+                {
+                    Log.Error(Globals.LogTag, "Error Setting the Distance");
+                    LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Gets the Location object.
+        /// </summary>
+        public Location Location
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting location details");
+                return _location;
+           }
+        }
+
+        /// <summary>
+        /// Gets the type used to obtain Location data.
+        /// </summary>
+        public LocationType LocationType
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting LocationType");
+                return _locationType;
+            }
+        }
+
+        /// <summary>
+        /// Gets the status whether mock location is enabled or not.
+        /// </summary>
+        public bool EnableMock
+        {
+            get
+            {
+                Log.Info(Globals.LogTag, "Getting getting Mock");
+                return _isEnableMock;
+            }
+            set
+            {
+                _isEnableMock = value;
+                SetEnableMock();
+            }
+        }
+
+        internal IntPtr GetHandle()
+        {
+            return _handle;
+        }
+
+        private void SetEnableMock()
+        {
+            int ret = Interop.Locator.EnableMock(_isEnableMock);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error Set Enable Mock Type," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        /// <summary>
+        /// Starts the Location Manager which has been created using the specified method.
+        /// </summary>
+        public void Start()
+        {
+            Log.Info(Globals.LogTag, "Starting Location Manager");
+            if (Locator.s_locatorReference == null)
+            {
+                int ret = Interop.Locator.Start(_handle);
+                if (((LocationError)ret != LocationError.None))
+                {
+                    Log.Error(Globals.LogTag, "Error Starting Location Manager," + (LocationError)ret);
+                    LocationErrorFactory.ThrowLocationException(ret);
+                }
+                Locator.s_locatorReference = this;
+                _isStarted = true;
+                Log.Info(Globals.LogTag, "Locator reference set");
+            }
+            else
+            {
+                Log.Error(Globals.LogTag, "Error, previous instance of Locator should be stopped before starting a new one," + LocationError.NotSupported);
+                LocationErrorFactory.ThrowLocationException((int)LocationError.NotSupported);
+            }
+        }
+
+        /// <summary>
+        /// Stops the Location Manager which has been activated using the specified method.
+        /// Does not destroy the manager.
+        /// </summary>
+        public void Stop()
+        {
+            Log.Info(Globals.LogTag, "Stopping Location Manager");
+            int ret = Interop.Locator.Stop(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error stopping Location Manager," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+            Locator.s_locatorReference = null;
+            _isStarted = false;
+       }
+
+        /// <summary>
+        /// Sets a mock location for the given location method.
+        /// </summary>
+        /// <param name="location"> The location object containing the mock location details.</param>
+        public void SetMockLocation(Location location)
+        {
+            Log.Info(Globals.LogTag, "Setting mock location");
+            int ret = Interop.Locator.SetMockLocation(_handle, location.Latitude, location.Longitude, location.Altitude, location.Speed, location.Direction, location.HorizontalAccuracy);
+            if (((LocationError)ret == LocationError.None))
+            {
+                _location.Altitude = 0;
+                _location.Latitude = location.Latitude;
+                _location.Longitude = location.Longitude;
+                _location.Speed = location.Speed;
+                _location.Direction = location.Direction;
+                _location.HorizontalAccuracy = location.HorizontalAccuracy;
+            }
+            else
+            {
+                Log.Error(Globals.LogTag, "Error in setting up location mocking," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        /// <summary>
+        /// Clears a mock location for the given location method.
+        /// </summary>
+        public void ClearMock()
+        {
+            Log.Info(Globals.LogTag, "Clear mock location");
+            int ret = Interop.Locator.ClearMock(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in clear up location mocking," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        /// <summary>
+        /// Gets the details of the location asynchronously.
+        /// </summary>
+        /// <param name="timeout"> Timeout to stop requesting single location after.</param>
+        /// <returns> A task which contains the current location details</returns>
+        public Task<Location> GetLocationAsync(int timeout)
+        {
+            var task = new TaskCompletionSource<Location>();
+            IntPtr id = IntPtr.Zero;
+            lock (_callback_map)
+            {
+                id = (IntPtr)_requestId++;
+                _callback_map[id] = (LocationError error, double latitude, double longitude, double altitude, int timestamp, double speed, double direction, double climb, IntPtr userData) =>
+                {
+                    if (error != LocationError.None)
+                    {
+                        Log.Error(Globals.LogTag, "Error in getting up location information," + (LocationError)error);
+                    }
+                    else
+                    {
+                        Log.Info(Globals.LogTag, "Creating a current location object");
+                        _location = new Location(latitude, longitude, altitude, 0.0, direction, speed, timestamp);
+                        task.SetResult(_location);
+                    }
+                    lock (_callback_map)
+                    {
+                        _callback_map.Remove(userData);
+                    }
+                };
+            }
+
+            int ret = Interop.LocatorEvent.GetSingleLocation(_handle, timeout, _callback_map[id], id);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in setting up location mocking," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+            return task.Task;
+        }
+
+
+        /// <summary>
+        /// Gets the details of the location.
+        /// </summary>
+        /// <returns> which contains the current location details</returns>
+        public Location GetLocation()
+        {
+            double altitude = 0;
+            double latitude = 0;
+            double longitude = 0;
+            double climb = 0;
+            double direction = 0;
+            double speed = 0;
+            LocationAccuracy level = LocationAccuracy.None;
+            double horizontal = 0;
+            double vertical = 0;
+            int timestamp = 0;
+
+            if (_isStarted)
+            {
+                Log.Info(Globals.LogTag, "Get current location information");
+                int ret = Interop.Locator.GetLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out horizontal, out vertical, out timestamp);
+                if (((LocationError)ret != LocationError.None))
+                {
+                    Log.Error(Globals.LogTag, "Error in get current location infomation," + (LocationError)ret);
+                    LocationErrorFactory.ThrowLocationException(ret);
+                }
+            }
+            else
+            {
+                Log.Info(Globals.LogTag, "Get last location information");
+                int ret = Interop.Locator.GetLastLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out horizontal, out vertical, out timestamp);
+                if (((LocationError)ret != LocationError.None))
+                {
+                    Log.Error(Globals.LogTag, "Error in get last location information," + (LocationError)ret);
+                    LocationErrorFactory.ThrowLocationException(ret);
+                }
+            }
+
+            Location location = new Location(latitude, longitude, altitude, horizontal, direction, speed, timestamp);
+            _location = location;
+
+            return location;
+        }
+
+
+        /// <summary>
+        /// Adds a bounds for a given location manager.
+        /// </summary>
+        /// <param name="locationBoundary"> The boundary object to be added to the location manager.</param>
+        public void AddBoundary(LocationBoundary locationBoundary)
+        {
+            Log.Info(Globals.LogTag, "AddBoundary called");
+
+            int ret = Interop.Locator.AddBoundary(_handle, locationBoundary.GetHandle());
+            if ((LocationBoundError)ret != LocationBoundError.None)
+            {
+                Log.Error(Globals.LogTag, "Error Adding Boundary," + (LocationBoundError)ret);
+                LocationErrorFactory.ThrowLocationBoundaryException(ret);
+            }
+        }
+
+        /// <summary>
+        /// Deletes a bounds for a given location.
+        /// </summary>
+        /// <param name="locationBoundary"> The boundary object to be removed from the location manager.</param>
+        public void RemoveBoundary(LocationBoundary locationBoundary)
+        {
+            Log.Info(Globals.LogTag, "RemoveBoundary called");
+            int ret = Interop.Locator.RemoveBoundary(_handle, locationBoundary.GetHandle());
+            if ((LocationBoundError)ret != LocationBoundError.None)
+            {
+                Log.Error(Globals.LogTag, "Error Removing Boundary," + (LocationBoundError)ret);
+                LocationErrorFactory.ThrowLocationBoundaryException(ret);
+            }
+        }
+
+        /// <summary>
+        /// The overidden Dispose method of the IDisposable class.
+        /// </summary>
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (_disposed)
+                return;
+
+            DestroyHandle();
+            _disposed = true;
+        }
+
+        private void DestroyHandle()
+        {
+            int ret = Interop.Locator.Destroy(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Destroy handle" + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        /// <summary>
+        /// (event) ServiceStateChanged Event is invoked when the location service state is changed.
+        /// </summary>
+        public event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
+        {
+            add
+            {
+                Log.Info(Globals.LogTag, "ServiceStateChanged called");
+                if (_serviceStateChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function SetServiceStateChangedCallback");
+                    SetServiceStateChangedCallback();
+                }
+                _serviceStateChanged += value;
+            }
+            remove
+            {
+                Log.Info(Globals.LogTag, "Callback removed");
+                _serviceStateChanged -= value;
+
+                if (_serviceStateChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function UnSetServiceStateChangedCallback");
+                    UnSetServiceStateChangedCallback();
+                }
+            }
+        }
+
+        private void SetServiceStateChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Calling Interop.LocatorEvent.SetServiceStateChangedCallback");
+            int ret = Interop.LocatorEvent.SetServiceStateChangedCallback(_handle, ServiceStateChangedCallback, IntPtr.Zero);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Setting Service State Changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void UnSetServiceStateChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Calling Interop.LocatorEvent.UnSetServiceStateChangedCallback");
+            int ret = Interop.LocatorEvent.UnSetServiceStateChangedCallback(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in UnSetting Service State Changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void ServiceStateChangedCallback(ServiceState state, IntPtr userData)
+        {
+            Log.Info(Globals.LogTag, "Inside ServiceStateChangedCallback");
+            _serviceStateChanged?.Invoke(this, new ServiceStateChangedEventArgs(state));
+        }
+
+        /// <summary>
+        /// (event) ZoneChanged is  invoked when the previously set boundary area is entered or left.
+        /// </summary>
+        public event EventHandler<ZoneChangedEventArgs> ZoneChanged
+        {
+            add
+            {
+                Log.Info(Globals.LogTag, "ZoneChanged called");
+                if (_zoneChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function SetZoneChangedCallback");
+                    SetZoneChangedCallback();
+                }
+                _zoneChanged += value;
+            }
+            remove
+            {
+                Log.Info(Globals.LogTag, "Callback removed");
+                _zoneChanged -= value;
+
+                if (_zoneChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function UnSetZoneChangedCallback");
+                    UnSetZoneChangedCallback();
+                }
+            }
+        }
+
+        private void SetZoneChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Inside SetZoneChangedCallback");
+            int ret = Interop.LocatorEvent.SetZoneChangedCallback(_handle, ZoneChangedCallback, IntPtr.Zero);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Setting Zone Changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void UnSetZoneChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Inside UnSetZoneChangedCallback");
+            int ret = Interop.LocatorEvent.UnSetZoneChangedCallback(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in UnSetting Zone Changed Callback," + (LocationError)ret);
+            }
+        }
+
+        private void ZoneChangedCallback(BoundaryState state, double latitude, double longitude, double altitude, int timestamp, IntPtr userData)
+        {
+            Log.Info(Globals.LogTag, "Inside ZoneChangedCallback");
+            DateTime timeStamp = DateTime.Now;
+            if (timestamp != 0)
+            {
+                DateTime start = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(timestamp), DateTimeKind.Utc);
+                timeStamp = start.ToLocalTime();
+            }
+            _zoneChanged?.Invoke(this, new ZoneChangedEventArgs(state, latitude, longitude, altitude, timeStamp));
+        }
+
+        /// <summary>
+        /// (event) SetttingChanged is raised when the location setting is changed.
+        /// </summary>
+        public event EventHandler<SettingChangedEventArgs> SettingChanged
+        {
+            add
+            {
+                Log.Info(Globals.LogTag, "Adding SettingChanged EventHandler");
+                if (_settingChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function SetSettingChangedCallback");
+                    SetSettingChangedCallback();
+                }
+                _settingChanged += value;
+            }
+            remove
+            {
+                Log.Info(Globals.LogTag, "Removing SettingChanged EventHandler");
+                _settingChanged -= value;
+
+                if (_settingChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function UnSetSettingChangedCallback");
+                    UnSetSettingChangedCallback();
+                }
+            }
+        }
+
+        private void SetSettingChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Calling SetSettingChangedCallback");
+            int ret = Interop.LocatorEvent.SetSettingChangedCallback((int)_locationType, SettingChangedCallback, IntPtr.Zero);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Setting Changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void UnSetSettingChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Calling UnSetSettingChangedCallback");
+            int ret = Interop.LocatorEvent.UnSetSettingChangedCallback((int)_locationType);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Unsetting Setting's Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void SettingChangedCallback(LocationType method, bool enable, IntPtr userData)
+        {
+            Log.Info(Globals.LogTag, "Calling SettingChangedCallback");
+            _settingChanged?.Invoke(this, new SettingChangedEventArgs(method, enable));
+        }
+
+        /// <summary>
+        /// (event) DistanceBasedLocationChanged is raised with updated location information.
+        /// The callback will be invoked at minimum interval or minimum distance with updated position information.
+        /// </summary>
+        public event EventHandler<LocationChangedEventArgs> DistanceBasedLocationChanged
+        {
+            add
+            {
+                Log.Info(Globals.LogTag, "Adding DistanceBasedLocationChanged EventHandler");
+                if (_distanceBasedLocationChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function SetDistanceBasedLocationChangedCallback");
+                    SetDistanceBasedLocationChangedCallback();
+                }
+                _distanceBasedLocationChanged += value;
+            }
+            remove
+            {
+                Log.Info(Globals.LogTag, "Removing DistanceBasedLocationChanged EventHandler");
+                _distanceBasedLocationChanged -= value;
+
+                if (_distanceBasedLocationChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function UnSetDistanceBasedLocationChangedCallback");
+                    UnSetDistanceBasedLocationChangedCallback();
+                }
+            }
+        }
+
+        private void SetDistanceBasedLocationChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "SetDistanceBasedLocationChangedCallback");
+            int ret = Interop.LocatorEvent.SetDistanceBasedLocationChangedCallback(_handle, DistanceBasedLocationChangedCallback, _stayInterval, _distance, IntPtr.Zero);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Setting Distance based location changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void UnSetDistanceBasedLocationChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "UnSetDistanceBasedLocationChangedCallback");
+            int ret = Interop.LocatorEvent.UnSetDistanceBasedLocationChangedCallback(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in UnSetting Distance based location changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void DistanceBasedLocationChangedCallback(double latitude, double longitude, double altitude, double speed, double direction, double horizontalAccuracy, int timestamp, IntPtr userData)
+        {
+            Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback");
+            Location location = new Location(latitude, longitude, altitude, horizontalAccuracy, direction, speed, timestamp);
+            _distanceBasedLocationChanged?.Invoke(this, new LocationChangedEventArgs(location));
+        }
+
+        /// <summary>
+        /// (event)LocationUpdated is raised at defined intervals of time with updated location information.
+        /// The callback will be invoked periodically.
+        /// </summary>
+        public event EventHandler<LocationChangedEventArgs> LocationChanged
+        {
+            add
+            {
+                Log.Info(Globals.LogTag, "Adding LocationChanged EventHandler");
+                if (_locationChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "Calling function SetLocationChangedCallback");
+                    SetLocationChangedCallback();
+                }
+                _locationChanged += value;
+            }
+            remove
+            {
+                Log.Info(Globals.LogTag, "Adding LocationChanged EventHandler");
+                _locationChanged -= value;
+
+                if (_locationChanged == null)
+                {
+                    Log.Info(Globals.LogTag, "calling function UnSetLocationChangedCallback");
+                    UnSetLocationChangedCallback();
+                }
+            }
+        }
+
+        private void SetLocationChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Calling SetLocationChangedCallback");
+            int ret = Interop.LocatorEvent.SetLocationChangedCallback(_handle, LocationChangedCallback, _interval, IntPtr.Zero);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in Setting location changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void UnSetLocationChangedCallback()
+        {
+            Log.Info(Globals.LogTag, "Calling UnSetLocationChangedCallback");
+            int ret = Interop.LocatorEvent.UnSetLocationChangedCallback(_handle);
+            if (((LocationError)ret != LocationError.None))
+            {
+                Log.Error(Globals.LogTag, "Error in UnSetting location changed Callback," + (LocationError)ret);
+                LocationErrorFactory.ThrowLocationException(ret);
+            }
+        }
+
+        private void LocationChangedCallback(double latitude, double longitude, double altitude, double speed, double direction, double horizontalAccuracy, int timestamp, IntPtr userData)
+        {
+            Log.Info(Globals.LogTag, "LocationChangedCallback has been called");
+            Location location = new Location(latitude, longitude, altitude, horizontalAccuracy, direction, speed, timestamp);
+            _location = location;
+            _locationChanged?.Invoke(this, new LocationChangedEventArgs(location));
+        }
+    }
+}
diff --git a/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs b/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs
new file mode 100644 (file)
index 0000000..3a42cbb
--- /dev/null
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+
+namespace Tizen.Location
+{
+    /// <summary>
+    /// Enumeration for the state of the location service.
+    /// </summary>
+    public enum ServiceState
+    {
+        Disabled = 0, /**<Service is disabled.*/
+        Enabled /**<Service is enabled.*/
+    }
+
+    /// <summary>
+    /// Enumeration for the type of connection used in acquiring Location data.
+    /// </summary>
+    public enum LocationType
+    {
+        None = -1, /**<Undefined method.*/
+        Hybrid, /**<This method selects the best method available at the moment.*/
+        Gps, /**<This method uses Global Positioning System.*/
+        Wps, /**<This method uses WiFi Positioning System.*/
+        Mock /**<This method uses Mock location for testing.*/
+    }
+
+    /// <summary>
+    /// Enumeration for Approximate accuracy level of given information.
+    /// </summary>
+    public enum LocationAccuracy
+    {
+        None = 0, /**< Invalid Data */
+        Country, /**< Country accuracy level */
+        Region, /**< Regional accuracy level */
+        Locality, /**< Local accuracy level*/
+        PostalCode, /**< Postal accuracy level */
+        Street, /**< Street accuracy level */
+        Detailed /**< Detailed accuracy level*/
+    }
+
+    /// <summary>
+    /// Enumeration for the location service accessibility state.
+    /// </summary>
+    public enum AccessibilityState
+    {
+        None = 0, /**< Access state is not determined */
+        Denied, /**< Access denied */
+        Allowed /**< Access authorized */
+    }
+
+    /// <summary>
+    /// Enumeration for the created boundary type.
+    /// </summary>
+    public enum BoundaryType
+    {
+        Rectangle = 0, /**<Rectangular geographical area type. */
+        Circle, /**<Rectangular geographical area type. */
+        Polygon /**<Rectangular geographical area type. */
+    }
+
+    /// <summary>
+    /// Enumeration for error code for Location manager.
+    /// </summary>
+    public enum BoundaryState
+    {
+        In = 0, /**< Boundary In (Zone In) */
+        Out /**< Boundary Out (Zone Out) */
+    }
+}
\ No newline at end of file
diff --git a/src/Tizen.Location/Tizen.Location/LocatorHelper.cs b/src/Tizen.Location/Tizen.Location/LocatorHelper.cs
new file mode 100644 (file)
index 0000000..77531ed
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.
+
+using System;
+
+namespace Tizen.Location
+{
+    public static class LocatorHelper
+    {
+        /// <summary>
+        /// Checks if the specified geographical positioning type is supported or not.
+        /// </summary>
+        /// <param name="locationType"> The back-end positioning method to be used for LBS.</param>
+        /// <returns>Returns a boolean value indicating whether or not the specified method is supported.</returns>
+        public static bool IsSupportedType(LocationType locationType)
+        {
+            bool initStatus = Interop.LocatorHelper.IsSupported((int)locationType);
+            Log.Info(Globals.LogTag, "Checking if the Location Manager type is supported ," + initStatus);
+            return initStatus;
+        }
+
+        /// <summary>
+        /// Checks if the specified geographical positioning type is enabled or not.
+        /// </summary>
+        /// <param name="locationType"> The back-end positioning method to be used for LBS.</param>
+        /// <returns>Returns a boolean value indicating whether or not the specified method is supported.</returns>
+        public static bool IsEnableType(LocationType locationType)
+        {
+            Log.Info(Globals.LogTag, "Checking if the Location Manager type is Enabled");
+            bool initStatus;
+            int ret = Interop.LocatorHelper.IsEnabled((int)locationType, out initStatus);
+            if (((LocationError)ret != LocationError.None))\r
+            {\r
+                Log.Error(Globals.LogTag, "Error Checking the Location Manager type is Enabled," + (LocationError)ret);\r
+                LocationErrorFactory.ThrowLocationException(ret);\r
+            }
+            return initStatus;
+        }
+    }
+}
diff --git a/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..1374084
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.\r
+\r
+using System;\r
+\r
+\r
+namespace Tizen.Location\r
+{\r
+    public class SatelliteStatusChangedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Class Constructor for SatelliteStatusChangedEventArgs class.
+        /// </summary>
+        /// <param name="activeCount"> The number of active satellites.</param>
+        /// <param name="inviewCount"> The number of satellites in view.</param>
+        /// <param name="timestamp"> The time at which the data has been extracted.</param>
+        public SatelliteStatusChangedEventArgs(uint activeCount, uint inviewCount, DateTime timeStamp)
+        {
+            ActiveCount = activeCount;
+            InViewCount = inviewCount;
+            TimeStamp = timeStamp;
+        }
+
+        /// <summary>
+        /// Gets the number of active satellites.
+        /// </summary>
+        public uint ActiveCount { get; private set; }
+
+        /// <summary>
+        /// Gets the number of satellites in view.
+        /// </summary>
+        public uint InViewCount { get; private set; }
+
+        /// <summary>
+        /// Get the timestamp.
+        /// </summary>
+        public DateTime TimeStamp { get; private set; }
+    }\r
+}\r
diff --git a/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..228cf08
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.\r
+\r
+using System;\r
+\r
+\r
+namespace Tizen.Location\r
+{\r
+    /// <summary>
+    /// An extended EventArgs class which contains the changed location service state.
+    /// </summary>
+    public class ServiceStateChangedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Class Constructor for ServiceStateChangedEventArgs class.
+        /// </summary>
+        /// <param name="state"> An enumeration of type LocationServiceState.</param>
+        public ServiceStateChangedEventArgs(ServiceState state)
+        {
+
+            ServiceState = state;
+        }
+
+        /// <summary>
+        /// Get the Service state.
+        /// </summary>
+        public ServiceState ServiceState { get; private set; }
+    }\r
+}\r
diff --git a/src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..07208d5
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.\r
+\r
+using System;\r
+\r
+\r
+namespace Tizen.Location\r
+{\r
+    public class SettingChangedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Class Constructor for SettingChangedEventArgs class.
+        /// </summary>
+        /// <param name="method"> The positioing method used for Location information.</param>
+        /// <param name="enable"> Status of the method.</param>
+        public SettingChangedEventArgs(LocationType type, bool enable)
+        {
+            LocationType = type;
+            IsEnabled = enable;
+        }
+
+        /// <summary>
+        /// Gets the currently used location method.
+        /// </summary>
+        public LocationType LocationType { get; private set; }
+
+        /// <summary>
+        /// Method to get the setting value changed.
+        /// </summary>
+        public bool IsEnabled { get; private set; }
+    }\r
+}\r
diff --git a/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs
new file mode 100644 (file)
index 0000000..e44f720
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). You
+// shall not disclose such Confidential Information and shall use
+// it only in accordance with the terms of the license agreement
+// you entered into with Samsung.\r
+\r
+using System;\r
+\r
+\r
+namespace Tizen.Location\r
+{\r
+    public class ZoneChangedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// Class Constructor for ZoneChangedEventArgs class.
+        /// </summary>
+        /// <param name="state"> An enumeration of type BoundaryState.</param>
+        /// <param name="latitude"> The latitude value.</param>
+        /// <param name="longitude"> The longitude value.</param>
+        /// <param name="altitude"> The altitude value.</param>
+        /// <param name="timestamp"> The timestamp value.</param>
+        public ZoneChangedEventArgs(BoundaryState state, double latitude, double longitude, double altitude, DateTime timestamp)
+        {
+            BoundState = state;
+            Latitude = latitude;
+            Longitude = longitude;
+            Altitude = altitude;
+            TimeStamp = timestamp;
+        }
+
+        /// <summary>
+        /// Get the Boundary State.
+        /// </summary>
+        public BoundaryState BoundState { get; private set; }
+
+        /// <summary>
+        /// Get the latitude.
+        /// </summary>
+        public double Latitude { get; private set; }
+
+        /// <summary>
+        /// Get the longitude.
+        /// </summary>
+        public double Longitude { get; private set; }
+
+        /// <summary>
+        /// Get the altitude.
+        /// </summary>
+        public double Altitude { get; private set; }
+
+        /// <summary>
+        /// Method to get the timestamp.
+        /// </summary>
+        public DateTime TimeStamp { get; private set; }
+    }\r
+}\r