Modules and Multiple TP's
staticattic
Posts: 200
I am having problems implementing modules when multiple TP's are involved. With one TP and one device, I have no problems.
For example, if I declare a module like so:
DEFINE_MODULE 'Random_Things' mdl_Random_UI (vdvRandom_Device, dvTP, nButtons)
I can follow along just fine. If I have multiple TP's (that need to stay independent), and multiple devices, I get hung up. I was thinking of using something along the lines of:
DEFINE_MODULE 'Touchpanel_UI' TP1_UI(dvTP1,nButtons)
DEFINE_MODULE 'Touchpanel_UI' TP2_UI(dvTP2,nButtons)
DEFINE_MODULE 'Touchpanel_UI' TP3_UI(dvTP3,nButtons)
and the module name:
MODULE_NAME='Touchpanel_UI (DEV dvTP, INTEGER nButtons[])
That would work as far as telling me which TP was the last one to do something.
Now, if I add other devices and need to pass button arrays to those devices, I'm stuck. For example:
DEFINE_MODULE 'Another_Device' mdl_Another_Device_UI(xxx, nAnother_Device_Buttons)
For that, I was thinking it would be better to declare a virtual TP, a virtual device, and pass the button array via the virtual TP. I think that would work ok, but I would think if I was going that route, I would need a COMM module for the virtual TP and the real TP's that would be smart enough to figure out which real TP actually initiated the button press, and act accordingly. OR, would it be better to create a DEV array, put all of the TP's in it, and eliminate having to instantiate 3 UI's for the TP's?
For example, if I declare a module like so:
DEFINE_MODULE 'Random_Things' mdl_Random_UI (vdvRandom_Device, dvTP, nButtons)
I can follow along just fine. If I have multiple TP's (that need to stay independent), and multiple devices, I get hung up. I was thinking of using something along the lines of:
DEFINE_MODULE 'Touchpanel_UI' TP1_UI(dvTP1,nButtons)
DEFINE_MODULE 'Touchpanel_UI' TP2_UI(dvTP2,nButtons)
DEFINE_MODULE 'Touchpanel_UI' TP3_UI(dvTP3,nButtons)
and the module name:
MODULE_NAME='Touchpanel_UI (DEV dvTP, INTEGER nButtons[])
That would work as far as telling me which TP was the last one to do something.
Now, if I add other devices and need to pass button arrays to those devices, I'm stuck. For example:
DEFINE_MODULE 'Another_Device' mdl_Another_Device_UI(xxx, nAnother_Device_Buttons)
For that, I was thinking it would be better to declare a virtual TP, a virtual device, and pass the button array via the virtual TP. I think that would work ok, but I would think if I was going that route, I would need a COMM module for the virtual TP and the real TP's that would be smart enough to figure out which real TP actually initiated the button press, and act accordingly. OR, would it be better to create a DEV array, put all of the TP's in it, and eliminate having to instantiate 3 UI's for the TP's?
0
Comments
You'll probably have to do it the way you indicate. However, I'd be willing to bet that since it doesn't support multiple panels anyway, you're going to have collision problems with the method you're proposing. You'll just have to try it and see.
For most things, the protocol is simple enough that you can roll your own UI easily enough. I can count the UI parts of the module I use on one hand.
DEFINE_MODULE 'Touchpanel_UI' TP_UI(TOUCHPANEL,nButtons)
From that I also created modules like this:
DEFINE_MODULE 'Another_Device' mdl_Another_Device_UI(TOUCHPANEL, dvAnother_Device, nAnother_Device_Buttons)
In the TP UI module, I created a function to determine which TP was the one to initiate something. I should be able to take that info and make the module act accordingly.
In the main program, all I have are the device declarations and the module instantiations. From the AMX provided modules I have looked at as examples, that seems to be about par.