Datalogic .NET SDK
AccStream (Constructor) (+1 overload)
Syntax
public AccStream(uint interval);
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] |
uint |
interval |
The interval in milliseconds between which to sample the accelerometer data. |
|
|
|
|
[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 and initializes the sampling interval. accStream = new Device.AccStream(1000); accStream.DataReady += new Device.AccDataReady(accStream_DataReady); // 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
Setting the Enable property to false will stop data collection, which can then be restarted by setting the Enable property to true. 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