[Ovmsdev] Android client crashes

Michael Balzer dexter at expeedo.de
Sun Nov 5 18:31:22 HKT 2017


Hardening the Android message parser has been on my list for too long…  :-/

The Android App parses the drive mode as an integer. It's a bug it doesn't parse it as a hexadecimal integer, I'll fix that (may explain some spurious App
crashes). It's interpreted as a bitfield only when the car is a Twizy.

I think the drivemode should generally be a drive profile number, as there won't be a common definition of profile names/labels. If labels can be assigned to
the profiles, the profile label could be set in another metric.

I've pulled your fix and will change the metric type to integer now.



Am 05.11.2017 um 09:42 schrieb Tom Parker:
> I found a couple of new android client crashes.
>
> One was caused by the TPMS message which I've sent a pull request to fix.
>
> The other crash is in the GPS message. The v2 car module's car_drivemode is a hex encoded char. In v3 this has turned into a string which defaults to
> 'standard'. The android client crashes on receipt of this message. I'm not sure how to fix this, the field is only used by the twizzy (as a bit field) and I'm
> not sure the intention of the ms_v_env_drivemode string metric is.
>
> In the meantime this patch avoids the crash
>
> diff --git a/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp b/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
> index 9d3a6ad..eddb89f 100644
> --- a/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
> +++ b/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
> @@ -558,7 +558,7 @@ void OvmsServerV2::TransmitMsgGPS(bool always)
>    else
> buffer.append(StandardMetrics.ms_v_pos_speed->AsString("0",Mph).c_str());
>    buffer.append(",");
> - buffer.append(StandardMetrics.ms_v_env_drivemode->AsString("standard").c_str());
> +  buffer.append("0"); // car_drivemode
>    buffer.append(",");
> buffer.append(StandardMetrics.ms_v_bat_power->AsString("0",Other,1).c_str());
>    buffer.append(",");
>
>

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26





More information about the OvmsDev mailing list