Kaleidoscope
HostOS-Base.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*-
2  * Kaleidoscope-HostOS -- Host OS detection and tracking for Kaleidoscope
3  * Copyright (C) 2016, 2017 Gergely Nagy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 #include <Kaleidoscope.h>
22 
23 namespace kaleidoscope {
24 namespace hostos {
25 
26 typedef enum {
28  OSX,
31 
32  AUTO = 0xff,
33 } Type;
34 
35 class Base : public KaleidoscopePlugin {
36  public:
37  void begin(void) final;
38 
39  Type os(void);
40  void os(Type new_os);
41 
42  static bool focusHook(const char *command);
43 
44  protected:
45  virtual void autoDetect(void) {}
47 
48  private:
49  uint16_t eeprom_slice_;
50  bool is_configured_ = false;
51 };
52 
53 }
54 }
55 
57 
58 #define FOCUS_HOOK_HOSTOS FOCUS_HOOK(HostOS.focusHook, "hostos.type")
Type
Definition: HostOS-Base.h:26
virtual void autoDetect(void)
Definition: HostOS-Base.h:45
Definition: hid.cpp:4
kaleidoscope::hostos::Base HostOS
Definition: HostOS-select.h:27
Definition: HostOS-Base.h:27
Definition: HostOS-Base.h:29
Definition: HostOS-Base.h:35
Type os_
Definition: HostOS-Base.h:46
Definition: HostOS-Base.h:32
static bool focusHook(const char *command)
Definition: HostOS-Base.cpp:57
Type os(void)
Definition: HostOS-Base.cpp:45
Definition: Kaleidoscope.h:40
Definition: HostOS-Base.h:28
Definition: HostOS-Base.h:30
void begin(void) final
Definition: HostOS-Base.cpp:27