Home AMXForums Archive Threads Residential Forum

Programming Doubt

vijaykumarvijaykumar Junior MemberPosts: 18
Hi guys.,

just i am giving how can i do the program for amx devices,,present i am having a modules Met-Ecom , Matrix audio controller and csg-544 SIP ...Etc

in my Netlinx project ..for every module main file code..i am copying and paste in my Main(Master file) Project File,for that one in my project master file having the lot of code..

IS THEIR ANY OTHER WAY TO INSERT THOSE MODULES WITHOUT COPY OR EDIT IN MY PROJECT ..

Comments

  • PhreaKPhreaK Senior Member Posts: 966
    There are a number of ways you can structure your code so that it a lot more maintainable / readable / functional. Copying and pasting from the demo implementation that comes with modules is not one of them.

    All that you need to utilize the modules is to instantiate them using 'define_module', you will then communicate with them via string, command and channel events on the attached virtual device as defined in the module API doc. From there you can separate functionality out into include files etc and utilize functions for handling repeated tasks to maximize code re-use and/or provide a further level of abstraction from the module API.
  • DHawthorneDHawthorne Junior Member Posts: 4,584
    The "Main" files that come with modules are just there to tell you what is needed to make the module run, and how you put it in your program is entirely up to you. The better written ones only have the necessary variable and device declarations besides the define_module line itself. I generally like to organize my programs so variables for modules have their own spot I can easily go to, and I rename them so it's clear what they are for. For example, almost every module out there has a pane named dvTP or just TP - if you put them all in unchanged, the compiler will barf, but even one like that might leave you scratching your head two months later when you don't remember what module it belongs to.
Sign In or Register to comment.