--- /dev/null
+
+ 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.
+++ /dev/null
-\r
-Microsoft Visual Studio Solution File, Format Version 11.00\r
-# Visual Studio 2010\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.Sensor", "Tizen.System.Sensor\Tizen.System.Sensor.csproj", "{CB655C6A-F73B-448E-913C-CA4DCBC5E401}"\r
-EndProject\r
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Internals", "..\tizen\Tizen.Internals\Tizen.Internals.csproj", "{B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}"\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
- Debug|Any CPU = Debug|Any CPU\r
- Release|Any CPU = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
- {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Release|Any CPU.Build.0 = Release|Any CPU\r
- {CB655C6A-F73B-448E-913C-CA4DCBC5E401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
- {CB655C6A-F73B-448E-913C-CA4DCBC5E401}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
- {CB655C6A-F73B-448E-913C-CA4DCBC5E401}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
- {CB655C6A-F73B-448E-913C-CA4DCBC5E401}.Release|Any CPU.Build.0 = Release|Any CPU\r
- EndGlobalSection\r
- GlobalSection(MonoDevelopProperties) = preSolution\r
- StartupItem = Tizen.System.Sensor\Tizen.System.Sensor.csproj\r
- Policies = $0\r
- $0.DotNetNamingPolicy = $1\r
- $1.DirectoryNamespaceAssociation = None\r
- $1.ResourceNamePolicy = FileFormatDefault\r
- $0.TextStylePolicy = $2\r
- $2.inheritsSet = null\r
- $2.scope = text/x-csharp\r
- $0.CSharpFormattingPolicy = $3\r
- $3.inheritsSet = Mono\r
- $3.inheritsScope = text/x-csharp\r
- $3.scope = text/x-csharp\r
- $0.StandardHeader = $4\r
- $4.Text = \r
- $4.IncludeInNewFiles = True\r
- $0.TextStylePolicy = $5\r
- $5.EolMarker = Unix\r
- $5.inheritsSet = VisualStudio\r
- $5.inheritsScope = text/plain\r
- $5.scope = text/plain\r
- $0.TextStylePolicy = $6\r
- $6.inheritsSet = Mono\r
- $6.inheritsScope = text/plain\r
- $6.scope = application/xml\r
- $0.XmlFormattingPolicy = $7\r
- $7.inheritsSet = Mono\r
- $7.inheritsScope = application/xml\r
- $7.scope = application/xml\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<Properties>
- <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
- <MonoDevelop.Ide.Workbench ActiveDocument="Tizen.System.Sensor/Sensor/Plugins/Accelerometer.cs">
- <Files>
- <File FileName="Tizen.System.Sensor/Sensor/Sensor.cs" Line="74" Column="14" />
- <File FileName="Tizen.System.Sensor/Sensor/Plugins/Accelerometer.cs" Line="146" Column="34" />
- <File FileName="Tizen.System.Sensor/Interop/Interop.Sensor.cs" Line="57" Column="75" />
- <File FileName="Tizen.System.Sensor/Sensor/SensorErrorFactory.cs" Line="36" Column="60" />
- </Files>
- <Pads>
- <Pad Id="ProjectPad">
- <State expanded="True" selected="True">
- <Node name="Tizen.Internals" expanded="True" />
- <Node name="Tizen.System.Sensor" expanded="True">
- <Node name="Interop" expanded="True" />
- <Node name="Sensor" expanded="True">
- <Node name="EventArgs" expanded="True" />
- <Node name="Plugins" expanded="True" />
- </Node>
- </Node>
- </State>
- </Pad>
- </Pads>
- </MonoDevelop.Ide.Workbench>
- <MonoDevelop.Ide.DebuggingService.Breakpoints>
- <BreakpointStore />
- </MonoDevelop.Ide.DebuggingService.Breakpoints>
- <MonoDevelop.Ide.DebuggingService.PinnedWatches />
-</Properties>
\ No newline at end of file
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.0</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{CB655C6A-F73B-448E-913C-CA4DCBC5E401}</ProjectGuid>
- <OutputType>Library</OutputType>
- <RootNamespace>Tizen.System.Sensor</RootNamespace>
- <AssemblyName>Tizen.System.Sensor</AssemblyName>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG;</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Release</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <ConsolePause>false</ConsolePause>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Interop\Interop.Sensor.cs" />
- <Compile Include="Sensor\Enumerations.cs" />
- <Compile Include="Sensor\Sensor.cs" />
- <Compile Include="Interop\Interop.Libraries.cs" />
- <Compile Include="Sensor\Plugins\Accelerometer.cs" />
- <Compile Include="Sensor\EventArgs\SensorAccuracyChangedEventArgs.cs" />
- <Compile Include="Sensor\EventArgs\AccelerometerChangedEventArgs.cs" />
- <Compile Include="Sensor\SensorErrorFactory.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup>
- <ProjectReference Include="..\..\tizen\Tizen.Internals\Tizen.Internals.csproj">
- <Project>{B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}</Project>
- <Name>Tizen.Internals</Name>
- </ProjectReference>
- </ItemGroup>
- <ProjectExtensions>
- <MonoDevelop>
- <Properties>
- <Policies>
- <TextStylePolicy EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
- <CSharpFormattingPolicy inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
- <DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileFormatDefault" />
- <StandardHeader Text="" IncludeInNewFiles="True" />
- <TextStylePolicy EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
- <TextStylePolicy inheritsSet="Mono" inheritsScope="text/plain" scope="application/xml" />
- <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
- </Policies>
- </Properties>
- </MonoDevelop>
- </ProjectExtensions>
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <PropertyGroup>\r
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+ <ProductVersion>10.0.0</ProductVersion>\r
+ <SchemaVersion>2.0</SchemaVersion>\r
+ <ProjectGuid>{CB655C6A-F73B-448E-913C-CA4DCBC5E401}</ProjectGuid>\r
+ <OutputType>Library</OutputType>\r
+ <RootNamespace>Tizen.System.Sensor</RootNamespace>\r
+ <AssemblyName>Tizen.System</AssemblyName>\r
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\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;</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ <ConsolePause>false</ConsolePause>\r
+ <Prefer32Bit>false</Prefer32Bit>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>none</DebugType>\r
+ <Optimize>false</Optimize>\r
+ <OutputPath>bin\Release</OutputPath>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ <ConsolePause>false</ConsolePause>\r
+ <Prefer32Bit>false</Prefer32Bit>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <SignAssembly>true</SignAssembly>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <AssemblyOriginatorKeyFile>Tizen.System.Sensor.snk</AssemblyOriginatorKeyFile>\r
+ </PropertyGroup>\r
+ <ItemGroup>\r
+ <Reference Include="System" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Compile Include="Properties\AssemblyInfo.cs" />\r
+ <Compile Include="Interop\Interop.Sensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\SensorEnumerations.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\GravitySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\GyroscopeDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\HeartRateMonitorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\HumiditySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\LightSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\LinearAccelerationSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\MagnetometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\OrientationSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\PedometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\PressureSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\ProximitySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\RotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\SleepMonitorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\TemperatureSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\UltravioletSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\UncalibratedGyroscopeDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\UncalibratedMagnetometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\GravitySensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\Gyroscope.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\GyroscopeRotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\HeartRateMonitor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\HumiditySensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\LightSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\LinearAccelerationSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\Magnetometer.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\MagnetometerRotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\OrientationSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\Pedometer.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\PressureSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\ProximitySensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\RotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\SleepMonitor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\TemperatureSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\UltravioletSensor.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\UncalibratedGyroscope.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\UncalibratedMagnetometer.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Sensor.cs" />\r
+ <Compile Include="Interop\Interop.Libraries.cs" />\r
+ <Compile Include="Tizen.System.Sensor\Plugins\Accelerometer.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\SensorAccuracyChangedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\EventArgs\AccelerometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.System.Sensor\SensorErrorFactory.cs" />\r
+ </ItemGroup>\r
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
+ <ItemGroup>\r
+ <ProjectReference Include="..\..\tizen\Tizen.Internals\Tizen.Internals.csproj">\r
+ <Project>{B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}</Project>\r
+ <Name>Tizen.Internals</Name>\r
+ </ProjectReference>\r
+ <ProjectReference Include="..\..\tizen\Tizen\Tizen.csproj">\r
+ <Project>{7659ca59-410d-41a1-9841-586e88bc78c9}</Project>\r
+ <Name>Tizen</Name>\r
+ </ProjectReference>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="Tizen.System.Sensor.snk" />\r
+ </ItemGroup>\r
+ <ProjectExtensions>\r
+ <MonoDevelop>\r
+ <Properties>\r
+ <Policies>\r
+ <TextStylePolicy EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />\r
+ <CSharpFormattingPolicy inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />\r
+ <DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileFormatDefault" />\r
+ <StandardHeader Text="" IncludeInNewFiles="True" />\r
+ <TextStylePolicy EolMarker="Unix" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />\r
+ <TextStylePolicy inheritsSet="Mono" inheritsScope="text/plain" scope="application/xml" />\r
+ <XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />\r
+ </Policies>\r
+ </Properties>\r
+ </MonoDevelop>\r
+ </ProjectExtensions>\r
</Project>
\ No newline at end of file
/// <summary>
/// Accelerometer changed event arguments. Class for storing the data returned by accelerometer
/// </summary>
- public class AccelerometerChangedEventArgs : EventArgs
+ public class AccelerometerDataUpdatedEventArgs : EventArgs
{
- internal AccelerometerChangedEventArgs(float[] values)
+ internal AccelerometerDataUpdatedEventArgs(float[] values)
{
X = values[0];
Y = values[1];
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// GravitySensor changed event arguments. Class for storing the data returned by gravity sensor
+ /// </summary>
+ public class GravitySensorDataUpdatedEventArgs : EventArgs
+ {
+ internal GravitySensorDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ }
+
+ /// <summary>
+ /// Gets the X component of the gravity.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the gravity.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the gravity.
+ /// </summary>
+ public float Z { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// Gyroscope changed event arguments. Class for storing the data returned by gyroscope
+ /// </summary>
+ public class GyroscopeDataUpdatedEventArgs : EventArgs
+ {
+ internal GyroscopeDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ }
+
+ /// <summary>
+ /// Gets the X component of the gyroscope data.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the gyroscope data.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the gyroscope data.
+ /// </summary>
+ public float Z { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// GyroscopeRotationVectorSensor changed event arguments. Class for storing the data returned by gyroscope rotation vector sensor
+ /// </summary>
+ public class GyroscopeRotationVectorSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal GyroscopeRotationVectorSensorDataUpdatedEventArgs(float[] values, SensorDataAccuracy accuracy)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ W = values[3];
+ Accuracy = accuracy;
+ }
+
+ /// <summary>
+ /// Gets the X component of the gyroscope rotation vector.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the gyroscope rotation vector.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the gyroscope rotation vector.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the W component of the gyroscope rotation vector.
+ /// </summary>
+ public float W { get; private set; }
+
+ /// <summary>
+ /// Gets the accuracy of the gyroscope rotation vector data.
+ /// </summary>
+ public SensorDataAccuracy Accuracy { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// HeartRateMonitor changed event arguments. Class for storing the data returned by heart rate monitor
+ /// </summary>
+ public class HeartRateMonitorDataUpdatedEventArgs : EventArgs
+ {
+ internal HeartRateMonitorDataUpdatedEventArgs(int heartRate)
+ {
+ HeartRate = heartRate;
+ }
+
+ /// <summary>
+ /// Gets the value of the heartRate.
+ /// </summary>
+ public int HeartRate { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// HumiditySensor changed event arguments. Class for storing the data returned by humidity sensor
+ /// </summary>
+ public class HumiditySensorDataUpdatedEventArgs : EventArgs
+ {
+ internal HumiditySensorDataUpdatedEventArgs(float humidity)
+ {
+ Humidity = humidity;
+ }
+
+ /// <summary>
+ /// Gets the value of the humidity.
+ /// </summary>
+ public float Humidity { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// LightSensor changed event arguments. Class for storing the data returned by light sensor
+ /// </summary>
+ public class LightSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal LightSensorDataUpdatedEventArgs(float level)
+ {
+ Level = level;
+ }
+
+ /// <summary>
+ /// Gets the level of the light.
+ /// </summary>
+ public float Level { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// LinearAccelerationSensor changed event arguments. Class for storing the data returned by linear acceleration sensor
+ /// </summary>
+ public class LinearAccelerationSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal LinearAccelerationSensorDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ }
+
+ /// <summary>
+ /// Gets the X component of the linear acceleration.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the linear acceleration.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the linear acceleration.
+ /// </summary>
+ public float Z { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// Magnetometer changed event arguments. Class for storing the data returned by magnetometer sensor
+ /// </summary>
+ public class MagnetometerDataUpdatedEventArgs : EventArgs
+ {
+ internal MagnetometerDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ }
+
+ /// <summary>
+ /// Gets the X component of the magnetometer.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the magnetometer.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the magnetometer.
+ /// </summary>
+ public float Z { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// MagnetometerRotationVectorSensor changed event arguments. Class for storing the data returned by magnetometer rotation vector sensor
+ /// </summary>
+ public class MagnetometerRotationVectorSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal MagnetometerRotationVectorSensorDataUpdatedEventArgs(float[] values, SensorDataAccuracy accuracy)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ W = values[3];
+ Accuracy = accuracy;
+ }
+
+ /// <summary>
+ /// Gets the X component of the magnetometer rotation vector.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the magnetometer rotation vector.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the magnetometer rotation vector.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the W component of the magnetometer rotation vector.
+ /// </summary>
+ public float W { get; private set; }
+
+ /// <summary>
+ /// Gets the accuracy of the magnetometer rotation vector data.
+ /// </summary>
+ public SensorDataAccuracy Accuracy { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// OrientationSensor changed event arguments. Class for storing the data returned by orientation sensor
+ /// </summary>
+ public class OrientationSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal OrientationSensorDataUpdatedEventArgs(float[] values)
+ {
+ Azimuth = values[0];
+ Pitch = values[1];
+ Roll = values[2];
+ }
+
+ /// <summary>
+ /// Gets the azimuth component of the orientation.
+ /// </summary>
+ public float Azimuth { get; private set; }
+
+ /// <summary>
+ /// Gets the pitch component of the orientation.
+ /// </summary>
+ public float Pitch { get; private set; }
+
+ /// <summary>
+ /// Gets the roll component of the orientation.
+ /// </summary>
+ public float Roll { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// Pedometer changed event arguments. Class for storing the data returned by pedometer
+ /// </summary>
+ public class PedometerDataUpdatedEventArgs : EventArgs
+ {
+ internal PedometerDataUpdatedEventArgs(float[] values)
+ {
+ StepCount = (int) values[0];
+ WalkStepCount = (int) values[1];
+ RunStepCount = (int) values[2];
+ MovingDistance = values[3];
+ CalorieBurned = values[4];
+ LastSpeed = values[5];
+ LastSteppingFrequency = values[6];
+ LastStepStatus = (PedometerState) values[7];
+ }
+
+ /// <summary>
+ /// Gets the step count
+ /// </summary>
+ public int StepCount { get; private set; }
+
+ /// <summary>
+ /// Gets the walking step count
+ /// </summary>
+ public int WalkStepCount { get; private set; }
+
+ /// <summary>
+ /// Gets the running step count
+ /// </summary>
+ public int RunStepCount { get; private set; }
+
+ /// <summary>
+ /// Gets the moving distance
+ /// </summary>
+ public float MovingDistance { get; private set; }
+
+ /// <summary>
+ /// Gets the calorie burned
+ /// </summary>
+ public float CalorieBurned { get; private set; }
+
+ /// <summary>
+ /// Gets the last speed
+ /// </summary>
+ public float LastSpeed { get; private set; }
+
+ /// <summary>
+ /// Gets the last stepping frequency
+ /// </summary>
+ public float LastSteppingFrequency { get; private set; }
+
+ /// <summary>
+ /// Gets the last step status
+ /// </summary>
+ public PedometerState LastStepStatus { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// PressureSensor changed event arguments. Class for storing the data returned by pressure sensor
+ /// </summary>
+ public class PressureSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal PressureSensorDataUpdatedEventArgs(float pressure)
+ {
+ Pressure = pressure;
+ }
+
+ /// <summary>
+ /// Gets the value of the pressure.
+ /// </summary>
+ public float Pressure { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// ProximitySensor changed event arguments. Class for storing the data returned by proximity sensor
+ /// </summary>
+ public class ProximitySensorDataUpdatedEventArgs : EventArgs
+ {
+ internal ProximitySensorDataUpdatedEventArgs(float proximity)
+ {
+ Proximity = (ProximitySensorState) proximity;
+ }
+
+ /// <summary>
+ /// Gets the proximity state.
+ /// </summary>
+ public ProximitySensorState Proximity { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// RotationVectorSensor changed event arguments. Class for storing the data returned by rotation vector sensor
+ /// </summary>
+ public class RotationVectorSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal RotationVectorSensorDataUpdatedEventArgs(float[] values, SensorDataAccuracy accuracy)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ W = values[3];
+ Accuracy = accuracy;
+ }
+
+ /// <summary>
+ /// Gets the X component of the rotation vector.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the rotation vector.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the rotation vector.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the W component of the rotation vector.
+ /// </summary>
+ public float W { get; private set;}
+
+ /// <summary>
+ /// Gets the accuracy of the rotation vector data.
+ /// </summary>
+ public SensorDataAccuracy Accuracy { get; private set; }
+ }
+}
\ No newline at end of file
/// </summary>
public class SensorAccuracyChangedEventArgs : EventArgs
{
- internal SensorAccuracyChangedEventArgs(DateTime timestamp, SensorDataAccuracy accuracy)
+ internal SensorAccuracyChangedEventArgs(TimeSpan timespan, SensorDataAccuracy accuracy)
{
- TimeStamp = timestamp;
+ TimeSpan = timespan;
Accuracy = accuracy;
}
/// <summary>
/// Gets the time stamp.
/// </summary>
- public DateTime TimeStamp { get; private set; }
+ public TimeSpan TimeSpan { get; private set; }
/// <summary>
/// Gets the accuracy.
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// SleepMonitor changed event arguments. Class for storing the data returned by sleep monitor
+ /// </summary>
+ public class SleepMonitorDataUpdatedEventArgs : EventArgs
+ {
+ internal SleepMonitorDataUpdatedEventArgs(int sleepState)
+ {
+ SleepState = (SleepMonitorState) sleepState;
+ }
+
+ /// <summary>
+ /// Gets the value of the sleep state.
+ /// </summary>
+ public SleepMonitorState SleepState { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// TemperatureSensor changed event arguments. Class for storing the data returned by temperature sensor
+ /// </summary>
+ public class TemperatureSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal TemperatureSensorDataUpdatedEventArgs(float temperature)
+ {
+ Temperature = temperature;
+ }
+
+ /// <summary>
+ /// Gets the value of the temperature.
+ /// </summary>
+ public float Temperature { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// UltravioletSensor changed event arguments. Class for storing the data returned by ultraviolet sensor
+ /// </summary>
+ public class UltravioletSensorDataUpdatedEventArgs : EventArgs
+ {
+ internal UltravioletSensorDataUpdatedEventArgs(float ultravioletIndex)
+ {
+ UltravioletIndex = ultravioletIndex;
+ }
+
+ /// <summary>
+ /// Gets the value of the ultraviolet index.
+ /// </summary>
+ public float UltravioletIndex { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// UncalibratedGyroscope changed event arguments. Class for storing the data returned by uncalibrated gyroscope
+ /// </summary>
+ public class UncalibratedGyroscopeDataUpdatedEventArgs : EventArgs
+ {
+ internal UncalibratedGyroscopeDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ BiasX = values[3];
+ BiasY = values[4];
+ BiasZ = values[5];
+ }
+
+ /// <summary>
+ /// Gets the X component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasX component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float BiasX { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasY component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float BiasY { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasZ component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float BiasZ { get; private set; }
+ }
+}
\ No newline at end of file
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// UncalibratedMagnetometer changed event arguments. Class for storing the data returned by uncalibrated magnetometer
+ /// </summary>
+ public class UncalibratedMagnetometerDataUpdatedEventArgs : EventArgs
+ {
+ internal UncalibratedMagnetometerDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ BiasX = values[3];
+ BiasY = values[4];
+ BiasZ = values[5];
+ }
+
+ /// <summary>
+ /// Gets the X component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasX component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float BiasX { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasY component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float BiasY { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasZ component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float BiasZ { get; private set; }
+ }
+}
\ No newline at end of file
/// /// </summary>
public class Accelerometer : Sensor
{
- private uint _defaultInterval = 0;
-
/// <summary>
/// Gets the X component of the acceleration.
/// </summary>
{
get
{
+ Log.Info(Globals.LogTag, "Checking if the Accelerometer sensor is supported");
return CheckIfSupported();
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the count of accelerometer sensors");
return GetCount();
}
}
/// </param>
public Accelerometer(int index = 0) : base(index)
{
- Interval = _defaultInterval;
+ Log.Info(Globals.LogTag, "Creating Accelerometer object");
}
- protected override SensorType GetSensorType()
+ internal override SensorType GetSensorType()
{
return SensorType.Accelerometer;
}
/// Event Handler for storing the callback functions for event corresponding to change in accelerometer sensor data.
/// </summary>
- public event EventHandler<AccelerometerChangedEventArgs> DataUpdated;
+ public event EventHandler<AccelerometerDataUpdatedEventArgs> DataUpdated;
private static bool CheckIfSupported()
{
bool isSupported;
int error = Interop.SensorManager.SensorIsSupported(SensorType.Accelerometer, out isSupported);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if accelerometer sensor is supported");
isSupported = false;
+ }
return isSupported;
}
IntPtr list;
int count;
int error = Interop.SensorManager.GetSensorList(SensorType.Accelerometer, out list, out count);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for accelerometer");
count = 0;
+ }
else
Interop.Libc.Free(list);
return count;
protected override void EventListenStart()
{
int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for accelerometer sensor");
throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for accelerometer");
+ }
}
protected override void EventListenStop()
{
int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for accelerometer sensor");
throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for accelerometer");
+ }
}
private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
{
Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- Timestamp = sensorData.timestamp;
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
X = sensorData.values[0];
Y = sensorData.values[1];
Z = sensorData.values[2];
- DataUpdated?.Invoke(this, new AccelerometerChangedEventArgs(sensorData.values));
+ DataUpdated?.Invoke(this, new AccelerometerDataUpdatedEventArgs(sensorData.values));
}
}
-}
\ No newline at end of file
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// GravitySensor Class. Used for registering callbacks for gravity sensor and getting gravity data
+ /// /// </summary>
+ public class GravitySensor : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the X component of the gravity.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the gravity.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the gravity.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether gravity sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the GravitySensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of gravity sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of gravity sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.GravitySensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular gravity sensor in case of multiple sensors
+ /// </param>
+ public GravitySensor (int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating GravitySensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.GravitySensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in gravity sensor data.
+ /// </summary>
+
+ public event EventHandler<GravitySensorDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.GravitySensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if gravity sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.GravitySensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for gravity");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for gravity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for gravity");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for gravity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for gravity");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for gravity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for gravity");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for gravity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for gravity");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+
+ DataUpdated?.Invoke(this, new GravitySensorDataUpdatedEventArgs(sensorData.values));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// Gyroscope Sensor Class. Used for registering callbacks for gyroscope and getting gyroscope data
+ /// /// </summary>
+ public class Gyroscope : Sensor
+ {
+ /// <summary>
+ /// Gets the X component of the acceleration.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the acceleration.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the acceleration.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether gyroscope sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the Gyroscope sensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of gyroscope sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of gyroscope sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.Gyroscope"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular gyroscope sensor in case of multiple sensors
+ /// </param>
+ public Gyroscope(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating Gyroscope object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.Gyroscope;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in gyroscope sensor data.
+ /// </summary>
+
+ public event EventHandler<GyroscopeDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.Gyroscope, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if gyroscope sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.Gyroscope, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for gyroscope");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for gyroscope sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for gyroscope");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for gyroscope sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for gyroscope");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+
+ DataUpdated?.Invoke(this, new GyroscopeDataUpdatedEventArgs(sensorData.values));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// GyroscopeRotationVectorSensor Class. Used for registering callbacks for gyroscope rotation vector sensor and getting gyroscope rotation vector data
+ /// /// </summary>
+ public class GyroscopeRotationVectorSensor : Sensor
+ {
+ /// <summary>
+ /// Gets the X component of the gyroscope rotation vector.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the gyroscope rotation vector.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the gyroscope rotation vector.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the W component of the gyroscope rotation vector.
+ /// </summary>
+ public float W { get; private set; }
+
+ /// <summary>
+ /// Gets the Accuracy of the gyroscope rotation vector data.
+ /// </summary>
+ public SensorDataAccuracy Accuracy { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether gyroscope rotation vector sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the GyroscopeRotationVectorSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of gyroscope rotation vector sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of gyroscope rotation vector sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.GyroscopeRotationVectorSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular gyroscope rotation vector sensor in case of multiple sensors
+ /// </param>
+ public GyroscopeRotationVectorSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating GyroscopeRotationVectorSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.GyroscopeRotationVectorSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in gyroscope rotation vector sensor data.
+ /// </summary>
+
+ public event EventHandler<GyroscopeRotationVectorSensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.GyroscopeRotationVectorSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if gyroscope rotation vector sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.GyroscopeRotationVectorSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for gyroscope rotation vector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for gyroscope rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for gyroscope rotation vector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for gyroscope rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for gyroscope rotation vector");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+ Accuracy = sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new GyroscopeRotationVectorSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy));
+ }
+
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// HeartRateMonitor Class. Used for registering callbacks for heart rate monitor and getting heart rate data
+ /// /// </summary>
+ public class HeartRateMonitor : Sensor
+ {
+ /// <summary>
+ /// Gets the value of the heart rate monitor.
+ /// </summary>
+ public int HeartRate { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether heart rate monitor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the HeartRateMonitor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of heart rate monitors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of heart rate monitors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.HeartRateMonitor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular heart rate monitor in case of multiple sensors
+ /// </param>
+ public HeartRateMonitor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating HeartRateMonitor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.HeartRateMonitor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in heart rate monitor data.
+ /// </summary>
+
+ public event EventHandler<HeartRateMonitorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.HeartRateMonitor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if heart rate monitor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.HeartRateMonitor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for heart rate");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for heart rate monitor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for heart rate");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for heart rate monitor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for heart rate");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ HeartRate = (int)sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new HeartRateMonitorDataUpdatedEventArgs((int)sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// HumiditySensor Class. Used for registering callbacks for humidity sensor and getting humidity data
+ /// /// </summary>
+ public class HumiditySensor : Sensor
+ {
+ /// <summary>
+ /// Gets the value of the humidity sensor.
+ /// </summary>
+ public float Humidity { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether humidity sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the HumiditySensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of humidity sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of humidity sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.HumiditySensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular humidity sensor in case of multiple sensors
+ /// </param>
+ public HumiditySensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating HumiditySensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.HumiditySensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in humidity sensor data.
+ /// </summary>
+
+ public event EventHandler<HumiditySensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.HumiditySensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if humidity sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.HumiditySensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for humidity");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for humidity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for humidity");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for humidity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for humidity");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Humidity = sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new HumiditySensorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// LightSensor Class. Used for registering callbacks for light sensor and getting light data
+ /// /// </summary>
+ public class LightSensor : Sensor
+ {
+ /// <summary>
+ /// Gets the Level of the light.
+ /// </summary>
+ public float Level { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether light sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the LightSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of light sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of light sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.LightSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular light sensor in case of multiple sensors
+ /// </param>
+ public LightSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating LightSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.LightSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in light sensor data.
+ /// </summary>
+
+ public event EventHandler<LightSensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.LightSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if light sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.LightSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for light");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for light sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for light");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for light sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for light");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Level = sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new LightSensorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// LinearAccelerationSensor Class. Used for registering callbacks for linear acceleration sensor and getting linear acceleration data
+ /// /// </summary>
+ public class LinearAccelerationSensor : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the X component of the linear acceleration.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the linear acceleration.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the linear acceleration.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether linear acceleration sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the LinearAccelerationSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of linear acceleration sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of linear acceleration sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.LinearAccelerationSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular linear acceleration sensor in case of multiple sensors
+ /// </param>
+ public LinearAccelerationSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating LinearAccelerationSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.LinearAccelerationSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in linear acceleration sensor data.
+ /// </summary>
+
+ public event EventHandler<LinearAccelerationSensorDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.LinearAccelerationSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if linear acceleration sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.LinearAccelerationSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for linear acceleration sensor");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for linear acceleration sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for linear acceleration sensor");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for linear acceleration sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for linear acceleration");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for linear acceleration sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for linear acceleration sensor");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for linear acceleration sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for linear acceleration sensor");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+
+ DataUpdated?.Invoke(this, new LinearAccelerationSensorDataUpdatedEventArgs(sensorData.values));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// Magnetometer Class. Used for registering callbacks for magnetometer and getting magnetometer data
+ /// /// </summary>
+ public class Magnetometer : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the X component of the magnetometer.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the magnetometer.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the magnetometer.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether magnetometer is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the Magnetometer is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of magnetometers available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of magnetometers");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.Magnetometer"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular magnetometer in case of multiple sensors
+ /// </param>
+ public Magnetometer(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating Magnetometer object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.Magnetometer;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in magnetometer data.
+ /// </summary>
+
+ public event EventHandler<MagnetometerDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.Magnetometer, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if magnetometer is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.Magnetometer, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for magnetometer");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for magnetometer");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for magnetometer");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for magnetometer");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for magnetometer");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for magnetometer");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for magnetometer");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for magnetometer");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for magnetometer");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+
+ DataUpdated?.Invoke(this, new MagnetometerDataUpdatedEventArgs(sensorData.values));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// MagnetometerRotationVectorSensor Class. Used for registering callbacks for magnetometer rotation vector sensor and getting magnetometer rotation vector data
+ /// /// </summary>
+ public class MagnetometerRotationVectorSensor : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the X component of the magnetometer rotation vector.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the magnetometer rotation vector.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the magnetometer rotation vector.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the W component of the magnetometer rotation vector.
+ /// </summary>
+ public float W { get; private set; }
+
+ /// <summary>
+ /// Gets the Accuracy of the magnetometer rotation vector data.
+ /// </summary>
+ public SensorDataAccuracy Accuracy { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether magnetometer rotation vector sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the MagnetometerRotationVectorSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of magnetometer rotation vector sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of magnetometer rotation vector sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.MagnetometerRotationVectorSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular magnetometer rotation vector sensor in case of multiple sensors
+ /// </param>
+ public MagnetometerRotationVectorSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating MagnetometerRotationVectorSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.MagnetometerRotationVectorSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in magnetometer rotation vector sensor data.
+ /// </summary>
+
+ public event EventHandler<MagnetometerRotationVectorSensorDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.MagnetometerRotationVectorSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if magnetometer rotation vector sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.MagnetometerRotationVectorSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for magnetometer rotation vector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for magnetometer rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for magnetometer rotation vector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for magnetometer rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for magnetometer rotation vector");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for magnetometer rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for magnetometer rotation vector");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for magnetometer rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for magnetometer rotation vector");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+ Accuracy = sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new MagnetometerRotationVectorSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ Accuracy = accuracy;
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
--- /dev/null
+// Copyright 2016 by Samsung Electronics, Inc.,
+//
+// This software is the confidential and proprietary information
+// of Samsung Electronics, Inc. ("Confidential Information"). Pitchou
+// 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.System.Sensor
+{
+ /// <summary>
+ /// OrientationSensor Class. Used for registering callbacks for orientation sensor and getting orientation data
+ /// /// </summary>
+ public class OrientationSensor : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the Azimuth component of the orientation.
+ /// </summary>
+ public float Azimuth { get; private set; }
+
+ /// <summary>
+ /// Gets the Pitch component of the orientation.
+ /// </summary>
+ public float Pitch { get; private set; }
+
+ /// <summary>
+ /// Gets the Roll component of the orientation.
+ /// </summary>
+ public float Roll { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether orientation sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the OrientationSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of orientation sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of orientation sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.OrientationSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular orientation sensor in case of multiple sensors
+ /// </param>
+ public OrientationSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating OrientationSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.OrientationSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in orientation sensor data.
+ /// </summary>
+
+ public event EventHandler<OrientationSensorDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.OrientationSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if orientation sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.OrientationSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for orientation");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for orientation sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for orientation");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for orientation sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for orientation");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for orientation sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy accuracy event callback for orientation");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for orientation sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for orientation");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Azimuth = sensorData.values[0];
+ Pitch = sensorData.values[1];
+ Roll = sensorData.values[2];
+
+ DataUpdated?.Invoke(this, new OrientationSensorDataUpdatedEventArgs(sensorData.values));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// Pedometer Sensor Class. Used for registering callbacks for pedometer and getting pedometer data
+ /// /// </summary>
+ public class Pedometer : Sensor
+ {
+ /// <summary>
+ /// Gets the step count
+ /// </summary>
+ public int StepCount { get; private set; }
+
+ /// <summary>
+ /// Gets the walking step count
+ /// </summary>
+ public int WalkStepCount { get; private set; }
+
+ /// <summary>
+ /// Gets the running step count
+ /// </summary>
+ public int RunStepCount { get; private set; }
+
+ /// <summary>
+ /// Gets the moving distance
+ /// </summary>
+ public float MovingDistance { get; private set; }
+
+ /// <summary>
+ /// Gets the calorie burned
+ /// </summary>
+ public float CalorieBurned { get; private set; }
+
+ /// <summary>
+ /// Gets the last speed
+ /// </summary>
+ public float LastSpeed { get; private set; }
+
+ /// <summary>
+ /// Gets the last stepping frequency
+ /// </summary>
+ public float LastSteppingFrequency { get; private set; }
+
+ /// <summary>
+ /// Gets the last step status
+ /// </summary>
+ public PedometerState LastStepStatus { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether pedometer sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the Pedometer sensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of pedometer sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of pedometer sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.Pedometer"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular pedometer sensor in case of multiple sensors
+ /// </param>
+ public Pedometer(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating Pedometer object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.HumanPedometer;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in pedometer sensor data.
+ /// </summary>
+
+ public event EventHandler<PedometerDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.HumanPedometer, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if pedometer sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.HumanPedometer, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for pedometer");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for pedometer sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pedometer");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for pedometer sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pedometer");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ StepCount = (int)sensorData.values[0];
+ WalkStepCount = (int)sensorData.values[1];
+ RunStepCount = (int)sensorData.values[2];
+ MovingDistance = sensorData.values[3];
+ CalorieBurned = sensorData.values[4];
+ LastSpeed = sensorData.values[5];
+ LastSteppingFrequency = sensorData.values[6];
+ LastStepStatus = (PedometerState)sensorData.values[7];
+
+ DataUpdated?.Invoke(this, new PedometerDataUpdatedEventArgs(sensorData.values));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// PressureSensor Class. Used for registering callbacks for pressure sensor and getting pressure data
+ /// /// </summary>
+ public class PressureSensor : Sensor
+ {
+ /// <summary>
+ /// Gets the value of the pressure sensor.
+ /// </summary>
+ public float Pressure { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether pressure sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the PressureSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of pressure sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of pressure sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.PressureSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular pressure sensor in case of multiple sensors
+ /// </param>
+ public PressureSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating PressureSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.PressureSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in pressure sensor data.
+ /// </summary>
+
+ public event EventHandler<PressureSensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.PressureSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if pressure sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.PressureSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for pressure");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for pressure sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pressure");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for pressure sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pressure");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Pressure = sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new PressureSensorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// ProximitySensor Class. Used for registering callbacks for proximity sensor and getting proximity data
+ /// /// </summary>
+ public class ProximitySensor : Sensor
+ {
+ /// <summary>
+ /// Gets the proximity state.
+ /// </summary>
+ public ProximitySensorState Proximity { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether proximity sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the ProximitySensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of proximity sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of proximity sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.ProximitySensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular proximity sensor in case of multiple sensors
+ /// </param>
+ public ProximitySensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating ProximitySensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.ProximitySensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in proximity sensor data.
+ /// </summary>
+
+ public event EventHandler<ProximitySensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.ProximitySensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if proximity sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.ProximitySensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for proximity");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for proximity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for proximity");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for proximity sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for proximity");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Proximity = (ProximitySensorState) sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new ProximitySensorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// RotationVectorSensor Class. Used for registering callbacks for rotation vector sensor and getting rotation vector data
+ /// /// </summary>
+ public class RotationVectorSensor : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the X component of the rotation vector.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the rotation vector.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the rotation vector.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the W component of the rotation vector.
+ /// </summary>
+ public float W { get; private set; }
+
+ /// <summary>
+ /// Gets the Accuracy of the rotation vector data.
+ /// </summary>
+ public SensorDataAccuracy Accuracy { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether rotation vector sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the RotationVectorSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of rotation vector sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of rotation vector sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.RotationVectorSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular rotation vector sensor in case of multiple sensors
+ /// </param>
+ public RotationVectorSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating RotationVectorSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.RotationVectorSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in rotation vector sensor data.
+ /// </summary>
+
+ public event EventHandler<RotationVectorSensorDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.RotationVectorSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if rotation vector sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.RotationVectorSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for rotation vector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for rotation vector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for rotation vector");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for rotation vector");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for rotation vector sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for rotation vector");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+ Accuracy = sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new RotationVectorSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ Accuracy = accuracy;
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// SleepMonitor Class. Used for registering callbacks for sleep monitor and getting sleep data
+ /// /// </summary>
+ public class SleepMonitor : Sensor
+ {
+ /// <summary>
+ /// Gets the value of the sleep state.
+ /// </summary>
+ public SleepMonitorState SleepState { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether sleep monitor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the SleepMonitor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of sleep monitors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of sleep monitors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.SleepMonitor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular sleep monitor in case of multiple sensors
+ /// </param>
+ public SleepMonitor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating SleepMonitor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.HumanSleepMonitor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in sleep monitor data.
+ /// </summary>
+
+ public event EventHandler<SleepMonitorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.HumanSleepMonitor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if sleep monitor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.HumanSleepMonitor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for sleep");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for sleep monitor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for sleep");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for sleep monitor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for sleep");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ SleepState = (SleepMonitorState)sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new SleepMonitorDataUpdatedEventArgs((int)sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// TemperatureSensor Class. Used for registering callbacks for temperature sensor and getting temperature data
+ /// /// </summary>
+ public class TemperatureSensor : Sensor
+ {
+ /// <summary>
+ /// Gets the value of the temperature sensor.
+ /// </summary>
+ public float Temperature { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether temperature sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the TemperatureSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of temperature sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of temperature sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.TemperatureSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular temperature sensor in case of multiple sensors
+ /// </param>
+ public TemperatureSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating TemperatureSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.TemperatureSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in temperature sensor data.
+ /// </summary>
+
+ public event EventHandler<TemperatureSensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.TemperatureSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if temperature sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.TemperatureSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for temperature");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for temperature sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for temperature");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for temperature sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for temperature");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Temperature = sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new TemperatureSensorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// UltravioletSensor Class. Used for registering callbacks for ultraviolet sensor and getting ultraviolet data
+ /// /// </summary>
+ public class UltravioletSensor : Sensor
+ {
+ /// <summary>
+ /// Gets the value of the ultraviolet sensor.
+ /// </summary>
+ public float UltravioletIndex { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether ultraviolet sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the UltravioletSensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of ultraviolet sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of ultraviolet sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.UltravioletSensor"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular ultraviolet sensor in case of multiple sensors
+ /// </param>
+ public UltravioletSensor(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating UltravioletSensor object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.UltravioletSensor;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in ultraviolet sensor data.
+ /// </summary>
+
+ public event EventHandler<UltravioletSensorDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.UltravioletSensor, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if ultraviolet sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.UltravioletSensor, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for ultraviolet");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for ultraviolet sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for ultraviolet");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for ultraviolet sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for ultraviolet");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ UltravioletIndex = sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new UltravioletSensorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// UncalibratedGyroscope Sensor Class. Used for registering callbacks for uncalibrated gyroscope and getting uncalibrated gyroscope data
+ /// /// </summary>
+ public class UncalibratedGyroscope : Sensor
+ {
+ /// <summary>
+ /// Gets the X component of the acceleration.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the acceleration.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the acceleration.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasX component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float BiasX { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasY component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float BiasY { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasZ component of the uncalibrated gyroscope data.
+ /// </summary>
+ public float BiasZ { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether uncalibrated gyroscope sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the UncalibratedGyroscope sensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of uncalibrated gyroscope sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of uncalibrated gyroscope sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.UncalibratedGyroscope"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular uncalibrated gyroscope sensor in case of multiple sensors
+ /// </param>
+ public UncalibratedGyroscope(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating UncalibratedGyroscope object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.UncalibratedGyroscope;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in uncalibrated gyroscope sensor data.
+ /// </summary>
+
+ public event EventHandler<UncalibratedGyroscopeDataUpdatedEventArgs> DataUpdated;
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.UncalibratedGyroscope, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if uncalibrated gyroscope sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.UncalibratedGyroscope, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for uncalibrated gyroscope");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for uncalibrated gyroscope sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for uncalibrated gyroscope");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for uncalibrated gyroscope sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for uncalibrated gyroscope");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+ BiasX = sensorData.values[3];
+ BiasY = sensorData.values[4];
+ BiasZ = sensorData.values[5];
+
+ DataUpdated?.Invoke(this, new UncalibratedGyroscopeDataUpdatedEventArgs(sensorData.values));
+ }
+ }
+}
--- /dev/null
+// 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.System.Sensor
+{
+ /// <summary>
+ /// UncalibratedMagnetometer Sensor Class. Used for registering callbacks for uncalibrated magnetometer and getting uncalibrated magnetometer data
+ /// /// </summary>
+ public class UncalibratedMagnetometer : Sensor
+ {
+ private event EventHandler<SensorAccuracyChangedEventArgs> _accuracyChanged;
+ /// <summary>
+ /// Gets the X component of the acceleration.
+ /// </summary>
+ public float X { get; private set; }
+
+ /// <summary>
+ /// Gets the Y component of the acceleration.
+ /// </summary>
+ public float Y { get; private set; }
+
+ /// <summary>
+ /// Gets the Z component of the acceleration.
+ /// </summary>
+ public float Z { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasX component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float BiasX { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasY component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float BiasY { get; private set; }
+
+ /// <summary>
+ /// Gets the BiasZ component of the uncalibrated magnetometer data.
+ /// </summary>
+ public float BiasZ { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether uncalibrated magnetometer sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the UncalibratedMagnetometer sensor is supported");
+ return CheckIfSupported();
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of uncalibrated magnetometer sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of uncalibrated magnetometer sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.System.Sensor.UncalibratedMagnetometer"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular uncalibrated magnetometer sensor in case of multiple sensors
+ /// </param>
+ public UncalibratedMagnetometer(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating UncalibratedMagnetometer object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.UncalibratedMagnetometer;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in uncalibrated magnetometer sensor data.
+ /// </summary>
+
+ public event EventHandler<UncalibratedMagnetometerDataUpdatedEventArgs> DataUpdated;
+
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.UncalibratedMagnetometer, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if uncalibrated magnetometer sensor is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.UncalibratedMagnetometer, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for uncalibrated magnetometer");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ protected override void EventListenStart()
+ {
+ int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, SensorEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting event callback for uncalibrated magnetometer sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for uncalibrated magnetometer");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for uncalibrated magnetometer sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for uncalibrated magnetometer");
+ }
+ }
+
+ private void AccuracyListenStart()
+ {
+ int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, Interval, AccuracyEventCallback, IntPtr.Zero);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting accuracy event callback for uncalibrated magnetometer");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for uncalibrated magnetometer");
+ }
+ }
+
+ private void AccuracyListenStop()
+ {
+ int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for uncalibrated magnetometer");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for uncalibrated magnetometer");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+ BiasX = sensorData.values[3];
+ BiasY = sensorData.values[4];
+ BiasZ = sensorData.values[5];
+
+ DataUpdated?.Invoke(this, new UncalibratedMagnetometerDataUpdatedEventArgs(sensorData.values));
+ }
+
+ private void AccuracyEventCallback(IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data)
+ {
+ TimeSpan = new TimeSpan((Int64)timestamp);
+ _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy));
+ }
+ }
+}
using System;
+
namespace Tizen.System.Sensor
{
+ internal static class Globals
+ {
+ internal const string LogTag = "Tizen.System.Sensor";
+ }
+
/// <summary>
/// Sensor class for storing hardware information about a particular sensor
/// </summary>
private int _minInterval;
private int _fifoCount;
private int _maxBatchCount;
- private bool _sensing = false;
+ private bool _isSensing = false;
private bool _disposed = false;
- private UInt64 _timestamp;
+ private TimeSpan _timeSpan;
private uint _interval = 0;
private uint _maxBatchLatency = 0;
private SensorPausePolicy _pausePolicy = SensorPausePolicy.None;
private IntPtr _sensorHandle = IntPtr.Zero;
private IntPtr _listenerHandle = IntPtr.Zero;
- protected abstract SensorType GetSensorType();
+ internal abstract SensorType GetSensorType();
protected abstract void EventListenStart();
protected abstract void EventListenStop();
{
get
{
+ Log.Info(Globals.LogTag, "Getting the sensor name");
return _name;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the sensor vendor name");
return _vendor;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the min value of the sensor");
return _minValue;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the max value of the sensor");
return _maxValue;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the resolution of the sensor");
return _resolution;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the min interval for the sensor");
return _minInterval;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the fifo count of the sensor");
return _fifoCount;
}
}
{
get
{
+ Log.Info(Globals.LogTag, "Getting the max batch count of the sensor");
return _maxBatchCount;
}
}
{
set
{
+ Log.Info(Globals.LogTag, "Setting the interval of the sensor");
_interval = value;
SetInterval();
}
get
{
+ Log.Info(Globals.LogTag, "Getting the interval of the sensor");
return _interval;
}
}
{
set
{
+ Log.Info(Globals.LogTag, "Setting the max batch latency of the sensor");
_maxBatchLatency = value;
SetMaxBatchLatency();
}
get
{
+ Log.Info(Globals.LogTag, "Getting the max batch latency of the sensor");
return _maxBatchLatency;
}
}
{
set
{
+ Log.Info(Globals.LogTag, "Setting the pause policy of the sensor");
_pausePolicy = value;
SetPausePolicy();
}
get
{
+ Log.Info(Globals.LogTag, "Getting the pause policy of the sensor");
return _pausePolicy;
}
}
- public UInt64 Timestamp
+ public TimeSpan TimeSpan
{
set
{
- _timestamp = value;
+ Log.Info(Globals.LogTag, "Setting the timespan of the sensor values");
+ _timeSpan = value;
}
get
{
- return _timestamp;
+ Log.Info(Globals.LogTag, "Getting the timespan of the sensor values");
+ return _timeSpan;
}
}
- public bool Sensing
+ public bool IsSensing
{
get
{
- return _sensing;
+ Log.Info(Globals.LogTag, "Checking if the sensor is started");
+ return _isSensing;
}
}
/// </summary>
public void Start()
{
+ Log.Info(Globals.LogTag, "Starting the sensor");
if (CheckListenerHandle())
{
int error = Interop.SensorListener.StartListener(_listenerHandle);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error starting sensor");
throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Start Sensor Listener");
+ }
EventListenStart();
- _sensing = true;
+ _isSensing = true;
+ Log.Info(Globals.LogTag, "Sensor started");
}
}
/// </summary>
public void Stop()
{
- if (!_sensing)
+ Log.Info(Globals.LogTag, "Stopping the sensor");
+ if (_isSensing)
{
int error = Interop.SensorListener.StopListener(_listenerHandle);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error stopping the sensor");
throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Stop Sensor Listener");
+ }
EventListenStop();
- _sensing = false;
+ _isSensing = false;
+ Log.Info(Globals.LogTag, "Sensor stopped");
}
else
{
- throw new InvalidOperationException("Operation Failed: Sensor already stopped");
+ Log.Error(Globals.LogTag, "Can't stop sensor as it is already stopped");
+ throw new InvalidOperationException("Operation Failed: Sensor is already stopped");
}
}
IntPtr[] sensorList;
int count;
int error = Interop.SensorManager.GetSensorList(type, out list, out count);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.GetSensorList Failed");
+ }
sensorList = Interop.IntPtrToIntPtrArray(list, count);
_sensorHandle = sensorList[index];
Interop.Libc.Free(list);
private void GetProperty()
{
- int error = (int)SensorErrorFactory.SensorError.None;
+ int error = (int)SensorError.None;
error = Interop.Sensor.GetName(_sensorHandle, out _name);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor name");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Name Failed");
+ }
error = Interop.Sensor.GetVendor(_sensorHandle, out _vendor);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor vendor name");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Vendor Failed");
+ }
error = Interop.Sensor.GetMinRange(_sensorHandle, out _minValue);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor min value");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MinValue Failed");
+ }
error = Interop.Sensor.GetMaxRange(_sensorHandle, out _maxValue);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor max value");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MaxValue Failed");
+ }
error = Interop.Sensor.GetResolution(_sensorHandle, out _resolution);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor resolution");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Resolution Failed");
+ }
error = Interop.Sensor.GetMinInterval(_sensorHandle, out _minInterval);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor min interval");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MinInterval Failed");
+ }
error = Interop.Sensor.GetFifoCount(_sensorHandle, out _fifoCount);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor fifo count");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.FifoCount Failed");
+ }
error = Interop.Sensor.GetMaxBatchCount(_sensorHandle, out _maxBatchCount);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor max batch count");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MaxBatchCount Failed");
+ }
}
private void CreateListener()
{
int error = Interop.SensorListener.CreateListener(_sensorHandle, out _listenerHandle);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error cerating sensor listener handle");
throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.CreateListener Failed");
+ }
}
private void SetInterval()
{
if (CheckListenerHandle())
{
- int error = Interop.SensorListener.SetInterval(_listenerHandle, _interval);
- if (error != 0)
- throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.PausePolicy Failed");
+ if (_isSensing)
+ {
+ int error = Interop.SensorListener.SetInterval(_listenerHandle, _interval);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting sensor interval");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.SetInterval Failed");
+ }
+ }
}
}
if (CheckListenerHandle())
{
int error = Interop.SensorListener.SetMaxBatchLatency(_listenerHandle, _maxBatchLatency);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting max batch latency");
throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.MaxBatchLatency Failed");
+ }
}
}
if (CheckListenerHandle())
{
int error = Interop.SensorListener.SetAttribute(_listenerHandle, SensorAttribute.PausePolicy, (int)_pausePolicy);
- if (error != 0)
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting sensor pause policy");
throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.PausePolicy Failed");
+ }
}
}
}
else
{
+ Log.Error(Globals.LogTag, "Sensor listener handle is null");
throw new ArgumentException("Invalid Parameter: Sensor is null");
}
return result;
}
else
{
+ Log.Error(Globals.LogTag, "Sensor handle is null");
throw new ArgumentException("Invalid Parameter: Sensor is null");
}
return result;
/// <summary>
/// The SensorType Enum defintion for all sensor types.
/// </summary>
- public enum SensorType
+ internal enum SensorType
{
/// <summary>
/// All sensors. This can be used to retrieve Sensor class object for all available sensors.
/// <summary>
/// Geomagnetic-based rotation vector sensor.
/// </summary>
- MagnetometerRotationVectorSensor = 20
+ MagnetometerRotationVectorSensor = 20,
+ /// <summary>
+ /// Pedometer sensor.
+ /// </summary>
+ HumanPedometer = 0x300,
+ /// <summary>
+ /// Sleep monitor sensor.
+ /// </summary>
+ HumanSleepMonitor = 22
}
/// <summary>
AxisOrientation,
PausePolicy
}
+
+ public enum PedometerState
+ {
+ Unknown,
+ Stop,
+ Walk,
+ Run
+ }
+
+ public enum SleepMonitorState
+ {
+ Unknown,
+ Wake,
+ Sleep
+ }
+
+ public enum ProximitySensorState
+ {
+ Near = 0,
+ Far = 5
+ }
}
namespace Tizen.System.Sensor
{
- internal static class SensorErrorFactory
+ internal enum SensorError
{
- internal enum SensorError
- {
- None = ErrorCode.None,
- IOError = ErrorCode.IoError,
- InvalidParameter = ErrorCode.InvalidParameter,
- NotSupported = ErrorCode.NotSupported,
- PermissionDenied = ErrorCode.PermissionDenied,
- OutOfMemory = ErrorCode.OutOfMemory,
- NotNeedCalibration = -0x02440000 | 0x03,
- OperationFailed = -0x02440000 | 0x06
- }
+ None = ErrorCode.None,
+ IOError = ErrorCode.IoError,
+ InvalidParameter = ErrorCode.InvalidParameter,
+ NotSupported = ErrorCode.NotSupported,
+ PermissionDenied = ErrorCode.PermissionDenied,
+ OutOfMemory = ErrorCode.OutOfMemory,
+ NotNeedCalibration = -0x02440000 | 0x03,
+ OperationFailed = -0x02440000 | 0x06
+ }
+ internal static class SensorErrorFactory
+ {
static internal Exception CheckAndThrowException(int error, string msg)
{
SensorError e = (SensorError)error;
%define dllpath %{_libdir}/mono/tizen
-%define dllname Tizen.System.Sensor.dll
+%define dllname Tizen.System.dll
Name: csapi-system.sensor
Summary: Tizen Sensor API for C#