|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // 電源周り
9: //
10:
11: #pragma once
12:
13: #include "device.h"
14: #include "message.h"
15:
16: class PowerDevice : public Device
17: {
18: using inherited = Device;
19: public:
20: PowerDevice();
21: ~PowerDevice() override;
22:
23: bool Init() override;
24:
25: // 電源オンを指示
26: // (当然電源オフ時に呼ぶので VM スレッド外から呼ばれることになる)
27: void MakePowerOn();
28:
29: // リセットを指示
30: // (どのスレッドから呼んでもよい)
31: void MakeResetHard();
32:
33: // 電源オフして終了を指示
34: // (どのスレッドから呼んでもよい)
35: void MakePowerOffExit();
36:
37: // リスタートを指示
38: // (どのスレッドから呼んでもよい)
39: void MakeRestart();
40:
41: // 電源オンなら true を返す。
42: bool IsPower() const { return ispower; }
43:
44: private:
45: void DoPowerOn();
46: void DoResetHard();
47: void DoPowerOff(MessageID);
48:
49: // メッセージコールバック
50: void PowerOnCallback(MessageID, uint32);
51: void ResetCallback(MessageID, uint32);
52: void PowerOffCallback(MessageID, uint32);
53:
54: // 電源オンなら true
55: bool ispower {};
56: };
57:
58: extern PowerDevice *gPower;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.