OBD II Protocol Specification

Hello guys,

I would like to build a new diagnostic software based on STN1110.

Is there any official specification document from OBD on how we can detect the protocol used by the ECU and how is the request format sent to ECU via the obd II connector.

Do I need to select which protocol to use before starting the comm with ECU or the STN1110 detects it automatically and sends the request in the right format?

Is there any arduino generic API that supports all protocols?

Obviously, I am a beginner but these are questions running in my head that need an answer.

Thank you.