SAIC-iSmart-API / saic-java-client

MIT License
7 stars 4 forks source link

MQTT gateway doesn't work with Thai API #44

Open JumpLao opened 1 year ago

JumpLao commented 1 year ago

Seem like ASN1 schema for Thai API is different from other. Decoder cannot decode "net.heberling.ismart.asn1.v1_1.entity.VinInfo.brandName". Error message show "out of bound" when try to decode brandName

Screenshot 2566-06-28 at 11 20 36
JumpLao commented 1 year ago

I try to debug decoder with saic-java-api-gateway. It seem that decoder cannot decode login response correctly using MP_UserLogginResp. token part of MP_UserLogginResp is unreadable may be that why whole application body cannot be decode.

Screenshot 2566-06-28 at 14 57 51
mschmiedel commented 1 year ago

Hi,

I tried to reproduce the error using your message from the picture in a unit test, but I cannot manage to format the string properly. Could you post the message that is logged as plain text please?

tisoft commented 1 year ago

I found the difference. The Thai API uses the same API versions as the European App. But unfortunately SAIC added a languageType field in the European app, without increasing the version number. Please try out #47. The login should work there, but there might be more problems.

JumpLao commented 1 year ago

Login response decode successfully but there is no applicationData. I found that there is an error message in response body.

Screenshot 2566-07-05 at 17 53 24 Screenshot 2566-07-05 at 18 00 13

errorMessage toString: [B@1f9354e8

tisoft commented 1 year ago

The error message is a byte array, but it contains string data. You should be able to do new String(loginResponseMessage.getBody().getErrorMessage(), StandardCharsets.UTF_8) to get the message.

JumpLao commented 1 year ago

The error message is a byte array, but it contains string data. You should be able to do new String(loginResponseMessage.getBody().getErrorMessage(), StandardCharsets.UTF_8) to get the message.

I'm just forgot to change API URI to Thailand SAIC URI. Currently, the Login API is working fine, but the other APIs are not functioning properly. I will now attempt to debug the other APIs one by one

JumpLao commented 1 year ago

It appears that the MQTT gateway is using the API asn1 schema v2.1, but for Thailand, the API uses asn1 schema v2.0. You can find more information about this at the following URI: https://iov-tap.mgthai.com/TAP.Web/ota.mpv20.

Screenshot 2566-07-05 at 21 41 54
tisoft commented 1 year ago

I have added some parts of the ASN.1 schema for version 2.0. Could you try it with them?

tisoft commented 1 year ago

@JumpLao Could you try the changes in #47 If they work I could integrate them in the release versions.