Module Expr Str Import alias ImportFrom alias alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias Assign NameStore Num Assign NameStore Call NameLoad Call NameLoad Assign NameStore NameLoad Assign NameStore NameLoad ClassDef bases NameLoad NameLoad body FunctionDef arguments args NameParam NameParam defaults body If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Expr Call NameLoad Return Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Slice Num If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Num If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad If CompareNotEq Call NameLoad NameLoad Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad Return Assign TupleStore NameStore NameStore NameLoad If CompareEq NameLoad Str body Assign NameStore NameLoad orelse If CompareIn Str NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str If CompareEq NameLoad Str body Assign NameStore TupleLoad SubscriptLoad NameLoad Index Num Call NameLoad NameLoad orelse Assign NameStore TupleLoad NameLoad Call NameLoad NameLoad orelse Assign NameStore TupleLoad NameLoad SubscriptLoad NameLoad Index Num If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad TryExcept body Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Str keyword NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad Return decorator_list FunctionDef arguments args NameParam NameParam defaults body If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad If CompareEq AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr decorator_list decorator_list NameLoad ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults body If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad If CompareEq AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad AttributeLoad NameLoad attr decorator_list decorator_list NameLoad TryFinally body TryExcept body Assign NameStore Call NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr Str If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore TupleLoad Str Num Assign NameStore TupleLoad Str Num orelse If Call AttributeLoad AttributeLoad NameLoad attr attr Str body Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num Assign NameStore TupleLoad Str NameLoad Assign NameStore TupleLoad Str NameLoad orelse Assign NameStore Call NameLoad AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str orelse If CompareEq NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Str orelse If CompareEq SubscriptLoad NameLoad Index Num Str body Expr Call AttributeLoad NameLoad attr Str orelse Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Expr Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Str NameLoad finalbody Expr Call AttributeLoad NameLoad attr Str
N/A N/A 
UDPConsole
==========

This is a sample application that is similar to the UDPMultiplexer.  It opens
a socket for unicast messages and (optionally) another for broadcast messages.

Run this application with a BACpypes IP address parameter.

    $ python UDPConsole.py <addr> [ --nobroadcast ]

The address can be one of the following forms:

    192.168.1.10             - unicast socket, no broadcast socket, port 47808
    192.168.1.10/24          - unicast socket, 192.168.1.255 broadcast socket, port 47808
    192.168.1.10:12345       - unicast socket, no broadcast socket, port 12345
    192.168.1.10/24:12345    - unicast socket, 192.168.1.255 broadcast socket, port 12345
    any                      - special tuple ('', 47808)
    any:12345                - special tuple ('', 12345)

Use the --nobroadcast option to prevent the application from opening the 
broadcast socket when one would otherwise be opened.

To send a packet, enter in a string in the form <addr> <message> where <addr>
is a BACpyes IP address (which may include the socket) or '*' for a local
broadcast.

Linux/MacOS Test Cases
----------------------

Here are some test cases for Linux and MacOS.

Using Any
~~~~~~~~~

    $ python samples/UDPConsole.py any
    * hi
    received u'hi' from ('10.0.1.5', 47808)

In this case the application received its own broadcast, but did not recognize
it as a broadcast message and did not recognize that it came from itself.
Broadcast messages from other devices sent to 255.255.255.255 or 10.0.1.255
are received, but also not recognized as broadcast messages.

Using the Local Address
~~~~~~~~~~~~~~~~~~~~~~~

    $ python samples/UDPConsole.py 10.0.1.5
    * hi
    received u'hi' from self

In this case it received its own broadcast and it recognized that it came from
itself, but it did not recognize it as a broadcast message.  Broadcast messages
from other devices sent to 255.255.255.255 or 10.0.1.255 are not received.

Using the CIDR Address
~~~~~~~~~~~~~~~~~~~~~~

    $ python samples/UDPConsole.py 10.0.1.5/24
    * hi
    received broadcast u'hi' from self

In this case it received its own broadcast, recognized that it came from itself,
and also recognized it was sent as a broadcast message.  Broadcast messages
from other devices sent to 255.255.255.255 are not received, but those sent to
10.0.1.255 are received and recognized as broadcast messages.
 N/A sys bacpypes.debugging bacpypes_debugging ModuleLogger bacpypes.udp UDPDirector bacpypes.comm Client Server bind bacpypes.pdu Address PDU bacpypes.core run stop bacpypes.consolelogging ArgumentParser bacpypes.console ConsoleClient N/A _debug 0 N/A _log N/A ModuleLogger N/A globals N/A local_unicast_tuple None N/A local_broadcast_tuple None MiddleMan N/A Client Server N/A indication N/A N/A self pdu N/A N/A N/A _debug N/A N/A N/A N/A MiddleMan _debug indication %r pdu N/A N/A N/A pdu pduData N/A N/A N/A stop N/A N/A line N/A N/A N/A N/A pdu pduData decode utf_8 N/A -1 N/A _debug N/A N/A N/A N/A MiddleMan _debug     - line: %r line N/A line_parts N/A N/A line split 1 N/A _debug N/A N/A N/A N/A MiddleMan _debug     - line_parts: %r line_parts N/A N/A N/A len line_parts 2 N/A N/A N/A N/A N/A sys stderr write N/A err: invalid line: %r
 N/A line N/A N/A N/A addr msg line_parts N/A N/A addr * N/A N/A dest local_broadcast_tuple N/A N/A N/A : addr N/A N/A N/A addr port N/A N/A addr split : N/A N/A addr * N/A N/A dest N/A N/A local_broadcast_tuple N/A 0 N/A int port N/A N/A dest N/A addr N/A int port N/A N/A dest N/A addr N/A local_unicast_tuple N/A 1 N/A _debug N/A N/A N/A N/A MiddleMan _debug     - dest: %r dest N/A N/A N/A N/A N/A self request N/A PDU N/A N/A msg encode utf_8 destination dest N/A N/A N/A Exception N/A err N/A N/A N/A N/A N/A sys stderr write N/A err: %r
 N/A err N/A N/A confirmation N/A N/A self pdu N/A N/A N/A _debug N/A N/A N/A N/A MiddleMan _debug confirmation %r pdu N/A line N/A N/A N/A pdu pduData decode utf_8 N/A _debug N/A N/A N/A N/A MiddleMan _debug     - line: %r line N/A N/A N/A pdu pduSource local_unicast_tuple N/A N/A N/A N/A N/A sys stdout write N/A received %r from self
 N/A line N/A N/A N/A N/A N/A sys stdout write N/A received %r from %s
 N/A line N/A pdu pduSource N/A N/A bacpypes_debugging BroadcastReceiver N/A Client N/A confirmation N/A N/A self pdu N/A N/A N/A _debug N/A N/A N/A N/A BroadcastReceiver _debug confirmation %r pdu N/A line N/A N/A N/A pdu pduData decode utf_8 N/A _debug N/A N/A N/A N/A MiddleMan _debug     - line: %r line N/A N/A N/A pdu pduSource local_unicast_tuple N/A N/A N/A N/A N/A sys stdout write N/A received broadcast %r from self
 N/A line N/A N/A N/A N/A N/A sys stdout write N/A received broadcast %r from %s
 N/A line N/A pdu pduSource N/A N/A bacpypes_debugging N/A N/A N/A N/A N/A parser N/A ArgumentParser description __doc__ N/A N/A N/A parser add_argument address help address of socket N/A N/A N/A parser add_argument --nobroadcast action store_true dest noBroadcast default False help do not create a broadcast socket N/A args N/A N/A parser parse_args N/A _debug N/A N/A N/A N/A _log debug initialization N/A _debug N/A N/A N/A N/A _log debug     - args: %r args N/A N/A N/A args address any N/A N/A local_unicast_tuple N/A 47808 N/A local_broadcast_tuple N/A 255.255.255.255 47808 N/A N/A N/A N/A N/A args address startswith any: N/A N/A port N/A int N/A N/A args address N/A 4 N/A local_unicast_tuple N/A port N/A local_broadcast_tuple N/A 255.255.255.255 port N/A N/A address N/A Address N/A args address N/A _debug N/A N/A N/A N/A _log debug     - local_address: %r address N/A local_unicast_tuple N/A address addrTuple N/A local_broadcast_tuple N/A address addrBroadcastTuple N/A _debug N/A N/A N/A N/A _log debug     - local_unicast_tuple: %r local_unicast_tuple N/A _debug N/A N/A N/A N/A _log debug     - local_broadcast_tuple: %r local_broadcast_tuple N/A console N/A ConsoleClient N/A middle_man N/A MiddleMan N/A unicast_director N/A UDPDirector local_unicast_tuple N/A N/A bind console middle_man unicast_director N/A N/A args noBroadcast N/A N/A N/A N/A _log debug     - skipping broadcast N/A N/A N/A local_unicast_tuple local_broadcast_tuple N/A N/A N/A N/A _log debug     - identical unicast and broadcast tuples N/A N/A N/A N/A local_broadcast_tuple N/A 0 255.255.255.255 N/A N/A N/A N/A _log debug     - special broadcast address only for sending N/A N/A broadcast_receiver N/A BroadcastReceiver N/A broadcast_director N/A UDPDirector local_broadcast_tuple reuse True N/A N/A bind broadcast_receiver broadcast_director N/A N/A N/A _log debug running N/A N/A run N/A N/A N/A Exception N/A e N/A N/A N/A N/A _log exception an error has occurred: %s e N/A N/A N/A N/A _log debug finally