So my theory of hooking up scanner with my simulator has not yet worked out so well.
I'm able to communicate, but the scanner seems to send some weird messages that it does not send when I'm passively listening b/w the scanner and ECU comms.
Spent about an hour fiddling with it to get it to communicate with ECU and send fixed values, but all I got was me getting soaked in my sweat. Was a hot day and I was determined. But today was not it.
The gist was that there were some "invalid" messages that the scanner was sending. e.g.
scanner: hello, i am sending a message which has 3 letters
my sim: oki got it. *chomps*. yup thats right. data is "WOW"
scanner: ok here's a another message which is also 3 letters.
my sim: noice. *chom-*. WUT???? data is "HELL". WHAAAA-
my sim: ok lemme read ahead what's next
my sim: oh next up was "O {next msg}". Oh so msg was "Hello", not "Hell".
SCANNER LIED about the length!
Similarly, scanner just randomly decides to send zeros without a checksum (a byte I use to know I got the right message).
It never does that when communicating with ECU. So not sure what to do with it. Maybe I need to set some delays because I could see the scanner querying A LOT of stuff (which includes the above weird crap), and since my simulator had no delay, it would respond in mere milliseconds. Will have to add some delays to make it realistic or something.
However some progress I got was that I eyeballed the data going back and forth b/w scanner and ECU and my prototype queries all 31 fields in a single message, while scanner queries I believe around 8 per message (not confirmed but it's near that number).
So that was not good because I don't really know which byte in the 8 bytes of the message corresponds to which parameter.
BUT, my hunch was right that selecting, say only 1 parameter and telling scanner to "Show selected" makes it query only those parameters. So e.g. I already knew engine rpm is made up of 2 param values, and selecting "Engine Speed" in scanner, I could see the scanner querying 2 obd addresses, while say for vehicle speed it queries only one.
So I went ahead and selected only 1 of the parameters and logged the communication going back and forth. Repeated with each parameter that works for my car.
This way I'm able to at least confirm which obd address is for what parameter. I can get rid of the "UNKNOWN_PARAM_X" from my code with this. I didn't bother logging the dead params that my car doesn't have (like oxygen sensor etc), only the ones I could see moving (or that the ecu can change in my car).
Helps me because I know the value I see in X address is for Y parameter. Will have to figure out calculation by trial though.