+++ /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.
-
-internal static partial class Interop
-{
- internal static partial class Libraries
- {
- public const string Sensor = "libcapi-system-sensor.so.0";
- public const string Libc = "libc.so.6";
- }
-}
\ 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;
-using System.Runtime.InteropServices;
-using Tizen.System.Sensor;
-
-internal static partial class Interop
-{
- internal static class Sensor
- {
- //Sensor Hardware CAPI
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_name")]
- internal static extern int GetName(IntPtr sensorhandle, out String name);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_vendor")]
- internal static extern int GetVendor(IntPtr sensorHandle, out String vendor);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_type")]
- internal static extern int GetType(IntPtr sensorHandle, out SensorType type);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_min_range")]
- internal static extern int GetMinRange(IntPtr sensorHandle, out float minRange);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_max_range")]
- internal static extern int GetMaxRange(IntPtr sensorHandle, out float maxRange);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_resolution")]
- internal static extern int GetResolution(IntPtr sensorHandle, out float resolution);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_min_interval")]
- internal static extern int GetMinInterval(IntPtr sensorHandle, out int minInterval);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_fifo_count")]
- internal static extern int GetFifoCount(IntPtr sensorHandle, out int fifoCount);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_max_batch_count")]
- internal static extern int GetMaxBatchCount(IntPtr sensorHandle, out int maxBatchCount);
- }
- internal static class SensorListener
- {
- //Sensor Listener CAPI
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SensorEventCallback(IntPtr sensorHandle, IntPtr eventData, IntPtr data);
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void SensorAccuracyCallback(IntPtr sensorHandle, ulong timestamp, SensorDataAccuracy accuracy, IntPtr data);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_create_listener")]
- internal static extern int CreateListener(IntPtr sensorHandle, out IntPtr listenerHandle);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_destroy_listener")]
- internal static extern int DestroyListener(IntPtr listenerHandle);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_start")]
- internal static extern int StartListener(IntPtr listenerHandle);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_stop")]
- internal static extern int StopListener(IntPtr listenerHandle);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_event_cb")]
- internal static extern int SetEventCallback(IntPtr listenerHandle, uint intervalMs, SensorEventCallback callback, IntPtr data);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_unset_event_cb")]
- internal static extern int UnsetEventCallback(IntPtr listernerHandle);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_accuracy_cb")]
- internal static extern int SetAccuracyCallback(IntPtr listenerHandle, uint intervalMs, SensorAccuracyCallback callback, IntPtr data);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_unset_accuracy_cb")]
- internal static extern int UnsetAccuracyCallback(IntPtr listernerHandle);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_interval")]
- internal static extern int SetInterval(IntPtr listenerHandle, uint intervalMs);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_max_batch_latency")]
- internal static extern int SetMaxBatchLatency(IntPtr listenerHandle, uint maxBatchLatency);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_attribute_int")]
- internal static extern int SetAttribute(IntPtr listenerHandle, SensorAttribute sensorAttribute, int option);
- }
-
- internal static class SensorManager
- {
- //Sensor Manager CAPI
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_is_supported")]
- internal static extern int SensorIsSupported(SensorType type, out bool supported);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_default_sensor")]
- internal static extern int GetDefaultSensor(SensorType type, out IntPtr sensor);
-
- [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_sensor_list")]
- internal static extern int GetSensorList(SensorType type, out IntPtr list, out int sensor_count);
- }
-
- internal static partial class Libc
- {
- [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)]
- internal static extern int Free(IntPtr ptr);
- }
-
- [StructLayout(LayoutKind.Sequential, Pack = 0)]
- internal struct SensorEventStruct
- {
- internal SensorDataAccuracy accuracy;
- internal UInt64 timestamp;
- internal int value_count;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
- internal float[] values;
- }
-
- internal static IntPtr[] IntPtrToIntPtrArray(IntPtr unmanagedArray, int size)
- {
- IntPtr[] managedArray = new IntPtr[size];
- Marshal.Copy(unmanagedArray, managedArray, 0, size);
- return managedArray;
- }
-
- internal static SensorEventStruct IntPtrToEventStruct(IntPtr unmanagedVariable)
- {
- SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure(unmanagedVariable, typeof(SensorEventStruct));
- return outStruct;
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("Tizen.System.Sensor")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Samsung Electronics")]
-[assembly: AssemblyProduct("Tizen.System.Sensor")]
-[assembly: AssemblyCopyright("Copyright (c) 2015 Samsung Electronics Co., Ltd")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.0.0")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProjectGuid>{15FBE509-20D4-4D66-A8FC-5B0AC807BB88}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>Tizen.System.Sensor</RootNamespace>\r
- <AssemblyName>Tizen.System.Sensor</AssemblyName>\r
- <FileAlignment>512</FileAlignment>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\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\Net45\</OutputPath>\r
- <DefineConstants>DEBUG;TRACE</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>pdbonly</DebugType>\r
- <Optimize>true</Optimize>\r
- <OutputPath>bin\Release\Net45\</OutputPath>\r
- <DefineConstants>TRACE</DefineConstants>\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
- <Reference Include="System.Core" />\r
- <Reference Include="System.Xml.Linq" />\r
- <Reference Include="System.Data.DataSetExtensions" />\r
- <Reference Include="Microsoft.CSharp" />\r
- <Reference Include="System.Data" />\r
- <Reference Include="System.Net.Http" />\r
- <Reference Include="System.Xml" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Compile Include="Properties\AssemblyInfo.cs" />\r
- <Compile Include="Interop\Interop.Sensor.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\FaceDownGestureDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\PickUpGestureDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\RunningActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\StationaryActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\InVehicleActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\WalkingActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\WristUpGestureDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\ActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\PickUpGestureDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\RunningActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\InVehicleActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\StationaryActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\WalkingActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\WristUpGestureDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\FaceDownGestureDetector.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
- <ItemGroup>\r
- <None Include="Tizen.System.Sensor.nuspec" />\r
- <None Include="Tizen.System.Sensor.Net45.project.json" />\r
- <None Include="Tizen.System.Sensor.snk" />\r
- </ItemGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
-</Project>
\ No newline at end of file
+++ /dev/null
-{
- "dependencies": {
- "Tizen": "1.0.1",
- "Tizen.System": "1.0.2"
- },
- "frameworks": {
- "net45": {}
- },
- "runtimes": {
- "win": {}
- }
-}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProjectGuid>{CB655C6A-F73B-448E-913C-CA4DCBC5E401}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>Tizen.System.Sensor</RootNamespace>\r
- <AssemblyName>Tizen.System.Sensor</AssemblyName>\r
- <FileAlignment>512</FileAlignment>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>\r
- <TargetFrameworkVersion>v1.3</TargetFrameworkVersion>\r
- <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>\r
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
- <NoStdLib>true</NoStdLib>\r
- <NoWarn>$(NoWarn);1701;1702</NoWarn>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <Optimize>false</Optimize>\r
- <OutputPath>bin\Debug\</OutputPath>\r
- <DefineConstants>DEBUG;TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- <ConsolePause>false</ConsolePause>\r
- <Prefer32Bit>false</Prefer32Bit>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <Optimize>true</Optimize>\r
- <OutputPath>bin\Release\</OutputPath>\r
- <DefineConstants>TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- <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
- <Compile Include="Properties\AssemblyInfo.cs" />\r
- <Compile Include="Interop\Interop.Sensor.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\FaceDownGestureDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\PickUpGestureDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\RunningActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\StationaryActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\InVehicleActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\WalkingActivityDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\EventArgs\WristUpGestureDetectorDataUpdatedEventArgs.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\ActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\PickUpGestureDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\RunningActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\InVehicleActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\StationaryActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\WalkingActivityDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\WristUpGestureDetector.cs" />\r
- <Compile Include="Tizen.System.Sensor\Plugins\FaceDownGestureDetector.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
- <ItemGroup>\r
- <None Include="Tizen.System.Sensor.nuspec" />\r
- <None Include="Tizen.System.Sensor.project.json" />\r
- <None Include="Tizen.System.Sensor.snk" />\r
- </ItemGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
- <PropertyGroup>\r
- <!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and\r
- https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild\r
- -->\r
- <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two\r
- properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and\r
- to prevent it from outputting a warning (MSB3644).\r
- -->\r
- <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>\r
- <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
- <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
- </PropertyGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<package>
- <metadata>
- <id>Tizen.System.Sensor</id>
- <version>$version$</version>
- <authors>Tizen Developers</authors>
- <description>Sensor API for Tizen.Net</description>
- <dependencies>
- <dependency id="Tizen" version="1.0.1" />
- </dependencies>
- </metadata>
- <files>
- <file src="bin/$Configuration$/Tizen.System.Sensor.dll" target="lib/netstandard1.3" />
- <file src="bin/$Configuration$/Net45/Tizen.System.Sensor.dll" target="lib/net45" />
- </files>
-</package>
+++ /dev/null
-{
- "dependencies": {
- "NETStandard.Library": "1.6.0",
- "Tizen": "1.0.1",
- "Tizen.System": "1.0.2"
- },
- "frameworks": {
- "netstandard1.3": {}
- }
-}
+++ /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>
- /// Accelerometer changed event arguments. Class for storing the data returned by accelerometer
- /// </summary>
- public class AccelerometerDataUpdatedEventArgs : EventArgs
- {
- internal AccelerometerDataUpdatedEventArgs(float[] values)
- {
- X = values[0];
- Y = values[1];
- Z = values[2];
- }
-
- /// <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; }
- }
-}
\ 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>
- /// FaceDownGestureDetector changed event arguments. Class for storing the data returned by face down gesture detector.
- /// </summary>
- public class FaceDownGestureDetectorDataUpdatedEventArgs : EventArgs
- {
- internal FaceDownGestureDetectorDataUpdatedEventArgs(float state)
- {
- FaceDown = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the face down state.
- /// </summary>
- public DetectorState FaceDown { get; private set; }
- }
-}
+++ /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"). 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>
- /// InVehicleActivityDetector changed event arguments. Class for storing the data returned by in-vehicle activity detector
- /// </summary>
- public class InVehicleActivityDetectorDataUpdatedEventArgs : EventArgs
- {
- internal InVehicleActivityDetectorDataUpdatedEventArgs(float state)
- {
- InVehicle = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the in-vehicle state.
- /// </summary>
- public DetectorState InVehicle { get; private set; }
- }
-}
+++ /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"). 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>
- /// PickUpGestureDetector changed event arguments. Class for storing the data returned by pick up gesture detector
- /// </summary>
- public class PickUpGestureDetectorDataUpdatedEventArgs : EventArgs
- {
- internal PickUpGestureDetectorDataUpdatedEventArgs(float state)
- {
- PickUp = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the pick up state.
- /// </summary>
- public DetectorState PickUp { get; private set; }
- }
-}
+++ /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
+++ /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>
- /// RunningActivityDetector changed event arguments. Class for storing the data returned by running activity detector
- /// </summary>
- public class RunningActivityDetectorDataUpdatedEventArgs : EventArgs
- {
- internal RunningActivityDetectorDataUpdatedEventArgs(float state)
- {
- Running = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the running state.
- /// </summary>
- public DetectorState Running { get; private set; }
- }
-}
+++ /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>
- /// Sensor accuracy changed event arguments Class. Contains the parameters to be returned through accuracy callback
- /// </summary>
- public class SensorAccuracyChangedEventArgs : EventArgs
- {
- internal SensorAccuracyChangedEventArgs(TimeSpan timespan, SensorDataAccuracy accuracy)
- {
- TimeSpan = timespan;
- Accuracy = accuracy;
- }
-
- /// <summary>
- /// Gets the time stamp.
- /// </summary>
- public TimeSpan TimeSpan { get; private set; }
-
- /// <summary>
- /// Gets the accuracy.
- /// </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>
- /// 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"). 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>
- /// StationaryActivityDetector changed event arguments. Class for storing the data returned by stationary activity detector
- /// </summary>
- public class StationaryActivityDetectorDataUpdatedEventArgs : EventArgs
- {
- internal StationaryActivityDetectorDataUpdatedEventArgs(float state)
- {
- Stationary = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the stationary state.
- /// </summary>
- public DetectorState Stationary { get; private set; }
- }
-}
+++ /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
+++ /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>
- /// WalkingActivityDetector changed event arguments. Class for storing the data returned by walking activity detector
- /// </summary>
- public class WalkingActivityDetectorDataUpdatedEventArgs : EventArgs
- {
- internal WalkingActivityDetectorDataUpdatedEventArgs(float state)
- {
- Walking = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the walking state.
- /// </summary>
- public DetectorState Walking { get; private set; }
- }
-}
+++ /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>
- /// WristUpGestureDetector changed event arguments. Class for storing the data returned by wrist up gesture detector
- /// </summary>
- public class WristUpGestureDetectorDataUpdatedEventArgs : EventArgs
- {
- internal WristUpGestureDetectorDataUpdatedEventArgs(float state)
- {
- WristUp = (DetectorState) state;
- }
-
- /// <summary>
- /// Gets the wrist up state.
- /// </summary>
- public DetectorState WristUp { get; private set; }
- }
-}
+++ /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>
- /// Accelerometer Sensor Class. Used for registering callbacks for accelerometer and getting accelerometer data
- /// /// </summary>
- public class Accelerometer : Sensor
- {
- private static string AccelerometerKey = "http://tizen.org/feature/sensor.accelerometer";
- /// <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 accelerometer sensor is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the Accelerometer sensor is supported");
- return CheckIfSupported(SensorType.Accelerometer, AccelerometerKey);
- }
- }
-
- /// <summary>
- /// Returns the number of accelerometer sensors available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of accelerometer sensors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.Accelerometer"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular accelerometer sensor in case of multiple sensors
- /// </param>
- public Accelerometer(int index = 0) : base(index)
- {
- Log.Info(Globals.LogTag, "Creating Accelerometer object");
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.Accelerometer;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in accelerometer sensor data.
- /// </summary>
-
- public event EventHandler<AccelerometerDataUpdatedEventArgs> DataUpdated;
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.Accelerometer, out list, out count);
- 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 != (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 != (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);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- X = sensorData.values[0];
- Y = sensorData.values[1];
- Z = sensorData.values[2];
-
- DataUpdated?.Invoke(this, new AccelerometerDataUpdatedEventArgs(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
-{
- public abstract class ActivityDetector : Sensor
- {
- protected const int ActivityAttribute = (((int)SensorType.InVehicleActivityDetector << 8) | 0x80 | 0x1);
-
- protected enum ActivityType
- {
- Unknown = 1,
- Stationary = 2,
- Walking = 4,
- Running = 8,
- InVehicle = 16,
- OnBicycle = 32,
- };
-
- /// <summary>
- /// Gets the activity accuracy of activity detector
- /// </summary>
- public SensorDataAccuracy ActivityAccuracy { get; protected set; }
-
- protected abstract void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data);
-
- internal ActivityDetector(int index) : base(index)
- {
- }
-
- 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 activity detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for activity detector");
- }
- }
-
- protected override void EventListenStop()
- {
- int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error unsetting event callback for activity detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for activity detector");
- }
- }
- }
-}
+++ /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>
- /// FaceDownGestureDetector Class. Used for registering callbacks for face down gesture detector and getting the face down state
- /// </summary>
- public class FaceDownGestureDetector : Sensor
- {
- private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition";
-
- /// <summary>
- /// Gets the state of the face down gesture.
- /// </summary>
- public DetectorState FaceDown { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether face down gesture detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the face down gesture detector is supported");
- return CheckIfSupported(SensorType.FaceDownGestureDetector, GestureDetectorKey);
- }
- }
-
- /// <summary>
- /// Returns the number of face down gesture detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of face down gesture detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.FaceDownGestureDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular face down gesture detector in case of multiple sensors.
- /// </param>
- public FaceDownGestureDetector(int index = 0) : base(index)
- {
- Log.Info(Globals.LogTag, "Creating face down gesture detector object");
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.FaceDownGestureDetector;
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.FaceDownGestureDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for face down gesture detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in face down gesture detector data.
- /// </summary>
- public event EventHandler<FaceDownGestureDetectorDataUpdatedEventArgs> DataUpdated;
-
- 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 face down gesture detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for face down gesture detector");
- }
- }
-
- protected override void EventListenStop()
- {
- int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error unsetting event callback for face down gesture detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for face down gesture detector");
- }
- }
-
- private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- FaceDown = (DetectorState) sensorData.values[0];
-
- DataUpdated?.Invoke(this, new FaceDownGestureDetectorDataUpdatedEventArgs(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>
- /// GravitySensor Class. Used for registering callbacks for gravity sensor and getting gravity data
- /// /// </summary>
- public class GravitySensor : Sensor
- {
- private const string GravitySensorKey = "http://tizen.org/feature/sensor.gravity";
-
- 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(SensorType.GravitySensor, GravitySensorKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
- {
- add
- {
- if (_accuracyChanged == null)
- {
- AccuracyListenStart();
- }
- _accuracyChanged += value;
- }
- remove
- {
- _accuracyChanged -= value;
- if (_accuracyChanged == null)
- {
- AccuracyListenStop();
- }
- }
- }
-
- 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
- {
- private const string GyroscopeKey = "http://tizen.org/feature/sensor.gyroscope";
-
- /// <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(SensorType.Gyroscope, GyroscopeKey);
- }
- }
-
- /// <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 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
- {
- private const string GyroscopeRVKey = "http://tizen.org/feature/sensor.gyroscope_rotation_vector";
-
- /// <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(SensorType.GyroscopeRotationVectorSensor, GyroscopeRVKey);
- }
- }
-
- /// <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 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
- {
- private const string HRMKey = "http://tizen.org/feature/sensor.heart_rate_monitor";
-
- /// <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(SensorType.HeartRateMonitor, HRMKey);
- }
- }
-
- /// <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 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
- {
- private const string HumiditySensorKey = "http://tizen.org/feature/sensor.humidity";
-
- /// <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(SensorType.HumiditySensor, HumiditySensorKey);
- }
- }
-
- /// <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 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>
- /// InVehicleActivityDetector Class. Used for registering callbacks for in vehicle activity detector and getting the in vehicle state
- /// </summary>
- public class InVehicleActivityDetector : ActivityDetector
- {
- private const string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
-
- /// <summary>
- /// Gets the state of in-vehicle activity detector
- /// </summary>
- public DetectorState InVehicle { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether in-vehicle activity detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the in-vehicle activity detector is supported");
- return CheckIfSupported(SensorType.InVehicleActivityDetector, ActivityDetectorKey);
- }
- }
-
- /// <summary>
- /// Returns the number of in-vehicle activity detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of in-vehicle activity detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.InVehicleActivityDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular in-vehicle activity detector in case of multiple sensors.
- /// </param>
- public InVehicleActivityDetector(int index = 0) : base(index)
- {
- SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.InVehicle);
- Log.Info(Globals.LogTag, "Creating in-vehicle activity detector object");
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.InVehicleActivityDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for in-vehicle activity detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in in-vehicle activity detector data.
- /// </summary>
- public event EventHandler<InVehicleActivityDetectorDataUpdatedEventArgs> DataUpdated;
-
- protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- InVehicle = (DetectorState)sensorData.values[0];
- ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
-
- DataUpdated?.Invoke(this, new InVehicleActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.InVehicleActivityDetector;
- }
- }
-}
+++ /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
- {
- private const string LightSensorKey = "http://tizen.org/feature/sensor.photometer";
-
- /// <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(SensorType.LightSensor, LightSensorKey);
- }
- }
-
- /// <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 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 const string LinearAccelerationSensorKey = "http://tizen.org/feature/sensor.linear_acceleration";
-
- 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(SensorType.LinearAccelerationSensor, LinearAccelerationSensorKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
- {
- add
- {
- if (_accuracyChanged == null)
- {
- AccuracyListenStart();
- }
- _accuracyChanged += value;
- }
- remove
- {
- _accuracyChanged -= value;
- if (_accuracyChanged == null)
- {
- AccuracyListenStop();
- }
- }
- }
-
- 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 static string MagnetometerKey = "http://tizen.org/feature/sensor.magnetometer";
-
- 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(SensorType.Magnetometer, MagnetometerKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
- {
- add
- {
- if (_accuracyChanged == null)
- {
- AccuracyListenStart();
- }
- _accuracyChanged += value;
- }
- remove
- {
- _accuracyChanged -= value;
- if (_accuracyChanged == null)
- {
- AccuracyListenStop();
- }
- }
- }
-
- 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 static string MagnetometerRVKey = "http://tizen.org/feature/sensor.geomagnetic_rotation_vector";
-
- 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(SensorType.MagnetometerRotationVectorSensor, MagnetometerRVKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- 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 static string OrientationSensorKey = "http://tizen.org/feature/sensor.tiltmeter";
-
- 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(SensorType.OrientationSensor, OrientationSensorKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
- {
- add
- {
- if (_accuracyChanged == null)
- {
- AccuracyListenStart();
- }
- _accuracyChanged += value;
- }
- remove
- {
- _accuracyChanged -= value;
- if (_accuracyChanged == null)
- {
- AccuracyListenStop();
- }
- }
- }
-
- 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
- {
- private static string PedometerKey = "http://tizen.org/feature/sensor.pedometer";
-
- /// <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(SensorType.Pedometer, PedometerKey);
- }
- }
-
- /// <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.Pedometer;
- }
-
- /// <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 int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.Pedometer, 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>
- /// PickUpGestureDetector Class. Used for registering callbacks for pick up activity detector and getting the pick up state
- /// </summary>
- public class PickUpGestureDetector : Sensor
- {
- private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition";
-
- /// <summary>
- /// Gets the state of the pick up gesture.
- /// </summary>
- public DetectorState PickUp { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether pick up gesture detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the pick up gesture detector is supported");
- return CheckIfSupported(SensorType.PickUpGestureDetector, GestureDetectorKey);
- }
- }
-
- /// <summary>
- /// Returns the number of pick up gesture detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of pick up gesture detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.PickUpGestureDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular pick up gesture detector in case of multiple sensors.
- /// </param>
- public PickUpGestureDetector(int index = 0) : base(index)
- {
- Log.Info(Globals.LogTag, "Creating pick up gesture detector object");
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.PickUpGestureDetector;
- }
-
- private static bool CheckIfSupported()
- {
- bool isSupported;
- int error = Interop.SensorManager.SensorIsSupported(SensorType.PickUpGestureDetector, out isSupported);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error checking if pick up gesture detector is supported");
- isSupported = false;
- }
- return isSupported;
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.PickUpGestureDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for pick up gesture detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in pick up gesture detector data.
- /// </summary>
- public event EventHandler<PickUpGestureDetectorDataUpdatedEventArgs> DataUpdated;
-
- 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 pick up gesture detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pick up gesture detector");
- }
- }
-
- protected override void EventListenStop()
- {
- int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error unsetting event callback for pick up gesture detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pick up gesture detector");
- }
- }
-
- private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- PickUp = (DetectorState) sensorData.values[0];
-
- DataUpdated?.Invoke(this, new PickUpGestureDetectorDataUpdatedEventArgs(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>
- /// PressureSensor Class. Used for registering callbacks for pressure sensor and getting pressure data
- /// /// </summary>
- public class PressureSensor : Sensor
- {
- private static string PressureSensorKey = "http://tizen.org/feature/sensor.barometer";
-
- /// <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(SensorType.PressureSensor, PressureSensorKey);
- }
- }
-
- /// <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 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
- {
- private static string ProximitySensorKey = "http://tizen.org/feature/sensor.proximity";
-
- /// <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(SensorType.ProximitySensor, ProximitySensorKey);
- }
- }
-
- /// <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 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 static string RotationVectorKey = "http://tizen.org/feature/sensor.rotation_vector";
-
- 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(SensorType.RotationVectorSensor, RotationVectorKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
- {
- add
- {
- if (_accuracyChanged == null)
- {
- AccuracyListenStart();
- }
- _accuracyChanged += value;
- }
- remove
- {
- _accuracyChanged -= value;
- if (_accuracyChanged == null)
- {
- AccuracyListenStop();
- }
- }
- }
-
- 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>
- /// RunningActivityDetector Class. Used for registering callbacks for running activity detector and getting the running state
- /// </summary>
- public class RunningActivityDetector : ActivityDetector
- {
- private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
-
- /// <summary>
- /// Gets the state of running activity detector
- /// </summary>
- public DetectorState Running { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether running activity detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the running activity detector is supported");
- return CheckIfSupported(SensorType.RunningActivityDetector, ActivityDetectorKey);
- }
- }
-
- /// <summary>
- /// Returns the number of running activity detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of running activity detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.RunningActivityDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular running activity detector in case of multiple sensors.
- /// </param>
- public RunningActivityDetector(int index = 0) : base(index)
- {
- SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Running);
- Log.Info(Globals.LogTag, "Creating running activity detector object");
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.RunningActivityDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for running activity detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in running activity detector data.
- /// </summary>
- public event EventHandler<RunningActivityDetectorDataUpdatedEventArgs> DataUpdated;
-
- protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- Running = (DetectorState)sensorData.values[0];
- ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
-
- DataUpdated?.Invoke(this, new RunningActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.RunningActivityDetector;
- }
- }
-}
+++ /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
- {
- private static string SleepMonitorKey = "http://tizen.org/feature/sensor.sleep_monitor";
-
- /// <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(SensorType.SleepMonitor, SleepMonitorKey);
- }
- }
-
- /// <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.SleepMonitor;
- }
-
- /// <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 int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.SleepMonitor, 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>
- /// StationaryActivityDetector Class. Used for registering callbacks for stationary activity detector and getting the stationary state
- /// </summary>
- public class StationaryActivityDetector : ActivityDetector
- {
- private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
-
- /// <summary>
- /// Gets the state of stationary activity detector
- /// </summary>
- public DetectorState Stationary { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether stationary activity detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the stationary activity detector is supported");
- return CheckIfSupported(SensorType.StationaryActivityDetector, ActivityDetectorKey);
- }
- }
-
- /// <summary>
- /// Returns the number of stationary activity detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of stationary activity detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.stationaryActivityDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular stationary activity detector in case of multiple sensors.
- /// </param>
- public StationaryActivityDetector(int index = 0) : base(index)
- {
- SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Stationary);
- Log.Info(Globals.LogTag, "Creating stationary activity detector object");
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.StationaryActivityDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for stationary activity detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in stationary activity detector data.
- /// </summary>
- public event EventHandler<StationaryActivityDetectorDataUpdatedEventArgs> DataUpdated;
-
- protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- Stationary = (DetectorState)sensorData.values[0];
- ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
-
- DataUpdated?.Invoke(this, new StationaryActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.StationaryActivityDetector;
- }
- }
-}
+++ /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
- {
- private static string TemperatureSensorKey = "http://tizen.org/feature/sensor.temperature";
-
- /// <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(SensorType.TemperatureSensor, TemperatureSensorKey);
- }
- }
-
- /// <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 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
- {
- private static string UltravioletSensorKey = "http://tizen.org/feature/sensor.ultraviolet";
-
- /// <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(SensorType.UltravioletSensor, UltravioletSensorKey);
- }
- }
-
- /// <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 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
- {
- private static string UncalibratedGyroscopeKey = "http://tizen.org/feature/sensor.gyroscope.uncalibrated";
-
- /// <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(SensorType.UncalibratedGyroscope, UncalibratedGyroscopeKey);
- }
- }
-
- /// <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 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 static string UncalibratedMagnetometerKey = "http://tizen.org/feature/sensor.magnetometer.uncalibrated";
-
- 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(SensorType.UncalibratedMagnetometer, UncalibratedMagnetometerKey);
- }
- }
-
- /// <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;
-
- /// <summary>
- /// Event handler for accuracy changed events.
- /// </summary>
- public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
- {
- add
- {
- if (_accuracyChanged == null)
- {
- AccuracyListenStart();
- }
- _accuracyChanged += value;
- }
- remove
- {
- _accuracyChanged -= value;
- if (_accuracyChanged == null)
- {
- AccuracyListenStop();
- }
- }
- }
-
- 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));
- }
- }
-}
+++ /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>
- /// WalkingActivityDetector Class. Used for registering callbacks for walking activity detector and getting the walking state
- /// </summary>
- public class WalkingActivityDetector : ActivityDetector
- {
- private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
-
- /// <summary>
- /// Gets the state of walking activity detector
- /// </summary>
- public DetectorState Walking { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether walking activity detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the walking activity detector is supported");
- return CheckIfSupported(SensorType.WalkingActivityDetector, ActivityDetectorKey);
- }
- }
-
- /// <summary>
- /// Returns the number of walking activity detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of walking activity detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.walkingActivityDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular walking activity detector in case of multiple sensors.
- /// </param>
- public WalkingActivityDetector(int index = 0) : base(index)
- {
- SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Walking);
- Log.Info(Globals.LogTag, "Creating walking activity gesture detector object");
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.WalkingActivityDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for walking activity detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in walking activity gesture detector data.
- /// </summary>
- public event EventHandler<WalkingActivityDetectorDataUpdatedEventArgs> DataUpdated;
-
- protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- Walking = (DetectorState)sensorData.values[0];
- ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
-
- DataUpdated?.Invoke(this, new WalkingActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.WalkingActivityDetector;
- }
- }
-}
+++ /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>
- /// WristUpGestureDetector Class. Used for registering callbacks for wrist up gesture detector and getting the wrist up state
- /// </summary>
- public class WristUpGestureDetector : Sensor
- {
- private static string WristUpKey = "http://tizen.org/feature/sensor.wrist_up";
-
- /// <summary>
- /// Gets the state of the wrist up gesture.
- /// </summary>
- public DetectorState WristUp { get; private set; }
-
- /// <summary>
- /// Returns true or false based on whether wrist up gesture detector is supported by device.
- /// </summary>
- public static bool IsSupported
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the wrist up gesture detector is supported");
- return CheckIfSupported(SensorType.WristUpGestureDetector, WristUpKey);
- }
- }
-
- /// <summary>
- /// Returns the number of wrist up gesture detector available on the device.
- /// </summary>
- public static int Count
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the count of wrist up gesture detectors");
- return GetCount();
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Tizen.System.Sensor.WristUpGestureDetector"/> class.
- /// </summary>
- /// <param name='index'>
- /// Index. Default value for this is 0. Index refers to a particular wrist up gesture detector in case of multiple sensors.
- /// </param>
- public WristUpGestureDetector(int index = 0) : base(index)
- {
- Log.Info(Globals.LogTag, "Creating wrist up gesture detector object");
- }
-
- internal override SensorType GetSensorType()
- {
- return SensorType.WristUpGestureDetector;
- }
-
- private static int GetCount()
- {
- IntPtr list;
- int count;
- int error = Interop.SensorManager.GetSensorList(SensorType.WristUpGestureDetector, out list, out count);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error getting sensor list for wrist up gesture detector");
- count = 0;
- }
- else
- Interop.Libc.Free(list);
- return count;
- }
-
- /// <summary>
- /// Event Handler for storing the callback functions for event corresponding to change in wrist up gesture detector data.
- /// </summary>
- public event EventHandler<WristUpGestureDetectorDataUpdatedEventArgs> DataUpdated;
-
- 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 wrist up gesture detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for wrist up gesture detector");
- }
- }
-
- protected override void EventListenStop()
- {
- int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error unsetting event callback for wrist up gesture detector");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for wrist up gesture detector");
- }
- }
-
- private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
- {
- Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
- TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
- WristUp = (DetectorState) sensorData.values[0];
-
- DataUpdated?.Invoke(this, new WristUpGestureDetectorDataUpdatedEventArgs(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;
-using Tizen.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>
- public abstract class Sensor : IDisposable
- {
- private string _name;
- private string _vendor;
- private float _minValue;
- private float _maxValue;
- private float _resolution;
- private int _minInterval;
- private int _fifoCount;
- private int _maxBatchCount;
- private bool _isSensing = false;
- private bool _disposed = false;
- 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;
-
- internal abstract SensorType GetSensorType();
- protected abstract void EventListenStart();
- protected abstract void EventListenStop();
-
- internal Sensor(int index)
- {
- SensorType type = GetSensorType();
- GetHandleList(type, index);
- if (CheckSensorHandle())
- {
- CreateListener();
- GetProperty();
- }
- }
-
- ~Sensor()
- {
- Dispose(false);
- }
-
- /// <summary>
- /// Property: For getting the name of the sensor
- /// </summary>
- public string Name
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the sensor name");
- return _name;
- }
- }
-
- /// <summary>
- /// Property: Gets the vendor.
- /// </summary>
- public string Vendor
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the sensor vendor name");
- return _vendor;
- }
- }
-
- /// <summary>
- /// Property: Gets the minimum value of range of sensor data.
- /// </summary>
- public float MinValue
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the min value of the sensor");
- return _minValue;
- }
- }
-
- /// <summary>
- /// Property: Gets the maximum value of range of sensor data.
- /// </summary>
- public float MaxValue
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the max value of the sensor");
- return _maxValue;
- }
- }
-
- /// <summary>
- /// Property: Gets the resolution.
- /// </summary>
- public float Resolution
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the resolution of the sensor");
- return _resolution;
- }
- }
-
- /// <summary>
- /// Property: Gets the minimum interval.
- /// </summary>
- public int MinInterval
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the min interval for the sensor");
- return _minInterval;
- }
- }
-
- /// <summary>
- /// Property: Gets the fifo count.
- /// </summary>
- public int FifoCount
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the fifo count of the sensor");
- return _fifoCount;
- }
- }
-
- /// <summary>
- /// Property: Gets the maximum batch count.
- /// </summary>
- public int MaxBatchCount
- {
- get
- {
- Log.Info(Globals.LogTag, "Getting the max batch count of the sensor");
- return _maxBatchCount;
- }
- }
-
- /// <summary>
- /// Sets the interval of the sensor for sensor data event
- /// Callbacks will be called at frequency of this interval
- /// </summary>
- public uint Interval
- {
- 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;
- }
- }
-
- /// <summary>
- /// Sets the max batch latency for the sensor corresponding to the sensor data event.
- /// </summary>
- public uint MaxBatchLatency
- {
- 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;
- }
- }
-
- /// <summary>
- /// Sets the pause policy of the sensor.
- /// </summary>
- /// <value>
- public SensorPausePolicy PausePolicy
- {
- set
- {
- Log.Info(Globals.LogTag, "Setting the pause policy of the sensor");
- _pausePolicy = value;
- SetAttribute(SensorAttribute.PausePolicy, (int)_pausePolicy);
- }
- get
- {
- Log.Info(Globals.LogTag, "Getting the pause policy of the sensor");
- return _pausePolicy;
- }
- }
-
- /// <summary>
- /// Gets or sets the time span.
- /// </summary>
- /// <value>The time span.</value>
- public TimeSpan TimeSpan
- {
- set
- {
- Log.Info(Globals.LogTag, "Setting the timespan of the sensor values");
- _timeSpan = value;
- }
- get
- {
- Log.Info(Globals.LogTag, "Getting the timespan of the sensor values");
- return _timeSpan;
- }
- }
-
- /// <summary>
- /// Indicates whether this sensor is sensing.
- /// </summary>
- /// <value><c>true</c> if this sensor is sensing; otherwise, <c>false</c>.</value>
- public bool IsSensing
- {
- get
- {
- Log.Info(Globals.LogTag, "Checking if the sensor is started");
- return _isSensing;
- }
- }
-
- internal IntPtr ListenerHandle
- {
- get
- {
- return _listenerHandle;
- }
- }
-
- internal static bool CheckIfSupported(SensorType type, String key)
- {
- bool isSupported = false;
- bool error = SystemInfo.TryGetValue(key, out isSupported);
-
- if (!error || !isSupported)
- {
- Log.Error(Globals.LogTag, "Error checking if sensor is supported(systeminfo)");
- return false;
- }
-
- int ret = Interop.SensorManager.SensorIsSupported(type, out isSupported);
- if (ret != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error checking if sensor is supported");
- isSupported = false;
- }
-
- return isSupported;
- }
-
- /// <summary>
- /// Starts the sensor.
- /// After this the event handlers will start receiving events.
- /// </summary>
- public void Start()
- {
- Log.Info(Globals.LogTag, "Starting the sensor");
- if (CheckListenerHandle())
- {
- int error = Interop.SensorListener.StartListener(_listenerHandle);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error starting sensor");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Start Sensor Listener");
- }
- EventListenStart();
- _isSensing = true;
- Log.Info(Globals.LogTag, "Sensor started");
- }
- }
-
- /// <summary>
- /// Stop the sensor.
- /// After this the event handlers will stop receiving the events
- /// </summary>
- public void Stop()
- {
- Log.Info(Globals.LogTag, "Stopping the sensor");
- if (_isSensing)
- {
- int error = Interop.SensorListener.StopListener(_listenerHandle);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error stopping the sensor");
- throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Stop Sensor Listener");
- }
- EventListenStop();
- _isSensing = false;
- Log.Info(Globals.LogTag, "Sensor stopped");
- }
- else
- {
- Log.Error(Globals.LogTag, "Can't stop sensor as it is already stopped");
- throw new InvalidOperationException("Operation Failed: Sensor is already stopped");
- }
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (_disposed)
- return;
-
- DestroyHandles();
- _disposed = true;
- }
-
- protected void SetAttribute(SensorAttribute attribute, int option)
- {
- if (CheckListenerHandle())
- {
- int error = Interop.SensorListener.SetAttribute(_listenerHandle, attribute, option);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error setting sensor pause policy");
- throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.PausePolicy Failed");
- }
- }
- }
-
- private void GetHandleList(SensorType type, int index)
- {
- IntPtr list;
- IntPtr[] sensorList;
- int count;
- int error = Interop.SensorManager.GetSensorList(type, out list, out count);
- 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)SensorError.None;
-
- error = Interop.Sensor.GetName(_sensorHandle, out _name);
- 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 != (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 != (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 != (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 != (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 != (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 != (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 != (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 != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error cerating sensor listener handle");
- throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.CreateListener Failed");
- }
- }
-
- private void SetInterval()
- {
- if (CheckListenerHandle())
- {
- 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");
- }
- }
- }
- }
-
- private void SetMaxBatchLatency()
- {
- if (CheckListenerHandle())
- {
- int error = Interop.SensorListener.SetMaxBatchLatency(_listenerHandle, _maxBatchLatency);
- if (error != (int)SensorError.None)
- {
- Log.Error(Globals.LogTag, "Error setting max batch latency");
- throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.MaxBatchLatency Failed");
- }
- }
- }
-
- private bool CheckListenerHandle()
- {
- bool result = false;
- if (_listenerHandle != IntPtr.Zero)
- {
- result = true;
- }
- else
- {
- Log.Error(Globals.LogTag, "Sensor listener handle is null");
- throw new ArgumentException("Invalid Parameter: Sensor is null");
- }
- return result;
- }
-
- private bool CheckSensorHandle()
- {
- bool result = false;
- if (_sensorHandle != IntPtr.Zero)
- {
- result = true;
- }
- else
- {
- Log.Error(Globals.LogTag, "Sensor handle is null");
- throw new ArgumentException("Invalid Parameter: Sensor is null");
- }
- return result;
- }
-
- private void DestroyHandles()
- {
- Interop.SensorListener.DestroyListener(_listenerHandle);
- }
- }
-}
+++ /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>
- /// The SensorType Enum defintion for all sensor types.
- /// </summary>
- internal enum SensorType
- {
- /// <summary>
- /// All sensors. This can be used to retrieve Sensor class object for all available sensors.
- /// </summary>
- All = -1,
- /// <summary>
- /// Accelerometer sensor.
- /// </summary>
- Accelerometer = 0,
- /// <summary>
- /// Gravity sensor.
- /// </summary>
- GravitySensor = 1,
- /// <summary>
- /// Linear Acceleration sensor.
- /// </summary>
- LinearAccelerationSensor = 2,
- /// <summary>
- /// Magnetometer sensor.
- /// </summary>
- Magnetometer = 3,
- /// <summary>
- /// Rotation Vector sensor.
- /// </summary>
- RotationVectorSensor = 4,
- /// <summary>
- /// Orientation sensor.
- /// </summary>
- OrientationSensor = 5,
- /// <summary>
- /// Gyroscope sensor.
- /// </summary>
- Gyroscope = 6,
- /// <summary>
- /// Light sensor.
- /// </summary>
- LightSensor = 7,
- /// <summary>
- /// Proximity sensor.
- /// </summary>
- ProximitySensor = 8,
- /// <summary>
- /// Pressure sensor.
- /// </summary>
- PressureSensor = 9,
- /// <summary>
- /// Ultraviolet sensor.
- /// </summary>
- UltravioletSensor = 10,
- /// <summary>
- /// Temperature sensor.
- /// </summary>
- TemperatureSensor = 11,
- /// <summary>
- /// Humidity sensor.
- /// </summary>
- HumiditySensor = 12,
- /// <summary>
- /// Hear rate monitor sensor.
- /// </summary>
- HeartRateMonitor = 13,
- /// <summary>
- /// Uncalibrated Gyroscope sensor.
- /// </summary>
- UncalibratedGyroscope = 17,
- /// <summary>
- /// Uncalibrated Geomagnetic sensor.
- /// </summary>
- UncalibratedMagnetometer = 18,
- /// <summary>
- /// Gyroscope-based rotation vector sensor.
- /// </summary>
- GyroscopeRotationVectorSensor = 19,
- /// <summary>
- /// Geomagnetic-based rotation vector sensor.
- /// </summary>
- MagnetometerRotationVectorSensor = 20,
- /// <summary>
- /// Pedometer sensor.
- /// </summary>
- Pedometer = 0x300,
- /// <summary>
- /// Sleep monitor sensor.
- /// </summary>
- SleepMonitor = 0x301,
- /// <summary>
- /// Walking activity detector.
- /// </summary>
- WalkingActivityDetector = 0x1A00,
- /// <summary>
- /// Running activity detector.
- /// </summary>
- RunningActivityDetector = 0x1A00,
- /// <summary>
- /// Stationary activity detector.
- /// </summary>
- StationaryActivityDetector = 0x1A00,
- /// <summary>
- /// InVehicle activity detector.
- /// </summary>
- InVehicleActivityDetector = 0x1A00,
- /// <summary>
- /// Wrist up gesture detector.
- /// </summary>
- WristUpGestureDetector = 0x1201,
- /// <summary>
- /// Pick up gesture detector.
- /// </summary>
- PickUpGestureDetector = 0x1204,
- /// <summary>
- /// Face down gesture detector.
- /// </summary>
- FaceDownGestureDetector = 0x1205
- }
-
- /// <summary>
- /// SensorDataAccuracy Enum definition for all possible sensor data accuracy Values.
- /// </summary>
- public enum SensorDataAccuracy
- {
- /// <summary>
- /// Undefined sensor data accuracy.
- /// </summary>
- Undefined = -1,
- /// <summary>
- /// Sensor data not accurate.
- /// </summary>
- Bad = 0,
- /// <summary>
- /// Moderately accurate sensor data.
- /// </summary>
- Normal = 1,
- /// <summary>
- /// Highly accurate sensor data.
- /// </summary>
- Good = 2,
- /// <summary>
- /// Very highly accurate sensor data.
- /// </summary>
- VeryGood = 3
- }
-
- /// <summary>
- /// Sensor Option Enum definition for sensor option Values
- /// </summary>
- public enum SensorPausePolicy
- {
- /// <summary>
- /// Does not receive data when the LCD is off and in the power save mode.
- /// </summary>
- None,
- /// <summary>
- /// Receives data when the LCD is off.
- /// </summary>
- DisplayOff,
- /// <summary>
- /// Receives data in the power save mode.
- /// </summary>
- PowerSaveMode,
- /// <summary>
- /// Receives data when the LCD is off and in the power save mode.
- /// </summary>
- All
- }
-
- /// <summary>
- /// Sensor attribute.
- /// </summary>
- public enum SensorAttribute
- {
- /// <summary>
- /// The axis orientation.
- /// </summary>
- AxisOrientation,
-
- /// <summary>
- /// The pause policy.
- /// </summary>
- PausePolicy
- }
-
- /// <summary>
- /// Pedometer state.
- /// </summary>
- public enum PedometerState
- {
- /// <summary>
- /// Unknown.
- /// </summary>
- Unknown,
-
- /// <summary>
- /// Stop state.
- /// </summary>
- Stop,
-
- /// <summary>
- /// Walking state.
- /// </summary>
- Walk,
-
- /// <summary>
- /// Running state.
- /// </summary>
- Run
- }
-
- /// <summary>
- /// Sleep monitor state.
- /// </summary>
- public enum SleepMonitorState
- {
- /// <summary>
- /// Unknown.
- /// </summary>
- Unknown,
-
- /// <summary>
- /// The wake state.
- /// </summary>
- Wake,
-
- /// <summary>
- /// The sleeping state.
- /// </summary>
- Sleep
- }
-
- /// <summary>
- /// Proximity sensor state.
- /// </summary>
- public enum ProximitySensorState
- {
- /// <summary>
- /// Near sate.
- /// </summary>
- Near = 0,
-
- /// <summary>
- /// Far state.
- /// </summary>
- Far = 5
- }
-
- /// <summary>
- /// Detector sensor state.
- /// </summary>
- public enum DetectorState
- {
- /// <summary>
- /// None sate.
- /// </summary>
- NotDetected = 0,
-
- /// <summary>
- /// Detected state.
- /// </summary>
- Detected = 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;
-using Tizen.Internals.Errors;
-
-namespace Tizen.System.Sensor
-{
- 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
- }
-
- internal static class SensorErrorFactory
- {
- static internal Exception CheckAndThrowException(int error, string msg)
- {
- SensorError e = (SensorError)error;
- switch (e)
- {
- case SensorError.None:
- return null;
- case SensorError.IOError:
- return new InvalidOperationException("I/O Error: " + msg);
- case SensorError.InvalidParameter:
- return new ArgumentException("Invalid Parameter: " + msg);
- case SensorError.NotSupported:
- return new InvalidOperationException("Not Supported: " + msg);
- case SensorError.PermissionDenied:
- return new InvalidOperationException("Permission Denied: " + msg);
- case SensorError.OutOfMemory:
- return new InvalidOperationException("Out of Memory: " + msg);
- case SensorError.NotNeedCalibration:
- return new InvalidOperationException("Sensor doesn't need calibration: " + msg);
- case SensorError.OperationFailed:
- return new InvalidOperationException("Operation Failed: " + msg);
- default:
- return new InvalidOperationException("Unknown Error Code: " + msg);
- }
- }
- }
-}
\ No newline at end of file
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+%{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework}
+
+%if 0%{?tizen_build_devel_mode}
+%define BUILDCONF Debug
+%else
+%define BUILDCONF Release
+%endif
+
+Name: csapi-sensor
+Summary: Tizen Sensor API for C#
+Version: 1.0.1
+Release: 1
+Group: Development/Libraries
+License: Apache-2.0
+URL: https://www.tizen.org
+Source0: %{name}-%{version}.tar.gz
+Source1: %{name}.manifest
+
+AutoReqProv: no
+
+BuildRequires: mono-compiler
+BuildRequires: mono-devel
+
+BuildRequires: dotnet-build-tools
+
+# C# API Requries
+BuildRequires: csapi-tizen-nuget
+BuildRequires: csapi-system-nuget
+
+%description
+Tizen Sensor API for C#
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+%define Assemblies Tizen.Sensor
+
+%build
+for ASM in %{Assemblies}; do
+# NuGet Restore
+find $ASM/*.project.json -exec nuget restore {} \;
+# Build
+find $ASM/*.csproj -exec xbuild {} /p:Configuration=%{BUILDCONF} \;
+# NuGet Pack
+nuget pack $ASM/$ASM.nuspec -Version %{version} -Properties Configuration=%{BUILDCONF}
+done
+
+%install
+# Runtime Binary
+mkdir -p %{buildroot}%{dotnet_assembly_path}
+for ASM in %{Assemblies}; do
+%if 0%{?_with_corefx}
+ install -p -m 644 $ASM/bin/%{BUILDCONF}/$ASM.dll %{buildroot}%{dotnet_assembly_path}
+%else
+ install -p -m 644 $ASM/bin/%{BUILDCONF}/Net45/$ASM.dll %{buildroot}%{dotnet_assembly_path}
+%endif
+done
+# NuGet
+mkdir -p %{buildroot}/nuget
+install -p -m 644 *.nupkg %{buildroot}/nuget
+
+%files
+%manifest %{name}.manifest
+%license LICENSE
+%attr(644,root,root) %{dotnet_assembly_path}/*.dll
+
+%package nuget
+Summary: NuGet package for %{name}
+Group: Development/Libraries
+
+%description nuget
+NuGet package for %{name}
+
+%files nuget
+/nuget/*.nupkg
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>
+++ /dev/null
-%{!?dotnet_assembly_path: %define dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework}
-
-%if 0%{?tizen_build_devel_mode}
-%define BUILDCONF Debug
-%else
-%define BUILDCONF Release
-%endif
-
-Name: csapi-system-sensor
-Summary: Tizen Sensor API for C#
-Version: 1.0.1
-Release: 1
-Group: Development/Libraries
-License: Apache-2.0
-URL: https://www.tizen.org
-Source0: %{name}-%{version}.tar.gz
-Source1: %{name}.manifest
-
-AutoReqProv: no
-
-BuildRequires: mono-compiler
-BuildRequires: mono-devel
-
-BuildRequires: dotnet-build-tools
-
-# C# API Requries
-BuildRequires: csapi-tizen-nuget
-BuildRequires: csapi-system-nuget
-
-%description
-Tizen Sensor API for C#
-
-%prep
-%setup -q
-cp %{SOURCE1} .
-
-%define Assemblies Tizen.System.Sensor
-
-%build
-for ASM in %{Assemblies}; do
-# NuGet Restore
-find $ASM/*.project.json -exec nuget restore {} \;
-# Build
-find $ASM/*.csproj -exec xbuild {} /p:Configuration=%{BUILDCONF} \;
-# NuGet Pack
-nuget pack $ASM/$ASM.nuspec -Version %{version} -Properties Configuration=%{BUILDCONF}
-done
-
-%install
-# Runtime Binary
-mkdir -p %{buildroot}%{dotnet_assembly_path}
-for ASM in %{Assemblies}; do
-%if 0%{?_with_corefx}
- install -p -m 644 $ASM/bin/%{BUILDCONF}/$ASM.dll %{buildroot}%{dotnet_assembly_path}
-%else
- install -p -m 644 $ASM/bin/%{BUILDCONF}/Net45/$ASM.dll %{buildroot}%{dotnet_assembly_path}
-%endif
-done
-# NuGet
-mkdir -p %{buildroot}/nuget
-install -p -m 644 *.nupkg %{buildroot}/nuget
-
-%files
-%manifest %{name}.manifest
-%license LICENSE
-%attr(644,root,root) %{dotnet_assembly_path}/*.dll
-
-%package nuget
-Summary: NuGet package for %{name}
-Group: Development/Libraries
-
-%description nuget
-NuGet package for %{name}
-
-%files nuget
-/nuget/*.nupkg
--- /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.
+
+internal static partial class Interop
+{
+ internal static partial class Libraries
+ {
+ public const string Sensor = "libcapi-system-sensor.so.0";
+ public const string Libc = "libc.so.6";
+ }
+}
\ 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;
+using System.Runtime.InteropServices;
+using Tizen.Sensor;
+
+internal static partial class Interop
+{
+ internal static class Sensor
+ {
+ //Sensor Hardware CAPI
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_name")]
+ internal static extern int GetName(IntPtr sensorhandle, out String name);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_vendor")]
+ internal static extern int GetVendor(IntPtr sensorHandle, out String vendor);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_type")]
+ internal static extern int GetType(IntPtr sensorHandle, out SensorType type);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_min_range")]
+ internal static extern int GetMinRange(IntPtr sensorHandle, out float minRange);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_max_range")]
+ internal static extern int GetMaxRange(IntPtr sensorHandle, out float maxRange);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_resolution")]
+ internal static extern int GetResolution(IntPtr sensorHandle, out float resolution);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_min_interval")]
+ internal static extern int GetMinInterval(IntPtr sensorHandle, out int minInterval);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_fifo_count")]
+ internal static extern int GetFifoCount(IntPtr sensorHandle, out int fifoCount);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_max_batch_count")]
+ internal static extern int GetMaxBatchCount(IntPtr sensorHandle, out int maxBatchCount);
+ }
+ internal static class SensorListener
+ {
+ //Sensor Listener CAPI
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void SensorEventCallback(IntPtr sensorHandle, IntPtr eventData, IntPtr data);
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void SensorAccuracyCallback(IntPtr sensorHandle, ulong timestamp, SensorDataAccuracy accuracy, IntPtr data);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_create_listener")]
+ internal static extern int CreateListener(IntPtr sensorHandle, out IntPtr listenerHandle);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_destroy_listener")]
+ internal static extern int DestroyListener(IntPtr listenerHandle);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_start")]
+ internal static extern int StartListener(IntPtr listenerHandle);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_stop")]
+ internal static extern int StopListener(IntPtr listenerHandle);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_event_cb")]
+ internal static extern int SetEventCallback(IntPtr listenerHandle, uint intervalMs, SensorEventCallback callback, IntPtr data);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_unset_event_cb")]
+ internal static extern int UnsetEventCallback(IntPtr listernerHandle);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_accuracy_cb")]
+ internal static extern int SetAccuracyCallback(IntPtr listenerHandle, uint intervalMs, SensorAccuracyCallback callback, IntPtr data);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_unset_accuracy_cb")]
+ internal static extern int UnsetAccuracyCallback(IntPtr listernerHandle);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_interval")]
+ internal static extern int SetInterval(IntPtr listenerHandle, uint intervalMs);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_max_batch_latency")]
+ internal static extern int SetMaxBatchLatency(IntPtr listenerHandle, uint maxBatchLatency);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_attribute_int")]
+ internal static extern int SetAttribute(IntPtr listenerHandle, SensorAttribute sensorAttribute, int option);
+ }
+
+ internal static class SensorManager
+ {
+ //Sensor Manager CAPI
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_is_supported")]
+ internal static extern int SensorIsSupported(SensorType type, out bool supported);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_default_sensor")]
+ internal static extern int GetDefaultSensor(SensorType type, out IntPtr sensor);
+
+ [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_sensor_list")]
+ internal static extern int GetSensorList(SensorType type, out IntPtr list, out int sensor_count);
+ }
+
+ internal static partial class Libc
+ {
+ [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int Free(IntPtr ptr);
+ }
+
+ [StructLayout(LayoutKind.Sequential, Pack = 0)]
+ internal struct SensorEventStruct
+ {
+ internal SensorDataAccuracy accuracy;
+ internal UInt64 timestamp;
+ internal int value_count;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
+ internal float[] values;
+ }
+
+ internal static IntPtr[] IntPtrToIntPtrArray(IntPtr unmanagedArray, int size)
+ {
+ IntPtr[] managedArray = new IntPtr[size];
+ Marshal.Copy(unmanagedArray, managedArray, 0, size);
+ return managedArray;
+ }
+
+ internal static SensorEventStruct IntPtrToEventStruct(IntPtr unmanagedVariable)
+ {
+ SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure(unmanagedVariable, typeof(SensorEventStruct));
+ return outStruct;
+ }
+}
--- /dev/null
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Tizen.Sensor")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Samsung Electronics")]
+[assembly: AssemblyProduct("Tizen.Sensor")]
+[assembly: AssemblyCopyright("Copyright (c) 2015 Samsung Electronics Co., Ltd")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.0.0")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <PropertyGroup>\r
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+ <ProjectGuid>{15FBE509-20D4-4D66-A8FC-5B0AC807BB88}</ProjectGuid>\r
+ <OutputType>Library</OutputType>\r
+ <AppDesignerFolder>Properties</AppDesignerFolder>\r
+ <RootNamespace>Tizen.Sensor</RootNamespace>\r
+ <AssemblyName>Tizen.Sensor</AssemblyName>\r
+ <FileAlignment>512</FileAlignment>\r
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\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\Net45\</OutputPath>\r
+ <DefineConstants>DEBUG;TRACE</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>pdbonly</DebugType>\r
+ <Optimize>true</Optimize>\r
+ <OutputPath>bin\Release\Net45\</OutputPath>\r
+ <DefineConstants>TRACE</DefineConstants>\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.Sensor.snk</AssemblyOriginatorKeyFile>\r
+ </PropertyGroup>\r
+ <ItemGroup>\r
+ <Reference Include="System" />\r
+ <Reference Include="System.Core" />\r
+ <Reference Include="System.Xml.Linq" />\r
+ <Reference Include="System.Data.DataSetExtensions" />\r
+ <Reference Include="Microsoft.CSharp" />\r
+ <Reference Include="System.Data" />\r
+ <Reference Include="System.Net.Http" />\r
+ <Reference Include="System.Xml" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <Compile Include="Properties\AssemblyInfo.cs" />\r
+ <Compile Include="Interop\Interop.Sensor.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\FaceDownGestureDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\PickUpGestureDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\RunningActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\StationaryActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\InVehicleActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\WalkingActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\WristUpGestureDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\ActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\PickUpGestureDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\RunningActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\InVehicleActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\StationaryActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\WalkingActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\WristUpGestureDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\FaceDownGestureDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\SensorEnumerations.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\GravitySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\GyroscopeDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\HeartRateMonitorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\HumiditySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\LightSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\LinearAccelerationSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\MagnetometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\OrientationSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\PedometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\PressureSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\ProximitySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\RotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\SleepMonitorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\TemperatureSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\UltravioletSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\UncalibratedGyroscopeDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\UncalibratedMagnetometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\GravitySensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Gyroscope.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\GyroscopeRotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\HeartRateMonitor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\HumiditySensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\LightSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\LinearAccelerationSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Magnetometer.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\MagnetometerRotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\OrientationSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Pedometer.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\PressureSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\ProximitySensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\RotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\SleepMonitor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\TemperatureSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\UltravioletSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\UncalibratedGyroscope.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\UncalibratedMagnetometer.cs" />\r
+ <Compile Include="Tizen.Sensor\Sensor.cs" />\r
+ <Compile Include="Interop\Interop.Libraries.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Accelerometer.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\SensorAccuracyChangedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\AccelerometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\SensorErrorFactory.cs" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="Tizen.Sensor.nuspec" />\r
+ <None Include="Tizen.Sensor.Net45.project.json" />\r
+ <None Include="Tizen.Sensor.snk" />\r
+ </ItemGroup>\r
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
+ Other similar extension points exist, see Microsoft.Common.targets.\r
+ <Target Name="BeforeBuild">\r
+ </Target>\r
+ <Target Name="AfterBuild">\r
+ </Target>\r
+ -->\r
+</Project>\r
--- /dev/null
+{
+ "dependencies": {
+ "Tizen": "1.0.1",
+ "Tizen.System": "1.0.2"
+ },
+ "frameworks": {
+ "net45": {}
+ },
+ "runtimes": {
+ "win": {}
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <PropertyGroup>\r
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+ <ProjectGuid>{CB655C6A-F73B-448E-913C-CA4DCBC5E401}</ProjectGuid>\r
+ <OutputType>Library</OutputType>\r
+ <AppDesignerFolder>Properties</AppDesignerFolder>\r
+ <RootNamespace>Tizen.Sensor</RootNamespace>\r
+ <AssemblyName>Tizen.Sensor</AssemblyName>\r
+ <FileAlignment>512</FileAlignment>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>\r
+ <TargetFrameworkVersion>v1.3</TargetFrameworkVersion>\r
+ <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>\r
+ <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
+ <NoStdLib>true</NoStdLib>\r
+ <NoWarn>$(NoWarn);1701;1702</NoWarn>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+ <DebugSymbols>true</DebugSymbols>\r
+ <DebugType>full</DebugType>\r
+ <Optimize>false</Optimize>\r
+ <OutputPath>bin\Debug\</OutputPath>\r
+ <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ <ConsolePause>false</ConsolePause>\r
+ <Prefer32Bit>false</Prefer32Bit>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+ <DebugType>pdbonly</DebugType>\r
+ <Optimize>true</Optimize>\r
+ <OutputPath>bin\Release\</OutputPath>\r
+ <DefineConstants>TRACE</DefineConstants>\r
+ <ErrorReport>prompt</ErrorReport>\r
+ <WarningLevel>4</WarningLevel>\r
+ <ConsolePause>false</ConsolePause>\r
+ <Prefer32Bit>false</Prefer32Bit>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <SignAssembly>true</SignAssembly>\r
+ </PropertyGroup>\r
+ <PropertyGroup>\r
+ <AssemblyOriginatorKeyFile>Tizen.Sensor.snk</AssemblyOriginatorKeyFile>\r
+ </PropertyGroup>\r
+ <ItemGroup>\r
+ <Compile Include="Properties\AssemblyInfo.cs" />\r
+ <Compile Include="Interop\Interop.Sensor.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\FaceDownGestureDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\PickUpGestureDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\RunningActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\StationaryActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\InVehicleActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\WalkingActivityDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\WristUpGestureDetectorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\ActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\PickUpGestureDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\RunningActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\InVehicleActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\StationaryActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\WalkingActivityDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\WristUpGestureDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\FaceDownGestureDetector.cs" />\r
+ <Compile Include="Tizen.Sensor\SensorEnumerations.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\GravitySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\GyroscopeDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\HeartRateMonitorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\HumiditySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\LightSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\LinearAccelerationSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\MagnetometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\OrientationSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\PedometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\PressureSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\ProximitySensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\RotationVectorSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\SleepMonitorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\TemperatureSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\UltravioletSensorDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\UncalibratedGyroscopeDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\UncalibratedMagnetometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\GravitySensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Gyroscope.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\GyroscopeRotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\HeartRateMonitor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\HumiditySensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\LightSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\LinearAccelerationSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Magnetometer.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\MagnetometerRotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\OrientationSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Pedometer.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\PressureSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\ProximitySensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\RotationVectorSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\SleepMonitor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\TemperatureSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\UltravioletSensor.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\UncalibratedGyroscope.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\UncalibratedMagnetometer.cs" />\r
+ <Compile Include="Tizen.Sensor\Sensor.cs" />\r
+ <Compile Include="Interop\Interop.Libraries.cs" />\r
+ <Compile Include="Tizen.Sensor\Plugins\Accelerometer.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\SensorAccuracyChangedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\EventArgs\AccelerometerDataUpdatedEventArgs.cs" />\r
+ <Compile Include="Tizen.Sensor\SensorErrorFactory.cs" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="Tizen.Sensor.nuspec" />\r
+ <None Include="Tizen.Sensor.project.json" />\r
+ <None Include="Tizen.Sensor.snk" />\r
+ </ItemGroup>\r
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
+ Other similar extension points exist, see Microsoft.Common.targets.\r
+ <Target Name="BeforeBuild">\r
+ </Target>\r
+ <Target Name="AfterBuild">\r
+ </Target>\r
+ -->\r
+ <PropertyGroup>\r
+ <!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and\r
+ https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild\r
+ -->\r
+ <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two\r
+ properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and\r
+ to prevent it from outputting a warning (MSB3644).\r
+ -->\r
+ <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>\r
+ <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>\r
+ <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>\r
+ </PropertyGroup>\r
+</Project>\r
--- /dev/null
+<?xml version="1.0"?>
+<package>
+ <metadata>
+ <id>Tizen.Sensor</id>
+ <version>$version$</version>
+ <authors>Tizen Developers</authors>
+ <description>Sensor API for Tizen.Net</description>
+ <dependencies>
+ <dependency id="Tizen" version="1.0.1" />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="bin/$Configuration$/Tizen.Sensor.dll" target="lib/netstandard1.3" />
+ <file src="bin/$Configuration$/Net45/Tizen.Sensor.dll" target="lib/net45" />
+ </files>
+</package>
--- /dev/null
+{
+ "dependencies": {
+ "NETStandard.Library": "1.6.0",
+ "Tizen": "1.0.1",
+ "Tizen.System": "1.0.2"
+ },
+ "frameworks": {
+ "netstandard1.3": {}
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// Accelerometer changed event arguments. Class for storing the data returned by accelerometer
+ /// </summary>
+ public class AccelerometerDataUpdatedEventArgs : EventArgs
+ {
+ internal AccelerometerDataUpdatedEventArgs(float[] values)
+ {
+ X = values[0];
+ Y = values[1];
+ Z = values[2];
+ }
+
+ /// <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; }
+ }
+}
\ 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.Sensor
+{
+ /// <summary>
+ /// FaceDownGestureDetector changed event arguments. Class for storing the data returned by face down gesture detector.
+ /// </summary>
+ public class FaceDownGestureDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal FaceDownGestureDetectorDataUpdatedEventArgs(float state)
+ {
+ FaceDown = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the face down state.
+ /// </summary>
+ public DetectorState FaceDown { get; private set; }
+ }
+}
--- /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.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.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.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.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.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"). 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.Sensor
+{
+ /// <summary>
+ /// InVehicleActivityDetector changed event arguments. Class for storing the data returned by in-vehicle activity detector
+ /// </summary>
+ public class InVehicleActivityDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal InVehicleActivityDetectorDataUpdatedEventArgs(float state)
+ {
+ InVehicle = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the in-vehicle state.
+ /// </summary>
+ public DetectorState InVehicle { get; private set; }
+ }
+}
--- /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.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.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.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.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.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.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"). 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.Sensor
+{
+ /// <summary>
+ /// PickUpGestureDetector changed event arguments. Class for storing the data returned by pick up gesture detector
+ /// </summary>
+ public class PickUpGestureDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal PickUpGestureDetectorDataUpdatedEventArgs(float state)
+ {
+ PickUp = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the pick up state.
+ /// </summary>
+ public DetectorState PickUp { get; private set; }
+ }
+}
--- /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.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.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.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
--- /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.Sensor
+{
+ /// <summary>
+ /// RunningActivityDetector changed event arguments. Class for storing the data returned by running activity detector
+ /// </summary>
+ public class RunningActivityDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal RunningActivityDetectorDataUpdatedEventArgs(float state)
+ {
+ Running = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the running state.
+ /// </summary>
+ public DetectorState Running { get; private set; }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// Sensor accuracy changed event arguments Class. Contains the parameters to be returned through accuracy callback
+ /// </summary>
+ public class SensorAccuracyChangedEventArgs : EventArgs
+ {
+ internal SensorAccuracyChangedEventArgs(TimeSpan timespan, SensorDataAccuracy accuracy)
+ {
+ TimeSpan = timespan;
+ Accuracy = accuracy;
+ }
+
+ /// <summary>
+ /// Gets the time stamp.
+ /// </summary>
+ public TimeSpan TimeSpan { get; private set; }
+
+ /// <summary>
+ /// Gets the accuracy.
+ /// </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.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"). 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.Sensor
+{
+ /// <summary>
+ /// StationaryActivityDetector changed event arguments. Class for storing the data returned by stationary activity detector
+ /// </summary>
+ public class StationaryActivityDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal StationaryActivityDetectorDataUpdatedEventArgs(float state)
+ {
+ Stationary = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the stationary state.
+ /// </summary>
+ public DetectorState Stationary { get; private set; }
+ }
+}
--- /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.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.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.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.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
--- /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.Sensor
+{
+ /// <summary>
+ /// WalkingActivityDetector changed event arguments. Class for storing the data returned by walking activity detector
+ /// </summary>
+ public class WalkingActivityDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal WalkingActivityDetectorDataUpdatedEventArgs(float state)
+ {
+ Walking = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the walking state.
+ /// </summary>
+ public DetectorState Walking { get; private set; }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// WristUpGestureDetector changed event arguments. Class for storing the data returned by wrist up gesture detector
+ /// </summary>
+ public class WristUpGestureDetectorDataUpdatedEventArgs : EventArgs
+ {
+ internal WristUpGestureDetectorDataUpdatedEventArgs(float state)
+ {
+ WristUp = (DetectorState) state;
+ }
+
+ /// <summary>
+ /// Gets the wrist up state.
+ /// </summary>
+ public DetectorState WristUp { get; private set; }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// Accelerometer Sensor Class. Used for registering callbacks for accelerometer and getting accelerometer data
+ /// /// </summary>
+ public class Accelerometer : Sensor
+ {
+ private static string AccelerometerKey = "http://tizen.org/feature/sensor.accelerometer";
+ /// <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 accelerometer sensor is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the Accelerometer sensor is supported");
+ return CheckIfSupported(SensorType.Accelerometer, AccelerometerKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of accelerometer sensors available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of accelerometer sensors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.Accelerometer"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular accelerometer sensor in case of multiple sensors
+ /// </param>
+ public Accelerometer(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating Accelerometer object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.Accelerometer;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in accelerometer sensor data.
+ /// </summary>
+
+ public event EventHandler<AccelerometerDataUpdatedEventArgs> DataUpdated;
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.Accelerometer, out list, out count);
+ 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 != (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 != (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);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ X = sensorData.values[0];
+ Y = sensorData.values[1];
+ Z = sensorData.values[2];
+
+ DataUpdated?.Invoke(this, new AccelerometerDataUpdatedEventArgs(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.Sensor
+{
+ public abstract class ActivityDetector : Sensor
+ {
+ protected const int ActivityAttribute = (((int)SensorType.InVehicleActivityDetector << 8) | 0x80 | 0x1);
+
+ protected enum ActivityType
+ {
+ Unknown = 1,
+ Stationary = 2,
+ Walking = 4,
+ Running = 8,
+ InVehicle = 16,
+ OnBicycle = 32,
+ };
+
+ /// <summary>
+ /// Gets the activity accuracy of activity detector
+ /// </summary>
+ public SensorDataAccuracy ActivityAccuracy { get; protected set; }
+
+ protected abstract void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data);
+
+ internal ActivityDetector(int index) : base(index)
+ {
+ }
+
+ 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 activity detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for activity detector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for activity detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for activity detector");
+ }
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// FaceDownGestureDetector Class. Used for registering callbacks for face down gesture detector and getting the face down state
+ /// </summary>
+ public class FaceDownGestureDetector : Sensor
+ {
+ private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition";
+
+ /// <summary>
+ /// Gets the state of the face down gesture.
+ /// </summary>
+ public DetectorState FaceDown { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether face down gesture detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the face down gesture detector is supported");
+ return CheckIfSupported(SensorType.FaceDownGestureDetector, GestureDetectorKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of face down gesture detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of face down gesture detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.FaceDownGestureDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular face down gesture detector in case of multiple sensors.
+ /// </param>
+ public FaceDownGestureDetector(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating face down gesture detector object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.FaceDownGestureDetector;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.FaceDownGestureDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for face down gesture detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in face down gesture detector data.
+ /// </summary>
+ public event EventHandler<FaceDownGestureDetectorDataUpdatedEventArgs> DataUpdated;
+
+ 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 face down gesture detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for face down gesture detector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for face down gesture detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for face down gesture detector");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ FaceDown = (DetectorState) sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new FaceDownGestureDetectorDataUpdatedEventArgs(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.Sensor
+{
+ /// <summary>
+ /// GravitySensor Class. Used for registering callbacks for gravity sensor and getting gravity data
+ /// /// </summary>
+ public class GravitySensor : Sensor
+ {
+ private const string GravitySensorKey = "http://tizen.org/feature/sensor.gravity";
+
+ 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(SensorType.GravitySensor, GravitySensorKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ 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.Sensor
+{
+ /// <summary>
+ /// Gyroscope Sensor Class. Used for registering callbacks for gyroscope and getting gyroscope data
+ /// /// </summary>
+ public class Gyroscope : Sensor
+ {
+ private const string GyroscopeKey = "http://tizen.org/feature/sensor.gyroscope";
+
+ /// <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(SensorType.Gyroscope, GyroscopeKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// GyroscopeRotationVectorSensor Class. Used for registering callbacks for gyroscope rotation vector sensor and getting gyroscope rotation vector data
+ /// /// </summary>
+ public class GyroscopeRotationVectorSensor : Sensor
+ {
+ private const string GyroscopeRVKey = "http://tizen.org/feature/sensor.gyroscope_rotation_vector";
+
+ /// <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(SensorType.GyroscopeRotationVectorSensor, GyroscopeRVKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// HeartRateMonitor Class. Used for registering callbacks for heart rate monitor and getting heart rate data
+ /// /// </summary>
+ public class HeartRateMonitor : Sensor
+ {
+ private const string HRMKey = "http://tizen.org/feature/sensor.heart_rate_monitor";
+
+ /// <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(SensorType.HeartRateMonitor, HRMKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// HumiditySensor Class. Used for registering callbacks for humidity sensor and getting humidity data
+ /// /// </summary>
+ public class HumiditySensor : Sensor
+ {
+ private const string HumiditySensorKey = "http://tizen.org/feature/sensor.humidity";
+
+ /// <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(SensorType.HumiditySensor, HumiditySensorKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// InVehicleActivityDetector Class. Used for registering callbacks for in vehicle activity detector and getting the in vehicle state
+ /// </summary>
+ public class InVehicleActivityDetector : ActivityDetector
+ {
+ private const string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
+ /// <summary>
+ /// Gets the state of in-vehicle activity detector
+ /// </summary>
+ public DetectorState InVehicle { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether in-vehicle activity detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the in-vehicle activity detector is supported");
+ return CheckIfSupported(SensorType.InVehicleActivityDetector, ActivityDetectorKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of in-vehicle activity detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of in-vehicle activity detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.InVehicleActivityDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular in-vehicle activity detector in case of multiple sensors.
+ /// </param>
+ public InVehicleActivityDetector(int index = 0) : base(index)
+ {
+ SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.InVehicle);
+ Log.Info(Globals.LogTag, "Creating in-vehicle activity detector object");
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.InVehicleActivityDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for in-vehicle activity detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in in-vehicle activity detector data.
+ /// </summary>
+ public event EventHandler<InVehicleActivityDetectorDataUpdatedEventArgs> DataUpdated;
+
+ protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ InVehicle = (DetectorState)sensorData.values[0];
+ ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new InVehicleActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.InVehicleActivityDetector;
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// LightSensor Class. Used for registering callbacks for light sensor and getting light data
+ /// /// </summary>
+ public class LightSensor : Sensor
+ {
+ private const string LightSensorKey = "http://tizen.org/feature/sensor.photometer";
+
+ /// <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(SensorType.LightSensor, LightSensorKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// LinearAccelerationSensor Class. Used for registering callbacks for linear acceleration sensor and getting linear acceleration data
+ /// /// </summary>
+ public class LinearAccelerationSensor : Sensor
+ {
+ private const string LinearAccelerationSensorKey = "http://tizen.org/feature/sensor.linear_acceleration";
+
+ 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(SensorType.LinearAccelerationSensor, LinearAccelerationSensorKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ 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.Sensor
+{
+ /// <summary>
+ /// Magnetometer Class. Used for registering callbacks for magnetometer and getting magnetometer data
+ /// /// </summary>
+ public class Magnetometer : Sensor
+ {
+ private static string MagnetometerKey = "http://tizen.org/feature/sensor.magnetometer";
+
+ 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(SensorType.Magnetometer, MagnetometerKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ 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.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 static string MagnetometerRVKey = "http://tizen.org/feature/sensor.geomagnetic_rotation_vector";
+
+ 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(SensorType.MagnetometerRotationVectorSensor, MagnetometerRVKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ 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.Sensor
+{
+ /// <summary>
+ /// OrientationSensor Class. Used for registering callbacks for orientation sensor and getting orientation data
+ /// /// </summary>
+ public class OrientationSensor : Sensor
+ {
+ private static string OrientationSensorKey = "http://tizen.org/feature/sensor.tiltmeter";
+
+ 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(SensorType.OrientationSensor, OrientationSensorKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ 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.Sensor
+{
+ /// <summary>
+ /// Pedometer Sensor Class. Used for registering callbacks for pedometer and getting pedometer data
+ /// /// </summary>
+ public class Pedometer : Sensor
+ {
+ private static string PedometerKey = "http://tizen.org/feature/sensor.pedometer";
+
+ /// <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(SensorType.Pedometer, PedometerKey);
+ }
+ }
+
+ /// <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.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.Pedometer;
+ }
+
+ /// <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 int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.Pedometer, 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.Sensor
+{
+ /// <summary>
+ /// PickUpGestureDetector Class. Used for registering callbacks for pick up activity detector and getting the pick up state
+ /// </summary>
+ public class PickUpGestureDetector : Sensor
+ {
+ private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition";
+
+ /// <summary>
+ /// Gets the state of the pick up gesture.
+ /// </summary>
+ public DetectorState PickUp { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether pick up gesture detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the pick up gesture detector is supported");
+ return CheckIfSupported(SensorType.PickUpGestureDetector, GestureDetectorKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of pick up gesture detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of pick up gesture detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.PickUpGestureDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular pick up gesture detector in case of multiple sensors.
+ /// </param>
+ public PickUpGestureDetector(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating pick up gesture detector object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.PickUpGestureDetector;
+ }
+
+ private static bool CheckIfSupported()
+ {
+ bool isSupported;
+ int error = Interop.SensorManager.SensorIsSupported(SensorType.PickUpGestureDetector, out isSupported);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if pick up gesture detector is supported");
+ isSupported = false;
+ }
+ return isSupported;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.PickUpGestureDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for pick up gesture detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in pick up gesture detector data.
+ /// </summary>
+ public event EventHandler<PickUpGestureDetectorDataUpdatedEventArgs> DataUpdated;
+
+ 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 pick up gesture detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pick up gesture detector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for pick up gesture detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pick up gesture detector");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ PickUp = (DetectorState) sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new PickUpGestureDetectorDataUpdatedEventArgs(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.Sensor
+{
+ /// <summary>
+ /// PressureSensor Class. Used for registering callbacks for pressure sensor and getting pressure data
+ /// /// </summary>
+ public class PressureSensor : Sensor
+ {
+ private static string PressureSensorKey = "http://tizen.org/feature/sensor.barometer";
+
+ /// <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(SensorType.PressureSensor, PressureSensorKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// ProximitySensor Class. Used for registering callbacks for proximity sensor and getting proximity data
+ /// /// </summary>
+ public class ProximitySensor : Sensor
+ {
+ private static string ProximitySensorKey = "http://tizen.org/feature/sensor.proximity";
+
+ /// <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(SensorType.ProximitySensor, ProximitySensorKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// RotationVectorSensor Class. Used for registering callbacks for rotation vector sensor and getting rotation vector data
+ /// /// </summary>
+ public class RotationVectorSensor : Sensor
+ {
+ private static string RotationVectorKey = "http://tizen.org/feature/sensor.rotation_vector";
+
+ 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(SensorType.RotationVectorSensor, RotationVectorKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ 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.Sensor
+{
+ /// <summary>
+ /// RunningActivityDetector Class. Used for registering callbacks for running activity detector and getting the running state
+ /// </summary>
+ public class RunningActivityDetector : ActivityDetector
+ {
+ private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
+ /// <summary>
+ /// Gets the state of running activity detector
+ /// </summary>
+ public DetectorState Running { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether running activity detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the running activity detector is supported");
+ return CheckIfSupported(SensorType.RunningActivityDetector, ActivityDetectorKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of running activity detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of running activity detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.RunningActivityDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular running activity detector in case of multiple sensors.
+ /// </param>
+ public RunningActivityDetector(int index = 0) : base(index)
+ {
+ SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Running);
+ Log.Info(Globals.LogTag, "Creating running activity detector object");
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.RunningActivityDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for running activity detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in running activity detector data.
+ /// </summary>
+ public event EventHandler<RunningActivityDetectorDataUpdatedEventArgs> DataUpdated;
+
+ protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Running = (DetectorState)sensorData.values[0];
+ ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new RunningActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.RunningActivityDetector;
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// SleepMonitor Class. Used for registering callbacks for sleep monitor and getting sleep data
+ /// /// </summary>
+ public class SleepMonitor : Sensor
+ {
+ private static string SleepMonitorKey = "http://tizen.org/feature/sensor.sleep_monitor";
+
+ /// <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(SensorType.SleepMonitor, SleepMonitorKey);
+ }
+ }
+
+ /// <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.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.SleepMonitor;
+ }
+
+ /// <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 int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.SleepMonitor, 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.Sensor
+{
+ /// <summary>
+ /// StationaryActivityDetector Class. Used for registering callbacks for stationary activity detector and getting the stationary state
+ /// </summary>
+ public class StationaryActivityDetector : ActivityDetector
+ {
+ private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
+ /// <summary>
+ /// Gets the state of stationary activity detector
+ /// </summary>
+ public DetectorState Stationary { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether stationary activity detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the stationary activity detector is supported");
+ return CheckIfSupported(SensorType.StationaryActivityDetector, ActivityDetectorKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of stationary activity detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of stationary activity detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.stationaryActivityDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular stationary activity detector in case of multiple sensors.
+ /// </param>
+ public StationaryActivityDetector(int index = 0) : base(index)
+ {
+ SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Stationary);
+ Log.Info(Globals.LogTag, "Creating stationary activity detector object");
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.StationaryActivityDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for stationary activity detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in stationary activity detector data.
+ /// </summary>
+ public event EventHandler<StationaryActivityDetectorDataUpdatedEventArgs> DataUpdated;
+
+ protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Stationary = (DetectorState)sensorData.values[0];
+ ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new StationaryActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.StationaryActivityDetector;
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// TemperatureSensor Class. Used for registering callbacks for temperature sensor and getting temperature data
+ /// /// </summary>
+ public class TemperatureSensor : Sensor
+ {
+ private static string TemperatureSensorKey = "http://tizen.org/feature/sensor.temperature";
+
+ /// <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(SensorType.TemperatureSensor, TemperatureSensorKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// UltravioletSensor Class. Used for registering callbacks for ultraviolet sensor and getting ultraviolet data
+ /// /// </summary>
+ public class UltravioletSensor : Sensor
+ {
+ private static string UltravioletSensorKey = "http://tizen.org/feature/sensor.ultraviolet";
+
+ /// <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(SensorType.UltravioletSensor, UltravioletSensorKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// UncalibratedGyroscope Sensor Class. Used for registering callbacks for uncalibrated gyroscope and getting uncalibrated gyroscope data
+ /// /// </summary>
+ public class UncalibratedGyroscope : Sensor
+ {
+ private static string UncalibratedGyroscopeKey = "http://tizen.org/feature/sensor.gyroscope.uncalibrated";
+
+ /// <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(SensorType.UncalibratedGyroscope, UncalibratedGyroscopeKey);
+ }
+ }
+
+ /// <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.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 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.Sensor
+{
+ /// <summary>
+ /// UncalibratedMagnetometer Sensor Class. Used for registering callbacks for uncalibrated magnetometer and getting uncalibrated magnetometer data
+ /// /// </summary>
+ public class UncalibratedMagnetometer : Sensor
+ {
+ private static string UncalibratedMagnetometerKey = "http://tizen.org/feature/sensor.magnetometer.uncalibrated";
+
+ 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(SensorType.UncalibratedMagnetometer, UncalibratedMagnetometerKey);
+ }
+ }
+
+ /// <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.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;
+
+ /// <summary>
+ /// Event handler for accuracy changed events.
+ /// </summary>
+ public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
+ {
+ add
+ {
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStart();
+ }
+ _accuracyChanged += value;
+ }
+ remove
+ {
+ _accuracyChanged -= value;
+ if (_accuracyChanged == null)
+ {
+ AccuracyListenStop();
+ }
+ }
+ }
+
+ 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));
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// WalkingActivityDetector Class. Used for registering callbacks for walking activity detector and getting the walking state
+ /// </summary>
+ public class WalkingActivityDetector : ActivityDetector
+ {
+ private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition";
+
+ /// <summary>
+ /// Gets the state of walking activity detector
+ /// </summary>
+ public DetectorState Walking { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether walking activity detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the walking activity detector is supported");
+ return CheckIfSupported(SensorType.WalkingActivityDetector, ActivityDetectorKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of walking activity detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of walking activity detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.walkingActivityDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular walking activity detector in case of multiple sensors.
+ /// </param>
+ public WalkingActivityDetector(int index = 0) : base(index)
+ {
+ SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Walking);
+ Log.Info(Globals.LogTag, "Creating walking activity gesture detector object");
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.WalkingActivityDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for walking activity detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in walking activity gesture detector data.
+ /// </summary>
+ public event EventHandler<WalkingActivityDetectorDataUpdatedEventArgs> DataUpdated;
+
+ protected override void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ Walking = (DetectorState)sensorData.values[0];
+ ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy;
+
+ DataUpdated?.Invoke(this, new WalkingActivityDetectorDataUpdatedEventArgs(sensorData.values[0]));
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.WalkingActivityDetector;
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// WristUpGestureDetector Class. Used for registering callbacks for wrist up gesture detector and getting the wrist up state
+ /// </summary>
+ public class WristUpGestureDetector : Sensor
+ {
+ private static string WristUpKey = "http://tizen.org/feature/sensor.wrist_up";
+
+ /// <summary>
+ /// Gets the state of the wrist up gesture.
+ /// </summary>
+ public DetectorState WristUp { get; private set; }
+
+ /// <summary>
+ /// Returns true or false based on whether wrist up gesture detector is supported by device.
+ /// </summary>
+ public static bool IsSupported
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the wrist up gesture detector is supported");
+ return CheckIfSupported(SensorType.WristUpGestureDetector, WristUpKey);
+ }
+ }
+
+ /// <summary>
+ /// Returns the number of wrist up gesture detector available on the device.
+ /// </summary>
+ public static int Count
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the count of wrist up gesture detectors");
+ return GetCount();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Tizen.Sensor.WristUpGestureDetector"/> class.
+ /// </summary>
+ /// <param name='index'>
+ /// Index. Default value for this is 0. Index refers to a particular wrist up gesture detector in case of multiple sensors.
+ /// </param>
+ public WristUpGestureDetector(int index = 0) : base(index)
+ {
+ Log.Info(Globals.LogTag, "Creating wrist up gesture detector object");
+ }
+
+ internal override SensorType GetSensorType()
+ {
+ return SensorType.WristUpGestureDetector;
+ }
+
+ private static int GetCount()
+ {
+ IntPtr list;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(SensorType.WristUpGestureDetector, out list, out count);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error getting sensor list for wrist up gesture detector");
+ count = 0;
+ }
+ else
+ Interop.Libc.Free(list);
+ return count;
+ }
+
+ /// <summary>
+ /// Event Handler for storing the callback functions for event corresponding to change in wrist up gesture detector data.
+ /// </summary>
+ public event EventHandler<WristUpGestureDetectorDataUpdatedEventArgs> DataUpdated;
+
+ 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 wrist up gesture detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for wrist up gesture detector");
+ }
+ }
+
+ protected override void EventListenStop()
+ {
+ int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error unsetting event callback for wrist up gesture detector");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for wrist up gesture detector");
+ }
+ }
+
+ private void SensorEventCallback(IntPtr sensorHandle, IntPtr sensorPtr, IntPtr data)
+ {
+ Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(sensorPtr);
+ TimeSpan = new TimeSpan((Int64)sensorData.timestamp);
+ WristUp = (DetectorState) sensorData.values[0];
+
+ DataUpdated?.Invoke(this, new WristUpGestureDetectorDataUpdatedEventArgs(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;
+using Tizen.System;
+
+namespace Tizen.Sensor
+{
+ internal static class Globals
+ {
+ internal const string LogTag = "Tizen.Sensor";
+ }
+
+ /// <summary>
+ /// Sensor class for storing hardware information about a particular sensor
+ /// </summary>
+ public abstract class Sensor : IDisposable
+ {
+ private string _name;
+ private string _vendor;
+ private float _minValue;
+ private float _maxValue;
+ private float _resolution;
+ private int _minInterval;
+ private int _fifoCount;
+ private int _maxBatchCount;
+ private bool _isSensing = false;
+ private bool _disposed = false;
+ 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;
+
+ internal abstract SensorType GetSensorType();
+ protected abstract void EventListenStart();
+ protected abstract void EventListenStop();
+
+ internal Sensor(int index)
+ {
+ SensorType type = GetSensorType();
+ GetHandleList(type, index);
+ if (CheckSensorHandle())
+ {
+ CreateListener();
+ GetProperty();
+ }
+ }
+
+ ~Sensor()
+ {
+ Dispose(false);
+ }
+
+ /// <summary>
+ /// Property: For getting the name of the sensor
+ /// </summary>
+ public string Name
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the sensor name");
+ return _name;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the vendor.
+ /// </summary>
+ public string Vendor
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the sensor vendor name");
+ return _vendor;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the minimum value of range of sensor data.
+ /// </summary>
+ public float MinValue
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the min value of the sensor");
+ return _minValue;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the maximum value of range of sensor data.
+ /// </summary>
+ public float MaxValue
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the max value of the sensor");
+ return _maxValue;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the resolution.
+ /// </summary>
+ public float Resolution
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the resolution of the sensor");
+ return _resolution;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the minimum interval.
+ /// </summary>
+ public int MinInterval
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the min interval for the sensor");
+ return _minInterval;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the fifo count.
+ /// </summary>
+ public int FifoCount
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the fifo count of the sensor");
+ return _fifoCount;
+ }
+ }
+
+ /// <summary>
+ /// Property: Gets the maximum batch count.
+ /// </summary>
+ public int MaxBatchCount
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the max batch count of the sensor");
+ return _maxBatchCount;
+ }
+ }
+
+ /// <summary>
+ /// Sets the interval of the sensor for sensor data event
+ /// Callbacks will be called at frequency of this interval
+ /// </summary>
+ public uint Interval
+ {
+ 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;
+ }
+ }
+
+ /// <summary>
+ /// Sets the max batch latency for the sensor corresponding to the sensor data event.
+ /// </summary>
+ public uint MaxBatchLatency
+ {
+ 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;
+ }
+ }
+
+ /// <summary>
+ /// Sets the pause policy of the sensor.
+ /// </summary>
+ /// <value>
+ public SensorPausePolicy PausePolicy
+ {
+ set
+ {
+ Log.Info(Globals.LogTag, "Setting the pause policy of the sensor");
+ _pausePolicy = value;
+ SetAttribute(SensorAttribute.PausePolicy, (int)_pausePolicy);
+ }
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the pause policy of the sensor");
+ return _pausePolicy;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the time span.
+ /// </summary>
+ /// <value>The time span.</value>
+ public TimeSpan TimeSpan
+ {
+ set
+ {
+ Log.Info(Globals.LogTag, "Setting the timespan of the sensor values");
+ _timeSpan = value;
+ }
+ get
+ {
+ Log.Info(Globals.LogTag, "Getting the timespan of the sensor values");
+ return _timeSpan;
+ }
+ }
+
+ /// <summary>
+ /// Indicates whether this sensor is sensing.
+ /// </summary>
+ /// <value><c>true</c> if this sensor is sensing; otherwise, <c>false</c>.</value>
+ public bool IsSensing
+ {
+ get
+ {
+ Log.Info(Globals.LogTag, "Checking if the sensor is started");
+ return _isSensing;
+ }
+ }
+
+ internal IntPtr ListenerHandle
+ {
+ get
+ {
+ return _listenerHandle;
+ }
+ }
+
+ internal static bool CheckIfSupported(SensorType type, String key)
+ {
+ bool isSupported = false;
+ bool error = SystemInfo.TryGetValue(key, out isSupported);
+
+ if (!error || !isSupported)
+ {
+ Log.Error(Globals.LogTag, "Error checking if sensor is supported(systeminfo)");
+ return false;
+ }
+
+ int ret = Interop.SensorManager.SensorIsSupported(type, out isSupported);
+ if (ret != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error checking if sensor is supported");
+ isSupported = false;
+ }
+
+ return isSupported;
+ }
+
+ /// <summary>
+ /// Starts the sensor.
+ /// After this the event handlers will start receiving events.
+ /// </summary>
+ public void Start()
+ {
+ Log.Info(Globals.LogTag, "Starting the sensor");
+ if (CheckListenerHandle())
+ {
+ int error = Interop.SensorListener.StartListener(_listenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error starting sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Start Sensor Listener");
+ }
+ EventListenStart();
+ _isSensing = true;
+ Log.Info(Globals.LogTag, "Sensor started");
+ }
+ }
+
+ /// <summary>
+ /// Stop the sensor.
+ /// After this the event handlers will stop receiving the events
+ /// </summary>
+ public void Stop()
+ {
+ Log.Info(Globals.LogTag, "Stopping the sensor");
+ if (_isSensing)
+ {
+ int error = Interop.SensorListener.StopListener(_listenerHandle);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error stopping the sensor");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Stop Sensor Listener");
+ }
+ EventListenStop();
+ _isSensing = false;
+ Log.Info(Globals.LogTag, "Sensor stopped");
+ }
+ else
+ {
+ Log.Error(Globals.LogTag, "Can't stop sensor as it is already stopped");
+ throw new InvalidOperationException("Operation Failed: Sensor is already stopped");
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (_disposed)
+ return;
+
+ DestroyHandles();
+ _disposed = true;
+ }
+
+ protected void SetAttribute(SensorAttribute attribute, int option)
+ {
+ if (CheckListenerHandle())
+ {
+ int error = Interop.SensorListener.SetAttribute(_listenerHandle, attribute, option);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting sensor pause policy");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.PausePolicy Failed");
+ }
+ }
+ }
+
+ private void GetHandleList(SensorType type, int index)
+ {
+ IntPtr list;
+ IntPtr[] sensorList;
+ int count;
+ int error = Interop.SensorManager.GetSensorList(type, out list, out count);
+ 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)SensorError.None;
+
+ error = Interop.Sensor.GetName(_sensorHandle, out _name);
+ 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 != (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 != (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 != (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 != (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 != (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 != (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 != (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 != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error cerating sensor listener handle");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.CreateListener Failed");
+ }
+ }
+
+ private void SetInterval()
+ {
+ if (CheckListenerHandle())
+ {
+ 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");
+ }
+ }
+ }
+ }
+
+ private void SetMaxBatchLatency()
+ {
+ if (CheckListenerHandle())
+ {
+ int error = Interop.SensorListener.SetMaxBatchLatency(_listenerHandle, _maxBatchLatency);
+ if (error != (int)SensorError.None)
+ {
+ Log.Error(Globals.LogTag, "Error setting max batch latency");
+ throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.MaxBatchLatency Failed");
+ }
+ }
+ }
+
+ private bool CheckListenerHandle()
+ {
+ bool result = false;
+ if (_listenerHandle != IntPtr.Zero)
+ {
+ result = true;
+ }
+ else
+ {
+ Log.Error(Globals.LogTag, "Sensor listener handle is null");
+ throw new ArgumentException("Invalid Parameter: Sensor is null");
+ }
+ return result;
+ }
+
+ private bool CheckSensorHandle()
+ {
+ bool result = false;
+ if (_sensorHandle != IntPtr.Zero)
+ {
+ result = true;
+ }
+ else
+ {
+ Log.Error(Globals.LogTag, "Sensor handle is null");
+ throw new ArgumentException("Invalid Parameter: Sensor is null");
+ }
+ return result;
+ }
+
+ private void DestroyHandles()
+ {
+ Interop.SensorListener.DestroyListener(_listenerHandle);
+ }
+ }
+}
--- /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.Sensor
+{
+ /// <summary>
+ /// The SensorType Enum defintion for all sensor types.
+ /// </summary>
+ internal enum SensorType
+ {
+ /// <summary>
+ /// All sensors. This can be used to retrieve Sensor class object for all available sensors.
+ /// </summary>
+ All = -1,
+ /// <summary>
+ /// Accelerometer sensor.
+ /// </summary>
+ Accelerometer = 0,
+ /// <summary>
+ /// Gravity sensor.
+ /// </summary>
+ GravitySensor = 1,
+ /// <summary>
+ /// Linear Acceleration sensor.
+ /// </summary>
+ LinearAccelerationSensor = 2,
+ /// <summary>
+ /// Magnetometer sensor.
+ /// </summary>
+ Magnetometer = 3,
+ /// <summary>
+ /// Rotation Vector sensor.
+ /// </summary>
+ RotationVectorSensor = 4,
+ /// <summary>
+ /// Orientation sensor.
+ /// </summary>
+ OrientationSensor = 5,
+ /// <summary>
+ /// Gyroscope sensor.
+ /// </summary>
+ Gyroscope = 6,
+ /// <summary>
+ /// Light sensor.
+ /// </summary>
+ LightSensor = 7,
+ /// <summary>
+ /// Proximity sensor.
+ /// </summary>
+ ProximitySensor = 8,
+ /// <summary>
+ /// Pressure sensor.
+ /// </summary>
+ PressureSensor = 9,
+ /// <summary>
+ /// Ultraviolet sensor.
+ /// </summary>
+ UltravioletSensor = 10,
+ /// <summary>
+ /// Temperature sensor.
+ /// </summary>
+ TemperatureSensor = 11,
+ /// <summary>
+ /// Humidity sensor.
+ /// </summary>
+ HumiditySensor = 12,
+ /// <summary>
+ /// Hear rate monitor sensor.
+ /// </summary>
+ HeartRateMonitor = 13,
+ /// <summary>
+ /// Uncalibrated Gyroscope sensor.
+ /// </summary>
+ UncalibratedGyroscope = 17,
+ /// <summary>
+ /// Uncalibrated Geomagnetic sensor.
+ /// </summary>
+ UncalibratedMagnetometer = 18,
+ /// <summary>
+ /// Gyroscope-based rotation vector sensor.
+ /// </summary>
+ GyroscopeRotationVectorSensor = 19,
+ /// <summary>
+ /// Geomagnetic-based rotation vector sensor.
+ /// </summary>
+ MagnetometerRotationVectorSensor = 20,
+ /// <summary>
+ /// Pedometer sensor.
+ /// </summary>
+ Pedometer = 0x300,
+ /// <summary>
+ /// Sleep monitor sensor.
+ /// </summary>
+ SleepMonitor = 0x301,
+ /// <summary>
+ /// Walking activity detector.
+ /// </summary>
+ WalkingActivityDetector = 0x1A00,
+ /// <summary>
+ /// Running activity detector.
+ /// </summary>
+ RunningActivityDetector = 0x1A00,
+ /// <summary>
+ /// Stationary activity detector.
+ /// </summary>
+ StationaryActivityDetector = 0x1A00,
+ /// <summary>
+ /// InVehicle activity detector.
+ /// </summary>
+ InVehicleActivityDetector = 0x1A00,
+ /// <summary>
+ /// Wrist up gesture detector.
+ /// </summary>
+ WristUpGestureDetector = 0x1201,
+ /// <summary>
+ /// Pick up gesture detector.
+ /// </summary>
+ PickUpGestureDetector = 0x1204,
+ /// <summary>
+ /// Face down gesture detector.
+ /// </summary>
+ FaceDownGestureDetector = 0x1205
+ }
+
+ /// <summary>
+ /// SensorDataAccuracy Enum definition for all possible sensor data accuracy Values.
+ /// </summary>
+ public enum SensorDataAccuracy
+ {
+ /// <summary>
+ /// Undefined sensor data accuracy.
+ /// </summary>
+ Undefined = -1,
+ /// <summary>
+ /// Sensor data not accurate.
+ /// </summary>
+ Bad = 0,
+ /// <summary>
+ /// Moderately accurate sensor data.
+ /// </summary>
+ Normal = 1,
+ /// <summary>
+ /// Highly accurate sensor data.
+ /// </summary>
+ Good = 2,
+ /// <summary>
+ /// Very highly accurate sensor data.
+ /// </summary>
+ VeryGood = 3
+ }
+
+ /// <summary>
+ /// Sensor Option Enum definition for sensor option Values
+ /// </summary>
+ public enum SensorPausePolicy
+ {
+ /// <summary>
+ /// Does not receive data when the LCD is off and in the power save mode.
+ /// </summary>
+ None,
+ /// <summary>
+ /// Receives data when the LCD is off.
+ /// </summary>
+ DisplayOff,
+ /// <summary>
+ /// Receives data in the power save mode.
+ /// </summary>
+ PowerSaveMode,
+ /// <summary>
+ /// Receives data when the LCD is off and in the power save mode.
+ /// </summary>
+ All
+ }
+
+ /// <summary>
+ /// Sensor attribute.
+ /// </summary>
+ public enum SensorAttribute
+ {
+ /// <summary>
+ /// The axis orientation.
+ /// </summary>
+ AxisOrientation,
+
+ /// <summary>
+ /// The pause policy.
+ /// </summary>
+ PausePolicy
+ }
+
+ /// <summary>
+ /// Pedometer state.
+ /// </summary>
+ public enum PedometerState
+ {
+ /// <summary>
+ /// Unknown.
+ /// </summary>
+ Unknown,
+
+ /// <summary>
+ /// Stop state.
+ /// </summary>
+ Stop,
+
+ /// <summary>
+ /// Walking state.
+ /// </summary>
+ Walk,
+
+ /// <summary>
+ /// Running state.
+ /// </summary>
+ Run
+ }
+
+ /// <summary>
+ /// Sleep monitor state.
+ /// </summary>
+ public enum SleepMonitorState
+ {
+ /// <summary>
+ /// Unknown.
+ /// </summary>
+ Unknown,
+
+ /// <summary>
+ /// The wake state.
+ /// </summary>
+ Wake,
+
+ /// <summary>
+ /// The sleeping state.
+ /// </summary>
+ Sleep
+ }
+
+ /// <summary>
+ /// Proximity sensor state.
+ /// </summary>
+ public enum ProximitySensorState
+ {
+ /// <summary>
+ /// Near sate.
+ /// </summary>
+ Near = 0,
+
+ /// <summary>
+ /// Far state.
+ /// </summary>
+ Far = 5
+ }
+
+ /// <summary>
+ /// Detector sensor state.
+ /// </summary>
+ public enum DetectorState
+ {
+ /// <summary>
+ /// None sate.
+ /// </summary>
+ NotDetected = 0,
+
+ /// <summary>
+ /// Detected state.
+ /// </summary>
+ Detected = 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;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Sensor
+{
+ 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
+ }
+
+ internal static class SensorErrorFactory
+ {
+ static internal Exception CheckAndThrowException(int error, string msg)
+ {
+ SensorError e = (SensorError)error;
+ switch (e)
+ {
+ case SensorError.None:
+ return null;
+ case SensorError.IOError:
+ return new InvalidOperationException("I/O Error: " + msg);
+ case SensorError.InvalidParameter:
+ return new ArgumentException("Invalid Parameter: " + msg);
+ case SensorError.NotSupported:
+ return new InvalidOperationException("Not Supported: " + msg);
+ case SensorError.PermissionDenied:
+ return new InvalidOperationException("Permission Denied: " + msg);
+ case SensorError.OutOfMemory:
+ return new InvalidOperationException("Out of Memory: " + msg);
+ case SensorError.NotNeedCalibration:
+ return new InvalidOperationException("Sensor doesn't need calibration: " + msg);
+ case SensorError.OperationFailed:
+ return new InvalidOperationException("Operation Failed: " + msg);
+ default:
+ return new InvalidOperationException("Unknown Error Code: " + msg);
+ }
+ }
+ }
+}
\ No newline at end of file