[Ovmsdev] Merging in Twizy and Volt/Ampera work

Michael Balzer dexter at expeedo.de
Fri Jan 18 22:38:24 HKT 2013


Mark,

\n was causing problems in push alerts, breaking the protocol. I also 
wanted to factorize alert text preparation into one function to save 
space, but \r is wrong (or meaningless) for SMS messages.

My solution is to use only \r in the prep functions and to convert those 
to \n for SMS channels using cr2lf() just before sending.

The twizy alert functions use that scheme, and I changed the standard 
stat message functions to it as well during the sprintf() rework.

vehicle_twizy_ca_msgp() does not use that scheme because it sends a 
standard one line command reply, not a text notification. Have a look at 
vehicle_twizy_stat_prepmsg() and vehicle_twizy_power_prepmsg() for other 
text alerts.

Regards,
Michael


Am 18.01.2013 04:21, schrieb Mark Webb-Johnson:
> Michael B,
>
> I see the code for push notification charge alerts net_prep_stat() now 
> contains:
>
>     ...
>       s = stp_i(s, "\r SOC: ", car_SOC);
>       s = stp_rom(s, "%");
>     ...
>
>
> which produces messages like:
>
>     rx msg P ANot charging^M Range: 59 - 59 km^M SOC: 100%^M ODO: 0 km
>
>
> Your vehicle_twizy_ca_msgp() function doesn't seem to have those ^M.
>
> Your message below seems to indicate you've seen this as a problem 
> (having embedded carriage returns in the alerts). Or, is it the \n 
> (not \r) that caused the problem?
>
> That said, I just tested with my car (using cmd.pl to send a msg 6), 
> and got:
>
>     rx msg P ANot charging^M Range: 218 - 234 km^M SOC: 75%^M ODO:
>     19408 km
>
>
> and the push notification came through to both iOS and Android Apps 
> (even though it contained ^M).
>
> Thoughts?
>
> Regards, Mark.
>
> On 22 Nov, 2012, at 3:10 AM, Michael Balzer wrote:
>
>> Mark,
>>
>> that shed some light, thanks.
>>
>> It now seems it was not a bug but a combination of a) my poor garage 
>> GPRS connectivity, b) the MSG protocol and/or App not allowing for 
>> "\n" within alert text and c) me not remembering to put the App to 
>> background in time so the notification would really be displayed by 
>> Android.
>>
>> So, everything's working now, I get the same alerts from the App now 
>> as via SMS :-)
>>
>> https://github.com/dexterbg/Open-Vehicle-Monitoring-System/commits/v2
>>
>> Regarding cr2lf(): I think it would be nice if we could just use one 
>> kind of line break throughout all texts without having to recode them 
>> according to the transport. I thought about modifying the transport 
>> layer functions to recode text accordingly, but that's quite 
>> lowlevel, so I now introduced this utility as a workaround. Maybe we 
>> can eliminate that later.
>>
>> Regards,
>> Michael
>>
>>
>> Am 21.11.2012 02:38, schrieb Mark Webb-Johnson:
>>> Michael,
>>>
>>> Server logs for PUSH notifications:
>>>
>>>     2012-11-20 14:52:21.050617 -0500 info  main: #37 C DEXZE85 rx
>>>     msg P ACharging, Topping off
>>>     2012-11-20 14:56:13.216180 -0500 info  main: #37 C DEXZE85 rx
>>>     msg P ACharging, Topping off
>>>     2012-11-20 15:28:37.549081 -0500 info  main: #37 C DEXZE85 rx
>>>     msg P ACharging, Topping off
>>>     2012-11-20 15:40:48.776406 -0500 info  main: #80 C DEXZE85 rx
>>>     msg P ACharging, Topping off Range: 46 - 66 km SOC: 83% (8194 -
>>>     8302) ODO: 3730 Km
>>>     2012-11-20 16:00:15.659214 -0500 info  main: #53 C DEXZE85 rx
>>>     msg P ACharging, Topping off Range: 51 - 74 km SOC: 93% (8696 -
>>>     9304) ODO: 3730 Km
>>>
>>>
>>> Times are EST.
>>>
>>> Regards, Mark.
>>>
>>> On 21 Nov, 2012, at 5:25 AM, Michael Balzer wrote:
>>>
>>>> Am 20.11.2012 20:47, schrieb Michael Balzer:
>>>>> I'm currently charging my Twizy to see if the alert is functional now.
>>>>
>>>> Ok, this is getting strange now... everything else works, calling 
>>>> cmd 6 in diag mode, SMS alerts etc., just the App wouldn't alert 
>>>> me. I found a "PA" entry in the Apps "TCP log" output that was cut 
>>>> down to the charge state line, so I thought maybe it's the "\r\n" I 
>>>> had put into the alert text to structure it.
>>>>
>>>> I removed all of the line breaks and the first two alerts again did 
>>>> not come through to the App -- but the third one just did, in 
>>>> perfect shape!?
>>>>
>>>> But for that one I now do not find any TCP log entry... is the 
>>>> Android App reliable concerning the TCP log function?
>>>>
>>>> Mark, I'm stuck. Could you please check the server log for this? 
>>>> Vehicle name now is "DEXZE85".
>>>>
>>>> Thanks,
>>>> Michael
>>>>
>>>> -- 
>>>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>>>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>>>> <dexter.vcf>_______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.teslaclub.hk <mailto:OvmsDev at lists.teslaclub.hk>
>>>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>>>
>>>
>>>
>>> _______________________________________________
>>> OvmsDev mailing list
>>> OvmsDev at lists.teslaclub.hk
>>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>>
>> -- 
>> Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
>> Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
>> <dexter.vcf>_______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.teslaclub.hk <mailto:OvmsDev at lists.teslaclub.hk>
>> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
>
>
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.teslaclub.hk/pipermail/ovmsdev/attachments/20130118/c8df38ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dexter.vcf
Type: text/x-vcard
Size: 206 bytes
Desc: not available
URL: <http://lists.teslaclub.hk/pipermail/ovmsdev/attachments/20130118/c8df38ac/attachment.vcf>


More information about the OvmsDev mailing list