@@ -1111,9 +1111,15 @@ protected void processInstreamResponse(boolean shouldClearCrcFromBuffer) {
11111111 }
11121112 }
11131113 else if (inStreamResponseCommand ==STATUS_RESPONSE ){
1114- byte [] responseData = readBytes (1 , inStreamResponseCommand );
1114+ int statusBytesToRead = 0 ;
1115+ if (isSupportedUSBPluggedInStatus ()) {
1116+ statusBytesToRead = 2 ;
1117+ }else {
1118+ statusBytesToRead = 1 ;
1119+ }
1120+ byte [] responseData = readBytes (statusBytesToRead , inStreamResponseCommand );
11151121 if (responseData !=null ){
1116- parseStatusByte (responseData [ 0 ] );
1122+ parseStatusByte (responseData );
11171123
11181124 if (!isSupportedRtcStateInStatus ()){
11191125 if (!mIsSensing && !isInitialised ()){
@@ -2396,26 +2402,26 @@ protected byte[] readBytes(int numBytes, byte btCommand) {
23962402 /**
23972403 * @param statusByte
23982404 */
2399- protected void parseStatusByte (byte statusByte ){
2405+ protected void parseStatusByte (byte [] statusByte ){
24002406 Boolean savedDockedState = isDocked ();
24012407
2402- setIsDocked (((statusByte & (0x01 << 0 )) > 0 )? true :false );
2403- setIsSensing (((statusByte & (0x01 << 1 )) > 0 )? true :false );
2408+ setIsDocked (((statusByte [ 0 ] & (0x01 << 0 )) > 0 )? true :false );
2409+ setIsSensing (((statusByte [ 0 ] & (0x01 << 1 )) > 0 )? true :false );
24042410 //reserved(((statusByte & (0x01 << 2)) > 0)? true:false);
24052411 if (isSupportedRtcStateInStatus ()){
2406- mIsRtcSet = ((statusByte & (0x01 << 2 )) > 0 )? true :false ;
2412+ mIsRtcSet = ((statusByte [ 0 ] & (0x01 << 2 )) > 0 )? true :false ;
24072413 }
2408- setIsSDLogging (((statusByte & (0x01 << 3 )) > 0 )? true :false );
2409- setIsStreaming (((statusByte & (0x01 << 4 )) > 0 )? true :false );
2414+ setIsSDLogging (((statusByte [ 0 ] & (0x01 << 3 )) > 0 )? true :false );
2415+ setIsStreaming (((statusByte [ 0 ] & (0x01 << 4 )) > 0 )? true :false );
24102416 if (isSupportedSdInfoInStatus ()){
2411- setIsSDPresent (((statusByte & (0x01 << 5 )) > 0 )? true :false );
2412- setIsSDError (((statusByte & (0x01 << 6 )) > 0 )? true :false );
2417+ setIsSDPresent (((statusByte [ 0 ] & (0x01 << 5 )) > 0 )? true :false );
2418+ setIsSDError (((statusByte [ 0 ] & (0x01 << 6 )) > 0 )? true :false );
24132419 }
24142420 if (isSupportedRedLedStateInStatus ()){
2415- mIsRedLedOn = ((statusByte & (0x01 << 7 )) > 0 )? true :false ;
2421+ mIsRedLedOn = ((statusByte [ 0 ] & (0x01 << 7 )) > 0 )? true :false ;
24162422 }
2417-
2418- consolePrintLn ("\n Status Response = \n " + UtilShimmer .byteToHexStringFormatted (statusByte )
2423+
2424+ consolePrintLn ("\n Status Response = \n " + UtilShimmer .byteToHexStringFormatted (statusByte [ 0 ] )
24192425 + "\t " + "IsDocked = " + isDocked ()
24202426 + "\t " + "IsSensing = " + mIsSensing
24212427 + "\t " + "IsRtcSet = " + mIsRtcSet
@@ -2425,6 +2431,14 @@ protected void parseStatusByte(byte statusByte){
24252431 + "\t " + "mIsSdPresent = " + isSDPresent ()
24262432 + "\t " + "mIsRedLedOn = " + mIsRedLedOn );
24272433
2434+ if (statusByte .length > 1 ) {
2435+ setIsUsbPluggedIn (((statusByte [1 ] & (0x01 << 0 )) > 0 )? true :false );
2436+
2437+ consolePrintLn ("\n Status Response = \n " + UtilShimmer .byteToHexStringFormatted (statusByte [1 ])
2438+ + "\t " + "IsUsbPluggedIn = " + isUsbPluggedIn ());
2439+
2440+ }
2441+
24282442 if (savedDockedState !=isDocked ()){
24292443 dockedStateChange ();
24302444 }
@@ -2442,6 +2456,10 @@ public boolean isSupportedSdInfoInStatus() {
24422456 return isThisVerCompatibleWith (FW_ID .LOGANDSTREAM , 0 , 7 , 12 );
24432457 }
24442458
2459+ public boolean isSupportedUSBPluggedInStatus () {
2460+ return isThisVerCompatibleWith (HW_ID .SHIMMER_3R , FW_ID .LOGANDSTREAM , 1 ,0 , 24 );
2461+ }
2462+
24452463 protected boolean isSupportedInStreamCmds () {
24462464 if ((getFirmwareIdentifier ()==FW_ID .LOGANDSTREAM
24472465 || isThisVerCompatibleWith (FW_ID .BTSTREAM , 0 , 8 , 1 ))&& getHardwareVersion ()!=HW_ID .SHIMMER_2R ){
0 commit comments