Skip to content

Add Condition to Stop read_response Function in i2c.py #10

@YairBenamou

Description

@YairBenamou

I’d like to propose an enhancement for the py532lib library, specifically in the i2c.py file. Currently, the read_response function continuously listens for incoming NFC chips without a built-in mechanism to stop this process based on a condition.

I suggest adding a simple flag to the class that can be used to control the execution of the loop.

def __init__(self, address=PN532_I2C_SLAVE_ADDRESS, i2c_channel=RPI_DEFAULT_I2C_NEW):
    ...
    self.condition = True

def read_response(self):
    ...

    while self.condition:

        ....

This change would provide more control over the NFC reading process, enabling users to stop listening based on specific conditions like listening for incoming chips only on working hours.

I have not found any existing method to stop the read_mifare() function from waiting for incoming chips, so this enhancement would fill a useful gap in the library’s functionality.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions