converting AXCENT 3 code to Netlinx
playskool1
Posts: 64
I sucked out the code from a functional system that currently has a Axcent 3 Pro Controller. The system will be upgrading their master controller to a NI-3100. Looking at the source code it looks very different the way I would write it for Netlinx. Things that I have noticed were: there were no Data_Events and I'm not sure what else but it looks confusing to me but may be easy for others. I was wondering if there is an easy way of doing this? I tried compiling the existing code set up for Netlinx and I already got 1 error. Any tips or tricks that I should know? I have no kind of experience with Axcess.
0
Comments
It probably won't be too terribly hard to port it over by hand, but there isn't an 'automatic' way of doing it. Basically devices on an axcess system only had a channel number and a device address between 1-254. ) was the processor. There was no system number since it was only one processor period. So for each device in the define_device section, you need to change it from a single axlink address number to be x:1:0 where x is the original number.
Pushes will have to be converted into button_events with push and release information in them for each button. Original button push statements were written like this: push[dev_num,channel]. Just re-write it with the proper button_event and it will be fine.
Now as far as how serial worked, axcess relied on creating buffers. You can keep that kinda if you want. But Netlinx data_events is now how you get the data from serial devices. You will most likely re-do how you parse the data and use it within your system either by adding modules or whatnot.
Hopefully this gave you a good starting ground on understanding how to read axcess. Its not that much different, but you can just over think on how it works. It is a seriously dummed down version of netlinx.
Since when is it multi-threded? Netlinx is event based but events are not executed simultaneously, instead they are passed into a processing cue and executed serially - which does make some of the data management a little easier but can be a pain in the arse for performance.
In regards to porting the code, depending on your time / budget constraints and how the code was originally written it may even be worth looking at a re-write. By all means you can port things across but as ryanww said AXCESS and NetLinx are two different languages and there are a few different ways of accomplishing things within NetLinx that are a hell of a lot more effecient and logical than AXCESS. It will also make modifications and future upgrades a lot easier.
You shouldn't need to do any porting. NetLinx was specifically designed to be backwards-compatible with Axcess. You can do a 'compile as netlinx' on your axcess code and load it on the NL system, and it should build and run. You may have to change the device numbers to D:P:S notation, but I don't think even that is necessary.
That said, the NetLinx language has so much more capability than Axcess, it's not even funny. If there is any chance you'll ever have to look at this system again, and you have the time, I'd rewrite it as NetLinx. As Kim says, it will make future maintenance *much* easier.
The NetLinx compiler also is MUCH more accurate regarding syntax, because he has much more capabilities in coding. There are several situations where missing of wrong brackets work in AXcess, but in NetLinx the compile may fail or the code would not do the same like in AXcess previously.
You may also stumble over constant or variable names used in AXcess, which in NetLinx are keywords, like This would compile in AXcess, but in NetLinx "dev" is a keyword and may fail
Another issue might be the serial port configuration. In AXcess, the SET BAUD commonly was done in DEFINE_START, but this may fail in NetLinx, because the master has past DEFINE_START before the device is online, and so the SET BAUD fails. So for this a DATA_EVENT should be created.
Device numbers do in fact need to be changed, it's not an option. As I recall, there are one or two other mandatory changes, but the compiler will flag them as soon as you try to compile it. I'd say its about 90% backwards compatible. However, it's also probably well worth your time to go through and convert things like PUSH statements to button events, that kind of thing.
Be careful when you do this because if a push event is handled within the DEFINE_EVENT section, it won't be handled in the DEFINE_PROGRAM section. For example, adding: Will keep this from working Because the event was already handled in the DEFINE_EVENT section.