.. |br| raw:: html
.. _ex_pf:
Port forwarding
===============
Do you want to do crazy interconnections by software? This is your section! |br|
You can find more information about forwarding in the ``Gps`` class here: :ref:`gps`.
You can find more information about forwarding in the ``Xbee`` class here: :ref:`xbee`.
You can find more information about forwarding in the ``RS232`` class here: :ref:`rs232`.
Forward XBee socket A to Gps1 receivers
---------------------------------------
All incoming information from XBEE socket A is forwarded to Gps1 UART1 (RX) port.
>>> import sbc
>>> pm = sbc.Power_Module()
>>> pm.gps2and3_on()
>>> pm.xbee_on()
>>> gps1 = sbc.Gps(1, 115200)
>>> xbee = sbc.Xbee(115200, "XBEE_A")
>>> xbee.forward_to(gps1)
Forward Gps1 UBX+NMEA to USB
-----------------------------
You don't need to do anything if this is your use case :) |br|
By connecting the SBC to your device via USB, you will have direct access to all GPS/GNSS receivers USB native ports. |br|
You can use u-center to enable/disable your preferred messages.
In case you want to access Gps2 or Gps3, you will only need to power them up:
>>> import sbc
>>> pm = sbc.Power_Module()
>>> pm.gps2and3_on()
Forward Gps1 UBX+NMEA to XBee socket B
---------------------------------------
All Gps1 UART1 (TX) data is forwarded to XBEE socket B peripheral.
>>> import sbc
>>> pm = sbc.Power_Module()
>>> pm.xbee_on()
>>> gps1 = sbc.Gps(1, 115200)
>>> xbee = sbc.Xbee(115200, "XBEE_B")
>>> gps1.forward_to(xbee)
Forward XBee socket A to RS232
------------------------------
All incoming information from XBEE socket A is forwarded to RS232#1 peripheral.
>>> import sbc
>>> pm = sbc.Power_Module()
>>> pm.xbee_on()
>>> rs232 = sbc.RS232()
>>> xbee = sbc.Xbee(115200, "XBEE_A")
>>> xbee.forward_to(rs232)