mirror of
https://github.com/JoelBender/bacpypes
synced 2025-10-27 00:57:47 +08:00
pass the iocb to the application in the core thread context (usually the main thread) by calling for the sample applications with a console thread (#247)
This commit is contained in:
@@ -11,7 +11,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -145,7 +145,7 @@ class SubscribeCOVConsoleCmd(ConsoleCmd):
|
||||
if _debug: SubscribeCOVConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -11,7 +11,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -78,7 +78,7 @@ class DCCConsoleCmd(ConsoleCmd):
|
||||
if _debug: DCCConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -72,7 +72,7 @@ from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.pdu import Address, LocalBroadcast, GlobalBroadcast
|
||||
from bacpypes.comm import bind
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
# application layer
|
||||
@@ -490,7 +490,7 @@ class DiscoverConsoleCmd(ConsoleCmd):
|
||||
if _debug: DiscoverConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# sleep for responses
|
||||
time.sleep(3.0)
|
||||
@@ -575,7 +575,7 @@ class DiscoverConsoleCmd(ConsoleCmd):
|
||||
if _debug: DiscoverConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
@@ -716,7 +716,7 @@ class DiscoverConsoleCmd(ConsoleCmd):
|
||||
if _debug: DiscoverConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -17,7 +17,7 @@ import SimpleHTTPServer
|
||||
from bacpypes.debugging import class_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
|
||||
from bacpypes.core import run
|
||||
from bacpypes.core import run, deferred
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address, GlobalBroadcast
|
||||
@@ -138,7 +138,7 @@ class ThreadedHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
if _debug: ThreadedHTTPRequestHandler._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -75,7 +75,7 @@ class ReadPointListThread(Thread):
|
||||
if _debug: ReadPointListThread._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for the response
|
||||
iocb.wait()
|
||||
|
||||
@@ -12,7 +12,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -68,7 +68,7 @@ class ReadPropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadPropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -12,7 +12,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -73,7 +73,7 @@ class ReadPropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadPropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -13,7 +13,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -64,7 +64,7 @@ class ReadPropertyAnyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadPropertyAnyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -12,7 +12,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -112,7 +112,7 @@ class ReadPropertyMultipleConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadPropertyMultipleConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -12,7 +12,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -119,7 +119,7 @@ class ReadPropertyMultipleConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadPropertyMultipleConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -12,7 +12,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -66,7 +66,7 @@ class ReadRangeConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadRangeConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -11,7 +11,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -71,7 +71,7 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadWritePropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -14,7 +14,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -78,7 +78,7 @@ class TestConsoleCmd(ConsoleCmd):
|
||||
if _debug: TestConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
@@ -140,7 +140,7 @@ class TestConsoleCmd(ConsoleCmd):
|
||||
if _debug: TestConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
@@ -204,7 +204,7 @@ class TestConsoleCmd(ConsoleCmd):
|
||||
if _debug: TestConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
@@ -266,7 +266,7 @@ class TestConsoleCmd(ConsoleCmd):
|
||||
if _debug: TestConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -14,7 +14,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -72,7 +72,7 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadWritePropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
@@ -212,7 +212,7 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadWritePropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -86,7 +86,7 @@ class ReadPointListThread(Thread):
|
||||
if _debug: ReadPointListThread._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for the response
|
||||
iocb.wait()
|
||||
|
||||
@@ -14,7 +14,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address
|
||||
@@ -76,7 +76,7 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadWritePropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
@@ -199,7 +199,7 @@ class ReadWritePropertyConsoleCmd(ConsoleCmd):
|
||||
if _debug: ReadWritePropertyConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
@@ -12,7 +12,7 @@ from bacpypes.debugging import bacpypes_debugging, ModuleLogger
|
||||
from bacpypes.consolelogging import ConfigArgumentParser
|
||||
from bacpypes.consolecmd import ConsoleCmd
|
||||
|
||||
from bacpypes.core import run, enable_sleeping
|
||||
from bacpypes.core import run, deferred, enable_sleeping
|
||||
from bacpypes.iocb import IOCB
|
||||
|
||||
from bacpypes.pdu import Address, GlobalBroadcast
|
||||
|
||||
@@ -80,7 +80,7 @@ class WriteSomethingConsoleCmd(ConsoleCmd):
|
||||
if _debug: WriteSomethingConsoleCmd._debug(" - iocb: %r", iocb)
|
||||
|
||||
# give it to the application
|
||||
this_application.request_io(iocb)
|
||||
deferred(this_application.request_io, iocb)
|
||||
|
||||
# wait for it to complete
|
||||
iocb.wait()
|
||||
|
||||
Reference in New Issue
Block a user