@@ -1111,9 +1111,9 @@ protected void processInstreamResponse(boolean shouldClearCrcFromBuffer) {
11111111 }
11121112 }
11131113 else if (inStreamResponseCommand ==STATUS_RESPONSE ){
1114- byte [] responseData = readBytes (1 , inStreamResponseCommand );
1114+ byte [] responseData = readBytes (2 , inStreamResponseCommand );
11151115 if (responseData !=null ){
1116- parseStatusByte (responseData [ 0 ] );
1116+ parseStatusByte (responseData );
11171117
11181118 if (!isSupportedRtcStateInStatus ()){
11191119 if (!mIsSensing && !isInitialised ()){
@@ -2396,26 +2396,30 @@ protected byte[] readBytes(int numBytes, byte btCommand) {
23962396 /**
23972397 * @param statusByte
23982398 */
2399- protected void parseStatusByte (byte statusByte ){
2399+ protected void parseStatusByte (byte [] statusByte ){
24002400 Boolean savedDockedState = isDocked ();
24012401
2402- setIsDocked (((statusByte & (0x01 << 0 )) > 0 )? true :false );
2403- setIsSensing (((statusByte & (0x01 << 1 )) > 0 )? true :false );
2402+ setIsDocked (((statusByte [ 0 ] & (0x01 << 0 )) > 0 )? true :false );
2403+ setIsSensing (((statusByte [ 0 ] & (0x01 << 1 )) > 0 )? true :false );
24042404 //reserved(((statusByte & (0x01 << 2)) > 0)? true:false);
24052405 if (isSupportedRtcStateInStatus ()){
2406- mIsRtcSet = ((statusByte & (0x01 << 2 )) > 0 )? true :false ;
2406+ mIsRtcSet = ((statusByte [ 0 ] & (0x01 << 2 )) > 0 )? true :false ;
24072407 }
2408- setIsSDLogging (((statusByte & (0x01 << 3 )) > 0 )? true :false );
2409- setIsStreaming (((statusByte & (0x01 << 4 )) > 0 )? true :false );
2408+ setIsSDLogging (((statusByte [ 0 ] & (0x01 << 3 )) > 0 )? true :false );
2409+ setIsStreaming (((statusByte [ 0 ] & (0x01 << 4 )) > 0 )? true :false );
24102410 if (isSupportedSdInfoInStatus ()){
2411- setIsSDPresent (((statusByte & (0x01 << 5 )) > 0 )? true :false );
2412- setIsSDError (((statusByte & (0x01 << 6 )) > 0 )? true :false );
2411+ setIsSDPresent (((statusByte [ 0 ] & (0x01 << 5 )) > 0 )? true :false );
2412+ setIsSDError (((statusByte [ 0 ] & (0x01 << 6 )) > 0 )? true :false );
24132413 }
24142414 if (isSupportedRedLedStateInStatus ()){
2415- mIsRedLedOn = ((statusByte & (0x01 << 7 )) > 0 )? true :false ;
2415+ mIsRedLedOn = ((statusByte [ 0 ] & (0x01 << 7 )) > 0 )? true :false ;
24162416 }
24172417
2418- consolePrintLn ("\n Status Response = \n " + UtilShimmer .byteToHexStringFormatted (statusByte )
2418+ if (getHardwareVersion ()==HW_ID .SHIMMER_3R && getFirmwareVersionCode ()>=10 ) {
2419+ setIsUsbPluggedIn (((statusByte [1 ] & (0x01 << 0 )) > 0 )? true :false );
2420+ }
2421+
2422+ consolePrintLn ("\n Status Response = \n " + UtilShimmer .byteToHexStringFormatted (statusByte [0 ])
24192423 + "\t " + "IsDocked = " + isDocked ()
24202424 + "\t " + "IsSensing = " + mIsSensing
24212425 + "\t " + "IsRtcSet = " + mIsRtcSet
@@ -2425,6 +2429,9 @@ protected void parseStatusByte(byte statusByte){
24252429 + "\t " + "mIsSdPresent = " + isSDPresent ()
24262430 + "\t " + "mIsRedLedOn = " + mIsRedLedOn );
24272431
2432+ consolePrintLn ("\n Status Response = \n " + UtilShimmer .byteToHexStringFormatted (statusByte [1 ])
2433+ + "\t " + "IsUsbPluggedIn = " + isUsbPluggedIn ());
2434+
24282435 if (savedDockedState !=isDocked ()){
24292436 dockedStateChange ();
24302437 }
0 commit comments