ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#15052 - 06/04/04 08:53 PM Pocket PC with 802.11b
Todd R. Offline
active contributor


Registered: 05/27/03
Posts: 178
Loc: CA
Anyone using a Handheld Pocket PC with 802.11b wireless communicating to an Ocelot? Or Bluetooth?

What I was thinking was an HP iPAQ h4150 Palm type handheld that could send commands to the Ocelot, IE wireless X10, and IR, etc.. all in one handheld device!

Currently, I am implimenting a Palm IIIc with Omni Remote Pro, to send IR to a Xantech hub, and then to my Ocelot. But I have to point it to an IR receiver!

My other idea was a wall mounted Palm OS device, using a serial connection to talk to Ocelot via Serial.

Thanks,
_________________________
Todd Reed

Top
#15053 - 06/09/04 08:55 PM Re: Pocket PC with 802.11b
trevor Offline
journeyman


Registered: 01/11/03
Posts: 91
Loc: Sydney, Australia
Hi Todd,

Interesting question. The protocol for talking serial to an Ocelot is on the ADI site (somewhere!), and this is the easiest way. Other options are X-10, or IR. I do use IR as a communication, but I use a PC to generate the IR codes, which are then sent from a 3.5m jack along a cable to another jack, plugged in to an Ocelot. Code in the Ocelot can then translate this into whatever actions required.

If you intend to use a handheld, then a PC is the easiest bet, as it has more communications options available. Bluetooth to a PC works, for example, sending IR the same way to a Leopard. (Which is exactly the same as an Ocelot, in programming terms).

Of course, the problem is that PC's crash while the Ocelots and Leos live on....
_________________________
If it aint broke, try to fix it. It soon will be.

Top
#19120 - 12/10/07 03:13 PM Re: Pocket PC with 802.11b [Re: trevor]
wondersnarf Offline
newbie


Registered: 12/04/07
Posts: 6
I've got my pda talking to my ocelot. Having troubles with consistency but im working on that. Using xalib library which acts as a server for ocelot commands. You send it packets to its listening port and it will send the serial commands for you. Using this c-sharp code:
http://msdn2.microsoft.com/en-us/library/aa446527.aspx
to connect pda to my program. It automatically creates a connection between the pda and itself when the pda is switched on, over wifi. There's then a bit of code: which ive added to the program to send commands to xalib:

private void txtChatDisplay_TextChanged(object sender, EventArgs e)
{
string[] pieces = txtChatDisplay.Text.Split('>');
string[] extrapieces = pieces[pieces.Length - 1].Split(' ');
int Text = txtChatDisplay.Text.IndexOf("Bedroom Lights On");
if (extrapieces[extrapieces.Length - 3] == "Bedroom" & extrapieces[extrapieces.Length - 2] == "Lights")
{
X10(26, 0, 1, Convert.ToInt32(extrapieces[extrapieces.Length - 1]));
}

if (extrapieces[extrapieces.Length - 3] == "Lounge" & extrapieces[extrapieces.Length - 2] == "Lights")
{
X10(26, 0, 0, Convert.ToInt32(extrapieces[extrapieces.Length - 1]));
}

//CMax test = new CMax();
//test.OpenComms(1);
//test.SendX10(0, 17, 1);
//test.CloseComms();
}

private void ChatMainDT_Load(object sender, EventArgs e)
{

}

private void X10(int commandcode, int housecode, int keycode, int state)
{
tcpClient2 = new System.Net.Sockets.TcpClient(); //.Net.Sockets.TcpClient();
tcpClient2.Connect("127.0.0.1", 3000);
networkstream2 = tcpClient2.GetStream();
if (networkstream2.CanWrite == true & networkstream2.CanRead == true)
{
// Do a simple write.
//byte sendBytes = Encoding.ASCII.GetBytes("Is anybody there");
int test;

test = commandcode;
//test = End32(test)
test = System.Net.IPAddress.NetworkToHostOrder(test);

networkstream2.Write(BitConverter.GetBytes(test), 0, BitConverter.GetBytes(test).Length);

test = housecode;
//test = End32(test)
test = System.Net.IPAddress.NetworkToHostOrder(test);

networkstream2.Write(BitConverter.GetBytes(test), 0, BitConverter.GetBytes(test).Length);

test = keycode;
//test = End32(test)
test = System.Net.IPAddress.NetworkToHostOrder(test);

networkstream2.Write(BitConverter.GetBytes(test), 0, BitConverter.GetBytes(test).Length);

test = state;
//test = End32(test)
test = System.Net.IPAddress.NetworkToHostOrder(test);

networkstream2.Write(BitConverter.GetBytes(test), 0, BitConverter.GetBytes(test).Length);


}}
this code is very "get it working as fast and as simply as possible"... Im not even closing down the network stream when im done with it. This could be the root of my problems. My X10 function isnt really an x10 function at all but can be adapted to many different commands. The command codes are as follows:

eval("sub XA_UNKNOWN () { 0; }") unless defined(&XA_UNKNOWN);
eval("sub XA_LEARN_IR () { 1; }") unless defined(&XA_LEARN_IR);
eval("sub XA_LOCAL_IR () { 2; }") unless defined(&XA_LOCAL_IR);
eval("sub XA_REMOTE_IR () { 3; }") unless defined(&XA_REMOTE_IR);
eval("sub XA_GET_IR () { 4; }") unless defined(&XA_GET_IR);
eval("sub XA_SET_IR () { 5; }") unless defined(&XA_SET_IR);
eval("sub XA_SET_VARIABLE () { 6; }") unless defined(&XA_SET_VARIABLE);
eval("sub XA_SET_TIMER () { 7; }") unless defined(&XA_SET_TIMER);
eval("sub XA_GET_VARIABLES () { 8; }") unless defined(&XA_GET_VARIABLES);
eval("sub XA_GET_TIMERS () { 9; }") unless defined(&XA_GET_TIMERS);
eval("sub XA_SET_CPUXA_PARAM () { 10; }") unless defined(&XA_SET_CPUXA_PARAM);
eval("sub XA_SET_UNIT_PARAM () { 11; }") unless defined(&XA_SET_UNIT_PARAM);
eval("sub XA_GET_MEMORY () { 12; }") unless defined(&XA_GET_MEMORY);
eval("sub XA_SET_MEMORY () { 13; }") unless defined(&XA_SET_MEMORY);
eval("sub XA_GET_CPUXA_PARAMS () { 14; }") unless defined(&XA_GET_CPUXA_PARAMS);
eval("sub XA_GET_UNIT_PARAMS () { 15; }") unless defined(&XA_GET_UNIT_PARAMS);
eval("sub XA_GET_TYPES () { 16; }") unless defined(&XA_GET_TYPES);
eval("sub XA_GET_VERSIONS () { 17; }") unless defined(&XA_GET_VERSIONS);
eval("sub XA_IO_LATCHED () { 18; }") unless defined(&XA_IO_LATCHED);
eval("sub XA_IO_REALTIME () { 19; }") unless defined(&XA_IO_REALTIME);
eval("sub XA_SET_RELAY () { 20; }") unless defined(&XA_SET_RELAY);
eval("sub XA_GET_RTC () { 21; }") unless defined(&XA_GET_RTC);
eval("sub XA_SET_RTC () { 22; }") unless defined(&XA_SET_RTC);
eval("sub XA_SEND_X10 () { 23; }") unless defined(&XA_SEND_X10);
eval("sub XA_GET_X10 () { 24; }") unless defined(&XA_GET_X10);
eval("sub XA_X10STATES () { 25; }") unless defined(&XA_X10STATES);
eval("sub XA_X10_LEVEL () { 26; }") unless defined(&XA_X10_LEVEL);
eval("sub XA_X10_GROUP () { 27; }") unless defined(&XA_X10_GROUP);
eval("sub XA_RESCAN () { 28; }") unless defined(&XA_RESCAN);
eval("sub XA_RESTART () { 29; }") unless defined(&XA_RESTART);
eval("sub XA_INTERP_STOP () { 30; }") unless defined(&XA_INTERP_STOP);
eval("sub XA_INTERP_START () { 31; }") unless defined(&XA_INTERP_START);
eval("sub XA_INTERP_LOAD () { 32; }") unless defined(&XA_INTERP_LOAD);
eval("sub XA_ASCII_LOAD () { 33; }") unless defined(&XA_ASCII_LOAD);
eval("sub XA_PAGER_LOAD () { 34; }") unless defined(&XA_PAGER_LOAD);
eval("sub XA_EPHEM_LOAD () { 35; }") unless defined(&XA_EPHEM_LOAD);
eval("sub XA_GET_ADDRS () { 36; }") unless defined(&XA_GET_ADDRS);
eval("sub XA_MONITOR () { 37; }") unless defined(&XA_MONITOR);
eval("sub XA_HANGUP () { 38; }") unless defined(&XA_HANGUP);
eval("sub SERVER_REFUSED () { 0; }") unless defined(&SERVER_REFUSED);
eval("sub SERVER_FULL () { 1; }") unless defined(&SERVER_FULL);
eval("sub SERVER_INTERP () { 2; }") unless defined(&SERVER_INTERP);
eval("sub SERVER_OK () { 3; }") unless defined(&SERVER_OK);
eval("sub ERR_NONE () { 0; }") unless defined(&ERR_NONE);
eval("sub ERR_ACK () { 1; }") unless defined(&ERR_ACK);
eval("sub ERR_DATA () { 2; }") unless defined(&ERR_DATA);
eval("sub ERR_CRC_RX () { 3; }") unless defined(&ERR_CRC_RX);
eval("sub ERR_CRC_TX () { 4; }") unless defined(&ERR_CRC_TX);
eval("sub ERR_WRITE () { 5; }") unless defined(&ERR_WRITE);
eval("sub ERR_NOCMD () { 6; }") unless defined(&ERR_NOCMD);
eval("sub ERR_SOCKREAD () { 7; }") unless defined(&ERR_SOCKREAD);
eval("sub ERR_SOCKWRITE () { 8; }") unless defined(&ERR_SOCKWRITE);
eval("sub ERR_SHUTDOWN () { 9; }") unless defined(&ERR_SHUTDOWN);
eval("sub ERR_UNKNOWN () { 10; }") unless defined(&ERR_UNKNOWN);

The specific format for each command other than x10 I dont yet know. Other than that you send the command type on the first packet to the port followed by the variables associated with that command on the consequtive packets. The appropriate sequence of numbers can be found by examining the misterhouse perl code. Although not all the available functions are implemented. Or you can packet sniff the connection made by the command executable (NXACMD) included in xalib. This allows you to specify commands by using options, i.e. -a on -h A -k 1. You need a packet sniffer that works on the loopback interface, there's a trial one which works nicely: commview. filter for port 3000 which is default xalib port and then select reconstruct tcp/ip then look at the packets in hex mode. Thats the communication you want to replicate. Get a hex to decimal converter and you can see the command code comming first, followed by the parameters.

Hope this helps, you'll have to delve into some programing to get this working, but its well worth the effort. I now have control of my two dimmer modules via two slider bars on the pda screen, with the background as the plan layout of my house \:\) very cool!!! The ladies will be impressed ;\)

Oh and of course your pc needs to be on \:\( You could use a low power pc, nano-itx or something...

Marcus...
Alice: Would you tell me, please, which way I ought to go from here?'
That depends a good deal on where you want to get to,' said the Cat.
`I don't much care where--' said Alice.
`Then it doesn't matter which way you go,' said the Cat.
`--so long as I get somewhere,' Alice added as an explanation.

`Oh, you're sure to do that,' said the Cat, `if you only walk long enough.'



Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
3 registered (pbir, Bent, Martin in Texas) and 31 anonymous users online.
Recent Posts
SECU16IR Output Connecting To A Xantech Connecting Block
by Jean-Marie
Today at 08:36 AM
SECU16IR Output Connecting To A Xantech Connecting Block
by Jean-Marie
Today at 08:34 AM
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Does anyone have a copy of the latest TSE?
by sevenzenith1
01/30/12 05:17 AM
Shout Box

Newest Members
feshh, manu, kuro, chuck214, Funkhauser
2747 Registered Users
Forum Stats
2747 Members
19 Forums
3837 Topics
22713 Posts

Max Online: 67 @ 08/16/11 03:08 PM
February
Su M Tu W Th F Sa
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