View Full Version : SendMessage and X-10
Ron
October 13th, 2002, 03:55 PM
I tried to access that FTP site but i could not get in. The Message box is the Message number that gets sent to the application.
Usually its specified as WM_USER+number.
WM_USER = 1024
thus
WM_USER + 10 = 1034
See if you can find that.
Ron
Ron
October 13th, 2002, 03:55 PM
-Mark
Mark F wrote:
It looks like you need to send a long pointer to a memory location to the X10COM32.exe application.
How should this work ? Normally one program cannot read a memory location in the other program. Have you got some info/examples on this?
Thanks!
Ron
October 13th, 2002, 03:55 PM
Aah how could i forget that one,.. thanks Mark. But we don't know that this is the way the X10 stuff actually works :( Besides, it would seem more logical to use a WM_COPYDATA for this kinda stuff. Oh well,.. logics.
Ron
October 13th, 2002, 03:55 PM
No I didn't read the document yet.
And for the lucky winners i've already created a WM_COPYDATA plugin!!! See the download page.
Ron
Ron
October 13th, 2002, 03:55 PM
I've just got the documents,.. I saw that currently available plugins won't do the job, on the otherhand it won't be hard for anyone with a little experience to make this. Of course i'm always here to ask...
SteveV
October 13th, 2002, 03:55 PM
Hi Mark,
I'm not Will, but I was in the neighborhood too. :)
x10com32.exe is part of X10's free Active Home App available at:
ftp://ftp.x10.com/pub/applications/activehome/x10ah141.exe
Regards -- Steve
Mark F
October 13th, 2002, 03:55 PM
Hi Will,
I'm not Ron, but I was in the neighborhood. :)
It looks like you need to send a long pointer to a memory location to the X10COM32.exe application. This application will then parse the message (like "A1 dim to 090%, delay 025") to obtain the right values for the actual command. Unforunately, I don't think SendMessage 1.5 supports sending pointers to strings as the parameter(s) of a SendMessage. (jump in any time, Ron :) )
This sure looks like a juicy (and easy to program) api. If you don't mind me asking, what software package is this and where did you get it? I'm still swamped at work (doing weekends SUCKS!) but I could put it on the list to build a simple action plugin for it.
[Edited by Mark F on 04-23-2001 at 03:59 PM GMT]
Mark F
October 13th, 2002, 03:55 PM
Steve - Thanks! I'll be looking at this some more. I just don't know when. :(
Will - All my in home development is on hold as I make a living. We are in a major crunch at work and that always takes priority. :(
Another problem you'll find with registers is the number strings are only as large as the number of significant digits. That means 50 is "50", not the "050" that X10com32 requires.
Ron - Do a GlobalAlloc and a GlobalLock (win32 calls) to get a pointer to memory shared between applications. Like this:
// just an example!
char str[]="yadda yadda yadda";
// allocate some shared memory to hold the string (include terminating null)
HANDLE hMem = GlobalAlloc(GMEM_MOVEABLE+GMEM_DDESHARE+GMEM_SHARE , strlen(str)+1);
// increment the use count on the memory and cast to a pointer
char *pChar = (char*)GlobalLock(hMem);
// copy the string to the global memory
strcpy(pChar, str);
// now send the message. (I think it is like this but you would know this better than me) :)
SendMessage(hWndTarget,WM_COMMAND,302,pChar);
// don't post the message above as you need to do
// the following AFTER the app has used the pointer
GlobalUnlock(hMem);
GlobalFree(hMem);
Mark F
October 13th, 2002, 03:55 PM
Can you still not FTP the document at the top of this set of posts? It is like you are reading it to me. :)
From that document -
The communications bridge will also accept the WM_COPYDATA message to provide the same functionality as the WM_COMMAND message. The parameters for the WM_COPYDATA message are as follows:
wParam Handle of the window sending the message
lParam Far pointer to a COPYDATASTRUCT structure.
The dwData parameter of the COPYDATASTRUCT structure defines the action that is to be taken by the communication bridge, and the cbData and lpData parameters define any additional data that is required. Possible values for dwData are:
CDM_REGISTER 0x0001
CDM_UNREGISTER 0x0002
Messages used to register and unregister the client application to receive status updates whenever a change of state is detected. The cbData and lpData parameters should be 0.
CDM_TRANSMIT 0x0003
Used to initiate an X-10 transmission. The cbData should indicate the length of the data string that identifies the transmission (ie A1 On, Delay 000) and the lpData contains a FAR pointer to the data string.
Tell you what, I'll download the doc and send it to you.
Mark F
October 13th, 2002, 03:55 PM
I've been working on a plugin to use the X10COMM communications bridge. I need help deciding how to handle Girder registers.
Any suggestions on an interface that would be both easy and flexible? I have a very rigid interface working now (lots of values in dropdown boxes). This is the third plugin for this weekend. :smile:
Caffiend
October 13th, 2002, 03:55 PM
What is the Message Number field in SendMessage 1.5 for? I'm trying to use Registers and the new SendMessage to send to the Activehome X10COM32.exe so that I can control all the lights in my house using my Pronto with a keypad, and registers to be able to access all 255 codes with discrete dim levels as well. I put the x10comm help file at:
FTP://ftp.ausdig.com/will/x10comm.hlp
in case some kind soul wants to help me figure this out. If I understand this correctly, I should be able to target the communication bridge (x10com32.exe) with wParam "302" and lParam "a3 on", for example, to turn on lamp A3. I'm pretty sure I can do the register stuff now, but I don't understand the Message Number portion.
Thanks!
-will
Caffiend
October 13th, 2002, 03:55 PM
Hmmm... I'm not finding that. I don't know why my FTP wouldn't work for you. Here's the juicy portions I think:
************Begin Quote************
The communications bridge will accept the WM_COMMAND Windows message with the following parameters:
WORD parameter (wParam) Ordinal Value
IDC_REGISTER 300
IDC_UNREGISTER 301
IDC_TXDATA 302
<TRIM>
IDC_TXDATA:
This message is used to send a command on the power line.
The LONG parameter of the message may contain a far pointer to a buffer containing the command that is to be sent, or if the high word is null, the parameter may contain a command index to cause a configuration command to be transmitted to the interface.
Accepted Commands
The commands accepted by the interface are typically structured as follows:
<housecode and device code list> <function>, <delay>
The housecode and device code list is comma delimited, and each device must be of the same housecode (i.e. A1,B2,C3 is illegal). There should not be any spaces following the comma, nor at the beginning of the string.
After the housecode and device code list, there should be a single space followed by the function and any additional data associated with the function. Accepted functions are:
All Units Off
All Lights On
All Lights Off
Hail Request
Hail Acknowledge
Status On
Status Off
Status Request
<TRIM>
************End Quote************
Thanks for the help Ron!
Caffiend
October 13th, 2002, 03:55 PM
Hey Mark, I was wondering how your X-10 stuff was coming along. That file is installed with the X-10 Activehome software.
http://www.x10.com/home/offer.cgi?SOFT1,../software1.htm
Here's what I've been doing until now:
I run x10com32 on Windows start to load the "communication bridge".
Then use Girder's O.S.->Execute to send to x10com32.
The syntax for that is "x10com32 b2 on" or "x10com32 a5 dim to 050%". Which works great, but I was trying to figure out a way to use registers to simplify the 255 possible combinations, from the Pronto end and the Girder end.
I just realized I can only use registers to hold a numerical value, so it's not as simple as I wanted.
Ideally, I would push A then 5 then On and the command would execute, currently I have to have a discrete A5-On button, which would become extremely unwieldy, especially once you start throwing in Dim functions too.
-will
Caffiend
October 13th, 2002, 03:55 PM
So the easiest path I could come up with for now is to use a combination of registers and a batch file. Since registers aren't strings, I use a batch file to take registers 1, 2, 3 to assemble the syntax for the x10com32. This makes for the least amount of Girder commands and the fewest Pronto buttons as well. It's not as smooth as I might like, but it does work well.
-will
Caffiend
October 13th, 2002, 03:55 PM
I'm going to reply to my own message yet again...
So the problem I have with my current work-around is that the Batch file technique has a lag to it. I had it set to Hidden so that it didn't spawn the Command window, but then it was a full 3 seconds from button push to response. When I run it at Default it's less than a second. Would it be hard to make the registers support string values?
Maybe Mark F's X-10 CM11A Plug-in will support registers :)
-will
Caffiend
October 13th, 2002, 03:55 PM
Mark:
Yeah, I had read your post in another thread that you were really busy right now. Thanks for taking time to offer info on this! I've been trying to get into C/C++ but I haven't been able to spend a lot of time on that yet.
-will
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.