Class Vibrator

Definition

Namespace:
Tizen.System
Assembly:
Tizen.System.dll
API Level:
3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/haptic
Feature:
http://tizen.org/feature/feedback.vibration

The Vibrator class provides the properties and methods to control a vibrator.

C#
Copy
public class Vibrator : IDisposable
Inheritance
System.Object
Vibrator
Implements
System.IDisposable
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 the methods to vibrate and stop the vibration.

Examples
Copy
Console.WriteLine("Total number of Vibrators are: {0}", Tizen.System.Vibrator.NumberOfVibrators);

Properties

View Source

NumberOfVibrators

Gets the number of the available vibrators.

Declaration
C#
Copy
public static int NumberOfVibrators { get; }
Property Value
Type Description
Int32
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

API Level: 3
View Source

Vibrators

Gets all the available vibrators.

Declaration
C#
Copy
public static IReadOnlyList<Vibrator> Vibrators { get; }
Property Value
Type Description
System.Collections.Generic.IReadOnlyList<Vibrator>
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

API Level: 3

Methods

View Source

Dispose()

Dispose API for closing the internal resources. This function can be used to stop all the effects started by Vibrate().

Declaration
C#
Copy
public void Dispose()
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

API Level: 3
View Source

Dispose(Boolean)

Dispose API for closing the internal resources. This function can be used to stop all the effects started by Vibrate().

Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

API Level: 3
View Source

Finalize()

Finalizes an instance of the Vibrator class.

Declaration
C#
Copy
protected void Finalize()
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

View Source

Stop()

Stops all the vibration effects which are being played. This function can be used to stop all the effects started by Vibrate().

Declaration
C#
Copy
public void Stop()
Examples
Copy
Vibrator vibrator = Vibrator.Vibrators[0]; try { vibrator.Stop(); } catch(Exception e) { }
Exceptions
Type Condition
System.ArgumentException

In case an invalid vibrator instance is used.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

System.NotSupportedException

In case the device does not support this behavior.

API Level: 3
Feature: http://tizen.org/feature/feedback.vibration
View Source

Vibrate(Int32, Int32)

Vibrates during the specified time with a constant intensity. This function can be used to start monotonous vibration for the specified time.

Declaration
C#
Copy
public void Vibrate(int duration, int feedback)
Parameters
Type Name Description
Int32 duration

The play duration in milliseconds.

Int32 feedback

The amount of the intensity variation (0 ~ 100).

Examples
Copy
Vibrator vibrator = Vibrator.Vibrators[0]; try { vibrator.Vibrate(2000, 70); } catch(Exception e) { }
Exceptions
Type Condition
System.ArgumentException

When an invalid parameter value is set.

UnauthorizedAccessException

If the privilege is not set.

System.InvalidOperationException

In case of any system error.

System.NotSupportedException

In case the device does not support this behavior.

API Level: 3
Feature: http://tizen.org/feature/feedback.vibration

Implements

System.IDisposable