Musical programmable school bell "Student-3"
As I changed platform for the school bell, I publish the source code of the previous project "Student-3". Immediately explain that I wasn't planning to distribute the source somewhere other than Russia, so almost all code is written in Russian. To some it may seem funny, do not judge strictly, I just found it easier to write code.
a Little history
"Student 3" is a musical programmable school bell on the basis of cheap cell phone that has Java support. The idea is, I came by chance, when I was thinking about replacing the previous version of the school bell "the Schoolboy-2". It was quite primitive, as was assembled in the microcontroller AVR Mega series with a small harness and two-line display.
The problem was that it was homemade. Because it communicates with the fire alarm system, the iron must have a certificate of conformity, i.e. to pass the test that you need time, money. I wanted to avoid this moment, but you need to ready the iron, which would fit in functionality and was cheap. So, returning home one day, I paid attention to your cell phone. Why not? It contains all the essential just for this purpose. I don't even own was the thought that still no such idea in a head did not come, but I did review and know built on what other school bell system.
It was really a problem, I had not experienced with Java so tightly and I certainly did not write the MIDlet. It was not clear how to behave in a particular implementation of the JVM when operating in continuous mode. Also, I have not solved the problem with the signing of the MIDlet. I'm surprised the situation is that I have something somewhere to pay (regularly) to operate a cell phone at their discretion.
While putting aside the issue with the signing, I started to look for the cheapest and most convenient phone for experimentation. What a match that at this time there was a simple Fly MC150DS. Of all its useful properties, the main criterion for his choice was the lack of need to sign the MIDlet. It looked strange on the background of all the other devices of other firms, where the people on the forums what did not come up to get around this requirement.
The next step was to test the very basic possibility of using the phone as the automated system. Here I was waiting for one "wonderful" surprise that almost spoiled the beauty and simplicity of the idea. Downloading yourself a development environment, docks, etc., managed to sketch out something like a running engine, which formed a schedule for a task (playing a sound). As soon as I was able to test during the day, the work of the engine, I went to school with a request of pilot testing. Unlike the previous version, now you can play mp3 files and potentially do many other things, because the phone basically is a small PC.
After several days of testing showed strange behavior time. I could not believe the results, rechecking their day — application is inhibited for 20 seconds every day. It looked impossible, because I believed that the clock in your phone are exactly. But the fact remains a fact — 20 seconds difference from where they were running. It was only half the trouble, the second part was the fact that the MIDlet can't fix time in the phone. You can read, but correct — no. It's got me stumped. The main feature of automatic delivery of calls — is the exact time of their filing, and I have some unknown just a terrible jamb in this place.
When I recovered from the shock (so much time spent on empty idea), I noticed that turns time inside the MIDlet is different from the time in the phone, ie actually inside the MIDlet creates its own "flow" of time. Perhaps it was not interested in game developers, because a day on the phone no one is playing, but in my case this led to the accumulation of errors in time keeping. I didn't understand what exactly is happening inside the concrete implementations of the java machine, but I knew so. When you download java machine initialisere internal time counter and the system clock in the process flow, which is responsible for the timing, the brakes and therefore considers the wrong time, affecting the returned values of Date().
What to do? I was thinking only one thing — extra time tracking in the program and adjust assignments for timers depending on the coming up for all time of the amendment. Honestly, I myself after a few years I don't know exactly how it works for me, but it works. Every day at midnight there is a formation of the package of calls, the time is adjusted, where the Delta is calculated as the product since the beginning of the work day for a discrepancy of one day. This daily closure is determined experimentally by results of tests. The way, of course, crooked, but that phone call has worked a total of three years, until it fell off
About the project
A detailed description of the program can be found in the user Manual that I have attached below. The source code on github, I have collected the last time it seems in NetBeans 8. The work of the MIDlet can be fully tested on the emulator. You need to collect the debug version putting in the file main.java value:
the
// Set or reset for the debug mode.
static final public boolean REGIMESOR = true;
It should in the root of the filesystem to put Ringtones folder from github. There are melodies themselves, and configuration files. Perhaps in the file Настройки.txt you will need to edit the path on the local emulator, I just do not remember. To see what's running under the debugger.
The program also uses the microlog module, which has a very detailed statistics of what is done in the MIDlet. At the same time in the same folder with the tunes file is created microlog.txt where to watch for user activity or errors arising in the course of work. It is very convenient.
Maybe my project will come across someone in any ideas to use a mobile phone. Very sorry that so much computing goodness every year is thrown in the dustbin of history, but they could still serve and serve, grinding the ones and zeroes.
Links
1. Source on github.
2. Schoolboy-3. User manual (pdf).
3. Musical programmable school bell "Student 4".
Комментарии
Отправить комментарий