Module/Virtual Device Question
rynando
Posts: 68
I'm pulling my hair out over a simple problem. I can't get a virtual device that's been passed off to a module to handle events from the master program. The modules run fine. I can setup a timeline inside a module and have it tick away with send_string 0 messages. Sending events to the virtual device however is fruitless. Here's some sample code.
Main
[PHP]
DEFINE_DEVICE
dv1 = 5001:1:0;
dvTp = 10001:1:0;
vdv1 = 41001:1:0;
.....
DEFINE_START
DEFINE_MODULE 'TestMod' tmcomm(vdv1,dv1);
DEFINE_EVENT
BUTTON_EVENT[dvTp,1]
{
push:
{
send_command vdv1,"'SomeCommand'";
}
}
[/PHP]
Module
[PHP]
MODULE_NAME='TestMod'(dev vdv1, dev dv1)
.......
DEFINE_EVENT
DATA_EVENT[vdv1]
{
command:
{
send_string 0,"'Command=',data.text";
}
}
[/PHP]
When the button's pushed nothing happens. I don't get anything in the notifications section of NetLinx Studio. What am I doing wrong? I've written modules like this in the past and had everything work as expected. Now nothing. Is there something obvious that I'm missing? Also, should my virtual devices show up in the on-line tree?
Thanks,
R
Main
[PHP]
DEFINE_DEVICE
dv1 = 5001:1:0;
dvTp = 10001:1:0;
vdv1 = 41001:1:0;
.....
DEFINE_START
DEFINE_MODULE 'TestMod' tmcomm(vdv1,dv1);
DEFINE_EVENT
BUTTON_EVENT[dvTp,1]
{
push:
{
send_command vdv1,"'SomeCommand'";
}
}
[/PHP]
Module
[PHP]
MODULE_NAME='TestMod'(dev vdv1, dev dv1)
.......
DEFINE_EVENT
DATA_EVENT[vdv1]
{
command:
{
send_string 0,"'Command=',data.text";
}
}
[/PHP]
When the button's pushed nothing happens. I don't get anything in the notifications section of NetLinx Studio. What am I doing wrong? I've written modules like this in the past and had everything work as expected. Now nothing. Is there something obvious that I'm missing? Also, should my virtual devices show up in the on-line tree?
Thanks,
R
0
Comments
However, one thing... Your module is not duet. So, I'd keep the device of the virtual in the 3X,000 s range not the 4X,000. I don't know if this could be the problem since I've never ran into any issues myself.
Perhaps try changing the virtual device number to 34001 or something. Perhaps it's stomping on a duet module someplace.
hope that helps.
e
This was the issue! I didn't realize that that address space was reserved for duet. My Netlinx modules would initialize and run in that range which was throwing me off; I just couldn't interact with them which makes perfect sense now. With the module renumbered to 33xxx it works as expected and shows up in the online tree.
Thanks to both of you.
R