Skip to content

Use socket.recv instead of socket.read #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

brentru
Copy link
Member

@brentru brentru commented Aug 29, 2019

Switching socket.read to socket.recv to match the CircuitPython Socket API and the CPython Socket API.

  • read now calls recv, has a note regarding future depreciation

MiniMQTT and Requests are affected by this change.

Tested on: Adafruit CircuitPython 4.0.2 on 2019-06-27; Adafruit PyPortal with samd51j20

Tests ran:
esp32spi_simpletest.py - ESP + Requests

Ping google.com: 10 ms
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)

----------------------------------------

Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
----------------------------------------
{'time': {'updated': 'Aug 29, 2019 21:35:00 UTC', 'updatedISO': '2019-08-29T21:35:00+00:00', 'updateduk': 'Aug 29, 2019 at 22:35 BST'}, 'disclaimer': 'This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 9513.59, 'rate': '9,513.5900'}}}
----------------------------------------
Done!

esp32spi_aio_post.py - WiFiManager + Requests

ESP32 SPI webclient test
Posting data...{'lat': None, 'feed_id': 997503, 'ele': None, 'expiration': '2019-10-28T21:36:43Z', 'id': '0E82WHFFNKECTNQ5JZP2DVH7C8', 'lon': None, 'value': '0', 'feed_key': 'test', 'location': None, 'created_at': '2019-08-29T21:36:43Z', 'created_epoch': 1567114603}
OK
Posting data...{'lat': None, 'feed_id': 997503, 'ele': None, 'expiration': '2019-10-28T21:37:02Z', 'id': '0E82WHN3B7J3DMSETJ1Y0QWRMZ', 'lon': None, 'value': '1', 'feed_key': 'test', 'location': None, 'created_at': '2019-08-29T21:37:02Z', 'created_epoch': 1567114622}
OK

MiniMQTT Adafruit IO Example

code.py output:
Connecting to Adafruit IO...
Connected to Adafruit IO! Listening for topic changes on snip/feeds/onoff
Sending photocell value: 0...
Sent!
Sending photocell value: 1...
Sent!
Sending photocell value: 2...
Sent!
Sending photocell value: 3...
Sent!
Sending photocell value: 4...
Sent!
Sending photocell value: 5...
Sent!

@brentru brentru requested a review from a team August 29, 2019 21:47
@brentru brentru merged commit c28977f into adafruit:master Aug 29, 2019
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 30, 2019
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 1.9.2 from 1.9.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#71 from brentru/switch-read
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#70 from brentru/sock-send
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#68 from mscosti/get_time_err_ap

Updating https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH to 5.0.1 from 5.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_LIS3DH#55 from jerryneedell/jerryn_adc
  > Merge pull request adafruit/Adafruit_CircuitPython_LIS3DH#53 from jerryneedell/jerryn_pygamer

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 1.1.4 from 1.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#8 from brentru/switch-read
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#7 from brentru/sock-send

Updating https://github.com/adafruit/Adafruit_CircuitPython_Requests to 1.1.2 from v1.1.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#9 from brentru/switch-read
  > Merge pull request adafruit/Adafruit_CircuitPython_Requests#8 from brentru/sock-send
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants