Adb command(s) to get screen state and locked state Background:

I'm using automated tests on many different variants of devices (Samsung tablets and smartphones such as Galaxy A5, S8, S7 etc.) where the devices have different versions of Android (6.0, 6.0.1, 7.0 and 7.1.1) - all in varying combinations.

Some of my tests require locking the screen (turning it off) and then turning it on and PIN-ing in. I have not been able to find a (universal) adb-command to get the phones' state. Ideally, I would like one command to tell me in which of the following states the phone is in:


Screen turned off (Assumed locked as well)
Screen turned on, locked
Screen turned on, unlocked


My best solution so far is to use the following 2 (bash terminal) commands:

#1:
adb shell dumpsys display | grep "mScreenState"

#2:
adb shell service call trust 7


Command #1 tells me whether the screen is on, off or "dozed".

Command #2 tells me whether the phone is locked or unlocked.

Questions: 

Is there a single adb command which can give me the information I need? Is this command compatible with the Android versions listed above? 

On Android version 6.* command #2 always indicates that the phone is locked. What is the "Android 6.* compatible" alternative of command #2?  ----> By pure chance I found that "service call trust 6" works as expected on Android 6. devices!*

Note:

The resource I've found that most closely resembles my issue is the following SO question/response. However, not all of the devices have/use NFC so the following command (although compatible with most devices/versions) is not acceptable in my tests:

adb shell dumpsys nfc | grep 'mScreenState='


Since timing is an issue, the proposed solution (best answer in the link) is not acceptable either.
I am a Windows fanboy, so the solution contains find instead of using grep, just replace find with grep.

adb shell dumpsys power | find "mWakefulness="
adb shell dumpsys power | find "mHoldingWakeLockSuspendBlocker=" 



  Screen OFF and Locked = mWakefulness=Asleep &amp; 
  mHoldingWakeLockSuspendBlocker=false
  
  Screen ON and Locked = mWakefulness=Awake &amp; 
  mHoldingWakeLockSuspendBlocker=false
  
  Screen ON and Unlocked = mWakefulness=Awake &amp; 
  mHoldingWakeLockSuspendBlocker=true


P.S: I've tested it on Android 7.0, don't know if it'll work with other versions.