Update 02/08/03
A few more changes last week. A little bit of bug fixing, a little bit of feature. I'm going to start working on getting a much larger amount of the defined voice_cmds into a menuing system.
New features:
-
Added support for X10 Appliances. The Lights and Appliances can now be toggled on and off. Currently the list of Lights and Appliances is retrieved everytime you enter the menu. This takes about a 1-2 seconds. Later I'll probably add persist the lists and add a refresh option (or maybe handshake a "change#" to see if the local list is out of date).
-
Serial Items are now displayed much like the Lights and Appliance items. This uses the same code on the Cybiko side to it behaves the same way, except the Serial item state can't be modified, only displayed. I'll add a menu item for Sensor_Items later, but right now, all my motion sensors are still defined the 'old' way using Serial_Items.
-
There some dead code in the cy_echo.pl mh perl file that was the beginings of my handling of groups. Still trying to work out just to do that in a way that's compact, but allows me to exploit come of the graphics and versitility of the Cybiko client (stay tuned).
-
I got tired of selecting the partner_id (the gateway Cybiko) everytime I restarted the app. Now, once it's selected, it'll be reused across restarts until a new gateway is choosen.
Bug fixes:
-
Fixed the order of the ACK/NACK, pattern matching (since ACK matches both). I'm sure there's some really cool and slick perl way to do this, maybe someday when I learn perl...
-
Fixed a bug that hit when the buffer to be sent was exactly equal to the maximum packet size.
-
Fixed the bogus "Link lost" error messages that occured when you first went to the Lights menu, then visited the Commands menu.
-
Not at all a fix, but I bumped the limit of the MH->gateway serial buffer to about 10K from 3K. What I really need to do is grow the buffer if needed.
Update 01/29/03 - Take 2
Yes, those changes were hard to debug (still doing it) try these updates for a slightly better attempt.
Update 01/29/03
Some seemingly small updates, but took me a hell
of a time to debug.
-
Now serial data is broken up in MH into small packets (~80 bytes) and then
recombined at the gateway before sending to the Mr. Cybiko (MC).
I'm still using a simple length byte and no CRC to verify the data.
Now that the basic serial connection is working again I'll probably look
to see if there are any speed optimizations I can perform (this isn't the
speediest link in the world).
-
Picked up a couple of little bugs here and there
Update 01/25/03
Here's the latest addtion. Still what I'd
call very rough, but progressing. Some of that progress includes:
-
A little work on the serial 'protocol'. A simple length amount is
added to the front of the message being sent from MH to the gateway Cybiko.
If the length of the received message doesn't match the passed length amount,
the gateway 'NACK's the message and MH tries again. Yes, I know not
what I'd call stellar robustness, but it was quick and has greatly helped
in reducing transmission errors.
-
"All Lights" command has some initial support at the client Cybiko.
When selected, it'll retieve the current list of X10_Items, their ids and
state. This is then formatted into an item list on the Cybiko.
Selecting ON or OFF then hitting ENTER will send the ON/OFF command back
to MH.
-
A very little bit of code clean up (still a huge mess).
That's about it for now. I'll probably next go for a News
command. I like the idea of a having a list of headlines. Selecting
one gives you the full story. I've been reading up on how to do some
intersting things with the little guy. I might look into moving all
the MH<->Cybiko message processing to a partner app. This would
allow me a 'background thread' of sorts.......
Here's the initial bit
of hackery. Sorry, I haven't had much time since my initial investigations.
The resulting files are:
-
gateway directory. Within find the gateway.app. Load this on
a Classic Cybiko and connect to a PC that's running MH.
-
lights directory. Within find the lights.app. This is the end client.
BTW, the title for in the Cybiko menus is Mr. Cybiko ;-)
-
ComPort.dl needed on the 'gateway' Cybiko
-
cy_echo.pl mh perl script for issuing commands and sending
responses
-
mh.private.ini MH parms to define the Cybiko connected serial
port and baud.
All of this shamelessly incomplete. About all that works is
the following:
-
you can select a partner (the cybiko running the gateway app). You
have to do this overtime you start the lights.app. Preferences are
coming
-
issue free form text in the Commands window. Any generic text is
simply echoed back from MH. Text that starts with an '=' will get
executed as a MH command. If the command uses respond, the output
should go to the end client (sometimes ;-).
-
Weather will displayed the saved weather on the Cybiko (if any).
Selecting the Refresh button will grab the weather_forcast.txt and weather_conditions.txt
files from mh and send them to the Cybiko (and save them for later display).
Entering "=get internet weather data" in the Commands window will trigger
MH to refresh the files.
-
The "All Lights" menu simple displays the currently defined X10_Items.
The control of the items isn't hooked up yet.
There's still a HUGE amount of work to be done on this. For
example:
-
The serial protocol needs to be written. I'm finding the Cybiko is
dropping characters when more than 100 bytes are sent at a time (I hear
that 80 is a safe limit and or lowering the baud may help). So some
amounts of data queuing, checksum, retry, ack, ... needs to be implemented
between the gateway and MH
-
The current serial and messaging support had hard limit for data packet
size (3K if I remember correctly). Anything send over that will probably
just start stomping all over memory (if the transfer itself is even successful).
-
Finish hooking up some of the commands (News, TV, X10 Items, Motion Sensors,
MP3 control, .............)
-
Restructure code. This so far has been simple hacking away at existing
sample from various sources (and adding piles of code as I code).
Simply not the way to proceed. For example, I've got about 3 or 4
place where messages are read and processed (blech!).
-
Saved preferences. Since typing on the little critters is less than
fun, having settable menu items is very helpful.
-
Concurrent clients. Probably will never be a biggie, but annoys my that the Cybikos seems to get confused if messages are sent rapidly from two different clients.
-
MH integration points. For example, it'd be nice if items that are
to be display and controlled by a cybiko are some how tagged as such when
they're defined.
-
Graphics graphics and more graphics.