Datalogic .NET SDK
AccStream (Constructor) (+1 overload)
Syntax
public AccStream(void);
Description
Constructor to Datalogic.API.Device.AccStream. When an instance of this class is created, the accelerometer data is not sampled until the Enable property is set.
Parameters Table
|
Type |
Parameter |
Description |
[in] |
- |
- |
- |
|
|
|
|
[return] |
- |
- |
- |
[on error] |
throws ApplicationException |
|
- |
Example
protected void myInitializeAccelerometer() { int hardware; if (Device.GetHardwareInfo(out hardware)) { hardware &= (int)Device.HardwareOptions.Accelerometer; if (hardware != 0) { hasAccelerometer = true; } }
if (hasAccelerometer) { try { // This creates the object accStream = new Device.AccStream(); 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"; } else this.statusBar1.Text = "Device has no Accelerometer."; } |
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), AccStream.Dispose (Method), Example #040.
Copyright © Datalogic ADC. All Right Reserved