Annotation of nono/vm/lunakbd.h, revision 1.1.1.13

1.1       root        1: //
                      2: // nono
1.1.1.3   root        3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
1.1.1.11  root        7: //
                      8: // LUNA のキーボードとマウス
                      9: //
                     10: 
1.1       root       11: #pragma once
                     12: 
                     13: #include "keyboard.h"
1.1.1.11  root       14: #include "event.h"
1.1.1.8   root       15: #include "monitor.h"
1.1       root       16: 
1.1.1.12  root       17: class SIODevice;
                     18: 
1.1       root       19: class LunaKeyboard : public Keyboard
                     20: {
1.1.1.3   root       21:        using inherited = Keyboard;
1.1       root       22:  public:
                     23:        LunaKeyboard();
1.1.1.13! root       24:        ~LunaKeyboard() override;
1.1       root       25: 
1.1.1.12  root       26:        bool Init() override;
                     27: 
1.1.1.7   root       28:        // シフト状態なら true を返す
                     29:        bool IsShift() const override;
                     30: 
1.1.1.2   root       31:        // マウス入力
1.1.1.3   root       32:        void MouseInput(int x, int y, bool rb, bool lb, bool mb) override;
                     33: 
1.1.1.9   root       34:        // マウスデータを VM に送信する MD 処理
                     35:        void MouseSendStart() override;
                     36: 
1.1.1.3   root       37:        // ホストからの制御コマンド
                     38:        void Command(uint32 data) override;
1.1       root       39: 
                     40:  private:
1.1.1.11  root       41:        // キーボードの接続と取り外し
                     42:        void MDConnect() override;
                     43:        void MDDisconnect() override;
                     44: 
1.1.1.7   root       45:        // MD キーコードに変換
1.1.1.10  root       46:        uint KeyToMDKey(uint keystat) const override;
1.1.1.7   root       47: 
1.1.1.8   root       48:        // キーを1つ処理する
                     49:        void KeyInput(uint keystat) override;
1.1.1.3   root       50: 
1.1.1.7   root       51:        // キーイベントを起こせる空きスロットを計算して、イベントを開始
                     52:        void SendStart() override;
1.1.1.2   root       53: 
1.1.1.10  root       54:        // イベントを開始
                     55:        void Start(uint64 period);
                     56: 
                     57:        // コールバック
                     58:        void Callback(Event& ev);
1.1.1.2   root       59: 
1.1.1.7   root       60:        // 共通キーコードから LED 番号を取得。
1.1.1.3   root       61:        // 0: かな
                     62:        // 1: CAPS
1.1.1.7   root       63:        int Keycode2LED(uint keycode) const;
1.1.1.10  root       64:        // LED 番号から共通キーコードを取得。
                     65:        uint LED2Keycode(int ledcode) const;
                     66: 
                     67:        // マウスサンプリング
                     68:        void MouseSampling();
                     69:        void MouseOn();
                     70:        void MouseOff();
1.1.1.3   root       71: 
1.1.1.8   root       72:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                     73: 
1.1.1.10  root       74:        // マウスサンプリング
                     75:        bool mouse_on {};
1.1.1.2   root       76: 
1.1.1.10  root       77:        // ブザー
                     78:        uint buzzer_msec {};            // コマンドで指定した発音時間 [msec]
                     79:        uint buzzer_freq {};            // コマンドで指定した発音周波数 [Hz]
                     80:        uint64 buzzer_end {};           // ブザーを鳴らし終わる仮想時刻
                     81: 
                     82:        // イベント
                     83:        Event event { this };
1.1.1.2   root       84: 
1.1.1.8   root       85:        Monitor monitor { this };
                     86: 
1.1.1.12  root       87:        SIODevice *sio {};
                     88: 
1.1       root       89:        // 変換テーブル
1.1.1.10  root       90:        static const uint keycode2lunakey_table[KC_max];
1.1       root       91: 
                     92:        // LUNA キーコード
                     93:        static const uint NoKey                                 = 0;
                     94:        static const uint LunaKey_TAB                   = 0x09;
                     95:        static const uint LunaKey_CTRL                  = 0x0a;
                     96:        static const uint LunaKey_kana                  = 0x0b;
                     97:        static const uint LunaKey_SHIFT_L               = 0x0c;
                     98:        static const uint LunaKey_SHIFT_R               = 0x0d;
                     99:        static const uint LunaKey_CAPS                  = 0x0e;
                    100:        static const uint LunaKey_SF                    = 0x0f;
                    101: 
                    102:        static const uint LunaKey_ESC                   = 0x10;
                    103:        static const uint LunaKey_BS                    = 0x11;
                    104:        static const uint LunaKey_enter                 = 0x12;
                    105:        static const uint LunaKey_space                 = 0x14;
                    106:        static const uint LunaKey_DEL                   = 0x15;
                    107:        static const uint LunaKey_XFER                  = 0x16;
                    108:        static const uint LunaKey_VALID                 = 0x17;
                    109:        static const uint LunaKey_PF11                  = 0x18;
                    110:        static const uint LunaKey_PF12                  = 0x19;
                    111:        static const uint LunaKey_PF13                  = 0x1a;
                    112:        static const uint LunaKey_PF14                  = 0x1b;
                    113:        static const uint LunaKey_up                    = 0x1c;
                    114:        static const uint LunaKey_left                  = 0x1d;
                    115:        static const uint LunaKey_right                 = 0x1e;
                    116:        static const uint LunaKey_down                  = 0x1f;
                    117: 
                    118:        static const uint LunaKey_1                             = 0x22;
                    119:        static const uint LunaKey_2                             = 0x23;
                    120:        static const uint LunaKey_3                             = 0x24;
                    121:        static const uint LunaKey_4                             = 0x25;
                    122:        static const uint LunaKey_5                             = 0x26;
                    123:        static const uint LunaKey_6                             = 0x27;
                    124:        static const uint LunaKey_7                             = 0x28;
                    125:        static const uint LunaKey_8                             = 0x29;
                    126:        static const uint LunaKey_9                             = 0x2a;
                    127:        static const uint LunaKey_0                             = 0x2b;
                    128:        static const uint LunaKey_minus                 = 0x2c;
                    129:        static const uint LunaKey_circum                = 0x2d;
                    130:        static const uint LunaKey_backslash             = 0x2e;
1.1.1.12  root      131:        static const uint LunaKey_buzzer                = 0x2f;
1.1       root      132: 
                    133:        static const uint LunaKey_Q                             = 0x32;
                    134:        static const uint LunaKey_W                             = 0x33;
                    135:        static const uint LunaKey_E                             = 0x34;
                    136:        static const uint LunaKey_R                             = 0x35;
                    137:        static const uint LunaKey_T                             = 0x36;
                    138:        static const uint LunaKey_Y                             = 0x37;
                    139:        static const uint LunaKey_U                             = 0x38;
                    140:        static const uint LunaKey_I                             = 0x39;
                    141:        static const uint LunaKey_O                             = 0x3a;
                    142:        static const uint LunaKey_P                             = 0x3b;
                    143:        static const uint LunaKey_at                    = 0x3c;
                    144:        static const uint LunaKey_bracketleft   = 0x3d;
                    145: 
                    146:        static const uint LunaKey_A                             = 0x42;
                    147:        static const uint LunaKey_S                             = 0x43;
                    148:        static const uint LunaKey_D                             = 0x44;
                    149:        static const uint LunaKey_F                             = 0x45;
                    150:        static const uint LunaKey_G                             = 0x46;
                    151:        static const uint LunaKey_H                             = 0x47;
                    152:        static const uint LunaKey_J                             = 0x48;
                    153:        static const uint LunaKey_K                             = 0x49;
                    154:        static const uint LunaKey_L                             = 0x4a;
                    155:        static const uint LunaKey_semicolon             = 0x4b;
                    156:        static const uint LunaKey_colon                 = 0x4c;
                    157:        static const uint LunaKey_bracketright  = 0x4d;
                    158: 
                    159:        static const uint LunaKey_Z                             = 0x52;
                    160:        static const uint LunaKey_X                             = 0x53;
                    161:        static const uint LunaKey_C                             = 0x54;
                    162:        static const uint LunaKey_V                             = 0x55;
                    163:        static const uint LunaKey_B                             = 0x56;
                    164:        static const uint LunaKey_N                             = 0x57;
                    165:        static const uint LunaKey_M                             = 0x58;
                    166:        static const uint LunaKey_comma                 = 0x59;
                    167:        static const uint LunaKey_period                = 0x5a;
                    168:        static const uint LunaKey_slash                 = 0x5b;
                    169:        static const uint LunaKey_underscore    = 0x5c;
                    170: 
                    171:        static const uint LunaKey_PAD_plus              = 0x61;
                    172:        static const uint LunaKey_PAD_minus             = 0x62;
                    173:        static const uint LunaKey_PAD_7                 = 0x63;
                    174:        static const uint LunaKey_PAD_8                 = 0x64;
                    175:        static const uint LunaKey_PAD_9                 = 0x65;
                    176:        static const uint LunaKey_PAD_4                 = 0x66;
                    177:        static const uint LunaKey_PAD_5                 = 0x67;
                    178:        static const uint LunaKey_PAD_6                 = 0x68;
                    179:        static const uint LunaKey_PAD_1                 = 0x69;
                    180:        static const uint LunaKey_PAD_2                 = 0x6a;
                    181:        static const uint LunaKey_PAD_3                 = 0x6b;
                    182:        static const uint LunaKey_PAD_0                 = 0x6c;
                    183:        static const uint LunaKey_PAD_decimal   = 0x6d;
                    184:        static const uint LunaKey_PAD_enter             = 0x6e;
                    185: 
                    186:        static const uint LunaKey_F1                    = 0x72;
                    187:        static const uint LunaKey_F2                    = 0x73;
                    188:        static const uint LunaKey_F3                    = 0x74;
                    189:        static const uint LunaKey_F4                    = 0x75;
                    190:        static const uint LunaKey_F5                    = 0x76;
                    191:        static const uint LunaKey_F6                    = 0x77;
                    192:        static const uint LunaKey_F7                    = 0x78;
                    193:        static const uint LunaKey_F8                    = 0x79;
                    194:        static const uint LunaKey_F9                    = 0x7a;
                    195:        static const uint LunaKey_F10                   = 0x7b;
                    196:        static const uint LunaKey_PAD_multiply  = 0x7c;
                    197:        static const uint LunaKey_PAD_divide    = 0x7d;
                    198:        static const uint LunaKey_PAD_equal             = 0x7e;
                    199:        static const uint LunaKey_PAD_comma             = 0x7f;
                    200: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.