This module provides functions for the idle mode.
More...
This module provides functions for the idle mode.
◆ mygpio_event
Possible event types
| Enumerator |
|---|
| MYGPIO_EVENT_UNKNOWN | unknown
|
| MYGPIO_EVENT_GPIO_FALLING | GPIO falling.
|
| MYGPIO_EVENT_GPIO_RISING | GPIO rising.
|
| MYGPIO_EVENT_GPIO_LONG_PRESS | GPIO long_press.
|
| MYGPIO_EVENT_GPIO_LONG_PRESS_RELEASE | GPIO long_press release.
|
| MYGPIO_EVENT_INPUT | Input event.
|
◆ mygpio_free_idle_event()
Frees the struct received by mygpio_recv_idle_event
- Parameters
-
◆ mygpio_idle_event_get_event()
Returns the event type from an idle event.
- Parameters
-
- Returns
- The event type, one of enum mygpio_event.
◆ mygpio_idle_event_get_event_name()
Returns the event type name from an idle event.
- Parameters
-
- Returns
- The event type name
◆ mygpio_idle_event_get_gpio()
Returns the GPIO number from an idle event.
- Parameters
-
- Returns
- GPIO number.
◆ mygpio_idle_event_get_input_code()
Returns the input event code
- Parameters
-
- Returns
- char * or NULL if not an input event
◆ mygpio_idle_event_get_input_device()
Returns the input event device
- Parameters
-
- Returns
- char * or NULL if not an input event
◆ mygpio_idle_event_get_input_type()
Returns the input event type
- Parameters
-
- Returns
- char * or NULL if not an input event
◆ mygpio_idle_event_get_input_value()
Returns the input event value
- Parameters
-
- Returns
- char * or NULL if not an input event
◆ mygpio_idle_event_get_timestamp_ms()
Returns the timestamp from an idle event.
- Parameters
-
- Returns
- The timestamp in milliseconds.
◆ mygpio_lookup_event()
Lookups the name for the event.
- Parameters
-
- Returns
- Event name as string
◆ mygpio_parse_event()
Parses a string to the event type.
- Parameters
-
- Returns
- enum mygpio_event
◆ mygpio_recv_idle_event()
Receives a list element of the waiting idle events. Access the values with the mygpio_idle_event_get_* functions. The caller must free it with mygpio_free_idle_event.
- Parameters
-
| connection | Pointer to the connection struct returned by mygpio_connection_new. |
- Returns
- Allocated struct t_mygpio_idle_event or NULL on list end or error.
◆ mygpio_send_idle()
Enters the myGPIOd idle mode to get notifications about events. Retrieve the list of events with mygpio_recv_idle_event. In this mode no commands but mygpio_send_noidle are allowed. All timeouts are disabled.
- Parameters
-
| connection | Pointer to the connection struct returned by mygpio_connection_new. |
- Returns
- true on success, else false
◆ mygpio_send_noidle()
Exits the myGPIOd idle mode.
- Parameters
-
| connection | Pointer to the connection struct returned by mygpio_connection_new. |
- Returns
- true on success, else false
◆ mygpio_wait_idle()
Waits until an event occurs or the timeout expires. It returns instantly if events had occurred while not in idle mode.
- Parameters
-
| connection | Pointer to the connection struct returned by mygpio_connection_new. |
| timeout | Timeout in milliseconds, -1 for no timeout |
- Returns
- true if an event has occurred, false on timeout or error.