|
28 | 28 | import com.shimmerresearch.sensors.AbstractSensor.SENSORS; |
29 | 29 | import com.shimmerresearch.sensors.AbstractSensor; |
30 | 30 | import com.shimmerresearch.sensors.SensorSystemTimeStamp; |
31 | | -import com.shimmerresearch.sensors.ShimmerClock; |
| 31 | +import com.shimmerresearch.sensors.SensorShimmerClock; |
32 | 32 |
|
33 | 33 | //https://www.numed.co.uk/files/uploads/Product/Nonin%209560%20Bluetooth%20Specification.pdf |
34 | 34 | public class NoninOnyxIIDevice extends ShimmerDevice implements SerialPortListener{ |
@@ -65,7 +65,7 @@ public void setDefaultShimmerConfiguration() { |
65 | 65 | setMacIdFromUart(mUniqueID); |
66 | 66 | setShimmerUserAssignedNameWithMac("Nonin"); |
67 | 67 |
|
68 | | - setShimmerVersionInfoAndCreateSensorMap(SVO); |
| 68 | + setShimmerVersionObjectAndCreateSensorMap(SVO); |
69 | 69 | } |
70 | 70 |
|
71 | 71 | @Override |
@@ -232,49 +232,19 @@ protected void processMsgFromCallback(ShimmerMsg shimmerMSG) { |
232 | 232 | * Shimmer Device Overrides end |
233 | 233 | * ******************************************/ |
234 | 234 |
|
235 | | - //TODO neaten below. Copy/Paste from Shimmer4 |
236 | 235 | protected void dataHandler(ObjectCluster ojc) { |
237 | | -// sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_DATA_PACKET, ojc); |
238 | 236 | mDeviceCallbackAdapter.dataHandler(ojc); |
239 | 237 | } |
240 | 238 |
|
241 | | - //TODO neaten below. Copy/Paste from ShimmerBluetooth |
242 | 239 | @Override |
243 | 240 | public boolean setBluetoothRadioState(BT_STATE state) { |
244 | | - boolean changed = super.setBluetoothRadioState(state); |
245 | | - mDeviceCallbackAdapter.setBluetoothRadioState(state); |
246 | | - |
247 | | -// if(mBluetoothRadioState==BT_STATE.CONNECTED){ |
248 | | -// setIsConnected(true); |
249 | | -// setIsInitialised(true); |
250 | | -// setIsStreaming(false); |
251 | | -// } |
252 | | -// else if(mBluetoothRadioState==BT_STATE.STREAMING){ |
253 | | -// setIsStreaming(true); |
254 | | -// } |
255 | | -// else if((mBluetoothRadioState==BT_STATE.DISCONNECTED) |
256 | | -// ||(mBluetoothRadioState==BT_STATE.CONNECTION_LOST) |
257 | | -// ||(mBluetoothRadioState==BT_STATE.CONNECTION_FAILED)){ |
258 | | -// setIsConnected(false); |
259 | | -// setIsStreaming(false); |
260 | | -// setIsInitialised(false); |
261 | | -// } |
262 | | -// |
263 | | -// CallbackObject callBackObject = new CallbackObject(ShimmerBluetooth.NOTIFICATION_SHIMMER_STATE_CHANGE, state, getMacIdFromUart(), getComPort()); |
264 | | -// sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_STATE_CHANGE, callBackObject); |
265 | | - return changed; |
| 241 | + boolean isChanged = super.setBluetoothRadioState(state); |
| 242 | + mDeviceCallbackAdapter.setBluetoothRadioState(state, isChanged); |
| 243 | + return isChanged; |
266 | 244 | } |
267 | 245 |
|
268 | | - //TODO neaten below. Copy/Paste from Shimmer4 |
269 | 246 | public void isReadyForStreaming(){ |
270 | 247 | mDeviceCallbackAdapter.isReadyForStreaming(); |
271 | | -// setIsInitialised(true); |
272 | | -// |
273 | | -// CallbackObject callBackObject = new CallbackObject(ShimmerBluetooth.NOTIFICATION_SHIMMER_FULLY_INITIALIZED, getMacIdFromUart(), getComPort()); |
274 | | -// sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_NOTIFICATION_MESSAGE, callBackObject); |
275 | | -// if (getBluetoothRadioState()==BT_STATE.CONNECTING){ |
276 | | -// setBluetoothRadioState(BT_STATE.CONNECTED); |
277 | | -// } |
278 | 248 | } |
279 | 249 |
|
280 | 250 | //TODO neaten below. Copy/Paste from Shimmer4 |
@@ -302,30 +272,33 @@ public void eventConnected() { |
302 | 272 | } |
303 | 273 |
|
304 | 274 | @Override |
305 | | - public void calculatePacketReceptionRateCurrent(int timeDifference) { |
306 | | - setPacketReceptionRateCurrent(calculatePacketLossCurrent(timeDifference, getSamplingRateShimmer())); |
307 | | - CallbackObject callBackObject = new CallbackObject(ShimmerBluetooth.MSG_IDENTIFIER_PACKET_RECEPTION_RATE_CURRENT, getMacId(), getComPort(), getPacketReceptionRateCurrent()); |
308 | | - sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_PACKET_RECEPTION_RATE_CURRENT, callBackObject); |
309 | | - resetPacketReceptionCurrentCounters(); |
310 | | - } |
311 | | - |
312 | | - //TODO neaten below. Copy/Paste from ShimmerGQ |
313 | | - public double calculatePacketLossCurrent(long timeDifference, double samplingRate){ |
314 | | - mPacketExpectedCountCurrent = (long) ((double)((timeDifference/1000)*samplingRate)); |
315 | | - return calculatePacketLossCurrent(mPacketExpectedCountCurrent, mPacketReceivedCountCurrent); |
316 | | - } |
317 | | - |
318 | | - //TODO neaten below. Copy/Paste from ShimmerGQ |
319 | | - public double calculatePacketLossCurrent(){ |
320 | | - return calculatePacketLossCurrent(mPacketExpectedCountCurrent, mPacketReceivedCountCurrent); |
| 275 | + public void calculatePacketReceptionRateCurrent(int intervalMs) { |
| 276 | + super.calculatePacketReceptionRateCurrent(intervalMs); |
| 277 | + mDeviceCallbackAdapter.sendCallbackPacketReceptionRateCurrent(); |
| 278 | + |
| 279 | +// setPacketReceptionRateCurrent(calculatePacketLossCurrent(intervalMs, getSamplingRateShimmer())); |
| 280 | +// CallbackObject callBackObject = new CallbackObject(ShimmerBluetooth.MSG_IDENTIFIER_PACKET_RECEPTION_RATE_CURRENT, getMacId(), getComPort(), getPacketReceptionRateCurrent()); |
| 281 | +// sendCallBackMsg(ShimmerBluetooth.MSG_IDENTIFIER_PACKET_RECEPTION_RATE_CURRENT, callBackObject); |
| 282 | +// resetPacketReceptionCurrentCounters(); |
321 | 283 | } |
322 | 284 |
|
323 | | - //TODO neaten below. Copy/Paste from ShimmerGQ |
324 | | - private double calculatePacketLossCurrent(long packetExpectedCount, long packetReceivedCount){ |
325 | | - setPacketReceptionRateCurrent((double)((packetReceivedCount)/(double)packetExpectedCount)*100); |
326 | | - //TODO 2016-09-06 remove below because if it is going to be implemented it should be in the method setPacketReceptionRateCurrent()? |
327 | | - setPacketReceptionRateCurrent(UtilShimmer.nudgeDouble(getPacketReceptionRateCurrent(), 0.0, 100.0)); |
328 | | - return getPacketReceptionRateCurrent(); |
329 | | - } |
| 285 | +// //TODO neaten below. Copy/Paste from ShimmerGQ |
| 286 | +// public double calculatePacketLossCurrent(long timeDifference, double samplingRate){ |
| 287 | +// mPacketExpectedCountCurrent = (long) ((double)((timeDifference/1000)*samplingRate)); |
| 288 | +// return calculatePacketLossCurrent(mPacketExpectedCountCurrent, mPacketReceivedCountCurrent); |
| 289 | +// } |
| 290 | +// |
| 291 | +// //TODO neaten below. Copy/Paste from ShimmerGQ |
| 292 | +// public double calculatePacketLossCurrent(){ |
| 293 | +// return calculatePacketLossCurrent(mPacketExpectedCountCurrent, mPacketReceivedCountCurrent); |
| 294 | +// } |
| 295 | +// |
| 296 | +// //TODO neaten below. Copy/Paste from ShimmerGQ |
| 297 | +// private double calculatePacketLossCurrent(long packetExpectedCount, long packetReceivedCount){ |
| 298 | +// setPacketReceptionRateCurrent((double)((packetReceivedCount)/(double)packetExpectedCount)*100); |
| 299 | +// //TODO 2016-09-06 remove below because if it is going to be implemented it should be in the method setPacketReceptionRateCurrent()? |
| 300 | +// setPacketReceptionRateCurrent(UtilShimmer.nudgeDouble(getPacketReceptionRateCurrent(), 0.0, 100.0)); |
| 301 | +// return getPacketReceptionRateCurrent(); |
| 302 | +// } |
330 | 303 |
|
331 | 304 | } |
0 commit comments