Skip to content

Instantly share code, notes, and snippets.

@Eeems
Last active November 11, 2021 16:01
Show Gist options
  • Save Eeems/728d4ec836b156d880ce521ab50e5d40 to your computer and use it in GitHub Desktop.
Save Eeems/728d4ec836b156d880ce521ab50e5d40 to your computer and use it in GitHub Desktop.
Oxide API v1.0
  • The oxide API will be handled by a headless service so that it's not tied to to any front end.
  • All API interaction will be over DBus.
  • By default none of the APi interfaces/services other than the general one will be registered but the main API.
  • The main API will allow requesting access to an API.
  • Library for working with the API will be released.
  • Some simple command line programs that interact with it will also be released for scripting.

Overview

  • Request API - The API will be registered on the dbus and the path provided.
  • Unrequest API - If no other connections need the API, it's service will unregister from dbus.
  • Properties
    • APIs - List of available APIs
  • Signals
    • API Available - An API is now available.
    • API No Longer Available - An API is now no longer available.

Overview

  • Register Application - Register an application entry.
  • Properties
    • Startup Application - The application to launch at startup. Only valid for applictions with a type of Foreground+Background or Foreground
    • Applications - List of registered applications.
    • Current Application - The application that is currently in the foreground.
    • Running Applications - List of applications that are currently running or paused.
  • Signals
    • Application registered - An application was registered.
    • Application unregistered - An application was removed.
    • Application launched - An application (Other than myself) was launched.
    • Application paused - An application (Other than myself) was paused.
    • Application resumed - An application (Other than myself) was resumed.
    • Application signaled - An application (Other than myself) was signalled.
    • Application exited - An application (Other than myself) has finished running.

Application

  • Launch Application - Launch an application and suspend other non-background applications (Including yourself!).
  • Pause Application - Pause or background an application.
  • Resume Application - Resumes a paused application, or brings an application into the foreground.
  • Signal Application - Send a signal to an application (Can be used to kill/stop it).
  • Unregister Applicaton - Remove an application entry.
  • Set Environment - Change the environment that an application will launch with.
  • Properties
    • Name - Name of application (Must be unique).
    • Description - Description of application.
    • Call - Executable to run to start the application.
    • Term - Code to run after killing an application.
    • Type - Type of application (Foreground, Foreground+Background, Background).
    • Auto Start In Background - If the application can be automatically started in the background on boot. Only valid for an application with a type of Foreground+Background or Background
    • Application State - Foreground, Background, Paused, or Inactive.
    • onStop - Code that will be run when stopping this application
    • onPause - Code that will be run when pausing this application
    • onResume - Code that will be run when resuming this application
    • Environment - Environment to pass on to the application
  • Signals
    • Application Launched - This application was launched.
    • Application Paused - This application was paused.
    • Application Resumed - This application was resumed.
    • Application Signaled - This application had a signal sent to it.
    • Application unregistered - This application was removed.
    • Application exited - This application has finished running.

Overview

  • Turn on wifi - Turn on the wifi chip and start attempting to connect to networks.
  • Turn off wifi - Turn off the wifi chip.
  • Add Network - Add a network so that it can be connected to.
  • Get Network - Get a network if it exists based on passed in properties.
  • Get BSS - Get a BSS if it exists based on passed in properties.
  • Scan - Scan for networks.
  • Reconnect - Attempt to reconnect to any enabled network.
  • Reassociate - Reassocitate with the current network.
  • Flush BSS Cache - Remove all BSS items
  • Add Blob - Add a blob to the interface.
  • Get Blob - Get a blob on the interface.
  • Remove Blob - Remove a blob from the interface.
  • Properties
    • Wifi state - Off, On+Disconnected, On+Connected+Offline, On+Connected+Online
    • Blobs - List of all blobs on the interface.
    • BSSs - List of BSSs that can be connected to.
    • Networks - List of registered networks.
    • Current Network - Currently connected network.
    • Link - Current link quality (0%-100%)
  • Signals
    • Network Added - A network has been registered.
    • Network Remove - A network has been removed.
    • Network Connected - We have connected to a wifi network.
    • Disconnected - We have disconnected from a wifi network.
    • BSS Found - A new BSS has been detected by a scan.
    • BSS Removed - A BSS is has dropped off the cache.

Network

  • Remove - Remove this network.
  • Connect - Attempt to connect to this network.
  • Properties
    • Enabled - If this network will automatically be associated with.
    • BSS - The BSS for this network if it's available.
    • SSID - The SSID of this network.
    • Password - The password for this network.
    • Protocol - The protocol to use for connecting to this network.
    • Properties - Network properties used by WPA_Supplicant
  • Signals
    • Properties Changed - Properties for this network have changed.
    • Connected - We have connected to this network.
    • Disconnected - We have disconnected from this network.
    • Removed - This network has been removed.
    • State Change - This network has been enabled or disabled.

BSS

  • Connect - Register a BSS as a network and attempt to connect.
  • Properties
    • BSSID
    • SSID
    • Privacy
    • Frequency
    • Network - If this BSS is registered as a network, retrieve it's path.
  • Signals
    • Properties Changed - Properties for this BSS have changed.
    • Removed - This BSS has dropped off the cache.

Overview

  • Properties
    • Power State - The power state applications should be trying to optimize for (Normal or Power Saving).
    • Battery State - Charging, Discharging, Not Present, or Unknown.
    • Battery Level - Percentage of battery remaining.
    • Battery Temperature - Current temperature of the battery.
    • Charger State - Connected, Disconnected, Not Present, or Unknown
  • Signals
    • Battery state changed - The battery state has changed (Don't trust this for if the battery is plugged in).
    • Battery level changed - The battery level has changed.
    • Battery Temperature changed - The battery temperature has changed.
    • Battery warning - There is a new warning on the battery.
    • Battery alert - There is a new alert on the battery. Likely that the capacity is at an extremely low level.
    • Charger state changed - The charger state has changed.
    • Charger warning - There is a new warning on the Charger.
    • Power state changed - Power state was changed. Applications should respond to this by disabling or enabling features depending on the state.

Overview

  • Take Screenshot - Take a screenshot of the screen.
  • Add Screenshot - Add a "screenshot" provided by another application. This can be used to clone a screenshot.
  • List Screenshots - Get a list of screenshots on the device.
  • Signals
    • Screenshot Added - A screenshot has been taken and is now available.
    • Screenshot Removed - A screenshot has been removed from the device.
    • Screenshot Modified - A screenshot has been modified.

Screenshot

  • Remove - Delete a screenshot from the device.
  • Properties
    • Blob - The data of the screenshot.
    • Path - The path to the screenshot on disk.
  • Signals
    • Removed - This screenshot was removed from the device.
    • Modified - This screenshot was modified.

Overview

  • Add Notification - Create and display a new notification.
  • Get Notification - Get a path to an existing notification based on an external identifier.
  • Take Ownership of Notification - Register an existing notification as being owned by "your" application.
  • Properties
    • Notifications - List of notifications that the current application owns.
    • All Notifications - List of notifications from all applications.
    • Unowned Notifications - List of notifications where they are no longer owned by an application (It exited before removing them).
  • Signals
    • Notification Added - A new notification was created.
    • Notification Removed - A notification was removed.
    • Notification Changed - A notificaiton was changed.

Notification

  • Display - Display the notification overtop of the running application (by pausing it).
  • Remove - Remove a notification.
  • Properties
    • Application - Name of the application that owns this notification.
    • Text - Text content of the applicaation.
    • Icon - Icon to display with the notification.
  • Signals
    • Changed - Properties on this notification have changed.
    • Removed - This notificion has been removed.
    • Displayed - This notification was displayed to the user.
    • Clicked - This notification was clicked by a user. When this happens, the owning application will be unpaused, or launched.

Overview

  • Power off - Shut down system.
  • Suspend - Suspend the system.
  • Inhibit sleep - Don't allow allow sleep to happen.
  • Uninhibit sleep - Remove inhibitor on sleep.
  • Inhibit power off - Don't allow power offs to happen.
  • Uninhibit power off - Remove inhibitor on power off.
  • Activity - Register that activity has happend and that auto sleep should not happen.
  • Properties
    • autoSleep - How many minutes of inactivity before the system should automatically suspend.
    • sleepInhibited - If an application has installed a sleep inhibitor.
    • powerOffInhibited - If an application has installed a power off inhibitor.
  • Signals
    • Home Action - The home button was long pressed.
    • Left Action - The left button was long pressed.
    • Right Action - The right button was long pressed.
    • Power Action - The power button was long pressed.
@Eeems
Copy link
Author

Eeems commented Sep 9, 2020

@torwag I just updated the API with properties flushed out a bit more. You might want to update your API proposal in a simlar format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment