Getting Data Back From A Module (Correct Method)
xrmichael
Posts: 79
To the detriment of my social and family life, for the last few weeks i have been on with some modules for various bits of kit. After many pitfalls and suffering from ATOI ASCII To Insanity, they now seem to be working in a fashion. I now need to get the information back from the modules, each module contains variables/arrays within it holding the data i need, i presumed i could have read this information direct from my main programme but these variables are local to the module. So less rambling and to the questions.
My AMP module has an array of zone volumes i want to turn this into 12 levels, is the inbuilt CREATE_LEVEL suitable for this or is it for the Volume Card only. This array is updated every 2 secs from the amp and i only want to update the level on a change.
The dab module is holding info on station name, preset etc. Should i send this back with a SEND_STRING or can you make a Global Variable in the module and read it from the main programme.
Is there a nifty trick to see if data in my array has changed and then transmit the change sort of
If new vol <> old vol do this
Sorry for the garbled post.
My AMP module has an array of zone volumes i want to turn this into 12 levels, is the inbuilt CREATE_LEVEL suitable for this or is it for the Volume Card only. This array is updated every 2 secs from the amp and i only want to update the level on a change.
The dab module is holding info on station name, preset etc. Should i send this back with a SEND_STRING or can you make a Global Variable in the module and read it from the main programme.
Is there a nifty trick to see if data in my array has changed and then transmit the change sort of
If new vol <> old vol do this
Sorry for the garbled post.
0
Comments
Use levels on the virtual device associated with the module, and yes create_level is an option. Keep your variables local to the module unless they need to be persistent, and create your own protocol to deliver the information outside of the module with send_command (just because that's the current AMX standard). For example SEND_COMMAND vdvDev, "''CURRENTSTATIONNAME='',uStationCurrent.Name,$0A"
I have altered the Module a bit and its internal array holing volume etc is now split to current volume and new volume so i can tell and do something if the volume changes, i suppose the ? is what benefit do i get from creating a level do i need to create level. Am i not via the code already maintaining my own level ?
Basically i want to see all 12 amp levels from 1 page on the tp when done.
You don't have to use Levels. If in your module you are sending out to the virtual device the number, and once your virtual device receives the update... you should be done.
Another way to do it, instead of using virtual devices, is to pass a variable from main code into the module, then have your module's variable = the passed in variable.
I use that in my cable/sat module, because a module can not hold a persistent variable.
Why are you checking if the volume changes? I don't know what gear you are using but most preamps only send out data on a change so there is no need to poll or check for a different value.
Paul
This doesn't. It sends it current stats ever 2s you can ask for the stats for a channel but to do this would be 12 request and 12 replies ontop of the regular stats broadcast that i cannot stop, so i thought i was on the least traffic road.