keyboardio/Kaleidoscope-HostOS

Name: Kaleidoscope-HostOS

Owner: Keyboardio

Description: Host OS detection and tracking for Kaleidoscope

Created: 2017-01-16 14:28:30.0

Updated: 2018-05-15 05:09:38.0

Pushed: 2018-05-15 05:09:39.0

Homepage:

Size: 38

Language: C++

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Kaleidoscope-HostOS

status Build Status

The HostOS extension is not all that useful in itself, rather, it is a building block other plugins and extensions can use to not repeat the same guesswork and logic. Its primary purpose is to help either detect, or keep track of the host operating system. The detection part is not the most reliable thing, mind you.

The goal is to have a single place that remembers the host OS, either detected, or set by the end-user, in a Sketch, or via a macro, or some other way. This information can then be reused by other plugins.

See the Unicode extension for an example about how to use HostOS in practice.

Using the extension

The extension provides a HostOS singleton object. It can either be a simple one without auto-detection (the default), or one that will try to detect the Host OS, using the FingerprintUSBHost library. To enable auto-detection, KALEIDOSCOPE_HOSTOS_GUESSER must be defined before including the HostOS library header.

ine KALEIDOSCOPE_HOSTOS_GUESSER 1

lude <Kaleidoscope.h>
lude <Kaleidoscope-HostOS.h>
lude <Kaleidoscope/HostOS-select.h>

 someFunction(void) {
 (HostOS.os() == kaleidoscope::hostos::LINUX) {
// do something linux-y

 (HostOS.os() == kaleidoscope::hostos::OSX) {
// do something OSX-y



 setup(void) {
leidoscope.use(&HostOS);

leidoscope.setup ();

To be able to choose between the two variants, one must also include the Kaleidoscope/HostOS-select.h header.

Extension methods

The extension provides the following methods on the HostOS singleton:

.os()

Returns the stored type of the Host OS.

.os(type)

Sets the type of the host OS, overriding any previous value. The type is then stored in EEPROM for persistence.

Host OS Values

The OS type (i.e. the return type of .os() and the arguments to .os(type)) will be one of the following:

Dependencies
Further reading

Starting from the example is the recommended way of getting started with the extension.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.