Browse Source

Made SSL force the handshake instead of waiting until communication occurs. This allows us to grab the config automatically in open.

pyserial_fix
Scott Petersen 11 years ago
parent
commit
6723d81813
9 changed files with 4 additions and 11 deletions
  1. +0
    -3
      examples/alarm_email.py
  2. +0
    -1
      examples/basics.py
  3. +0
    -1
      examples/rf_device.py
  4. +0
    -1
      examples/serialport.py
  5. +0
    -1
      examples/socket_example.py
  6. +0
    -3
      examples/ssl_socket.py
  7. +0
    -1
      examples/virtual_zone_expander.py
  8. +1
    -0
      pyad2/ad2.py
  9. +3
    -0
      pyad2/devices.py

+ 0
- 3
examples/alarm_email.py View File

@@ -26,9 +26,6 @@ def main():
device.on_alarm += handle_alarm
device.open()

# Retrieve the device configuration
device.get_config()

# Wait for events
while True:
time.sleep(1)


+ 0
- 1
examples/basics.py View File

@@ -13,7 +13,6 @@ def main():
# Set up an event handler and open the device
device.on_message += handle_message
device.open()
device.get_config()

# Wait for events.
while True:


+ 0
- 1
examples/rf_device.py View File

@@ -23,7 +23,6 @@ def main():
# Set up an event handler and open the device
device.on_rfx_message += handle_rfx
device.open()
device.get_config()

# Wait for events.
while True:


+ 0
- 1
examples/serialport.py View File

@@ -17,7 +17,6 @@ def main():
# Set up an event handler and open the device
device.on_message += handle_message
device.open(baudrate=BAUDRATE) # Override the default SerialDevice baudrate.
device.get_config()

# Wait for events.
while True:


+ 0
- 1
examples/socket_example.py View File

@@ -18,7 +18,6 @@ def main():
# Set up an event handler and open the device
device.on_message += handle_message
device.open()
device.get_config()

# Wait for events.
while True:


+ 0
- 3
examples/ssl_socket.py View File

@@ -33,9 +33,6 @@ def main():
device.on_message += handle_message
device.open()

time.sleep(1) # Allow time for SSL handshake to complete.
device.get_config()

# Wait for events.
while True:
time.sleep(1)


+ 0
- 1
examples/virtual_zone_expander.py View File

@@ -35,7 +35,6 @@ def main():
device.on_zone_restore += handle_zone_restore

device.open()
device.get_config()

# Wait for events.
last_update = time.time()


+ 1
- 0
pyad2/ad2.py View File

@@ -105,6 +105,7 @@ class AD2(object):
"""
self._wire_events()
self._device.open(baudrate=baudrate, no_reader_thread=no_reader_thread)
self.get_config()

def close(self):
"""


+ 3
- 0
pyad2/devices.py View File

@@ -880,6 +880,9 @@ class SocketDevice(Device):

self._device.connect((self._host, self._port))

if self._use_ssl:
self._device.do_handshake()

self._id = '{0}:{1}'.format(self._host, self._port)

except socket.error, err:


Loading…
Cancel
Save