Netlinx Buffer
jgreer9514
Junior Member
I would like the ability to have a Netlinx module have a dynamic device passed into the module. I tried various ways of doing this but the buffer allocation will always attach to the original device passed into the module. I could decalre modules and have the users the ability to choose the type of device on the port not using Duet.
So an API call to reallocation the buffer to the device in Netlinx.
John
So an API call to reallocation the buffer to the device in Netlinx.
John
Comments
-
Variables are passed into a Netlinx module by reference. So, what the value is at startup is whats passed. To get dynamic info in you're going to have to do it by other means.jgreer9514 wrote: »I would like the ability to have a Netlinx module have a dynamic device passed into the module. I tried various ways of doing this but the buffer allocation will always attach to the original device passed into the module. I could decalre modules and have the users the ability to choose the type of device on the port not using Duet.
So an API call to reallocation the buffer to the device in Netlinx.
John
The easiest way that comes to mind is to create a command protocol and send commands to a virtual device created for the module.
Something along the lines of
send_command vdv_my_vDevice,"NEW_Device_Num:123:1:0
Then in the module you'd parse the string and reference the device with the new values.
It's going to be tricky in that events get ugly when trying to alter devices. -
Are you sure? I pass a variable over to my JSON parser and then parse directly on that within the module. It's here on the forum (and I think I posted the source code) if you want to look.ericmedley wrote: »Variables are passed into a Netlinx module by reference. So, what the value is at startup is whats passed. To get dynamic info in you're going to have to do it by other means.
So couldn't in the main program the device number would be a DEV var and when it changes in main code, it changes in the module?
Or maybe, I'm just not quite following . . . -
buffer
If you have a device declared and passed into the module and change it within your program there is no way to make the module re-sync the buffer with the new device. There is for touch panel events but not for the data event.
=( -
Curiously - is this a TPControl feature request? I'm not sure what they'd be able to do about. Again, perhaps posting this in the proper sub-forum would be of help.
-
jgreer9514 wrote: »I would like the ability to have a Netlinx module have a dynamic device passed into the module. I tried various ways of doing this but the buffer allocation will always attach to the original device passed into the module. I could decalre modules and have the users the ability to choose the type of device on the port not using Duet.
So an API call to reallocation the buffer to the device in Netlinx.
John
If you stay way from buffers and use DATA_EVENT this is easily done.// INSIDE MODULE DEFINE_EVENT DATA_EVENT[vdvDeviceID] { STRING: { // DO BUFFER PARSING HERE... } } DEFINE_PROGRAM if (vdvNewDeviceID != vdvDeviceID) { vdvDeviceID = vdvNewDeviceID; REBUILD_EVENT(); } -
I'm still not 100% sure exactly what you're trying to do but it sounds like you might just want to try using DYNAMIC_VIRTUAL_DEVICE. This will dynamically assign a device number in the 36,864+ address range. You'll guarantee a unique device number
Ex.
DEFINE_DEVICE
vdvDynVirtual = DYNAMIC_VIRTUAL_DEVICE -
Looking at the Netlinx.axi the DYNAMIC_VIRTUAL_DEVICE is statically assigned with a device number of 36864:1:0. Unless this device number is an alias for assigning a new device number then one will end up declaring many instances of the same device (?).I'm still not 100% sure exactly what you're trying to do but it sounds like you might just want to try using DYNAMIC_VIRTUAL_DEVICE. This will dynamically assign a device number in the 36,864+ address range. You'll guarantee a unique device number
Ex.
DEFINE_DEVICE
vdvDynVirtual = DYNAMIC_VIRTUAL_DEVICE
Kostas
Leave a Comment
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums