1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
/*
* Copyright 2011 Phidgets Inc. All rights reserved.
*/
#include "javamacros.h"
PACKAGEIMPORTS
/**
* This class represents a Phidget Bridge. All methods
* to manipulate the Phidget Bridge are implemented in this class.
* <p>
*
* @author Phidgets Inc.
*/
CLASSDEF(Bridge)
/**
* 1 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_1 = 1;
/**
* 8 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_8 = 2;
/**
* 16 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_16 = 3;
/**
* 32 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_32 = 4;
/**
* 64 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_64 = 5;
/**
* 128 Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_128 = 6;
/**
* Unknown Gain. This is used with {@link #getGain(int) getGain} and {@link #setGain(int, int) setGain}
*/
public static final int PHIDGET_BRIDGE_GAIN_UNKNOWN = 7;
/**
* Returns the number of bridges.
* @return Number of bridges
*/
PUBLIC_NATIVE(int, getInputCount,)
/**
* Returns the value of the selected input, in mV/V. If the input is not enabled, an EPHIDGET_UNKNOWNVAL exception will be thrown. If the bridge is saturated
*, this will be equal to BridgeMax or BridgeMin and an error event will be fired - in this case, gain should be reduced if possible.
* @param index Index of the bridge
* @return bridge value
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is out of range.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(double, getBridgeValue, int index)
/**
* Returns the minimum value that the selected bridge can measure, in mV/V. This value will depend on the selected gain. At a gain of 1, BridgeMin == -1000 mV/V.
* @param index Index of the bridge
* @return minimum value
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is out of range.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(double, getBridgeMin, int index)
/**
* Returns the maximum value that the selected bridge can measure, in mV/V. This value will depend on the selected gain. At a gain of 1, BridgeMin == 1000 mV/V.
* @param index Index of the bridge
* @return maximum value
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is out of range.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(double, getBridgeMax, int index)
/**
* Returns the enabled state of the specified bridge. This applies power between +5v and Ground, and starts measuring the differential on the +/- pins. By default, all bridges are
* disabled, and need to be explicitly enabled on startup.
* @param index Index of the bridge
* @return state of the specified bridge
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(boolean, getEnabled, int index)
/**
* Sets the enabled state of the specified bridge. This applies power between +5v and Ground, and starts measuring the differential on the +/- pins. By default, all bridges are
* disabled, and need to be explicitly enabled on startup.
* @param index Index of the bridge
* @param state new state of the specified bridge
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(void, setEnabled, int index, boolean state)
/**
* Returns the gain for the selected bridge. Note that increasing the gains will reduce the measurable
* voltage difference by the gain factor, with +-1000 mV/V being the maximum, with no gain.
* The possible values for gain are {@link #PHIDGET_BRIDGE_GAIN_1 PHIDGET_BRIDGE_GAIN_1},
* {@link #PHIDGET_BRIDGE_GAIN_8 PHIDGET_BRIDGE_GAIN_8}, {@link #PHIDGET_BRIDGE_GAIN_16 PHIDGET_BRIDGE_GAIN_16},
* {@link #PHIDGET_BRIDGE_GAIN_32 PHIDGET_BRIDGE_GAIN_32}, {@link #PHIDGET_BRIDGE_GAIN_64 PHIDGET_BRIDGE_GAIN_64},
* {@link #PHIDGET_BRIDGE_GAIN_128 PHIDGET_BRIDGE_GAIN_128}, {@link #PHIDGET_BRIDGE_GAIN_UNKNOWN PHIDGET_BRIDGE_GAIN_UNKNOWN}
* <p>
* @param index Index of the bridge
* @return gain
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(int, getGain, int index)
/**
* Sets the gain for the selected bridge. Note that increasing the gains will reduce the measurable
* voltage difference by the gain factor, with +-1000 mV/V being the maximum, with no gain.
* <p>
* The possible values for gain are {@link #PHIDGET_BRIDGE_GAIN_1 PHIDGET_BRIDGE_GAIN_1},
* {@link #PHIDGET_BRIDGE_GAIN_8 PHIDGET_BRIDGE_GAIN_8}, {@link #PHIDGET_BRIDGE_GAIN_16 PHIDGET_BRIDGE_GAIN_16},
* {@link #PHIDGET_BRIDGE_GAIN_32 PHIDGET_BRIDGE_GAIN_32}, {@link #PHIDGET_BRIDGE_GAIN_64 PHIDGET_BRIDGE_GAIN_64},
* {@link #PHIDGET_BRIDGE_GAIN_128 PHIDGET_BRIDGE_GAIN_128}, {@link #PHIDGET_BRIDGE_GAIN_UNKNOWN PHIDGET_BRIDGE_GAIN_UNKNOWN}
* <p>
* @param index Index of the bridge
* @param gain new gain
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(void, setGain, int index, int gain)
/**
* Returns the data rate, in ms. Data rate applies to all 4 bridges simultaneously. Setting a slower data rate will reduce
* noise at the cost of sample time. Also note that each bridge is being sampled only 1/4 of the time - this is okay for very stable signals,
* but for changing signals, it is best to set a higher sampling rate and do averaging in the software.
* <p>
* Data rate must be a multiple of 8ms. Trying to set something between multiplies of 8 will cause an EPHIDGET_INVALIDARG exception.
* <p>
* @return Data Rate
* @throws PhidgetException If this Phidget is not opened and attached, or if the index is invalid.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(int, getDataRate,)
/**
* Sets the data rate, in ms. Data rate applies to all 4 bridges simultaneously. Setting a slower data rate will reduce
* noise at the cost of sample time. Also note that each bridge is being sampled only 1/4 of the time - this is okay for very stable signals,
* but for changing signals, it is best to set a higher sampling rate and do averaging in the software.
* <p>
* Data rate must be a multiple of 8ms. Trying to set something between multiplies of 8 will cause an EPHIDGET_INVALIDARG exception.
* <p>
* @param rate new data rate
* @throws PhidgetException If this Phidget is not opened and attached, or if the data rate is out of range
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(void, setDataRate, int rate)
/**
* Gets the minimum supported data rate, in ms.
* @return minimum supported data rate
* @throws PhidgetException If this Phidget is not opened and attached.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(int, getDataRateMin,)
/**
* Gets the maximum supported data rate, in ms.
* @return maximum supported data rate
* @throws PhidgetException If this Phidget is not opened and attached.
* See {@link com.phidgets.Phidget#open(int) open} for information on determining if a device is attached.
*/
PUBLIC_NATIVE(int, getDataRateMax,)
ENABLE_EVENTS
{
EVENT_ENABLE(bridgeData, BridgeData)
}
/**
* Adds a bridge data listener. The bridge data handler is a method that will be called at the specified data rate, for each enabled bridge. Value is the bridgeValue, in mV/V.
* <p>
* There is no limit on the number of bridge data handlers that can be registered for a particular Phidget.
*
* @param l An implemetation of the {@link com.phidgets.event.BridgeDataListener BridgeDataListener} interface
*/
EVENT(bridgeData, BridgeData, bridgeData)
}
|