brace.Server.GPIOSynch package¶
Submodules¶
brace.Server.GPIOSynch.PushButton module¶
- class brace.Server.GPIOSynch.PushButton.ButtonPress(buttonPin: int, UPDATE_RATE_PER_SECOND: int, startTime: Synchronized = None, triggerTopicName: str = None, dataTopicName: str = None)[source]¶
Bases:
IDataProducerIDataProducer class that continually checks a pin for whether or not it is pressed to determine the synchronization state. The default topic to use is “trigger” which sends out a message which can be used for event driven actions (such as displaying text when the trigger is pressed).
- TRIGGER_TOPIC = 'trigger'¶
- onTrigger() None[source]¶
Callback function defined to publish message to the TRIGGER_TOPIC for event driven code.
- Returns:
None
- Return type:
None
- publishDataToMqtt(force: bool = False) None[source]¶
Sends messages to the MQTT IDataProducer topic. Messages are buffered and sent when the max number of elements is reached. It can also be forced with a parameter.
- Parameters:
force (bool) – An boolean parameter to force the element to be published to the MQTT topic without reaching the target elements.
- Returns:
None
- Return type:
None
- resetAllState() None[source]¶
Resets the multiprocessing Events of this object.
- Returns:
None
- Return type:
None
- start(timeSynchronizationCondition: Condition = None, **kwargs: dict[str, Any]) None[source]¶
Starts the process loop by initializing a button under pulldown position with a bounce time of 0.1 ms. Data is sent out when the target number of elements is reached and when the sendData Event is set.
- Parameters:
timeSynchronizationCondition (multiprocessing.Condition) – A Condition that is shared to stop the Event from running until the primary IDataProducer initializes the shared start time. Default: None
kwargs (dict[str, Any]) – Keyword arguments (unused).
- Returns:
None
- Return type:
None
- startSend() None[source]¶
Starts sending data by setting the event flag.
- Returns:
None
- Return type:
None