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: IDataProducer

IDataProducer 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

stopProcess() None[source]

Stops the process by setting the event flag.

Returns:

None

Return type:

None

stopSend() None[source]

Stops sending data by clearing the event flag.

Returns:

None

Return type:

None

class brace.Server.GPIOSynch.PushButton.Trigger(triggerState: bool, t: float)[source]

Bases: NamedTuple

NamedTuple data object that describes a trigger state (0 when not pressed, 1 when pressed).

t: float

Alias for field number 1

triggerState: bool

Alias for field number 0

Module contents