Wireless Connect Logo
Hello Guest! - Login
Contact Wireless Connect
Serial Port Signaling Monitor
Credit Cards Accepted
Back to Table Of Contents >>

Serial Port Monitor

 

Document revision: 1 (Mon Jul 11 10:17:08 GMT 2005)
Applies to: V2.9

General Information

Summary

Serial port monitoring utility monitors state of attached asynchronous serial ports and generates system events upon state change.

Specifications

Packages required: advanced-tools
License required: Level1
Submenu level: /tool sigwatch
Standards and Technologies: none
Hardware usage: Not significant

Related Documents

Sigwatch

Description

Sigwatch monitors state of the serial port pins.

Property Description

count (read-only: integer) - how many times the event for this item was triggered. Count is reset on reboot and on most item configuration changeslog (yes | no; default: no) - whether to add a message in form of name-of-sigwatch-item: signal changed [to high | to low] to System-Info facility whenever this sigwatch item is triggeredname (name) - name of the sigwatch itemon-condition (on | off | change; default: on) - on what condition to trigger action of this item

on - trigger when state of pin changes to high
off - trigger when state of pin changes to low
change - trigger whenever state of pin changes. If state of pin changes rapidly, there might be triggered only one action for several state changes

port (name) - serial port name to monitorscript (name) - script to execute when this item is trigeredsignal (dtr | rts | cts | dcd | ri | dsr; default: rts) - name of signal of number of pin (for standard 9-pin connector) to monitor

dtr - Data Terminal Ready (pin #4)
rts - Request To Send (pin #7)
cts - Clear To Send (pin #8)
dcd - Data Carrier Detect (pin #1)
ri - Ring Indicator (pin #9)
dsr - Data Set Ready (pin #6)

state (read-only: text) - last remembered state of monitored signal

Notes

You can type actual script source instead of the script name from /system script list.

Example

In the following example we will add a new sigwatch item that monitors whether the port serial1 has cts signal.

[admin@10.179] tool sigwatch> pr
Flags: X - disabled
  #   NAME                                  PORT    SIGNAL     ON-CONDITION LOG
  0   test                                  serial1 cts        change       no
[admin@MikroTik] tool sigwatch>

By typing a command print detail interval=1s, we can check whether a cable is connected or it is not. See the state argument - if the cable is connected to the serial port, it shows on, otherwise it will be off.

[admin@MikroTik] tool sigwatch> print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=1 state=on

[admin@MikroTik] tool sigwatch> print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=1 state=on

[admin@MikroTik] tool sigwatch> print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=2 state=off

[admin@MikroTik] tool sigwatch> print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=2 state=off

[admin@MikroTik] tool sigwatch>

In the port menu you can see what signal is used by serial cable. For example, without any cables it looks like this:

[admin@MikroTik] port> print stats
  0 name="serial0" line-state=dtr,rts

  1 name="serial1" line-state=dtr,rts
[admin@MikroTik] port>

But after adding a serial cable to the serial port:

[admin@MikroTik] port> print stats
  0 name="serial0" line-state=dtr,rts

  1 name="serial1" line-state=dtr,rts,cts
[admin@MikroTik] port>

This means that the line-state besides the dtr and rts signals has also cts when a serial cable is connected.

The example below will execute a script whenever on-condition changes to off:

[admin@10.MikroTik] tool sigwatch> pr detail
Flags: X - disabled
  0   name="cts_rest" port=serial1 signal=cts on-condition=off log=no
      script=/system shutdown count=0 state=on
[admin@10.MikroTik] tool sigwatch>

It means that if a serial cable is connected to the serial port, all works fine, but as soon as it is disconnected, the router shuts down. It will continue all the time until the serial cable will not be connected again.

Back to Table Of Contents >>