BSB Developer Docs
Loading...
Searching...
No Matches
desktop.h File Reference

Functions for controlling the currently running application. More...

#include <stdbool.h>

Go to the source code of this file.

Macros

#define RECORD_DESKTOP   "desktop"
 Record key to get the Desktop instance.
 

Typedefs

typedef struct Desktop Desktop
 Opaque declaration for the Desktop type.
 

Enumerations

enum  DesktopSwitchDirection { DesktopSwitchDirectionUp , DesktopSwitchDirectionDown , DesktopSwitchDirectionsCount }
 Direction of rotary switch movement. More...
 

Functions

bool desktop_replace_current_app (Desktop *instance, const char *name, const char *args)
 Request the Desktop service to replace the currently running app.
 
void desktop_pin_current_app (Desktop *instance, bool pin)
 Pin or unpin the currently running app.
 
DesktopSwitchDirection desktop_get_switch_direction (Desktop *instance)
 Get the direction of the last rotary switch movement.
 

Detailed Description

Functions for controlling the currently running application.

Normally, only one application can be run and visible on the displays (except for services, which may or may not draw something on the display(s)). Desktop service responds to the rotary switch position, additionally, it allows overriding the current app programmatically (e.g. starting from the Apps menu).

Enumeration Type Documentation

◆ DesktopSwitchDirection

Direction of rotary switch movement.

Enumerator
DesktopSwitchDirectionUp 

Switch moved up.

DesktopSwitchDirectionDown 

Switch moved down.

Function Documentation

◆ desktop_get_switch_direction()

DesktopSwitchDirection desktop_get_switch_direction ( Desktop * instance)

Get the direction of the last rotary switch movement.

Returns the direction the rotary switch was last moved in, which is used The direction is calculated based on comparing the previous switch position with the new position.

Parameters
[in]instancepointer to the Desktop instance
Returns
DesktopSwitchDirectionUp if switch was last moved up, DesktopSwitchDirectionDown if switch was last moved down

◆ desktop_pin_current_app()

void desktop_pin_current_app ( Desktop * instance,
bool pin )

Pin or unpin the currently running app.

Calling this function will prevent the Desktop from changing the currently running app in response to flicking the rotary switch, or, conversely, enable this behaviour, depending on the pin parameter value.

Warning
This function is intended for testing purposes only.
Parameters
[in,out]instancepointer to the Desktop instance
[in]pinpin current app if true, do not pin if false

◆ desktop_replace_current_app()

bool desktop_replace_current_app ( Desktop * instance,
const char * name,
const char * args )

Request the Desktop service to replace the currently running app.

Calling this function will merely schedule the request, not actually start the application. It may be overridden at any point in time by the rotary switch or further calls to this function.

Note
Both application name and arguments are copied, so they may be deleted immediately after calling this function.
Parameters
[in,out]instancepointer to the Desktop instance
[in]nameapp name or ID to replace the current app with
[in,out]argspointer to a zero-terminated string containing application arguments
Returns
true if the request has been scheduled, false otherwise