<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Mark,<br>
<br>
\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.<br>
<br>
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.<br>
<br>
The twizy alert functions use that scheme, and I changed the
standard stat message functions to it as well during the sprintf()
rework.<br>
<br>
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.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 18.01.2013 04:21, schrieb Mark
Webb-Johnson:<br>
</div>
<blockquote
cite="mid:C89F20CD-67F4-4568-B1CB-EC7600AC2493@webb-johnson.net"
type="cite">Michael B,
<div><br>
</div>
<div>I see the code for push notification charge alerts
net_prep_stat() now contains:</div>
<div><br>
</div>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0
40px; border: none; padding: 0px;">
<div>
<div><font class="Apple-style-span" face="'Andale Mono'">...</font></div>
<div><font class="Apple-style-span" face="'Andale Mono'"> s =
stp_i(s, "\r SOC: ", car_SOC);</font></div>
<div><font class="Apple-style-span" face="'Andale Mono'"> s =
stp_rom(s, "%");</font></div>
</div>
<div><font class="Apple-style-span" face="'Andale Mono'">...</font></div>
</blockquote>
<div>
<div>
<div><br>
</div>
<div>which produces messages like:</div>
<div><br>
</div>
</div>
</div>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0
40px; border: none; padding: 0px;">
<div>
<div>
<div><font class="Apple-style-span" face="'Andale Mono'">rx
msg P ANot charging^M Range: 59 - 59 km^M SOC: 100%^M
ODO: 0 km</font></div>
</div>
</div>
</blockquote>
<div>
<div>
<div><br>
</div>
<div>Your vehicle_twizy_ca_msgp() function doesn't seem to
have those ^M.</div>
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<div>That said, I just tested with my car (using cmd.pl to
send a msg 6), and got:</div>
<div><br>
</div>
</div>
</div>
<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0
40px; border: none; padding: 0px;">
<div>
<div>
<div><font class="Apple-style-span" face="'Andale Mono'">rx
msg P ANot charging^M Range: 218 - 234 km^M SOC: 75%^M
ODO: 19408 km</font></div>
</div>
</div>
</blockquote>
<div>
<div>
<div><br>
</div>
<div>and the push notification came through to both iOS and
Android Apps (even though it contained ^M).</div>
<div><br>
</div>
<div>Thoughts?</div>
<div><br>
</div>
<div>Regards, Mark.</div>
<div><br>
</div>
<div>On 22 Nov, 2012, at 3:10 AM, Michael Balzer wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000"> Mark,<br>
<br>
that shed some light, thanks.<br>
<br>
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.<br>
<br>
So, everything's working now, I get the same alerts from
the App now as via SMS :-)<br>
<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/dexterbg/Open-Vehicle-Monitoring-System/commits/v2">https://github.com/dexterbg/Open-Vehicle-Monitoring-System/commits/v2</a><br>
<br>
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.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div class="moz-cite-prefix">Am 21.11.2012 02:38, schrieb
Mark Webb-Johnson:<br>
</div>
<blockquote
cite="mid:3592E69C-1D82-4F69-8755-2A7E7B157315@webb-johnson.net"
type="cite">Michael,
<div><br>
</div>
<div>Server logs for PUSH notifications:</div>
<div><br>
</div>
<blockquote class="webkit-indent-blockquote"
style="margin: 0 0 0 40px; border: none; padding:
0px;">
<div>
<div>2012-11-20 14:52:21.050617 -0500 info main:
#37 C DEXZE85 rx msg P ACharging, Topping off</div>
<div>2012-11-20 14:56:13.216180 -0500 info main:
#37 C DEXZE85 rx msg P ACharging, Topping off</div>
<div>2012-11-20 15:28:37.549081 -0500 info main:
#37 C DEXZE85 rx msg P ACharging, Topping off</div>
<div>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</div>
<div>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</div>
</div>
</blockquote>
<div>
<div>
<div><br>
</div>
<div>Times are EST.</div>
<div><br>
</div>
<div>Regards, Mark.</div>
<div><br>
</div>
<div>On 21 Nov, 2012, at 5:25 AM, Michael Balzer
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000"> Am
20.11.2012 20:47, schrieb Michael Balzer:<br>
<blockquote
cite="mid:50ABDE57.7020609@expeedo.de"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
I'm currently charging my Twizy to see if the
alert is functional now.<br>
</blockquote>
<br>
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.<br>
<br>
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!?<br>
<br>
But for that one I now do not find any TCP log
entry... is the Android App reliable concerning
the TCP log function?<br>
<br>
Mark, I'm stuck. Could you please check the
server log for this? Vehicle name now is
"DEXZE85".<br>
<br>
Thanks,<br>
Michael<br>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
</div>
<span><dexter.vcf></span>_______________________________________________<br>
OvmsDev mailing list<br>
<a moz-do-not-send="true"
href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>
<a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
</div>
<span><dexter.vcf></span>_______________________________________________<br>
OvmsDev mailing list<br>
<a moz-do-not-send="true"
href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
</body>
</html>