Added more doxygen comments and example code
authorPraveen Gattu <gattu.p@samsung.com>
Thu, 14 Jul 2016 12:51:07 +0000 (18:21 +0530)
committerPraveen Gattu <gattu.p@samsung.com>
Thu, 14 Jul 2016 12:51:07 +0000 (18:21 +0530)
Change-Id: I492f8ab3d07aac733bd23fd9031bf9b23cfec171
Signed-off-by: Praveen Gattu <gattu.p@samsung.com>
src/Tizen.System/Device/Battery.cs
src/Tizen.System/Device/DeviceEventArgs.cs
src/Tizen.System/Device/DeviceExceptionFactory.cs
src/Tizen.System/Device/Display.cs
src/Tizen.System/Device/Haptic.cs
src/Tizen.System/Device/IR.cs
src/Tizen.System/Device/Led.cs
src/Tizen.System/Device/Power.cs

index 5d4f127..bf69f0e 100755 (executable)
@@ -3,7 +3,7 @@ using System;
 namespace Tizen.System
 {
     /// <summary>
-    /// Enumeration for the battery level.
+    /// Enumeration for the Battery level.
     /// </summary>
     public enum BatteryLevelStatus
     {
@@ -36,14 +36,18 @@ namespace Tizen.System
     }
 
     /// <summary>
-    /// The Battery API provides functions to get information about the battery.
+    /// The Battery class provides the Properties and Events for device battery.
     /// </summary>
     /// <remarks>
-    /// The Battery API provides the way to get the current battery capacity value,
-    /// battery state and charging state. It also supports the API for an application
-    /// to receive the battery events from the system. To receive the battery event
-    /// it should be described by the callback function.
+    /// The Battery API provides the way to get the current battery capacity value (Percent),
+    /// battery state and charging state. It also provides Events for an application
+    /// to receive the battery status change events from the device.
+    /// To receive the battery event, application should register with respective EventHandler.
     /// </remarks>
+    /// <code>
+    ///     Console.WriteLine("battery Charging state is: {0}", Tizen.System.Battery.IsCharging);
+    ///     Console.WriteLine("battery Percent is: {0}", Tizen.System.Battery.Percent);
+    /// </code>
     public static class Battery
     {
         private static readonly object s_lock = new object();
@@ -66,7 +70,7 @@ namespace Tizen.System
             }
         }
         /// <summary>
-        /// Gets the battery level.
+        /// Gets the current Battery level.
         /// </summary>
         public static BatteryLevelStatus Level
         {
@@ -82,7 +86,7 @@ namespace Tizen.System
             }
         }
         /// <summary>
-        /// Gets the charging state.
+        /// Gets the current charging state.
         /// </summary>
         public static bool IsCharging
         {
@@ -103,8 +107,19 @@ namespace Tizen.System
         /// CapacityChanged is triggered when the battery charge percentage is changed
         /// </summary>
         /// <param name="sender"></param>
-        /// <param name="e">A BatteryCapacityChangedEventArgs object that contains changed battery capacity</param>
-
+        /// <param name="e">A BatteryCapacityChangedEventArgs object that contains changed battery capacity (Percent)</param>
+        /// <code>
+        /// public static async Task BatteryEventHandler()
+        /// {
+        ///     EventHandler<BatteryPercentChangedEventArgs> handler = null;
+        ///     handler = (object sender, BatteryChargingStateChangedEventArgs args) =>
+        ///     {
+        ///          Console.WriteLine("battery Percent is: {0}", args.Percent);
+        ///     }
+        ///     Battery.PercentChanged += handler;
+        ///     await Task.Delay(20000);
+        ///  }
+        /// </code>
         public static event EventHandler<BatteryPercentChangedEventArgs> PercentChanged
         {
             add
@@ -138,6 +153,18 @@ namespace Tizen.System
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e">A BatteryLevelChangedEventArgs object that contains changed battery level </param>
+        /// <code>
+        /// public static async Task BatteryEventHandler()
+        /// {
+        ///     EventHandler<BatteryLevelChangedEventArgs> handler = null;
+        ///     handler = (object sender, BatteryLevelChangedEventArgs args) =>
+        ///     {
+        ///          Console.WriteLine("battery Level is: {0}", args.Level);
+        ///     }
+        ///     Battery.LevelChanged += handler;
+        ///     await Task.Delay(20000);
+        ///  }
+        /// </code>
         public static event EventHandler<BatteryLevelChangedEventArgs> LevelChanged
         {
             add
@@ -166,11 +193,23 @@ namespace Tizen.System
 
         private static event EventHandler<BatteryChargingStateChangedEventArgs> s_chargingStateChanged;
         /// <summary>
-        /// ChargingStatusChanged is triggered when the battery charging status is changed
+        /// ChargingStatusChanged is triggered when the Battery charging status is changed.
+        /// This event is triggered when Charger is connected/Disconnected.
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e">A BatteryChargingStateChangedEventArgs object that contains changed battery charging state</param>
-
+        /// <code>
+        /// public static async Task BatteryEventHandler()
+        /// {
+        ///     EventHandler<BatteryChargingStateChangedEventArgs> handler = null;
+        ///     handler = (object sender, BatteryChargingStateChangedEventArgs args) =>
+        ///     {
+        ///          Console.WriteLine("battery Level is: {0}", args.IsCharging);
+        ///     }
+        ///     Battery.ChargingStateChanged += handler;
+        ///     await Task.Delay(20000);
+        ///  }
+        /// </code>
         public static event EventHandler<BatteryChargingStateChangedEventArgs> ChargingStateChanged
         {
             add
index 389581e..f641a53 100644 (file)
@@ -2,7 +2,9 @@ using System;
 
 namespace Tizen.System
 {
-    // Battery
+    /// <summary>
+    /// BatteryPercentChangedEventArgs is an extended EventArgs class. This class contains event arguments for BatteryPercentChanged event from Battery class.
+    /// </summary>
     public class BatteryPercentChangedEventArgs : EventArgs
     {
         internal BatteryPercentChangedEventArgs(){}
@@ -13,6 +15,9 @@ namespace Tizen.System
         public int Percent { get; internal set; }
     }
 
+    /// <summary>
+    /// BatteryLevelChangedEventArgs is an extended EventArgs class. This class contains event arguments for BatteryLevelChanged event from Battery class.
+    /// </summary>
     public class BatteryLevelChangedEventArgs : EventArgs
     {
         internal BatteryLevelChangedEventArgs(){}
@@ -22,6 +27,9 @@ namespace Tizen.System
         public BatteryLevelStatus Level { get; internal set; }
     }
 
+    /// <summary>
+    /// BatteryChargingStateChangedEventArgs is an extended EventArgs class. This class contains event arguments for BatteryChargingStateChanged event from Battery class.
+    /// </summary>
     public class BatteryChargingStateChangedEventArgs : EventArgs
     {
         internal BatteryChargingStateChangedEventArgs() {}
@@ -31,7 +39,9 @@ namespace Tizen.System
         public bool IsCharging { get; internal set; }
     }
 
-    // Display
+    /// <summary>
+    /// DisplayStateChangedEventArgs is an extended EventArgs class. This class contains event arguments for DisplayStateChanged event from Display class.
+    /// </summary>
     public class DisplayStateChangedEventArgs : EventArgs
     {
         internal DisplayStateChangedEventArgs() {}
@@ -41,7 +51,9 @@ namespace Tizen.System
         public DisplayState State { get; internal set; }
     }
 
-    // Led
+    /// <summary>
+    /// LedBrightnessChangedEventArgs is an extended EventArgs class. This class contains event arguments for LedBrightnessChanged event from Led class.
+    /// </summary>
     public class LedBrightnessChangedEventArgs : EventArgs
     {
         internal LedBrightnessChangedEventArgs() {}
index c30d004..30a1aab 100644 (file)
@@ -28,10 +28,12 @@ namespace Tizen.System
             switch (err)
             {
                 case DeviceError.InvalidParameter:
+                case DeviceError.NotInitialized:
+                    //fall through
                     exp =  new ArgumentException(msg);
                     break;
                 case DeviceError.NotSupported:
-                    exp = new InvalidOperationException(msg +" : Device does not support the Operation.");
+                    exp = new NotSupportedException(msg +" : Device does not support the Operation.");
                     break;
                 case DeviceError.AlreadyInProgress:
                     //fall through
@@ -39,13 +41,12 @@ namespace Tizen.System
                     //fall through
                 case DeviceError.OperationFailed:
                     //fall through
-                case DeviceError.NotInitialized:
-                    //fall through
-                case DeviceError.PermissionDenied:
-                    //fall through
                 case DeviceError.InvalidOperation:
                     exp = new InvalidOperationException(msg);
                     break;
+                case DeviceError.PermissionDenied:
+                    exp = new UnauthorizedAccessException(msg);
+                    break;
                 default:
                     exp = new InvalidOperationException("Unknown error occured.");
                     break;
index 1325d55..9bb8345 100644 (file)
@@ -3,7 +3,7 @@ using System.Collections.Generic;
 namespace Tizen.System
 {
     /// <summary>
-    /// Enumeration for the available display states.
+    /// Enumeration for the available Display states.
     /// An application cannot put the device into the power off state or the suspend state.
     /// </summary>
     public enum DisplayState
@@ -23,8 +23,21 @@ namespace Tizen.System
     }
 
     /// <summary>
-    /// The Display class provides properties and methods to control the display status and brightness.
+    /// The Display class provides Properties and Events to control the display status and brightness.
     /// </summary>
+    /// <remarks>
+    /// The Display API provides the way to get the current Display brightness value,
+    /// display state and toal number of available displayes.
+    /// It also provides Events for an application to receive the Display state change events from the device.
+    /// To receive the Display event, application should register with assocated EventHandler.
+    /// </remarks>
+    /// <previlege>
+    /// http://tizen.org/privilege/display
+    /// </previlege>
+    /// <code>
+    ///     Console.WriteLine("Display current state is: {0}", Tizen.System.Display.State);
+    ///     Console.WriteLine("Total number of Displays are: {0}", Tizen.System.Display.NumberOfDisplays);
+    /// </code>
     public class Display
     {
         private readonly int _displayId;
@@ -36,7 +49,7 @@ namespace Tizen.System
         }
 
         /// <summary>
-        /// The number of display devices.
+        /// The number of available display devices.
         /// </summary>
         public static int NumberOfDisplays
         {
@@ -53,6 +66,7 @@ namespace Tizen.System
         }
         /// <summary>
         /// Get all the avaialble Displays.
+        /// The Display at index zero is always assigned to the main display.
         /// </summary>
         public static IReadOnlyList<Display> Displays
         {
@@ -76,14 +90,18 @@ namespace Tizen.System
 
         }
         /// <summary>
-        /// The maximum brightness value that can be set.
+        /// The maximum brightness value that can be set for the specific Display.
         /// </summary>
+        /// <code>
+        ///     Display display = Display.Displays[0];
+        ///     Console.WriteLine("Display MaxBrightness is: {0}", display.MaxBrightness);
+        /// </code>
         public int MaxBrightness
         {
             get
             {
                 int max = 0;
-                DeviceError res = (DeviceError) Interop.Device.DeviceDisplayGetMaxBrightness(_displayId, out max);
+                DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetMaxBrightness(_displayId, out max);
                 if (res != DeviceError.None)
                 {
                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get max brightness.");
@@ -93,14 +111,23 @@ namespace Tizen.System
         }
 
         /// <summary>
-        /// The display brightness value.
+        /// The display brightness valu of the Display.
         /// </summary>
+        /// <remarks>
+        /// Brightness value should be less than are equal to MaxBrightness value.
+        /// </remarks>
+        /// <exception cref="ArgumentException"> When the invalid parameter value is set.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <code>
+        ///     Display display = Display.Displays[0];
+        ///     Console.WriteLine("Display current Brightness is: {0}", display.Brightness);
+        /// </code>
         public int Brightness
         {
             get
             {
                 int brightness = 0;
-                DeviceError res = (DeviceError) Interop.Device.DeviceDisplayGetBrightness(_displayId, out brightness);
+                DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetBrightness(_displayId, out brightness);
                 if (res != DeviceError.None)
                 {
                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get brightness.");
@@ -110,7 +137,7 @@ namespace Tizen.System
             set
             {
                 //TODO: Check for maximum throw exception..
-                DeviceError res = (DeviceError) Interop.Device.DeviceDisplaySetBrightness(_displayId, value);
+                DeviceError res = (DeviceError)Interop.Device.DeviceDisplaySetBrightness(_displayId, value);
                 if (res != DeviceError.None)
                 {
                     throw DeviceExceptionFactory.CreateException(res, "unable to set brightness value");
@@ -118,14 +145,14 @@ namespace Tizen.System
             }
         }
         /// <summary>
-        /// The current display state.
+        /// The current device display state.
         /// </summary>
         public static DisplayState State
         {
             get
             {
                 int state = 0;
-                DeviceError res = (DeviceError) Interop.Device.DeviceDisplayGetState(out state);
+                DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetState(out state);
                 if (res != DeviceError.None)
                 {
                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get Display state.");
@@ -140,7 +167,18 @@ namespace Tizen.System
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e">An DisplayStateChangedEventArgs object that contains the changed state</param>
-
+        /// <code>
+        /// public static async Task DisplayEventHandler()
+        /// {
+        ///     EventHandler<DisplayStateChangedEventArgs> handler = null;
+        ///     handler = (object sender, DisplayStateChangedEventArgs args) =>
+        ///     {
+        ///          Console.WriteLine("Display State is: {0}", args.State);
+        ///     }
+        ///     Battery.StateChanged += handler;
+        ///     await Task.Delay(20000);
+        ///  }
+        /// </code>
         public static event EventHandler<DisplayStateChangedEventArgs> StateChanged
         {
             add
index 4bd431f..7121059 100644 (file)
@@ -3,19 +3,30 @@ using System.Collections.Generic;
 namespace Tizen.System
 {
     /// <summary>
-    /// The Haptic class provides properties and methods to control a vibrator.
+    /// The Vibrator class provides properties and methods to control a vibrator.
     /// </summary>
+    /// <remarks>
+    /// The Vibrator API provides the way to access the Vibrators in the device.
+    /// It allows the management of the device's vibrator parameters, such as the vibration count and level.
+    /// It provides methods to Vibrate and Stop the vibration.
+    /// </remarks>
+    /// <previlege>
+    /// http://tizen.org/privilege/haptic
+    /// </previlege>
+    /// <code>
+    ///     Console.WriteLine("Total number of Vibrators are: {0}", Tizen.System.Vibrator.NumberOfVibrators);
+    /// </code>
     public class Vibrator : IDisposable
     {
         private readonly int _vibratorId;
-        private IntPtr _hapticHandle;
+        private IntPtr _hapticHandle = IntPtr.Zero;
         private bool _disposedValue = false;
         private static Lazy<IReadOnlyList<Vibrator>> _lazyVibrators;
         private static int _maxcount = 0;
         private Vibrator(int id)
         {
             _vibratorId = id;
-            DeviceError res = (DeviceError) Interop.Device.DeviceHapticOpen(_vibratorId, out _hapticHandle);
+            DeviceError res = (DeviceError)Interop.Device.DeviceHapticOpen(_vibratorId, out _hapticHandle);
             if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "unable to create Vibrator for given Id");
@@ -62,13 +73,13 @@ namespace Tizen.System
         private static IReadOnlyList<Vibrator> GetAllVibrators()
         {
             int count = 0;
-            List< Vibrator > vibrators = new List<Vibrator>();
+            List<Vibrator> vibrators = new List<Vibrator>();
             DeviceError res = (DeviceError)Interop.Device.DeviceHapticGetCount(out count);
             if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "unable to get Vibrators count.");
             }
-            for(int i = 0; i< NumberOfVibrators; i++)
+            for (int i = 0; i < NumberOfVibrators; i++)
             {
                 vibrators.Add(new Vibrator(i));
             }
@@ -81,20 +92,35 @@ namespace Tizen.System
         /// </summary>
         /// <param name="duration">The play duration in milliseconds </param>
         /// <param name="feedback">The amount of the intensity variation (0 ~ 100) </param>
+        /// <exception cref="ArgumentException"> When the invalid parameter value is set.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <exception cref = "NotSupportedException"> In case of device does not support this behavior.</exception>
+        /// <code>
+        ///     Vibrator vibrator = Vibrator.Vibrators[0];
+        ///     try
+        ///     {
+        ///         vibrator.Vibrate(2000, 70);
+        ///     }
+        ///     Catch(Exception e)
+        ///     {
+        ///     }
+        /// </code>
+
         public void Vibrate(int duration, int feedback)
         {
             IntPtr effect;
             DeviceError res = DeviceError.None;
             if (_hapticHandle == IntPtr.Zero)
             {
-                res = (DeviceError) Interop.Device.DeviceHapticOpen(_vibratorId, out _hapticHandle);
+                res = (DeviceError)Interop.Device.DeviceHapticOpen(_vibratorId, out _hapticHandle);
                 if (res != DeviceError.None)
                 {
                     throw DeviceExceptionFactory.CreateException(res, "unable to get vibrator.");
                 }
             }
 
-            res = (DeviceError) Interop.Device.DeviceHapticVibrate(_hapticHandle, duration, feedback, out effect);
+            res = (DeviceError)Interop.Device.DeviceHapticVibrate(_hapticHandle, duration, feedback, out effect);
             if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "unable to vibrate the current vibrator.");
@@ -104,6 +130,20 @@ namespace Tizen.System
         /// Stops all vibration effects which are being played.
         /// This function can be used to stop all effects started by Vibrate().
         /// </summary>
+        /// <exception cref="ArgumentException"> In case of invalid vibrator instance is used.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <exception cref = "NotSupportedException"> In case of device does not support this behavior.</exception>
+        /// <code>
+        ///     Vibrator vibrator = Vibrator.Vibrators[0];
+        ///     try
+        ///     {
+        ///         vibrator.Stop();
+        ///     }
+        ///     Catch(Exception e)
+        ///     {
+        ///     }
+        /// </code>
         public void Stop()
         {
             if (_hapticHandle != IntPtr.Zero)
index 2f96bad..2d68e0b 100644 (file)
@@ -8,6 +8,12 @@ namespace Tizen.System
     /// The IR API provides functions to control a IR transmitter.
     /// The IR API provides the way to get the information whether IR is available and transmit IR command.
     /// </summary>
+    /// <previlege>
+    /// http://tizen.org/privilege/use_ir
+    /// </previlege>
+    /// <code>
+    ///     Console.WriteLine("IR availablity for this device is: {0}", IR.IsAvailable);
+    /// </code>
     public static class IR
     {
         /// <summary>
@@ -18,7 +24,7 @@ namespace Tizen.System
             get
             {
                 bool available = false;
-                DeviceError res = (DeviceError) Interop.Device.DeviceIRIsAvailable(out available);
+                DeviceError res = (DeviceError)Interop.Device.DeviceIRIsAvailable(out available);
                 if (res != DeviceError.None)
                 {
                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get ir status.");
@@ -36,10 +42,26 @@ namespace Tizen.System
         /// <param name="pattern">
         /// IR command list of type interger.
         /// </param>
+        /// <exception cref="ArgumentException"> When the invalid parameter value is set.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <exception cref = "NotSupportedException"> In case of device does not support this behavior.</exception>
+        /// <code>
+        ///    try
+        ///    {
+        ///       List<int> pattern = new List<int>();
+        ///       pattern.Add(10);
+        ///       pattern.Add(50);
+        ///       IR.Transmit(60657, pattern);
+        ///    }
+        ///    catch(Exception e)
+        ///    {
+        ///    }
+        /// </code>
         public static void Transmit(int carrierFreequency, IList<int> pattern)
         {
             int[] patternArray = pattern.ToArray();
-            DeviceError res = (DeviceError) Interop.Device.DeviceIRTransmit(carrierFreequency, patternArray, pattern.Count());
+            DeviceError res = (DeviceError)Interop.Device.DeviceIRTransmit(carrierFreequency, patternArray, pattern.Count());
             if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "unable to trasmit IR command.");
index 2df3ae1..8e4f1b4 100755 (executable)
@@ -5,6 +5,21 @@ namespace Tizen.System
     /// <summary>
     /// The Led class provides properties and methods to control the attached led device.
     /// </summary>
+    /// <remarks>
+    /// The Led API provides the way to control the attached LED device such as the camera flash and service LED.It supports to turn on the camera flash and set the pattern to the service LED which is located to the front of a device.
+    /// Related Features
+    ///    http://tizen.org/feature/led
+    ///    http://tizen.org/feature/camera.back.flash
+    /// It is recommended to design feature related codes in your application for reliability.
+    /// You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
+    /// </remarks>
+    /// <previlege>
+    ///  http://tizen.org/privilege/led
+    /// </previlege>
+    /// <code>
+    ///     Console.WriteLine("Led MaxBrightness is: {0}", Tizen.System.Led.MaxBrightness);
+    ///     Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);
+    /// </code>
     public static class Led
     {
         /// <summary>
@@ -15,7 +30,7 @@ namespace Tizen.System
             get
             {
                 int max = 0;
-                DeviceError res = (DeviceError) Interop.Device.DeviceFlashGetMaxBrightness(out max);
+                DeviceError res = (DeviceError)Interop.Device.DeviceFlashGetMaxBrightness(out max);
                 if (res != DeviceError.None)
                 {
                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get max brightness value.");
@@ -29,12 +44,23 @@ namespace Tizen.System
         /// <summary>
         /// Gets the brightness value of a LED that is located next to the camera.
         /// </summary>
+        /// <remarks>The brightness value range of LED is 0 to Tizen.System.Led.MaxBrightness value.
+        /// Changing the brightness value will invoke the registered EventHandler for led BrightnessChanged (If any).
+        /// </remarks>
+        /// <exception cref="ArgumentException"> When the invalid parameter value is set.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <code>
+        ///     Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);
+        ///     Tizen.System.Led.Brightness = 50;
+        ///     Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness);
+        /// </code>
+
         public static int Brightness
         {
             get
             {
                 int brightness = 0;
-                DeviceError res = (DeviceError) Interop.Device.DeviceFlashGetBrightness(out brightness);
+                DeviceError res = (DeviceError)Interop.Device.DeviceFlashGetBrightness(out brightness);
                 if (res != DeviceError.None)
                 {
                     Log.Warn(DeviceExceptionFactory.LogTag, "unable to get brightness value.");
@@ -43,7 +69,11 @@ namespace Tizen.System
             }
             set
             {
-                Interop.Device.DeviceFlashSetBrightness(value);
+                DeviceError res = (DeviceError) Interop.Device.DeviceFlashSetBrightness(value);
+                if (res != DeviceError.None)
+                {
+                    throw DeviceExceptionFactory.CreateException(res, "unable to set brightness value");
+                }
             }
         }
 
@@ -56,6 +86,19 @@ namespace Tizen.System
         /// The Color value
         /// The first byte means opaque and the other 3 bytes are RGB values.
         /// </param>
+        /// <exception cref="ArgumentException"> When the invalid parameter value is set.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <exception cref = "NotSupportedException"> In case of device does not support this behavior.</exception>
+        /// <code>
+        ///     try
+        ///     {
+        ///         Led.Play(500, 200, Color.FromRgba(255, 255, 255, 1));
+        ///     }
+        ///     Catch(Exception e)
+        ///     {
+        ///     }
+        /// </code>
         public static void Play(int on, int off, Color color)
         {
             //looks like only blink option is supported. So hard coded to default blink option.
@@ -69,10 +112,25 @@ namespace Tizen.System
         /// <summary>
         /// Stops the LED that is located to the front of a device.
         /// </summary>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <exception cref = "NotSupportedException"> In case of device does not support this behavior.</exception>
+        /// <code>
+        ///     try
+        ///     {
+        ///         Led.Play(500, 200, Color.FromRgba(255, 255, 255, 1));
+        ///         //wait for a while and stop...
+        ///         Led.Stop();
+        ///     }
+        ///     Catch(Exception e)
+        ///     {
+        ///     }
+        /// </code>
+
         public static void Stop()
         {
-            DeviceError res = (DeviceError) Interop.Device.DeviceLedStopCustom();
-            if(res != DeviceError.None)
+            DeviceError res = (DeviceError)Interop.Device.DeviceLedStopCustom();
+            if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "failed to stop Led.");
             }
index a1b5efa..396890f 100644 (file)
@@ -5,31 +5,52 @@ namespace Tizen.System
     /// <summary>
     /// The Power class provides methods to control the power service.
     /// </summary>
+    /// <remarks>
+    /// The Power API provides the way to control the power service.
+    /// It can be made to hold the specific state to avoid CPU state internally.
+    /// </remarks>
+    /// <previlege>
+    /// http://tizen.org/privilege/display
+    /// </previlege>
     public static class Power
     {
         /// <summary>
         /// Locks the CPU for a specified time.
         /// After the given timeout (in milliseconds), unlock the given lock state automatically.
         /// </summary>
+        /// <remarks>
+        /// If the process dies, then every lock will be removed.
+        /// </remarks>
         /// <param name="timeout">
         /// The positive number in milliseconds or 0 for permanent lock
         /// So you must release the permanent lock of power state with ReleaseCpuLock() if timeout_ms is zero.
         /// </param>
+        /// <exception cref="ArgumentException"> When the invalid parameter value is set.</exception>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <code>
+        /// Tizen.System.Power.RequestCpuLock(2000);
+        /// </code>
+
         public static void RequestCpuLock(int timeout)
         {
-            DeviceError res = (DeviceError) Interop.Device.DevicePowerRequestLock(0, timeout);
+            DeviceError res = (DeviceError)Interop.Device.DevicePowerRequestLock(0, timeout);
             if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "unable to acquire power lock.");
             }
         }
-
         /// <summary>
         /// Releases the CPU lock state.
         /// </summary>
+        /// <exception cref = "UnauthorizedAccessException"> If the privilege is not set.</exception>
+        /// <exception cref = "InvalidOperationException"> In case of any system error.</exception>
+        /// <code>
+        /// Tizen.System.Power.ReleaseCpuLock();
+        /// </code>
         public static void ReleaseCpuLock()
         {
-            DeviceError res = (DeviceError) Interop.Device.DevicePowerReleaseLock(0);
+            DeviceError res = (DeviceError)Interop.Device.DevicePowerReleaseLock(0);
             if (res != DeviceError.None)
             {
                 throw DeviceExceptionFactory.CreateException(res, "unable to release power lock.");