Premise Resetting serial port from script driver

Motorola Premise

franky

Member
One of the challenging parts of making a reliable system, at least for me, is handling power outages and unexpected system restarts. One of the many things that causes problems is that sometimes a serial port needs to be reset (closed and reopened) in order to reestablish communication with the device.

I can't see an obvious way to reset a serial port from a script driver. I thought about clearing and then setting the Network property, but this seems like a rather indirect way of closing and reopening the serial port. Does anyone know how to do this, or have some good ideas?

Regards,
Frank
 
Is the driver a module (from an imported xdo file) or from an add-in?

If you download the Beta Brite module, it's a simple example that uses a feedback response as a keep alive. When no feedback is received from the Beta Brite, the port is reset.

Description of Beta Brite port reset:
OnChangeNetwork stores the serial port to a container so that it can be used later is the port needs resetting (if the current port is not nothing).

OnChangeOnInit starts the polling upon port initialization.

NetworkQuery is called by PollDevice and sends a poll command to the Beta Brite.

OnChangeOnNewData resets a timer that upon timing out will set InterfaceFailure to true.

Upon InterfaceFailure being true, OnChangeInterfaceFailure will set an event then call ResetPort.

ResetPort sets the serial port to nothing, then three seconds later sets it to the port held in the container from when the port was first set to a non-nothing value.

Hope this helps!
 
Thanks, etc! I have a problem w/ my GC-100 going off-line (or is it my Integra?) - this would be a great help in keeping it alive....
 
Thanks etc6849. This particular driver is a custom device created in the Premise Builder, so it's just vbscript. However I suppose I should consider doing something similar in any C++ drivers too. The approach you described is almost identical to what I started developing, so I'm happy to see I wasn't going off in the weeds. I was just hoping there were some functions to directly close/reopen the port rather than doing this indirectly by clearing and then setting the port.
 
Back
Top