<?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>Wed, 28 Jul 2010 20:31:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>TC65FM : TC65 Fast Manager</title>
		<link>http://florent.clairambault.fr/tc65fm-tc65-fast-manager?utm_source=rss&amp;utm_medium=rss&amp;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>0</slash:comments>
		</item>
		<item>
		<title>A little TC65 development document</title>
		<link>http://florent.clairambault.fr/tc65dev-document?utm_source=rss&amp;utm_medium=rss&amp;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://florent.clairambault.fr/downloads/Cinterion/TC65Dev.pdf">the document</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65dev-document/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JObexFTP from Ricardo Schmidt</title>
		<link>http://florent.clairambault.fr/jobexftp-from-ricardo-schmidt?utm_source=rss&amp;utm_medium=rss&amp;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 JOBextFTP. This can be used for anyone whose Module Exchange Suite (MES) 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 applications. 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>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>0</slash:comments>
		</item>
		<item>
		<title>The M2MP protocol</title>
		<link>http://florent.clairambault.fr/the-m2mp-protocol?utm_source=rss&amp;utm_medium=rss&amp;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="p216529"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2165code29"><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="p216530"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code30"><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="p216531"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code31"><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="p216532"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code32"><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="p216533"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code33"><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="p216534"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2165code34"><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="p216535"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code35"><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="p216536"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code36"><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="p216537"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code37"><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="p216538"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code38"><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="p216539"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2165code39"><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="p216540"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2165code40"><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="p216541"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2165code41"><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="p216542"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2165code42"><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="p216543"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2165code43"><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="p216544"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code44"><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="p216545"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2165code45"><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="p216546"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p2165code46"><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 capacities specifications.</p>
<p><strong>Capacities</strong><br />
If the server send &#8220;?&#8221; on the &#8220;_cap&#8221; (like capacities) channel, the client replies on the same channel with an data array containing the capacities it has (like &#8220;positionTracking&#8221;, &#8220;smsSending&#8221;, &#8220;sms&#8221; ).</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.</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>
<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>2</slash:comments>
		</item>
		<item>
		<title>TC65 : Settings management</title>
		<link>http://florent.clairambault.fr/tc65-settings-management?utm_source=rss&amp;utm_medium=rss&amp;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>

<div class="wp_codebox"><table><tr id="p214648"><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="p2146code48"><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>
					Load_TreatLine<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> Load_TreatLine<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;Load_TreatLine( [...], <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> ResetErything<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>0</slash:comments>
		</item>
		<item>
		<title>My dear visitors</title>
		<link>http://florent.clairambault.fr/my-dear-visitors?utm_source=rss&amp;utm_medium=rss&amp;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&amp;utm_medium=rss&amp;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="p186550"><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="p1865code50"><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>
		<item>
		<title>Server-Side HTTP Request tester</title>
		<link>http://florent.clairambault.fr/server-side-http-request-tester?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=server-side-http-request-tester</link>
		<comments>http://florent.clairambault.fr/server-side-http-request-tester#comments</comments>
		<pubDate>Sun, 25 Oct 2009 08:30: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=1860</guid>
		<description><![CDATA[I made this simple test website for those of you who would want to check if their HTTP request made from a simple equipment like the TC65 are sent correctly. The idea is simple : You choose an id like &#8220;ThisIsMe&#8221; You access the test website with this id : http://test.webingenia.com/ThisIsMe You check what was [...]]]></description>
			<content:encoded><![CDATA[<p>I made this simple test website for those of you who would want to check if their HTTP request made from a simple equipment like the <a href="http://florent.clairambault.fr/tag/tc65">TC65</a> are sent correctly.</p>
<p>The idea is simple : </p>
<ul>
<li>You choose an id like &#8220;ThisIsMe&#8221;</li>
<li>You access the test website with this id : <a href="http://test.webingenia.com/ThisIsMe">http://test.webingenia.com/ThisIsMe</a></li>
<li>You check what was the content of the request at this address : <a href="http://test.webingenia.com/read/ThisIsMe">http://test.webingenia.com/read/ThisIsMe</a></a></li>
</ul>
<p>You can contact me if you don&#8217;t understand something, if something doesn&#8217;t work or if you would like me to add a feature.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/server-side-http-request-tester/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.Net, Flex and WebORB.Net</title>
		<link>http://florent.clairambault.fr/net-flex-and-weborb-net?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=net-flex-and-weborb-net</link>
		<comments>http://florent.clairambault.fr/net-flex-and-weborb-net#comments</comments>
		<pubDate>Sat, 24 Oct 2009 07:47:41 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[M2M]]></category>
		<category><![CDATA[TC65]]></category>
		<category><![CDATA[WCF]]></category>
		<category><![CDATA[WebORB]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=1825</guid>
		<description><![CDATA[I&#8217;ve been working on a project where we had to use Flex on a .Net environment and it had to be realtime. I was a little worried at first that it could be tricky to set up. But with WebORB.Net it&#8217;s pretty easy. We used the integrated RTMP (Real Time Messaging Protocol) messaging server. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a project where we had to use Flex on a .Net environment and it had to be realtime. I was a little worried at first that it could be tricky to set up. But with <a href="http://www.themidnightcoders.com/products/weborb-for-net/overview.html">WebORB.Net</a> it&#8217;s pretty easy. We used the integrated RTMP (Real Time Messaging Protocol) messaging server. It&#8217;s almost like using WCF. The most important differences are that, by default, objects are transmitted as Hashtable and calls can&#8217;t be synchronous. We can bind the object to right .Net object within the WebOrb management console but we decided to do it ourself using reflection (because we don&#8217;t like to depend too much on the management console).</p>
<p><strong>RTMP</strong><br />
The result is pretty impressive as it makes a really powerful real-time management system. And it&#8217;s freaking fast. Like WCF, it can handle concurrent calls. It&#8217;s in fact easier because everything is asynchronous but still, it does manage that. These calls are received on parallel threads.</p>
<p>The only problem with WebORB.Net is that you don&#8217;t have too much examples in the documentation. Our biggest problem was that we didn&#8217;t even knew how to detect what was the current calling connection on a method. This is pretty easy but you can&#8217;t exactly guess it. This is a dummy sample to show you how it&#8217;s done :</p>

<div class="wp_codebox"><table><tr id="p182552"><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
</pre></td><td class="code" id="p1825code52"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> FlexConnectionsServer<span style="color: #008000;">:</span>ApplicationAdapter <span style="color: #008000;">&#123;</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> _connectionIdCounter <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> Dictionary<span style="color: #008000;">&lt;</span>IConnection,<span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&gt;</span> _connectionsToId <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Dictionary<span style="color: #008000;">&lt;</span>IConnection,<span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// Returns the CURRENT connection (must be used from a method called by the flex client)</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> IConnection CurrentConnection <span style="color: #008000;">&#123;</span> get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> ConnectionHub<span style="color: #008000;">.</span><span style="color: #0000FF;">getConnectionLocal</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span> <span style="color: #008000;">&#125;</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">int</span> CurrentID <span style="color: #008000;">&#123;</span> get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> _connectionsToId<span style="color: #008000;">&#91;</span> CurrentConnection <span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// When the RTMP service is loaded, we start the time dispatcher thread</span>
	<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">bool</span> appStart<span style="color: #008000;">&#40;</span> IScope app <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Thread<span style="color: #008000;">&#40;</span> Thread_TimeDispatcher <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Start</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// This method is called when a client connects</span>
	<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">bool</span> appConnect<span style="color: #008000;">&#40;</span> IConnection conn, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> parms <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0600FF; font-weight: bold;">lock</span> <span style="color: #008000;">&#40;</span> _connectionsToId <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			_connectionsToId<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span> conn, _connectionIdCounter<span style="color: #008000;">++</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
&nbsp;
		<span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// This method is called when a client disconnects</span>
	<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> appDisconnect<span style="color: #008000;">&#40;</span> IConnection conn <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0600FF; font-weight: bold;">lock</span> <span style="color: #008000;">&#40;</span> _connectionsToId <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			_connectionsToId<span style="color: #008000;">.</span><span style="color: #0000FF;">Remove</span><span style="color: #008000;">&#40;</span> conn <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// This is a sample method call</span>
	<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">String</span> GetMyName<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Client{0}&quot;</span>, CurrentId <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// This thread dispatches the current time to every client</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> Thread_TimeDispatcher<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0600FF; font-weight: bold;">while</span><span style="color: #008000;">&#40;</span> <span style="color: #0600FF; font-weight: bold;">true</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			var t <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">UtcNow</span><span style="color: #008000;">;</span>
			SendCommand<span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;CurrentTime&quot;</span>, <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">&#123;</span> t <span style="color: #008000;">&#125;</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
			Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span> <span style="color: #FF0000;">1000</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">// Call a remote method on each client connection</span>
	<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> SendCommand<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">String</span> command, <span style="color: #6666cc; font-weight: bold;">Object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #0600FF; font-weight: bold;">params</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #0600FF; font-weight: bold;">lock</span> <span style="color: #008000;">&#40;</span> _connectionsToId <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
			<span style="color: #0600FF; font-weight: bold;">foreach</span><span style="color: #008000;">&#40;</span> var kvp <span style="color: #0600FF; font-weight: bold;">in</span> _connectionsToId <span style="color: #008000;">&#41;</span>
				<span style="color: #008000;">&#40;</span> kvp<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span> <span style="color: #0600FF; font-weight: bold;">as</span> IServiceCapableConnection <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Invoke</span><span style="color: #008000;">&#40;</span> command, <span style="color: #0600FF; font-weight: bold;">params</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
		<span style="color: #008000;">&#125;</span>
	<span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>It&#8217;s a little bit like using WCF in Single instance mode.</p>
<p><strong>IIS 7.0 Setup</strong><br />
There was something really weird that happened with my IIS 7.0 on my Windows 7 x64. Using the RTMP connection, I frequently had null return values on .Net method calls. We firstly find a quick way to solve it : Recall each time we get a null value. It&#8217;s really dirty, but It worked as a very temporary solution.<br />
Then, when debugging on the IIS process, I noticed a lot of NullReferenceException exceptions displayed on the debugger console. They were about the WebORB &#8220;LicenseManager&#8221; class, and I had as much exceptions as I had null values on the Flex client. I tried a lot of things that didn&#8217;t do anything. And then, I changed the &#8220;Managemd pipeline mode&#8221; of the Application Pool from &#8220;Integrated&#8221; to &#8220;Classic&#8221;, and the problem was solved. The really weird stuff here is that <a href="http://www.themidnightcoders.com/products/weborb-for-net/developer-den/technical-articles/installing-weborb-on-vista-iis-7-install.html">WebORB recommends to use the &#8220;Integrated&#8221; mode</a>.</p>
<p><strong>MidnightCoders support</strong><br />
We asked MidnightCoders to send us a community edition license, and they instantly answered. We got our license within the 48 hours after our first mail (I was the one slowing it down).</p>
<p><strong>Quick note on the project</strong><br />
To give you a better view of the project I&#8217;m talking about :<br />
GPRS Equipment <--(<a href="http://florent.clairambault.fr/the-m2mp-protocol">M2MP protocol</a>)&#8211;> [Generic M2M Server] <--(WCF)--> [Business logic software] <--(WCF)--> [Flex connections server] <--(RTMP)--> Flex<br />
We&#8217;ve got a little equipment (<a href="http://florent.clairambault.fr/tag/tc65">TC65</a> based as you can guess) that connects to a generic server using our own (real-time and bandwidth optimized) protocol. A business logic software connects to this server using a WCF service. And then we have the WebORB.Net / IIS that connects to this business logic software. </p>
<p>WCF helps make very interesting .Net applications because it simplifies all the communication but can also create deadlocks you might not have seen. Take this example : You have a lock on the WCF Server on the clients list object, you make a call to the WCF client and this client makes a call to the WCF Server that also requires a lock. If you were doing all this client/server calls on the same process this wouldn&#8217;t be a problem. But as you use WCF client-to-server and server-to-client calls are made on differents threads. You create a deadlock (unless you set the OperationContract attribute to IsOneWay and/or you fix the deadlock source).</p>
<p>If you&#8217;re doing real-time applications, I would recommend to define all the frequently used methods with the &#8220;IsOneWay=true&#8221; option. </p>
<p><em>06/11/2009 Update : I added a sample server-to-client code because some people were interested by it.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/net-flex-and-weborb-net/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>TC65 Module Exchange Suite (MES) problems</title>
		<link>http://florent.clairambault.fr/tc65-module-exchange-suite-mes-problems?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=tc65-module-exchange-suite-mes-problems</link>
		<comments>http://florent.clairambault.fr/tc65-module-exchange-suite-mes-problems#comments</comments>
		<pubDate>Sat, 03 Oct 2009 19:20:12 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Cinterion]]></category>
		<category><![CDATA[MES]]></category>
		<category><![CDATA[OBEX]]></category>
		<category><![CDATA[TC65]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=1748</guid>
		<description><![CDATA[When you want to locally deploy software on your TC65 chip, you need the Module Exchange Suite (MES). If it doesn&#8217;t work, it won&#8217;t tell you why, finding out why can be quite tricky. If you want to find out why the communication with your TC65 failed, the best way is to use the portmon [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to locally deploy software on your TC65 chip, you need the Module Exchange Suite (MES). If it doesn&#8217;t work, it won&#8217;t tell you why, finding out why can be quite tricky. </p>
<p>If you want to find out why the communication with your TC65 failed, the best way is to use the <a href="http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx">portmon tool</a> and see what is exchanged between the MESServer.exe and the chip.</p>
<p>I collected 3 portmon captures that could help you diagnose your MES communication problems :</p>
<ul>
<li><a href="http://florent.clairambault.fr/wp-content/uploads/2009/10/florent_mes.txt">Here</a> is a successful MES files listing at 19200 bps. You can see that it sends the &#8220;AT+CGMM&#8221; at different bit rates unless it gets a good response. Then it sets some serial communication options. And then it sends the &#8220;AT^SQWE=100&#8243; commands which fails and then establish a successful link using the &#8220;AT^SQWE=3&#8243; command.</li>
<li><a href="http://florent.clairambault.fr/wp-content/uploads/2009/10/florent_mes_failed.txt">Here</a> a failed MES file listing. Here, after the &#8220;&#8221;AT^SQWE=3&#8243;&#8221; is sent, MES sends a 26 bytes message and receives a 41 bytes message from the chip. Then it should request the file listing. But here, MES doesn&#8217;t request anything. Maybe MES doesn&#8217;t work well, or maybe the reply from the chip doesn&#8217;t satisfy his requirements.<br />
Anyway, after that it should send a 27 bytes message containing : &#8220;x-obex/folder-listing&#8221;, and it should get the file listing. But it doesn&#8217;t. It reads on the serial port like if it was still waiting for something. And finally, it closes the connection (with &#8220;+++&#8221;).</li>
<li><a href="http://florent.clairambault.fr/wp-content/uploads/2009/10/florent_mes_failed.txt">Here</a> a totally failed communication. Here it&#8217;s because the modem gets stuck on waiting for the modem hardware flow control (&#8220;IOCTL_SERIAL_GET_MODEMSTATUS&#8221;) when it&#8217;s only a 3 wires (TX,RX,GND) communication. So MES never reads or writes anything.</li>
</ul>
<p>If you have the same kind of problem, you can send me your portmon capture file.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/tc65-module-exchange-suite-mes-problems/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 2.919 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-29 16:43:09 -->
