<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Florent Clairambault &#187; TC65</title>
	<atom:link href="http://florent.clairambault.fr/tag/tc65/feed" rel="self" type="application/rss+xml" />
	<link>http://florent.clairambault.fr</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 19:56:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>TC65 Development document updated</title>
		<link>http://florent.clairambault.fr/tc65-development-document-updated?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tc65-development-document-updated</link>
		<comments>http://florent.clairambault.fr/tc65-development-document-updated#comments</comments>
		<pubDate>Wed, 30 Mar 2011 22:40:49 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3348</guid>
		<description><![CDATA[Hi everyone, I updated the TC65Dev document. Mostly because there&#8217;s a good chance I will only have less free time. I modified few parts and added some new content. It is now 50 pages long, this is a lot more than I originally intended to do. Click here to get it]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>I updated the TC65Dev document. Mostly because there&#8217;s a good chance I will only have less free time. I modified few parts and added some new content. It is now 50 pages long, this is a lot more than I originally intended to do.</p>
<p><a href="http://www.webingenia.com/static/doc/TC65Dev.pdf">Click here to get it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65-development-document-updated/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Cinterion development materials removed</title>
		<link>http://florent.clairambault.fr/cinterion-development-material-removed?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cinterion-development-material-removed</link>
		<comments>http://florent.clairambault.fr/cinterion-development-material-removed#comments</comments>
		<pubDate>Thu, 13 Jan 2011 21:18:32 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[TC65]]></category>
		<category><![CDATA[TC65 tools]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3248</guid>
		<description><![CDATA[Hi the Cinterion community, Cinterion France asked me to remove all the Cinterion TC65 / TC65i development materials I published on my blog. The good news is you can contact the Cinterion office of your country and sign a NDA to get the latest version of their manuals and SDK.]]></description>
			<content:encoded><![CDATA[<p>Hi the Cinterion community,</p>
<p>Cinterion France asked me to remove all the Cinterion TC65 / TC65i development materials I published on my blog. The good news is you can contact the Cinterion office of your country and sign a <a href="http://en.wikipedia.org/wiki/Non-disclosure_agreement">NDA</a> to get the latest version of their manuals and SDK.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/cinterion-development-material-removed/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>TC65SH for Cinterion TC65/TC65i development</title>
		<link>http://florent.clairambault.fr/tc65sh-for-cinterion-tc65-tc65i-development?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tc65sh-for-cinterion-tc65-tc65i-development</link>
		<comments>http://florent.clairambault.fr/tc65sh-for-cinterion-tc65-tc65i-development#comments</comments>
		<pubDate>Mon, 10 Jan 2011 19:57:10 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=3219</guid>
		<description><![CDATA[Hi the TC65 community, There&#8217;s a new software in town, after JOBexFTP from Ricardo Schmidt, Christoph Vilsmeier decided to create the TC65SH tool which apparently does the same thing but faster. Best regards, Here is the mail that brouht the good news: Hello Florent, I&#8217;ve done some TC65 development recently and found your site very [...]]]></description>
			<content:encoded><![CDATA[<p>Hi the TC65 community,</p>
<p>There&#8217;s a new software in town, after <a href="http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt">JOBexFTP from Ricardo Schmidt</a>, <a href="http://www.vilsmeier-consulting.de/">Christoph Vilsmeier</a> decided to create the <a href="http://www.vilsmeier-consulting.de/tc65sh.html">TC65SH</a> tool which apparently does the same thing but faster.</p>
<p>Best regards,</p>
<hr />
Here is the mail that brouht the good news:</p>
<div style="border: 1px solid gray; background-color: #eef; padding: 5px; text-align: justify">
Hello Florent,</p>
<p>I&#8217;ve done some TC65 development recently and found your site very helpful, especially your articles about TC65 development. Thank you for that!</p>
<p>I ran into some problems with the Cinterion SDK, especially the Module Exchange Suite (MES). Basically, it didn&#8217;t work for me. Cinterion support told us that MES doesn&#8217;t work on Windows 7 and they are working on a solution, well&#8230; (I tried it on WindowsXP too. There, it worked better but was still very unreliable.)</p>
<p>In the meantime, I checked out JObexFTP from Ricardo Schmidt, which I found via your blog. That tool did help me quite a lot, as it let me (after fixing it a little bit) upload files to the device via a USB-serial port adapter. But i missed an interactive mode. And I wasn&#8217;t too happy about the fact that for each file upload or download, JObexFTP does a complete connect-upload-disconnect cycle, which I found was pretty time-consuming.</p>
<p>Inspired by JObexFTP, I started to write my own Java tool for communicating with a Siemens/Cinterion TC65 device: TC65SH lets you upload, download and delete files, navigate the directory structure of the device, create and remove directories and completely erase the device&#8217;s flash memory.<br />
The program provides both an interactive command line (like a unix shell or a Windows command prompt) and a batch-processing function, which makes for easy integration into development build scripts.</p>
<p>I wanted to let you know that TC65SH is available free and Open Source from my web page at:</p>
<p>http://www.vilsmeier-consulting.de/tc65sh.html</p>
<p>Thank you for your attention and thank you for your great site.</p>
<p>Christoph Vilsmeier
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65sh-for-cinterion-tc65-tc65i-development/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>TC65FM : TC65 Fast Manager</title>
		<link>http://florent.clairambault.fr/tc65fm-tc65-fast-manager?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tc65fm-tc65-fast-manager</link>
		<comments>http://florent.clairambault.fr/tc65fm-tc65-fast-manager#comments</comments>
		<pubDate>Wed, 21 Jul 2010 20:00:02 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[TC65]]></category>
		<category><![CDATA[TC65 tools]]></category>
		<category><![CDATA[TC65FM]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2919</guid>
		<description><![CDATA[I did this program because I had to reprogram some chips without a working MES deployment environment. I could deploy the TC65 program on a server but not upload it on the chip. And then I thought it could do a nice application for all the people deploying TC65 programs in a production environment. What [...]]]></description>
			<content:encoded><![CDATA[<p>I did this program because I had to reprogram some chips without a working MES deployment environment. I could deploy the TC65 program on a server but not upload it on the chip. And then I thought it could do a nice application for all the people deploying TC65 programs in a production environment.</p>
<p>What this program basically does is to respond to &#8220;^SYSSTART&#8221; messages coming from the TC65 chip to launch an OTAP update and/or launch the program. But in the details it does a little bit more as it can auto-detect the port of the chip.</p>
<p>Some of the features might not be working great or even not working at all. The program will be improved with the time, my testings and your comments but it&#8217;s currently used for my own needs.</p>
<p><strong>You can <a href="http://florent.clairambault.fr/downloads/tc65fm.exe">download it</a>.</strong></p>
<p>Here is the &#8220;-h&#8221; output :</p>

<div class="wp_codebox"><table><tr id="p29196"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code" id="p2919code6"><pre class="sh" style="font-family:monospace;">TC65FM 0.1 - Fast Manager - Copyright WebIngenia 2010
&nbsp;
 -b  --behavior &lt;behavior&gt;     Behavior, can be : 
       i  / install              Install only
       r  / run                  Run only
       ri / run-and-install      Run and install
       n  / none                 Nothing
 -na --net-apn &lt;apn&gt;           Network APN
 -nu --net-user &lt;user&gt;         Network User
 -np --net-password &lt;password&gt; Network password
 -nd --net-dns &lt;dns&gt;           Network DNS
 -au --application-url &lt;url&gt;   Application url
 -sA --serial-autodetect       Serial auto-Detect
 -sp --serial-port &lt;port&gt;      Serial port (default: COM4)
 -ss --serial-speed &lt;speed&gt;    Serial speed (defau:t 9600)
 -tp --target-program          Target program
 -ni --no-ipr                  Desactivate IPR command (not recommended)
 -ae --autostart-enable        Enable autostart
 -ad --autostart-disable       Disable autostart
 -at --autostart-time          Time before autostart
 -pc --password-current        Current password
 -pn --password-next           Next password
 -h  --help                    This help</pre></td></tr></table></div>

<p>There&#8217;s also a &#8220;network autodetection&#8221; feature which is in a very early stage. So if you want to test it you can using the &#8220;-nA&#8221; option (but you shouldn&#8217;t).</p>
<p>Let&#8217;s say you want to automatically install the program each time a chip (configured with a serial baudrate of 9600) connects to the COM4 port :</p>

<div class="wp_codebox"><table><tr id="p29197"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2919code7"><pre class="bash" style="font-family:monospace;">tc65fm <span style="color: #660033;">-sp</span> COM4 <span style="color: #660033;">-ss</span> <span style="color: #000000;">9600</span> <span style="color: #660033;">-na</span> <span style="color: #ff0000;">&quot;m2minternet&quot;</span> <span style="color: #660033;">-nu</span> <span style="color: #ff0000;">&quot;http://webingenia.com/myPath/myApp.jad&quot;</span> <span style="color: #660033;">-tg</span> <span style="color: #ff0000;">&quot;a:/wim2msoft.jad&quot;</span></pre></td></tr></table></div>

<p>The program creates two types of log files. One for the complete running time and one for each communication with the chip occuring after a restart (and the identification of the chip by its IMEI).</p>
<p>Here is the logs of what you should get at each chip startup with this app :</p>

<div class="wp_codebox"><table><tr id="p29198"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p2919code8"><pre class="txt" style="font-family:monospace;">TC65FM v0.1 - Copyright Webingenia - www.webingenia.com
2010-07-17 09:43:25.682 | &lt;-- AT
2010-07-17 09:43:25.733 | --&gt; AT
2010-07-17 09:43:25.748 | --&gt; OK
2010-07-17 09:43:25.766 | &lt;-- AT+IPR=9600
2010-07-17 09:43:25.828 | --&gt; AT+IPR=9600
2010-07-17 09:43:25.829 | --&gt; OK
2010-07-17 09:43:25.847 | &lt;-- AT+CFUN=1,1
2010-07-17 09:43:25.908 | --&gt; AT+CFUN=1,1
2010-07-17 09:43:26.932 | --&gt; OK
2010-07-17 09:43:30.164 | --&gt; ^SYSSTART
2010-07-17 09:43:30.169 | &lt;-- AT+CGSN
2010-07-17 09:43:30.228 | --&gt; AT+CGSN
2010-07-17 09:43:30.292 | --&gt; 353234023540741
2010-07-17 09:43:30.292 | --&gt; OK</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p29199"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p2919code9"><pre class="txt" style="font-family:monospace;">TC65FM v0.1 - Copyright Webingenia - www.webingenia.com
2010-07-17 09:43:31.174 | &lt;-- ATE1
2010-07-17 09:43:31.236 | --&gt; ATE1
2010-07-17 09:43:31.253 | --&gt; OK
2010-07-17 09:43:31.256 | &lt;-- AT^SJOTAP=,http://webingenia.com:8080/myPath/myApp.jad,a:,,,gprs,m2minternet,,,,,,
2010-07-17 09:43:31.413 | --&gt; AT^SJOTAP=,http://webingenia.com:8080/myPath/myApp.jar,a:,,,gprs,m2minternet,,,,,,
2010-07-17 09:43:31.461 | --&gt; OK
2010-07-17 09:43:31.477 | &lt;-- AT^SJOTAP
2010-07-17 09:43:31.540 | --&gt; AT^SJOTAP
2010-07-17 09:43:31.573 | --&gt; OK
2010-07-17 09:43:31.578 | &lt;-- AT^SCFG=&quot;Trace/Syslog/OTAP&quot;,&quot;1&quot;
2010-07-17 09:43:31.668 | --&gt; AT^SCFG=&quot;Trace/Syslog/OTAP&quot;,&quot;1&quot;
2010-07-17 09:43:31.685 | --&gt; SYSLOG ENABLED
2010-07-17 09:43:47.622 | --&gt; [OTAP] GPRS connection established.
2010-07-17 09:43:47.702 | --&gt; [OTAP] Try to get http://webingenia.com:8080/myPath/myApp.jad ...
2010-07-17 09:43:51.812 | --&gt; [OTAP] Connected.
2010-07-17 09:43:51.861 | --&gt; [OTAP] Transfer finished.
2010-07-17 09:43:51.941 | --&gt; [OTAP] Try to get http://webingenia.com:8080/myPath/myApp.jar ...
2010-07-17 09:44:01.781 | --&gt; [OTAP] Connected.
2010-07-17 09:44:02.340 | --&gt; [OTAP] Transfer finished.
2010-07-17 09:44:05.541 | --&gt; [OTAP] JAM status: 900 Success.
2010-07-17 09:44:11.524 | --&gt; [OTAP] Reboot now.
2010-07-17 09:44:11.540 | --&gt; ^SYSSTART
2010-07-17 09:44:11.544 | &lt;-- AT+CGSN
2010-07-17 09:44:11.605 | --&gt; AT+CGSN
2010-07-17 09:44:11.652 | --&gt; 353234023540741
2010-07-17 09:44:11.668 | --&gt; OK</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p291910"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p2919code10"><pre class="txt" style="font-family:monospace;">TC65FM v0.1 - Copyright Webingenia - www.webingenia.com
2010-07-17 09:44:12.048 | &lt;-- AT^SJRA=a:/secretApp.jad
2010-07-17 09:44:12.132 | --&gt; AT^SJRA=a:/secretApp.jad
2010-07-17 09:44:12.389 | --&gt; OK
2010-07-17 09:44:13.652 | --&gt; WIM2MSoft
2010-07-17 09:44:14.036 | --&gt; Thread-5 : [1/7] Initiating...
2010-07-17 09:44:14.534 | --&gt; Thread-5 : [2/7] Loading settings...
2010-07-17 09:44:15.126 | --&gt; Thread-5 : [3/7] main AT Command interface...
2010-07-17 09:44:15.222 | --&gt; Thread-5 : [4/7] Loading SMS Management...
2010-07-17 09:44:15.510 | --&gt; Thread-5 : [5/7] Checking SIM card...
2010-07-17 09:44:20.676 | --&gt; Thread-5 : [6/7] Loading M2MP network communication...
2010-07-17 09:44:21.908 | --&gt; Thread-5 : [7/7] Loading the main program...
2010-07-17 09:44:32.485 | --&gt; nwr : NetworkLayer.Connect : Could not connect to 84.14.33.44:3000 ex : class javax.microedition.io.ConnectionNotFoundException :  Remote host has rejected the connection.
2010-07-17 09:44:53.845 | --&gt; nwr : NetworkLayer.Connect : Could not connect to 84.14.33.44:3000 ex : class javax.microedition.io.ConnectionNotFoundException :  Remote host has rejected the connection.</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65fm-tc65-fast-manager/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A little TC65 development document</title>
		<link>http://florent.clairambault.fr/tc65dev-document?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tc65dev-document</link>
		<comments>http://florent.clairambault.fr/tc65dev-document#comments</comments>
		<pubDate>Sun, 13 Jun 2010 16:47:19 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2785</guid>
		<description><![CDATA[During the last months I spent some time writing a document on the TC65 development. It is primary aimed at TC65 project managers and developers. This document can be considered as a draft and I&#8217;m waiting for any of your comments to fix / improve / complete it. It&#8217;s currently 40 pages long. Here is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i.mivi.fr/85978f19836fda42f7bc43e25d1c05e80ca0e15f.x.300.png" style="position: relative; float: right; margin-left: 10px" /></p>
<p>During the last months I spent some time writing a document on the TC65 development. It is primary aimed at TC65 project managers and developers.</p>
<p>This document can be considered as a draft and I&#8217;m waiting for any of your comments to fix / improve / complete it. It&#8217;s currently 40 pages long.</p>
<p>Here is <a href="http://www.webingenia.com/static/doc/TC65Dev.pdf">the document</a>. I also added it to our <a href="http://webingenia.com/cinterion-tc65i">Cinterion TC65i page on our website</a>.</p>
<p><strong>Oct 10, 2010 : Update</strong><br />
I updated the document to speak about libraries and fixed some few things.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65dev-document/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>JObexFTP from Ricardo Schmidt</title>
		<link>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jobexftp-from-ricardo-schmidt</link>
		<comments>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt#comments</comments>
		<pubDate>Sat, 19 Dec 2009 22:20:31 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[JObexFTP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MES]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2216</guid>
		<description><![CDATA[Ricardo Schmidt made a great multi-platform TC65 control and file management tool called JOBextFTP. This can be used for anyone whose Module Exchange Suite (MES) doesn&#8217;t work or doesn&#8217;t work correctly. The biggest effort is put on managing the OBEX file transmission protocol, but it also does offer some simple methods that can be integrated [...]]]></description>
			<content:encoded><![CDATA[<p>Ricardo Schmidt made a great multi-platform TC65 control and file management tool called <a href="https://github.com/3esmit/JObexFTP">JOBextFTP</a>. This can be used for anyone whose <a href="http://florent.clairambault.fr/tag/mes">Module Exchange Suite (MES)</a> doesn&#8217;t work or doesn&#8217;t work correctly.</p>
<p>The biggest effort is put on managing the OBEX file transmission protocol, but it also does offer some simple methods that can be integrated in your development process, like &#8220;turnOn&#8221;, &#8220;turnOff&#8221;, &#8220;getTime&#8221;, &#8220;runApp&#8221;.</p>
<p>I&#8217;m really sorry but I didn&#8217;t take the time to test it as I&#8217;m currently not making some TC65 development. But it looks very operational to me.</p>
<p>Maybe I should start a list of useful TC65 softwares. I can already see this one to help you deploy programs and files locally and my <a href="http://florent.clairambault.fr/sms-otap-program-for-the-tc65-updated">SMSOTAP</a> to help you deploy programs remotely.</p>
<p><a name="2011-02-24"></a><br />
<strong style="color: red">Update: JObexFTP 2.4</strong><br />
<em>Thu, Feb 24, 2011 at 00:51</em></p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello,</p>
<p>You recieved this email due your interest in JObexFTP.</p>
<p>JObexFTP have new cool features!<br />
Now we can:<br />
- move files and folder with mv command<br />
- change mode of files and folder with chmod command<br />
- see the total disk space and the free space.</p>
<p>Checkout the changelog from the past 2 releases:</p>
<p>JObexFTP 2.4<br />
- Added disk information in about command<br />
- Added move (mv) operation<br />
- Added change mode (chmod) operation<br />
JObexFTP 2.3<br />
- Improved ObexClose.<br />
- Improved estability.<br />
- Faster operations.<br />
- Code clean up.<br />
- Fixed getContents of binary OBEXFile</p>
<p>Thank you for the attention!
</p></div>
<p><a name="2011-01-29"></a><br />
<strong style="color: red">Update: New interface</strong><br />
<em>Sat, Jan 29, 2011 at 08:12</em></p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello,</p>
<p>You received this email due your interest in JObexFTP.</p>
<p>New utilities: emulator and cmd_autoexec_off.sh<br />
New TC65SH UI: An improved user interface based on TC65SH 1.2.0<br />
Makefile: just type `make &#038;&#038; sudo make install` and call it by<br />
`jobexftp` from anywhere in your linux. (It also installs the rxtxlib)</p>
<p>Using JObexFTP emulator with your IDE your going to send files to<br />
module, execute and follow their output, all in the IDE. Stack Traces<br />
are automatically parsed by IDE and shown in a programmer friendly way.<br />
Check out attached screen shot.<br />
JObexFTP emulator also turns on your device if is not yet, and attempts<br />
to leave data mode if no response to at commands (just using echo and<br />
cat).</p>
<p>binaries, libraries and sources available to download in github</p>
<p>https://github.com/3esmit/JObexFTP/</p>
<p>Any feature request, issues, experiences or improvements with JObexFTP<br />
please contact me, I will be pleased in have your feedback.</p>
<p>Thank you for the attention,<br />
Ricardo Guilherme Schmidt
</p></div>
<p><strong style="color: red">Update : JObexFTP version 2.0</strong><br />
Ricardo Schmidt sent an other mail about his project on the <a href="https://groups.google.com/forum/#!forum/javacint" target="_blank">javacint group</a>, on Oct 22, 2010 at 14:51 :</p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello community,</p>
<p>I&#8217;ve just released JOBEXFTP 2.0 (beta), which brings tons of<br />
improvements from last version due total refactoring of code. Its<br />
better then never, check out sources!<br />
Now the transfers are stable and 60% much faster. If you are a maniac<br />
object oriented programmer, you going to love it, since it follow many<br />
project patterns as listeners, notify, encapsulation.<br />
The program API is a truly Java library, with easy Obex FTP calls.<br />
Full information available in project README.</p>
<p>The project is released under LGPL and need your feedback.</p>
<p>Access: http://www.github.com/3esmit/jobexftp
</p></div>
<p>Here is the email Ricardo Schmidt sent me on the 17 December 2009 :<br />
<em>I modified and formated some parts of the original mail.</em></p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello Florent,</p>
<p>    With Ondrej ObexTool sources, that I <a href="http://florent.clairambault.fr/tc65-module-exchange-suite-mes-problems#comment-557">met through your blog</a>, I made up a new tool (think OO). So I made a library to help developers make multiplatform easy communication with TC65 and simmilar modules.<br />
I&#8217;m already using it in a desktop configuration program for my M2M application and it just works great.<br />
     It have some TODOs and maybe some bugs, but it have a nice object oriented programming. Also I abused of the exceptions, becouse this project is not just an application, but also a library. You can use it to develop your configurator programs, its very easy to do with it.<br />
     The code is fully in english, but in future I pretend make it multilanguage. For now it just garantees that TC65 is going to work with it, but I belive TC65i and XT75 should work as TC65, since it under the same AT &#8220;platform&#8221;.</p>
<p><strong>Some nice features in the library :</strong></p>
<ul>
<li>Auto turns on/off the module</li>
<li>If for some previous crash it stayed in DATAMODE, it sends the +++<br />
until it get the COMMANDMODE again.</li>
<li>You can choose for seeing verbose messages and for seeing the AT<br />
communication.</li>
<li>You can send a String as a file to the module.</li>
<li>You recieve a file as a String from module (since writing a file is easy).</li>
<li>Working in windows platf (under test)</li>
</ul>
<p><strong>Some nice features in the application :</strong></p>
<ul>
<li>Argument configurable on/off module, verbose and show atcomand.</li>
<li>Download, upload and list files just in one connection (no limit) ex.: jobexftp /dev/ttyACM0 -u arq1.ext arq2.ext arq3.ext arq4.ext -l -d filetodown.ext -V -A</li>
<li>Option to just stdout the file. (sometimes we just need to see the<br />
contents)</li>
</ul>
<p><strong>TODOs:</strong></p>
<ul>
<li>Documentation (kinda important)</li>
<li>Auto run jars (in library is ready, just for app)</li>
<li>Choose folder to send the file (easy task)</li>
<li>MacOSX adaption (maybe its already working, I dont have any macs to test)</li>
<li>Multilanguage</li>
</ul>
<p>The listing comes in the XML from library, I think that this should be treated just in the applications, since the xml is very good for programming analyse.</p>
<p>Hope you like it.</p>
<p>You can get the latest sources from project kenai : <a href="http://www.kenai.com/projects/jobexftp">http://www.kenai.com/projects/jobexftp</a></p>
<p><a href="http://kenai.com/">Kenai</a> is NetBeans integrated, and it uses subversion. This project is opensource under GPL (application) and under LGPL (library).</p>
<p>Thank you for the attention,<br />
Ricardo Schmidt
</p></div>
<p>Here is an other message Ricardo sent on the 18 March 2010 :</p>
<div style="border: 1px solid gray; margin: 10px; padding: 10px; background-color: #eef">
Hello developers,</p>
<p>Due to the kenai closing, and to have the best control version system, JObexFTP have moved to github.com.<br />
Now we can manage projects better with git control version. If you dont know Git, you should!<br />
The Kenai&#8217;s JObexFTP will be closed soon, the repository is already deleted.<br />
Note: The old JObexFTP versions are lost due to new commit.<br />
Please consider joining my project. </p>
<p><strong>What is JObexFTP?</strong><br />
Its a fully opensource library (and application) to transfer files from/to obex server.<br />
You can use it in any J2SE application to enable java communication to module without third party app. You can also use it as a MES in unsupported cinterion plataforms like Linux.<br />
For now it just supports cinterion modules due to ATCommand spec.<br />
It needs RxTx library to have the serial communication. </p>
<p><strong>JObexFTP news:</strong><br />
Now we have fully OO obex objects (files/folders).<br />
The downloading files is speeded up. </p>
<p><strong>Under development:</strong><br />
Human readable folder listing<br />
Multilanguage</p>
<p><strong>Known issues:</strong><br />
Deleting multiple files is buggy and needs reconnection. (Its also buggy in windows MES, but here is a way more buggy)<br />
In Windows sometimes it takes more time to have obex ready to read folder listing (I hate you microsoft)
</div>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The M2MP protocol</title>
		<link>http://florent.clairambault.fr/the-m2mp-protocol?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-m2mp-protocol</link>
		<comments>http://florent.clairambault.fr/the-m2mp-protocol#comments</comments>
		<pubDate>Sat, 12 Dec 2009 20:00:10 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[M2M]]></category>
		<category><![CDATA[M2MP]]></category>
		<category><![CDATA[Protocol]]></category>
		<category><![CDATA[TC65]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2165</guid>
		<description><![CDATA[Today, I&#8217;m going to talk about a little protocol that I&#8217;ve implemented in few softwares (on TC65, .Net client and .Net server). It won&#8217;t be very interesting for most of you (99.99%). But still, I wanted to write it because it has been very useful and it might prevent you from writing the next stupid [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I&#8217;m going to talk about a little protocol that I&#8217;ve implemented in few softwares (on TC65, .Net client and .Net server). It won&#8217;t be very interesting for most of you (99.99%). But still, I wanted to write it because it has been very useful and it might prevent you from writing the next <a href="#stupid">stupid M2M protocol specifications</a>.</p>
<h2>Motivations</h2>
<p>I made this simple protocol to solve very simple and common problems on M2M equipments, we want to :</p>
<ul>
<li>Transmit and receive in real-time</li>
<li>Transmit as few data as possible</li>
<li>Send and receive any kind of data</li>
</ul>
<p>So the basic ideas are to :</p>
<ul>
<li>Keep a TCP connection open all the time by sending regular keep-alive frames.</li>
<li>Define named channels that are only transmitted once</li>
<li>Send byte array, and two-dimensionnal byte arrays on these channels</li>
</ul>
<p>We rely on the TCP protocol for packet checksuming, packet ordering and every little things it does very well.</p>
<p>Basically, we send these kind of frames :</p>
<ul>
<li>Identification frames</li>
<li>Channel name to id definition</li>
<li>Data transmission of single byte arrays (Byte[]).</li>
<li>Data transmission of two-dimentionnal byte arrays (Byte[][]).</li>
</ul>
<h2>The protocol</h2>
<p><b>Identification</b><br />
The client ask for authentication :</p>

<div class="wp_codebox"><table><tr id="p216546"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2165code46"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// Identification header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x05 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// Size of the identification</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">5</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">'h'</span>, <span style="color: #0000ff;">'e'</span>, <span style="color: #0000ff;">'l'</span>, <span style="color: #0000ff;">'l'</span>, <span style="color: #0000ff;">'o'</span> <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// Identifier</span></pre></td></tr></table></div>

<p>The server replies &#8220;ok&#8221; or &#8220;not ok&#8221;</p>

<div class="wp_codebox"><table><tr id="p216547"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code47"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// Identification request</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// OK, 0x00 for not ok</span></pre></td></tr></table></div>

<p><strong>Ping / Keep alives</strong><br />
Client sends a ping request :</p>

<div class="wp_codebox"><table><tr id="p216548"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code48"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x02 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// client ping request header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x15 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// the number (here 0x15) can be incremented or random</span></pre></td></tr></table></div>

<p>Server answers the ping request :</p>

<div class="wp_codebox"><table><tr id="p216549"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code49"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x02 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// client ping server response header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x15 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 0x15 is the number of the ping request</span></pre></td></tr></table></div>

<p>Server sends a ping request :</p>

<div class="wp_codebox"><table><tr id="p216550"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code50"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// server ping request header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x16 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// the number (here 0x16) can be incremented or random</span></pre></td></tr></table></div>

<p>Client answers the ping request :</p>

<div class="wp_codebox"><table><tr id="p216551"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code51"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// server ping client response header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x16 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 0x16 is the 0x16 number of the ping request</span></pre></td></tr></table></div>

<p><strong>Defining a named channel</strong><br />
<em>This applies to both client to server and server to client communcation.</em></p>

<div class="wp_codebox"><table><tr id="p216552"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code52"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x20 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// channel definition frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x0D <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 13 is the size of the following message</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">12</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">'c'</span>, <span style="color: #0000ff;">'h'</span>, <span style="color: #0000ff;">'a'</span>, <span style="color: #0000ff;">'n'</span>, <span style="color: #0000ff;">'n'</span>, <span style="color: #0000ff;">'e'</span>, <span style="color: #0000ff;">'l'</span>, <span style="color: #0000ff;">' '</span>, <span style="color: #0000ff;">'n'</span>, <span style="color: #0000ff;">'a'</span>, <span style="color: #0000ff;">'m'</span>, <span style="color: #0000ff;">'e'</span> <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// the name of the channel : &quot;channel name&quot;</span></pre></td></tr></table></div>

<p><strong>Sending some data</strong><br />
<em>This applies to both client to server and server to client communcation.</em></p>
<p>For 0 to 254 sized messages :</p>

<div class="wp_codebox"><table><tr id="p216553"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code53"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x21 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// one byte sized data transmission frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x06 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the data</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">5</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x02, 0x03, 0x04, 0x05 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// data transmitted on the channel</span></pre></td></tr></table></div>

<p>For 255 to 65534 sized data messages :</p>

<div class="wp_codebox"><table><tr id="p216554"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code54"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x41 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// two bytes sized data transmission frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x06 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the data</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">5</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x02, 0x03, 0x04, 0x05 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// data transmitted on the channel</span></pre></td></tr></table></div>

<p>For 65 535 octets to 4 294 967 294 sized data messages :</p>

<div class="wp_codebox"><table><tr id="p216555"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code55"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x61 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// two bytes sized data transmission frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x00, 0x00, 0x06 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the data</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">5</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x02, 0x03, 0x04, 0x05 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// data transmitted on the channel</span></pre></td></tr></table></div>

<p>For data arrray transmission, it&#8217;s the same except frame header are 0&#215;22, 0&#215;42, 0&#215;62 instead of 0&#215;21, 0&#215;41, 0&#215;61. If you transmit data array like this one Byte[][] data = { { 0&#215;01, 0&#215;02 }, { 0&#215;03, 0&#215;04, 0&#215;05 }, { 0&#215;06, 0&#215;07, 0&#215;08, 0&#215;09 } } :</p>

<div class="wp_codebox"><table><tr id="p216556"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2165code56"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x22 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// one byte sized data transmission frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x0D <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the data</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x02 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the first array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x02 <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the second array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03, 0x04, 0x05 <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x04 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the third array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x06, 0x07, 0x08, 0x09 <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>For bigger arrays, you need to define :</p>

<div class="wp_codebox"><table><tr id="p216557"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2165code57"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x42 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// one byte sized data transmission frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x10 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the data (16)</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x02 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the first array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x02 <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the second array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03, 0x04, 0x05 <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x04 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the third array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x06, 0x07, 0x08, 0x09 <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>and so on :</p>

<div class="wp_codebox"><table><tr id="p216558"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2165code58"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x62 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// one byte sized data transmission frame header</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x16 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the data (22)</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// where 3 is the id of the channel</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x00, 0x00, 0x02 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the first array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x02 <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x00, 0x00, 0x03 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the second array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x03, 0x04, 0x05 <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x00, 0x00, 0x00, 0x04 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// size of the third array</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x06, 0x07, 0x08, 0x09 <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Sample data types transmitted</h2>
<p><strong>Strings</strong><br />
Easy&#8230; Just the bytes value of the string</p>
<p><strong>Position</strong><br />
when moving :</p>

<div class="wp_codebox"><table><tr id="p216559"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2165code59"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Atimestamp+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Timestamp</span></a> <span style="color: #339933;">:</span> UInt32 <span style="color: #009900;">&#40;</span>since <span style="color: #cc66cc;">1970</span> or <span style="color: #cc66cc;">2009</span> <span style="color: #000000; font-weight: bold;">if</span> you wish<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> Longitude <span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afloat+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Float</span></a>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> Latitude <span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afloat+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Float</span></a>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> Speed <span style="color: #339933;">:</span> UInt16
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> Altitude <span style="color: #339933;">:</span> UInt16</pre></td></tr></table></div>

<p>= 16 bytes</p>
<p>when stopped :</p>

<div class="wp_codebox"><table><tr id="p216560"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2165code60"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Atimestamp+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Timestamp</span></a> <span style="color: #339933;">:</span> UInt32 <span style="color: #009900;">&#40;</span>since <span style="color: #cc66cc;">1970</span> or <span style="color: #cc66cc;">2009</span> <span style="color: #000000; font-weight: bold;">if</span> you wish<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> Longitude <span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afloat+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Float</span></a>
<span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#93;</span> Latitude <span style="color: #339933;">:</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Afloat+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Float</span></a></pre></td></tr></table></div>

<p>= 12 bytes</p>
<p><strong>Battery</strong><br />
Percentage :</p>

<div class="wp_codebox"><table><tr id="p216561"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code61"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> Percentage <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abyte+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Byte</span></a><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>Voltage :</p>

<div class="wp_codebox"><table><tr id="p216562"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code62"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#93;</span> Voltage in mV <span style="color: #009900;">&#40;</span>UInt16<span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<h2>Sample communication</h2>
<p>This is just to show how is working a sample communication</p>

<div class="wp_codebox"><table><tr id="p216563"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code63"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x04, 0x01, 0x02, 0x03, 0x04 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// identification frame</span>
<span style="color: #339933;">&lt;--</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x01, 0x01 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// identification accepted</span>
<span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x20, 0x08, 0x00, <span style="color: #0000ff;">'b'</span>, <span style="color: #0000ff;">'a'</span>, <span style="color: #0000ff;">'t'</span>, <span style="color: #0000ff;">'t'</span>, <span style="color: #0000ff;">'e'</span>, <span style="color: #0000ff;">'r'</span>, <span style="color: #0000ff;">'y'</span> <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// We define the channel &quot;battery&quot; with id 0x00</span>
<span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 0x21, 0x02, 0x00, <span style="color: #cc66cc;">70</span> <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// We send 70 (meaning 70%) on the &quot;battery&quot; channel.</span></pre></td></tr></table></div>

<h2>On top of that</h2>
<p>On top of that, I added some settings management and status specifications.</p>
<p><strong>Settings management</strong><br />
The server can get and set some settings on the &#8220;_set&#8221; channel.<br />
If it&#8217;s a two-dimentionnal array and the first element is &#8220;s&#8221; (like &#8220;set&#8221;) it means that it sets some settings, the next elements will be &#8220;setting1=value1&#8243;, &#8220;setting2=value2&#8243;, etc.<br />
If it&#8217;s a two-dimentionnal array and the first element is &#8220;g&#8221; (like &#8220;get&#8221;) it means that it needs the client to report the value of some settings, like &#8220;setting1&#8243;, &#8220;setting2&#8243;<br />
If it&#8217;s a single dimentionnal array that contains &#8220;ga&#8221; (like &#8220;get all&#8221;) it means that the server wants the client to report the value of every settings.<br />
The client can also send &#8220;c&#8221;  (in the same format as the get) if a setting changed on the client side.</p>
<p>Sample transmission:<br />
Setting values:</p>

<div class="wp_codebox"><table><tr id="p216564"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code64"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;s&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1=value1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting2=value2&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>It&#8217;s the responsibility of the server to send an acknowledge request to know that the client has actually successfully received this settings.</p>
<p>Getting values:</p>

<div class="wp_codebox"><table><tr id="p216565"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code65"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting2&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1=value1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting2=value2&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Setting and gettings value :</p>

<div class="wp_codebox"><table><tr id="p216566"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code66"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;sg&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1=value1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting2=value2&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1=value1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting2=value2&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Gettings all the values :</p>

<div class="wp_codebox"><table><tr id="p216567"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code67"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #ff0000;">&quot;ga&quot;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>   <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1=value1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting2=value2&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Status parameters management</strong><br />
The server can get some status parameters on the &#8220;_sta&#8221; channel. Status are pretty much like settings except that they describe parameters that cannot be changed from the server.</p>
<p>Getting a parameter:</p>

<div class="wp_codebox"><table><tr id="p216568"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code68"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_sta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;version&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_sta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;version=0.0.1&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Getting all parameters:</p>

<div class="wp_codebox"><table><tr id="p216569"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code69"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_sta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;ga&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_sta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;hw=tc65i/1.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;sw=sampleprogram/0.0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;cap=sms,applicationA/1.0&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Value changed on the client side</p>

<div class="wp_codebox"><table><tr id="p216570"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code70"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_set&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;c&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;setting1=value1&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Capacities</strong><br />
Previously, capacities where requested by server with the &#8220;?&#8221; message on the &#8220;_cap&#8221; channel but they are now handled through the standard status message and the &#8220;cap&#8221; parameter.</p>

<div class="wp_codebox"><table><tr id="p216571"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code71"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_sta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;cap&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_sta&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;g&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;cap=sms_relay_send_1,gpio_1&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Command execution</strong></p>

<div class="wp_codebox"><table><tr id="p216572"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code72"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// To send a command</span>
 <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_cmd&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&lt;commandId&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;command&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;arg1&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;arg2&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// To acknowledge the command</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_cmd&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;a&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&lt;commandId&gt;&quot;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><em>In the future commands could algo be acknowledge as a group by sending an acknowledge request.</em></p>
<p><strong>Files transmission</strong><br />
The server sends:</p>

<div class="wp_codebox"><table><tr id="p216573"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code73"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_fi:u&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span> <span style="color: #009900;">&#123;</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;file1&quot;</span><span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> file1Size<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">16</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> file1Hash<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;file2&quot;</span><span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> file2Size<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">16</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> file2Hash <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If the client wants to get the detailed subhashes:</p>

<div class="wp_codebox"><table><tr id="p216574"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code74"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_fi:h&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;file1&quot;</span><span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> size<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> offset1<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> offset2 <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_fi:h&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;file1&quot;</span><span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> size<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> offset1<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">16</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> hash<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> size<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">16</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> hash <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Then if the client has a different value of the files:</p>

<div class="wp_codebox"><table><tr id="p216575"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code75"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_fi:g:file1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> offset<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> size <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_fi:g:file1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>uint32_t<span style="color: #009900;">&#41;</span> offset<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span> x <span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> data<span style="color: #339933;">,</span> byte<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">16</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> file1Hash <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Publish/Subscribe (MQTT like)</strong><br />
You could subscribe to a channel &#8220;toto&#8221; using:</p>

<div class="wp_codebox"><table><tr id="p216576"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code76"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_pubsub&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;s&quot;</span> <span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;toto&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_pubsub&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;sa&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;toto&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span> <span style="color: #208080;">0x01</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>You could unsubscribe to a channel &#8220;toto&#8221; using:</p>

<div class="wp_codebox"><table><tr id="p216577"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code77"><pre class="c" style="font-family:monospace;"> <span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_pubsub&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;u&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;toto&quot;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_pubsub&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--</span>  <span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">&quot;ua&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;toto&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span> <span style="color: #208080;">0x01</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And the rest is left like this.</p>
<p><strong>Gateway acting and sub equipements</strong><br />
Any equipment can act as a gateway by encapsulating data of an sub-equipment in a channel name like this &#8220;_eq/[sub equipment identifier]&#8221; but this has never been used for the moment.</p>
<p>Every packet coming from the sub-equipment is relayed to the server as a data packet.<br />
If the equipment, identified locally by &#8220;mac:112233445566&#8243; sends an identification to the server, this will work like this :<br />
Subequipment to Equipment:</p>

<div class="wp_codebox"><table><tr id="p216578"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code78"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span> <span style="color: #208080;">0x01</span> <span style="color: #208080;">0x04</span> <span style="color: #ff0000;">'t'</span> <span style="color: #ff0000;">'o'</span> <span style="color: #ff0000;">'t'</span> <span style="color: #ff0000;">'o'</span> <span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p>This will be relayed to the server as data message like this :</p>

<div class="wp_codebox"><table><tr id="p216579"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code79"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">--</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;_eq/mac:112233445566&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">--&gt;</span> <span style="color: #009900;">&#91;</span> <span style="color: #208080;">0x01</span><span style="color: #339933;">,</span> <span style="color: #208080;">0x04</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'t'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'o'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'t'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'o'</span> <span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p>Meaning in raw data :</p>

<div class="wp_codebox"><table><tr id="p216580"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code80"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span><span style="color: #208080;">0x21</span> <span style="color: #208080;">0x07</span> <span style="color: #208080;">0x03</span> <span style="color: #208080;">0x01</span> <span style="color: #208080;">0x04</span> <span style="color: #ff0000;">'t'</span> <span style="color: #ff0000;">'o'</span> <span style="color: #ff0000;">'t'</span> <span style="color: #ff0000;">'o'</span> <span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p>(where 0&#215;03 is the generated channel id)</p>
<h2>Stupid protocols</h2>
<p>I&#8217;ve seen a lot of protocols from big companies doing some really stupid things like <a name="stupid">:</a></p>
<ul>
<li>Fixed size frames for not fixed size data.</li>
<li>4 zero filled bytes preamble. Why the hell would we need preamble in a TCP connection ?</li>
<li>8 bytes timestamp in millisecond when data has a 1 second precision.</li>
<li>4 bytes integer for specifying some number that never exceed 32.</li>
<li>Checksums on top of the TCP checksumming mechanism.</li>
<li>Redundant data at the beginning and the end.</li>
<li>Disconnecting very frequently (TCP establishment + identification costs a lot).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/the-m2mp-protocol/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TC65 : Settings management</title>
		<link>http://florent.clairambault.fr/tc65-settings-management?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tc65-settings-management</link>
		<comments>http://florent.clairambault.fr/tc65-settings-management#comments</comments>
		<pubDate>Fri, 11 Dec 2009 20:00:03 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[M2M]]></category>
		<category><![CDATA[M2MP]]></category>
		<category><![CDATA[Protocol]]></category>
		<category><![CDATA[TC65]]></category>
		<category><![CDATA[TCP]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2146</guid>
		<description><![CDATA[Someone recently asked me and the javacint group how we should handle settings. So I&#8217;ll give you two answers : ejw&#8217;s reply : You should use some simple DataInputStream and DataOutputStream objects. Mine : If you only store simple values (numbers and text), you should use a simple text file. It enables you to easily [...]]]></description>
			<content:encoded><![CDATA[<p>Someone recently asked me and the javacint group <a href="http://groups.google.com/group/javacint/browse_thread/thread/4cfb9c3754334291">how we should handle settings</a>. So I&#8217;ll give you two answers :</p>
<ul>
<li><a href="http://groups.google.com/group/javacint/msg/f226ea32c02d6d68">ejw&#8217;s reply</a> : You should use some simple DataInputStream and DataOutputStream objects.</li>
<li>Mine : If you only store simple values (numbers and text), you should use a simple text file. It enables you to easily see and modify settings outside the TC65.</li>
</ul>
<p>So, my little gift of today will be a simple settings management class. The idea is that this file is in a very simple format (that can be read in any PC) and it only stores settings that have changed. This is very important, it allows you to change the default behavior at next software update but also enable you to override some of the settings for each chip (like the last IMSI identifier of the SIM card). </p>
<p><em>I did something wrong in this example by writing all the methods with a starting Uppercase letter. The reason is that I do like a it a lot better like that (this is the C# style) but style, the good thing to do is to stick to each language&#8217;s coding conventions. I can&#8217;t really update this code as I have modified this class to a more complex version where other class register to this one to receive settings change event.</em></p>

<div class="wp_codebox"><table><tr id="p214682"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
</pre></td><td class="code" id="p2146code82"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">Common</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.microedition.io.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.siemens.icm.io.file.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Settings management class
 * @author Florent Clairambault
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Settings <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// The cached settings</span>
	<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a> _settings<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// File of the settings</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> _fileName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;a:/settings.txt&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Singleton instance of the settings</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> Settings _instance<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Get Default instance of the Settings class
	 * @return The default instance of the Settings class
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">synchronized</span> Settings getInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> _instance <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
			_instance <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Settings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> _instance<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Free the singleton instance
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> freeInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		_instance <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Load settings
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> load<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astringbuffer+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">StringBuffer</span></a> buffer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astringbuffer+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">StringBuffer</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a> settings <span style="color: #339933;">=</span> getDefaultSettings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
			FileConnection fc <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FileConnection<span style="color: #009900;">&#41;</span> Connector.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;file:///&quot;</span> <span style="color: #339933;">+</span> _fileName, Connector.<span style="color: #006633;">READ</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InputStream</span></a> is <span style="color: #339933;">=</span> fc.<span style="color: #006633;">openInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span> is.<span style="color: #006633;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">int</span> c <span style="color: #339933;">=</span> is.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> c <span style="color: #339933;">==</span> <span style="color: #0000ff;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					loadTreatLine<span style="color: #009900;">&#40;</span> settings, buffer.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					buffer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astringbuffer+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">StringBuffer</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span>
					buffer.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span> c <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			is.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			fc.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">IOException</span></a> ex <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// The exception we shoud have is at first launch : </span>
			<span style="color: #666666; font-style: italic;">// There shouldn't be any file to read from</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Logger.<span style="color: #006633;">E_CRITICAL</span> <span style="color: #009900;">&#41;</span>
				Logger.<span style="color: #006633;">Log</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">19</span>, <span style="color: #0000ff;">&quot;Settings.Load&quot;</span>, ex <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		_settings <span style="color: #339933;">=</span> settings<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Treat each line of the file
	 * @param def Default settings
	 * @param line Line to parse
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> loadTreatLine<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a> settings, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> line <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Logger.<span style="color: #006633;">E_VERBOSE</span> <span style="color: #009900;">&#41;</span>
			Logger.<span style="color: #006633;">Log</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">78</span>, <span style="color: #0000ff;">&quot;loadTreatLine( [...], <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> line <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> );&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> spl <span style="color: #339933;">=</span> Common.<span style="color: #006633;">strSplit</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'='</span>, line <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> key <span style="color: #339933;">=</span> spl<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> value <span style="color: #339933;">=</span> spl<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If default settings hashTable contains this key</span>
		<span style="color: #666666; font-style: italic;">// we can use this value</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> settings.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			settings.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			settings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> key, value <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Get default settings
	 * @return Default settings Hashtable
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a> getDefaultSettings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a> defaultSettings <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// General M2MSoft settings :</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;code&quot;</span>, <span style="color: #0000ff;">&quot;8888&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;servers&quot;</span>, <span style="color: #0000ff;">&quot;87.106.206.30:3000&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;apn&quot;</span>, <span style="color: #0000ff;">&quot;gprs,m2minternet,<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\&quot;</span>,<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\&quot;</span>,,0&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;imsi&quot;</span>, <span style="color: #0000ff;">&quot;0000&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;watchdogtimer&quot;</span>, <span style="color: #0000ff;">&quot;20&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;version&quot;</span>, <span style="color: #0000ff;">&quot;0&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		defaultSettings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;phoneManager&quot;</span>, <span style="color: #0000ff;">&quot;+33686955405&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> defaultSettings<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Reset everything
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> resetEverything<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			FileConnection fc <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FileConnection<span style="color: #009900;">&#41;</span> Connector.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;file:///&quot;</span> <span style="color: #339933;">+</span> _fileName, Connector.<span style="color: #006633;">READ_WRITE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> fc.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
				fc.<span style="color: #006633;">delete</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        _settings <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> ex <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Logger.<span style="color: #006633;">E_CRITICAL</span> <span style="color: #009900;">&#41;</span>
				Logger.<span style="color: #006633;">Log</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">16725</span>, <span style="color: #0000ff;">&quot;Settings.ResetEverything&quot;</span>, ex <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/** 
	 * save setttings
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> save<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// If there's no settings, we shouldn't have to save anything</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> _settings <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ahashtable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Hashtable</span></a> defSettings <span style="color: #339933;">=</span> getDefaultSettings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aenumeration+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Enumeration</span></a> e <span style="color: #339933;">=</span> defSettings.<span style="color: #006633;">keys</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			FileConnection fc <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>FileConnection<span style="color: #009900;">&#41;</span> Connector.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;file:///&quot;</span> <span style="color: #339933;">+</span> _fileName, Connector.<span style="color: #006633;">READ_WRITE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> fc.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
				fc.<span style="color: #006633;">delete</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">//fc = (FileConnection) Connector.open(&quot;file:///&quot; + _fileName, Connector.READ_WRITE);</span>
			fc.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aoutputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">OutputStream</span></a> os <span style="color: #339933;">=</span> fc.<span style="color: #006633;">openOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span> e.<span style="color: #006633;">hasMoreElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> key <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#41;</span> e.<span style="color: #006633;">nextElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> value <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#41;</span> _settings.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> defValue <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#41;</span> defSettings.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #666666; font-style: italic;">// if there is a default value</span>
					defValue <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #666666; font-style: italic;">// and</span>
					<span style="color: #666666; font-style: italic;">// the value isn't the same as the default value</span>
					defValue.<span style="color: #006633;">compareTo</span><span style="color: #009900;">&#40;</span> value <span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> line <span style="color: #339933;">=</span> key <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;=&quot;</span> <span style="color: #339933;">+</span> value <span style="color: #339933;">+</span> <span style="color: #0000ff;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Logger.<span style="color: #006633;">E_DEBUG</span> <span style="color: #009900;">&#41;</span>
						Logger.<span style="color: #006633;">Log</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">131</span>, <span style="color: #0000ff;">&quot;Settings.save.line = <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">+</span> line <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
					os.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span> line.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
			os.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			os.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			fc.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> ex <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> Logger.<span style="color: #006633;">E_CRITICAL</span> <span style="color: #009900;">&#41;</span>
				Logger.<span style="color: #006633;">Log</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">131</span>, <span style="color: #0000ff;">&quot;Settings.save&quot;</span>, ex <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Init (and ReInit) method
	 */</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> checkLoad<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> _settings <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
			load<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Get a setting's value as a String
	 * @param key Key Name of the setting
	 * @return String value of the setting
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> getSetting<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> key <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		checkLoad<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> _settings.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#41;</span> _settings.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Sets a setting
	 * @param key Setting to set
	 * @param value Value of the setting
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">synchronized</span> <span style="color: #000066; font-weight: bold;">void</span> setSetting<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> key, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> value <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		checkLoad<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> _settings.<span style="color: #006633;">containsKey</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
			_settings.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		_settings.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span> key, value <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		OnSettingChanged<span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #008000; font-style: italic; font-weight: bold;">/**
	 * Get a setting's value as an int
	 * @param key Key Name of setting
	 * @return Integer value of the setting
	 * @throws java.lang.NumberFormatException When the int cannot be parsed
	 */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getSettingInt<span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> key <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Anumberformatexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">NumberFormatException</span></a> <span style="color: #009900;">&#123;</span>
		<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> value <span style="color: #339933;">=</span> getSetting<span style="color: #009900;">&#40;</span> key <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> value <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">return</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainteger+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Integer</span></a>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span> value <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Latter on, I added some settings consumer capacities. It allows to use this class in some sort of &#8220;third party&#8221; developed components. Each component had to register itself to the settings management class, the settings management class could then request the default value settings it will provide, and it could set/get settings. The settings event class also launched an event when a setting was changed.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65-settings-management/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My dear visitors</title>
		<link>http://florent.clairambault.fr/my-dear-visitors?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-dear-visitors</link>
		<comments>http://florent.clairambault.fr/my-dear-visitors#comments</comments>
		<pubDate>Sat, 28 Nov 2009 08:54:59 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[TC65]]></category>
		<category><![CDATA[you]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2007</guid>
		<description><![CDATA[Hi my dear visitors, Some of you seem to like (or fall by mistake in) my unfunny, unspiritual and crappy english speaking blog. I&#8217;m very glad you have such bad taste. You are more than 2 500 to come each month. You mostly come about some stuffs around the TC65, SVN, C# .Net or Sharepoint. [...]]]></description>
			<content:encoded><![CDATA[<p>Hi my dear visitors,</p>
<p>Some of you seem to like (or fall by mistake in) my unfunny, unspiritual and crappy english speaking blog. I&#8217;m very glad you have such bad taste. You are more than 2 500 to come each month. You mostly come about some stuffs around the TC65, SVN, C# .Net or Sharepoint.</p>
<p>By the way, you consumed more than 200 GB of bandwidth this month, mostly on downloading the <a href="http://florent.clairambault.fr/downloads">TC65 SDK</a>. I&#8217;m really surprised, I guess a lot of people use this chip even if nearly nobody writes about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/my-dear-visitors/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TC65 HTTP POST request</title>
		<link>http://florent.clairambault.fr/tc65-http-post-request?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tc65-http-post-request</link>
		<comments>http://florent.clairambault.fr/tc65-http-post-request#comments</comments>
		<pubDate>Sun, 25 Oct 2009 21:45:43 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=1865</guid>
		<description><![CDATA[This is just a quick code to show how to do a simple http POST request from a TC65 chip. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick code to show how to do a simple http POST request from a TC65 chip.</p>

<div class="wp_codebox"><table><tr id="p186584"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code" id="p1865code84"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> httpCheck<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> data <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Parameter1=000009960623185&amp;Parameter2=$GPWPL,4807.038,N,01131.000,E,WPTNME*5C&quot;</span><span style="color: #339933;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> url <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://test.webingenia.com/postIdent&quot;</span><span style="color: #339933;">;</span>
        HttpConnection conn <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Ainputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">InputStream</span></a> is <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aoutputstream+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">OutputStream</span></a> os <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Test HTTP connection</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// We prepare the POST request</span>
            conn <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>HttpConnection<span style="color: #009900;">&#41;</span> Connector.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span> url <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            conn.<span style="color: #006633;">setRequestMethod</span><span style="color: #009900;">&#40;</span> HttpConnection.<span style="color: #006633;">POST</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            conn.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Content-Type&quot;</span>, <span style="color: #0000ff;">&quot;application/x-www-form-urlencoded&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            os <span style="color: #339933;">=</span> conn.<span style="color: #006633;">openOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            os.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span> data.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// We launch the request</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Response code : &quot;</span> <span style="color: #339933;">+</span> conn.<span style="color: #006633;">getResponseCode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// We display the generated content</span>
            is <span style="color: #339933;">=</span> conn.<span style="color: #006633;">openInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">int</span> ch<span style="color: #339933;">;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Output : &quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>ch <span style="color: #339933;">=</span> is.<span style="color: #006633;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span>
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span> ch <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> ex <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Http : ex : &quot;</span> <span style="color: #339933;">+</span> ex.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; : &quot;</span> <span style="color: #339933;">+</span> ex.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            ex.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// Whatever happens, we close everything</span>
        <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> conn <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
                    conn.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> is <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
                    is.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> os <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
                    os.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> ex <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Http : ex2 : &quot;</span> <span style="color: #339933;">+</span> ex.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; : &quot;</span> <span style="color: #339933;">+</span> ex.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                ex.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65-http-post-request/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/41 queries in 0.015 seconds using disk: basic
Object Caching 2289/2366 objects using disk: basic

Served from: florent.clairambault.fr @ 2012-02-04 22:39:32 -->
