Datalogic .NET SDK

DataReady (Event)

 

Syntax

 

   public event AccDataReady DataReady;

 

 

Subclass                       AccStream

Class                           : Device

Namespace                : Datalogic.API

Assembly                   : Datalogic.API.DLL

 

 

Description

The Datalogic.API.Device.AccDataReady delegate is used when the accelerometer driver raises an event. All methods referenced by Datalogic.API.Device.AccStream.DataReady will be invoked after the event is raised.

 

 

Parameters Table

 

Type

Parameter

Description

[in]

-

-

-

 

 

 

 

[return]

-

-

-

[on error]

throws ApplicationException  

 

-

 

 

Example

protected void myInitializeAccelerometer()

{

      try

      {

            // This creates the object

            accStream = new Device.AccStream();

            // Subscribe to be notified of the event

            accStream.DataReady +=

                  new Device.AccDataReady(accStream_DataReady);

            // This initializes the sampling interval to one second.

            accStream.Interval = 1000;

            // This starts the data sampling.

            accStream.Enable = true;

      }

      catch (ApplicationException ex)

      {

            this.statusBar1.Text = "Error: " + ex.Message;

      }

      this.statusBar1.Text = "Success: Sampling";

}

 

/// <summary>

/// This is the method the AccStream will call when the data is sampled.

/// </summary>

/// <param name="sender"></param>

/// <param name="e">contains the accelerometer data</param>

void accStream_DataReady(object sender, Device.AccEventArgs e)

{

}

 

 

Remarks

 

After construction, the Interval property should be set before setting the Enable property to true to start data sampling.  Data sampling can be disabled and re-enabled using the Enable property.  The Interval Property can be used to change the sampling interval before or during data collection.  Remember to call Dispose() on the AccStream object when it is no longer needed.

 

 

See Also

AccStream (Class), AccDataReady (delegate), Example #041.

  

 

Copyright © Datalogic ADC. All Right Reserved