Skip to content

Conversation

@brentru
Copy link
Member

@brentru brentru commented Oct 16, 2019

Exposing wifi attribute so wrapper libraries (AWS IoT, Adafruit IO) which create a minimqtt object can access WiFiManager and ESP32SPI (via client.wifi.esp) attributes.

@brentru brentru requested a review from a team October 16, 2019 14:40
Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if we end up using this with cell or ethernet?

@brentru
Copy link
Member Author

brentru commented Oct 16, 2019

@ladyada this only effects the check for a ESPSPI_WiFiManager. Other network_manager's (when we make them) would be detected and handled separately.

        network_manager_type = str(type(network_manager))
        if 'ESPSPI_WiFiManager' in network_manager_type:
            self.wifi = network_manager
        else:
            raise TypeError("This library requires a NetworkManager object.")

@ladyada
Copy link
Member

ladyada commented Oct 16, 2019

yeah but if its exposed, then people would rely on it?

@brentru
Copy link
Member Author

brentru commented Oct 16, 2019

@ladyada I don't think user-code will rely on this....Possibly a better method would be checking the esp's version from code if an esp is used, instead of relying on the MiniMQTT client.

@brentru
Copy link
Member Author

brentru commented Oct 17, 2019

@ladyada I don't think exposing from user-code would be a good idea, since libraries using a MiniMQTT object should be able to check set_psk and set_crt booleans (https://github.com/adafruit/Adafruit_CircuitPython_AWS_IOT/blob/master/adafruit_aws_iot.py#L82) on initialization...

I could pass in the wifi object to the library's init instead, but what if the library is using cellular or ethernet.

@brentru
Copy link
Member Author

brentru commented Oct 21, 2019

Closing in favor of adafruit/Adafruit_CircuitPython_AWS_IOT#4

@brentru brentru closed this Oct 21, 2019
@brentru brentru deleted the expose-wifi-attribute branch October 21, 2019 14:20
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